/* =========================================================
   NORTH FITS — Business Management System
   Premium offline dashboard styles (no external fonts/libs)
   ========================================================= */

:root {
  --navy: #0b1220;
  --navy-2: #111c31;
  --navy-3: #1c2b45;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-soft: #eaf1ff;
  --accent: #06b6d4;
  --accent-soft: #e4fbfd;
  --success: #10b981;
  --success-soft: #e7f8f2;
  --warning: #f59e0b;
  --warning-soft: #fff5e3;
  --danger: #ef4444;
  --danger-soft: #feecec;
  --purple: #7c3aed;
  --purple-soft: #f1ebff;
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --text: #0f172a;
  --text-2: #475569;
  --muted: #94a3b8;
  --border: #e5eaf1;
  --border-2: #d7dee8;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05), 0 1px 3px rgba(15, 23, 42, .04);
  --shadow: 0 4px 20px rgba(15, 23, 42, .07);
  --shadow-lg: 0 24px 60px rgba(15, 23, 42, .18);
  --radius: 14px;
  --radius-sm: 9px;
  --sidebar-w: 254px;
  --topbar-h: 72px;
  --t: .22s cubic-bezier(.4, 0, .2, 1);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: "Segoe UI", Inter, -apple-system, BlinkMacSystemFont, Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: var(--primary); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.nowrap { white-space: nowrap; }
.mono { font-variant-numeric: tabular-nums; }
.ic { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ic.filled { fill: currentColor; stroke: none; }

/* ---------- Login ---------- */
.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
  position: relative;
  overflow: hidden;
  background: radial-gradient(1100px 600px at 12% 10%, #1b3157 0%, transparent 55%),
              radial-gradient(900px 600px at 92% 90%, #12324a 0%, transparent 55%),
              linear-gradient(135deg, #0a1120, #101e36 55%, #0a1729);
}
.login-bg-shape { position: absolute; border-radius: 50%; filter: blur(2px); pointer-events: none; }
.shape-a { width: 420px; height: 420px; border: 1px solid rgba(255,255,255,.06); top: -140px; right: -120px; box-shadow: 0 0 0 60px rgba(255,255,255,.015), 0 0 0 120px rgba(255,255,255,.01); }
.shape-b { width: 300px; height: 300px; border: 1px solid rgba(6,182,212,.12); bottom: -150px; left: -80px; }
.login-shell {
  width: min(960px, 100%);
  min-height: 560px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--surface);
  border-radius: 24px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  position: relative;
  z-index: 1;
  animation: rise .5s ease both;
}
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.login-brand-panel {
  padding: 56px 48px;
  color: white;
  background: linear-gradient(155deg, #0d1a30 0%, #142a4b 55%, #0f3b52 100%);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.login-brand-panel::after {
  content: ""; position: absolute; width: 440px; height: 440px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,.06); right: -220px; bottom: -170px;
  box-shadow: 0 0 0 50px rgba(255,255,255,.02), 0 0 0 100px rgba(255,255,255,.015);
}
.brand-mark {
  width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff; font-weight: 800; letter-spacing: -.5px; font-size: 15px;
  box-shadow: 0 6px 16px rgba(37,99,235,.35); flex: none;
}
.brand-mark.big { width: 62px; height: 62px; font-size: 21px; border-radius: 17px; margin-bottom: 26px; }
.login-brand-panel h1 { font-size: 34px; letter-spacing: 3px; margin: 0 0 6px; font-weight: 800; }
.login-brand-panel p { color: #a9c0df; margin: 0; font-size: 15px; letter-spacing: .4px; }
.brand-divider { width: 54px; height: 3px; border-radius: 3px; background: var(--accent); margin: 32px 0 26px; }
.brand-points { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; position: relative; z-index: 1; }
.brand-points li { display: flex; align-items: center; gap: 12px; color: #d6e4f5; font-size: 14px; }
.brand-points .ic { color: #22d3ee; width: 16px; height: 16px; stroke-width: 2.5; }
.login-form-panel { padding: 64px 56px; display: flex; flex-direction: column; justify-content: center; }
.login-form-panel h2 { font-size: 28px; margin: 0 0 4px; letter-spacing: -.5px; }
.login-form-panel > p { margin: 0 0 32px; }
.login-mobile-brand { display: none; align-items: center; gap: 10px; margin-bottom: 22px; font-size: 16px; letter-spacing: 1px; }
.field-label { display: block; font-size: 12.5px; font-weight: 650; color: var(--text-2); margin: 0 0 7px; }
.input-wrap { position: relative; margin-bottom: 20px; }
.input-wrap > .ic { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 17px; height: 17px; }
.input-wrap input { width: 100%; height: 48px; padding: 0 14px 0 42px; border: 1.5px solid var(--border-2); border-radius: var(--radius-sm); outline: none; background: #fff; transition: var(--t); color: var(--text); }
.input-wrap input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(37,99,235,.1); }
.form-error { color: var(--danger); font-size: 12.5px; min-height: 18px; margin: -8px 0 8px; }
.login-foot { margin-top: 26px; text-align: center; color: var(--muted); font-size: 12px; }

/* ---------- App shell ---------- */
.app-shell { min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); height: 100vh; position: fixed; left: 0; top: 0; z-index: 40;
  background: linear-gradient(180deg, var(--navy) 0%, #0d182b 100%);
  color: #c8d6ea; display: flex; flex-direction: column;
  border-right: 1px solid rgba(255,255,255,.05);
}
.sidebar-brand { height: var(--topbar-h); display: flex; align-items: center; gap: 12px; padding: 0 22px; border-bottom: 1px solid rgba(255,255,255,.07); flex: none; }
.sidebar-brand strong { display: block; color: #fff; font-size: 15px; letter-spacing: 1.6px; line-height: 1.1; }
.sidebar-brand span { font-size: 10.5px; color: #7d93b3; letter-spacing: 1.2px; text-transform: uppercase; }
.nav { padding: 20px 12px; overflow-y: auto; flex: 1; scrollbar-width: thin; }
.nav-section { font-size: 10px; letter-spacing: 1.5px; color: #5f7696; font-weight: 700; padding: 14px 12px 8px; }
.nav-item {
  width: 100%; display: flex; align-items: center; gap: 12px; border: 0; background: transparent;
  color: #a9bbd3; padding: 11px 12px; border-radius: 10px; text-align: left; font-size: 13.5px;
  font-weight: 550; transition: var(--t); position: relative; margin-bottom: 3px;
}
.nav-item .ic { width: 19px; height: 19px; }
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active { background: linear-gradient(90deg, rgba(37,99,235,.28), rgba(37,99,235,.08)); color: #fff; box-shadow: inset 3px 0 0 #3b82f6; }
.nav-item.active .ic { color: #60a5fa; }
.nav-badge { margin-left: auto; font-style: normal; font-size: 10px; font-weight: 700; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 20px; background: rgba(255,255,255,.1); color: #dbe7f6; display: none; place-items: center; }
.nav-badge.show { display: grid; }
.nav-badge.warn { background: rgba(245,158,11,.2); color: #fbbf24; }
.sidebar-user { border-top: 1px solid rgba(255,255,255,.07); padding: 16px 18px; display: flex; align-items: center; gap: 10px; flex: none; }
.avatar, .topbar-avatar { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: linear-gradient(135deg, #3b82f6, #06b6d4); color: #fff; font-weight: 700; font-size: 12px; flex: none; }
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-info strong { display: block; color: #fff; font-size: 12.5px; }
.sidebar-user-info span { font-size: 11px; color: #7d93b3; }
.sidebar-user .icon-btn { color: #8fa4c0; }
.sidebar-user .icon-btn:hover { color: #fff; background: rgba(255,255,255,.08); }
.sidebar-overlay { display: none; }

.main-wrap { margin-left: var(--sidebar-w); min-height: 100vh; }
.topbar {
  height: var(--topbar-h); background: rgba(255,255,255,.92); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 18px;
  padding: 0 30px; position: sticky; top: 0; z-index: 30;
}
.menu-btn { display: none; }
.global-search { position: relative; width: min(480px, 46vw); }
.global-search > .ic { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.global-search input { width: 100%; height: 40px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); padding: 0 14px 0 40px; outline: none; transition: var(--t); }
.global-search input:focus { background: #fff; border-color: var(--primary); box-shadow: 0 0 0 4px rgba(37,99,235,.09); }
.search-results {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0; max-height: 420px; overflow: auto;
  background: #fff; border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg);
  padding: 8px; z-index: 50;
}
.search-group-title { font-size: 10px; letter-spacing: 1.2px; font-weight: 700; color: var(--muted); padding: 8px 10px 4px; text-transform: uppercase; }
.search-hit { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: transparent; padding: 9px 10px; border-radius: 8px; text-align: left; }
.search-hit:hover { background: var(--primary-soft); }
.search-hit .ic { width: 15px; height: 15px; color: var(--primary); }
.search-hit span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-hit small { color: var(--muted); }
.search-empty { padding: 20px; text-align: center; color: var(--muted); font-size: 13px; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.today-chip { display: flex; align-items: center; gap: 7px; color: var(--text-2); font-size: 12.5px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; padding: 7px 11px; }
.today-chip .ic { width: 15px; height: 15px; color: var(--primary); }
.page-content { padding: 28px 30px 48px; max-width: 1700px; margin: 0 auto; animation: fadeIn .25s ease; }
@keyframes fadeIn { from { opacity: .55; transform: translateY(5px); } to { opacity: 1; transform: none; } }

/* ---------- Shared UI ---------- */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head h1 { font-size: 24px; margin: 0 0 4px; letter-spacing: -.5px; }
.page-head p { margin: 0; color: var(--muted); font-size: 13px; }
.page-actions { display: flex; gap: 9px; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px;
  padding: 0 15px; border-radius: 9px; border: 1px solid var(--border-2); background: #fff; color: var(--text-2);
  font-size: 13px; font-weight: 600; white-space: nowrap; transition: var(--t);
}
.btn .ic { width: 16px; height: 16px; }
.btn:hover { border-color: #b9c6d6; color: var(--text); box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.btn:active { transform: none; }
.btn-primary { background: linear-gradient(135deg, var(--primary), #3b82f6); border-color: transparent; color: #fff; box-shadow: 0 5px 14px rgba(37,99,235,.25); }
.btn-primary:hover { color: #fff; box-shadow: 0 8px 18px rgba(37,99,235,.3); }
.btn-success { background: var(--success); border-color: transparent; color: #fff; }
.btn-danger { background: var(--danger); border-color: transparent; color: #fff; }
.btn-danger:hover { color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-block { width: 100%; height: 48px; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12px; border-radius: 7px; }
.icon-btn { width: 36px; height: 36px; border-radius: 9px; border: 1px solid transparent; background: transparent; color: var(--text-2); display: grid; place-items: center; transition: var(--t); flex: none; }
.icon-btn:hover { background: var(--surface-2); border-color: var(--border); color: var(--text); }
.icon-btn.danger:hover { background: var(--danger-soft); color: var(--danger); border-color: #f8caca; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-head { padding: 17px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.card-head h2, .card-head h3 { margin: 0; font-size: 15px; letter-spacing: -.2px; }
.card-head p { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.card-body { padding: 20px; }
.card-body.flush { padding: 0; }

.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 18px 16px; box-shadow: var(--shadow-sm); position: relative; overflow: hidden; transition: var(--t); }
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.stat-card::after { content: ""; position: absolute; right: -24px; top: -24px; width: 90px; height: 90px; border-radius: 50%; background: var(--tint, var(--primary-soft)); opacity: .55; }
.stat-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; position: relative; z-index: 1; }
.stat-label { font-size: 12px; color: var(--text-2); font-weight: 600; }
.stat-icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--tint, var(--primary-soft)); color: var(--tone, var(--primary)); }
.stat-icon .ic { width: 18px; height: 18px; }
.stat-value { font-size: 25px; font-weight: 750; letter-spacing: -.7px; margin: 12px 0 3px; font-variant-numeric: tabular-nums; position: relative; z-index: 1; }
.stat-foot { font-size: 11.5px; color: var(--muted); display: flex; align-items: center; gap: 5px; position: relative; z-index: 1; }
.stat-foot .pill { font-size: 10.5px; font-weight: 700; padding: 1px 6px; border-radius: 5px; background: var(--success-soft); color: var(--success); }

.grid-2 { display: grid; grid-template-columns: 1.5fr 1fr; gap: 18px; margin-bottom: 18px; }
.grid-2.equal { grid-template-columns: 1fr 1fr; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-bottom: 18px; }
.chart-wrap { width: 100%; overflow: hidden; }
.chart-wrap svg { width: 100%; height: auto; display: block; }
.chart-legend { display: flex; gap: 18px; padding: 0 20px 16px; font-size: 11.5px; color: var(--text-2); }
.legend-dot { width: 9px; height: 9px; border-radius: 3px; display: inline-block; margin-right: 6px; }

/* Tables */
.table-tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 14px 20px; border-bottom: 1px solid var(--border); }
.search-field { position: relative; flex: 1; min-width: 200px; max-width: 340px; }
.search-field .ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--muted); }
.search-field input, .select-field, .date-field, .input, .textarea {
  width: 100%; height: 38px; border: 1px solid var(--border-2); border-radius: 8px; background: #fff;
  padding: 0 12px; outline: none; color: var(--text); transition: var(--t); font-size: 13px;
}
.search-field input { padding-left: 35px; }
.input:focus, .select-field:focus, .date-field:focus, .textarea:focus, .search-field input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.09); }
.textarea { height: auto; min-height: 74px; padding: 10px 12px; resize: vertical; }
.select-field { cursor: pointer; }
.date-field { min-width: 150px; }
.table-tools .select-field { width: auto; min-width: 140px; }
.table-scroll { overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; font-size: 12.8px; }
.data-table thead th {
  text-align: left; padding: 11px 16px; background: var(--surface-2); color: var(--text-2);
  font-size: 10.5px; letter-spacing: .7px; text-transform: uppercase; font-weight: 700; white-space: nowrap; border-bottom: 1px solid var(--border);
}
.data-table tbody td { padding: 12px 16px; border-bottom: 1px solid #f0f3f8; vertical-align: middle; white-space: nowrap; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr { transition: background .15s; }
.data-table tbody tr:hover { background: #fbfdff; }
.data-table .strong { font-weight: 650; color: var(--text); }
.data-table .sub { display: block; font-size: 11px; color: var(--muted); margin-top: 1px; }
.data-table tfoot td { padding: 12px 16px; background: var(--surface-2); font-weight: 700; border-top: 1px solid var(--border); }
.row-actions { display: flex; gap: 2px; justify-content: flex-end; }
.row-actions .icon-btn { width: 30px; height: 30px; }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 20px; font-size: 10.5px; font-weight: 700; white-space: nowrap; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); }
.badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.badge.success { background: var(--success-soft); color: #047857; border-color: #c6efdf; }
.badge.warning { background: var(--warning-soft); color: #b45309; border-color: #fde3b3; }
.badge.danger { background: var(--danger-soft); color: #b91c1c; border-color: #f8cccc; }
.badge.info { background: var(--primary-soft); color: var(--primary-dark); border-color: #cfddff; }
.badge.purple { background: var(--purple-soft); color: var(--purple); border-color: #ddd0ff; }
.table-footer { padding: 12px 20px; display: flex; justify-content: space-between; align-items: center; gap: 12px; color: var(--muted); font-size: 12px; border-top: 1px solid var(--border); flex-wrap: wrap; }

.empty-state { padding: 54px 20px; text-align: center; }
.empty-icon { width: 58px; height: 58px; border-radius: 16px; background: var(--surface-2); border: 1px solid var(--border); display: grid; place-items: center; margin: 0 auto 14px; color: var(--muted); }
.empty-icon .ic { width: 26px; height: 26px; }
.empty-state h3 { margin: 0 0 5px; font-size: 15px; }
.empty-state p { margin: 0 0 16px; color: var(--muted); font-size: 12.5px; }

.alert-strip { display: flex; align-items: center; gap: 10px; padding: 11px 15px; border-radius: 10px; margin-bottom: 16px; font-size: 12.5px; }
.alert-strip .ic { width: 17px; height: 17px; }
.alert-strip.warn { background: var(--warning-soft); color: #92400e; border: 1px solid #fce4b6; }
.alert-strip.danger { background: var(--danger-soft); color: #991b1b; border: 1px solid #f8cccc; }
.alert-strip.info { background: var(--primary-soft); color: #1e40af; border: 1px solid #cfddff; }

/* Forms in modals */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-group { min-width: 0; }
.form-group.full { grid-column: 1 / -1; }
.form-group label { display: block; font-size: 12px; font-weight: 650; color: var(--text-2); margin-bottom: 6px; }
.form-group label .req { color: var(--danger); }
.form-group .hint { font-size: 11px; color: var(--muted); margin-top: 5px; display: block; }
.form-section-title { grid-column: 1 / -1; font-size: 11px; letter-spacing: 1px; text-transform: uppercase; font-weight: 750; color: var(--primary); border-bottom: 1px solid var(--border); padding-bottom: 8px; margin-top: 4px; }
.calc-box { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 14px; }
.calc-row { display: flex; justify-content: space-between; font-size: 12.5px; padding: 4px 0; color: var(--text-2); }
.calc-row.total { border-top: 1px dashed var(--border-2); margin-top: 8px; padding-top: 10px; font-size: 16px; font-weight: 750; color: var(--text); }
.calc-row.due { color: var(--danger); font-weight: 700; }
.switch-line { display: flex; align-items: center; gap: 9px; font-size: 12.5px; color: var(--text-2); margin-top: 6px; }
.switch-line input { width: 16px; height: 16px; accent-color: var(--primary); }

/* Modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(9, 16, 30, .55); backdrop-filter: blur(3px); z-index: 100; display: flex; align-items: center; justify-content: center; padding: 20px; animation: fadeIn .18s ease; }
.modal { width: min(720px, 100%); max-height: calc(100vh - 40px); background: #fff; border-radius: 16px; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; overflow: hidden; animation: popIn .22s ease; }
.modal.wide { width: min(1000px, 100%); }
.modal.small { width: min(440px, 100%); }
@keyframes popIn { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
.modal-head { padding: 18px 22px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; flex: none; }
.modal-head h2 { margin: 0; font-size: 17px; }
.modal-head p { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.modal-body { padding: 22px; overflow-y: auto; flex: 1; }
.modal-foot { padding: 15px 22px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; background: var(--surface-2); flex: none; }
.confirm-text { font-size: 14px; color: var(--text-2); line-height: 1.6; }
.confirm-text strong { color: var(--text); }

/* Toasts */
.toast-root { position: fixed; right: 22px; bottom: 22px; z-index: 200; display: flex; flex-direction: column; gap: 10px; width: min(360px, calc(100vw - 40px)); }
.toast { display: flex; align-items: flex-start; gap: 11px; background: #fff; border: 1px solid var(--border); border-left: 4px solid var(--primary); border-radius: 10px; box-shadow: var(--shadow); padding: 12px 14px; animation: slideIn .25s ease; }
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }
.toast .ic { color: var(--primary); margin-top: 1px; }
.toast.success .ic { color: var(--success); }
.toast.error .ic { color: var(--danger); }
.toast.warning .ic { color: var(--warning); }
.toast-div { flex: 1; min-width: 0; }
.toast-title { font-weight: 700; font-size: 12.5px; }
.toast-msg { font-size: 12px; color: var(--text-2); word-break: break-word; }
.toast-close { border: 0; background: transparent; color: var(--muted); padding: 0; }
@keyframes slideIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }

/* Dashboard specific */
.activity-list { display: flex; flex-direction: column; }
.activity-item { display: flex; align-items: center; gap: 12px; padding: 11px 20px; border-bottom: 1px solid #f0f3f8; }
.activity-item:last-child { border-bottom: 0; }
.activity-icon { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; flex: none; }
.activity-icon .ic { width: 16px; height: 16px; }
.activity-info { flex: 1; min-width: 0; }
.activity-info strong { display: block; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.activity-info span { font-size: 11px; color: var(--muted); }
.activity-amount { font-weight: 700; font-size: 13px; font-variant-numeric: tabular-nums; }
.finance-list { display: grid; gap: 1px; background: var(--border); }
.finance-row { display: flex; justify-content: space-between; align-items: center; padding: 11px 20px; background: #fff; font-size: 12.5px; }
.finance-row span { color: var(--text-2); }
.finance-row strong { font-variant-numeric: tabular-nums; }
.finance-row.net { background: var(--surface-2); }
.finance-row.net strong { font-size: 16px; }

/* Stock variant editor */
.variant-rows { display: grid; gap: 10px; }
.variant-head, .variant-row { display: grid; grid-template-columns: 1.2fr 1fr .7fr .9fr .9fr .85fr 34px; gap: 8px; align-items: end; }
.variant-head { padding: 0 10px; font-size: 10px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); font-weight: 700; }
.variant-row { padding: 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.variant-row .form-group label { font-size: 10.5px; }
.variant-row .input { height: 34px; padding: 0 8px; font-size: 12px; }
.variant-line-value { font-size: 12px; font-weight: 700; text-align: right; padding-bottom: 9px; color: var(--primary-dark); font-variant-numeric: tabular-nums; }

/* Order line items */
.line-items { display: grid; gap: 10px; }
.line-row { display: grid; grid-template-columns: 2fr .7fr .7fr .7fr .8fr .8fr 34px; gap: 8px; align-items: end; padding: 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.line-row .form-group label { font-size: 10.5px; }
.line-row .input, .line-row .select-field { height: 34px; padding: 0 8px; font-size: 12px; }
.line-row .line-total { font-size: 12px; font-weight: 700; text-align: right; padding-bottom: 9px; color: var(--primary-dark); }
.line-head { display: grid; grid-template-columns: 2fr .7fr .7fr .7fr .8fr .8fr 34px; gap: 8px; padding: 0 10px; font-size: 10px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); font-weight: 700; }
/* Order lines: roomy two-row cards */
.order-line { display: block; padding: 14px; }
.order-line-top, .order-line-bottom { display: grid; gap: 12px; align-items: end; }
.order-line-top { grid-template-columns: 2.2fr 1.2fr 1fr .8fr; }
.order-line-bottom { grid-template-columns: 1fr 1fr 1.1fr 42px; margin-top: 12px; }
.order-line .form-group label { font-size: 11px; }
.order-line .input, .order-line .select-field { height: 38px; padding: 0 10px; font-size: 13px; }
.line-total-box { display: flex; flex-direction: column; align-items: flex-end; justify-content: flex-end; padding-bottom: 8px; }
.line-total-box small { font-size: 10px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); font-weight: 700; }
.line-total-box strong { font-size: 14px; color: var(--primary-dark); font-variant-numeric: tabular-nums; }
.order-line-meta { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-top: 10px; }
.order-line-meta .stock-hint, .order-line-meta .stock-error { margin-top: 0; font-size: 11.5px; }
.stock-hint { color: var(--muted); }
.stock-error { color: var(--danger); font-weight: 700; min-height: 14px; }
.order-line.row-invalid { border-color: #f3b8b8; background: #fffafa; }
.order-summary-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.summary-panel { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 16px; }
.summary-panel h4 { margin: 0 0 12px; font-size: 12px; letter-spacing: .6px; text-transform: uppercase; color: var(--text-2); }

/* Settings / backup */
.backup-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.drop-zone { border: 2px dashed var(--border-2); border-radius: 12px; padding: 30px 20px; text-align: center; background: var(--surface-2); transition: var(--t); }
.drop-zone.dragover { border-color: var(--primary); background: var(--primary-soft); }
.drop-zone .ic { width: 30px; height: 30px; color: var(--primary); }
.drop-zone h3 { margin: 10px 0 4px; font-size: 14px; }
.drop-zone p { margin: 0 0 14px; font-size: 12px; color: var(--muted); }
.data-stat-row { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px dashed var(--border); font-size: 12.5px; }
.data-stat-row:last-child { border-bottom: 0; }
.data-stat-row strong { font-variant-numeric: tabular-nums; }

/* Report filter bar */
.filter-bar { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.filter-bar .form-group { margin: 0; }
.filter-bar .form-group label { font-size: 10.5px; letter-spacing: .4px; text-transform: uppercase; }
.kpi-strip { display: grid; grid-template-columns: repeat(5, 1fr); gap: 1px; background: var(--border); border-radius: 12px; overflow: hidden; margin-bottom: 18px; border: 1px solid var(--border); }
.kpi-cell { background: #fff; padding: 14px 16px; }
.kpi-cell span { display: block; font-size: 11px; color: var(--muted); margin-bottom: 5px; }
.kpi-cell strong { font-size: 16px; font-variant-numeric: tabular-nums; }

/* ---------- Responsive ---------- */
@media (max-width: 1200px) {
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2, .grid-2.equal { grid-template-columns: 1fr; }
  .kpi-strip { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 900px) {
  :root { --sidebar-w: 0px; }
  .sidebar { width: 254px; transform: translateX(-100%); transition: transform var(--t); box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: none; }
  .sidebar-overlay.show { display: block; position: fixed; inset: 0; background: rgba(8,15,28,.5); z-index: 39; }
  .main-wrap { margin-left: 0; }
  .menu-btn { display: grid; }
  .topbar { padding: 0 18px; gap: 12px; }
  .page-content { padding: 22px 18px 40px; }
  .global-search { width: auto; flex: 1; }
  .today-chip { display: none; }
  .grid-3, .backup-grid { grid-template-columns: 1fr; }
  .order-summary-grid { grid-template-columns: 1fr; }
}
@media (max-width: 680px) {
  .login-shell { grid-template-columns: 1fr; min-height: 0; }
  .login-brand-panel { display: none; }
  .login-form-panel { padding: 38px 26px; }
  .login-mobile-brand { display: flex; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat-card { padding: 14px; }
  .stat-value { font-size: 20px; }
  .stat-label { font-size: 11px; }
  .page-head h1 { font-size: 20px; }
  .page-actions .btn { flex: 1; }
  .form-grid, .form-grid.three { grid-template-columns: 1fr; }
  .line-head, .variant-head, .order-line-head { display: none; }
  .line-row { grid-template-columns: 1fr 1fr; }
  .order-line { display: block; }
  .order-line-top, .order-line-bottom { grid-template-columns: 1fr 1fr; }
  .line-total-box { align-items: flex-start; padding-bottom: 0; }
  .line-row .line-total { grid-column: 1 / -1; padding-bottom: 0; text-align: left; }
  .variant-row { grid-template-columns: 1fr 1fr; }
  .variant-line-value { grid-column: 1 / -1; padding-bottom: 0; text-align: left; }
  .modal-backdrop { padding: 10px; align-items: flex-end; }
  .modal { max-height: 94vh; border-radius: 16px 16px 0 0; }
  .modal-body { padding: 16px; }
  .kpi-strip { grid-template-columns: repeat(2, 1fr); }
  .topbar-avatar { display: none; }
  .table-tools { padding: 12px; }
  .table-tools .select-field, .date-field { flex: 1; }
}
@media print {
  .sidebar, .topbar, .page-actions, .table-tools, .row-actions, .toast-root { display: none !important; }
  .main-wrap { margin: 0; }
  .page-content { padding: 0; }
  .card { border: 0; box-shadow: none; }
}
