/* ============================================================
   Tawasul Printing — design system
   Shared styles for the public site, auth screens and dashboard.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans+Arabic:wght@400;500;600;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Arabic:wght@400;500;600;700&family=Noto+Sans+Bengali:wght@400;500;600;700&family=Noto+Sans+Devanagari:wght@400;500;600;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@400;500;700;800&display=swap');

:root {
  /* --- palette (v2) ------------------------------------------------ */
  --brand-50: #eef4ff;
  --brand-100: #dce9ff;
  --brand-200: #b8d2ff;
  --brand-500: #4b82f7;
  --brand-600: #2f6bff;
  --brand-700: #1d4ed8;
  --brand-900: #12286b;

  --accent-400: #22d3ee;
  --accent-500: #0d9488;

  --navy-900: #0a1526;
  --navy-800: #101f39;

  --ink-900: #0b1220;
  --ink-800: #1b2536;
  --ink-700: #334155;
  --ink-600: #475569;
  --ink-500: #64748b;
  --ink-400: #94a3b8;

  --line: #e2e8f2;
  --line-soft: #eef2f9;
  --surface: #ffffff;
  --surface-2: #f8faff;
  --bg: #f5f7fc;

  --success: #047857;
  --danger: #b91c1c;
  --warning: #b45309;

  /* --- shape ------------------------------------------------------- */
  --radius-sm: 0.6rem;
  --radius: 0.85rem;
  --radius-lg: 1.1rem;
  --radius-xl: 1.5rem;

  /* --- depth ------------------------------------------------------- */
  --shadow-xs: 0 1px 2px rgba(11, 18, 32, 0.06);
  --shadow-sm: 0 10px 26px -18px rgba(11, 18, 32, 0.28);
  --shadow-md: 0 28px 60px -36px rgba(11, 18, 32, 0.45);
  --shadow-brand: 0 18px 36px -18px rgba(47, 107, 255, 0.55);
  --ring: 0 0 0 3px rgba(47, 107, 255, 0.25);
}

/* --- Base ---------------------------------------------------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family:
    'IBM Plex Sans Arabic',
    'Tajawal',
    system-ui,
    -apple-system,
    'Segoe UI',
    sans-serif;
  background-color: var(--bg);
  background-image: radial-gradient(
      1200px 560px at 100% -10%,
      #e4edff 0%,
      rgba(228, 237, 255, 0) 60%
    ),
    radial-gradient(900px 500px at 0% 0%, #eaf7ff 0%, rgba(234, 247, 255, 0) 55%);
  background-attachment: fixed;
  color: var(--ink-700);
  min-height: 100vh;
  overflow: auto;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Script-specific stacks: Bengali and Devanagari need taller line boxes,
   Urdu keeps the Arabic script but with the Noto coverage. */
html[lang='ur'] body {
  font-family: 'Noto Sans Arabic', 'IBM Plex Sans Arabic', 'Tajawal', system-ui, sans-serif;
}

html[lang='bn'] body {
  font-family: 'Noto Sans Bengali', 'IBM Plex Sans Arabic', system-ui, sans-serif;
  line-height: 1.7;
}

html[lang='hi'] body {
  font-family: 'Noto Sans Devanagari', 'IBM Plex Sans Arabic', system-ui, sans-serif;
  line-height: 1.7;
}

h1,
h2,
h3,
h4 {
  color: var(--ink-900);
  font-weight: 800;
  line-height: 1.3;
}

a {
  color: inherit;
}

::selection {
  background-color: var(--brand-600);
  color: #fff;
}

:focus-visible {
  outline: 2px solid var(--brand-600);
  outline-offset: 2px;
}

/* Keep the dashboard shell transparent so the page gradient shows. */
.flex.h-screen {
  background-color: transparent;
}

/* --- Buttons -------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 2.75rem;
  padding: 0.625rem 1.25rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  box-shadow: var(--shadow-xs);
  transition:
    transform 0.16s ease,
    box-shadow 0.2s ease,
    background-color 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}

.btn-primary {
  background-color: var(--brand-600);
  background-image: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
  color: #fff;
  box-shadow: 0 10px 22px -12px rgba(37, 99, 235, 0.75);
}

.btn-primary:hover {
  background-image: linear-gradient(135deg, #1d4ed8 0%, #1e3a8a 100%);
  box-shadow: 0 14px 26px -12px rgba(37, 99, 235, 0.8);
}

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

.btn-secondary:hover {
  background-color: #065f46;
}

.btn-neutral {
  background-color: #fff;
  color: var(--ink-600);
  border-color: var(--line);
}

.btn-neutral:hover {
  background-color: #f8fbff;
  border-color: var(--brand-200);
  color: var(--brand-700);
}

.btn-ghost {
  background-color: transparent;
  color: var(--ink-600);
  border-color: transparent;
  box-shadow: none;
}

.btn-ghost:hover {
  background-color: #eef2f7;
  color: var(--ink-900);
}

.btn-danger {
  background-color: #dc2626;
  color: #fff;
}

.btn-danger:hover {
  background-color: #b91c1c;
}

.btn-light {
  background-color: #fff;
  color: var(--brand-700);
  border-color: transparent;
  box-shadow: 0 10px 24px -14px rgba(2, 6, 23, 0.6);
}

.btn-light:hover {
  background-color: #eff6ff;
  color: var(--brand-900);
}

.btn-lg {
  min-height: 3.25rem;
  padding: 0.85rem 1.9rem;
  border-radius: var(--radius-lg);
  font-size: 1.05rem;
}

.btn-sm {
  min-height: 2.25rem;
  padding: 0.4rem 0.9rem;
  font-size: 0.85rem;
  border-radius: var(--radius-sm);
}

#language-toggle {
  min-width: 2.75rem;
  padding-inline: 0.75rem;
}

/* --- Forms ---------------------------------------------------- */

.form-card {
  background-color: var(--surface);
  padding: 2rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
}

.form-title {
  font-size: 1.55rem;
  font-weight: 800;
  color: var(--ink-900);
}

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--ink-700);
  margin-bottom: 0.5rem;
}

.form-input {
  width: 100%;
  min-height: 3rem;
  padding: 0.7rem 1rem;
  background-color: #fbfcfe;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink-900);
  transition:
    border-color 0.2s,
    box-shadow 0.2s,
    background-color 0.2s;
}

.form-input::placeholder {
  color: var(--ink-400);
}

.form-input:hover {
  border-color: #cbd5e1;
}

.form-input:focus {
  outline: none;
  background-color: #fff;
  border-color: var(--brand-500);
  box-shadow: var(--ring);
}

.form-input:disabled,
.form-input[readonly] {
  background-color: #f1f5f9;
  cursor: not-allowed;
}

/* Marks a field the save action is waiting for (e.g. the licence selector). */
.form-input.is-invalid {
  border-color: #dc2626;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.16);
  background-color: #fff;
}

/* Legacy pages rely on this rule; keep it valid plain CSS. */
form button[type='submit']:not(.btn) {
  background-color: var(--brand-600);
  color: #fff;
  font-weight: 700;
  padding: 0.625rem 1rem;
  border-radius: var(--radius);
  border: 0;
  cursor: pointer;
}

/* Auth pages used to force the footer links visible with inline !important
   rules. The new layout keeps them in normal flow, so only keep the base. */
p[data-translate-key='already_have_account'],
p[data-translate-key='no_account_yet'],
p[data-translate-key='go_back_to_login'] {
  display: block;
  margin-top: 1.5rem;
}

/* Radio cards (register page) */
.role-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.role-option {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background-color: #fff;
  cursor: pointer;
  font-weight: 600;
  color: var(--ink-700);
  transition:
    border-color 0.2s,
    background-color 0.2s,
    box-shadow 0.2s;
}

.role-option:hover {
  border-color: var(--brand-200);
  background-color: #f8fbff;
}

.role-option:has(input:checked) {
  border-color: var(--brand-600);
  background-color: var(--brand-50);
  color: var(--brand-900);
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.25) inset;
}

.role-option input {
  accent-color: var(--brand-600);
  width: 1rem;
  height: 1rem;
}

/* --- Tables --------------------------------------------------- */

.table-container {
  background-color: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
}

.data-table {
  width: 100%;
  min-width: 640px;
  text-align: right;
  font-size: 0.875rem;
  border-collapse: collapse;
}

.data-table thead th {
  background-color: #f8fafc;
  color: var(--ink-500);
  font-weight: 700;
  font-size: 0.78rem;
  padding: 0.85rem 1.25rem;
  white-space: nowrap;
  border-bottom: 1px solid var(--line);
}

.data-table tbody tr {
  border-bottom: 1px solid var(--line-soft);
  transition: background-color 0.15s ease;
}

.data-table tbody tr:last-of-type {
  border-bottom: none;
}

.data-table tbody tr:hover {
  background-color: #f8fbff;
}

.data-table tbody td {
  padding: 0.95rem 1.25rem;
  color: var(--ink-700);
  vertical-align: middle;
}

/* --- Status tags ---------------------------------------------- */

.date-tag {
  padding: 0.25rem 0.7rem;
  border-radius: 9999px;
  font-weight: 700;
  font-size: 0.75rem;
  display: inline-block;
  white-space: nowrap;
}

.date-tag.expired {
  background-color: #fee2e2;
  color: #b91c1c;
}

.date-tag.expiring-soon {
  background-color: #fef3c7;
  color: #92400e;
}

.date-tag.valid {
  background-color: #ecfdf5;
  color: #047857;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.65rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 700;
}

.badge-info {
  background-color: var(--brand-50);
  color: var(--brand-700);
}

.badge-success {
  background-color: #ecfdf5;
  color: #047857;
}

.badge-warning {
  background-color: #fffbeb;
  color: #92400e;
}

.badge-danger {
  background-color: #fef2f2;
  color: #b91c1c;
}

/* --- Stat cards ----------------------------------------------- */

.stat-card {
  display: block;
  background-color: var(--surface);
  padding: 1.15rem 1.25rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  text-decoration: none;
  color: inherit;
  transition:
    transform 0.18s ease,
    box-shadow 0.2s ease,
    border-color 0.2s ease;
}

.stat-card:hover {
  transform: translateY(-3px);
  border-color: var(--brand-200);
  box-shadow: var(--shadow-md);
}

.stat-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.stat-title {
  color: var(--ink-500);
  font-weight: 700;
  font-size: 0.85rem;
  line-height: 1.45;
}

