:root {
  --navy-950: #07152f;
  --navy-900: #0b1e45;
  --navy-800: #102a5f;
  --blue-700: #0759dc;
  --blue-600: #0b68f0;
  --blue-500: #2680ff;
  --blue-100: #e8f1ff;
  --cyan-500: #00a7c4;
  --green-600: #07935c;
  --green-100: #e8f8f1;
  --amber-600: #b86e00;
  --amber-100: #fff4db;
  --red-600: #d03543;
  --red-100: #ffebee;
  --violet-600: #7047d7;
  --violet-100: #f0ebff;
  --slate-950: #13213a;
  --slate-800: #263651;
  --slate-700: #41516b;
  --slate-600: #5e6d84;
  --slate-500: #7c899d;
  --slate-400: #a5afbd;
  --slate-300: #cdd4de;
  --slate-200: #e2e7ed;
  --slate-100: #eff2f6;
  --slate-50: #f7f9fc;
  --white: #fff;
  --sidebar-width: 254px;
  --topbar-height: 72px;
  --shadow-sm: 0 2px 10px rgba(22, 43, 77, .06);
  --shadow-md: 0 18px 50px rgba(19, 42, 80, .14);
  --radius: 14px;
  --radius-sm: 10px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  background: var(--slate-50);
  color: var(--slate-950);
  font-family: "Cairo", Tahoma, Arial, sans-serif;
  font-size: 13px;
  line-height: 1.65;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .58; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--slate-200);
  border-radius: 10px;
  background: var(--white);
  color: var(--slate-950);
  outline: none;
  transition: border-color .16s ease, box-shadow .16s ease;
}
input, select { height: 43px; padding: 0 12px; }
textarea { min-height: 92px; resize: vertical; padding: 10px 12px; }
input:focus, select:focus, textarea:focus {
  border-color: var(--blue-500);
  box-shadow: 0 0 0 3px rgba(38, 128, 255, .12);
}
label { display: grid; gap: 6px; color: var(--slate-700); font-size: 11px; font-weight: 700; }
h1, h2, h3, p { margin-top: 0; }
.muted { color: var(--slate-500); }
.text-danger { color: var(--red-600) !important; }
.text-success { color: var(--green-600) !important; }
.number-ltr { direction: ltr; display: inline-block; font-variant-numeric: tabular-nums; }

