/* ============================================================
   Tiliso — overlay components, document & print, auth, portal
   ============================================================ */

/* ---------------- modal ---------------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 120;
  background: rgba(11, 14, 25, 0.5);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 32px 20px 40px; overflow-y: auto;
  animation: fadeIn 0.18s var(--ease);
}
[data-theme="dark"] .modal-backdrop { background: rgba(0, 0, 0, 0.66); }
.modal {
  width: 100%; max-width: 560px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg); overflow: hidden;
  animation: modalIn 0.24s var(--ease);
  margin: 0 auto;
}
.modal-lg { max-width: 760px; }
.modal-xl { max-width: 940px; }
.modal-sm { max-width: 420px; }
.modal-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  padding: 20px 22px 14px;
}
.modal-title { font-size: 17px; font-weight: 700; letter-spacing: -0.02em; }
.modal-sub { font-size: 12.5px; color: var(--text-3); margin-top: 4px; }
.modal-close { flex: none; margin: -4px -4px 0 0; }
.modal-body { padding: 4px 22px 20px; }
.modal-body.flush { padding: 0; }
.modal-foot {
  display: flex; align-items: center; justify-content: flex-end; gap: 9px;
  padding: 15px 22px; border-top: 1px solid var(--border); background: var(--surface-2);
}
.modal-foot .spacer { flex: 1; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn { from { opacity: 0; transform: translateY(10px) scale(0.985); } to { opacity: 1; transform: none; } }
body.modal-open { overflow: hidden; }

/* ---------------- dropdown menu ---------------- */
.menu-wrap { position: relative; display: inline-flex; }
.menu {
  position: absolute; z-index: 9999; min-width: 192px; padding: 6px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15), 0 8px 10px -6px rgba(0, 0, 0, 0.1); animation: menuIn 0.14s var(--ease);
}
.menu[hidden] { display: none; }
.menu.right { right: 0; left: auto; top: calc(100% + 8px); }
.menu.left { left: 0; right: auto; top: calc(100% + 8px); }
.menu.up { bottom: calc(100% + 8px); top: auto; }
.menu-item {
  display: flex; align-items: center; gap: 9px; width: 100%; padding: 8px 10px;
  border: 0; border-radius: 8px; background: transparent; color: var(--text-2);
  font-size: 13px; font-weight: 500; cursor: pointer; text-align: left; white-space: nowrap;
  text-decoration: none;
}
.menu-item:hover { background: var(--surface-3); color: var(--text); }
.menu-item .ic { color: var(--text-3); }
.menu-item:hover .ic { color: var(--text-2); }
.menu-item.danger { color: var(--danger); }
.menu-item.danger .ic { color: var(--danger); }
.menu-item.danger:hover { background: var(--danger-soft); }
.menu-item kbd, .menu-item .kbd { margin-left: auto; }
.menu-label {
  padding: 7px 10px 4px; font-size: 10px; font-weight: 750; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--text-3);
}
.menu-sep { height: 1px; background: var(--border); margin: 5px 4px; }
.menu-note { padding: 7px 10px; font-size: 11.5px; color: var(--text-3); white-space: normal; max-width: 240px; }
@keyframes menuIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* ---------------- toast ---------------- */
.toast-root {
  position: fixed; bottom: 22px; right: 22px; z-index: 300;
  display: flex; flex-direction: column; gap: 9px; align-items: flex-end; pointer-events: none;
}
.toast {
  pointer-events: auto; display: flex; align-items: flex-start; gap: 10px;
  min-width: 260px; max-width: 380px; padding: 12px 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow-lg); font-size: 13px; color: var(--text);
  animation: toastIn 0.26s var(--ease);
}
.toast .ic { margin-top: 1px; }
.toast.success .ic { color: var(--success); }
.toast.error .ic { color: var(--danger); }
.toast.info .ic { color: var(--info); }
.toast.warning .ic { color: var(--warning); }
.toast-text { flex: 1; line-height: 1.4; }
.toast-x { border: 0; background: none; color: var(--text-3); cursor: pointer; padding: 2px; border-radius: 5px; }
.toast-x:hover { background: var(--bg-soft); color: var(--text); }
.toast.leaving { animation: toastOut 0.2s var(--ease) forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateX(16px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateX(12px); } }

/* ---------------- empty state ---------------- */
.empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 54px 24px; gap: 4px;
}
.empty-art {
  width: 68px; height: 68px; border-radius: 20px; display: grid; place-items: center;
  background: var(--brand-soft);
  color: #111827; margin-bottom: 14px; border: 1px solid var(--border);
  box-shadow: 0 4px 12px rgba(200, 241, 53, 0.2);
}
.empty-title { font-size: 15px; font-weight: 680; }
.empty-text { font-size: 12.5px; color: var(--text-3); max-width: 340px; line-height: 1.5; margin-top: 2px; }
.empty-actions { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; justify-content: center; }

/* ---------------- command palette ---------------- */
.palette-backdrop {
  position: fixed; inset: 0; z-index: 150; background: rgba(11, 14, 25, 0.45);
  backdrop-filter: blur(3px); display: flex; justify-content: center; align-items: flex-start;
  padding: 10vh 20px 40px; animation: fadeIn 0.15s;
}
[data-theme="dark"] .palette-backdrop { background: rgba(0, 0, 0, 0.6); }
.palette {
  width: 100%; max-width: 600px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; box-shadow: var(--shadow-lg); overflow: hidden; animation: modalIn 0.2s var(--ease);
}
.palette-input-row { display: flex; align-items: center; gap: 10px; padding: 13px 16px; border-bottom: 1px solid var(--border); }
.palette-input-row .ic { color: var(--text-3); }
.palette-input {
  flex: 1; border: 0; background: none; outline: none; color: var(--text);
  font-size: 15px; font-family: inherit;
}
.palette-input::placeholder { color: var(--text-3); }
.palette-results { max-height: 56vh; overflow-y: auto; padding: 7px; }
.palette-group-label {
  padding: 9px 10px 5px; font-size: 10px; font-weight: 750; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--text-3);
}
.palette-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px;
  border: 0; border-radius: 9px; background: transparent; color: var(--text-2);
  font-size: 13px; cursor: pointer; text-align: left;
}
.palette-item .ic { color: var(--text-3); }
.palette-item .meta { margin-left: auto; font-size: 11px; color: var(--text-3); }
.palette-item:hover, .palette-item.is-active { background: var(--brand-soft); color: var(--brand-ink); }
.palette-item.is-active .ic, .palette-item:hover .ic { color: var(--brand); }
.palette-foot {
  display: flex; align-items: center; gap: 14px; padding: 9px 14px; border-top: 1px solid var(--border);
  font-size: 11px; color: var(--text-3); background: var(--surface-2);
}
.palette-foot span { display: inline-flex; align-items: center; gap: 5px; }
.palette-empty { padding: 30px 16px; text-align: center; color: var(--text-3); font-size: 13px; }

