/* ============================================================
   ITERBE — Sistema de Fluxo Interno
   Tema: Cartographic Parchment
   Paleta: #582836 (vinho) · #D9AF7B (dourado) · #1C1612 (charcoal)
   Tipografia: Cormorant Garamond (display) · Figtree (corpo)
   ============================================================ */

:root {
  --primary:        #582836;
  --primary-dark:   #3e1b25;
  --primary-light:  #7a3a4a;
  --gold:           #D9AF7B;
  --gold-dark:      #b8904f;
  --gold-light:     #f0e4cc;
  --charcoal:       #1C1612;
  --charcoal-2:     #251c17;

  --bg:             #F2EBE1;
  --surface:        #FDFAF6;
  --surface-2:      #F6F1E9;
  --border:         #E3D8CB;
  --border-strong:  #CDBFB0;

  --text:           #281A11;
  --text-muted:     #8C7565;

  --success:        #2e7d32;
  --warning:        #b45309;
  --danger:         #b71c1c;
  --info:           #01579b;

  --radius:         6px;
  --radius-lg:      10px;
  --shadow:         0 1px 3px rgba(40,26,17,.05), 0 4px 16px rgba(40,26,17,.07);
  --shadow-lg:      0 6px 30px rgba(40,26,17,.13);

  --sidebar-w:      256px;
  --header-h:       60px;
  --transition:     .18s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Figtree', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--gold-dark); }
img { max-width: 100%; }

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary-light); }


/* ── Layout Shell ─────────────────────────────────────────── */
.shell { display: flex; min-height: 100vh; }


/* ── Sidebar ──────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--charcoal);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  box-shadow: 1px 0 0 rgba(255,255,255,.04), 4px 0 24px rgba(0,0,0,.3);
  transition: transform var(--transition);
}

.sidebar-logo {
  padding: 16px 18px;
  border-bottom: 1px solid #e3d8cb;
  background: #ffffff !important;
}
.sidebar-logo .logo-mark {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: .5px;
  color: var(--primary);
  line-height: 1.1;
}
.sidebar-logo .logo-sub {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 1.8px;
  color: var(--text-muted);
  margin-top: 3px;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 18px;
  border-bottom: 1px solid rgba(255,255,255,.05);
  background: rgba(0,0,0,.2);
}
.sidebar-user .avatar {
  width: 36px; height: 36px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dark) 100%);
  color: var(--charcoal);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 13px;
  flex-shrink: 0;
}
.sidebar-user .user-info { min-width: 0; }
.sidebar-user .user-name {
  font-size: 12.5px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  color: rgba(255,255,255,.88);
}
.sidebar-user .user-role {
  font-size: 9px; text-transform: uppercase; letter-spacing: 1.4px;
  color: var(--gold); opacity: .55;
}

.sidebar-nav { flex: 1; padding: 10px 0; overflow-y: auto; }
.nav-section-label {
  font-size: 8.5px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: rgba(255,255,255,.22);
  padding: 14px 18px 4px;
  display: block;
}
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 18px;
  color: rgba(255,255,255,.58);
  font-size: 13px;
  font-weight: 500;
  border-left: 2px solid transparent;
  transition: all var(--transition);
}
.sidebar-nav a:hover {
  background: rgba(255,255,255,.05);
  color: rgba(255,255,255,.88);
  border-left-color: rgba(217,175,123,.35);
}
.sidebar-nav a.active {
  background: rgba(217,175,123,.09);
  color: #fff;
  border-left-color: var(--gold);
}
.sidebar-nav a .nav-icon { width: 17px; height: 17px; opacity: .7; flex-shrink: 0; }
.sidebar-nav a.active .nav-icon { opacity: 1; }

.sidebar-footer {
  padding: 12px 18px;
  border-top: 1px solid rgba(255,255,255,.05);
}
.sidebar-footer a,
.sidebar-footer .sidebar-logout {
  display: flex; align-items: center; gap: 8px;
  color: rgba(255,255,255,.35);
  font-size: 12px;
  transition: color var(--transition);
}
.sidebar-footer a:hover,
.sidebar-footer .sidebar-logout:hover { color: rgba(255,255,255,.7); }
.sidebar-footer .sidebar-logout { background: none; border: 0; padding: 0; width: 100%; cursor: pointer; font-family: inherit; }


/* ── Main ─────────────────────────────────────────────────── */
.main-wrap {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}


