/* =============================================================================
   FILE: static/css/style.css
   =============================================================================
   What this file does:
     Visual design for the NEI Engineering Operations Management System.
   Why it exists:
     Gives the application a consistent, professional engineering look across
     every screen (login, dashboards, forms, tables, search).
   Design direction:
     Palette locked to the Africa-map logo (Zambia navy, pale sky, map gray).
     Deep navy sidebar + white logo plate so the mark stays clearly visible.
   ============================================================================= */

@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600;700&family=IBM+Plex+Mono:wght@500&display=swap");

:root {
  /* Africa-map logo palette — Zambia navy, pale sky fill, map gray */
  --ink: #0a1220;
  --ink-soft: #1b2a40;
  --steel: #5a6d82;
  --panel: #e6ebf3;
  --panel-elevated: #ffffff;
  --line: #c5d0df;
  --amber: #c47b17;
  --amber-deep: #9a5f0d;
  --brand: #000090;
  --brand-deep: #000048;
  --brand-soft: #1a2a8c;
  --brand-navy: #000038;
  --brand-sky: #d8e4f4;
  --teal: #000090;
  --danger: #a12828;
  --success: #1f6b3a;
  --warning: #9a5f0d;
  --info: #0033a0;
  /* Deep navy shell so the white logo plate reads clearly */
  --sidebar-bg: #000038;
  --sidebar-text: #e8eef8;
  --sidebar-muted: #9eb0c8;
  --logo-plate: #ffffff;
  --main-bg: #e8eef6;
  --hero-grid: radial-gradient(circle at 18% 18%, rgba(216, 228, 244, 0.16), transparent 42%),
    radial-gradient(circle at 82% 8%, rgba(0, 0, 144, 0.35), transparent 38%),
    linear-gradient(180deg, #000028 0%, #000048 48%, #0a1640 100%);
  --shadow: 0 10px 30px rgba(10, 18, 32, 0.1);
  --radius: 10px;
  --font: "IBM Plex Sans", "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: var(--font);
  color: var(--ink);
  background: var(--panel);
}

a {
  color: var(--teal);
  text-decoration: none;
}

a:hover {
  color: var(--amber-deep);
}

/* ---------- App shell ---------- */
.app-shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  padding: 1.25rem 1rem 2rem;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  border-right: 1px solid rgba(216, 228, 244, 0.12);
  box-shadow: 4px 0 24px rgba(0, 0, 28, 0.28);
}

.brand-block {
  padding: 0.85rem 0.65rem 1.2rem;
  border-bottom: 1px solid rgba(216, 228, 244, 0.16);
  margin-bottom: 1rem;
  text-align: center;
  background: transparent;
}

.brand-block .brand-mark-img {
  display: block;
  width: min(120px, 90%);
  height: auto;
  margin: 0 auto 0.7rem;
  padding: 0.65rem;
  background: var(--logo-plate);
  border: 1px solid rgba(216, 228, 244, 0.55);
  border-radius: 14px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
  object-fit: contain;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0;
  background: transparent;
  color: var(--brand-sky);
  font-weight: 800;
  letter-spacing: 0.04em;
  margin-bottom: 0.75rem;
}

img.brand-mark,
.brand-mark-img {
  display: block;
  width: min(120px, 90%);
  height: auto;
  max-height: none;
  padding: 0.65rem;
  background: var(--logo-plate);
  border: 1px solid rgba(216, 228, 244, 0.55);
  border-radius: 14px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
  object-fit: contain;
}

@keyframes brandPulse {
  0%,
  100% {
    transform: translateY(0);
    box-shadow: 0 0 0 0 rgba(196, 123, 23, 0.35);
  }
  50% {
    transform: translateY(-2px);
    box-shadow: 0 8px 18px rgba(196, 123, 23, 0.25);
  }
}

.brand-block h1 {
  margin: 0;
  font-size: 1.15rem;
  letter-spacing: 0.02em;
  color: #ffffff;
}

.brand-block p {
  margin: 0.35rem 0 0;
  color: var(--sidebar-muted);
  font-size: 0.82rem;
}

.nav-section {
  margin: 1rem 0 0.35rem;
  padding: 0 0.75rem;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--brand-sky);
  opacity: 0.78;
}

.nav-link {
  display: block;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  color: var(--sidebar-text);
  margin: 0.15rem 0;
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.nav-link:hover,
.nav-link.active {
  background: rgba(255, 255, 255, 0.96);
  color: var(--brand-deep);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
  transform: translateX(3px);
}

.main-area {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--main-bg);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.5rem;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}