.stat-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--ink-900);
  margin-top: 0.65rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.stat-hint {
  color: var(--ink-400);
  font-size: 0.78rem;
  margin-top: 0.4rem;
}

.stat-icon {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.stat-icon-blue {
  background-color: var(--brand-50);
  color: var(--brand-600);
}

.stat-icon-green {
  background-color: #ecfdf5;
  color: #059669;
}

.stat-icon-amber {
  background-color: #fffbeb;
  color: #d97706;
}

.stat-icon-rose {
  background-color: #fef2f2;
  color: #dc2626;
}

.stat-icon-orange {
  background-color: #fff7ed;
  color: #ea580c;
}

/* Legacy stat icon markup */
.stat-card .icon-container {
  width: 50px;
  height: 50px;
  border-radius: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-card .icon-container i {
  color: #fff;
  font-size: 1.2rem;
}

/* --- Message containers --------------------------------------- */

.message-container {
  margin-top: 1.25rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
  text-align: center;
  font-weight: 600;
  min-height: 1.5rem;
}

.message-container:empty {
  display: none;
}

.message-info {
  background-color: #e0f2fe;
  color: #0c4a6e;
}

.message-success {
  background-color: #dcfce7;
  color: #166534;
}

.message-error {
  background-color: #fee2e2;
  color: #991b1b;
}

.message-warning {
  background-color: #fffbeb;
  border-inline-start: 4px solid #f59e0b;
  color: #b45309;
}

/* --- Cards (data management) ---------------------------------- */

.card {
  background-color: var(--surface);
  padding: 1.5rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}

.card-header {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--ink-800);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.card p {
  color: var(--ink-600);
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
}

.card p:last-child {
  margin-bottom: 0;
}

.feature-list {
  list-style: none;
  display: grid;
  gap: 0.7rem;
  margin: 0;
  padding: 0;
}

.feature-list li {
  position: relative;
  padding-inline-start: 1.7rem;
  color: var(--ink-600);
  font-size: 0.95rem;
  line-height: 1.75;
  margin: 0;
}

.feature-list li::before {
  content: '✓';
  position: absolute;
  inset-inline-start: 0;
  top: 0.05rem;
  width: 1.15rem;
  height: 1.15rem;
  display: grid;
  place-items: center;
  border-radius: 9999px;
  background-color: var(--brand-50);
  color: var(--brand-700);
  font-size: 0.7rem;
  font-weight: 700;
}

.faq-q {
  font-size: 1.02rem;
  font-weight: 800;
  color: var(--ink-800);
  margin-bottom: 0.4rem;
}

.btn-action {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius);
  font-weight: 700;
  text-align: center;
  color: #fff;
  transition: all 0.25s ease-in-out;
  box-shadow: var(--shadow-sm);
}

.btn-action:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.btn-export-primary {
  background-color: var(--brand-500);
}

.btn-export-primary:hover {
  background-color: var(--brand-600);
}

.btn-backup-special {
  background-color: #7c3aed;
}

.btn-backup-special:hover {
  background-color: #6d28d9;
}

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

.btn-import-secondary:hover {
  background-color: #047857;
}

.btn-restore-danger {
  background-color: #dc2626;
}

.btn-restore-danger:hover {
  background-color: #b91c1c;
}

.file-input-wrapper {
  position: relative;
  overflow: hidden;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius);
  font-weight: 700;
  color: var(--ink-600);
  background-color: #eef2f7;
  transition: all 0.25s ease-in-out;
  box-shadow: var(--shadow-xs);
}

.file-input-wrapper:hover {
  background-color: #e2e8f0;
  transform: translateY(-2px);
}

.file-input-wrapper input[type='file'] {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

/* --- Empty states --------------------------------------------- */

.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--ink-500);
}

.empty-state i {
  font-size: 2rem;
  color: var(--brand-200);
  margin-bottom: 0.75rem;
  display: block;
}

.empty-state p {
  font-weight: 600;
}

/* ============================================================
   Public site
   ============================================================ */

.site-nav {
  background-color: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.02);
}

.site-nav .navbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 4.25rem;
  gap: 1rem;
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 800;
  color: var(--brand-700);
  text-decoration: none;
  white-space: nowrap;
}

.brand-mark {
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 0.8rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-image: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
  color: #fff;
  font-size: 1rem;
  box-shadow: 0 8px 16px -8px rgba(37, 99, 235, 0.75);
  flex-shrink: 0;
}

.brand-text {
  font-size: 1.2rem;
  line-height: 1.1;
}

.site-nav-links a {
  position: relative;
  padding: 0.55rem 0.9rem;
  border-radius: 0.6rem;
  font-size: 0.925rem;
  font-weight: 600;
  color: var(--ink-500);
  text-decoration: none;
  transition:
    color 0.2s,
    background-color 0.2s;
}

.site-nav-links a:hover {
  color: var(--brand-700);
  background-color: var(--brand-50);
}

.site-nav-links a.is-active {
  color: var(--brand-700);
  background-color: var(--brand-50);
}

.site-nav-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

#public-mobile-menu {
  border-top: 1px solid var(--line);
  background-color: #fff;
}

#public-mobile-menu a {
  border-radius: 0.6rem;
}

/* --- Hero ----------------------------------------------------- */

.hero {
  position: relative;
  overflow: hidden;
  padding: 4.5rem 0 4rem;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: linear-gradient(to right, rgba(37, 99, 235, 0.06) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(37, 99, 235, 0.06) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 0%, #000 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 0%, #000 30%, transparent 75%);
  pointer-events: none;
}

.hero-grid {
  position: relative;
  display: grid;
  grid-template-columns: 1.02fr 0.98fr;
  gap: 3.5rem;
  align-items: center;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.4rem 0.85rem;
  border-radius: 9999px;
  background-color: #fff;
  border: 1px solid var(--brand-100);
  color: var(--brand-700);
  font-size: 0.8rem;
  font-weight: 700;
  box-shadow: var(--shadow-xs);
}

.hero-badge i {
  color: var(--brand-500);
}

.hero-title {
  margin-top: 1.25rem;
  font-size: clamp(2.2rem, 4.4vw, 3.5rem);
  line-height: 1.14;
  font-weight: 800;
  color: var(--ink-900);
}

.hero-title .accent {
  display: block;
  color: var(--brand-600);
}

.hero-sub {
  margin-top: 1.25rem;
  max-width: 34rem;
  font-size: 1.075rem;
  line-height: 1.9;
  color: var(--ink-500);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 2rem;
}

.hero-trust {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.4rem;
  margin-top: 1.9rem;
  padding: 0;
  list-style: none;
  color: var(--ink-500);
  font-size: 0.875rem;
  font-weight: 600;
}

.hero-trust li {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.hero-trust i {
  color: #059669;
}

/* Decorative dashboard preview */
.hero-visual {
  position: relative;
}

.hero-visual::after {
  content: '';
  position: absolute;
  inset: 8% -6% -10% 6%;
  background: radial-gradient(closest-side, rgba(37, 99, 235, 0.18), transparent 70%);
  filter: blur(20px);
  z-index: 0;
}

.mock-window {
  position: relative;
  z-index: 1;
  background-color: #fff;
  border: 1px solid var(--line);
  border-radius: 1.25rem;
  box-shadow: 0 40px 80px -40px rgba(15, 23, 42, 0.45);
  padding: 1rem;
  transform: rotate(-1.4deg);
}

html[dir='ltr'] .mock-window {
  transform: rotate(1.4deg);
}

.mock-top {
  display: flex;
  gap: 0.35rem;
  padding: 0.15rem 0.25rem 0.75rem;
}

.mock-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 9999px;
  background-color: #e2e8f0;
}

.mock-dot:nth-child(1) {
  background-color: #fca5a5;
}

.mock-dot:nth-child(2) {
  background-color: #fcd34d;
}

.mock-dot:nth-child(3) {
  background-color: #86efac;
}

.mock-body {
  background-color: #f8fafc;
  border: 1px solid var(--line-soft);
  border-radius: 0.9rem;
  padding: 0.9rem;
}

.mock-kpis {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.6rem;
}

.mock-kpi {
  background-color: #fff;
  border: 1px solid var(--line-soft);
  border-radius: 0.75rem;
  padding: 0.7rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.mock-kpi strong {
  color: var(--ink-900);
  font-size: 1.25rem;
  line-height: 1;
  font-weight: 800;
}

.mock-kpi small {
  color: var(--ink-400);
  font-size: 0.7rem;
  font-weight: 700;
}

.mock-icon {
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 0.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  margin-bottom: 0.35rem;
}

.mock-icon.blue {
  background-color: var(--brand-50);
  color: var(--brand-600);
}

.mock-icon.green {
  background-color: #ecfdf5;
  color: #059669;
}

.mock-icon.amber {
  background-color: #fffbeb;
  color: #d97706;
}

.mock-alert {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background-color: #fff;
  border: 1px solid #fde68a;
  border-radius: 0.75rem;
  padding: 0.65rem 0.75rem;
  margin-top: 0.6rem;
}

.mock-alert-icon {
  width: 1.8rem;
  height: 1.8rem;
  border-radius: 0.5rem;
  background-color: #fffbeb;
  color: #d97706;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  flex-shrink: 0;
}

.mock-alert div {
  display: flex;
  flex-direction: column;
  line-height: 1.3;
  flex: 1;
}

.mock-alert strong {
  font-size: 0.75rem;
  color: var(--ink-800);
}

.mock-alert small {
  font-size: 0.68rem;
  color: var(--ink-400);
}

.mock-alert em {
  font-style: normal;
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--brand-700);
  background-color: var(--brand-50);
  padding: 0.2rem 0.5rem;
  border-radius: 9999px;
}

.mock-bars {
  display: grid;
  gap: 0.5rem;
  margin-top: 0.7rem;
}

.mock-bar-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.mock-bar-row span {
  width: 3.2rem;
  height: 0.45rem;
  border-radius: 9999px;
  background-color: #e2e8f0;
}

.mock-bar {
  flex: 1;
  height: 0.45rem;
  border-radius: 9999px;
  background-color: #e2e8f0;
  overflow: hidden;
}

.mock-bar i {
  display: block;
  height: 100%;
  border-radius: 9999px;
  background-image: linear-gradient(90deg, #60a5fa, #2563eb);
}

/* --- Sections ------------------------------------------------- */

.section {
  padding: 4.5rem 0;
}

.section-head {
  max-width: 640px;
  margin: 0 auto;
  text-align: center;
}

.eyebrow {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--brand-700);
  background-color: var(--brand-50);
  border: 1px solid var(--brand-100);
  padding: 0.3rem 0.75rem;
  border-radius: 9999px;
}

.section-title {
  margin-top: 0.9rem;
  font-size: clamp(1.7rem, 3vw, 2.3rem);
}

.section-sub {
  margin-top: 0.75rem;
  color: var(--ink-500);
  font-size: 1rem;
  line-height: 1.8;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-top: 2.75rem;
}

.feature-card {
  background-color: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.6rem 1.4rem;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    border-color 0.2s ease;
}

.feature-card:hover {
  transform: translateY(-4px);
  border-color: var(--brand-200);
  box-shadow: var(--shadow-md);
}

.feature-icon {
  width: 3rem;
  height: 3rem;
  border-radius: 0.9rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  background-color: var(--brand-50);
  color: var(--brand-600);
}

.feature-card:nth-child(2) .feature-icon {
  background-color: #ecfdf5;
  color: #059669;
}

.feature-card:nth-child(3) .feature-icon {
  background-color: #fffbeb;
  color: #d97706;
}

.feature-card:nth-child(4) .feature-icon {
  background-color: #eef2ff;
  color: #4f46e5;
}

.feature-card h3 {
  margin-top: 1.1rem;
  font-size: 1.05rem;
  font-weight: 800;
}

.feature-card p {
  margin-top: 0.5rem;
  color: var(--ink-500);
  font-size: 0.9rem;
  line-height: 1.8;
}

.steps-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  margin-top: 2.75rem;
  counter-reset: step;
}

