:root {
  --tt-gold: #f4b400;
  --tt-gold-dark: #bd8700;
  --tt-ink: #111111;
  --tt-text: #232323;
  --tt-muted: #656565;
  --tt-bg: #f4f5f7;
  --tt-panel: #ffffff;
  --tt-line: #dedede;
  --tt-soft: #f9fafb;
  --tt-ok: #147d4f;
  --tt-warn: #a15c00;
  --tt-bad: #b42318;
  --tt-focus: rgba(244, 180, 0, .32);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-height: 100%;
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--tt-text);
  background: var(--tt-bg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
}

.admin-login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 14px;
  background:
    linear-gradient(135deg, rgba(0, 0, 0, .86), rgba(24, 24, 24, .72)),
    url("../../assets/bg-900x900.webp") center / cover fixed;
}

.login-box {
  width: min(100%, 430px);
  background: rgba(255, 255, 255, .98);
  border: 1px solid rgba(255, 255, 255, .55);
  border-radius: 8px;
  box-shadow: 0 22px 60px rgba(0, 0, 0, .34);
  padding: 24px;
}

.login-brand,
.admin-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.login-brand img,
.admin-brand img {
  width: 52px;
  height: 52px;
  object-fit: contain;
  border-radius: 8px;
}

.login-brand h1,
.admin-title h1 {
  margin: 0;
  color: var(--tt-ink);
  font-size: 22px;
  line-height: 1.15;
}

.login-brand span,
.admin-title span,
.field-hint,
.status-line {
  color: var(--tt-muted);
  font-size: 13px;
}

.login-form,
.form-grid,
.stack {
  display: grid;
  gap: 12px;
}

.login-form {
  margin-top: 22px;
}

.field {
  display: grid;
  gap: 6px;
}

.field label,
.check-field span {
  color: #242424;
  font-size: 13px;
  font-weight: 700;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid #cfcfcf;
  border-radius: 8px;
  background: #fff;
  color: var(--tt-text);
  padding: 10px 12px;
  outline: none;
}

.field textarea {
  min-height: 96px;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--tt-gold-dark);
  box-shadow: 0 0 0 4px var(--tt-focus);
}

.check-field {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.check-field input {
  width: 20px;
  height: 20px;
  accent-color: var(--tt-gold);
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.btn {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 10px 14px;
  font-weight: 800;
  text-decoration: none;
}

.btn-primary {
  background: var(--tt-gold);
  color: #111;
}

.btn-primary:active {
  background: var(--tt-gold-dark);
}

.btn-secondary {
  background: #111;
  color: #fff;
}

.btn-ghost {
  background: #fff;
  color: #111;
  border-color: #d9d9d9;
}

.btn-danger {
  background: #fff4f2;
  color: var(--tt-bad);
  border-color: #ffd1ca;
}

.btn-small {
  min-height: 34px;
  padding: 7px 10px;
  font-size: 12px;
}

.btn:disabled {
  cursor: wait;
  opacity: .64;
}

.status {
  min-height: 24px;
  color: var(--tt-muted);
  font-size: 14px;
}

.status.is-error {
  color: var(--tt-bad);
}

.status.is-ok {
  color: var(--tt-ok);
}

.admin-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
}

.admin-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 18px;
  color: #fff;
  background: #111;
}

.admin-brand h1,
.admin-brand span {
  color: #fff;
}

.admin-brand img {
  box-shadow: 0 10px 28px rgba(0, 0, 0, .32);
}

.admin-nav {
  display: grid;
  gap: 8px;
}

.nav-link {
  display: flex;
  align-items: center;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 8px;
  color: #fff;
  text-decoration: none;
}

.nav-link.is-active {
  background: var(--tt-gold);
  color: #111;
  border-color: var(--tt-gold);
  font-weight: 800;
}

.sidebar-footer {
  margin-top: auto;
  display: grid;
  gap: 8px;
}

.admin-main {
  min-width: 0;
  padding: 22px;
}

.admin-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.admin-title h1 {
  font-size: 28px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.metric {
  min-height: 76px;
  display: grid;
  align-content: center;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--tt-line);
  border-radius: 8px;
  background: var(--tt-panel);
}

.metric strong {
  color: var(--tt-ink);
  font-size: 24px;
}

.metric span {
  color: var(--tt-muted);
  font-size: 12px;
  font-weight: 700;
}

.tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.tab-button {
  min-height: 40px;
  border: 1px solid var(--tt-line);
  border-radius: 8px;
  background: #fff;
  color: #222;
  padding: 8px 12px;
  font-weight: 800;
}

.tab-button.is-active {
  border-color: var(--tt-gold);
  background: var(--tt-gold);
  color: #111;
}

.panel {
  border: 1px solid var(--tt-line);
  border-radius: 8px;
  background: var(--tt-panel);
  box-shadow: 0 12px 32px rgba(10, 10, 10, .05);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--tt-line);
}

.panel-header h2 {
  margin: 0;
  color: var(--tt-ink);
  font-size: 18px;
}

.panel-body {
  padding: 16px;
}

.form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-grid .wide {
  grid-column: 1 / -1;
}

.inline-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.result-box {
  min-height: 74px;
  max-height: 280px;
  overflow: auto;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid #d8dce0;
  border-radius: 8px;
  background: #fbfcfd;
  color: #222;
  font-size: 13px;
  white-space: pre-wrap;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th,
td {
  padding: 10px 8px;
  border-bottom: 1px solid #ececec;
  text-align: left;
  vertical-align: top;
}

th {
  color: #333;
  background: var(--tt-soft);
  font-size: 12px;
  text-transform: uppercase;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 3px 8px;
  background: #f2f2f2;
  color: #222;
  font-size: 12px;
  font-weight: 800;
}

.pill.ok {
  background: #e8f7ef;
  color: var(--tt-ok);
}

.pill.bad {
  background: #fff0ed;
  color: var(--tt-bad);
}

.pill.warn {
  background: #fff6db;
  color: var(--tt-warn);
}

.image-preview {
  width: 100%;
  max-width: 360px;
  aspect-ratio: 2 / 1;
  border: 1px solid var(--tt-line);
  border-radius: 8px;
  background: #f2f2f2 center / cover no-repeat;
}

.phone-preview {
  width: min(100%, 330px);
}

.phone-shell {
  position: relative;
  width: 100%;
  aspect-ratio: 946 / 2048;
  box-sizing: border-box;
  padding: 5px;
  border-radius: 30px;
  background: #090909;
  box-shadow: 0 20px 48px rgba(0, 0, 0, .22), inset 0 0 0 1px rgba(255, 255, 255, .08);
}

.phone-screen {
  position: relative;
  height: 100%;
  overflow: hidden;
  border-radius: 24px;
  isolation: isolate;
  background: url("fundo_xiaomi.jpg") center top / cover no-repeat;
}

.phone-screen::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, .04) 0%, rgba(0, 0, 0, .02) 52%, rgba(0, 0, 0, .28) 100%);
  pointer-events: none;
}

.phone-screen::after {
  display: none;
}

.phone-camera {
  position: absolute;
  left: 50%;
  top: 17px;
  z-index: 4;
  width: 14px;
  height: 14px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: #050505;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .08);
}

.phone-shade {
  position: absolute;
  z-index: 3;
  left: 10px;
  right: 10px;
  top: 42px;
}

.push-card {
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 24px;
  background: rgba(15, 17, 20, .92);
  color: rgba(245, 245, 245, .92);
  padding: 12px 14px 14px;
  box-shadow: 0 16px 42px rgba(0, 0, 0, .34);
  backdrop-filter: blur(8px);
}

.push-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  color: rgba(238, 238, 238, .68);
  font-size: 14px;
  font-weight: 500;
}

.push-app {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.push-icon {
  width: 31px;
  height: 31px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #ffc51e;
  overflow: hidden;
}

.push-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.push-meta {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 9px;
  color: rgba(244, 244, 248, .72);
  font-size: 18px;
  line-height: 1;
  white-space: nowrap;
}

.push-meta-dot {
  width: 6px;
  height: 6px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: rgba(255, 255, 255, .72);
}

.push-collapse {
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, .12);
  color: rgba(255, 255, 255, .78);
  font-size: 0;
  font-weight: 300;
  line-height: 1;
  font-family: Arial, Helvetica, sans-serif;
}

.push-collapse::before {
  content: ">";
  display: block;
  font-size: 21px;
  line-height: 1;
  transform: rotate(-90deg) scaleX(.85);
  transform-origin: center;
}

.push-content {
  min-width: 0;
}

