/* ============================================================
   XET 1.7.0 — "Soft brand" look (loaded after main.css)
   Every color comes from the region's theme (includes/theme.php):
   --brand, --brand-dk, --brand-tint, --sidebar-*, --bg-*, --text-*.
   ============================================================ */

body { background: var(--bg-page); -webkit-font-smoothing: antialiased; }

/* ── Sidebar: light, tinted with the brand color ── */
.sidebar {
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  border-right: 1px solid var(--sidebar-border);
}
.sidebar-logo { border-bottom: 1px solid var(--sidebar-border); padding: 18px 18px 14px; }
.sidebar-nav { padding: 10px 0; }
.sidebar-nav a {
  color: var(--sidebar-text);
  margin: 1px 10px;
  padding: 9px 12px;
  border-radius: 8px;
  font-weight: 500;
}
.sidebar-nav a:hover { background: var(--sidebar-hover); color: var(--text-primary); }
.sidebar-nav a.active { background: var(--brand); color: var(--brand-on); }
.sidebar-nav a.active::before { display: none; }
.sidebar-nav .badge { background: var(--brand); color: var(--brand-on); }
.sidebar-nav a.active .badge { background: var(--brand-on); color: var(--brand); }
.sidebar-nav .nav-section-toggle {
  background: transparent !important;
  color: var(--sidebar-muted) !important;
  margin: 10px 0 0;
  padding: 8px 22px !important;
  border-radius: 0 !important;
}
.sidebar-nav .nav-section-toggle:hover { color: var(--brand) !important; }
.sidebar-nav .nav-section-body a { padding-left: 22px !important; }
.sidebar-footer { border-top: 1px solid var(--sidebar-border); color: var(--sidebar-muted); }
.sidebar-footer strong { color: var(--text-primary); }
.sidebar-footer a { color: var(--sidebar-muted) !important; }
.sidebar-footer a:hover { color: var(--brand) !important; }
.brand-name    { font-size: 16px; font-weight: 700; color: var(--text-primary); line-height: 1.15; }
.brand-tagline { font-size: 10.5px; font-weight: 700; color: var(--brand-text); letter-spacing: 1.1px; text-transform: uppercase; margin-top: 2px; }

/* ── Top bar ── */
.topbar { box-shadow: none; border-bottom: 1px solid var(--border); background: var(--bg-card); }
.topbar-title { font-weight: 700; letter-spacing: -0.01em; }
.region-switch summary { background: var(--brand-tint) !important; color: var(--brand-text) !important; }

