/* =========================================================
   THE TALENT GRID - BRAND CONSISTENT STYLE.CSS
   Voice Assistant + RBAC + Subscription + Admin Metrics
========================================================= */

* {
  box-sizing: border-box;
}

:root {
  --font-scale: 1;
  --editor-font-scale: 1;

  /* The Talent Grid Brand Palette */
  --tg-navy: #07111f;
  --tg-deep-navy: #0b1220;
  --tg-card: #111827;
  --tg-card-soft: #172033;

  --tg-blue: #159bd3;
  --tg-cyan: #18b6c9;
  --tg-teal: #24b6a8;
  --tg-green: #93d84e;
  --tg-yellow: #eadb20;
  --tg-orange: #f17328;
  --tg-purple: #6c2eb9;
  --tg-magenta: #9b2fae;

  --tg-light-bg: #f3f7fb;
  --tg-white: #ffffff;
  --tg-muted: #94a3b8;
  --tg-text: #111827;
  --tg-soft-border: rgba(255, 255, 255, 0.12);

  --tg-gradient: linear-gradient(
    135deg,
    #159bd3 0%,
    #18b6c9 20%,
    #93d84e 42%,
    #eadb20 58%,
    #f17328 76%,
    #6c2eb9 100%
  );

  --tg-gradient-soft: linear-gradient(
    135deg,
    rgba(21, 155, 211, 0.18),
    rgba(147, 216, 78, 0.18),
    rgba(241, 115, 40, 0.18),
    rgba(108, 46, 185, 0.18)
  );

  --tg-shadow: 0 22px 60px rgba(7, 17, 31, 0.22);
  --tg-shadow-soft: 0 10px 28px rgba(7, 17, 31, 0.12);
  --tg-radius: 18px;
  --tg-radius-lg: 26px;
}

/* =========================================================
   BASE
========================================================= */

html,
body {
  margin: 0;
  padding: 0;
  font-family: Inter, Arial, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(21, 155, 211, 0.14), transparent 34%),
    radial-gradient(circle at top right, rgba(241, 115, 40, 0.12), transparent 30%),
    radial-gradient(circle at bottom right, rgba(108, 46, 185, 0.14), transparent 36%),
    var(--tg-light-bg);
  color: var(--tg-text);
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

.hidden {
  display: none !important;
}

button,
a.download-btn {
  border: 0;
  border-radius: 14px;
  padding: 10px 15px;
  background: var(--tg-gradient);
  color: #ffffff;
  cursor: pointer;
  text-decoration: none;
  font-weight: 800;
  white-space: nowrap;
  box-shadow: 0 10px 24px rgba(21, 155, 211, 0.22);
  transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

button:hover,
a.download-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 30px rgba(108, 46, 185, 0.22);
}

button:active,
a.download-btn:active {
  transform: translateY(0);
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

input,
select {
  border: 1px solid #d8e1ef;
  border-radius: 14px;
  padding: 10px 12px;
  background: #ffffff;
  color: var(--tg-text);
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

input:focus,
select:focus {
  border-color: var(--tg-blue);
  box-shadow: 0 0 0 4px rgba(21, 155, 211, 0.14);
}

.ghost-btn {
  background: #ffffff;
  color: var(--tg-deep-navy);
  border: 1px solid #d8e1ef;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.07);
}

.ghost-btn:hover {
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.12);
}

.muted {
  color: #64748b;
}

.notice {
  margin-top: 10px;
  color: #b45309;
}

/* =========================================================
   AUTH + SUBSCRIPTION
========================================================= */

.auth-shell,
.subscription-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
  background:
    radial-gradient(circle at 20% 20%, rgba(21, 155, 211, 0.22), transparent 28%),
    radial-gradient(circle at 80% 24%, rgba(234, 219, 32, 0.18), transparent 26%),
    radial-gradient(circle at 80% 82%, rgba(108, 46, 185, 0.18), transparent 32%),
    var(--tg-deep-navy);
}

.auth-card,
.subscription-card {
  width: min(480px, 96vw);
  background: rgba(255, 255, 255, 0.96);
  border-radius: var(--tg-radius-lg);
  padding: 30px;
  box-shadow: var(--tg-shadow);
  border: 1px solid rgba(255, 255, 255, 0.35);
  position: relative;
  overflow: hidden;
}

