:root {
  --bg: #f3f5f8;
  --bg-soft: #f8fafc;
  --surface: #ffffff;
  --panel: #ffffff;
  --panel-2: #f1f4f8;
  --border: #dce3ec;
  --border-strong: #c5d0dc;
  --text: #152033;
  --muted: #607084;
  --accent: #14b8a6;
  --accent-hover: #0f766e;
  --accent-soft: #e6f8f4;
  --accent-dim: #c5eee5;
  --warn: #9a6700;
  --warn-bg: #fff8e6;
  --error: #b42318;
  --error-bg: #fef3f2;
  --info: #175cd3;
  --info-bg: #eff8ff;
  --ok: #067647;
  --ok-bg: #ecfdf3;
  --header: #0b1c24;
  --ink: #050b10;
  --gold: #2dd4bf;
  --shadow: 0 18px 40px rgba(13, 27, 42, 0.08);
  --shadow-sm: 0 4px 14px rgba(13, 27, 42, 0.06);
  --radius: 14px;
  --font: "Manrope", "Segoe UI", sans-serif;
  --display: "Sora", "Manrope", sans-serif;
  --content: 1180px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  overflow-x: hidden;
}

.bg-ambient {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 70% 45% at 15% 0%, rgba(15, 110, 140, 0.14), transparent 55%),
    radial-gradient(ellipse 55% 40% at 90% 10%, rgba(18, 48, 71, 0.1), transparent 50%),
    linear-gradient(180deg, #e8eef3 0%, #f3f5f8 40%, #f7f8fa 100%);
}

.app-shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
}

.topbar {
  width: 100%;
  background: #000;
  border: none;
  border-bottom: 3px solid var(--gold);
  color: #fff;
}

.topbar-inner,
.statusbar-inner {
  width: min(100% - 40px, var(--content));
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}

.topbar-inner {
  padding: 16px 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #fff;
  font-family: var(--display);
  font-weight: 700;
  font-size: 20px;
  letter-spacing: 0.02em;
}

.brand-logo {
  display: block;
  height: 44px;
  width: auto;
  max-width: min(280px, 60vw);
  object-fit: contain;
  object-position: left center;
}

.brand-mark {
  display: none;
}

.brand small {
  display: block;
  margin-top: 2px;
  font-family: var(--font);
  font-size: 12px;
  font-weight: 500;
  opacity: 0.82;
  letter-spacing: 0;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.session-meta {
  color: rgba(255, 255, 255, 0.85);
  font-size: 13px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  line-height: 1.25;
  text-align: right;
}

.session-meta strong {
  color: #fff;
  font-weight: 700;
}

.session-meta .session-email {
  color: rgba(255, 255, 255, 0.75);
  font-size: 12px;
}

.session-meta .session-role {
  color: var(--gold);
  font-size: 11px;
  font-weight: 650;
}

.btn-logout {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.28);
  color: #fff;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 650;
  border-radius: 8px;
}

.btn-logout:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.45);
  color: #fff;
}

.btn-logout.hidden {
  display: none;
}

.app-shell.auth-mode .btn-logout {
  display: none !important;
}

.statusbar {
  width: 100%;
  background: #fff;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
}

.statusbar-inner {
  padding: 14px 0;
}

.screen-root {
  width: min(100% - 40px, var(--content));
  margin: 28px auto;
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 28px 30px;
  overflow: auto;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.screen-title {
  border-bottom: 1px solid var(--border);
  padding-bottom: 16px;
  margin-bottom: 22px;
}

.screen-title h1 {
  font-family: var(--display);
  font-size: 26px;
  font-weight: 700;
  color: var(--header);
  letter-spacing: -0.02em;
  text-transform: none;
}

.screen-title p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 15px;
}

/* Guía interna (no login) */
.flow-guide {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 22px;
  padding: 12px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.flow-guide-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.flow-guide-item .num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--panel-2);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.flow-guide-item.done {
  color: var(--ok);
  border-color: #abefc6;
  background: var(--ok-bg);
}

.flow-guide-item.done .num {
  background: var(--ok);
  color: #fff;
}

.flow-guide-item.active {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
}

.flow-guide-item.active .num {
  background: var(--accent);
  color: #fff;
}

.flow-guide-note {
  width: 100%;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  padding-left: 4px;
}

.panel {
  border: 1px solid var(--border);
  background: var(--panel);
  padding: 18px;
  margin-bottom: 16px;
  border-radius: 12px;
}

.panel-title {
  color: var(--header);
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
  letter-spacing: 0;
  text-transform: none;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
}

.field { margin-bottom: 14px; }