.step-card {
  position: relative;
  background-color: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.6rem;
}

.step-num {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: var(--brand-700);
  background-color: var(--brand-50);
  border: 1px solid var(--brand-100);
}

.step-card h3 {
  margin-top: 0.9rem;
  font-size: 1.02rem;
}

.step-card p {
  margin-top: 0.4rem;
  color: var(--ink-500);
  font-size: 0.9rem;
  line-height: 1.8;
}

.cta-wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.cta-band {
  position: relative;
  overflow: hidden;
  border-radius: 1.5rem;
  background-image: linear-gradient(135deg, #1e3a8a 0%, #2563eb 55%, #3b82f6 100%);
  color: #e2e8f0;
  padding: 3rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  box-shadow: var(--shadow-brand);
}

.cta-band::before {
  content: '';
  position: absolute;
  width: 22rem;
  height: 22rem;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.08);
  inset-inline-end: -6rem;
  top: -10rem;
}

.cta-band h2 {
  color: #fff;
  font-size: clamp(1.5rem, 2.6vw, 2rem);
}

.cta-band p {
  margin-top: 0.6rem;
  color: #dbeafe;
  max-width: 36rem;
  line-height: 1.8;
}

.cta-band .btn {
  position: relative;
  flex-shrink: 0;
}

/* --- Footer --------------------------------------------------- */

.site-footer {
  background-color: #0b1220;
  color: #94a3b8;
  margin-top: 4.5rem;
  padding: 3rem 0 1.5rem;
}

.site-footer .brand-text {
  color: #fff;
}

.site-footer a {
  color: #cbd5e1;
  text-decoration: none;
  transition: color 0.2s;
}

.site-footer a:hover {
  color: #fff;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr;
  gap: 2rem;
}

.footer-tagline {
  margin-top: 0.9rem;
  max-width: 22rem;
  font-size: 0.9rem;
  line-height: 1.8;
  color: #94a3b8;
}

.footer-title {
  color: #e2e8f0;
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0;
  margin-bottom: 0.9rem;
}

.footer-links {
  display: grid;
  gap: 0.55rem;
  font-size: 0.9rem;
}

.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  margin-top: 2.5rem;
  padding-top: 1.25rem;
  text-align: center;
  font-size: 0.85rem;
  color: #94a3b8;
}

/* ============================================================
   Legal pages & 404
   ============================================================ */

.legal-topbar {
  background-color: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}

.legal-topbar-inner {
  max-width: 900px;
  margin-inline: auto;
  padding: 0.9rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.legal-wrap {
  max-width: 900px;
  margin-inline: auto;
  padding: 2.5rem 1.5rem 3.5rem;
}

.legal-card {
  background-color: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: clamp(1.5rem, 4vw, 3rem);
}

.legal-title {
  font-size: clamp(1.7rem, 3vw, 2.1rem);
}

.legal-meta {
  margin-top: 0.35rem;
  color: var(--ink-400);
  font-size: 0.85rem;
}

.legal-card p {
  margin-top: 1rem;
  color: var(--ink-600);
  font-size: 0.97rem;
  line-height: 1.95;
}

.legal-h2 {
  margin-top: 2.1rem;
  font-size: 1.15rem;
}

.legal-list {
  margin-top: 0.85rem;
  padding-inline-start: 1.4rem;
  list-style: disc;
  display: grid;
  gap: 0.4rem;
  color: var(--ink-600);
  font-size: 0.97rem;
  line-height: 1.9;
}

.legal-list strong {
  color: var(--ink-800);
}

.legal-actions {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}

.error-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem 1.25rem;
}

.error-card {
  width: 100%;
  max-width: 30rem;
  text-align: center;
  background-color: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  padding: clamp(2rem, 6vw, 3rem);
}

.error-brand {
  margin-bottom: 1.75rem;
  justify-content: center;
}

.error-code {
  font-size: clamp(3.5rem, 10vw, 5rem);
  font-weight: 800;
  line-height: 1;
  background-image: linear-gradient(135deg, var(--brand-700), var(--brand-500));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.error-title {
  margin-top: 0.75rem;
  font-size: 1.5rem;
}

.error-text {
  margin-top: 0.5rem;
  color: var(--ink-500);
  font-size: 0.98rem;
}

.error-actions {
  margin-top: 1.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
}

/* ============================================================
   Auth pages
   ============================================================ */

.auth-page {
  background-color: var(--bg);
}

.auth-shell {
  min-height: 100vh;
  max-width: 1180px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 2.5rem;
  align-items: center;
}

.auth-aside {
  position: relative;
  overflow: hidden;
  min-height: 600px;
  border-radius: 1.5rem;
  padding: 2.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  background-image: radial-gradient(120% 90% at 100% 0%, #3b82f6 0%, #1d4ed8 42%, #172554 100%);
  color: #dbeafe;
  box-shadow: var(--shadow-md);
}

.auth-aside::before {
  content: '';
  position: absolute;
  width: 18rem;
  height: 18rem;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.07);
  inset-inline-end: -5rem;
  bottom: -6rem;
}

.auth-aside::after {
  content: '';
  position: absolute;
  width: 10rem;
  height: 10rem;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.05);
  inset-inline-start: -3rem;
  top: 30%;
}

.auth-aside .brand-lockup {
  color: #fff;
  position: relative;
  z-index: 1;
}

.auth-aside .brand-mark {
  background-image: none;
  background-color: rgba(255, 255, 255, 0.14);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}

.auth-aside-title {
  position: relative;
  z-index: 1;
  color: #fff;
  font-size: 2rem;
  line-height: 1.35;
  margin-top: 1rem;
}

.auth-aside-sub {
  position: relative;
  z-index: 1;
  color: #bfdbfe;
  font-size: 1rem;
  line-height: 1.85;
  max-width: 26rem;
}

.auth-points {
  position: relative;
  z-index: 1;
  list-style: none;
  display: grid;
  gap: 0.85rem;
  margin-top: auto;
  padding: 0;
}

.auth-points li {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  font-weight: 600;
  color: #eff6ff;
  font-size: 0.95rem;
}

.auth-points i {
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  background-color: rgba(255, 255, 255, 0.14);
  color: #fff;
  flex-shrink: 0;
}

.auth-panel {
  width: 100%;
  max-width: 460px;
  margin-inline: auto;
}

.auth-panel-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.auth-back {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ink-500);
  text-decoration: none;
}

.auth-back:hover {
  color: var(--brand-700);
}

.auth-mobile-brand {
  display: none;
}

.auth-card {
  padding: 2.25rem;
}

.auth-switch {
  margin-top: 1.25rem;
  text-align: center;
  font-size: 0.9rem;
  color: var(--ink-500);
}

.auth-switch a {
  font-weight: 700;
  color: var(--brand-700);
  text-decoration: none;
}

.auth-switch a:hover {
  text-decoration: underline;
}

/* ============================================================
   Dashboard
   ============================================================ */

/* ============================================================
   Dashboard shell
   One sidebar + one top bar, rendered by js/shell/appShell.js for the
   owner, admin and employee areas.
   ============================================================ */

.app-sidebar {
  position: relative;
  background-image: linear-gradient(180deg, var(--navy-900) 0%, var(--navy-800) 58%, #0d1730 100%);
  color: #dbe6f6;
  border-inline-end: 0;
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.05);
  overflow: hidden;
}

.app-sidebar::after {
  content: '';
  position: absolute;
  inset-inline-start: -45%;
  top: -18%;
  width: 140%;
  height: 52%;
  background-image: radial-gradient(closest-side, rgba(79, 122, 255, 0.32), rgba(79, 122, 255, 0));
  pointer-events: none;
}

.app-sidebar .sidebar-brand {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  height: 4.5rem;
  padding-inline: 1.1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.app-sidebar .brand-lockup {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
}

.app-sidebar .brand-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  min-width: 0;
}