.splash-screen {
  min-height: 100vh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 20px;
  background: radial-gradient(circle at 50% 35%, #fff 0, #f3f7ff 50%, #e8f0fc 100%);
}
.splash-screen img { width: 215px; height: auto; }
.splash-screen p { color: var(--slate-500); font-size: 12px; }
.splash-loader { width: 130px; height: 4px; overflow: hidden; border-radius: 99px; background: #d9e5f7; }
.splash-loader i { display: block; width: 45%; height: 100%; border-radius: inherit; background: var(--blue-600); animation: loading 1.1s infinite ease-in-out; }
@keyframes loading { from { transform: translateX(130px); } to { transform: translateX(-130px); } }

.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(460px, .9fr) minmax(520px, 1.1fr);
  background: var(--white);
}
.login-panel { display: grid; place-items: center; padding: 40px; }
.login-card { width: min(430px, 100%); }
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand img { display: block; width: 155px; max-height: 52px; object-fit: contain; object-position: right center; }
.brand .brand-tag {
  padding: 4px 9px;
  border: 1px solid #cfe0fb;
  border-radius: 7px;
  color: var(--blue-700);
  background: #f1f6ff;
  font-size: 10px;
  font-weight: 800;
}
.login-brand { display: grid; gap: 5px; margin-bottom: 50px; }
.login-brand small { color: var(--slate-500); font-size: 9px; }
.login-heading .eyebrow { display: inline-block; margin-bottom: 7px; color: var(--blue-600); font-size: 10px; font-weight: 800; }
.login-heading h1 { margin-bottom: 7px; font-size: clamp(27px, 3vw, 37px); line-height: 1.3; }
.login-heading p { margin-bottom: 28px; color: var(--slate-500); font-size: 11px; }
.login-form { display: grid; gap: 16px; }
.password-field { position: relative; }
.password-field button { position: absolute; left: 7px; bottom: 7px; height: 29px; padding: 0 8px; border: 0; border-radius: 7px; color: var(--slate-500); background: var(--slate-100); font-size: 9px; }
.login-options { display: flex; align-items: center; justify-content: space-between; }
.check-label { display: flex; grid-template-columns: auto 1fr; align-items: center; gap: 8px; }
.check-label input { width: 16px; height: 16px; accent-color: var(--blue-600); }
.text-button { padding: 0; border: 0; color: var(--blue-600); background: transparent; font-size: 10px; font-weight: 700; }
.demo-box {
  display: grid;
  gap: 3px;
  margin-top: 22px;
  padding: 13px 14px;
  border: 1px solid #d9e7fc;
  border-radius: 10px;
  background: #f7faff;
  color: var(--slate-600);
  font-size: 9px;
}
.demo-box b { color: var(--navy-800); }
.login-visual {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: 70px;
  color: white;
  background:
    radial-gradient(circle at 15% 20%, rgba(64, 137, 255, .43), transparent 33%),
    radial-gradient(circle at 83% 79%, rgba(51, 78, 190, .42), transparent 34%),
    linear-gradient(145deg, #0a2456 0%, #071633 55%, #0b1d45 100%);
}
.login-visual::before, .login-visual::after {
  content: "";
  position: absolute;
  width: 390px;
  height: 390px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 50%;
}
.login-visual::before { top: -140px; left: -100px; }
.login-visual::after { bottom: -180px; right: -80px; width: 520px; height: 520px; }
.login-visual-content { position: relative; z-index: 1; max-width: 550px; }
.visual-chip { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border: 1px solid rgba(255,255,255,.14); border-radius: 99px; background: rgba(255,255,255,.07); font-size: 10px; }
.login-visual h2 { margin: 25px 0 12px; font-size: clamp(40px, 5vw, 65px); line-height: 1.33; }
.login-visual p { max-width: 450px; color: rgba(255,255,255,.67); line-height: 2; font-size: 12px; }
.visual-features { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 38px; }
.visual-feature { padding: 15px; border: 1px solid rgba(255,255,255,.1); border-radius: 12px; background: rgba(255,255,255,.055); backdrop-filter: blur(6px); }
.visual-feature b { display: block; margin-bottom: 2px; color: #85b7ff; }
.visual-feature span { color: rgba(255,255,255,.62); font-size: 9px; }

.primary-button, .secondary-button, .danger-button, .ghost-button {
  min-height: 41px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 15px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
  text-decoration: none;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.primary-button { color: white; background: linear-gradient(135deg, var(--blue-600), #0756d8); box-shadow: 0 7px 18px rgba(11, 104, 240, .19); }
.primary-button:hover { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(11, 104, 240, .25); }
.secondary-button { border-color: var(--slate-200); color: var(--slate-700); background: var(--white); }
.secondary-button:hover { border-color: #bfd2ee; color: var(--blue-700); background: #f8fbff; }
.danger-button { border-color: #f4c6cb; color: var(--red-600); background: var(--red-100); }
.ghost-button { color: var(--slate-600); background: transparent; }
.button-sm { min-height: 32px; padding: 0 10px; border-radius: 8px; font-size: 9px; }
.icon-button {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid var(--slate-200);
  border-radius: 10px;
  color: var(--slate-600);
  background: var(--white);
}

.app-shell { min-height: 100vh; }
.sidebar {
  position: fixed;
  inset: 0 0 0 auto;
  z-index: 30;
  width: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  padding: 22px 14px 18px;
  color: white;
  background:
    radial-gradient(circle at 70% -10%, rgba(40, 116, 247, .25), transparent 28%),
    linear-gradient(180deg, var(--navy-900), var(--navy-950));
  box-shadow: -9px 0 30px rgba(5, 18, 42, .08);
}
.sidebar-header { display: flex; align-items: center; justify-content: space-between; padding: 2px 9px 23px; border-bottom: 1px solid rgba(255,255,255,.08); }
.sidebar .brand img { width: 137px; filter: brightness(0) invert(1); }
.sidebar .brand-tag { border-color: rgba(255,255,255,.15); color: #a9cfff; background: rgba(255,255,255,.07); }
.mobile-close { display: none; }
.sidebar-company { display: grid; grid-template-columns: 36px 1fr; align-items: center; gap: 10px; margin: 14px 6px 8px; padding: 10px; border-radius: 10px; background: rgba(255,255,255,.055); }
.company-avatar { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 9px; color: #a9ccff; background: rgba(63, 137, 255, .17); font-weight: 800; }
.sidebar-company b, .sidebar-company small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-company b { font-size: 9px; }
.sidebar-company small { display: block; color: rgba(255,255,255,.48); font-size: 7px; direction: ltr; text-align: right; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 5px 0; scrollbar-width: thin; }
.nav-section-label { display: block; padding: 14px 13px 6px; color: rgba(255,255,255,.32); font-size: 7px; font-weight: 800; letter-spacing: .6px; }
.nav-item {
  width: 100%;
  height: 44px;
  display: grid;
  grid-template-columns: 32px 1fr auto;
  align-items: center;
  gap: 8px;
  margin: 2px 0;
  padding: 0 9px;
  border: 0;
  border-radius: 9px;
  color: rgba(255,255,255,.65);
  background: transparent;
  text-align: right;
  font-size: 9px;
  font-weight: 700;
}
.nav-icon { width: 29px; height: 29px; display: grid; place-items: center; border-radius: 8px; background: rgba(255,255,255,.055); font-size: 13px; }
.nav-item:hover { color: white; background: rgba(255,255,255,.055); }
.nav-item.active { color: white; background: linear-gradient(90deg, rgba(29,112,247,.22), rgba(29,112,247,.1)); box-shadow: inset -3px 0 0 #3c8cff; }
.nav-item.active .nav-icon { color: #9bc5ff; background: rgba(54, 135, 255, .2); }
.nav-badge { min-width: 20px; height: 20px; display: grid; place-items: center; padding: 0 5px; border-radius: 99px; color: #ffc9ce; background: rgba(232, 69, 84, .18); font-size: 7px; }
.sidebar-footer { padding: 13px 5px 0; border-top: 1px solid rgba(255,255,255,.08); }
.sidebar-user { display: grid; grid-template-columns: 36px 1fr auto; align-items: center; gap: 8px; }
.sidebar-user .avatar { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; color: white; background: linear-gradient(135deg, #2e83ff, #6c49d8); font-size: 11px; font-weight: 800; }
.sidebar-user b { display: block; font-size: 8px; }
.sidebar-user small { display: block; color: rgba(255,255,255,.43); font-size: 7px; }
.sidebar-user button { border: 0; color: rgba(255,255,255,.5); background: transparent; font-size: 15px; }

.workspace { min-height: 100vh; margin-right: var(--sidebar-width); }
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 28px;
  border-bottom: 1px solid var(--slate-200);
  background: rgba(255,255,255,.94);
  backdrop-filter: blur(12px);
}
.topbar-title { display: flex; align-items: center; gap: 12px; }
.topbar-title small { display: block; color: var(--slate-400); font-size: 7px; direction: ltr; text-align: right; }
.topbar-title strong { display: block; font-size: 12px; }
.mobile-menu { display: none; }
.topbar-actions { display: flex; align-items: center; gap: 9px; }
.branch-chip { height: 38px; display: flex; align-items: center; gap: 8px; padding: 0 12px; border: 1px solid var(--slate-200); border-radius: 9px; color: var(--slate-600); background: var(--slate-50); font-size: 8px; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: #14b879; box-shadow: 0 0 0 4px rgba(20,184,121,.12); }
.content-area { max-width: 1600px; margin: auto; padding: 28px 28px 48px; }
.page-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.page-heading h1 { margin-bottom: 3px; font-size: 23px; line-height: 1.4; }
.page-heading p, .page-heading span { margin: 0; color: var(--slate-500); font-size: 9px; }
.heading-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.metrics-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 17px; }
.metric-card {
  position: relative;
  min-height: 138px;
  padding: 18px;
  overflow: hidden;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: var(--shadow-sm);
}
.metric-card::after { content: ""; position: absolute; width: 85px; height: 85px; left: -28px; top: -32px; border-radius: 50%; background: var(--metric-soft, var(--blue-100)); opacity: .55; }
.metric-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.metric-label { color: var(--slate-500); font-size: 9px; }
.metric-icon { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; color: var(--metric-color, var(--blue-600)); background: var(--metric-soft, var(--blue-100)); font-size: 15px; }
.metric-card strong { display: block; margin: 17px 0 3px; font-size: 21px; letter-spacing: -.3px; }
.metric-card small { color: var(--slate-400); font-size: 8px; }
.metric-card.green { --metric-color: var(--green-600); --metric-soft: var(--green-100); }
.metric-card.amber { --metric-color: var(--amber-600); --metric-soft: var(--amber-100); }
.metric-card.violet { --metric-color: var(--violet-600); --metric-soft: var(--violet-100); }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(320px, .75fr); gap: 16px; margin-bottom: 17px; }
.panel {
  border: 1px solid var(--slate-200);
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: var(--shadow-sm);
}
.panel-head { min-height: 67px; display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 14px 18px; border-bottom: 1px solid var(--slate-100); }
.panel-head h2 { margin: 1px 0 0; font-size: 13px; }
.eyebrow { color: var(--slate-400); font-size: 7px; font-weight: 800; }
.panel-body { padding: 18px; }
.chart {
  height: 220px;
  display: flex;
  align-items: end;
  gap: 12px;
  padding: 20px 12px 2px;
  background: repeating-linear-gradient(to top, transparent 0 43px, var(--slate-100) 44px);
}
.chart-column { flex: 1; min-width: 22px; display: grid; grid-template-rows: 1fr auto; align-items: end; gap: 7px; height: 100%; }
.chart-bar { width: min(44px, 76%); min-height: 4px; margin: 0 auto; border-radius: 7px 7px 2px 2px; background: linear-gradient(180deg, #3288ff, #0963ea); box-shadow: 0 7px 16px rgba(16,101,235,.16); }
.chart-column small { color: var(--slate-400); font-size: 7px; text-align: center; direction: ltr; }
.alert-list { display: grid; gap: 8px; }
.alert-item { display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 10px; padding: 9px; border-radius: 10px; background: var(--slate-50); }
.alert-item .icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 9px; color: var(--amber-600); background: var(--amber-100); }
.alert-item b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 8px; }
.alert-item small { display: block; color: var(--slate-400); font-size: 7px; }
.alert-item strong { color: var(--red-600); font-size: 11px; }
.empty-state { min-height: 180px; display: grid; place-content: center; justify-items: center; gap: 7px; padding: 30px; color: var(--slate-400); text-align: center; }
.empty-state .empty-icon { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 14px; color: var(--blue-600); background: var(--blue-100); font-size: 21px; }
.empty-state b { color: var(--slate-700); }

.toolbar { display: flex; align-items: center; gap: 9px; margin-bottom: 14px; }
.search-box { position: relative; width: min(390px, 100%); }
.search-box input { padding-right: 38px; background: var(--white); }
.search-box .search-icon { position: absolute; right: 13px; top: 50%; transform: translateY(-50%); color: var(--slate-400); }
.tabs { display: flex; gap: 4px; margin-bottom: 15px; padding: 4px; overflow-x: auto; border: 1px solid var(--slate-200); border-radius: 11px; background: var(--white); scrollbar-width: none; }
.tabs button { min-height: 36px; padding: 0 14px; border: 0; border-radius: 8px; color: var(--slate-500); background: transparent; font-size: 9px; font-weight: 700; white-space: nowrap; }
.tabs button.active { color: var(--blue-700); background: var(--blue-100); box-shadow: inset 0 0 0 1px #d4e4ff; }
.filter-row { display: grid; grid-template-columns: repeat(4, minmax(130px, 1fr)); gap: 10px; margin-bottom: 14px; padding: 13px; border: 1px solid var(--slate-200); border-radius: 11px; background: var(--white); }

.table-panel { overflow: hidden; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; white-space: nowrap; }
th, td { height: 54px; padding: 0 15px; border-bottom: 1px solid var(--slate-100); text-align: right; }
th { height: 43px; color: var(--slate-500); background: #fafbfd; font-size: 8px; font-weight: 800; }
td { color: var(--slate-700); font-size: 9px; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #fbfdff; }
.document-number { color: var(--blue-700); font-weight: 800; direction: ltr; display: inline-block; }
.cell-title { display: grid; }
.cell-title b { color: var(--slate-800); }
.cell-title small { color: var(--slate-400); font-size: 7px; }
.status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 64px;
  height: 25px;
  padding: 0 9px;
  border-radius: 99px;
  font-size: 7px;
  font-weight: 800;
}
.status.posted, .status.active, .status.paid { color: var(--green-600); background: var(--green-100); }
.status.draft, .status.partial { color: var(--amber-600); background: var(--amber-100); }
.status.cancelled, .status.inactive, .status.overdue { color: var(--red-600); background: var(--red-100); }
.status.info { color: var(--blue-700); background: var(--blue-100); }
.row-actions { display: flex; align-items: center; justify-content: flex-end; gap: 5px; }
.row-actions button { height: 30px; padding: 0 9px; border: 1px solid var(--slate-200); border-radius: 7px; color: var(--slate-600); background: white; font-size: 8px; }
.row-actions button:hover { color: var(--blue-700); border-color: #c9dcf8; }

.summary-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 14px; }
.summary-item { display: flex; align-items: center; gap: 10px; min-height: 75px; padding: 13px 15px; border: 1px solid var(--slate-200); border-radius: 11px; background: var(--white); }
.summary-item .icon { width: 37px; height: 37px; display: grid; place-items: center; border-radius: 10px; color: var(--blue-600); background: var(--blue-100); }
.summary-item span { color: var(--slate-500); font-size: 8px; }
.summary-item b { display: block; margin-top: 2px; color: var(--slate-900); font-size: 12px; }

.reports-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 13px; margin-bottom: 17px; }
.report-card { min-height: 142px; display: grid; align-content: space-between; padding: 17px; border: 1px solid var(--slate-200); border-radius: 13px; background: var(--white); box-shadow: var(--shadow-sm); }
.report-card .icon { width: 39px; height: 39px; display: grid; place-items: center; border-radius: 10px; color: var(--blue-700); background: var(--blue-100); font-size: 16px; }
.report-card h3 { margin: 13px 0 2px; font-size: 11px; }
.report-card p { margin: 0; color: var(--slate-500); font-size: 8px; }
.report-card button { justify-self: end; margin-top: 12px; border: 0; color: var(--blue-700); background: transparent; font-size: 8px; font-weight: 800; }
.report-output { margin-top: 16px; }

.settings-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(320px, .7fr); gap: 16px; }
.settings-stack { display: grid; gap: 16px; align-content: start; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.form-wide { grid-column: 1 / -1; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; padding-top: 15px; border-top: 1px solid var(--slate-100); }
.info-list { display: grid; gap: 9px; }
.info-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 10px 0; border-bottom: 1px solid var(--slate-100); }
.info-row:last-child { border-bottom: 0; }
.info-row span { color: var(--slate-500); font-size: 8px; }
.info-row b { font-size: 9px; }
.danger-zone { border-color: #f3cdd1; }
.danger-zone .panel-head { background: #fffafb; }
.backup-actions { display: grid; gap: 9px; }
.upload-label { cursor: pointer; }
.upload-label input { display: none; }
.integrity-result { margin-top: 10px; padding: 10px; border-radius: 9px; font-size: 8px; }
.integrity-result.ok { color: var(--green-600); background: var(--green-100); }
.integrity-result.bad { color: var(--red-600); background: var(--red-100); }

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 25px;
  background: rgba(4, 15, 37, .58);
  backdrop-filter: blur(4px);
  animation: fadeIn .16s ease;
}
.modal-card {
  width: min(720px, 100%);
  max-height: calc(100vh - 50px);
  overflow: auto;
  border-radius: 16px;
  background: var(--white);
  box-shadow: 0 30px 90px rgba(4, 20, 51, .3);
  animation: modalUp .2s ease;
}
.modal-card.modal-lg { width: min(1020px, 100%); }
.modal-card.modal-sm { width: min(480px, 100%); }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes modalUp { from { opacity: 0; transform: translateY(12px) scale(.985); } }
.modal-header { position: sticky; top: 0; z-index: 2; min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 14px 20px; border-bottom: 1px solid var(--slate-100); background: rgba(255,255,255,.96); backdrop-filter: blur(8px); }
.modal-header h2 { margin: 1px 0 0; font-size: 15px; }
.modal-body { padding: 20px; }
.modal-footer { position: sticky; bottom: 0; z-index: 2; display: flex; align-items: center; justify-content: flex-end; gap: 8px; min-height: 67px; padding: 12px 20px; border-top: 1px solid var(--slate-100); background: rgba(255,255,255,.97); backdrop-filter: blur(8px); }
.line-items { margin-top: 15px; border: 1px solid var(--slate-200); border-radius: 11px; overflow: hidden; }
.line-items-head, .line-item-row { min-width: 820px; display: grid; grid-template-columns: 2fr .65fr .9fr .8fr .75fr 34px; gap: 8px; align-items: center; padding: 8px; }
.line-items-head { color: var(--slate-500); background: var(--slate-50); font-size: 8px; font-weight: 800; }
.line-item-row { border-top: 1px solid var(--slate-100); }
.line-item-row input, .line-item-row select { height: 37px; font-size: 9px; }
.remove-line { width: 30px; height: 30px; border: 0; border-radius: 7px; color: var(--red-600); background: var(--red-100); }
.invoice-totals { width: min(410px, 100%); display: grid; gap: 7px; margin: 17px 0 0 auto; padding: 14px; border-radius: 11px; background: var(--slate-50); }
.invoice-totals span, .invoice-totals strong { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.invoice-totals span { color: var(--slate-500); font-size: 8px; }
.invoice-totals strong { padding-top: 8px; border-top: 1px solid var(--slate-200); font-size: 11px; }
.document-view-header { display: flex; justify-content: space-between; gap: 20px; margin-bottom: 17px; padding: 17px; border-radius: 11px; color: white; background: linear-gradient(135deg, var(--navy-900), #143b7c); }
.document-view-header h3 { margin-bottom: 2px; font-size: 17px; direction: ltr; text-align: right; }
.document-view-header span { color: rgba(255,255,255,.6); font-size: 8px; }
.document-view-header .amount { text-align: left; }
.document-view-header .amount strong { display: block; font-size: 19px; }
.document-info-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 15px; }
.document-info-grid div { padding: 11px; border: 1px solid var(--slate-200); border-radius: 9px; }
.document-info-grid span { display: block; color: var(--slate-500); font-size: 7px; }
.document-info-grid b { font-size: 9px; }

#toast-root { position: fixed; top: 18px; left: 18px; z-index: 200; display: grid; gap: 8px; width: min(360px, calc(100vw - 36px)); }
.toast { display: grid; grid-template-columns: 30px 1fr auto; align-items: center; gap: 9px; padding: 12px; border: 1px solid var(--slate-200); border-radius: 11px; background: white; box-shadow: var(--shadow-md); animation: toastIn .25s ease; }
@keyframes toastIn { from { opacity: 0; transform: translateX(-15px); } }
.toast .toast-icon { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 8px; }
.toast.success .toast-icon { color: var(--green-600); background: var(--green-100); }
.toast.error .toast-icon { color: var(--red-600); background: var(--red-100); }
.toast.info .toast-icon { color: var(--blue-600); background: var(--blue-100); }
.toast b { display: block; font-size: 9px; }
.toast span { display: block; color: var(--slate-500); font-size: 8px; }
.toast button { border: 0; color: var(--slate-400); background: transparent; }

.loading-block { min-height: 320px; display: grid; place-content: center; justify-items: center; gap: 12px; color: var(--slate-400); }
.spinner { width: 34px; height: 34px; border: 3px solid #dce7f8; border-top-color: var(--blue-600); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.sidebar-scrim { display: none; }

@media print {
  body { background: white; }
  .sidebar, .topbar, .page-heading, .toolbar, .tabs, .modal-footer, #toast-root { display: none !important; }
  .workspace { margin: 0; }
  .content-area { padding: 0; }
  .panel { border: 0; box-shadow: none; }
}

@media (max-width: 1180px) {
  .metrics-grid { grid-template-columns: repeat(2, 1fr); }
  .summary-strip { grid-template-columns: repeat(2, 1fr); }
  .reports-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 960px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-visual { display: none; }
  .sidebar { transform: translateX(105%); transition: transform .22s ease; }
  .sidebar.open { transform: translateX(0); }
  .sidebar-scrim { position: fixed; inset: 0; z-index: 29; display: block; border: 0; background: rgba(5,19,48,.53); }
  .mobile-close { width: 32px; height: 32px; display: grid; place-items: center; border: 0; border-radius: 8px; color: white; background: rgba(255,255,255,.09); }
  .workspace { margin-right: 0; }
  .mobile-menu { width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid var(--slate-200); border-radius: 9px; color: var(--slate-700); background: white; }
  .dashboard-grid, .settings-grid { grid-template-columns: 1fr; }
  .filter-row { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 680px) {
  body { font-size: 12px; }
  .login-panel { padding: 24px; }
  .login-brand { margin-bottom: 34px; }
  .topbar { height: 66px; padding: 0 14px; }
  .branch-chip span { display: none; }
  .content-area { padding: 20px 13px 36px; }
  .page-heading { align-items: flex-start; }
  .page-heading h1 { font-size: 19px; }
  .heading-actions { justify-content: flex-end; }
  .metrics-grid, .summary-strip, .reports-grid { grid-template-columns: 1fr; }
  .metric-card { min-height: 126px; }
  .toolbar { flex-wrap: wrap; }
  .search-box { flex: 1 0 100%; width: 100%; }
  .filter-row { grid-template-columns: 1fr; }
  .form-grid, .document-info-grid { grid-template-columns: 1fr; }
  .form-wide { grid-column: auto; }
  .modal-backdrop { padding: 0; place-items: end center; }
  .modal-card, .modal-card.modal-lg, .modal-card.modal-sm { width: 100%; max-height: 94vh; border-radius: 16px 16px 0 0; }
  .modal-body { padding: 16px; }
  .document-view-header { display: grid; }
  .document-view-header .amount { text-align: right; }
  #toast-root { top: 10px; left: 10px; width: calc(100vw - 20px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* Online demo indicators */
.demo-chip {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  background: #fff3cd;
  color: #7a4d00;
  border: 1px solid #f2d98a;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.demo-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 24px;
  background: #fff8e5;
  color: #5f4300;
  border-bottom: 1px solid #f0d991;
  font-size: 13px;
}

.demo-banner b { white-space: nowrap; }
.demo-banner span { line-height: 1.65; }
.disabled-control { opacity: .55; cursor: not-allowed; pointer-events: none; }
button:disabled { opacity: .55; cursor: not-allowed; }

@media (max-width: 700px) {
  .demo-banner { align-items: flex-start; padding: 9px 14px; flex-direction: column; gap: 2px; }
  .demo-chip { display: none; }
}


/* Readability upgrade for the online sales demo */
:root { --sidebar-width: 272px; }
body { font-size: 15px; }
label { font-size: 13px; }
input, select, textarea { font-size: 14px; }
.login-brand small, .login-heading .eyebrow { font-size: 12px; }
.login-heading p, .login-visual p { font-size: 14px; }
.password-field button, .demo-box, .visual-feature span { font-size: 12px; }
.text-button, .visual-chip { font-size: 13px; }
.primary-button, .secondary-button, .danger-button, .ghost-button { min-height: 44px; font-size: 13px; }
.button-sm { min-height: 35px; font-size: 12px; }
.sidebar-company b { font-size: 12px; }
.sidebar-company small { font-size: 10px; }
.nav-section-label { font-size: 10px; }
.nav-item { height: 46px; font-size: 12px; }
.nav-badge { font-size: 10px; }
.sidebar-user b { font-size: 11px; }
.sidebar-user small { font-size: 10px; }
.topbar-title small { font-size: 10px; }
.topbar-title strong { font-size: 15px; }
.branch-chip { font-size: 11px; }
.page-heading h1 { font-size: 27px; }
.page-heading p, .page-heading span { font-size: 12px; }
.metric-label { font-size: 12px; }
.metric-card strong { font-size: 24px; }
.metric-card small { font-size: 11px; }
.panel-head h2 { font-size: 16px; }
.eyebrow { font-size: 10px; }
.chart-column small { font-size: 10px; }
.alert-item b { font-size: 11px; }
.alert-item small { font-size: 10px; }
.alert-item strong { font-size: 14px; }
.tabs button { min-height: 40px; font-size: 12px; }
th { font-size: 11px; }
td { font-size: 12px; }
.cell-title small { font-size: 10px; }
.status { font-size: 10px; }
.row-actions button { font-size: 11px; }
.summary-item span { font-size: 11px; }
.summary-item b { font-size: 15px; }
.report-card h3 { font-size: 14px; }
.report-card p, .report-card button { font-size: 11px; }
.info-row span { font-size: 11px; }
.info-row b { font-size: 12px; }
.integrity-result { font-size: 11px; }
.modal-header h2 { font-size: 19px; }
.line-items-head { font-size: 11px; }
.line-item-row input, .line-item-row select { font-size: 12px; }
.invoice-totals span { font-size: 11px; }
.invoice-totals strong { font-size: 15px; }
.document-view-header span { font-size: 11px; }
.document-info-grid span { font-size: 10px; }
.document-info-grid b { font-size: 12px; }
.toast b { font-size: 12px; }
.toast span { font-size: 11px; }

.demo-tour {
  display: grid;
  grid-template-columns: minmax(260px, .8fr) minmax(560px, 1.7fr);
  gap: 18px;
  align-items: center;
  margin-bottom: 18px;
  padding: 18px;
  border: 1px solid #d8e5f8;
  border-radius: var(--radius);
  background: linear-gradient(135deg, #ffffff 0%, #f3f7ff 100%);
  box-shadow: var(--shadow-sm);
}
.demo-tour-intro h2 { margin: 3px 0 5px; font-size: 18px; }
.demo-tour-intro p { margin: 0; color: var(--slate-500); font-size: 12px; }
.demo-tour-steps { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.demo-tour-steps button {
  min-width: 0;
  min-height: 76px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px;
  border: 1px solid var(--slate-200);
  border-radius: 11px;
  color: var(--slate-800);
  background: var(--white);
  text-align: right;
}
.demo-tour-steps button:hover { border-color: #a9c9f6; background: #f8fbff; transform: translateY(-1px); }
.demo-tour-steps button > b {
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: var(--blue-700);
  background: var(--blue-100);
  font-size: 12px;
}
.demo-tour-steps span { min-width: 0; font-size: 12px; font-weight: 800; }
.demo-tour-steps small { display: block; margin-top: 2px; color: var(--slate-500); font-size: 9px; font-weight: 600; line-height: 1.5; }

@media (max-width: 1180px) {
  .demo-tour { grid-template-columns: 1fr; }
  .demo-tour-steps { grid-template-columns: repeat(5, minmax(125px, 1fr)); overflow-x: auto; padding-bottom: 4px; }
}
@media (max-width: 680px) {
  body { font-size: 14px; }
  .page-heading h1 { font-size: 22px; }
  .demo-tour { padding: 14px; }
  .demo-tour-steps { grid-template-columns: repeat(5, 150px); }
}

/* Final branding and demo header polish */
.login-brand .brand img{width:64px;max-height:64px;object-fit:contain;object-position:center}
.login-brand .brand{gap:10px}
.sidebar .brand{align-items:center;gap:10px}
.sidebar .brand img{width:58px;height:58px;max-height:58px;object-fit:contain;object-position:center;filter:none}
.branches-group{display:flex;align-items:center;gap:8px;flex-wrap:wrap;justify-content:flex-end}
.branch-chip{min-height:38px;padding:0 12px;font-weight:700}
@media (max-width:980px){.topbar-actions{justify-content:flex-end}.branches-group{max-width:100%;row-gap:6px}}
@media (max-width:700px){.branches-group{display:none}}