.field label {
  display: block;
  margin-bottom: 6px;
  color: var(--text);
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0;
  text-transform: none;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  background: #fff;
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: 12px 13px;
  font-family: var(--font);
  font-size: 15px;
  outline: none;
  border-radius: 8px;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 110, 140, 0.14);
}

.field .hint {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

button {
  background: #fff;
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: 11px 16px;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 650;
  letter-spacing: 0;
  text-transform: none;
  cursor: pointer;
  border-radius: 8px;
  transition: 0.15s ease;
}

button:hover {
  background: var(--bg-soft);
  border-color: var(--accent);
  color: var(--accent);
}

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

button.primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: #fff;
}

button.secondary {
  color: var(--muted);
  background: #fff;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.msg {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  margin: 10px 0;
  font-size: 14px;
}

.msg.ok { border-color: #abefc6; color: var(--ok); background: var(--ok-bg); }
.msg.err { border-color: #fecdca; color: var(--error); background: var(--error-bg); }
.msg.info { border-color: #b2ddff; color: var(--info); background: var(--info-bg); }
.msg.warn { border-color: #fedf89; color: var(--warn); background: var(--warn-bg); }

.kv {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 8px 14px;
  font-size: 14px;
}

.kv .k { color: var(--muted); }
.kv .v { color: var(--text); font-weight: 650; }
.kv .v.yes { color: var(--ok); }
.kv .v.no { color: var(--error); }

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

table.data th,
table.data td {
  border: 1px solid var(--border);
  padding: 11px 12px;
  text-align: left;
}

table.data th {
  color: var(--header);
  background: var(--accent-soft);
  font-weight: 700;
  font-size: 13px;
  text-transform: none;
  letter-spacing: 0;
}

table.data td.code { color: var(--accent); font-weight: 700; }
table.data tfoot td {
  color: var(--header);
  font-weight: 700;
  background: var(--panel-2);
}

.log {
  max-height: 180px;
  overflow: auto;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
}

.log .line { margin-bottom: 4px; white-space: pre-wrap; }
.log .INFO { color: var(--info); }
.log .WARN { color: var(--warn); }
.log .OK { color: var(--ok); }

.meter {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.meter-bar {
  flex: 1;
  height: 10px;
  background: #e7edf3;
  border-radius: 999px;
  overflow: hidden;
  border: none;
}

.meter-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--header), var(--accent));
  width: 0%;
  transition: width 0.4s ease;
}

.file-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.file-name { color: var(--muted); font-size: 13px; }

.admin-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.case-item {
  border: 1px solid var(--border);
  padding: 12px;
  background: var(--panel-2);
  cursor: pointer;
  border-radius: 10px;
}

.case-item:hover,
.case-item.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.case-item .meta { color: var(--muted); font-size: 12px; margin-top: 4px; }

.badge {
  display: inline-block;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 650;
}

.badge.pending { color: var(--warn); border-color: #fedf89; background: var(--warn-bg); }
.badge.reviewed { color: var(--ok); border-color: #abefc6; background: var(--ok-bg); }
.badge.sent { color: var(--info); border-color: #b2ddff; background: var(--info-bg); }

.summary-box {
  border-color: #b7dce7;
  background: var(--accent-soft);
}

.summary-box.highlight {
  border-color: var(--accent);
  background: #dff1f6;
}

.trace-log {
  margin-top: 14px;
  max-height: 160px;
  overflow: auto;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
}

.trace-line {
  margin-bottom: 6px;
  color: var(--text);
}

.trace-line.muted {
  color: var(--muted);
}

.pay-method-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  margin-top: 12px;
  background: #fff;
}

.pay-method-card h3 {
  font-size: 15px;
  color: var(--header);
  margin-bottom: 10px;
}

.pay-admin-block {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  background: var(--panel-2);
}

.pay-admin-block h3 {
  font-size: 15px;
  color: var(--header);
  margin-bottom: 12px;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  border: 1px solid var(--border-strong);
  background: #fff;
  color: var(--muted);
  padding: 8px 12px;
  border-radius: 8px;
  font-weight: 650;
}

.chip.active {
  background: var(--header);
  border-color: var(--header);
  color: #fff;
}

.chip:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.chip.active:hover {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

.qr-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px;
}

.fee-amount {
  font-family: var(--display);
  font-size: 26px !important;
  color: var(--header) !important;
}

.tx-draft {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 10px;
  background: var(--panel-2);
  display: flex;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
}

.tx-draft-grid {
  flex: 1;
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
}

.tx-draft-address {
  grid-column: 1 / -1;
}

.tx-draft .field {
  margin-bottom: 0;
}

.mono-cell {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  word-break: break-all;
  max-width: 260px;
}

@media (max-width: 900px) {
  .tx-draft-grid {
    grid-template-columns: 1fr;
  }
}

.tx-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 10px;
  background: #fff;
}

.tx-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.tx-card-head .code {
  color: var(--accent);
  margin-right: 8px;
}

.tx-card-value {
  font-family: var(--display);
  font-weight: 700;
  color: var(--header);
  font-size: 16px;
}

.tx-card-meta {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.tx-history {
  margin-top: 10px;
  border-top: 1px solid var(--border);
  padding-top: 8px;
}

.tx-history summary {
  cursor: pointer;
  color: var(--accent);
  font-size: 13px;
  font-weight: 650;
  list-style: none;
}

.tx-history summary::-webkit-details-marker { display: none; }

.tx-history-list {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tx-history-row {
  display: grid;
  grid-template-columns: 150px 90px 1fr 100px;
  gap: 8px;
  font-size: 12px;
  padding: 6px 8px;
  background: var(--panel-2);
  border-radius: 6px;
  color: var(--text);
}

.tx-history-row.muted { color: var(--muted); }
.tx-history-at { color: var(--muted); }
.tx-history-ev {
  font-weight: 700;
  color: var(--accent);
}
.tx-history-by {
  color: var(--muted);
  text-align: right;
}

.btn-remove-draft {
  padding: 10px 12px;
  font-size: 13px;
}

.admin-action-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.admin-action-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  text-align: left;
  padding: 18px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel-2);
  color: var(--text);
  cursor: pointer;
  transition: 0.15s ease;
}

.admin-action-card:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--text);
}

.action-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--header);
  color: #fff;
}