.app-sidebar .brand-mark {
  width: 2.15rem;
  height: 2.15rem;
  border-radius: 0.7rem;
  display: grid;
  place-items: center;
  background-image: linear-gradient(140deg, #4f7dff 0%, #7c5cff 58%, #22d3ee 100%);
  color: #fff;
  font-size: 0.92rem;
  box-shadow: 0 12px 24px -12px rgba(79, 125, 255, 0.9);
}

.app-sidebar .brand-text {
  color: #fff;
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-role {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  font-size: 0.64rem;
  line-height: 1.4;
  font-weight: 700;
  padding: 0.1rem 0.5rem;
  border-radius: 9999px;
  background-color: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #b7c8e4;
  white-space: nowrap;
}

.app-sidebar--admin .sidebar-role {
  background-color: rgba(245, 158, 11, 0.16);
  border-color: rgba(245, 158, 11, 0.35);
  color: #ffd08a;
}

.app-sidebar--employee .sidebar-role {
  background-color: rgba(20, 184, 166, 0.16);
  border-color: rgba(20, 184, 166, 0.35);
  color: #9df5ec;
}

.sidebar-scroll {
  position: relative;
  z-index: 1;
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 0.85rem 0.7rem;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.22rem;
  margin: 0;
  padding: 0;
}

.app-sidebar nav a.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.62rem 0.75rem;
  border-radius: 0.7rem;
  color: #a8bad6;
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
  transition:
    background-color 0.16s ease,
    color 0.16s ease;
}

.app-sidebar nav a.nav-item:hover {
  background-color: rgba(255, 255, 255, 0.06);
  color: #ffffff;
}

.app-sidebar nav a.nav-item i {
  width: 1.2rem;
  text-align: center;
  color: #8fa6c8;
  font-size: 0.92rem;
}

.app-sidebar nav a.nav-item:hover i {
  color: #cfdcf2;
}

.app-sidebar nav a.nav-item.is-active {
  background-image: linear-gradient(90deg, rgba(79, 125, 255, 0.34), rgba(79, 125, 255, 0.06));
  color: #ffffff;
  box-shadow: inset 0 0 0 1px rgba(120, 160, 255, 0.26);
}

.app-sidebar nav a.nav-item.is-active::before {
  content: '';
  position: absolute;
  inset-inline-start: 0;
  top: 22%;
  bottom: 22%;
  width: 3px;
  border-radius: 9999px;
  background-image: linear-gradient(180deg, #6ea8ff, #22d3ee);
}

.app-sidebar nav a.nav-item.is-active i {
  color: #9fc4ff;
}

.nav-label {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Section headings inside the sidebar (Overview / Companies / Documents ...) */
.nav-group-label {
  margin: 0.85rem 0.35rem 0.3rem;
  padding: 0 0.4rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #7d92b3;
}

.sidebar-nav .nav-group-label:first-child {
  margin-top: 0.2rem;
}

.notification-badge {
  margin-inline-start: 0.45rem;
  min-width: 1.3rem;
  height: 1.3rem;
  padding: 0 0.35rem;
  border-radius: 9999px;
  background-color: #ef4444;
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  text-align: center;
  line-height: 1.3rem;
  flex-shrink: 0;
}

.notification-badge:not(.hidden) {
  display: inline-block;
}

.sidebar-foot {
  position: relative;
  z-index: 1;
  padding: 0.75rem 1.1rem 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.sidebar-version {
  font-size: 0.7rem;
  color: #6f84a5;
  letter-spacing: 0.06em;
}

/* --- Top bar -------------------------------------------------- */

.app-topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  flex-shrink: 0;
  height: 4.25rem;
  background-color: rgba(255, 255, 255, 0.74);
  backdrop-filter: blur(16px) saturate(1.25);
  -webkit-backdrop-filter: blur(16px) saturate(1.25);
  border-bottom: 1px solid var(--line);
}

.app-topbar #welcome-message,
.app-topbar .topbar-user {
  max-width: 20rem;
  font-weight: 600;
  color: var(--ink-600);
  text-decoration: none;
  padding: 0.4rem 0.7rem;
  border-radius: 0.6rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition:
    color 0.18s ease,
    background-color 0.18s ease;
}

.app-topbar #welcome-message:hover {
  color: var(--brand-700);
  background-color: var(--brand-50);
}

/* --- Content -------------------------------------------------- */

.app-content {
  width: 100%;
  max-width: 1440px;
  margin-inline: auto;
  padding: clamp(1rem, 2vw, 1.75rem);
  overflow-x: auto;
  min-width: 0;
}

.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.page-header h1 {
  font-size: 1.6rem;
  letter-spacing: -0.01em;
}

.page-subtitle {
  margin-top: 0.3rem;
  color: var(--ink-500);
  font-size: 0.9rem;
}

.section-label {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 1.02rem;
  font-weight: 800;
  color: var(--ink-800);
  margin-bottom: 1rem;
}

.section-label::before {
  content: '';
  width: 0.28rem;
  height: 1.1rem;
  border-radius: 9999px;
  background-image: linear-gradient(180deg, var(--brand-500), #22d3ee);
}

/* --- Surface polish ------------------------------------------- */

.card {
  border-radius: var(--radius-xl);
  border-color: var(--line);
  box-shadow: var(--shadow-sm);
}

.stat-card {
  border-radius: var(--radius-xl);
  background-image: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
  box-shadow: var(--shadow-xs);
}

.stat-card:hover {
  box-shadow: var(--shadow-md);
}

.stat-icon {
  border-radius: 0.85rem;
}

.table-container {
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xs);
}

.data-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background-color: #f5f8fd;
  letter-spacing: 0.02em;
}

.btn {
  border-radius: var(--radius);
}

.btn-primary {
  background-image: linear-gradient(135deg, #3b74ff 0%, #1f4fd8 100%);
  box-shadow: 0 12px 24px -14px rgba(31, 79, 216, 0.85);
}

.btn-primary:hover {
  background-image: linear-gradient(135deg, #2f66f0 0%, #173fae 100%);
  box-shadow: 0 16px 28px -14px rgba(31, 79, 216, 0.9);
}

/* ============================================================
   Mobile navigation (dashboard drawer)
   ============================================================ */

#mobile-menu-btn {
  display: none;
}

#mobile-nav-overlay {
  display: none;
}

.sidebar-close-btn {
  display: none;
}

@media (max-width: 767px) {
  #mobile-menu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
  }

  #app-sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    right: 0;
    z-index: 60;
    width: 16rem;
    max-width: 85vw;
    display: flex !important;
    overflow-y: auto;
    transform: translateX(100%);
    transition: transform 0.25s ease-in-out;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
  }

  html[dir='ltr'] #app-sidebar {
    right: auto;
    left: 0;
    transform: translateX(-100%);
  }

  #app-sidebar.sidebar-open,
  html[dir='ltr'] #app-sidebar.sidebar-open {
    transform: translateX(0);
  }

  .sidebar-close-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    color: #cfdcf2;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 0.6rem;
    cursor: pointer;
  }

  #mobile-nav-overlay {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 50;
    background-color: rgba(15, 23, 42, 0.55);
    opacity: 0;
    visibility: hidden;
    transition:
      opacity 0.2s ease-in-out,
      visibility 0.2s ease-in-out;
  }

  body.nav-open #mobile-nav-overlay {
    opacity: 1;
    visibility: visible;
  }

  body.nav-open {
    overflow: hidden;
  }
}

/* ============================================================
   Responsive
   ============================================================ */

/* Between 768px and 1023px the desktop header does not fit: use the
   collapsible public menu instead of letting the items overlap. */
@media (min-width: 768px) and (max-width: 1023px) {
  .site-nav .hidden.md\:block,
  .site-nav .hidden.md\:flex {
    display: none !important;
  }

  .site-nav .-mr-2.flex.md\:hidden {
    display: flex !important;
  }

  #public-mobile-menu:not(.hidden) {
    display: block !important;
  }
}

@media (max-width: 1023px) {
  .hero-grid {
    grid-template-columns: 1fr;
    gap: 2.5rem;
  }

  .hero {
    padding: 3rem 0 3.5rem;
  }

  .hero-sub {
    max-width: none;
  }

  .hero-visual {
    max-width: 560px;
    margin-inline: auto;
  }

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

  .steps-grid {
    grid-template-columns: 1fr;
  }

  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }

  .footer-grid > div:first-child {
    grid-column: 1 / -1;
  }

  .auth-shell {
    grid-template-columns: 1fr;
    max-width: 540px;
    padding: 1.5rem;
  }

  .auth-aside {
    display: none;
  }

  .auth-mobile-brand {
    display: inline-flex;
  }

  .auth-back {
    display: none;
  }
}

@media (max-width: 767px) {
  .hero-title {
    font-size: clamp(2rem, 8vw, 2.6rem);
  }

  .feature-grid {
    grid-template-columns: 1fr;
  }

  .cta-band {
    flex-direction: column;
    align-items: flex-start;
    padding: 2rem;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .app-content {
    padding: 1rem;
  }

  .auth-card {
    padding: 1.5rem;
  }

  .form-card {
    padding: 1.5rem;
  }

  .page-header h1 {
    font-size: 1.3rem;
  }

  .cta-wrap {
    padding: 0 1rem;
  }

  .page-header > .btn {
    width: 100%;
  }
}

/* Keep the dashboard top bar readable on small phones. */
@media (max-width: 480px) {
  #welcome-message {
    display: none;
  }

  .app-topbar {
    padding-inline: 0.75rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  #app-sidebar,
  #mobile-nav-overlay {
    transition: none;
  }

  .btn,
  .stat-card,
  .feature-card {
    transition: none;
  }
}

/* --- WhatsApp expiry alerts ----------------------------------- */

.wa-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.75rem;
  overflow: hidden;
}

.wa-card[hidden] {
  display: none;
}

.wa-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 1.1rem 1.35rem;
  background: linear-gradient(135deg, #ecfdf5 0%, var(--brand-50) 100%);
  border-bottom: 1px solid var(--line-soft);
}

.wa-head-main {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  min-width: 0;
}

.wa-icon {
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  flex: none;
  border-radius: 50%;
  background: #ffffff;
  color: #128c7e;
  font-size: 1.35rem;
  box-shadow: var(--shadow-xs);
}

.wa-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--ink-900);
}

.wa-subtitle {
  margin: 0.15rem 0 0;
  font-size: 0.82rem;
  color: var(--ink-600);
  line-height: 1.6;
}

.wa-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  cursor: pointer;
  user-select: none;
  position: relative;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-700);
}

.wa-switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.wa-switch-track {
  position: relative;
  width: 46px;
  height: 26px;
  flex: none;
  border-radius: 999px;
  background: #cbd5e1;
  transition: background 0.2s ease;
}

.wa-switch-thumb {
  position: absolute;
  top: 3px;
  inset-inline-start: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.35);
  transition: transform 0.2s ease;
}

.wa-switch input:checked + .wa-switch-track {
  background: var(--brand-600);
}

.wa-switch input:checked + .wa-switch-track .wa-switch-thumb {
  transform: translateX(20px);
}

[dir='rtl'] .wa-switch input:checked + .wa-switch-track .wa-switch-thumb {
  transform: translateX(-20px);
}

.wa-switch input:focus-visible + .wa-switch-track {
  box-shadow: var(--ring);
}