.auth-card::before,
.subscription-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 6px;
  background: var(--tg-gradient);
}

.auth-card h1,
.auth-card h2,
.subscription-card h1,
.subscription-card h2 {
  color: var(--tg-deep-navy);
  margin-top: 0;
}

.tabs {
  display: flex;
  gap: 10px;
  margin: 18px 0;
  background: #edf3f8;
  padding: 6px;
  border-radius: 16px;
}

.tabs button {
  flex: 1;
  background: transparent;
  color: var(--tg-deep-navy);
  box-shadow: none;
}

.tabs button.active {
  background: var(--tg-gradient);
  color: #ffffff;
  box-shadow: 0 10px 24px rgba(21, 155, 211, 0.22);
}

.form-stack {
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.small-note {
  font-size: 12px;
  color: #64748b;
}

/* =========================================================
   TOP ACCOUNT BAR
========================================================= */

.top-account-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 18px;
  background:
    linear-gradient(90deg, rgba(7, 17, 31, 0.98), rgba(15, 23, 42, 0.96)),
    var(--tg-deep-navy);
  color: #ffffff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  min-height: 64px;
}

.top-account-bar strong,
.top-account-bar b {
  color: #ffffff;
}

.top-account-bar .muted,
.top-account-bar small {
  color: #cbd5e1;
}

.account-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

/* =========================================================
   MAIN APP LAYOUT
========================================================= */

.app {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  height: calc(100vh - 64px);
  min-height: 0;
  max-width: 100%;
  overflow: hidden;
}

.sidebar {
  background:
    radial-gradient(circle at top left, rgba(21, 155, 211, 0.18), transparent 34%),
    linear-gradient(180deg, #07111f 0%, #101827 58%, #111827 100%);
  color: #ffffff;
  padding: 15px;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar input {
  width: 100%;
}

.sidebar-header,
.toolbar,
.statusbar,
.mode-row,
.btn-row,
.toggle-line {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-header {
  justify-content: space-between;
}

.sidebar-header h2 {
  margin: 0;
  font-size: 20px;
  letter-spacing: -0.02em;
}

.search-wrap {
  margin-top: 18px;
}

.conversation-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin: 12px 0;
}

.conv-item {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  text-align: left;
  padding: 13px;
  border-radius: 16px;
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: none;
}

.conv-item:hover {
  background: rgba(255, 255, 255, 0.12);
  transform: translateY(-1px);
}

.conv-item.active {
  outline: 2px solid var(--tg-cyan);
  background:
    linear-gradient(135deg, rgba(21, 155, 211, 0.22), rgba(108, 46, 185, 0.18)),
    rgba(255, 255, 255, 0.1);
}

.conv-item-title {
  font-weight: 900;
}

.conv-status,
.conv-updated {
  font-size: 12px;
  color: #cbd5e1;
  margin-top: 4px;
}

.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  padding: 14px;
  gap: 10px;
  overflow: hidden;
  max-width: 100%;
}

.toolbar {
  flex: 0 0 auto;
  flex-wrap: wrap;
}

.toolbar input {
  flex: 1;
  min-width: 220px;
}

.statusbar,
.mode-row {
  flex: 0 0 auto;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.92);
  padding: 11px 13px;
  border-radius: 18px;
  border: 1px solid rgba(216, 225, 239, 0.9);
  box-shadow: var(--tg-shadow-soft);
}

.status-group {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.status-group strong,
.statusbar strong {
  color: var(--tg-deep-navy);
}

.view-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.font-size-text {
  min-width: 50px;
  text-align: center;
  font-weight: 900;
  color: var(--tg-deep-navy);
}

/* =========================================================
   EDITOR + MESSAGES
========================================================= */

.editor {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(248, 250, 252, 0.98));
  border-radius: 22px;
  padding: 18px;
  font-size: calc(17px * var(--font-scale, 1));
  line-height: 1.6;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
  border: 1px solid #dbe6f3;
  box-shadow: var(--tg-shadow-soft);
}

.msg {
  max-width: 90%;
  margin: 0 0 14px;
  padding: 15px 17px;
  border-radius: 20px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
  overflow-wrap: anywhere;
  word-break: break-word;
  position: relative;
}