.action-icon-svg {
  width: 22px;
  height: 22px;
  display: block;
}

.action-title {
  font-family: var(--display);
  font-size: 16px;
  font-weight: 700;
  color: var(--header);
}

.action-desc {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.4;
}

.action-status {
  margin-top: 4px;
  font-size: 12px;
  font-weight: 650;
  padding: 4px 8px;
  border-radius: 6px;
}

.action-status.on {
  color: var(--ok);
  background: var(--ok-bg);
}

.action-status.off {
  color: var(--warn);
  background: var(--warn-bg);
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(5, 11, 16, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.open,
.modal-overlay:not([hidden]) {
  display: flex;
}

.modal-overlay[hidden] {
  display: none !important;
}

.modal-card {
  width: min(100%, 640px);
  max-height: min(90dvh, 860px);
  background: #fff;
  border-radius: 14px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-card-wide {
  width: min(100%, 720px);
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--panel-2);
}

.modal-head h2 {
  font-family: var(--display);
  font-size: 18px;
  color: var(--header);
  font-weight: 700;
}

.modal-close {
  border: none;
  background: transparent;
  font-size: 28px;
  line-height: 1;
  padding: 0 6px;
  color: var(--muted);
}

.modal-close:hover {
  color: var(--error);
  background: transparent;
  border-color: transparent;
}

.modal-body {
  padding: 16px 18px;
  overflow: auto;
}

.modal-lead {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 14px;
}

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 18px;
  border-top: 1px solid var(--border);
  background: #fff;
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  font-weight: 650;
  font-size: 14px;
  color: var(--header);
  cursor: pointer;
}

.pay-admin-block.is-disabled {
  opacity: 0.45;
  pointer-events: none;
}

@media (max-width: 800px) {
  .admin-action-grid { grid-template-columns: 1fr; }
  .tx-history-row {
    grid-template-columns: 1fr;
    gap: 2px;
  }
  .tx-history-by { text-align: left; }
}

.btn-doc-open {
  display: inline-flex;
  align-items: center;
  padding: 10px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: #fff;
  color: var(--accent);
  font-weight: 650;
  text-decoration: none;
  font-size: 14px;
}

.btn-doc-open:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.doc-preview-box {
  margin-top: 8px;
}

.doc-preview-img {
  display: block;
  width: 100%;
  max-width: 420px;
  max-height: 360px;
  object-fit: contain;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #f8fafc;
  margin-top: 8px;
}

.notif-wrap {
  position: relative;
}

.notif-wrap.hidden { display: none; }

.notif-bell {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.25);
  background: rgba(255,255,255,0.08);
  color: #fff;
  padding: 0;
  display: grid;
  place-items: center;
}

.notif-bell:hover {
  background: rgba(255,255,255,0.16);
  color: #fff;
  border-color: rgba(255,255,255,0.4);
}

.notif-bell.has-unread {
  border-color: var(--gold);
}

.notif-count {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--error);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: grid;
  place-items: center;
}