.wa-body {
  padding: 1.25rem 1.35rem 1.5rem;
}

.wa-recipients-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.wa-section-title {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--ink-800);
}

.wa-last-sent {
  font-size: 0.76rem;
  color: var(--ink-500);
}

.wa-recipients {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.wa-empty {
  margin: 0;
  padding: 0.85rem 1rem;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  font-size: 0.84rem;
  color: var(--ink-500);
}

.wa-recipient {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

.wa-recipient-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 50%;
  background: var(--brand-50);
  color: var(--brand-600);
  font-size: 0.85rem;
}

.wa-recipient-info {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  flex: 1 1 140px;
  min-width: 0;
}

.wa-recipient-info strong {
  font-size: 0.9rem;
  color: var(--ink-800);
}

.wa-recipient-info span {
  font-size: 0.78rem;
  color: var(--ink-500);
}

.wa-recipient-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-inline-start: auto;
}

.wa-remove {
  color: var(--danger);
}

.wa-form {
  margin-top: 1rem;
  padding: 1rem;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--bg);
}

.wa-form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}

.wa-form-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.85rem;
}

.wa-help {
  margin-top: 1rem;
  font-size: 0.84rem;
  color: var(--ink-600);
}

.wa-help summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--brand-700);
}

.wa-help summary:focus-visible {
  outline: none;
  box-shadow: var(--ring);
  border-radius: var(--radius-sm);
}

.wa-help-list {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin: 0.6rem 0 0;
  padding-inline-start: 1.25rem;
  line-height: 1.75;
  list-style: decimal;
}

.wa-help-list li::marker {
  color: var(--brand-600);
  font-weight: 700;
}

.wa-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.1rem;
}

.wa-actions .btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.wa-message-box {
  margin-top: 0.85rem;
}

.wa-preview {
  margin: 1rem 0 0;
  padding: 1rem 1.1rem;
  border-radius: var(--radius);
  background: #0f172a;
  color: #e2e8f0;
  font-family: inherit;
  font-size: 0.82rem;
  line-height: 1.9;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-x: auto;
}

.wa-preview[hidden] {
  display: none;
}

@media (max-width: 767px) {
  .wa-head {
    align-items: flex-start;
  }

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

  .wa-body {
    padding: 1rem;
  }

  .wa-actions .btn {
    width: 100%;
    justify-content: center;
  }
}

/* --- Document import ------------------------------------------ */

.doc-steps {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 1.25rem;
  padding: 0;
  list-style: none;
  flex-wrap: wrap;
}

.doc-step {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-500);
}

.doc-step + .doc-step::before {
  content: '';
  display: block;
  width: 28px;
  height: 2px;
  margin-inline-end: 0.35rem;
  border-radius: 2px;
  background: var(--line);
}

.doc-step-num {
  display: grid;
  place-items: center;
  width: 1.6rem;
  height: 1.6rem;
  flex: none;
  border-radius: 50%;
  background: #ffffff;
  border: 1px solid var(--line);
  color: var(--ink-500);
  font-size: 0.75rem;
}

.doc-step.is-active {
  color: var(--brand-700);
}

.doc-step.is-active .doc-step-num {
  background: var(--brand-600);
  border-color: var(--brand-600);
  color: #ffffff;
}

.doc-step.is-done {
  color: var(--success);
}

.doc-step.is-done .doc-step-num {
  background: #ecfdf5;
  border-color: #a7f3d0;
  color: var(--success);
}

.doc-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 1.35rem;
  margin-bottom: 1.25rem;
}

.doc-card[hidden] {
  display: none;
}

.doc-dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  padding: 2.25rem 1.25rem;
  border: 2px dashed var(--line);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, var(--brand-50) 0%, #ffffff 100%);
  text-align: center;
  cursor: pointer;
  transition:
    border-color 0.15s ease,
    background 0.15s ease,
    box-shadow 0.15s ease;
  position: relative;
}

.doc-dropzone:hover,
.doc-dropzone.is-dragover {
  border-color: var(--brand-500);
  background: linear-gradient(180deg, var(--brand-100) 0%, #ffffff 100%);
}

.doc-dropzone:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}

.doc-dropzone-icon {
  display: grid;
  place-items: center;
  width: 3.25rem;
  height: 3.25rem;
  border-radius: 50%;
  background: #ffffff;
  color: var(--brand-600);
  font-size: 1.4rem;
  box-shadow: var(--shadow-xs);
}

.doc-dropzone-title {
  margin: 0.5rem 0 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink-900);
}

.doc-dropzone-hint {
  margin: 0;
  font-size: 0.82rem;
  color: var(--ink-600);
}

.doc-dropzone-btn {
  margin-top: 0.85rem;
  pointer-events: none;
}

.doc-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.doc-file-chip {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1rem;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
}

.doc-file-chip[hidden] {
  display: none;
}

.doc-file-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: none;
  border-radius: 50%;
  background: #ffffff;
  color: var(--brand-600);
}

.doc-file-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.doc-file-meta strong {
  font-size: 0.88rem;
  color: var(--ink-800);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.doc-file-meta span {
  font-size: 0.76rem;
  color: var(--ink-500);
}

.doc-progress {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 1rem 0 0;
  padding: 0.7rem 0.9rem;
  border-radius: var(--radius);
  background: #eff6ff;
  color: var(--brand-900);
  font-size: 0.84rem;
  font-weight: 600;
}

.doc-progress[hidden] {
  display: none;
}

.doc-progress::before {
  content: '';
  width: 14px;
  height: 14px;
  flex: none;
  border-radius: 50%;
  border: 2px solid var(--brand-200);
  border-top-color: var(--brand-600);
  animation: doc-spin 0.8s linear infinite;
}

@keyframes doc-spin {
  to {
    transform: rotate(360deg);
  }
}

.doc-review-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding-bottom: 1rem;
  margin-bottom: 1.1rem;
  border-bottom: 1px solid var(--line-soft);
}

.doc-review-title {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  min-width: 0;
}

.doc-type-icon {
  display: grid;
  place-items: center;
  width: 2.6rem;
  height: 2.6rem;
  flex: none;
  border-radius: var(--radius);
  background: var(--brand-50);
  color: var(--brand-600);
  font-size: 1.1rem;
}

.doc-review-title h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink-900);
}

.doc-review-sub {
  margin: 0.15rem 0 0;
  font-size: 0.78rem;
  color: var(--ink-500);
}

.doc-badges {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.badge-success-soft {
  background: #ecfdf5;
  color: #047857;
}

.badge-warning-soft {
  background: #fffbeb;
  color: #b45309;
}

.badge-danger-soft {
  background: #fef2f2;
  color: #b91c1c;
}

.doc-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.9rem;
}

.doc-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
}

.doc-hint {
  margin: 0.6rem 0 0;
  font-size: 0.78rem;
  color: var(--ink-500);
}

.doc-diff[hidden],
.doc-field[hidden] {
  display: none;
}

.doc-diff {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 1.1rem;
  padding: 0.8rem 1rem;
  border-radius: var(--radius);
  background: var(--bg);
  border: 1px solid var(--line-soft);
}

.doc-diff-item {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 120px;
}

.doc-diff-item.is-new .doc-diff-value {
  color: var(--success);
  font-weight: 700;
}

.doc-diff-label {
  font-size: 0.72rem;
  color: var(--ink-500);
}

.doc-diff-value {
  font-size: 0.95rem;
  color: var(--ink-800);
  font-weight: 600;
}

.doc-diff-arrow {
  color: var(--ink-400);
  font-size: 0.9rem;
}

.doc-warning {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  margin-top: 1rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #92400e;
  font-size: 0.83rem;
}

.doc-warning[hidden] {
  display: none;
}

.doc-warning > i {
  margin-top: 0.15rem;
  flex: none;
}

.doc-warning p {
  margin: 0;
  line-height: 1.7;
}

.doc-confirm {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin-top: 0.5rem;
  font-weight: 600;
  cursor: pointer;
}

.doc-confirm input {
  margin-top: 0.2rem;
  accent-color: var(--brand-600);
}

.doc-employees {
  margin-top: 1.25rem;
}

.doc-employees[hidden] {
  display: none;
}

.doc-employees-title {
  margin: 0 0 0.6rem;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--ink-800);
}

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

.doc-table-wrap .form-input {
  padding: 0.4rem 0.5rem;
  font-size: 0.82rem;
  min-width: 190px;
}

.doc-table-wrap td {
  vertical-align: middle;
}

.doc-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.25rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--line-soft);
}

.doc-raw {
  margin-top: 1rem;
  font-size: 0.83rem;
  color: var(--ink-600);
}

.doc-raw summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--brand-700);
}

.doc-raw pre {
  margin: 0.7rem 0 0;
  padding: 0.9rem;
  max-height: 260px;
  overflow: auto;
  border-radius: var(--radius);
  background: #0f172a;
  color: #e2e8f0;
  font-family: inherit;
  font-size: 0.78rem;
  line-height: 1.8;
  white-space: pre-wrap;
  word-break: break-word;
}

.doc-success {
  display: flex;
  align-items: flex-start;
  gap: 0.9rem;
  background: #ecfdf5;
  border-color: #a7f3d0;
}

.doc-success[hidden] {
  display: none;
}

.doc-success-icon {
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  flex: none;
  border-radius: 50%;
  background: #ffffff;
  color: var(--success);
  font-size: 1.35rem;
}

.doc-success h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: #065f46;
}

.doc-success p {
  margin: 0.3rem 0 0;
  font-size: 0.85rem;
  color: #047857;
  line-height: 1.8;
}

.doc-success-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.9rem;
}

.doc-message {
  margin-top: 0;
}

@media (max-width: 1023px) {
  .doc-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 767px) {
  .doc-grid {
    grid-template-columns: 1fr;
  }

  .doc-card {
    padding: 1rem;
  }

  .doc-dropzone {
    padding: 1.75rem 1rem;
  }

  .doc-actions .btn {
    width: 100%;
    justify-content: center;
  }

  .doc-step + .doc-step::before {
    width: 14px;
  }

  .doc-diff {
    align-items: flex-start;
  }

  .doc-diff-arrow {
    transform: rotate(-90deg);
  }
}

/* ============================================================
   Language menu (Arabic, English, Bengali, Urdu, Hindi)
   ============================================================ */

.lang-code {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  margin-inline-start: 0.35rem;
}