/* ---------------- notifications ---------------- */
.notif-panel {
  position: absolute; right: 0; top: calc(100% + 8px); width: 360px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 15px;
  box-shadow: var(--shadow-lg); overflow: hidden; z-index: 80;
  animation: menuIn 0.16s var(--ease);
}
.notif-head { display: flex; align-items: center; justify-content: space-between; padding: 13px 16px; border-bottom: 1px solid var(--border); }
.notif-title { font-size: 13.5px; font-weight: 680; }
.notif-list { max-height: 380px; overflow-y: auto; }
.notif-item { display: flex; gap: 11px; padding: 12px 16px; border-bottom: 1px solid var(--border); cursor: pointer; }
.notif-item:last-child { border-bottom: 0; }
.notif-item:hover { background: var(--surface-2); }
.notif-item.unread { background: rgba(91, 91, 214, 0.045); }
.notif-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--brand); margin-top: 6px; flex: none; }
.notif-item.read .notif-dot { background: transparent; }
.notif-text { font-size: 12.5px; line-height: 1.45; color: var(--text-2); }
.notif-text strong { color: var(--text); font-weight: 650; }
.notif-time { font-size: 10.5px; color: var(--text-3); margin-top: 3px; }

/* ---------------- charts ---------------- */
.chart { width: 100%; display: block; overflow: visible; }
.chart .grid-line { stroke: var(--border); stroke-width: 1; stroke-dasharray: 2 4; opacity: 0.8; }
.chart .axis-label { fill: var(--text-3); font-size: 10px; font-family: var(--font); font-weight: 500; }
.chart .bar { transition: opacity 0.15s; }
.chart .bar:hover { opacity: 0.82; }
.chart .area { opacity: 0.16; }
.chart .line-path { fill: none; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.chart .dot { transition: r 0.15s; }
.chart .donut-seg { transition: opacity 0.15s; }
.chart .donut-seg:hover { opacity: 0.85; }
.chart .center-value { fill: var(--text); font-size: 19px; font-weight: 730; font-family: var(--font); letter-spacing: -0.02em; }
.chart .center-label { fill: var(--text-3); font-size: 10.5px; font-family: var(--font); font-weight: 550; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 10px 16px; }
.chart-legend .item { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--text-3); }
.chart-legend .swatch { width: 8px; height: 8px; border-radius: 3px; flex: none; }
.chart-legend .val { color: var(--text); font-weight: 650; margin-left: 2px; }

/* ---------------- activity / timeline ---------------- */
.feed { display: flex; flex-direction: column; }
.feed-item { display: flex; gap: 12px; padding: 11px 0; position: relative; }
.feed-item + .feed-item { border-top: 1px solid var(--border); }
.feed-icon {
  width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; flex: none;
  background: var(--surface-3); color: var(--text-3); margin-top: 1px;
}
.feed-icon.brand { background: var(--brand-soft); color: var(--brand); }
.feed-icon.success { background: var(--success-soft); color: var(--success); }
.feed-icon.warning { background: var(--warning-soft); color: var(--warning); }
.feed-icon.danger { background: var(--danger-soft); color: var(--danger); }
.feed-text { font-size: 12.5px; line-height: 1.45; color: var(--text-2); }
.feed-text strong { color: var(--text); font-weight: 650; }
.feed-time { font-size: 10.5px; color: var(--text-3); margin-top: 2px; }