.notif-panel {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: min(360px, 86vw);
  max-height: 420px;
  overflow: auto;
  background: #fff;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  z-index: 40;
}

.notif-panel.open { display: block; }

.notif-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--panel-2);
}

.notif-list { padding: 8px; }

.notif-item {
  padding: 10px 12px;
  border-radius: 8px;
  margin-bottom: 6px;
  background: var(--panel-2);
  border-left: 3px solid var(--border-strong);
}

.notif-item.unread {
  background: var(--accent-soft);
  border-left-color: var(--accent);
}

.notif-item.notif-ok { border-left-color: var(--ok); }
.notif-item.notif-err { border-left-color: var(--error); }
.notif-item.notif-warn { border-left-color: #f79009; }

.notif-title {
  font-weight: 700;
  font-size: 13px;
  color: var(--header);
}

.notif-msg {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}

.notif-at {
  margin-top: 6px;
  font-size: 11px;
  color: var(--muted);
}

.notif-empty {
  padding: 18px 12px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 50;
  min-width: 260px;
  max-width: 420px;
  border: 1px solid var(--border);
  background: #fff;
  padding: 12px 14px;
  border-radius: 10px;
  box-shadow: var(--shadow);
  font-weight: 650;
}

.toast.hidden { display: none; }
.toast.ok { border-color: #abefc6; color: var(--ok); }
.toast.err { border-color: #fecdca; color: var(--error); }
.toast.info { border-color: #b2ddff; color: var(--info); }

.ascii-frame { display: none; }

/* ---------- LOGIN (split equilibrado, sin deformar) ---------- */
.app-shell.auth-mode {
  max-width: none;
  min-height: 100dvh;
  height: 100dvh;
  overflow: hidden;
  grid-template-rows: 1fr;
}

.app-shell.auth-mode .topbar,
.app-shell.auth-mode .statusbar {
  display: none !important;
}

.app-shell.auth-mode .screen-root {
  width: 100% !important;
  max-width: none;
  height: 100%;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  box-shadow: none;
  border-radius: 0;
  overflow: hidden;
}

.auth-gate {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(380px, 0.85fr);
  width: 100%;
  height: 100%;
  min-height: 0;
  border: none;
  background: #fff;
  overflow: hidden;
  animation: authIn 0.35s ease both;
}

@keyframes authIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.auth-hero {
  position: relative;
  box-sizing: border-box;
  padding: 40px 44px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 28px;
  background:
    linear-gradient(135deg, rgba(5, 11, 16, 0.92), rgba(11, 28, 36, 0.88) 45%, rgba(20, 184, 166, 0.28)),
    linear-gradient(160deg, #050b10 0%, #0b1c24 48%, #115e59 100%);
  color: #fff;
  overflow: hidden;
  min-height: 0;
  height: 100%;
}

.auth-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse at 30% 20%, black 10%, transparent 70%);
  opacity: 0.65;
  pointer-events: none;
}

.auth-hero::after {
  content: "";
  position: absolute;
  width: 420px;
  height: 420px;
  right: -140px;
  bottom: -160px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(45, 212, 191, 0.22), transparent 68%);
  pointer-events: none;
}

.auth-hero-top,
.auth-hero-bot {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 460px;
}

.auth-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  color: #fff;
  padding: 7px 12px;
  font-size: 12px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  font-weight: 600;
}

.auth-chip .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #7ddea5;
  flex-shrink: 0;
}

.auth-logo {
  display: block;
  width: min(420px, 100%);
  height: auto;
  margin-top: 22px;
  object-fit: contain;
  object-position: left center;
  filter: drop-shadow(0 10px 24px rgba(0, 0, 0, 0.28));
}

.auth-tagline {
  margin-top: 18px;
  max-width: 420px;
  color: rgba(255, 255, 255, 0.9);
  font-size: 15px;
  line-height: 1.55;
}

.auth-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 28px;
  width: 100%;
}

.auth-metric {
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  padding: 12px 10px;
  border-radius: 10px;
  min-height: 64px;
}

.auth-metric .label {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.75);
  font-weight: 600;
}

.auth-metric .value {
  margin-top: 4px;
  font-family: var(--display);
  font-size: 14px;
  color: #fff;
  font-weight: 700;
}

.auth-scanline { display: none; }

.auth-hero-bot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 12px;
  margin-top: 0;
}

.auth-panel {
  box-sizing: border-box;
  padding: 40px 48px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: stretch;
  background: #fff;
  height: 100%;
  min-height: 0;
  overflow: auto;
}

.auth-panel-inner {
  width: 100%;
  max-width: 400px;
}