.push-content strong {
  display: block;
  margin-bottom: 7px;
  color: rgba(255, 255, 255, .94);
  font-size: 20px;
  line-height: 1.25;
  word-break: break-word;
  font-weight: 500;
}

.push-content p {
  margin: 0;
  color: rgba(245, 245, 245, .74);
  font-size: 16px;
  line-height: 1.35;
  word-break: break-word;
}

.push-media {
  position: relative;
  width: 100%;
  aspect-ratio: 2 / 1;
  margin-top: 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, .08);
  overflow: hidden;
}

.push-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
}

.section-label {
  margin-bottom: 8px;
  color: #242424;
  font-size: 13px;
  font-weight: 800;
}

.permission-grid {
  display: grid;
  gap: 10px;
}

.permission-area {
  border: 1px solid var(--tt-line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}

.permission-area h3 {
  margin: 0 0 10px;
  color: var(--tt-ink);
  font-size: 15px;
}

.permission-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.permission-actions label {
  min-height: 36px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #e7e7e7;
  border-radius: 8px;
  padding: 7px 9px;
  background: #fbfbfb;
  color: #2b2b2b;
  font-size: 12px;
  font-weight: 800;
}

.permission-actions input {
  width: 17px;
  height: 17px;
  accent-color: var(--tt-gold);
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.choice-grid.compact {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.choice-list {
  display: grid;
  gap: 8px;
  max-height: 260px;
  overflow: auto;
  padding: 8px;
  border: 1px solid var(--tt-line);
  border-radius: 8px;
  background: #fff;
}

.choice-item {
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px solid #e8e8e8;
  border-radius: 8px;
  padding: 8px 10px;
  background: #fbfbfb;
  color: #242424;
  font-size: 13px;
  font-weight: 800;
}

.choice-item small {
  display: block;
  color: var(--tt-muted);
  font-size: 12px;
  font-weight: 600;
}

.choice-item input {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  accent-color: var(--tt-gold);
}

.choice-filter {
  margin-bottom: 8px;
}

.send-model-picker {
  margin-top: -4px;
  padding: 12px;
  border: 1px solid var(--tt-line);
  border-radius: 8px;
  background: #fff;
}

.send-model-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.send-model-card {
  width: 100%;
  min-height: 118px;
  display: grid;
  gap: 5px;
  align-content: start;
  text-align: left;
  border: 1px solid #e6e6e6;
  border-radius: 8px;
  padding: 10px;
  background: #fbfbfb;
  color: #222;
  cursor: pointer;
}

.send-model-card:hover,
.send-model-card.is-selected {
  border-color: #d6a914;
  background: #fff8df;
}

.send-model-card-title {
  color: #1d1d1d;
  font-size: 13px;
  font-weight: 900;
}

.send-model-card-key,
.send-model-card-message {
  color: var(--tt-muted);
  font-size: 12px;
  line-height: 1.35;
}

.send-model-card strong {
  color: var(--tt-ink);
  font-size: 13px;
  line-height: 1.25;
}

.row-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

tr[data-model-row] {
  cursor: pointer;
}

tr[data-model-row].is-selected td {
  background: #fff8df;
}

.model-preview-wrap {
  display: grid;
  justify-items: start;
  gap: 8px;
}

@media (max-width: 980px) {
  .admin-shell {
    grid-template-columns: 1fr;
  }

  .admin-sidebar {
    position: static;
    height: auto;
  }

  .admin-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sidebar-footer {
    margin-top: 0;
  }

  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .inline-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .permission-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .choice-grid,
  .choice-grid.compact,
  .send-model-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .login-box {
    padding: 18px;
  }

  .admin-main {
    padding: 14px;
  }

  .admin-topbar,
  .panel-header {
    align-items: stretch;
    flex-direction: column;
  }

  .admin-title h1 {
    font-size: 23px;
  }

  .metric-grid,
  .form-grid,
  .inline-grid,
  .admin-nav {
    grid-template-columns: 1fr;
  }

  .btn-row .btn,
  .tabs .tab-button {
    flex: 1 1 auto;
  }

  th,
  td {
    padding: 9px 7px;
  }

  .permission-actions {
    grid-template-columns: 1fr;
  }

  .choice-grid,
  .choice-grid.compact,
  .send-model-list {
    grid-template-columns: 1fr;
  }
}