.msg.user {
  background:
    linear-gradient(135deg, rgba(21, 155, 211, 0.15), rgba(24, 182, 201, 0.12)),
    #eef9ff;
  margin-right: auto;
  border: 1px solid rgba(21, 155, 211, 0.22);
}

.msg.assistant {
  background:
    linear-gradient(135deg, rgba(147, 216, 78, 0.12), rgba(108, 46, 185, 0.08)),
    #ffffff;
  margin-left: auto;
  border: 1px solid rgba(108, 46, 185, 0.16);
}

.msg.partial {
  outline: 2px dashed var(--tg-cyan);
  outline-offset: 2px;
}

.msg-label {
  font-size: calc(12px * var(--font-scale, 1));
  font-weight: 900;
  text-transform: uppercase;
  color: #64748b;
  margin-bottom: 6px;
  letter-spacing: 0.04em;
}

.msg.user .msg-label {
  color: var(--tg-blue);
}

.msg.assistant .msg-label {
  color: var(--tg-purple);
}

.msg-content {
  white-space: pre-wrap;
  font-size: calc(17px * var(--font-scale, 1));
  line-height: 1.6;
  overflow-wrap: anywhere;
  word-break: break-word;
  max-width: 100%;
}

/* =========================================================
   MODE / MANUAL RECORDING
========================================================= */

.manual-hint {
  flex: 0 0 auto;
  font-size: 13px;
  color: #64748b;
}

.mode-badge {
  font-weight: 900;
  background: linear-gradient(135deg, rgba(147, 216, 78, 0.24), rgba(24, 182, 201, 0.18));
  color: #166534;
  border-radius: 999px;
  padding: 8px 13px;
  border: 1px solid rgba(34, 197, 94, 0.22);
}

.manual-on {
  background: linear-gradient(135deg, rgba(234, 219, 32, 0.26), rgba(241, 115, 40, 0.16));
  color: #92400e;
  border-color: rgba(241, 115, 40, 0.25);
}

.recording-on {
  background: linear-gradient(135deg, rgba(241, 115, 40, 0.22), rgba(155, 47, 174, 0.18));
  color: #9a3412;
  border-color: rgba(241, 115, 40, 0.3);
  animation: tgPulse 1.2s infinite;
}

@keyframes tgPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(241, 115, 40, 0.35);
  }
  70% {
    box-shadow: 0 0 0 8px rgba(241, 115, 40, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(241, 115, 40, 0);
  }
}

.mode-control {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 11px;
  min-height: 34px;
}

.mode-control #modeText {
  display: inline-flex;
  align-items: center;
  line-height: 1;
  font-weight: 800;
  white-space: nowrap;
  transform: translateY(1px);
}

.switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 27px;
  flex: 0 0 auto;
}

.switch input {
  display: none;
}

.switch-ui {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: #94a3b8;
  border-radius: 999px;
  transition: 0.2s;
}

.switch-ui:before {
  content: "";
  position: absolute;
  width: 21px;
  height: 21px;
  left: 3px;
  top: 3px;
  background: #ffffff;
  border-radius: 50%;
  transition: 0.2s;
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.2);
}

input:checked + .switch-ui {
  background: var(--tg-gradient);
}

input:checked + .switch-ui:before {
  transform: translateX(21px);
}

/* =========================================================
   SPEAKER IGNORE LIST
========================================================= */

.ignored-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border-radius: 16px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  margin-bottom: 10px;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.05);
}

.ignored-main {
  min-width: 0;
}

.ignored-name {
  font-weight: 900;
  color: var(--tg-deep-navy);
}

.ignored-meta {
  font-size: 12px;
  color: #64748b;
  margin-top: 3px;
}

.ignored-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* =========================================================
   ADMIN PANEL
========================================================= */

.admin-panel {
  position: fixed;
  inset: 70px 20px 20px 20px;
  background: #ffffff;
  border-radius: 24px;
  box-shadow: 0 30px 80px rgba(7, 17, 31, 0.32);
  z-index: 10;
  padding: 18px;
  overflow: auto;
  border: 1px solid #dbe6f3;
}

.admin-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.admin-head h2,
.admin-head h3 {
  color: var(--tg-deep-navy);
}

.admin-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

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

.admin-table th,
.admin-table td {
  border-bottom: 1px solid #e5e7eb;
  padding: 8px;
  text-align: left;
}