.topbar-back {
  flex: 0 0 auto;
  white-space: nowrap;
}

.topbar h2 {
  margin: 0;
  font-size: 1.15rem;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.9rem;
}

.role-badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: var(--brand-sky);
  color: var(--brand-deep);
  font-size: 0.75rem;
  font-weight: 600;
}

.content {
  padding: 1.25rem 1.5rem 2.5rem;
  background: var(--main-bg);
}

/* ---------- Login ---------- */
.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: var(--hero-grid);
  position: relative;
  overflow: hidden;
}

.login-page::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 48px 48px;
  animation: gridDrift 28s linear infinite;
  pointer-events: none;
}

@keyframes gridDrift {
  from {
    transform: translateY(0);
  }
  to {
    transform: translateY(48px);
  }
}

.login-card {
  width: min(420px, calc(100% - 2rem));
  background: rgba(255, 255, 255, 0.96);
  border-radius: 14px;
  padding: 2rem;
  box-shadow: var(--shadow);
  position: relative;
  z-index: 1;
  animation: fadeRise 0.55s ease both;
}

.login-card .brand-mark-img {
  width: min(128px, 62%);
  height: auto;
  margin: 0 auto 0.85rem;
  background: #fff;
  padding: 0.55rem;
  border: 1px solid rgba(0, 0, 72, 0.16);
  border-radius: 12px;
  box-shadow: 0 10px 24px rgba(0, 0, 56, 0.14);
}

@keyframes fadeRise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.login-card .brand-title {
  font-size: 1.6rem;
  margin: 0.4rem 0 0.2rem;
  color: var(--ink);
}

.login-card .brand-sub {
  color: var(--steel);
  margin: 0 0 1.4rem;
}

/* ---------- Cards / panels ---------- */
.panel {
  background: var(--panel-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  box-shadow: 0 1px 0 rgba(18, 22, 28, 0.02);
}

.panel + .panel {
  margin-top: 1rem;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.9rem;
}

.panel-header h3 {
  margin: 0;
  font-size: 1.05rem;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}

.kpi {
  background: linear-gradient(160deg, #ffffff, #f7f9fb);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
  animation: fadeRise 0.5s ease both;
}

.kpi:nth-child(2) {
  animation-delay: 0.05s;
}
.kpi:nth-child(3) {
  animation-delay: 0.1s;
}
.kpi:nth-child(4) {
  animation-delay: 0.15s;
}

.kpi .label {
  color: var(--steel);
  font-size: 0.82rem;
  margin-bottom: 0.35rem;
}

.kpi .value {
  font-size: 1.55rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.kpi .hint {
  margin-top: 0.35rem;
  color: #6b7785;
  font-size: 0.78rem;
}

/* ---------- Forms / tables ---------- */
label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
  color: var(--ink-soft);
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="date"],
select,
textarea {
  width: 100%;
  border: 1px solid #c7d0db;
  border-radius: 8px;
  padding: 0.6rem 0.7rem;
  font: inherit;
  background: #fff;
  color: var(--ink);
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(31, 111, 106, 0.25);
  border-color: var(--teal);
}

.form-row {
  margin-bottom: 0.9rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem 1rem;
}

.form-grid > .form-grid-span {
  grid-column: 1 / -1;
}

.zra-invoice-field {
  padding: 0.85rem 1rem;
  border: 2px solid var(--brand-soft);
  border-radius: 8px;
  background: #f3f5ff;
}

.zra-invoice-field label {
  font-weight: 700;
  color: #0b1f33;
}

.zra-invoice-field input {
  font-size: 1.1rem;
  font-weight: 600;
}

.quote-letterhead-invno {
  margin: 0.35rem 0 0.45rem;
  display: grid;
  gap: 0.15rem;
  justify-items: end;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: 0;
  border-radius: 8px;
  padding: 0.55rem 0.95rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.15s ease, background 0.15s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--teal);
  color: #fff;
}

.btn-primary:hover {
  background: #185851;
  color: #fff;
}

.btn-accent {
  background: var(--amber);
  color: #1a1205;
}

.btn-accent:hover {
  background: var(--amber-deep);
  color: #fff;
}

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

.btn-ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink-soft);
}

.btn-sm {
  padding: 0.35rem 0.65rem;
  font-size: 0.85rem;
}