.language-menu {
  position: fixed;
  z-index: 90;
  min-width: 12.5rem;
  padding: 0.35rem;
  background-color: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
}

.language-menu.hidden {
  display: none;
}

.language-menu-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  padding: 0.5rem 0.6rem;
  border: 0;
  border-radius: 0.55rem;
  background-color: transparent;
  color: var(--ink-700);
  font: inherit;
  font-size: 0.9rem;
  text-align: start;
  cursor: pointer;
  transition:
    background-color 0.15s ease,
    color 0.15s ease;
}

.language-menu-item:hover,
.language-menu-item:focus-visible {
  background-color: var(--brand-50);
  color: var(--brand-700);
  outline: none;
}

.language-menu-item[aria-checked='true'] {
  background-color: var(--brand-50);
  color: var(--brand-700);
  font-weight: 700;
}

.language-menu-code {
  min-width: 2.2rem;
  padding: 0.1rem 0.35rem;
  border-radius: 0.4rem;
  background-color: #eef2f9;
  color: var(--ink-500);
  font-size: 0.7rem;
  font-weight: 700;
  text-align: center;
}

.language-menu-item[aria-checked='true'] .language-menu-code {
  background-color: var(--brand-100);
  color: var(--brand-700);
}

.language-menu-label {
  flex: 1 1 auto;
  white-space: nowrap;
}

.language-menu-check {
  opacity: 0;
  color: var(--brand-600);
  font-size: 0.8rem;
}

.language-menu-item[aria-checked='true'] .language-menu-check {
  opacity: 1;
}

/* ============================================================
   Table tools · sorting, pagination, bulk actions, QR, dark mode
   ============================================================ */

/* --- row status colours ------------------------------------- */
.data-table tbody tr.row-expired {
  background-color: rgba(220, 38, 38, 0.06);
}
.data-table tbody tr.row-expired:hover {
  background-color: rgba(220, 38, 38, 0.1);
}
.data-table tbody tr.row-expiring-soon {
  background-color: rgba(245, 158, 11, 0.08);
}
.data-table tbody tr.row-expiring-soon:hover {
  background-color: rgba(245, 158, 11, 0.13);
}
.data-table tbody tr.tt-selected {
  background-color: rgba(47, 107, 255, 0.09);
}

/* --- toolbars ------------------------------------------------ */
.tt-toolbar {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
}
.tt-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  padding: 0.85rem 0.25rem 0.25rem;
  color: var(--ink-500);
  font-size: 0.85rem;
}
.tt-pager .btn[disabled] {
  opacity: 0.4;
  cursor: not-allowed;
}
.tt-page-info {
  font-weight: 600;
  color: var(--ink-700);
}
.tt-page-size {
  color: var(--ink-400);
  font-size: 0.78rem;
}
.tt-bulk {
  display: none;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.6rem;
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius);
  background-color: var(--brand-50);
  border: 1px solid var(--brand-200);
}
.tt-bulk.is-visible {
  display: flex;
}
.tt-bulk-count {
  font-weight: 700;
  color: var(--brand-700);
  margin-inline-end: auto;
}
.btn.btn-danger-soft {
  background-color: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
}
.btn.btn-danger-soft:hover {
  background-color: #fecaca;
}

/* --- row tools ----------------------------------------------- */
.tt-select-col {
  width: 2.4rem;
  padding-inline-start: 0.75rem !important;
  padding-inline-end: 0 !important;
}
.tt-select-col input {
  width: 1rem;
  height: 1rem;
  cursor: pointer;
  accent-color: var(--brand-600);
}
.tt-row-tools {
  display: inline-flex;
  gap: 0.35rem;
  margin-inline-start: 0.5rem;
  vertical-align: middle;
}
.tt-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 0.5rem;
  border: 1px solid var(--line);
  background-color: var(--surface);
  color: var(--ink-600);
  cursor: pointer;
  transition:
    background-color 0.15s ease,
    color 0.15s ease;
}
.tt-icon-btn:hover {
  background-color: var(--brand-50);
  color: var(--brand-700);
}
.tt-sortable {
  user-select: none;
  white-space: nowrap;
}
.tt-sortable::after {
  content: '\f0dc';
  font-family: 'Font Awesome 6 Free', 'Font Awesome 6 Pro', sans-serif;
  font-weight: 900;
  margin-inline-start: 0.35rem;
  font-size: 0.7rem;
  opacity: 0.35;
}
.tt-sort-asc::after {
  content: '\f0de';
  opacity: 1;
  color: var(--brand-600);
}
.tt-sort-desc::after {
  content: '\f0dd';
  opacity: 1;
  color: var(--brand-600);
}

/* --- QR modal ------------------------------------------------- */
.tt-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background-color: rgba(11, 18, 32, 0.55);
  z-index: 90;
}
.tt-modal.is-open {
  display: flex;
}
.tt-modal-card {
  position: relative;
  width: min(380px, 100%);
  padding: 1.5rem;
  border-radius: var(--radius-lg);
  background-color: var(--surface);
  box-shadow: var(--shadow-md);
  text-align: center;
}
.tt-modal-close {
  position: absolute;
  top: 0.5rem;
  inset-inline-end: 0.75rem;
  border: 0;
  background: none;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--ink-400);
  cursor: pointer;
}
.tt-modal-title {
  margin: 0 0 1rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--ink-900);
}
.tt-qr-box {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 220px;
  padding: 0.5rem;
  background-color: #fff;
  border-radius: var(--radius);
  word-break: break-all;
  font-size: 0.8rem;
}
.tt-qr-caption {
  margin: 0.75rem 0 0;
  color: var(--ink-500);
  font-size: 0.85rem;
}

/* --- global search (Ctrl+K) ---------------------------------- */
.gs-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 8vh 1.25rem 1.25rem;
  background-color: rgba(11, 18, 32, 0.55);
  z-index: 95;
}
.gs-overlay.is-open {
  display: flex;
}
.gs-card {
  width: min(640px, 100%);
  max-height: 70vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background-color: var(--surface);
  box-shadow: var(--shadow-md);
}
.gs-input-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--line);
}
.gs-input {
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  font: inherit;
  font-size: 1rem;
  color: var(--ink-800);
}
.gs-hint {
  font-size: 0.7rem;
  color: var(--ink-400);
  border: 1px solid var(--line);
  border-radius: 0.35rem;
  padding: 0.1rem 0.35rem;
}
.gs-results {
  overflow-y: auto;
  padding: 0.4rem;
}
.gs-group {
  padding: 0.55rem 0.75rem 0.25rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--ink-400);
}
.gs-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.6rem 0.75rem;
  border-radius: 0.6rem;
  color: var(--ink-700);
  text-decoration: none;
  font-size: 0.9rem;
}
.gs-item:hover,
.gs-item:focus-visible {
  background-color: var(--brand-50);
  color: var(--brand-700);
  outline: none;
}
.gs-item small {
  margin-inline-start: auto;
  color: var(--ink-400);
  font-size: 0.75rem;
}
.gs-empty {
  padding: 1.5rem;
  text-align: center;
  color: var(--ink-400);
  font-size: 0.9rem;
}

/* --- charts --------------------------------------------------- */
.chart-card {
  padding: 1rem 1.1rem 0.6rem;
}
.chart-card h2 {
  margin: 0 0 0.75rem;
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink-800);
}
.chart-canvas-wrap {
  position: relative;
  height: 260px;
}

/* ============================================================
   Dashboard toolbars, compact tables and expiry list
   ============================================================ */

.table-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.table-toolbar-title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
}

.table-toolbar .section-label {
  margin: 0;
}

.toolbar-search {
  position: relative;
  display: flex;
  align-items: center;
}

.toolbar-search i {
  position: absolute;
  inset-inline-start: 0.9rem;
  color: var(--ink-400);
  font-size: 0.85rem;
  pointer-events: none;
}

.toolbar-search .form-input {
  width: min(320px, 72vw);
  padding-inline-start: 2.3rem;
}

.table-scroll-y {
  max-height: 460px;
  overflow: auto;
}

.table-scroll-y .data-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
}

.table-footer {
  display: flex;
  justify-content: center;
  margin-top: 0.85rem;
}

/* Keep anchor jumps clear of the sticky top bar. */
.app-content section[id] {
  scroll-margin-top: 96px;
}

.icon-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.icon-actions .btn {
  padding: 0.4rem 0.55rem;
  line-height: 1;
}

.expiry-list {
  max-height: 340px;
  overflow-y: auto;
}

.expiry-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.9rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--line-soft);
  font-size: 0.9rem;
}

.expiry-row:last-child {
  border-bottom: none;
}

/* Rows that open the record editor look like rows, not like links. */
.expiry-list a.expiry-row {
  color: inherit;
  text-decoration: none;
  border-radius: 8px;
  padding-inline: 0.4rem;
}

.expiry-list a.expiry-row:hover {
  background-color: #f8fbff;
}

html[data-theme='dark'] .expiry-list a.expiry-row:hover {
  background-color: rgba(148, 163, 184, 0.08);
}

.expiry-main {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.expiry-main strong {
  font-weight: 700;
  color: var(--ink-800);
  font-size: 0.9rem;
}

.expiry-main small {
  color: var(--ink-500);
  font-size: 0.78rem;
}

.expiry-side {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  white-space: nowrap;
}

@media (max-width: 640px) {
  .toolbar-search {
    width: 100%;
  }
  .toolbar-search .form-input {
    width: 100%;
  }
  .expiry-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
  }
}

/* --- dark mode ------------------------------------------------ */
html[data-theme='dark'] {
  color-scheme: dark;
  --ink-900: #e8eefc;
  --ink-800: #dbe4f5;
  --ink-700: #c3cfe4;
  --ink-600: #a9b8d1;
  --ink-500: #8fa1bd;
  --ink-400: #7b8ca8;
  --line: #22304a;
  --line-soft: #1b2740;
  --surface: #131c2e;
  --bg: #0b1220;
  --brand-50: #16233c;
  --brand-100: #1d2f52;
  --brand-200: #27406f;
}