.admin-table th {
  background:
    linear-gradient(135deg, rgba(21, 155, 211, 0.08), rgba(108, 46, 185, 0.06)),
    #f8fafc;
  color: var(--tg-deep-navy);
  font-weight: 900;
}

.admin-table input,
.admin-table select {
  padding: 6px;
  width: 100%;
}

/* =========================================================
   MAXIMISE MODE - SINGLE SCROLLABLE CONTROL STRIP
========================================================= */

.app-shell.maximized,
.app-shell.maximized-layout {
  height: 100vh !important;
  max-height: 100vh !important;
  width: 100vw !important;
  max-width: 100vw !important;
  overflow: hidden !important;
}

/* Hide account/download/logout bar in maximise mode */
.app-shell.maximized .top-account-bar,
.app-shell.maximized-layout .top-account-bar {
  display: none !important;
}

/* Fullscreen app */
.app-shell.maximized .app,
.app-shell.maximized-layout .app {
  display: block !important;
  width: 100vw !important;
  max-width: 100vw !important;
  height: 100vh !important;
  max-height: 100vh !important;
  overflow: hidden !important;
}

/* Hide sidebar */
.app-shell.maximized .sidebar,
.app-shell.maximized-layout .sidebar {
  display: none !important;
}

/*
  In maximise mode .main becomes a flex container.
  Control blocks sit in one horizontal row.
  If total controls exceed screen width, the top area scrolls horizontally.
*/
.app-shell.maximized .main,
.app-shell.maximized-layout .main {
  width: 100vw !important;
  max-width: 100vw !important;
  height: 100vh !important;
  max-height: 100vh !important;
  min-height: 0 !important;

  padding: 6px !important;
  gap: 0 !important;

  display: flex !important;
  flex-direction: row !important;
  flex-wrap: wrap !important;
  align-content: flex-start !important;

  background:
    radial-gradient(circle at top left, rgba(21, 155, 211, 0.14), transparent 30%),
    radial-gradient(circle at top right, rgba(108, 46, 185, 0.12), transparent 34%),
    var(--tg-light-bg) !important;

  overflow-x: auto !important;
  overflow-y: hidden !important;
  scrollbar-width: thin !important;
}

/* Hide hint and duplicate badge in maximise mode */
.app-shell.maximized .manual-hint,
.app-shell.maximized-layout .manual-hint,
.app-shell.maximized .mode-badge,
.app-shell.maximized-layout .mode-badge {
  display: none !important;
}

/* Top controls behave as one continuous horizontal strip */
.app-shell.maximized .toolbar,
.app-shell.maximized-layout .toolbar,
.app-shell.maximized .statusbar,
.app-shell.maximized-layout .statusbar,
.app-shell.maximized .mode-row,
.app-shell.maximized-layout .mode-row {
  order: 1 !important;

  height: 56px !important;
  min-height: 56px !important;
  max-height: 56px !important;

  display: inline-flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: center !important;

  gap: 8px !important;
  margin: 0 !important;
  padding: 8px !important;

  background: rgba(255, 255, 255, 0.96) !important;
  border-radius: 0 !important;
  border: 1px solid #dbe6f3 !important;

  white-space: nowrap !important;
  overflow: visible !important;

  flex: 0 0 auto !important;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.08) !important;
}

/* Left and right rounded corners for the single-looking top strip */
.app-shell.maximized .toolbar,
.app-shell.maximized-layout .toolbar {
  border-radius: 16px 0 0 16px !important;
}

.app-shell.maximized .mode-row,
.app-shell.maximized-layout .mode-row {
  border-radius: 0 16px 16px 0 !important;
}

/* Editor is fixed to screen width and does not create horizontal page overflow */
.app-shell.maximized .editor,
.app-shell.maximized-layout .editor {
  order: 2 !important;

  flex: 0 0 calc(100vw - 12px) !important;
  width: calc(100vw - 12px) !important;
  max-width: calc(100vw - 12px) !important;

  height: calc(100vh - 68px) !important;
  min-height: 0 !important;
  max-height: calc(100vh - 68px) !important;

  margin-top: 6px !important;

  overflow-y: auto !important;
  overflow-x: hidden !important;

  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 250, 252, 0.98)) !important;
  border-radius: 20px !important;
  padding: 18px !important;

  -webkit-overflow-scrolling: touch !important;
  scroll-behavior: smooth !important;
}