.table-wrap {
  overflow-x: auto;
}

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

table.data th,
table.data td {
  padding: 0.7rem 0.65rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

table.data th {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--steel);
  background: #f7f9fb;
}

table.data tr {
  transition: background 0.15s ease;
}

table.data tbody tr:hover {
  background: #f4f8f8;
}

.badge {
  display: inline-block;
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: #eef1f5;
  color: var(--ink-soft);
}

.badge-success {
  background: #e5f5eb;
  color: var(--success);
}
.badge-warning {
  background: #fff2df;
  color: var(--warning);
}
.badge-danger {
  background: #fde8e8;
  color: var(--danger);
}
.badge-info {
  background: #e7f1fa;
  color: var(--info);
}

.flash-stack {
  margin-bottom: 1rem;
}

.flash {
  padding: 0.75rem 0.9rem;
  border-radius: 8px;
  margin-bottom: 0.5rem;
  border: 1px solid transparent;
}

.flash-success {
  background: #e5f5eb;
  border-color: #b9e0c6;
  color: var(--success);
}
.flash-danger {
  background: #fde8e8;
  border-color: #f0c0c0;
  color: var(--danger);
}
.flash-warning {
  background: #fff2df;
  border-color: #f0d3a0;
  color: var(--warning);
}
.flash-info {
  background: #e7f1fa;
  border-color: #bdd6ec;
  color: var(--info);
}

.field-error {
  margin-top: 0.3rem;
  font-size: 0.82rem;
  color: var(--danger);
}

/* ---------- Smart search ---------- */
.search-bar {
  display: grid;
  grid-template-columns: 2fr repeat(4, 1fr) auto;
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.search-results {
  display: grid;
  gap: 0.75rem;
}

.search-result {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  background: #fff;
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 0.7fr 1.2fr;
  gap: 0.75rem;
  align-items: center;
  animation: fadeRise 0.35s ease both;
}

.search-result strong {
  display: block;
  margin-bottom: 0.2rem;
}

.search-result .meta {
  color: var(--steel);
  font-size: 0.85rem;
}

.mono {
  font-family: var(--mono);
  font-size: 0.85rem;
}

/* ---------- Requisition cart ---------- */
.cart-layout {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 1rem;
}

.cart-lines {
  min-height: 180px;
}

.cart-line {
  display: grid;
  grid-template-columns: 1.4fr 0.5fr 1fr auto;
  gap: 0.5rem;
  align-items: center;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--line);
}

.empty-state {
  color: var(--steel);
  padding: 1.5rem 0.5rem;
  text-align: center;
}

.muted {
  color: var(--steel);
}

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

.qty-edit-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.qty-edit-form input[type="number"] {
  width: 5.5rem;
}

.qty-edit-form input[type="text"] {
  flex: 1 1 10rem;
  min-width: 8rem;
}

.section-spacer {
  margin-top: 1.25rem;
}

.mobile-nav-toggle {
  display: none;
  appearance: none;
  border: 1px solid var(--line);
  background: var(--brand-navy);
  color: #fff;
  border-radius: 8px;
  padding: 0.45rem 0.85rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  flex: 0 0 auto;
}

