/* Om Enterprises LPG — Premium navy / slate / blue design system */

/* Local INR glyph (U+20B9) — self-hosted so ₹ renders when system fonts lack it */
@font-face {
  font-family: "Noto Sans INR";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/fonts/noto-sans-inr-400.ttf") format("truetype");
  unicode-range: U+20B9;
}
@font-face {
  font-family: "Noto Sans INR";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/assets/fonts/noto-sans-inr-700.ttf") format("truetype");
  unicode-range: U+20B9;
}
@font-face {
  font-family: "Noto Sans INR";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/assets/fonts/noto-sans-inr-700.ttf") format("truetype");
  unicode-range: U+20B9;
}
@font-face {
  font-family: "Noto Sans INR";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/assets/fonts/noto-sans-inr-700.ttf") format("truetype");
  unicode-range: U+20B9;
}

:root {
  --navy-950: #0b1220;
  --navy-900: #111827;
  --navy-800: #1e293b;
  --navy-700: #334155;
  --slate-600: #475569;
  --slate-500: #64748b;
  --slate-400: #94a3b8;
  --slate-200: #e2e8f0;
  --slate-100: #f1f5f9;
  --slate-50: #f8fafc;
  --blue-700: #1d4ed8;
  --blue-600: #2563eb;
  --blue-500: #3b82f6;
  --blue-100: #dbeafe;
  --blue-50: #eff6ff;
  --ok: #15803d;
  --ok-bg: #ecfdf5;
  --warn: #b45309;
  --warn-bg: #fffbeb;
  --danger: #b91c1c;
  --danger-bg: #fef2f2;

  --bg: var(--slate-50);
  --ink: #0f172a;
  --muted: var(--slate-500);
  --line: var(--slate-200);
  --accent: var(--blue-600);
  --accent-ink: #fff;
  --card: #ffffff;
  --edit: #fffbeb;
  --sidebar-w: 260px;
  --sidebar-collapsed-w: 76px;
  --topbar-h: 56px;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 1px 3px rgba(15, 23, 42, 0.06);
  /* Noto Sans INR provides ₹ (U+20B9) on clients missing that glyph */
  --font: "Noto Sans INR", "IBM Plex Sans", "Noto Sans", "Segoe UI", "Segoe UI Symbol", "Arial Unicode MS", system-ui, sans-serif;
  --font-inr: "Noto Sans INR", "Noto Sans", "IBM Plex Sans", "Segoe UI Symbol", "Segoe UI", "Arial Unicode MS", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
/* Ensure Indian Rupee ₹ renders (glyph missing in some fallback fonts) */
.num,
.value,
.stat-card .value,
.data-table,
.form-grid label,
.kpi-grid {
  font-family: var(--font-inr);
}
body.no-scroll { overflow: hidden; }
a { color: var(--blue-600); text-decoration: none; }
a:hover { color: var(--blue-700); }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.mt { margin-top: 1rem; }
.inline { display: inline; margin: 0; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ——— App shell ——— */
.app-body { min-height: 100vh; background: var(--bg); }
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
  transition: grid-template-columns 0.2s ease;
}
.app-shell.sidebar-collapsed {
  --sidebar-w: var(--sidebar-collapsed-w);
}
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 40;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, var(--navy-900) 0%, var(--navy-950) 100%);
  color: #e2e8f0;
  border-right: 1px solid rgba(148, 163, 184, 0.12);
  z-index: 50;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 1.1rem 0.85rem 1rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
  position: relative;
}
.sidebar-collapse-btn {
  margin-left: auto;
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 7px;
  background: rgba(148, 163, 184, 0.08);
  color: #cbd5e1;
  cursor: pointer;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 650;
  letter-spacing: -0.06em;
  line-height: 1;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.sidebar-collapse-btn:hover {
  background: rgba(37, 99, 235, 0.22);
  border-color: rgba(96, 165, 250, 0.45);
  color: #fff;
}
.sidebar-collapse-btn:focus-visible {
  outline: 2px solid var(--blue-500);
  outline-offset: 2px;
}
.collapse-glyph-out { display: none; }
.app-shell.sidebar-collapsed .collapse-glyph-in { display: none; }
.app-shell.sidebar-collapsed .collapse-glyph-out { display: inline; }
.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--blue-600);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}
.brand-text { display: grid; gap: 0.1rem; min-width: 0; }
.brand-text strong {
  font-size: 0.92rem;
  font-weight: 650;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.brand-text span {
  font-size: 0.72rem;
  color: var(--slate-400);
}

.sidebar-nav {
  flex: 1;
  overflow: auto;
  padding: 0.85rem 0.7rem 1rem;
}
.nav-section { margin-bottom: 1rem; }
.nav-section-label {
  font-size: 0.68rem;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--slate-400);
  padding: 0.35rem 0.7rem 0.45rem;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.7rem;
  border-radius: var(--radius-sm);
  color: #cbd5e1;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 0.15rem;
  transition: background 0.15s ease, color 0.15s ease;
}
.nav-link:hover {
  background: rgba(148, 163, 184, 0.12);
  color: #fff;
}
.nav-link.is-active {
  background: rgba(37, 99, 235, 0.22);
  color: #fff;
  box-shadow: inset 3px 0 0 var(--blue-500);
}
.nav-ico {
  display: inline-grid;
  place-items: center;
  width: 20px;
  opacity: 0.9;
  flex-shrink: 0;
}
.nav-link.compact {
  display: inline-flex;
  padding: 0.35rem 0.55rem;
  font-size: 0.8rem;
}