/* Compact controls in maximise mode */
.app-shell.maximized .toolbar input,
.app-shell.maximized-layout .toolbar input {
  width: 240px !important;
  min-width: 220px !important;
  max-width: 280px !important;
  height: 38px !important;
  flex: 0 0 auto !important;
}

.app-shell.maximized .toolbar select,
.app-shell.maximized-layout .toolbar select {
  height: 38px !important;
  min-width: 92px !important;
  flex: 0 0 auto !important;
}

.app-shell.maximized .toolbar button,
.app-shell.maximized-layout .toolbar button,
.app-shell.maximized .view-tools button,
.app-shell.maximized-layout .view-tools button {
  height: 38px !important;
  min-height: 38px !important;
  padding: 8px 12px !important;
  white-space: nowrap !important;
  flex: 0 0 auto !important;
}

/* Status and view tools should not break into new line */
.app-shell.maximized .status-group,
.app-shell.maximized-layout .status-group,
.app-shell.maximized .view-tools,
.app-shell.maximized-layout .view-tools,
.app-shell.maximized .mode-control,
.app-shell.maximized-layout .mode-control {
  display: inline-flex !important;
  flex-direction: row !important;
  align-items: center !important;
  flex-wrap: nowrap !important;
  gap: 8px !important;
  white-space: nowrap !important;
  width: auto !important;
  flex: 0 0 auto !important;
}

.app-shell.maximized .font-size-text,
.app-shell.maximized-layout .font-size-text {
  min-width: 46px !important;
  text-align: center !important;
  font-weight: 900 !important;
}

/* Wrap long answer/question content inside screen */
.app-shell.maximized .msg,
.app-shell.maximized-layout .msg {
  max-width: min(1180px, calc(100vw - 52px)) !important;
  overflow-wrap: anywhere !important;
  word-break: break-word !important;
}

.app-shell.maximized .msg-content,
.app-shell.maximized-layout .msg-content {
  max-width: 100% !important;
  overflow-wrap: anywhere !important;
  word-break: break-word !important;
  white-space: pre-wrap !important;
}

/* Prevent body from creating second scroll */
body.body-maximized {
  overflow: hidden !important;
  width: 100vw !important;
  max-width: 100vw !important;
}

/* =========================================================
   PAYMENT / BILLING / ADMIN ADDITIONS
========================================================= */

.payment-options {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  margin: 12px 0;
}

.secondary-pay-btn {
  background: linear-gradient(135deg, var(--tg-blue), var(--tg-purple)) !important;
}

.wallet-summary {
  padding: 12px;
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(21, 155, 211, 0.1), rgba(147, 216, 78, 0.09)),
    #f8fafc;
  margin: 10px 0;
  color: var(--tg-deep-navy);
  border: 1px solid #e2e8f0;
}

.admin-page {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px;
}

.admin-page section,
.admin-grid section {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  padding: 16px;
  margin: 14px 0;
  box-shadow: var(--tg-shadow-soft);
}

.admin-page h1,
.admin-page h2,
.admin-page h3,
.admin-grid h1,
.admin-grid h2,
.admin-grid h3 {
  color: var(--tg-deep-navy);
}

.admin-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  align-items: end;
}

.admin-field,
.admin-check {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: #374151;
}

.admin-check {
  flex-direction: row;
  align-items: center;
}

.admin-form input,
.admin-form select,
.admin-search input,
.admin-table input,
.admin-table select {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid #d8e1ef;
  border-radius: 12px;
  background: #fff;
}

.admin-form button,
.admin-search button,
.admin-table button {
  padding: 9px 12px;
  border: 0;
  border-radius: 12px;
  background: var(--tg-gradient);
  color: #fff;
  cursor: pointer;
  font-weight: 800;
}