.sidebar-mobile-head {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.sidebar-mobile-title {
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 0.8rem;
}

.sidebar-close {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: transparent;
  color: #fff;
  border-radius: 8px;
  padding: 0.35rem 0.7rem;
  font: inherit;
  cursor: pointer;
}

.sidebar-backdrop {
  display: none;
}

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .search-bar {
    grid-template-columns: 1fr 1fr;
  }
  .search-result {
    grid-template-columns: 1fr 1fr;
  }
  .cart-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .mobile-nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .sidebar-mobile-head {
    display: flex;
  }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(5, 10, 24, 0.55);
    z-index: 35;
  }

  .sidebar-backdrop[hidden] {
    display: none !important;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(300px, 88vw);
    max-width: 100%;
    transform: translateX(-105%);
    transition: transform 0.25s ease;
    z-index: 40;
    box-shadow: 8px 0 28px rgba(0, 0, 0, 0.35);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  body.nav-open {
    overflow: hidden;
  }

  .topbar {
    flex-wrap: wrap;
    align-items: flex-start;
    padding: 0.85rem 1rem;
    gap: 0.65rem;
  }

  .topbar-left {
    flex-wrap: wrap;
    width: 100%;
  }

  .topbar h2 {
    font-size: 1.05rem;
    flex: 1 1 auto;
    min-width: 0;
  }

  .user-chip {
    width: 100%;
    justify-content: flex-start;
  }

  .grid-2,
  .grid-3,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .panel-header {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }

  .stack-actions {
    flex-wrap: wrap;
    width: 100%;
  }

  .stack-actions .btn,
  .panel-header .btn {
    flex: 1 1 auto;
  }

  .table-wrap {
    margin: 0 -0.25rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  table.data {
    min-width: 640px;
  }

  .content {
    padding: 0.85rem 1rem 1.75rem;
  }

  .quote-letterhead,
  .quote-letterhead-brand {
    flex-direction: column;
  }
}

@media (max-width: 520px) {
  .topbar-back {
    padding-left: 0.55rem;
    padding-right: 0.55rem;
  }

  .brand-block .brand-mark-img,
  img.brand-mark,
  .brand-mark-img {
    width: min(108px, 78%);
  }

  .login-card {
    padding: 1.35rem 1.1rem;
  }

  .login-card .brand-mark-img {
    width: min(120px, 70%);
  }
}

/* ---------- Quotation builder ---------- */
.quote-letterhead {
  display: flex;
  justify-content: space-between;
  gap: 1.25rem;
  flex-wrap: wrap;
  margin: -0.25rem 0 1.5rem;
  padding: 1rem 1.1rem 1.15rem;
  border: 1px solid var(--line);
  border-bottom: 1px solid #c8c8c8;
  background: #fff;
}

.quote-letterhead-brand .quote-logo {
  width: 56px;
  height: auto;
}

.quote-letterhead-brand {
  display: flex;
  gap: 0.95rem;
  align-items: flex-start;
  min-width: min(100%, 28rem);
  flex: 1;
}

.quote-logo {
  width: 56px;
  height: auto;
  border-radius: 0;
  flex-shrink: 0;
  object-fit: contain;
}

.quote-letterhead-name {
  font-family: "Times New Roman", Times, serif;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #0000ff;
  line-height: 1.2;
  text-align: center;
}

.quote-letterhead-addr {
  margin: 0.35rem 0 0;
  font-family: "Times New Roman", Times, serif;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.25;
  color: #0000ff;
  text-align: center;
}

.quote-letterhead-company {
  flex: 1;
  text-align: center;
}

.quote-letterhead-meta {
  text-align: right;
  min-width: 10rem;
  color: #0000ff;
}

.quote-letterhead-label {
  font-family: "Times New Roman", Times, serif;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #0000ff;
  margin-bottom: 0.35rem;
}

.quote-builder .quote-section {
  margin-bottom: 1.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--line);
}

.quote-builder .quote-section h3 {
  margin: 0 0 0.75rem;
  font-size: 1rem;
  color: var(--ink-soft);
}

.quote-lines textarea,
.quote-lines input[type="text"],
.quote-lines input[type="number"] {
  width: 100%;
  min-width: 0;
}

.quote-lines .col-handle {
  width: 28px;
  cursor: grab;
  color: var(--steel);
  user-select: none;
  text-align: center;
}

.quote-lines .col-no { width: 48px; text-align: center; }
.quote-lines .col-uom { width: 72px; }
.quote-lines .col-qty { width: 88px; }
.quote-lines .col-price { width: 120px; }
.quote-lines .col-total { width: 110px; text-align: right; font-variant-numeric: tabular-nums; }
.quote-lines .col-actions { width: 44px; }

.quote-lines tr.dragging {
  opacity: 0.55;
  background: #fff8eb;
}

.quote-totals {
  display: grid;
  gap: 0.45rem;
  max-width: 320px;
  margin-left: auto;
  margin-top: 0.75rem;
}

.quote-totals > div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.quote-totals .grand {
  padding: 0.55rem 0.65rem;
  background: #e8f0ec;
  border-top: 2px solid var(--teal);
  font-weight: 700;
}

/* ---------- Planning suite ---------- */
.wizard-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--line);
}

.wizard-tab {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 7.5rem;
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7f9fb;
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 600;
}