/* ── Topbar ───────────────────────────────────────────────── */
.topbar {
  height: var(--header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 28px;
  gap: 16px;
  position: sticky; top: 0;
  z-index: 90;
  box-shadow: 0 1px 0 var(--border);
}
.topbar-title {
  flex: 1;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 19px;
  font-weight: 600;
  color: var(--primary);
  letter-spacing: .01em;
}
.topbar-title small {
  font-family: 'Figtree', sans-serif;
  font-size: 11.5px;
  font-weight: 400;
  color: var(--text-muted);
  display: block;
}
.topbar-actions { display: flex; align-items: center; gap: 10px; }

.notif-btn {
  position: relative;
  width: 38px; height: 38px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
  color: var(--text-muted);
}
.notif-btn:hover { background: var(--surface-2); border-color: var(--border-strong); color: var(--primary); }
.notif-badge {
  position: absolute;
  top: 5px; right: 5px;
  width: 16px; height: 16px;
  background: var(--danger);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--surface);
}


/* ── Page Content ─────────────────────────────────────────── */
.page-content {
  flex: 1;
  padding: 28px;
  max-width: 1300px;
  width: 100%;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
}
.page-header h1 {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 28px;
  font-weight: 600;
  color: var(--primary);
  line-height: 1.2;
  letter-spacing: .01em;
}
.page-header .subtitle {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 3px;
}


/* ── Stat Cards ───────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 18px 20px 16px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  border-top: 3px solid var(--gold);
  display: flex;
  flex-direction: column;
  gap: 2px;
  transition: transform var(--transition), box-shadow var(--transition);
  position: relative;
  overflow: hidden;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.stat-card.urgent  { border-top-color: var(--danger); }
.stat-card.success { border-top-color: var(--success); }

.stat-card .stat-icon {
  width: 32px; height: 32px;
  border-radius: 7px;
  background: var(--gold-light);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 8px;
  color: var(--gold-dark);
}
.stat-card.urgent .stat-icon  { background: #ffebee; color: var(--danger); }
.stat-card.success .stat-icon { background: #e8f5e9; color: var(--success); }

.stat-card .stat-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-muted);
  font-weight: 700;
}
.stat-card .stat-value {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 42px;
  font-weight: 700;
  line-height: 1;
  color: var(--primary);
  letter-spacing: -.02em;
}
.stat-card.urgent .stat-value  { color: var(--danger); }
.stat-card.success .stat-value { color: var(--success); }


/* ── Cards ────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  overflow: hidden;
  margin-bottom: 24px;
}
.card-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--surface);
}
.card-header h2 {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 16px;
  font-weight: 600;
  color: var(--primary);
  letter-spacing: .01em;
}
.card-body { padding: 20px; }
.card-body.no-pad { padding: 0; }


/* ── Tables ───────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th {
  background: var(--surface-2);
  padding: 10px 14px;
  text-align: left;
  font-weight: 700;
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-strong);
  white-space: nowrap;
}
.tbl td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text);
}
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl tbody tr:hover td { background: var(--surface-2); }


/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  white-space: nowrap;
  line-height: 1.4;
  font-family: inherit;
}
.btn:disabled { opacity: .45; cursor: not-allowed; }

.btn-primary {
  background: var(--primary); color: #fff;
  box-shadow: 0 1px 6px rgba(88,40,54,.2);
}
.btn-primary:hover { background: var(--primary-dark); color: #fff; box-shadow: 0 3px 12px rgba(88,40,54,.3); }

.btn-gold { background: var(--gold); color: var(--primary-dark); }
.btn-gold:hover { background: var(--gold-dark); }

.btn-outline { background: transparent; color: var(--primary); border: 1.5px solid var(--primary); }
.btn-outline:hover { background: var(--primary); color: #fff; }

.btn-ghost { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); border-color: var(--border-strong); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #8b0000; color: #fff; }

.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #1b5e20; color: #fff; }

.btn-sm  { padding: 4px 11px; font-size: 11.5px; }
.btn-lg  { padding: 12px 26px; font-size: 14.5px; }
.btn-block { width: 100%; justify-content: center; }


/* ── Forms ────────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: .7px;
}
.form-label .req { color: var(--danger); margin-left: 2px; }

.form-control {
  width: 100%;
  padding: 9px 13px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(88,40,54,.1);
}
.form-control::placeholder { color: #bbb; }
textarea.form-control { resize: vertical; min-height: 90px; }
select.form-control { cursor: pointer; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.form-grid.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.form-grid.cols-5 { grid-template-columns: repeat(5, 1fr); }
.form-grid.wide-first { grid-template-columns: 2fr 1fr; }
.form-grid.addr { grid-template-columns: 3fr 1fr 1fr 1fr; }
.form-hint  { font-size: 11.5px; color: var(--text-muted); margin-top: 4px; }
.form-error { font-size: 12px; color: var(--danger); margin-top: 4px; }

/* Prefixo dentro de um input (ex.: "R$") */
.input-prefix {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); font-size: 14px; pointer-events: none;
}