html[data-theme='dark'] body {
  background-image: radial-gradient(1200px 560px at 100% -10%, #16233c 0%, rgba(22, 35, 60, 0) 60%),
    radial-gradient(900px 500px at 0% 0%, #101b30 0%, rgba(16, 27, 48, 0) 55%);
  color: var(--ink-700);
}

html[data-theme='dark'] .app-sidebar {
  background-color: #0d1626;
  border-color: #1b2740;
}
html[data-theme='dark'] .app-topbar {
  background-color: rgba(13, 22, 38, 0.92);
  border-color: #1b2740;
}
html[data-theme='dark'] .doc-card,
html[data-theme='dark'] .table-container,
html[data-theme='dark'] .page-header,
html[data-theme='dark'] .gs-card,
html[data-theme='dark'] .tt-modal-card,
html[data-theme='dark'] .chart-card,
html[data-theme='dark'] .message-container {
  background-color: #131c2e;
  border-color: #22304a;
  color: var(--ink-700);
}
html[data-theme='dark'] .data-table thead th {
  background-color: #182338;
  color: var(--ink-600);
  border-color: #22304a;
}
html[data-theme='dark'] .data-table tbody tr {
  background-color: #131c2e;
  border-color: #1b2740;
}
html[data-theme='dark'] .data-table tbody tr:hover {
  background-color: #182338;
}
html[data-theme='dark'] .data-table td {
  color: var(--ink-700);
  border-color: #1b2740;
}
html[data-theme='dark'] .form-input,
html[data-theme='dark'] select.form-input,
html[data-theme='dark'] textarea {
  background-color: #0f1829;
  border-color: #263449;
  color: var(--ink-800);
}
html[data-theme='dark'] .btn-neutral {
  background-color: #182338;
  border-color: #263449;
  color: var(--ink-700);
}
html[data-theme='dark'] .btn-neutral:hover {
  background-color: #1d2a41;
}
html[data-theme='dark'] .tt-icon-btn {
  background-color: #182338;
  border-color: #263449;
  color: var(--ink-600);
}
html[data-theme='dark'] .text-gray-800,
html[data-theme='dark'] .text-gray-900,
html[data-theme='dark'] .text-gray-700 {
  color: #e2e9f7 !important;
}
html[data-theme='dark'] .text-gray-600,
html[data-theme='dark'] .text-gray-500 {
  color: #a9b8d1 !important;
}
html[data-theme='dark'] .bg-white {
  background-color: #131c2e !important;
}
html[data-theme='dark'] .bg-gray-50,
html[data-theme='dark'] .bg-gray-100 {
  background-color: #182338 !important;
}
html[data-theme='dark'] .border,
html[data-theme='dark'] .border-gray-200,
html[data-theme='dark'] .border-gray-300 {
  border-color: #22304a !important;
}
html[data-theme='dark'] .tt-qr-box {
  background-color: #fff;
}
html[data-theme='dark'] .badge {
  background-color: #182338;
  color: var(--ink-600);
}
html[data-theme='dark'] .data-table tbody tr.row-expired {
  background-color: rgba(248, 113, 113, 0.12);
}
html[data-theme='dark'] .data-table tbody tr.row-expiring-soon {
  background-color: rgba(251, 191, 36, 0.12);
}

/* --- printable card (A6) -------------------------------------- */
.card-sheet {
  width: 105mm;
  min-height: 148mm;
  margin: 2rem auto;
  padding: 8mm;
  border-radius: 4mm;
  background: #fff;
  color: #0b1220;
  box-shadow: 0 10px 40px -20px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  gap: 4mm;
}
.card-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #dbe3ef;
  padding-bottom: 3mm;
}
.card-sheet-title {
  font-size: 12pt;
  font-weight: 800;
}
.card-sheet-body {
  display: flex;
  gap: 4mm;
  flex: 1;
}
.card-sheet-qr {
  flex: 0 0 34mm;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}
.card-sheet-fields {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2.5mm;
  font-size: 9.5pt;
}
.card-field {
  display: flex;
  gap: 2mm;
  border-bottom: 1px dashed #e7edf7;
  padding-bottom: 1.5mm;
}
.card-field dt {
  min-width: 26mm;
  color: #64748b;
  font-weight: 600;
}
.card-field dd {
  margin: 0;
  font-weight: 700;
  word-break: break-word;
}
.card-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  margin: 1rem 0 2rem;
}

@media print {
  .card-actions,
  .app-sidebar,
  .app-topbar,
  .tt-toolbar,
  .tt-pager,
  .tt-bulk {
    display: none !important;
  }
  body {
    background: #fff !important;
  }
  .card-sheet {
    margin: 0;
    box-shadow: none;
    page-break-inside: avoid;
  }
  @page {
    size: A6;
    margin: 0;
  }
}

/* --- dark mode toggle + idle warning -------------------------- */
.theme-toggle svg,
.theme-toggle i {
  pointer-events: none;
}
.idle-warning {
  position: fixed;
  inset-inline: 1rem;
  bottom: 1rem;
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: 460px;
  margin-inline: auto;
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
  background-color: #fff7ed;
  border: 1px solid #fed7aa;
  color: #9a3412;
  box-shadow: var(--shadow-md);
  z-index: 96;
}
.idle-warning.is-visible {
  display: flex;
}
html[data-theme='dark'] .idle-warning {
  background-color: #2a1e0b;
  border-color: #4d3512;
  color: #fcd34d;
}

/* --- printable employee profile ------------------------------- */
.profile-page {
  max-width: 820px;
  margin: 0 auto;
  padding: 1.25rem;
}
.profile-sheet {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  color: var(--ink-800);
}
.profile-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 2px solid var(--brand-100);
  padding-bottom: 1rem;
  margin-bottom: 1.25rem;
}
.profile-header h1 {
  margin: 0;
  font-size: 1.4rem;
  font-weight: 800;
}
.profile-header p {
  margin: 0.25rem 0 0;
  color: var(--ink-500);
  font-size: 0.9rem;
}
.profile-brand {
  font-weight: 700;
  color: var(--brand-700);
  white-space: nowrap;
}
.profile-grid {
  display: grid;
  gap: 0.55rem 1.5rem;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  margin: 0;
}
.profile-row {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.45rem 0;
  border-bottom: 1px dashed var(--line);
  font-size: 0.9rem;
  flex-wrap: wrap;
}
.profile-row dt {
  color: var(--ink-500);
  font-weight: 600;
  min-width: 0;
}
.profile-row dd {
  margin: 0;
  font-weight: 700;
  text-align: end;
  word-break: break-word;
  overflow-wrap: anywhere;
  min-width: 0;
}
.profile-section-title {
  margin: 1.5rem 0 0.75rem;
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink-800);
}
.profile-footer {
  margin-top: 1.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
  color: var(--ink-400);
  font-size: 0.78rem;
  text-align: center;
}
.input-error {
  border-color: #dc2626 !important;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15) !important;
}

@media print {
  .profile-page {
    max-width: none;
    padding: 0;
  }
  .profile-sheet {
    border: 0;
    box-shadow: none;
    padding: 0;
  }
  .card-actions {
    display: none !important;
  }
}

html[data-theme='dark'] .stat-card {
  background-image: none;
  background-color: #131c2e;
  border-color: #22304a;
}
html[data-theme='dark'] .stat-value {
  color: #e8eefc;
}
html[data-theme='dark'] .stat-hint,
html[data-theme='dark'] .stat-title {
  color: #8fa1bd;
}
html[data-theme='dark'] .feature-card,
html[data-theme='dark'] .doc-card {
  background-image: none;
}
html[data-theme='dark'] .data-table thead th {
  background-image: none;
}
html[data-theme='dark'] .app-topbar,
html[data-theme='dark'] .app-sidebar {
  background-image: none;
}