.danger-btn {
  background: linear-gradient(135deg, #dc2626, #f17328) !important;
  color: #ffffff !important;
}

.table-wrap {
  overflow: auto;
  max-width: 100%;
}

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

.admin-table th,
.admin-table td {
  border-bottom: 1px solid #e5e7eb;
  padding: 8px;
  vertical-align: top;
  text-align: left;
}

.admin-table th {
  background:
    linear-gradient(135deg, rgba(21, 155, 211, 0.09), rgba(108, 46, 185, 0.06)),
    #f9fafb;
  position: sticky;
  top: 0;
  z-index: 1;
}

.admin-search {
  display: flex;
  gap: 8px;
  margin: 10px 0;
}

.admin-grid-wide {
  grid-template-columns: 1fr 1fr;
}

.admin-wide-section {
  grid-column: 1 / -1;
}

/* =========================================================
   REALTIME METRICS PAGE COMPATIBILITY
========================================================= */

.metric-card,
.metrics-card,
.kpi-card {
  background:
    linear-gradient(135deg, rgba(21, 155, 211, 0.12), rgba(108, 46, 185, 0.1)),
    #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 20px;
  box-shadow: var(--tg-shadow-soft);
}

.metric-value,
.kpi-value {
  background: var(--tg-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-weight: 900;
}

.success-text {
  color: #16a34a;
}

.error-text {
  color: #dc2626;
}

.warning-text {
  color: #b45309;
}

/* =========================================================
   SCROLLBARS
========================================================= */

.sidebar::-webkit-scrollbar,
.editor::-webkit-scrollbar,
.table-wrap::-webkit-scrollbar,
.admin-panel::-webkit-scrollbar,
.app-shell.maximized .main::-webkit-scrollbar,
.app-shell.maximized-layout .main::-webkit-scrollbar {
  width: 9px;
  height: 9px;
}

.sidebar::-webkit-scrollbar-track,
.editor::-webkit-scrollbar-track,
.table-wrap::-webkit-scrollbar-track,
.admin-panel::-webkit-scrollbar-track,
.app-shell.maximized .main::-webkit-scrollbar-track,
.app-shell.maximized-layout .main::-webkit-scrollbar-track {
  background: rgba(148, 163, 184, 0.18);
  border-radius: 999px;
}

.sidebar::-webkit-scrollbar-thumb,
.editor::-webkit-scrollbar-thumb,
.table-wrap::-webkit-scrollbar-thumb,
.admin-panel::-webkit-scrollbar-thumb,
.app-shell.maximized .main::-webkit-scrollbar-thumb,
.app-shell.maximized-layout .main::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, var(--tg-blue), var(--tg-purple));
  border-radius: 999px;
}

/* =========================================================
   RESPONSIVE
========================================================= */

@media (max-width: 900px) {
  .app {
    grid-template-columns: 1fr;
    height: auto;
    min-height: calc(100vh - 64px);
  }

  .sidebar {
    max-height: 360px;
  }

  .admin-grid,
  .admin-grid-wide {
    grid-template-columns: 1fr;
  }

  .top-account-bar {
    align-items: flex-start;
    flex-direction: column;
  }

  .editor {
    min-height: 60vh;
  }

  .statusbar,
  .mode-row {
    align-items: flex-start;
    gap: 10px;
  }

  .view-tools {
    width: 100%;
    justify-content: flex-start;
  }

  .mode-control {
    justify-content: flex-start;
  }

  .admin-form {
    grid-template-columns: 1fr;
  }

  .admin-search {
    flex-direction: column;
  }

  .app-shell.maximized .toolbar input,
  .app-shell.maximized-layout .toolbar input {
    width: 190px !important;
    min-width: 180px !important;
    max-width: 220px !important;
  }

  .app-shell.maximized .toolbar button,
  .app-shell.maximized-layout .toolbar button,
  .app-shell.maximized .toolbar select,
  .app-shell.maximized-layout .toolbar select,
  .app-shell.maximized .view-tools button,
  .app-shell.maximized-layout .view-tools button {
    height: 36px !important;
    min-height: 36px !important;
    padding: 7px 10px !important;
    font-size: 13px !important;
  }

  .app-shell.maximized .editor,
  .app-shell.maximized-layout .editor {
    height: calc(100vh - 66px) !important;
    max-height: calc(100vh - 66px) !important;
  }
}

@media (max-width: 560px) {
  .auth-card,
  .subscription-card {
    padding: 24px 18px;
    border-radius: 22px;
  }

  .main {
    padding: 10px;
  }

  .toolbar,
  .statusbar,
  .mode-row {
    gap: 8px;
  }

  .toolbar input {
    min-width: 100%;
  }

  .msg {
    max-width: 96%;
  }

  button,
  a.download-btn {
    padding: 9px 12px;
    font-size: 13px;
  }
}