/* ── Grupos de escolha (rádios / checkboxes) ───────────────── */
.choice-group { display: flex; flex-wrap: wrap; gap: 8px; }
.choice {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 13px; line-height: 1.2; cursor: pointer;
  transition: border-color var(--transition), background var(--transition), color var(--transition);
  user-select: none;
}
.choice:hover { border-color: var(--border-strong); }
.choice input { accent-color: var(--primary); cursor: pointer; margin: 0; width: 15px; height: 15px; flex-shrink: 0; }
.choice:has(input:checked) { border-color: var(--primary); background: #f5eaed; color: var(--primary); font-weight: 600; }

/* ── Cartões de membro da família ──────────────────────────── */
.member-card {
  position: relative;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-2);
  padding: 18px 18px 2px;
  margin-bottom: 16px;
}
.member-card .member-num {
  display: block; font-size: 11px; font-weight: 700; color: var(--primary);
  text-transform: uppercase; letter-spacing: .7px; margin-bottom: 14px; padding-right: 90px;
}
.member-remove { position: absolute; top: 14px; right: 14px; }

/* ── Barra de ações fixa do formulário ─────────────────────── */
.form-actionbar {
  position: sticky; bottom: 16px; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 13px 20px; margin-top: 24px;
  box-shadow: var(--shadow-lg);
}
.form-actionbar .actionbar-note { font-size: 12.5px; color: var(--text-muted); }
.form-actionbar .actionbar-btns { display: flex; gap: 10px; }