/* ── Cards: lighter, rounder, flatter ── */
.card { border-radius: 12px; box-shadow: none; border-color: var(--border); }
.card-header { padding: 14px 20px; }
.card-title { font-weight: 700; letter-spacing: -0.005em; }
.stat-card { border-radius: 12px; box-shadow: none; border: 1px solid var(--border); background: var(--bg-card); }
.stat-number { letter-spacing: -0.02em; }
.stat-number.red   { color: #DC2626; }
[data-theme="dark"] .stat-number.red { color: #F87171; }

/* ── Tables ── */
table th { background: transparent; color: var(--text-muted); font-weight: 600; letter-spacing: .04em; }
table tr:hover td { background: var(--bg-hover); }

/* ── Buttons ── */
.btn { border-radius: 8px; font-weight: 600; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-on); }
.btn-primary:hover:not(:disabled) { background: var(--brand-dk); border-color: var(--brand-dk); }
.btn-secondary { background: var(--bg-card); border: 1px solid var(--border); color: var(--text-primary); }
.btn-danger { background: transparent; color: #DC2626; border: 1px solid #FCA5A5; }
.btn-danger:hover:not(:disabled) { background: #DC2626; color: #fff; border-color: #DC2626; }

/* ── Forms ── */
.form-control { border-radius: 8px; }
.form-control:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-tint-2); }
.checkbox-pill.checked { background: var(--brand-tint); border-color: var(--brand); color: var(--brand-text); }

/* ── Alerts and badges ── */
.alert { border-radius: 10px; border: 1px solid transparent; }
.alert-info { border-color: var(--brand-tint-2); }
.status-already_customer { background: var(--brand-tint); color: var(--brand-text); }
[data-theme="dark"] .status-already_customer { background: var(--brand-tint); }
.row-pastdue td { border-left-color: #DC2626; }

/* ── Login pages ── */
.auth-page { background: var(--bg-page); }
.auth-card { border-radius: 16px; box-shadow: none; border: 1px solid var(--border); }

/* ── Dark-mode switch ── */
[data-theme="dark"] .toggle-track { background: var(--brand); }

/* ── Phones ── */
@media (max-width: 768px) {
  .sidebar { box-shadow: 4px 0 24px rgba(0,0,0,.12); }
  .page-content { padding: 16px; }
}

/* 1.8.0 — related-page tab strip */
.xet-subtabs { display:flex; gap:4px; flex-wrap:wrap; border-bottom:1px solid var(--border); margin:0 0 18px; }
.xet-subtabs a { padding:9px 14px; font-size:14px; font-weight:600; color:var(--text-secondary); text-decoration:none; border-bottom:2px solid transparent; margin-bottom:-1px; }
.xet-subtabs a:hover { color:var(--text-primary); }
.xet-subtabs a.on { color:var(--brand); border-bottom-color:var(--brand); }
.nav-badge { margin-left:auto; min-width:20px; height:20px; padding:0 6px; border-radius:10px; background:#DC2626; color:#fff; font-size:11px; font-weight:700; line-height:20px; text-align:center; }

/* 1.9.0 — XET app panel */
.xa-muted { font-size: 13px; color: var(--text-muted); display: block; margin-top: 2px; }
.xa-ok { font-size: 13px; color: #15803d; margin-top: 4px; font-weight: 600; }
.xa-step { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.xa-step:last-child { border-bottom: none; }
.xa-n { flex: 0 0 24px; height: 24px; border-radius: 12px; background: var(--brand); color: var(--brand-on, #fff); font-weight: 700; font-size: 12px; display: flex; align-items: center; justify-content: center; margin-top: 1px; }
.xa-links { margin-top: 8px; display: flex; gap: 6px; flex-wrap: wrap; font-size: 13px; }
.xa-key { display: inline-block; padding: 0 5px; border: 1px solid var(--border); border-radius: 5px; font-size: 12px; }
.xa-sub { font-size: 12px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase; color: var(--text-secondary); margin: 16px 0 4px; }
.xa-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 0; border-top: 1px solid var(--border); cursor: pointer; }
.xa-row b { font-size: 14px; font-weight: 600; display: block; }
.xa-msg { font-size: 13px; margin-top: 6px; min-height: 1px; }
.xa-switch { appearance: none; -webkit-appearance: none; flex: 0 0 44px; width: 44px; height: 26px; border-radius: 13px; background: #cbd5e1; position: relative; cursor: pointer; transition: background .15s; margin: 0; }
.xa-switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: left .15s; }
.xa-switch:checked { background: var(--brand); }
.xa-switch:checked::after { left: 21px; }
@media (display-mode: standalone) { .topbar { padding-top: env(safe-area-inset-top); } }

/* 1.9.0 — keep the phone top bar on one screen width */
@media (max-width: 520px) {
  .topbar-right { gap: 4px !important; }
  .topbar-right > a[title], .topbar-right > button[title] { width: 30px !important; height: 32px !important; font-size: 17px !important; }
  .topbar .dark-toggle .toggle-track { display: none; }
  .topbar .dark-toggle { padding: 0 2px; }
}

/* 1.9.4 — line icons (Lucide) in place of emoji */
.xi { width: 1.05em; height: 1.05em; vertical-align: -0.16em; flex-shrink: 0; display: inline-block; }
.nav-icon .xi { width: 18px; height: 18px; vertical-align: middle; opacity: .85; }
.topbar-right .xi { width: 20px; height: 20px; }
.card-title .xi, h1 .xi, h2 .xi { opacity: .8; }

/* 1.9.7: menu button uses a line icon (the old symbol was being stripped as an emoji) */
.hamburger { line-height: 0; }
.hamburger .xi { width: 26px; height: 26px; display: block; }