.sidebar-footer {
  padding: 0.85rem 1rem 1rem;
  border-top: 1px solid rgba(148, 163, 184, 0.12);
}
.sidebar-user-name { font-size: 0.88rem; font-weight: 600; color: #fff; }
.sidebar-user-role { font-size: 0.75rem; color: var(--slate-400); margin-top: 0.1rem; }
.sidebar-footer-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.65rem;
  flex-wrap: wrap;
}
.btn-logout {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: transparent;
  border: 1px solid rgba(148, 163, 184, 0.28);
  color: #e2e8f0;
  border-radius: 6px;
  padding: 0.3rem 0.55rem;
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
}
.btn-logout:hover { background: rgba(185, 28, 28, 0.2); border-color: rgba(248, 113, 113, 0.45); }
.btn-logout .logout-ico { display: none; }

/* ——— Desktop collapsed sidebar ——— */
.app-shell.sidebar-collapsed .brand-text,
.app-shell.sidebar-collapsed .nav-section-label,
.app-shell.sidebar-collapsed .sidebar-user,
.app-shell.sidebar-collapsed .nav-link > span:not(.nav-ico),
.app-shell.sidebar-collapsed .btn-logout .nav-label {
  display: none;
}
.app-shell.sidebar-collapsed .sidebar-brand {
  flex-direction: column;
  align-items: center;
  gap: 0.55rem;
  padding: 0.9rem 0.45rem;
}
.app-shell.sidebar-collapsed .sidebar-collapse-btn {
  margin-left: 0;
}
.app-shell.sidebar-collapsed .sidebar-nav {
  padding: 0.65rem 0.4rem 1rem;
}
.app-shell.sidebar-collapsed .nav-link {
  justify-content: center;
  padding: 0.65rem 0.35rem;
  gap: 0;
}
.app-shell.sidebar-collapsed .nav-link.is-active {
  box-shadow: inset 3px 0 0 var(--blue-500);
}
.app-shell.sidebar-collapsed .nav-link.compact {
  width: 100%;
  justify-content: center;
  padding: 0.55rem 0.35rem;
}
.app-shell.sidebar-collapsed .sidebar-footer {
  padding: 0.65rem 0.4rem 0.85rem;
}
.app-shell.sidebar-collapsed .sidebar-footer-actions {
  flex-direction: column;
  align-items: stretch;
  margin-top: 0;
  gap: 0.35rem;
}
.app-shell.sidebar-collapsed .btn-logout {
  width: 100%;
  justify-content: center;
  padding: 0.55rem 0.35rem;
}
.app-shell.sidebar-collapsed .btn-logout .logout-ico {
  display: inline-grid;
}
.app-shell.sidebar-collapsed .logout-form {
  display: block;
  width: 100%;
}

.app-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0 1.15rem;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.sidebar-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--navy-800);
  cursor: pointer;
}
.topbar-title { flex: 1; min-width: 0; }
.topbar-title h1 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 650;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar-user {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.2;
}
.topbar-user-name { font-size: 0.85rem; font-weight: 600; color: var(--ink); }
.topbar-user-role { font-size: 0.72rem; color: var(--muted); }

.page {
  padding: 1.25rem 1.35rem 2rem;
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
}
.page-register {
  max-width: none;
  padding: 1rem 1.1rem 1.5rem;
}