.auth-panel-head h2 {
  font-family: var(--display);
  font-size: 24px;
  color: var(--header);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.auth-panel-head p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin: 22px 0 18px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  border-radius: 10px;
  overflow: hidden;
}

.auth-tab {
  border: none;
  border-radius: 0;
  padding: 12px 10px;
  color: var(--muted);
  background: transparent;
  font-weight: 650;
  font-size: 14px;
}

.auth-tab:hover {
  background: rgba(20, 184, 166, 0.06);
  color: var(--accent);
  border-color: transparent;
}

.auth-tab.active {
  color: var(--accent);
  background: #fff;
  box-shadow: inset 0 -3px 0 var(--accent);
}

.auth-form {
  display: none;
  animation: formIn 0.25s ease both;
  width: 100%;
  max-width: none;
}

.auth-form.active { display: block; }

@keyframes formIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

.auth-form .field { margin-bottom: 14px; }
.auth-form .field label {
  font-size: 13px;
  margin-bottom: 6px;
}
.auth-form .field .hint {
  font-size: 12px;
  margin-top: 6px;
}
.auth-form .field input {
  padding: 12px 13px;
  background: #fff;
  font-size: 15px;
  width: 100%;
}

.auth-form .actions {
  margin-top: 6px;
}

.auth-form button.full {
  width: 100%;
  padding: 13px 16px;
  font-size: 15px;
  font-weight: 700;
  border-radius: 8px;
}

.auth-form button.primary.full {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.auth-form button.primary.full:hover {
  background: var(--accent-hover);
}

.pwd-meter {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  margin-top: 8px;
}

.pwd-meter span {
  height: 4px;
  background: #e7edf3;
  border-radius: 999px;
}

.pwd-meter[data-level="1"] span:nth-child(1) { background: var(--error); }
.pwd-meter[data-level="2"] span:nth-child(-n+2) { background: #f79009; }
.pwd-meter[data-level="3"] span:nth-child(-n+3) { background: #2e90fa; }
.pwd-meter[data-level="4"] span { background: var(--ok); }

.auth-switch {
  margin-top: 14px;
  text-align: left;
  color: var(--muted);
  font-size: 14px;
}

.auth-switch button.linkish {
  border: none;
  padding: 0;
  color: var(--accent);
  font-size: 14px;
  font-weight: 700;
  background: transparent;
  text-transform: none;
}

.auth-switch button.linkish:hover {
  background: transparent;
  text-decoration: underline;
  color: var(--accent-hover);
}

.auth-footer-note {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
  max-width: none;
  line-height: 1.6;
}

.auth-footer-note code {
  color: var(--accent);
  font-family: var(--font);
  font-weight: 700;
  background: var(--accent-soft);
  padding: 1px 6px;
  border-radius: 4px;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0 12px;
  color: var(--muted);
  font-size: 12px;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-weight: 650;
  font-size: 14px;
  text-decoration: none;
}

.btn-google:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-google.is-disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-google .g-icon {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background:
    conic-gradient(from -45deg, #ea4335 0 25%, #fbbc05 0 50%, #34a853 0 75%, #4285f4 0 100%);
  box-shadow: inset 0 0 0 3px #fff;
}

@media (max-width: 1100px) {
  .auth-gate {
    grid-template-columns: minmax(0, 1fr) minmax(360px, 420px);
  }
  .auth-hero { padding: 32px 28px; }
  .auth-panel { padding: 32px 28px; }
}

@media (max-width: 900px) {
  .app-shell.auth-mode {
    height: auto;
    min-height: 100dvh;
    overflow: auto;
  }
  .app-shell.auth-mode .screen-root {
    height: auto;
    overflow: visible;
  }
  .auth-gate {
    grid-template-columns: 1fr;
    height: auto;
  }
  .auth-hero {
    height: auto;
    min-height: 280px;
    padding: 28px 22px;
    justify-content: flex-start;
  }
  .auth-hero-top,
  .auth-hero-bot { max-width: none; }
  .auth-logo {
    width: min(320px, 100%);
    height: auto;
  }
  .auth-panel {
    height: auto;
    padding: 28px 22px 32px;
  }
  .auth-panel-inner { max-width: none; }
}

@media (max-width: 800px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr; gap: 2px; }
  .topbar-inner,
  .statusbar-inner {
    width: min(100% - 24px, var(--content));
  }
  .app-shell:not(.auth-mode) .screen-root {
    width: min(100% - 24px, var(--content));
    margin: 18px auto;
    padding: 18px;
  }
  .topbar-inner { flex-direction: column; align-items: flex-start; }
  .auth-metrics { grid-template-columns: 1fr; }
}