/* --- public how-to-use guide --------------------------------- */
.guide-hero {
  padding: 4.5rem 0 3.5rem;
  background: radial-gradient(
      900px 420px at 50% -20%,
      var(--brand-50) 0%,
      rgba(238, 244, 255, 0) 70%
    ),
    var(--bg);
  border-bottom: 1px solid var(--line);
}
.guide-hero-inner {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 1.25rem;
  text-align: center;
}
.guide-title {
  margin: 1rem 0 0.9rem;
  color: var(--ink-900);
  font-size: clamp(2rem, 4.6vw, 3.2rem);
  font-weight: 800;
  line-height: 1.18;
  letter-spacing: -0.02em;
}
.guide-sub {
  max-width: 680px;
  margin: 0 auto;
  color: var(--ink-500);
  font-size: 1.05rem;
  line-height: 1.85;
}
.guide-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 1.8rem;
}
.guide-steps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1rem;
  margin-top: 2.4rem;
}
.guide-step {
  position: relative;
  padding: 1.5rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background-color: var(--surface);
  box-shadow: var(--shadow-xs);
  transition:
    transform 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease;
}
.guide-step:hover {
  transform: translateY(-3px);
  border-color: var(--brand-200);
  box-shadow: var(--shadow-md);
}
.guide-step-num {
  position: absolute;
  top: 1rem;
  inset-inline-end: 1.15rem;
  color: var(--brand-200);
  font-size: 2.4rem;
  font-weight: 800;
  line-height: 1;
}
.guide-step-icon,
.guide-role-icon,
.guide-tip-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  margin-bottom: 1rem;
  border-radius: 0.9rem;
  background-color: var(--brand-50);
  color: var(--brand-700);
  font-size: 1.15rem;
}
.guide-step h3,
.guide-role-card h3,
.guide-tip h3 {
  margin: 0 0 0.55rem;
  color: var(--ink-900);
  font-size: 1.03rem;
  font-weight: 800;
}
.guide-step p,
.guide-role-card p,
.guide-tip p {
  margin: 0;
  color: var(--ink-500);
  font-size: 0.92rem;
  line-height: 1.8;
}
.guide-roles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1rem;
  margin-top: 2.4rem;
}
.guide-role-card {
  padding: 1.6rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background-color: var(--surface);
  box-shadow: var(--shadow-xs);
}
.guide-role-owner .guide-role-icon {
  background-color: #eef4ff;
  color: #2f6bff;
}
.guide-role-admin .guide-role-icon {
  background-color: #f3e8ff;
  color: #7e22ce;
}
.guide-role-employee .guide-role-icon {
  background-color: #ecfdf5;
  color: #047857;
}
.guide-note {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  margin: 1.4rem 0 0;
  padding: 0.95rem 1.1rem;
  border: 1px solid var(--brand-100);
  border-radius: var(--radius);
  background-color: var(--brand-50);
  color: var(--brand-900);
  font-size: 0.92rem;
  line-height: 1.7;
}
.guide-note i {
  margin-top: 0.2rem;
}
.guide-tips-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  margin-top: 2.4rem;
}
.guide-tip {
  padding: 1.35rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background-color: var(--surface);
}
.guide-tip-icon {
  width: 2.6rem;
  height: 2.6rem;
  margin-bottom: 0.8rem;
  background-color: #ecfeff;
  color: #0e7490;
}
.guide-faq-list {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  margin-top: 2rem;
}
.guide-faq-item {
  padding: 0;
  overflow: hidden;
}
.guide-faq-item summary {
  padding: 1.15rem 1.35rem;
  color: var(--ink-900);
  font-weight: 700;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.guide-faq-item summary::-webkit-details-marker {
  display: none;
}
.guide-faq-item summary::after {
  content: '\f078';
  font-family: 'Font Awesome 6 Free', 'Font Awesome 6 Pro', sans-serif;
  font-weight: 900;
  font-size: 0.75rem;
  color: var(--ink-400);
  transition: transform 0.2s ease;
}
.guide-faq-item[open] summary::after {
  transform: rotate(180deg);
}
.guide-faq-item p {
  margin: 0;
  padding: 0 1.35rem 1.3rem;
  color: var(--ink-500);
  font-size: 0.93rem;
  line-height: 1.85;
}

html[data-theme='dark'] .guide-hero {
  background: radial-gradient(900px 420px at 50% -20%, #16233c 0%, rgba(22, 35, 60, 0) 70%),
    var(--bg);
}
html[data-theme='dark'] .guide-step,
html[data-theme='dark'] .guide-role-card,
html[data-theme='dark'] .guide-tip,
html[data-theme='dark'] .guide-faq-item {
  background-color: #131c2e;
  border-color: #22304a;
}
html[data-theme='dark'] .guide-step-num {
  color: #27406f;
}
html[data-theme='dark'] .guide-note {
  background-color: #16233c;
  border-color: #27406f;
  color: var(--ink-700);
}
html[data-theme='dark'] .guide-role-owner .guide-role-icon,
html[data-theme='dark'] .guide-role-admin .guide-role-icon,
html[data-theme='dark'] .guide-role-employee .guide-role-icon,
html[data-theme='dark'] .guide-tip-icon {
  background-color: #182338;
}

/* ============================================================
   Shell v2 — navigation, top bar and surface refresh
   Appended last on purpose: it refines the components above
   without touching any page markup.
   ============================================================ */

/* --- collapsible sidebar ------------------------------------- */
.app-sidebar {
  transition: width 0.22s ease;
}

.sidebar-collapse-btn {
  display: grid;
  place-items: center;
  width: 1.9rem;
  height: 1.9rem;
  flex-shrink: 0;
  border-radius: 0.55rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background-color: rgba(255, 255, 255, 0.06);
  color: #a8bad6;
  cursor: pointer;
  transition:
    background-color 0.16s ease,
    color 0.16s ease;
}

.sidebar-collapse-btn:hover {
  background-color: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.sidebar-help {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
  padding: 0.42rem 0.55rem;
  border-radius: 0.55rem;
  color: #9fb4d3;
  font-size: 0.78rem;
  font-weight: 600;
  text-decoration: none;
  transition:
    background-color 0.16s ease,
    color 0.16s ease;
}

.sidebar-help:hover {
  background-color: rgba(255, 255, 255, 0.08);
  color: #fff;
}

@media (min-width: 768px) {
  .app-shell.is-sidebar-collapsed .app-sidebar {
    width: 4.9rem !important;
    min-width: 4.9rem !important;
    flex: 0 0 4.9rem !important;
  }

  .app-shell.is-sidebar-collapsed .app-sidebar .sidebar-brand {
    flex-direction: column;
    height: auto;
    gap: 0.55rem;
    padding: 0.8rem 0 0.6rem;
  }

  .app-shell.is-sidebar-collapsed .app-sidebar .brand-meta,
  .app-shell.is-sidebar-collapsed .app-sidebar .nav-label,
  .app-shell.is-sidebar-collapsed .app-sidebar .nav-group-label,
  .app-shell.is-sidebar-collapsed .app-sidebar .sidebar-help span,
  .app-shell.is-sidebar-collapsed .app-sidebar .sidebar-version {
    display: none;
  }

  .app-shell.is-sidebar-collapsed .app-sidebar nav a.nav-item {
    justify-content: center;
    padding-inline: 0.5rem;
  }

  .app-shell.is-sidebar-collapsed .app-sidebar nav a.nav-item i {
    width: auto;
    font-size: 1.05rem;
  }

  .app-shell.is-sidebar-collapsed .app-sidebar .sidebar-scroll {
    padding-inline: 0.55rem;
  }

  .app-shell.is-sidebar-collapsed .app-sidebar .sidebar-help {
    justify-content: center;
    padding-inline: 0;
  }

  .app-shell.is-sidebar-collapsed .app-sidebar .notification-badge {
    position: absolute;
    top: 0.2rem;
    inset-inline-end: 0.35rem;
    min-width: 1.05rem;
    height: 1.05rem;
    padding: 0 0.22rem;
    font-size: 0.6rem;
    line-height: 1.05rem;
  }
}

/* --- top bar -------------------------------------------------- */
.app-topbar {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 1rem;
  padding-inline: clamp(1rem, 2vw, 1.75rem);
  background-color: rgba(255, 255, 255, 0.78);
}

.topbar-head {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.1rem;
  min-width: 0;
}

.topbar-eyebrow {
  font-size: 0.63rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-400);
  line-height: 1.2;
}

.topbar-page-title {
  font-size: 1.02rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--ink-900);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  margin-inline-start: auto;
}

.topbar-search {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  height: 2.4rem;
  padding: 0 0.85rem;
  border-radius: 9999px;
  border: 1px solid var(--line);
  background-color: var(--surface);
  color: var(--ink-500);
  font-size: 0.83rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-xs);
  transition:
    border-color 0.16s ease,
    color 0.16s ease,
    box-shadow 0.16s ease;
}

.topbar-search:hover {
  border-color: var(--brand-200);
  color: var(--brand-700);
  box-shadow: var(--shadow-sm);
}

.topbar-search kbd {
  padding: 0.1rem 0.4rem;
  border-radius: 0.35rem;
  border: 1px solid var(--line);
  background-color: var(--surface-2);
  color: var(--ink-400);
  font-family: inherit;
  font-size: 0.62rem;
  font-weight: 700;
}

.topbar-icons {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.topbar-icon-btn {
  min-height: 2.4rem;
  width: 2.4rem;
  padding: 0;
  border-radius: 9999px;
}

#language-toggle {
  width: auto;
  min-width: 2.4rem;
  padding-inline: 0.7rem;
}

.topbar-sep {
  width: 1px;
  height: 1.6rem;
  background-color: var(--line);
  flex-shrink: 0;
}

.app-topbar .topbar-user {
  max-width: 14rem;
  font-size: 0.85rem;
}

.topbar-logout {
  border-radius: 9999px;
}

@media (max-width: 1024px) {
  .topbar-search-label,
  .topbar-search kbd {
    display: none;
  }
  .topbar-search {
    width: 2.4rem;
    padding: 0;
    justify-content: center;
  }
}

@media (max-width: 767px) {
  .topbar-eyebrow {
    display: none;
  }
  .app-topbar .topbar-user {
    display: none;
  }
  .topbar-sep {
    display: none;
  }
}

@media (max-width: 480px) {
  .topbar-logout-label {
    display: none;
  }
  .topbar-page-title {
    max-width: 7.5rem;
  }
}

/* --- content + page heading ----------------------------------- */
.app-content {
  max-width: 1360px;
  padding: clamp(1rem, 2.2vw, 2rem);
}

.page-header {
  align-items: flex-end;
  border-bottom: 1px solid var(--line-soft);
  padding-bottom: 1rem;
}

.page-header h1 {
  font-size: clamp(1.35rem, 2.3vw, 1.7rem);
  letter-spacing: -0.02em;
}

/* --- surfaces ------------------------------------------------- */
.doc-card,
.table-container {
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}

.table-container {
  overflow: auto;
}

.data-table thead th {
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.data-table tbody tr {
  transition: background-color 0.14s ease;
}

/* Softer scrollbars inside sidebars and tables. */
.sidebar-scroll,
.table-container {
  scrollbar-width: thin;
}

html[data-theme='dark'] .app-topbar {
  background-color: rgba(13, 22, 38, 0.86);
}

html[data-theme='dark'] .topbar-page-title {
  color: var(--ink-900);
}

html[data-theme='dark'] .topbar-search {
  background-color: #131c2e;
  border-color: #22304a;
  color: var(--ink-500);
}

html[data-theme='dark'] .topbar-search kbd {
  background-color: #0f1829;
  border-color: #263449;
}

html[data-theme='dark'] .topbar-sep {
  background-color: #22304a;
}

html[data-theme='dark'] .page-header {
  border-bottom-color: #1b2740;
}

html[data-theme='dark'] .sidebar-collapse-btn {
  border-color: rgba(255, 255, 255, 0.14);
}

/* --- Scrollbars for detail views (added) ----------------------- */
.profile-sheet,
.card-sheet {
  overflow: auto;
  max-height: 80vh;
  max-width: 100%;
  scrollbar-width: thin;
  scrollbar-color: var(--ink-400, #94a3b8) transparent;
}
.form-card {
  overflow: auto;
  max-height: 80vh;
  max-width: 100%;
  scrollbar-width: thin;
  scrollbar-color: var(--ink-400, #94a3b8) transparent;
}
.profile-sheet::-webkit-scrollbar,
.card-sheet::-webkit-scrollbar,
.form-card::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
.profile-sheet::-webkit-scrollbar-thumb,
.card-sheet::-webkit-scrollbar-thumb,
.form-card::-webkit-scrollbar-thumb {
  background: var(--ink-400, #94a3b8);
  border-radius: 999px;
}
.profile-sheet::-webkit-scrollbar-track,
.card-sheet::-webkit-scrollbar-track,
.form-card::-webkit-scrollbar-track {
  background: transparent;
}
/* --- Mobile responsiveness (added) ---------------------------- */
@media (max-width: 768px) {
  .app-content {
    padding: 0.75rem;
  }
  .profile-sheet,
  .card-sheet,
  .form-card {
    max-height: none;
    overflow: auto;
  }
  .profile-grid {
    grid-template-columns: 1fr;
  }
  .data-table {
    min-width: 640px;
  }
  .table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .flex.h-screen {
    height: auto;
    min-height: 100vh;
  }
}