.flash {
  margin: 0.85rem 1.25rem 0;
  padding: 0.7rem 0.9rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 0.9rem;
}
.flash.ok { background: var(--ok-bg); color: var(--ok); border-color: #bbf7d0; }
.flash.err { background: var(--danger-bg); color: var(--danger); border-color: #fecaca; }

/* ——— Buttons ——— */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  background: var(--blue-600);
  color: #fff;
  border: 1px solid transparent;
  padding: 0.55rem 1rem;
  min-height: 38px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-decoration: none;
  font: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}
.btn:hover { background: var(--blue-700); color: #fff; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-muted {
  background: #fff;
  color: var(--navy-800);
  border-color: var(--line);
}
.btn-muted:hover { background: var(--slate-100); color: var(--navy-900); }
.btn-sm { min-height: 32px; padding: 0.3rem 0.7rem; font-size: 0.82rem; }
.btn-link {
  background: none;
  border: 0;
  color: var(--blue-600);
  cursor: pointer;
  text-decoration: underline;
  font: inherit;
  padding: 0;
}
.btn-danger-link { color: #b91c1c; }
.actions-cell {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 0.85rem;
  align-items: center;
}
.actions-cell .inline-form { display: inline; margin: 0; }

/* ——— Cards / panels ——— */
.hero-panel,
.panel-block,
.stat-card,
.form-grid {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.hero-panel { padding: 1.25rem 1.35rem; }
.hero-panel h1 { margin: 0 0 0.35rem; font-size: 1.25rem; font-weight: 650; }
.panel-block { padding: 1.1rem 1.2rem; }
.panel-block h2 { margin: 0 0 0.85rem; font-size: 1rem; font-weight: 650; }
.panel-block .form-grid { margin: 0; border: 0; padding: 0; box-shadow: none; }

.page-head {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 1rem;
}
.page-head h1 {
  margin: 0;
  flex: 1;
  font-size: 1.25rem;
  font-weight: 650;
}
.page-head-actions {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}
.import-panel {
  margin: 0 0 1rem;
  padding: 1rem 1.1rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.import-panel h2 {
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
  font-weight: 650;
}
.import-panel .import-form {
  margin-top: 0.75rem;
}
.import-errors ul {
  margin: 0.4rem 0 0;
  padding-left: 1.15rem;
}
.flash.warn {
  background: var(--warn-bg);
  color: var(--warn);
  border: 1px solid #fde68a;
}
/* Avoid double page titles when shell topbar already shows title */
.app-main .page > .page-head > h1,
.app-main .page > .hero-panel > h1,
.app-main .page .register-toolbar > h1 {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.app-main .page > .page-head {
  justify-content: flex-end;
}

.stat-row, .kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 0.85rem;
  margin: 1rem 0;
}
.stat-card { padding: 1rem 1.05rem; }
.stat-card .label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--muted);
}
.stat-card .value {
  font-size: 1.25rem;
  font-weight: 700;
  margin-top: 0.35rem;
  color: var(--ink);
  letter-spacing: -0.02em;
}

.filters { display: flex; gap: 0.5rem; flex-wrap: wrap; margin: 1rem 0; }
.filters input, .filters select {
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font: inherit;
  background: #fff;
  min-height: 38px;
}

/* ——— Tables ——— */
.table-scroll {
  overflow: auto;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  max-height: 70vh;
  -webkit-overflow-scrolling: touch;
}
.data-table {
  border-collapse: collapse;
  width: 100%;
  background: #fff;
  font-size: 0.9rem;
}
.data-table th, .data-table td {
  border-bottom: 1px solid var(--line);
  padding: 0.65rem 0.75rem;
  text-align: left;
}
.data-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--slate-100);
  color: var(--navy-800);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.data-table tbody tr:hover { background: var(--slate-50); }
.data-table.compact td, .data-table.compact th { padding: 0.4rem 0.55rem; font-size: 0.85rem; }

/* ——— Forms ——— */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.9rem;
  padding: 1.1rem;
  margin: 1rem 0;
}
.form-grid label { display: grid; gap: 0.35rem; font-size: 0.875rem; font-weight: 550; color: var(--navy-800); }
.password-field {
  position: relative;
  display: block;
}
.password-field input {
  width: 100%;
  padding-right: 2.6rem !important;
  box-sizing: border-box;
}
.password-toggle {
  position: absolute;
  right: 0.35rem;
  top: 50%;
  transform: translateY(-50%);
  width: 2rem;
  height: 2rem;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--slate-600, #475569);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.password-toggle:hover {
  color: var(--navy-800, #1e293b);
  background: var(--slate-100, #f1f5f9);
}
.password-toggle svg {
  width: 1.15rem;
  height: 1.15rem;
  display: block;
}

.form-grid input:not([type="checkbox"]):not([type="radio"]),
.form-grid select,
.form-grid textarea {
  padding: 0.55rem 0.65rem;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font: inherit;
  font-weight: 400;
  background: #fff;
  color: var(--ink);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.form-grid textarea { min-height: 80px; }
.form-grid input:not([type="checkbox"]):not([type="radio"]):focus,
.form-grid select:focus,
.form-grid textarea:focus {
  outline: none;
  border-color: var(--blue-500);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
.form-grid input[type="checkbox"],
.form-grid input[type="radio"] {
  width: 1.05rem;
  height: 1.05rem;
  min-height: 0;
  margin: 0;
  padding: 0;
  flex-shrink: 0;
  accent-color: var(--blue-500);
  cursor: pointer;
}
.form-grid .full { grid-column: 1 / -1; }
.form-grid fieldset {
  border: 1px dashed var(--line);
  padding: 0.85rem;
  border-radius: var(--radius-sm);
  margin: 0;
}
.actions { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; }
.checkbox-label {
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9rem;
  font-weight: 500;
}
.panels { display: grid; gap: 1rem; margin-top: 1rem; }
.panels section {
  background: var(--card);
  border: 1px solid var(--line);
  padding: 1rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.panels h2 { margin: 0 0 0.55rem; font-size: 1rem; }

/* ——— Auth ——— */
.auth-body {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 1.25rem;
  background:
    radial-gradient(circle at 15% 20%, rgba(37, 99, 235, 0.12), transparent 42%),
    radial-gradient(circle at 85% 10%, rgba(15, 23, 42, 0.08), transparent 40%),
    var(--slate-100);
}
.auth-card {
  width: min(400px, 100%);
  background: var(--card);
  border: 1px solid var(--line);
  padding: 1.85rem 1.6rem;
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}
.auth-brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 0.35rem;
}
.auth-brand .brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--blue-600);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 700;
}
.auth-card h1 { margin: 0 0 0.15rem; font-size: 1.25rem; font-weight: 700; color: var(--navy-900); }
.dash-hero {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
}
.dash-hero-copy { flex: 1; min-width: min(280px, 100%); }
.dash-hero-actions { flex-shrink: 0; }
.perm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.55rem 1rem;
}
.perm-item {
  align-items: flex-start !important;
  padding: 0.35rem 0;
}
.perm-item input { margin-top: 0.2rem; }
.role-col-matrix { width: 100%; }
.role-col-matrix th:nth-child(2),
.role-col-matrix th:nth-child(3),
.role-col-matrix td:nth-child(2),
.role-col-matrix td:nth-child(3) {
  width: 5.5rem;
  text-align: center;
}
.role-col-matrix input[type="checkbox"] {
  width: 1.05rem;
  height: 1.05rem;
  cursor: pointer;
}
.stack { display: grid; gap: 0.95rem; margin-top: 1.15rem; }
.stack label { display: grid; gap: 0.35rem; font-size: 0.9rem; font-weight: 550; }
.stack input {
  padding: 0.6rem 0.7rem;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font: inherit;
}
.stack input:focus {
  outline: none;
  border-color: var(--blue-500);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
.auth-card .flash { margin: 0.85rem 0 0; }

/* ——— Daily Register ——— */
/* ——— Daily Register (Excel Worksheet clone) ——— */
.register-shell { min-width: 0; }
.register-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: end;
  margin-bottom: 0.55rem;
  padding: 0.55rem 0.7rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: visible;
  position: relative;
  z-index: 30;
}
.columns-picker {
  position: relative;
  align-self: end;
  z-index: 50;
}
.columns-picker-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 34px;
}
.columns-picker-toggle .columns-ico {
  width: 1rem;
  height: 1rem;
  flex: 0 0 auto;
  color: var(--blue-600);
}
.columns-picker-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 220px;
  max-height: min(70vh, 420px);
  overflow: auto;
  padding: 0.35rem 0;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
  z-index: 60;
}
.columns-picker-item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.4rem 0.75rem;
  margin: 0;
  font-size: 0.86rem;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
  user-select: none;
}
.columns-picker-item:hover { background: var(--blue-50); }
.columns-picker-item.is-locked {
  color: var(--slate-500);
  cursor: default;
}
.columns-picker-item.is-locked:hover { background: transparent; }
.columns-picker-item input {
  width: 1rem;
  height: 1rem;
  accent-color: var(--blue-600);
  flex: 0 0 auto;
  cursor: pointer;
}
.columns-picker-item.is-locked input { cursor: default; }
.register-table.excel-grid col.col-user-hidden,
.register-table.excel-grid th.col-user-hidden,
.register-table.excel-grid td.col-user-hidden {
  display: none !important;
}
.date-field, .search-wrap { display: grid; gap: 0.2rem; font-size: 0.75rem; font-weight: 600; color: var(--slate-600); }
.search-wrap { position: relative; min-width: min(260px, 100%); flex: 1; overflow: visible; z-index: 40; }
.search-wrap input, .date-field input {
  padding: 0.4rem 0.55rem;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 4px;
  font: inherit;
  font-weight: 400;
  background: #fff;
}
.search-wrap input:focus, .date-field input:focus {
  outline: none;
  border-color: var(--blue-500);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.12);
}
.type-toggle {
  display: inline-flex;
  align-items: stretch;
  align-self: end;
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
  background: #fff;
}
.type-toggle .type-btn {
  border: 0;
  border-radius: 0;
  min-height: 34px;
  box-shadow: none;
  background: #fff;
  color: var(--slate-600);
  font-weight: 600;
  padding: 0.35rem 0.7rem;
}
.type-toggle .type-btn + .type-btn {
  border-left: 1px solid var(--line);
}
.type-toggle .type-btn.is-active {
  background: var(--blue-600, #2563eb);
  color: #fff;
}
.autocomplete {
  position: absolute;
  z-index: 100;
  top: calc(100% + 2px);
  left: 0;
  right: 0;
  margin: 0;
  padding: 0.2rem 0;
  list-style: none;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px;
  box-shadow: var(--shadow);
  max-height: 260px;
  overflow: auto;
}
.autocomplete li {
  padding: 0.45rem 0.65rem;
  cursor: pointer;
  border-bottom: 1px solid var(--slate-100);
  font-size: 0.88rem;
}
.autocomplete li:hover, .autocomplete li.active { background: var(--blue-50); }
.btn-clear {
  position: absolute;
  right: 0.35rem;
  top: 1.35rem;
  border: 0;
  background: transparent;
  cursor: pointer;
  font-size: 1.05rem;
  color: var(--muted);
}

.excel-sheet-frame {
  border: 1px solid #b0b0b0;
  background: #fff;
  box-shadow: none;
  border-radius: 0;
  overflow: hidden;
}
.excel-sheet-title {
  display: none;
  text-align: center;
  font-family: Calibri, 'Segoe UI', Arial, sans-serif;
  font-size: 16px;
  font-weight: 700;
  padding: 6px 8px;
  border-bottom: 1px solid #b0b0b0;
  background: #fff;
  color: #000;
}
.excel-sheet-title.is-visible { display: block; }

.register-scroll {
  max-height: calc(100vh - 210px);
  overflow: auto;
  background: #fff;
  border-radius: 0;
  box-shadow: none;
  -webkit-overflow-scrolling: touch;
}
.register-table.excel-grid {
  border-collapse: separate;
  border-spacing: 0;
  width: max-content;
  min-width: 100%;
  font-family: "Noto Sans INR", "IBM Plex Sans", "Noto Sans", "Segoe UI", sans-serif;
  font-size: 14px;
  font-weight: 400;
  background: #fff;
  color: #000;
  table-layout: fixed;
}
.register-table.excel-grid th,
.register-table.excel-grid td {
  border-right: 1px solid #000;
  border-bottom: 1px solid #000;
  padding: 0;
  white-space: nowrap;
  height: 28px;
  max-height: 28px;
  vertical-align: middle;
  overflow: hidden;
  text-overflow: ellipsis;
  box-sizing: border-box;
}
.register-table.excel-grid thead th {
  position: sticky;
  top: 0;
  /* Excel header fill FFF0815E */
  background: #F0815E;
  color: #000;
  z-index: 5;
  padding: 3px 4px;
  font-weight: 700;
  font-size: 12px;
  text-align: center;
  letter-spacing: 0;
  line-height: 1.2;
  white-space: normal;
  height: auto;
  min-height: 36px;
  vertical-align: middle;
  border-top: 2px solid #000;
  border-bottom: 2px solid #000;
}
.register-table.excel-grid thead th .th-label {
  display: block;
}
.register-table.excel-grid thead th .col-perm-btns {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  margin-top: 2px;
}
.register-table.excel-grid thead th .col-eye,
.register-table.excel-grid thead th .col-edit-perm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.35rem;
  height: 1.35rem;
  padding: 0;
  border: 0;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.35);
  color: #1e293b;
  cursor: pointer;
  vertical-align: middle;
}
.register-table.excel-grid thead th .col-eye:hover,
.register-table.excel-grid thead th .col-edit-perm:hover {
  background: rgba(255, 255, 255, 0.7);
}
.register-table.excel-grid thead th .col-eye svg,
.register-table.excel-grid thead th .col-edit-perm svg {
  width: 0.95rem;
  height: 0.95rem;
  display: block;
}
.register-table.excel-grid thead th .col-eye .eye-off { display: none; }
.register-table.excel-grid thead th .col-eye.is-hidden .eye-on { display: none; }
.register-table.excel-grid thead th .col-eye.is-hidden .eye-off { display: block; }
.register-table.excel-grid thead th .col-eye.is-hidden {
  color: #7f1d1d;
  background: rgba(254, 226, 226, 0.85);
}
.register-table.excel-grid thead th .col-edit-perm .edit-off { display: none; }
.register-table.excel-grid thead th .col-edit-perm.is-locked .edit-on { display: none; }
.register-table.excel-grid thead th .col-edit-perm.is-locked .edit-off { display: block; }
.register-table.excel-grid thead th .col-edit-perm.is-editable {
  color: #166534;
  background: rgba(220, 252, 231, 0.9);
}
.register-table.excel-grid thead th .col-edit-perm.is-locked {
  color: #7f1d1d;
  background: rgba(254, 226, 226, 0.85);
}