.wizard-tab:hover {
  border-color: var(--teal, #1b4d3e);
  color: var(--ink);
}

.wizard-tab.is-active {
  background: #0b1f33;
  border-color: #0b1f33;
  color: #fff;
}

.wizard-tab-phase {
  font-size: 0.68rem;
  font-weight: 500;
  opacity: 0.75;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.form-stack {
  display: grid;
  gap: 0.75rem;
}

.form-stack label {
  display: grid;
  gap: 0.3rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-soft);
}

.form-stack input,
.form-stack select,
.form-stack textarea,
.inline-add-form input,
.inline-add-form select {
  width: 100%;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font: inherit;
  color: var(--ink);
}

.inline-add-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.inline-add-form input,
.inline-add-form select {
  width: auto;
  min-width: 7rem;
  flex: 1 1 7rem;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
}

.check-inline {
  display: inline-flex !important;
  align-items: center;
  gap: 0.4rem;
  font-weight: 500 !important;
  white-space: nowrap;
}

.check-inline input {
  width: auto !important;
}

.big-check {
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7f9fb;
}

.checklist-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.55rem;
}

.kpi-card .kpi-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--ink);
  margin-top: 0.35rem;
}

.text-danger { color: var(--danger); }
.text-success { color: var(--success); }

.daily-log-form {
  max-width: 720px;
}

@media (max-width: 860px) {
  .wizard-tab {
    min-width: calc(50% - 0.4rem);
  }
  .inline-add-form input,
  .inline-add-form select {
    min-width: 100%;
  }
}

/* ---------- Bulk delete action bar (inventory) ---------- */
.bulk-action-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-top: 0.85rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7f9fb;
}

.bulk-action-bar.has-selection {
  border-color: #f0c0c0;
  background: #fdf4f4;
}

.bulk-action-bar-left {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.bulk-action-bar-right {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
  margin-left: auto;
}

.bulk-action-bar .btn-danger:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* ---------- Per-role dashboard tutorial ---------- */
.role-tutorial {
  margin-bottom: 1.25rem;
}

.role-tutorial__panel {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: linear-gradient(180deg, #f3f7fb 0%, #ffffff 55%);
  padding: 0.85rem 1rem 0.95rem;
}

.role-tutorial__summary {
  list-style: none;
  cursor: pointer;
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 0.75rem;
  row-gap: 0.2rem;
  align-items: center;
}

.role-tutorial__summary::-webkit-details-marker {
  display: none;
}

.role-tutorial__toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 6px;
  background: #0b1f33;
  color: #f4f7f5;
  grid-row: 1 / span 2;
}

.role-tutorial__arrow {
  display: inline-block;
  font-size: 0.75rem;
  line-height: 1;
  transform: rotate(-90deg);
  transition: transform 0.15s ease;
}

.role-tutorial__panel[open] .role-tutorial__arrow {
  transform: rotate(0deg);
}

.role-tutorial__label-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.role-tutorial__label {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--ink, #0b1f33);
  letter-spacing: 0.02em;
}

.role-tutorial__hint-line {
  font-size: 0.85rem;
}

.role-tutorial__badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--brand-deep);
  background: #eef0ff;
  border: 1px solid #c8cff5;
  border-radius: 4px;
  padding: 0.15rem 0.45rem;
}

.role-tutorial__title {
  margin: 0 0 0.35rem;
  font-size: 1.1rem;
  color: var(--ink);
}

.role-tutorial__intro {
  margin: 0;
  color: var(--muted, #5b6b7c);
  max-width: 62rem;
}

.role-tutorial__body {
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--line);
}

.role-tutorial__flow {
  margin-bottom: 1rem;
  padding: 0.75rem 0.85rem;
  border-radius: 8px;
  background: #eef4f9;
  border: 1px solid #d5e2ee;
}

.role-tutorial__flow h3,
.role-tutorial__howto,
.role-tutorial__tips h3 {
  margin: 0 0 0.45rem;
  font-size: 0.95rem;
}