.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ""; position: absolute; left: 5px; top: 6px; bottom: 6px; width: 1.5px; background: var(--border); }
.timeline-item { position: relative; padding-bottom: 18px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-dot {
  position: absolute; left: -22px; top: 3px; width: 11px; height: 11px; border-radius: 50%;
  background: var(--surface); border: 2.5px solid var(--border-strong);
}
.timeline-dot.brand { border-color: var(--brand); }
.timeline-dot.success { border-color: var(--success); }
.timeline-dot.danger { border-color: var(--danger); }
.timeline-dot.warning { border-color: var(--warning); }
.timeline-title { font-size: 12.5px; font-weight: 600; color: var(--text); }
.timeline-meta { font-size: 11px; color: var(--text-3); margin-top: 2px; }

/* ---------------- alerts / callouts ---------------- */
.alert {
  display: flex; gap: 10px; padding: 12px 14px; border-radius: 11px;
  border: 1px solid var(--border); background: var(--surface-2);
  font-size: 12.5px; color: var(--text-2); line-height: 1.45;
}
.alert .ic { flex: none; margin-top: 1px; color: var(--text-3); }
.alert-title { font-weight: 650; color: var(--text); margin-bottom: 1px; }
.alert.info { background: var(--info-soft); border-color: rgba(37, 121, 242, 0.18); color: var(--info-ink); }
.alert.info .ic { color: var(--info); }
.alert.warning { background: var(--warning-soft); border-color: rgba(185, 116, 10, 0.2); color: var(--warning-ink); }
.alert.warning .ic { color: var(--warning); }
.alert.danger { background: var(--danger-soft); border-color: rgba(222, 67, 86, 0.2); color: var(--danger-ink); }
.alert.danger .ic { color: var(--danger); }
.alert.success { background: var(--success-soft); border-color: rgba(14, 159, 110, 0.18); color: var(--success-ink); }
.alert.success .ic { color: var(--success); }

/* ---------------- document (invoice preview) ---------------- */
.doc-stage { background: var(--surface-3); border: 1px solid var(--border); border-radius: 20px; padding: 22px; }
.doc {
  background: #fff; color: #111827; width: 100%; max-width: 840px; margin: 0 auto;
  padding: 44px 48px 40px; border-radius: 18px; box-shadow: var(--shadow-lg);
  font-size: 13px; line-height: 1.5; position: relative; overflow: hidden;
}
.doc * { box-sizing: border-box; }
.doc-accent { position: absolute; left: 0; top: 0; right: 0; height: 6px; background: var(--brand, #c8f135); }
.doc-head { display: flex; justify-content: space-between; gap: 24px; align-items: flex-start; padding-bottom: 24px; border-bottom: 1px solid #e9ebf0; }
.doc-brand { display: flex; gap: 14px; align-items: flex-start; }
.doc-logo {
  width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; flex: none;
  background: #111827; color: var(--brand, #c8f135); font-weight: 800; font-size: 18px;
}
.doc-org-name { font-size: 16px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.2; color: #111827; }
.doc-org-lines { font-size: 11px; color: #6b7280; line-height: 1.55; margin-top: 4px; white-space: pre-line; }
.doc-title-wrap { text-align: right; flex: none; }
.doc-title { font-size: 26px; font-weight: 850; letter-spacing: 0.04em; color: #111827; text-transform: uppercase; line-height: 1; }
.doc-number { font-size: 12.5px; color: #4b5563; font-weight: 700; margin-top: 6px; font-family: var(--mono); }
.doc-meta { display: flex; justify-content: space-between; gap: 30px; padding: 22px 0; border-bottom: 1px solid #e9ebf0; }
.doc-block-title { font-size: 9.5px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: #8e95a5; margin-bottom: 6px; }
.doc-bill-name { font-size: 13.5px; font-weight: 750; color: #111827; }
.doc-bill-lines { font-size: 11px; color: #4b5563; line-height: 1.55; margin-top: 3px; white-space: pre-line; }
.doc-meta-grid { display: grid; grid-template-columns: auto auto; gap: 5px 18px; font-size: 11.5px; }
.doc-meta-grid .k { color: #8e95a5; }
.doc-meta-grid .v { color: #111827; font-weight: 650; text-align: right; }
.doc-table { width: 100%; border-collapse: collapse; margin: 8px 0 0; }
.doc-table thead th {
  text-align: left; font-size: 9.5px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase;
  color: #6b7280; padding: 13px 10px; border-bottom: 1.5px solid #e9ebf0;
}
.doc-table thead th.num { text-align: right; }
.doc-table tbody td { padding: 13px 10px; border-bottom: 1px solid #f1f3f7; vertical-align: top; font-size: 12px; color: #374151; }
.doc-table tbody td.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.doc-item-name { font-weight: 700; color: #111827; }
.doc-item-desc { font-size: 10.5px; color: #6b7280; margin-top: 2px; line-height: 1.45; max-width: 320px; }
.doc-hsn { font-size: 9.5px; color: #8e95a5; margin-top: 2px; }
.doc-totals-wrap { display: flex; justify-content: flex-end; gap: 30px; padding-top: 20px; }
.doc-notes { flex: 1; max-width: 340px; }
.doc-note-title { font-size: 9.5px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: #8e95a5; margin-bottom: 5px; }
.doc-note-body { font-size: 11px; color: #4b5563; line-height: 1.55; white-space: pre-line; }
.doc-totals { width: 290px; flex: none; font-size: 12px; }
.doc-totals .row { display: flex; justify-content: space-between; gap: 20px; padding: 5px 0; color: #4b5563; }
.doc-totals .row .val { font-variant-numeric: tabular-nums; color: #111827; font-weight: 600; }
.doc-totals .row.total { border-top: 2px solid #111827; margin-top: 8px; padding-top: 10px; color: #111827; font-weight: 800; font-size: 14.5px; }
.doc-totals .row.total .val { font-weight: 850; font-size: 17px; }
.doc-totals .row.paid { color: #059669; }
.doc-totals .row.balance { border-top: 1px solid #e9ebf0; margin-top: 6px; padding-top: 8px; font-weight: 750; color: #111827; font-size: 13px; }
.doc-foot { display: flex; justify-content: space-between; gap: 24px; margin-top: 32px; padding-top: 18px; border-top: 1px solid #e9ebf0; }
.doc-foot-note { font-size: 10px; color: #8e95a5; line-height: 1.5; max-width: 380px; }
.doc-sign { text-align: right; font-size: 10.5px; color: #6b7280; }
.doc-sign-line { width: 160px; border-bottom: 1px solid #d1d5db; height: 32px; margin-bottom: 5px; margin-left: auto; }
.doc-badge-paid {
  position: absolute; right: 44px; top: 150px; transform: rotate(-8deg);
  border: 2.5px solid rgba(16, 185, 129, 0.6); color: #059669;
  font-size: 20px; font-weight: 800; letter-spacing: 0.12em; padding: 3px 14px; border-radius: 8px;
  text-transform: uppercase; pointer-events: none;
}
.doc-badge-paid.overdue { border-color: rgba(239, 68, 68, 0.6); color: #b91c1c; }
.doc-bank { margin-top: 16px; display: flex; gap: 26px; flex-wrap: wrap; font-size: 10.5px; color: #4b5563; }
.doc-bank strong { color: #111827; }
.doc-upi { display: flex; align-items: center; gap: 12px; }
.doc-upi svg, .doc-upi img { flex-shrink: 0; border: 1px solid #e5e7eb; border-radius: 6px; }
.doc-paypal a { color: inherit; text-decoration: none; }
.doc-watermark {
  position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none;
  font-size: 96px; font-weight: 800; letter-spacing: 0.1em; color: rgba(17, 24, 39, 0.035);
  transform: rotate(-24deg); text-transform: uppercase;
}
.doc-print-bar {
  display: flex; align-items: center; gap: 10px; padding: 13px 18px; margin-bottom: 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow);
}
.doc-print-bar .spacer { flex: 1; }

/* -------------------------------------------------------------------------- */
/* Unified Enterprise Authentication Experience (Sign In, Reset, 2FA)         */
/* -------------------------------------------------------------------------- */
.auth-page,
.auth {
  position: fixed; inset: 0; z-index: 100;
  display: flex; flex-direction: column;
  background: var(--bg);
  overflow-y: auto;
  min-height: 100vh;
}

.auth-page-main,
.auth-main {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 44px 24px 60px;
  position: relative;
  min-height: calc(100vh - 60px);
}

.auth-page-main::before,
.auth-main::before {
  content: "";
  position: absolute;
  top: 15%;
  left: 50%;
  transform: translateX(-50%);
  width: 620px;
  height: 420px;
  background: radial-gradient(circle, rgba(200, 241, 53, 0.08) 0%, rgba(59, 130, 246, 0.03) 45%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.auth-brand-centered {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 24px;
  text-decoration: none;
  position: relative;
  z-index: 1;
}

.auth-brand-centered .brand-mark {
  transition: transform 0.2s var(--ease);
}

.auth-brand-centered:hover .brand-mark {
  transform: translateY(-2px);
}

.auth-brand-title {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text);
  line-height: 1;
}

.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 36px 36px 32px;
  box-shadow: 0 16px 40px -10px rgba(17, 24, 39, 0.07), 0 0 1px 1px rgba(17, 24, 39, 0.02);
  position: relative;
  z-index: 1;
}

.auth-card-inner { width: 100%; }

.auth-card-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
}

.auth-badge-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  color: var(--text);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

.auth-title {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text);
  text-align: center;
  margin: 0;
}

.auth-sub {
  color: var(--text-3);
  font-size: 13.5px;
  margin: 8px 0 24px;
  text-align: center;
  line-height: 1.5;
}

.auth-form .field {
  margin-bottom: 16px;
}

.auth-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.auth-label-row .label {
  margin-bottom: 0;
}

.auth-label-row .auth-link {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  text-decoration: none;
  transition: color 0.15s;
}

.auth-label-row .auth-link:hover {
  color: var(--brand-ink);
  text-decoration: underline;
}

/* Input with icon & eye toggle */
.input-icon {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon > .ic {
  position: absolute;
  left: 14px;
  color: var(--text-3);
  pointer-events: none;
}

.input-icon > .input {
  padding-left: 42px;
  width: 100%;
  border-radius: 11px;
}

.input-action-btn {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  padding: 6px;
  cursor: pointer;
  color: var(--text-3);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: color 0.15s var(--ease);
}

.input-action-btn:hover {
  color: var(--text);
}

.input-action-btn .eye-hide {
  display: none;
}

.input-action-btn.is-visible .eye-show {
  display: none;
}

.input-action-btn.is-visible .eye-hide {
  display: block;
}

input[type="date"]::-webkit-calendar-picker-indicator,
input[type="date"]::-webkit-inner-spin-button,
input[type="date"]::-webkit-clear-button {
  display: none !important;
  -webkit-appearance: none !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.auth-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 6px 0 20px;
  font-size: 13px;
  color: var(--text-2);
}

.auth-row .checkbox span {
  font-weight: 500;
  color: var(--text-2);
}

.auth-link {
  color: var(--text-2);
  text-decoration: none;
  font-weight: 600;
  font-size: 12px;
}

.auth-link:hover {
  color: var(--brand-ink);
  text-decoration: underline;
}

.auth-submit-btn {
  height: 48px;
  font-size: 14.5px;
  font-weight: 750;
  border-radius: 12px;
  background: var(--brand);
  color: #111827;
  border: 1px solid rgba(17, 24, 39, 0.08);
  box-shadow: 0 2px 10px rgba(200, 241, 53, 0.32);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.18s var(--ease);
}

.auth-submit-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(200, 241, 53, 0.42);
}

.auth-submit-btn:active {
  transform: translateY(0);
}

/* Bottom Card Footer Switch Link */
.auth-card-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-size: 13.5px;
  color: var(--text-3);
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  text-align: center;
}

.auth-card-footer a,
.auth-link-strong {
  color: var(--text);
  font-weight: 700;
  text-decoration: none;
  transition: all 0.15s var(--ease);
}

.auth-card-footer a:hover,
.auth-link-strong:hover {
  color: #111827;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.auth-demo {
  border: 1px dashed var(--border-strong);
  background: var(--surface-2);
  border-radius: 14px;
  padding: 14px 16px;
  font-size: 12px;
  color: var(--text-3);
  line-height: 1.5;
}

.auth-demo strong {
  color: var(--text-2);
  font-weight: 650;
}

.auth-foot {
  margin-top: 22px;
  font-size: 11.5px;
  color: var(--text-3);
  text-align: center;
  line-height: 1.6;
}

.auth-page-footer {
  padding: 18px 24px;
  text-align: center;
  font-size: 12px;
  color: var(--text-3);
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.auth-footer-trust {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--text-3);
}

.auth-switch {
  font-size: 13px;
  color: var(--text-3);
  margin-top: 20px;
  text-align: center;
}

.auth-switch a {
  color: var(--text);
  font-weight: 650;
  cursor: pointer;
  text-decoration: none;
}

.auth-switch a:hover {
  text-decoration: underline;
}

.auth-card-top {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  font-size: 12.5px;
  color: var(--text-3);
  margin-bottom: 22px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.auth-card-top a {
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
}

.auth-card-top a.strong {
  font-weight: 750;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.auth-tabs { margin-bottom: 20px; }
.auth-tabs .tab { flex: 0 0 auto; }
.success-text { color: var(--success-ink); font-size: 12.5px; line-height: 1.5; }
.auth-pw { margin-top: 8px; }
.auth-pw-bar { height: 4px; border-radius: 99px; background: var(--border); overflow: hidden; }
.auth-pw-fill { height: 100%; border-radius: 99px; transition: width 0.2s var(--ease), background 0.2s var(--ease); }
.auth-pw-danger { background: var(--danger); }
.auth-pw-warning { background: var(--warning); }
.auth-pw-brand { background: var(--brand); }
.auth-pw-success { background: var(--success); }
.auth-pw-hint { font-size: 11.5px; color: var(--text-3); margin-top: 6px; }
.auth-pw-hint strong { color: var(--text-2); font-weight: 600; }

.auth-card-wide {
  max-width: 560px;
  padding: 36px 40px 36px;
}
.signup-stepper-wrap {
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}
.auth-steps { display: flex; align-items: flex-start; gap: 0; margin: 0 0 24px; }
.auth-step { flex: 1 1 0; display: flex; flex-direction: column; align-items: center; position: relative; gap: 8px; }
.auth-step::before {
  content: ""; position: absolute; top: 12px; left: -50%; width: 100%; height: 2px;
  background: var(--border); z-index: 0;
}
.auth-step:first-child::before { display: none; }
.auth-step-dot {
  width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface-2); border: 2px solid var(--border); color: var(--text-3);
  font-size: 11.5px; font-weight: 700; position: relative; z-index: 1; transition: all 0.2s var(--ease);
}
.auth-step-label { font-size: 11.5px; color: var(--text-3); text-align: center; line-height: 1.35; }
.auth-step.is-done .auth-step-dot { background: var(--brand); border-color: #111827; color: #111827; font-weight: 800; }
.auth-step.is-done::before { background: #111827; }
.auth-step.is-active .auth-step-dot { border-color: #111827; color: #111827; background: var(--brand); font-weight: 800; }
.auth-step.is-active .auth-step-label { color: var(--text); font-weight: 700; }

.auth-step-panel { display: none; }
.auth-step-panel.is-active { display: block; animation: authStepIn 0.22s var(--ease); }
@keyframes authStepIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.auth-field-error {
  display: block; font-size: 11.5px; color: var(--danger);
  margin-top: 5px; line-height: 1.45;
}
.auth-field-error a {
  color: var(--danger);
  text-decoration: underline;
  font-weight: 600;
}
.auth-field-error a:hover {
  filter: brightness(0.85);
}
.auth-field-error[hidden], .auth-field-hint[hidden] { display: none; }
.auth-field-hint { font-size: 11.5px; color: var(--text-3); margin-top: 5px; line-height: 1.45; }
.auth-field-hint.warn { color: var(--warning-ink); }
.input.has-error { border-color: var(--danger); }
.input.has-error:focus { box-shadow: 0 0 0 3px rgba(220, 80, 80, 0.14); }

.auth-pw-wrap { position: relative; }
.auth-pw-wrap .input { padding-right: 40px; }
.auth-pw-eye {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  background: none; border: 0; padding: 6px; cursor: pointer; color: var(--text-3);
  display: grid; place-items: center; border-radius: 8px;
}
.auth-pw-eye:hover { color: var(--text-2); background: var(--surface-2); }

.auth-choices { display: flex; flex-wrap: wrap; gap: 8px; }
.auth-choice {
  border: 1px solid var(--border); border-radius: 12px; padding: 9px 14px; font-size: 13px;
  color: var(--text-2); cursor: pointer; background: var(--surface); transition: all 0.15s var(--ease);
}
.auth-choice:hover { border-color: var(--border-strong); }
.auth-choice.is-on { border-color: #111827; background: var(--brand); color: #111827; font-weight: 700; }

.auth-consent { display: flex; gap: 9px; align-items: flex-start; font-size: 12.5px; color: var(--text-2); line-height: 1.5; }
.auth-consent input { margin-top: 2px; flex: 0 0 auto; accent-color: #111827; }
.auth-consent a { color: var(--text); font-weight: 700; }

/* ------------------------------------------- the country picker */
.auth-field { margin-bottom: 16px; }
.auth-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.auth-chip {
  border: 1px solid var(--border); border-radius: 99px; padding: 6px 14px; font-size: 12.5px;
  color: var(--text-2); cursor: pointer; background: var(--surface); transition: all 0.15s var(--ease);
}
.auth-chip:hover { border-color: var(--border-strong); }
.auth-chip.is-on {
  border-color: #111827; background: var(--brand); color: #111827; font-weight: 700;
}
.auth-country {
  border: 1px solid var(--border); border-radius: 12px; background: var(--surface-1);
  padding: 14px; margin: 4px 0 18px;
}
.auth-country-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding-bottom: 12px; margin-bottom: 12px; border-bottom: 1px solid var(--border);
}
.auth-country-head strong { display: block; font-size: 14px; font-weight: 700; }
.auth-country-head span { font-size: 12px; color: var(--text-3); }
.auth-country-badge {
  flex: 0 0 auto; background: var(--brand-soft); color: var(--brand); font-weight: 650;
  font-size: 11.5px; padding: 4px 9px; border-radius: 7px;
}
.auth-country-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; }
.auth-country-grid span {
  display: block; font-size: 10.5px; color: var(--text-3); text-transform: uppercase;
  letter-spacing: 0.05em; margin-bottom: 2px;
}
.auth-country-grid strong { font-size: 12.5px; font-weight: 600; color: var(--text-2); }

.auth-review { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.auth-review-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 14px; background: var(--surface-2); border-bottom: 1px solid var(--border);
}
.auth-review-head h3 { font-size: 12.5px; font-weight: 700; letter-spacing: 0.01em; }
.auth-review-head button { background: none; border: 0; color: var(--brand); font-size: 12px; font-weight: 600; cursor: pointer; }
.auth-review-list { display: grid; grid-template-columns: 128px 1fr; gap: 0; }
.auth-review-list dt {
  font-size: 12px; color: var(--text-3); padding: 9px 14px; border-bottom: 1px solid var(--border);
  background: var(--surface-1);
}
.auth-review-list dd {
  font-size: 12.5px; color: var(--text-2); padding: 9px 14px; border-bottom: 1px solid var(--border);
  margin: 0; word-break: break-word;
}
.auth-review-list dt:last-of-type, .auth-review-list dd:last-of-type { border-bottom: 0; }
.auth-review-note {
  margin: 12px 0 4px;
  padding: 10px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--text-2);
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.auth-review-note .ic {
  color: var(--text-3);
  flex-shrink: 0;
  margin-top: 2px;
}

.auth-plan {
  display: flex; align-items: center; gap: 12px; border: 1px solid var(--brand);
  background: var(--brand-soft); border-radius: 12px; padding: 12px 14px;
}
.auth-plan-badge {
  width: 34px; height: 34px; border-radius: 9px; background: var(--brand); color: #111827; font-weight: 800;
  display: grid; place-items: center; flex: 0 0 auto;
}
.auth-plan strong { font-size: 13px; display: block; }
.auth-plan span { font-size: 12px; color: var(--text-2); }

.auth-success { text-align: center; }
.auth-success-mark {
  width: 54px; height: 54px; border-radius: 50%; background: var(--success-soft); color: var(--success);
  display: grid; place-items: center; margin: 0 auto 14px;
}
.auth-checklist { text-align: left; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; margin: 18px 0; }
.auth-checklist div {
  display: flex; gap: 10px; align-items: center; padding: 11px 14px; font-size: 12.5px;
  color: var(--text-2); border-bottom: 1px solid var(--border);
}
.auth-checklist div:last-child { border-bottom: 0; }
.auth-checklist .n {
  width: 20px; height: 20px; border-radius: 50%; background: var(--surface-2); color: var(--text-3);
  display: grid; place-items: center; font-size: 11px; font-weight: 700; flex: 0 0 auto;
}

.auth-actions { display: flex; gap: 10px; margin-top: 20px; }
.auth-actions .btn { flex: 1 1 auto; }
.auth-actions .btn-ghost { flex: 0 0 auto; }

/* -------------------------------------------------------------------------- */
/* Standalone Enterprise Workspace Signup Experience (Unified with Auth)       */
/* -------------------------------------------------------------------------- */
.signup-page {
  position: fixed; inset: 0; z-index: 100;
  display: flex; flex-direction: column;
  background: var(--bg);
  overflow-y: auto;
  min-height: 100vh;
}


/* ---------------------------------------------- the guided setup */
.ob { max-width: 1080px; margin: 0 auto; padding: 28px 20px 80px; }
.ob-top {
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  padding: 22px 28px; margin-bottom: 28px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 18px; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
}
.ob-h1 { font-size: 24px; font-weight: 800; letter-spacing: -0.03em; color: var(--text); margin: 0; }
.ob-sub { color: var(--text-3); font-size: 13.5px; margin-top: 5px; margin-bottom: 0; }
.ob-progress {
  display: flex; flex-direction: column; align-items: flex-end; gap: 7px; flex: 0 0 auto;
  background: var(--surface-2); border: 1px solid var(--border); padding: 9px 16px; border-radius: 12px;
}
.ob-progress span { font-size: 12px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.ob-progress-bar {
  width: 170px; height: 6px; border-radius: 99px; background: var(--border); overflow: hidden;
}
.ob-progress-bar i {
  display: block; height: 100%; border-radius: 99px; background: var(--brand);
  transition: width 0.35s var(--ease);
}
.ob-body { display: grid; grid-template-columns: 290px 1fr; gap: 28px; align-items: start; }
.ob-rail-wrap { position: sticky; top: 20px; min-width: 0; }
.ob-card { min-width: 0; }
.ob-rail { list-style: none; display: flex; flex-direction: column; gap: 8px; padding: 0; margin: 0; }
.ob-rail-item {
  display: flex; gap: 14px; align-items: center; padding: 13px 16px; border-radius: 14px;
  cursor: pointer; transition: all 0.18s var(--ease); border: 1px solid transparent;
}
.ob-rail-item:hover { background: var(--surface-2); }
.ob-rail-dot {
  width: 28px; height: 28px; border-radius: 50%; flex: 0 0 auto; display: grid; place-items: center;
  background: var(--surface-2); border: 1.5px solid var(--border); color: var(--text-3);
  font-size: 12px; font-weight: 750; transition: all 0.18s var(--ease);
}
.ob-rail-text strong { display: block; font-size: 13px; font-weight: 650; color: var(--text-2); }
.ob-rail-text small { display: block; font-size: 11.5px; color: var(--text-3); margin-top: 2px; line-height: 1.4; }
.ob-rail-item.is-current {
  background: var(--surface); border-color: var(--border);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.04);
}
.ob-rail-item.is-current .ob-rail-dot {
  border-color: #111827; color: #111827; background: var(--brand); font-weight: 800;
  box-shadow: 0 0 10px rgba(200, 241, 53, 0.4);
}
.ob-rail-item.is-current .ob-rail-text strong { color: var(--text); font-weight: 750; }
.ob-rail-item.is-done .ob-rail-dot { background: var(--success); border-color: var(--success); color: #fff; }
.ob-rail-item.is-done .ob-rail-text strong { color: var(--text-3); }

.ob-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 20px;
  padding: 34px 38px 30px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.03);
}
.ob-eyebrow {
  display: inline-block; font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em;
  color: #111827; background: var(--brand); font-weight: 750; padding: 3px 8px; border-radius: 6px;
  margin-bottom: 10px;
}
.ob-title { font-size: 22px; font-weight: 800; letter-spacing: -0.025em; color: var(--text); margin: 0; }
.ob-blurb { color: var(--text-3); font-size: 13.5px; margin-top: 6px; margin-bottom: 24px; line-height: 1.5; }
.ob-form .field { margin-bottom: 16px; }
.ob-note {
  border: 1px solid var(--border); background: var(--surface-2); border-radius: 12px;
  padding: 14px 18px; font-size: 12.5px; color: var(--text-2); line-height: 1.55; margin-top: 14px;
}
.ob-hint { font-size: 12.5px; color: var(--text-3); margin-top: 12px; line-height: 1.5; }
.ob-msg { min-height: 20px; margin-top: 10px; }
.ob-actions {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border);
}
.ob-actions-right { display: flex; align-items: center; gap: 10px; }
.ob-foot { display: flex; gap: 16px; justify-content: center; margin-top: 26px; }
.ob-line { display: grid; grid-template-columns: 1fr 190px; gap: 12px; align-items: end; }
.ob-line-right { min-width: 0; }
.ob-total {
  display: flex; gap: 20px; align-items: center; justify-content: flex-end; flex-wrap: wrap;
  border: 1px solid var(--border); background: var(--surface-2); border-radius: 12px;
  padding: 14px 18px; margin-top: 16px; font-size: 13px; color: var(--text-2);
}
.ob-total strong { font-size: 16px; font-weight: 800; color: var(--text); }
.ob-list { border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
.ob-list-row {
  display: flex; gap: 12px; align-items: center; padding: 12px 16px;
  border-bottom: 1px solid var(--border); font-size: 13px; background: var(--surface);
}
.ob-list-row:last-child { border-bottom: 0; }
.ob-list-row strong { display: block; font-weight: 650; color: var(--text); }
.ob-list-row small { color: var(--text-3); font-size: 12px; }
.ob-roles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; }
.ob-role {
  border: 1px solid var(--border); border-radius: 14px; padding: 14px 16px;
  background: var(--surface); transition: all 0.18s var(--ease); cursor: default;
}
.ob-role:hover { border-color: var(--brand); background: var(--surface-2); box-shadow: 0 4px 12px rgba(0,0,0,0.03); }
.ob-role strong { display: block; font-size: 13px; font-weight: 750; color: var(--text); }
.ob-role span { font-size: 11.5px; color: var(--text-3); line-height: 1.45; margin-top: 4px; display: block; }
.ob-done { max-width: 620px; margin: 0 auto; }
.ob-done-grid { border: 1px solid var(--border); border-radius: 14px; overflow: hidden; margin-top: 18px; }
.ob-done-row {
  display: flex; justify-content: space-between; gap: 14px; padding: 13px 18px;
  border-bottom: 1px solid var(--border); font-size: 13px; background: var(--surface);
}
.ob-done-row:last-child { border-bottom: 0; }
.ob-done-row span { color: var(--text-3); }
.ob-done-row strong { font-weight: 700; text-align: right; color: var(--text); }
.ob-slabs { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); }
.ob-slabs-label {
  display: block; font-size: 11px; font-weight: 700; letter-spacing: .05em;
  text-transform: uppercase; color: var(--text-3); margin-bottom: 9px;
}
.ob-slab-row { display: flex; flex-wrap: wrap; gap: 7px; }
.ob-slab {
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text-2);
  border-radius: 999px; padding: 6px 14px; font-size: 12px; font-weight: 650;
  cursor: pointer; transition: all 0.15s var(--ease);
}
.ob-slab:hover { border-color: var(--brand); color: var(--text); background: var(--surface); }
.ob-slab.is-on {
  border-color: #111827; color: #111827; background: var(--brand); font-weight: 750;
  box-shadow: 0 2px 8px rgba(200, 241, 53, 0.3);
}

@media (max-width: 860px) {
  .ob-body { grid-template-columns: 1fr; }
  .ob-rail-wrap { position: static; }
  .ob-rail { flex-direction: row; overflow-x: auto; max-width: 100%; padding-bottom: 6px; }
  .ob-rail-item { flex: 0 0 auto; max-width: 210px; }
  .ob-rail-text { min-width: 0; }
  .ob-rail-text strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .ob-rail-text small { display: none; }
  .ob-top { flex-direction: column; align-items: flex-start; }
  .ob-progress { align-items: flex-start; }
  .ob-progress-bar { width: 100%; }
  .ob-roles { grid-template-columns: 1fr; }
  .ob-line { grid-template-columns: 1fr; }
}

/* ---------------- customer portal ---------------- */
.portal-page { min-height: 100vh; background: var(--bg); }
.portal-top {
  background: var(--surface); border-bottom: 1px solid var(--border); padding: 0 32px;
  height: 68px; display: flex; align-items: center; gap: 14px; position: sticky; top: 0; z-index: 20;
}
.portal-wrap { max-width: 1080px; margin: 0 auto; padding: 30px 24px 60px; }
.portal-hero {
  border-radius: var(--r-xl); padding: 30px 32px; color: #fff; position: relative; overflow: hidden;
  background: linear-gradient(135deg, #312e81, #5b21b6 60%, #7c3aed);
  margin-bottom: 22px;
}
.portal-hero::after {
  content: ""; position: absolute; width: 380px; height: 380px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.15), transparent 65%); right: -100px; top: -160px;
}
.portal-hero h1 { color: #fff; font-size: 26px; letter-spacing: -0.03em; }
.portal-hero p { color: rgba(255, 255, 255, 0.66); font-size: 13px; margin-top: 6px; }
.portal-hero-stats { display: flex; gap: 40px; margin-top: 22px; position: relative; z-index: 1; flex-wrap: wrap; }
.portal-hero-stat .label { font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; color: rgba(255, 255, 255, 0.55); font-weight: 700; }
.portal-hero-stat .value { font-size: 25px; font-weight: 730; letter-spacing: -0.02em; margin-top: 3px; font-variant-numeric: tabular-nums; }
.portal-top-name { min-width: 0; }
.portal-top-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* On a phone the portal's tables become one card per row, with each value
   labelled, instead of a table cut off at the edge of the screen. */
@media (max-width: 640px) {
  .portal-top { gap: 10px; }
  .portal-top-label { display: none; }
  .portal-hero-stats { gap: 18px 28px; }
  .portal-hero-stat .value { font-size: 21px; }
  .portal-tbl thead { display: none; }
  .portal-tbl, .portal-tbl tbody { display: block; width: 100%; }
  .tbl-scroll:has(> .portal-tbl) { overflow: visible; }
  .portal-tbl tr {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px 16px;
    padding: 16px 18px; border-bottom: 1px solid var(--border);
  }
  .portal-tbl tr:last-child { border-bottom: 0; }
  .portal-tbl td { display: block; padding: 0; border: 0; text-align: left; white-space: normal; min-width: 0; }
  .portal-tbl td.num { text-align: left; }
  .portal-tbl td:first-child { grid-column: 1; align-self: center; }
  .portal-tbl td.portal-status { grid-column: 2; grid-row: 1; justify-self: end; align-self: center; }
  .portal-tbl td[data-label]::before {
    content: attr(data-label); display: block; margin-bottom: 3px;
    font-size: 10.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-3);
  }
  .portal-tbl td.row-actions { grid-column: 1 / -1; }
  .portal-tbl td.row-actions .hstack { justify-content: stretch !important; }
  .portal-tbl td.row-actions .btn { flex: 1; justify-content: center; }
}

/* ---------------- print ---------------- */
.print-only { display: none; }
@media print {
  @page { size: A4; margin: 10mm; }
  html, body {
    background: #fff !important;
    color: #111827 !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    color-adjust: exact !important;
  }
  body::before { display: none !important; }
  .toast-root, .palette-backdrop, #boot { display: none !important; }
  .print-only { display: block !important; }
  .doc-print-bar { display: none !important; }
  .doc-stage { padding: 0 !important; border: 0 !important; background: #fff !important; }
  .doc {
    box-shadow: none !important; border-radius: 0 !important; max-width: none !important;
    padding: 24px 30px !important; width: 100% !important; font-size: 11.5px !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  .doc-accent {
    height: 6px !important;
    background: var(--doc-accent, #5b5bd6) !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  .doc-logo {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  .doc-table { page-break-inside: auto; }
  .doc-table tr { page-break-inside: avoid; }
  .doc-table thead th {
    background: #f8fafc !important;
    border-bottom: 1.5px solid #e2e8f0 !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  .doc-title { font-size: 24px !important; }

  /* printing from inside a modal (payment receipts, statements) */
  .modal-backdrop {
    position: static !important; padding: 0 !important; background: #fff !important;
    backdrop-filter: none !important; display: block !important; overflow: visible !important;
  }
  .modal {
    max-width: none !important; box-shadow: none !important; border: 0 !important;
    margin: 0 !important; background: #fff !important;
  }
  .modal-head, .modal-foot { display: none !important; }
  .modal-body { padding: 0 !important; }
  body.modal-open { overflow: visible !important; }
  body.modal-open .app { display: none !important; }
  .nav-backdrop { display: none !important; }
}

/* ---------------- responsive ---------------- */
@media (max-width: 1320px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-main-side { grid-template-columns: minmax(0, 1fr) 310px; }
}
@media (max-width: 1120px) {
  .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-main-side, .g-side-main { grid-template-columns: minmax(0, 1fr); }
  .topbar-search { width: 240px; }
  .view { padding: 20px 22px 64px; }
  .topbar { padding: 0 22px; }
}
@media (max-width: 1023px) {
  .app, .app.nav-collapsed { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; left: 0; top: 0; width: 280px; height: 100vh;
    transform: translateX(-102%); transition: transform 0.26s var(--ease);
    box-shadow: var(--shadow-lg); z-index: 110;
  }
  .app.nav-open .sidebar { transform: none; }
  .nav-toggle { display: grid; }
  .nav-backdrop {
    position: fixed; inset: 0; background: rgba(11, 14, 25, 0.45); z-index: 105;
    backdrop-filter: blur(2px); animation: fadeIn 0.2s;
  }
  .auth-main, .auth-page-main { padding: 32px 16px; }
  .auth-card { padding: 28px 20px; }
}
@media (max-width: 820px) {
  .g-3, .g-2, .split-2, .form-grid.cols-3, .form-grid.cols-4 { grid-template-columns: minmax(0, 1fr); }
  .form-grid.cols-2 { grid-template-columns: minmax(0, 1fr); }
  .form-grid .span-2, .form-grid .span-3 { grid-column: auto; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .page-title { font-size: 21px; }
  .view { padding: 16px 16px 60px; }
  .topbar { padding: 0 14px; gap: 8px; }
  .topbar-search { width: auto; flex: 1; max-width: none; }
  .topbar-search .kbd, .topbar-search span.placeholder-label { display: none; }
  .topbar-actions .desktop-only { display: none; }
  .doc { padding: 26px 22px; }
  .doc-head, .doc-meta { flex-direction: column; gap: 18px; }
  .doc-title-wrap { text-align: left; }
  .doc-totals-wrap { flex-direction: column; }
  .doc-totals { width: 100%; }
  .doc-stage { padding: 10px; }
  .modal-backdrop { padding: 20px 12px; }
  .notif-panel { width: min(360px, calc(100vw - 24px)); right: -6px; }
  .kv { grid-template-columns: 110px minmax(0, 1fr); }
  .page-head { align-items: flex-start; }
}
@media (max-width: 560px) {
  .kpi-grid { grid-template-columns: minmax(0, 1fr); }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1; }
  .btn .label-text.hide-sm { display: none; }
  .doc-print-bar { flex-wrap: wrap; }
  .portal-top { padding: 0 16px; }
  .portal-wrap { padding: 18px 14px 48px; }
  .portal-hero { padding: 24px 20px; }
  .toast-root { left: 14px; right: 14px; bottom: 14px; align-items: stretch; }
  .toast { max-width: none; }
}

/* ---------------------------------------------------------------- invoice templates */
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 18px; }
.tpl-card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; overflow: hidden; display: flex; flex-direction: column; transition: border-color .15s, box-shadow .15s; }
.tpl-card:hover { border-color: var(--border-strong, var(--border)); box-shadow: var(--shadow); }
.tpl-card.is-default { border-color: var(--success, #10b981); box-shadow: 0 0 0 1px var(--success, #10b981) inset; }
.tpl-card .ivd-thumb { display: block; border-radius: 0; height: 280px; }
.tpl-card-body { padding: 14px 16px 16px; display: flex; flex-direction: column; flex: 1; }
.tpl-card-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 12px; }
.ivd-thumb-sm { height: 190px; }
.ivd-thumb-sm > .ivd-thumb-inner { transform: translateX(-50%) scale(.2); top: 10px; }
.tpl-layout-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.tpl-layout-option { text-align: left; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 10px; cursor: pointer; font: inherit; color: inherit; }
.tpl-layout-option:hover { border-color: var(--brand-ink, var(--text)); }

.tpl-editor-page { max-width: none; }
.tpl-editor-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.tpl-name { max-width: 320px; font-weight: 650; }
.tpl-editor { display: grid; grid-template-columns: 380px minmax(0, 1fr); gap: 20px; align-items: start; }
.tpl-controls { position: sticky; top: 76px; max-height: calc(100vh - 96px); overflow: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; }
.tpl-section { border-bottom: 1px solid var(--border); }
.tpl-section:last-child { border-bottom: 0; }
.tpl-section > summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; font-weight: 700; font-size: 13.5px; }
.tpl-section > summary::-webkit-details-marker { display: none; }
.tpl-section[open] > summary svg { transform: rotate(180deg); }
.tpl-section-body { padding: 0 16px 16px; }
.tpl-layouts { display: grid; gap: 6px; }
.tpl-layout-chip { display: block; cursor: pointer; }
.tpl-layout-chip input { position: absolute; opacity: 0; pointer-events: none; }
.tpl-layout-chip span { display: block; padding: 9px 11px; border: 1px solid var(--border); border-radius: 10px; }
.tpl-layout-chip small { display: block; color: var(--text-3); font-size: 11.5px; line-height: 1.35; margin-top: 2px; }
.tpl-layout-chip input:checked + span { border-color: var(--text); box-shadow: 0 0 0 1px var(--text) inset; background: var(--surface-2); }
.tpl-layout-chip input:focus-visible + span { outline: 2px solid var(--brand, #c8f135); outline-offset: 2px; }
.tpl-swatches { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tpl-swatch { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--border); cursor: pointer; padding: 0; position: relative; overflow: hidden; }
.tpl-swatch.is-active { box-shadow: 0 0 0 2px var(--text); }
.tpl-swatch-custom { background: conic-gradient(#ef4444, #f59e0b, #10b981, #3b82f6, #8b5cf6, #ef4444); }
.tpl-swatch-custom input { position: absolute; inset: -6px; width: 40px; height: 40px; opacity: 0; cursor: pointer; }
.tpl-seg { display: inline-flex; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.tpl-seg label { cursor: pointer; }
.tpl-seg input { position: absolute; opacity: 0; pointer-events: none; }
.tpl-seg span { display: block; padding: 7px 12px; font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.tpl-seg label + label span { border-left: 1px solid var(--border); }
.tpl-seg input:checked + span { background: var(--text); color: var(--surface); }
.tpl-seg input:focus-visible + span { outline: 2px solid var(--brand, #c8f135); outline-offset: -2px; }
.tpl-show-group { margin-bottom: 12px; }
.tpl-show-group .checkbox { display: flex; margin: 5px 0; font-size: 13px; }
.tpl-show-title { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); margin-bottom: 4px; }
.tpl-sign-row { display: flex; gap: 14px; align-items: flex-start; }
.tpl-sign-preview { width: 130px; height: 64px; object-fit: contain; background: #fff; border: 1px solid var(--border); border-radius: 10px; flex: none; }
.tpl-sign-empty { display: grid; place-items: center; font-size: 11px; color: var(--text-3); background: var(--surface-2); }
.tpl-preview { min-width: 0; }
.tpl-preview-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.tpl-preview-stage { background: var(--surface-3); border: 1px solid var(--border); border-radius: 16px; padding: 24px; overflow-x: auto; }
@media (max-width: 1100px) {
  .tpl-editor { grid-template-columns: 1fr; }
  .tpl-controls { position: static; max-height: none; }
  .tpl-layout-pick { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .tpl-layout-pick { grid-template-columns: 1fr; }
  .tpl-preview-stage { padding: 8px; }
}

/* ---------------- interactive tour overlay & popover ---------------- */
.tiliso-tour-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
  z-index: 9998;
  pointer-events: auto;
  transition: opacity 0.3s ease;
}
.tiliso-tour-spotlight {
  position: fixed;
  z-index: 9999;
  border-radius: 12px;
  box-shadow: 0 0 0 9999px rgba(15, 23, 42, 0.55), 0 0 20px rgba(14, 165, 233, 0.4);
  border: 2px solid var(--primary, #0ea5e9);
  pointer-events: none;
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
.tiliso-tour-card {
  position: fixed;
  z-index: 10001;
  width: 360px;
  max-width: calc(100vw - 32px);
  background: var(--surface, #ffffff);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 20px 45px -10px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(0, 0, 0, 0.05);
  padding: 18px 20px 16px;
  transition: top 0.3s cubic-bezier(0.16, 1, 0.3, 1), left 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  animation: tourCardPop 0.25s ease-out;
}
@keyframes tourCardPop {
  from { opacity: 0; transform: scale(0.96) translateY(4px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.tour-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.tour-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  background: var(--primary-soft, rgba(14, 165, 233, 0.12));
  color: var(--primary, #0ea5e9);
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.tour-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.tour-close-btn:hover {
  background: var(--surface-sunken, #f1f5f9);
  color: var(--text);
}
.tour-title {
  margin: 0 0 6px 0;
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.01em;
}
.tour-desc {
  margin: 0 0 16px 0;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--text-2, #475569);
}
.tour-card-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.tour-dots {
  display: flex;
  gap: 5px;
  align-items: center;
}
.tour-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--border-strong, #cbd5e1);
  transition: all 0.2s ease;
}
.tour-dot.is-active {
  width: 18px;
  border-radius: 4px;
  background: var(--primary, #0ea5e9);
}
.tour-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
.tour-skip-btn {
  color: var(--text-muted) !important;
  font-size: 12px !important;
  font-weight: 600 !important;
}
.tour-skip-btn:hover {
  color: var(--text) !important;
}
.tour-next-btn {
  font-weight: 700 !important;
}

/* ---------------------------------------------------------------- HSN/SAC search (ui.hsnPicker) */
.hsn-menu { position: absolute; z-index: 1200; max-height: 340px; overflow-y: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg, 0 12px 32px rgba(15, 23, 42, .16)); padding: 4px; }
.hsn-option { display: grid; grid-template-columns: auto auto 1fr; gap: 4px 10px; align-items: baseline; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.hsn-option.is-active, .hsn-option:hover { background: var(--surface-2); }
.hsn-code { font-family: var(--mono, ui-monospace, monospace); font-weight: 700; font-size: 13px; color: var(--text); }
.hsn-kind { font-size: 10px; font-weight: 700; letter-spacing: .06em; color: var(--text-3); border: 1px solid var(--border); border-radius: 4px; padding: 0 4px; }
.hsn-desc { font-size: 12.5px; color: var(--text-2); line-height: 1.35; }
.hsn-empty, .hsn-foot { padding: 8px 10px; font-size: 11.5px; color: var(--text-3); }
.hsn-foot { border-top: 1px solid var(--border); margin-top: 4px; }

/* ---------------------------------------------------------------- record payment */
.pay-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; padding: 14px 16px; margin-bottom: 18px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 14px; }
.pay-head-amount { font-size: 22px; font-weight: 750; letter-spacing: -.02em; }
.pay-head-side { display: flex; gap: 22px; flex-wrap: wrap; }
.pay-head-side > div { display: flex; flex-direction: column; text-align: right; }
.pay-head-side strong { font-size: 13.5px; }
.pay-deductions { margin: 2px 0 14px; border: 1px dashed var(--border); border-radius: 12px; padding: 10px 14px; }
.pay-deductions > summary { cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 650; color: var(--text-2); }
.pay-deductions > summary::-webkit-details-marker { display: none; }
.pay-deductions[open] > summary { color: var(--text); }
.pay-chips { display: flex; gap: 6px; margin-top: 6px; }
.pay-chips .chip { border: 1px solid var(--border); background: var(--surface); border-radius: 999px; padding: 2px 10px; font: inherit; font-size: 12px; font-weight: 650; cursor: pointer; color: var(--text-2); }
.pay-chips .chip:hover { border-color: var(--text-3); color: var(--text); }
.pay-summary { padding: 12px 14px; margin-bottom: 14px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; font-size: 13px; }
.pay-summary .rowline { display: flex; justify-content: space-between; padding: 3px 0; color: var(--text-2); }
.pay-summary .rowline.strong { color: var(--text); font-weight: 700; border-top: 1px solid var(--border); margin-top: 4px; padding-top: 7px; }
.pay-status { display: flex; align-items: center; gap: 7px; margin-top: 8px; font-weight: 600; font-size: 12.5px; }
.pay-status.ok { color: var(--success-ink, #047857); }
.pay-status.part { color: var(--warning-ink, #b45309); }
.pay-status.over { color: var(--info-ink, #1d4ed8); }
@media (max-width: 560px) { .pay-head-side > div { text-align: left; } }

/* ---------------------------------------------------------------- foreign-currency payment (invoices.js) */
.pay-fx { margin: 2px 0 14px; padding: 14px 16px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 14px; }
.pay-fx-title { display: flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 700; margin-bottom: 10px; }
.pay-fx .field { margin-bottom: 0; }
.pay-fx-note { margin-top: 10px; font-size: 12.5px; color: var(--text-2); }
.pay-gain { color: var(--success-ink, #047857); font-weight: 700; }
.pay-loss { color: var(--danger-ink, #b91c1c); font-weight: 700; }

/* LUT validity warning under the tax treatment (invoice-editor.js) */
.lut-warn { display: block; margin-top: 6px; padding: 7px 10px; border-radius: 9px; font-weight: 600; line-height: 1.45; }
.lut-warn svg { vertical-align: -2px; }
.lut-warn.red { background: var(--danger-soft); color: var(--danger-ink); }
.lut-warn.amber { background: var(--warning-soft); color: var(--warning-ink); }