/* Compact layout for Manager / Employee / Delivery Boy (Owner & Super Admin unchanged) */
.excel-register.register-compact .register-scroll {
  overflow-x: auto;
}
.excel-register.register-compact .register-table.excel-grid {
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100%;
  table-layout: fixed;
}
.excel-register.register-compact .register-table.excel-grid thead th {
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
  hyphens: auto;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.25;
  padding: 4px 3px;
  min-height: 52px;
  min-width: 0 !important;
  vertical-align: bottom;
}
.excel-register.register-compact .register-table.excel-grid thead th .th-label {
  display: block;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.excel-register.register-compact .register-table.excel-grid tbody td,
.excel-register.register-compact .register-table.excel-grid tfoot td {
  font-size: 13px;
  padding: 1px 2px;
  min-width: 0 !important;
}
.excel-register.register-compact .register-table.excel-grid .cell-input {
  font-size: 13px;
  font-family: inherit;
  padding: 0 2px;
  min-width: 0;
}
.register-table.excel-grid tbody td {
  text-align: center;
  padding: 1px 3px;
  background-color: #fff;
}
.register-table.excel-grid tbody td.cell-name,
.register-table.excel-grid tbody td.cell-type {
  text-align: left;
  padding-left: 4px;
}
.register-table.excel-grid tbody td.cell-name,
.excel-register .register-table.excel-grid tbody td.cell-name *,
.excel-register .register-table.excel-grid tbody td[data-key="customer_name"],
.excel-register .register-table.excel-grid tbody td[data-key="customer_name"] * {
  font-weight: 700 !important;
  color: #111 !important;
}
.register-table.excel-grid tbody td.cell-type {
  font-weight: 500;
}
.register-table.excel-grid tbody td.cell-sl {
  font-weight: 600;
  text-align: center;
}
.register-table.excel-grid tbody td.cell-bold {
  font-weight: 600;
}
.register-table.excel-grid tfoot td {
  position: sticky;
  bottom: 0;
  background-color: #f3f3f3;
  font-weight: 700;
  padding: 2px 4px;
  z-index: 4;
  text-align: center;
  border-top: 2px solid #000;
}
.excel-register .sticky-col {
  position: sticky;
  background-color: #fff;
  z-index: 3;
}
.excel-register thead .sticky-col {
  z-index: 6;
  background-color: #F0815E;
  color: #000;
}
.excel-register tfoot .sticky-col {
  z-index: 5;
  background-color: #f3f3f3;
}
.excel-register .sticky-name {
  box-shadow: 2px 0 0 rgba(0,0,0,0.08);
}
.excel-register thead th.sticky-name {
  font-weight: 700;
}
.excel-register .sticky-sl {
  z-index: 4;
}
.excel-register thead .sticky-sl { z-index: 7; }

.excel-register .cell-editable {
  background-color: #fff;
  padding: 0;
}
.excel-register .cell-calc {
  background-color: #fff;
  color: #000;
  padding: 1px 3px;
}
.excel-register .cell-readonly {
  padding: 1px 3px;
}
.excel-register .cell-input {
  width: 100%;
  min-width: 0;
  border: 0;
  margin: 0;
  padding: 1px 3px;
  font: inherit;
  font-family: inherit;
  font-size: inherit;
  background: transparent;
  text-align: center;
  height: 26px;
  color: inherit;
}
.excel-register .cell-input:focus {
  outline: 2px solid #217346;
  outline-offset: -2px;
  background-color: #fff;
  z-index: 1;
  position: relative;
}

/*
 * Conditional formatting — dedicated mechanism.
 * JS sets --cf-bg / --cf-fg and .cf-applied (plus threshold classes).
 * These beat default register cell backgrounds without scattering !important elsewhere.
 */
.excel-register td.cf-applied,
.excel-register td.cf-applied.sticky-col,
.excel-register td.cf-applied.cell-calc,
.excel-register td.cf-applied.cell-editable,
.excel-register td.cf-applied.cell-readonly {
  background-color: var(--cf-bg) !important;
  color: var(--cf-fg, #000) !important;
}
.excel-register td.cf-applied .cell-input {
  color: inherit;
  background: transparent !important;
}
.excel-register .cf-cash-high {
  --cf-bg: #FF0000;
  --cf-fg: #fff;
  font-weight: 700 !important;
}
.excel-register .cf-cash-mid {
  --cf-bg: #FFC000;
  --cf-fg: #000;
  font-weight: 700 !important;
}
.excel-register .cf-cash-low {
  --cf-bg: #92D050;
  --cf-fg: #000;
  font-weight: 700 !important;
}

/* Must Collect Today — red amount, white cell (body + totals) */
.excel-register tbody td[data-key="must_collect_today"],
.excel-register tfoot td[data-key="must_collect_today"] {
  color: #FF0000 !important;
  background-color: #fff !important;
  font-weight: 600;
}

.save-status { font-size: 0.78rem; color: var(--muted); min-width: 5rem; font-weight: 600; }
.save-status.saving { color: var(--warn); }
.save-status.ok { color: var(--ok); }
.save-status.err { color: var(--danger); }
.mode-label { font-size: 0.75rem; color: var(--muted); font-weight: 500; }
.customer-summary {
  background: var(--card);
  border: 1px solid var(--line);
  padding: 0.45rem 0.7rem;
  margin-bottom: 0.45rem;
  border-radius: 4px;
  font-size: 0.85rem;
}
/* Confirm Delivery bar removed — register cells autosave + auto-confirm */
.register-pager {
  display: flex;
  gap: 0.65rem;
  align-items: center;
  margin-top: 0.55rem;
  flex-wrap: wrap;
}
.empty-hint td {
  padding: 0.9rem !important;
  color: var(--muted);
  text-align: left !important;
  font-size: 12px !important;
  height: auto !important;
  white-space: normal !important;
}

.report-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }

/* Custom columns editor */
.col-edit-head,
.col-edit-row {
  display: grid;
  grid-template-columns: minmax(140px, 1.4fr) minmax(120px, 1fr) 90px 80px 70px 70px auto;
  gap: 0.5rem 0.65rem;
  align-items: center;
}
.col-edit-head {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0 0.25rem 0.45rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 0.35rem;
}
.col-edit-list { list-style: none; margin: 0; padding: 0; }
.col-edit-item {
  border-bottom: 1px solid var(--slate-100);
  padding: 0.5rem 0.25rem;
}
.col-edit-row { margin: 0; }
.col-edit-row .col-label,
.col-edit-row .col-order {
  width: 100%;
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
}
.col-edit-row .col-key,
.col-edit-row .col-type {
  font-size: 0.8rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.row-disabled { opacity: 0.55; background: var(--slate-50); }

/* ——— Responsive ——— */
@media (max-width: 1023px) {
  .app-shell,
  .app-shell.sidebar-collapsed {
    --sidebar-w: 260px;
    grid-template-columns: 1fr;
  }
  .sidebar-collapse-btn { display: none; }
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: min(260px, 86vw);
    transform: translateX(-105%);
    transition: transform 0.2s ease;
    box-shadow: 8px 0 30px rgba(15, 23, 42, 0.25);
  }
  .app-shell.sidebar-open .sidebar { transform: translateX(0); }
  .app-shell.sidebar-open .sidebar-backdrop { display: block; }
  .sidebar-backdrop[hidden] { display: none !important; }
  .sidebar-toggle { display: inline-flex; }
  .topbar-user { display: none; }
}

@media (max-width: 900px) {
  .col-edit-head { display: none; }
  .col-edit-row { grid-template-columns: 1fr 1fr; }
  .col-edit-row .col-label { grid-column: 1 / -1; }
}

@media (max-width: 768px) {
  .page { padding: 1rem; }
  .page-register { padding: 0.55rem; }
  .register-toolbar { align-items: stretch; }
  .register-scroll { max-height: calc(100vh - 250px); }
  /* Keep spreadsheet scroll; enlarge touch targets without shrinking type */
  .excel-register .register-table.excel-grid th,
  .excel-register .register-table.excel-grid td {
    height: 32px;
    max-height: none;
    font-size: 12px;
  }
  .excel-register .cell-input {
    min-height: 30px;
    height: 30px;
    font-size: 16px; /* iOS zoom prevention */
  }
  .stat-row, .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 420px) {
  .stat-row, .kpi-grid { grid-template-columns: 1fr; }
  .topbar { padding: 0 0.75rem; }
}

@media print {
  .sidebar, .topbar, .sidebar-backdrop, .sidebar-toggle { display: none !important; }
  .app-shell { display: block; }
  .page { max-width: none; padding: 0; }
}

/* Daily.xlsx-style supplier sheet */
.daily-sheet {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 1rem 1.1rem 1.25rem;
  box-shadow: var(--shadow);
}
.daily-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-bottom: 0.85rem;
}
.daily-date-nav {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 700;
  color: var(--ink);
}
.daily-date-label { margin-right: 0.15rem; }
.daily-nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  min-height: 28px;
  padding: 0 0.45rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
  line-height: 1;
}
.daily-nav-btn:hover { background: var(--slate-50); border-color: var(--slate-400); }
.daily-date-input {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.2rem 0.4rem;
  font: inherit;
}
.daily-date-display {
  margin-left: 0.35rem;
  font-weight: 700;
}
.daily-actions {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.daily-print-head {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  align-items: baseline;
  margin-bottom: 0.75rem;
  font-size: 1rem;
}
.daily-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  background: #fff;
}
.daily-table th,
.daily-table td {
  border: 1px solid #111;
  padding: 0.45rem 0.55rem;
  vertical-align: middle;
}
.daily-table thead th {
  background: #f3f4f6;
  font-weight: 700;
  text-align: left;
  white-space: nowrap;
}
.daily-table td.num,
.daily-table th.num,
.daily-table tfoot td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.daily-supplier {
  font-weight: 600;
  white-space: nowrap;
}
.daily-total-row td {
  font-weight: 700;
  background: #fafafa;
}
.daily-empty-input {
  width: 100%;
  min-width: 4.5rem;
  max-width: 7rem;
  margin-left: auto;
  display: block;
  text-align: right;
  border: 1px solid transparent;
  background: #fffbeb;
  border-radius: 3px;
  padding: 0.25rem 0.4rem;
  font: inherit;
  font-variant-numeric: tabular-nums;
}
.daily-empty-input:focus {
  outline: none;
  border-color: var(--blue-500);
  background: #fff;
}
.daily-hint { margin: 0.75rem 0 0; }
.daily-sheet.is-print {
  border: 0;
  box-shadow: none;
  padding: 0;
}