/* ── Combobox (select com busca) ───────────────────────────────── */
.combo { position: relative; }
.combo-list {
  margin-top: 6px;
  max-height: 240px;
  overflow-y: auto;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.combo-opt {
  padding: 8px 12px;
  font-size: 13.5px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.combo-opt:hover, .combo-opt.active { background: #f5eaed; color: var(--primary); }
.combo-empty { padding: 10px 12px; font-size: 13px; color: var(--text-muted); }


/* ── Badges ───────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
}
.badge-primary { background: #f5eaed; color: var(--primary); }
.badge-gold    { background: var(--gold-light); color: var(--gold-dark); }
.badge-success { background: #e8f5e9; color: var(--success); }
.badge-warning { background: #fff3e0; color: var(--warning); }
.badge-danger  { background: #ffebee; color: var(--danger); }
.badge-info    { background: #e3f2fd; color: var(--info); }
.badge-neutral { background: var(--border); color: var(--text-muted); }

.status-em_andamento { background: #ddeeff; color: #01579b; }
.status-concluido    { background: #e8f5e9; color: #2e7d32; }
.status-devolvido    { background: #fff3e0; color: #b45309; }
.status-arquivado    { background: var(--border); color: var(--text-muted); }
.status-suspenso     { background: #ffebee; color: #b71c1c; }

.priority-normal  { background: var(--border);   color: var(--text-muted); }
.priority-alta    { background: #fff3e0; color: #b45309; }
.priority-urgente { background: #ffebee; color: #b71c1c; font-weight: 800; }


/* ── Alerts ───────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 13.5px;
  font-weight: 500;
  display: flex; align-items: flex-start; gap: 10px;
  border-left: 3px solid;
}
.alert-success { background: #f0faf0; border-color: var(--success); color: #1b5e20; }
.alert-error   { background: #fff5f5; border-color: var(--danger);  color: #7f0000; }
.alert-warning { background: #fffbf0; border-color: #f59e0b;        color: #78350f; }
.alert-info    { background: #f0f7ff; border-color: var(--info);    color: #0d3c61; }


/* ── Timeline ─────────────────────────────────────────────── */
.timeline { position: relative; }
.timeline-item {
  display: flex; gap: 14px;
  padding-bottom: 22px;
  position: relative;
}
.timeline-item::before {
  content: '';
  position: absolute;
  left: 17px; top: 34px; bottom: 0;
  width: 1px;
  background: var(--border);
}
.timeline-item:last-child::before { display: none; }
.timeline-icon {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; font-size: 14px; color: var(--text-muted); z-index: 1;
}
.timeline-icon.action-criado      { background: #e3f2fd; border-color: #1565c0; color: #1565c0; }
.timeline-icon.action-encaminhado { background: #f3e5f5; border-color: #6a1b9a; color: #6a1b9a; }
.timeline-icon.action-concluido   { background: #e8f5e9; border-color: #2e7d32; color: #2e7d32; }
.timeline-icon.action-devolvido   { background: #fff3e0; border-color: #b45309; color: #b45309; }
.timeline-body { flex: 1; padding-top: 5px; }
.timeline-meta { font-size: 11px; color: var(--text-muted); margin-bottom: 3px; }
.timeline-text { font-size: 13.5px; color: var(--text); }


/* ── Flow Steps ───────────────────────────────────────────── */
.flow-track {
  display: flex;
  align-items: flex-start;
  gap: 0;
  overflow-x: auto;
  padding: 6px 0 16px;
}
.flow-step { display: flex; align-items: center; }
.flow-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 0 4px;
  min-width: 72px;
}
.flow-node-circle {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
  border: 2px solid var(--border);
  background: var(--surface-2);
  color: var(--text-muted);
  transition: all var(--transition);
}
.flow-node-label {
  font-size: 10px;
  font-weight: 600;
  white-space: normal;
  word-break: break-word;
  color: var(--text-muted);
  text-align: center;
  letter-spacing: .01em;
  max-width: 72px;
  line-height: 1.3;
}
.flow-node.done    .flow-node-circle { background: #e8f5e9; border-color: #81c784; color: var(--success); }
.flow-node.done    .flow-node-label  { color: var(--success); }
.flow-node.current .flow-node-circle { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 2px 8px rgba(88,40,54,.3); }
.flow-node.current .flow-node-label  { color: var(--primary); font-weight: 700; }
.flow-node.pending .flow-node-circle { background: var(--surface-2); border-color: var(--border); color: var(--border-strong); }

.flow-arrow {
  width: 24px;
  height: 1px;
  background: var(--border);
  flex-shrink: 0;
  margin-bottom: 14px;
  position: relative;
}
.flow-arrow::after {
  content: '';
  position: absolute;
  right: -1px; top: -3px;
  border: 3px solid transparent;
  border-left-color: var(--border-strong);
}


/* ── Auth Pages ───────────────────────────────────────────── */
.auth-page {
  min-height: 100vh;
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, var(--primary-light) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
  overflow: hidden;
}
.auth-page::before {
  content: '';
  position: absolute; inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23d9af7b' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.auth-box {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%; max-width: 420px;
  overflow: hidden;
  position: relative; z-index: 1;
}
.auth-header {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  padding: 32px 36px 24px;
  text-align: center;
}
.auth-header .auth-logo {
  font-family: 'Cormorant Garamond', serif;
  font-size: 28px; font-weight: 700;
  color: var(--gold);
  letter-spacing: 2px; line-height: 1;
}
.auth-header .auth-subtitle {
  font-size: 11px; text-transform: uppercase;
  letter-spacing: 2px; color: rgba(255,255,255,.5); margin-top: 4px;
}
.auth-header .auth-inst {
  font-size: 13px; color: rgba(255,255,255,.72); margin-top: 10px;
}
.auth-body { padding: 32px 36px; }
.auth-footer {
  padding: 16px 36px;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 11.5px; color: var(--text-muted);
}


/* ── QR / 2FA ─────────────────────────────────────────────── */
.qr-box {
  text-align: center; padding: 24px;
  background: var(--surface-2);
  border-radius: var(--radius);
  border: 1.5px dashed var(--border-strong);
  margin-bottom: 20px;
}
.qr-box #qrcode {
  display: inline-block; padding: 12px;
  background: #fff; border-radius: 8px; box-shadow: var(--shadow);
}
.secret-code {
  font-family: 'Courier New', monospace;
  font-size: 16px; letter-spacing: 3px; font-weight: 700;
  color: var(--primary); background: var(--surface-2);
  padding: 10px 16px; border-radius: 8px;
  border: 1px solid var(--border);
  text-align: center; margin: 12px 0; user-select: all;
}


/* ── Modal ────────────────────────────────────────────────── */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(28,22,18,.5);
  z-index: 200;
  align-items: center; justify-content: center; padding: 24px;
}
.modal-overlay.open { display: flex; }
.modal-box {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%; max-width: 520px;
  overflow: hidden;
  animation: modalIn .18s ease;
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(-16px) scale(.98); }
  to   { opacity: 1; transform: none; }
}
.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-header h3 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 16px; font-weight: 600; color: var(--primary);
}
.modal-header .modal-close {
  width: 30px; height: 30px; border-radius: 50%;
  border: none; background: var(--border); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; color: var(--text-muted);
  transition: background var(--transition); flex-shrink: 0;
}
.modal-header .modal-close:hover { background: var(--primary); color: #fff; }
.modal-body { padding: 20px; }
.modal-footer {
  padding: 13px 20px;
  border-top: 1px solid var(--border);
  display: flex; gap: 10px; justify-content: flex-end;
}


/* ── OTP Input ────────────────────────────────────────────── */
.otp-input {
  text-align: center; font-size: 28px; font-weight: 800;
  letter-spacing: 12px; padding: 14px 20px;
  border: 1.5px solid var(--border); border-radius: var(--radius);
  width: 100%;
  font-family: 'Courier New', monospace; color: var(--primary);
  background: var(--surface-2); outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.otp-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(88,40,54,.1);
  background: #fff;
}


/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: none; }
  .main-wrap { margin-left: 0; }
  .form-grid,
  .form-grid.cols-3,
  .form-grid.cols-4,
  .form-grid.cols-5,
  .form-grid.wide-first,
  .form-grid.addr { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .page-content { padding: 16px; }
  .form-actionbar { flex-direction: column; align-items: stretch; }
  .form-actionbar .actionbar-btns .btn { flex: 1; justify-content: center; }
}


/* ── Utilities ────────────────────────────────────────────── */
.text-muted   { color: var(--text-muted); }
.text-primary { color: var(--primary); }
.text-gold    { color: var(--gold-dark); }
.text-danger  { color: var(--danger); }
.text-success { color: var(--success); }
.text-center  { text-align: center; }
.text-right   { text-align: right; }
.text-sm      { font-size: 12px; }
.text-xs      { font-size: 11px; }
.fw-bold      { font-weight: 700; }
.fw-900       { font-weight: 900; }
.mt-0 { margin-top: 0; }    .mt-1 { margin-top: 8px; }   .mt-2 { margin-top: 16px; }  .mt-3 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; }
.d-flex   { display: flex; }
.d-none   { display: none; }
.align-center    { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 8px; } .gap-2 { gap: 16px; }
.separator { border: none; border-top: 1px solid var(--border); margin: 20px 0; }

.chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 20px; font-size: 10.5px; color: var(--text-muted);
}

.empty-state { text-align: center; padding: 48px 24px; color: var(--text-muted); }
.empty-state .empty-icon { font-size: 48px; margin-bottom: 12px; opacity: .35; }
.empty-state p { font-size: 14px; }

/* Flash messages */
.flash-msg { animation: flashIn .3s ease; }
@keyframes flashIn {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: none; }
}

/* Print */
@media print {
  .sidebar, .topbar, .btn, .modal-overlay { display: none !important; }
  .main-wrap { margin-left: 0; }
  .card { box-shadow: none; border: 1px solid #ccc; }
}