.role-tutorial__flow-summary {
  margin: 0 0 0.65rem;
  line-height: 1.45;
  color: var(--muted, #5b6b7c);
}

.role-tutorial__flow-stages {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.55rem;
}

.role-tutorial__flow-stages li {
  display: grid;
  gap: 0.15rem;
  padding: 0.55rem 0.65rem;
  border-radius: 6px;
  background: #fff;
  border-left: 3px solid #0b5cab;
}

.role-tutorial__flow-who {
  font-weight: 700;
  font-size: 0.88rem;
  color: #0b1f33;
}

.role-tutorial__flow-what {
  font-size: 0.9rem;
  line-height: 1.4;
  color: var(--ink, #1a2733);
}

.role-tutorial__howto {
  margin-top: 0.25rem;
}

.role-tutorial__steps {
  margin: 0 0 0.85rem 1.15rem;
  padding: 0;
}

.role-tutorial__steps li {
  margin-bottom: 0.45rem;
  line-height: 1.45;
}

.role-tutorial__tips ul {
  margin: 0 0 0.75rem 1.15rem;
  padding: 0;
}

.role-tutorial__hint {
  margin: 0;
  font-size: 0.85rem;
}

tr.row-unread td {
  font-weight: 600;
  background: #f3f8fc;
}

/* Advanced multi-section forms (employee salary register, month-end salary) */
.advanced-form .panel {
  margin-bottom: 0;
}

.advanced-form .panel + .panel,
.advanced-form .panel.section-spacer {
  margin-top: 1rem;
}

.advanced-form .form-row label {
  font-weight: 600;
  color: var(--ink-soft, #3a4a58);
}

.advanced-form .form-row input[disabled] {
  opacity: 0.85;
  background: var(--surface-muted, #f4f7f5);
}

.advanced-form textarea {
  width: 100%;
  min-height: 4.5rem;
  resize: vertical;
}

/* Location demarcation on inventory catalogue */
.location-band {
  margin: 1.25rem 0 1.75rem;
  border: 1px solid var(--line, #d7dee7);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}
.location-band-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--line, #d7dee7);
  font-size: 0.95rem;
}
.location-band-ms .location-band-title { background: #eef4f8; }
.location-band-led .location-band-title { background: #eef8f1; }
.location-band-raw .location-band-title { background: #f8f1ee; }
.location-band .table-wrap { margin: 0; }

/* SKU organize drag-and-drop */
.sku-organize-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}
.sku-bucket {
  border: 1px solid var(--line, #d7dee7);
  border-radius: 8px;
  background: #fafbfc;
  min-height: 12rem;
  display: flex;
  flex-direction: column;
}
.sku-bucket-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--line, #d7dee7);
}
.sku-bucket-ms { background: #eef4f8; }
.sku-bucket-led { background: #eef8f1; }
.sku-bucket-raw { background: #f8f1ee; }
.sku-sortable {
  list-style: none;
  margin: 0;
  padding: 0.5rem;
  flex: 1;
  min-height: 8rem;
}
.sku-sortable.drag-over {
  outline: 2px dashed #3b82a0;
  background: #f0f7fb;
}
.sku-item {
  display: grid;
  grid-template-columns: auto auto 1fr;
  gap: 0.5rem;
  align-items: center;
  padding: 0.45rem 0.55rem;
  margin-bottom: 0.35rem;
  background: #fff;
  border: 1px solid var(--line, #d7dee7);
  border-radius: 6px;
  cursor: grab;
  user-select: none;
}
.sku-item.dragging {
  opacity: 0.55;
  cursor: grabbing;
}
.drag-handle {
  color: #8a97a5;
  font-size: 0.85rem;
  letter-spacing: -0.08em;
}

/* Stock Intake — collapsible store sections */
.intake-sections {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.intake-section {
  border: 1px solid var(--line, #c5d0df);
  border-radius: var(--radius, 10px);
  background: var(--panel-elevated, #fff);
  overflow: hidden;
}
.intake-section-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 1rem;
  padding: 0.85rem 1rem;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.intake-section-summary::-webkit-details-marker {
  display: none;
}
.intake-section-summary::before {
  content: "▸";
  color: var(--steel, #5a6d82);
  font-size: 0.85rem;
  transition: transform 0.15s ease;
}
.intake-section[open] > .intake-section-summary::before {
  transform: rotate(90deg);
}
.intake-section-title {
  font-weight: 600;
  font-size: 1.05rem;
}
.intake-hint {
  margin-left: auto;
  font-size: 0.85rem;
}
.intake-section-body {
  padding: 0 1rem 1rem;
  border-top: 1px solid var(--line, #c5d0df);
}
.intake-ms > .intake-section-summary,
.intake-ms > .panel-header {
  background: #eef4f8;
}
.intake-led > .intake-section-summary,
.intake-led > .panel-header {
  background: #eef8f1;
}
.intake-raw > .intake-section-summary,
.intake-raw > .panel-header {
  background: #f8f1ee;
}
.intake-lines select,
.intake-lines input[type="text"],
.intake-lines input[type="number"] {
  width: 100%;
  min-width: 0;
}
@media (max-width: 900px) {
  .intake-lines {
    display: block;
    overflow-x: auto;
  }
  .intake-hint {
    display: none;
  }
}