@media (max-width: 720px) {
  .daily-toolbar { align-items: stretch; }
  .daily-actions { width: 100%; }
  .daily-actions .btn { flex: 1; text-align: center; }
}

/* Accounting.xlsx-style sheet */
.acct-sheet {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 1rem 1.1rem 1.25rem;
  box-shadow: var(--shadow);
}
.acct-sheet.is-print {
  border: 0;
  box-shadow: none;
  padding: 0;
}
.acct-block { margin-bottom: 1.25rem; }
.acct-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  background: #fff;
}
.acct-table th,
.acct-table td {
  border: 1px solid #111;
  padding: 0.4rem 0.55rem;
  vertical-align: middle;
}
.acct-table thead th {
  background: #f3f4f6;
  font-weight: 700;
  text-align: left;
  white-space: nowrap;
}
.acct-table td.num,
.acct-table th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.acct-table .acct-gap {
  border: 0 !important;
  background: transparent !important;
  width: 1.25rem;
  min-width: 1rem;
  padding: 0;
}
.acct-head-recv,
.acct-head-paid {
  text-align: center !important;
}
.acct-plus-row td {
  font-weight: 700;
  text-align: center;
}
.acct-plus-row td.num,
.acct-plus-row td:first-child,
.acct-plus-row td:nth-child(4) {
  text-align: left;
}
.acct-total-row td {
  font-weight: 700;
  background: #fafafa;
}
.acct-summary {
  max-width: 920px;
}
