:root {
  --navy: #0B1C2E;
  --blue: #1565C0;
  --ice: #E3F2FD;
  --off: #F4F7FA;
  --text: #1A2B3C;
  --muted: #5A6E82;
  --amber: #FB8C00;
  --green: #2E7D32;
  --red: #C62828;
  --white: #ffffff;
  --line: #d7e1eb;
  --shadow: 0 10px 28px rgba(11, 28, 46, 0.06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--off);
  color: var(--text);
  font-family: "Avenir Next", "Segoe UI", "Trebuchet MS", sans-serif;
  line-height: 1.45;
}

a { color: var(--blue); }

:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.app-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 220px;
  flex: 0 0 220px;
  background: var(--navy);
  color: var(--white);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-brand {
  padding: 22px 16px 16px;
  font-weight: 800;
  letter-spacing: 0.04em;
  border-bottom: 3px solid var(--amber);
  font-size: 0.95rem;
}

.sidebar-tag {
  display: block;
  margin-top: 4px;
  color: #9fb3c8;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 12px;
}

.nav-item {
  color: #d6e4f0;
  text-decoration: none;
  display: block;
  padding: 12px 14px;
  border-radius: 8px;
  font-weight: 600;
}

.nav-item:hover { background: rgba(255, 255, 255, 0.08); color: var(--white); }
.nav-item.active { background: var(--blue); color: var(--white); }

.main-wrap {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  background: var(--white);
  border-bottom: 1px solid var(--line);
  min-height: 64px;
  padding: 12px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: relative;
  z-index: 30;
}

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

.topbar-title {
  margin: 0;
  font-size: 1.15rem;
  color: var(--navy);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  flex: 0 0 auto;
}

.logout-btn {
  color: var(--navy);
  font-weight: 700;
  text-decoration: none;
  border: 1px solid var(--line);
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--white);
}

.logout-btn:hover { border-color: var(--red); color: var(--red); }

.menu-btn {
  display: none;
  border: 1px solid var(--line);
  background: var(--white);
  border-radius: 8px;
  width: 40px;
  height: 40px;
  font-size: 1.2rem;
  cursor: pointer;
}

.backdrop {
  position: fixed;
  inset: 0;
  background: rgba(11, 28, 46, 0.45);
  z-index: 30;
}

.content {
  flex: 1;
  padding: 24px 28px 48px;
}

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 16px;
}

.lede { margin: 0; color: var(--muted); }

.stack { display: flex; flex-direction: column; gap: 18px; }

.panel {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px;
  box-shadow: var(--shadow);
}

.panel h2 { margin: 0 0 14px; font-size: 1.05rem; color: var(--navy); }

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 12px;
}

.panel-head h2 { margin: 0; }

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

.stat-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-top: 4px solid var(--blue);
  border-radius: 14px;
  padding: 18px 18px 16px;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow);
}

.stat-card:nth-child(1) { border-top-color: var(--navy); }
.stat-card:nth-child(2) { border-top-color: var(--amber); }
.stat-card:nth-child(3) { border-top-color: var(--blue); }
.stat-card:nth-child(4) { border-top-color: var(--green); }
.stat-card.stat-green { border-top-color: var(--green); }
.stat-card.stat-amber { border-top-color: var(--amber); }
.stat-card:hover { box-shadow: 0 12px 30px rgba(11, 28, 46, 0.1); }
.stat-pulse { animation: pulse-amber 2s infinite; }
@keyframes pulse-amber {
  0%, 100% { box-shadow: 0 2px 8px rgba(251, 140, 0, 0.2); }
  50% { box-shadow: 0 2px 20px rgba(251, 140, 0, 0.5); }
}

.stat-label {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.stat-value {
  display: block;
  margin-top: 8px;
  font-size: 2rem;
  font-weight: 700;
  color: var(--navy);
  font-variant-numeric: tabular-nums;
}

.dash-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }

.tab {
  text-decoration: none;
  color: var(--text);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 12px;
  font-weight: 700;
  font-size: 0.9rem;
}

.tab.active { background: var(--navy); color: var(--white); border-color: var(--navy); }

.table-wrap {
  overflow-x: auto;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 12px;
}

table { width: 100%; border-collapse: collapse; min-width: 640px; }

th {
  text-align: left;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 12px 14px;
  background: #f8fafc;
}

td {
  padding: 12px 14px;
  border-top: 1px solid #e8eef4;
  vertical-align: middle;
}

tbody tr:nth-child(even) { background: #f7fbfe; }
tbody tr:hover { background: var(--ice); }

th.sortable { cursor: pointer; user-select: none; }
th.sortable::after { content: " ↕"; color: #9aabba; font-size: 0.75em; }
th.sortable[data-dir="asc"]::after { content: " ↑"; color: var(--blue); }
th.sortable[data-dir="desc"]::after { content: " ↓"; color: var(--blue); }

.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.badge-pending { background: var(--amber); color: var(--white); }
.badge-lost { background: var(--red); color: var(--white); }
.badge-converted { background: var(--blue); color: var(--white); }
.badge-closed { background: var(--green); color: var(--white); }
.badge-docs { background: var(--blue); color: var(--white); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  border: 1.5px solid transparent;
  text-decoration: none;
  white-space: nowrap;
  background: var(--white);
  color: var(--navy);
  transition: background 0.15s, box-shadow 0.15s, transform 0.1s;
}
.btn:active { transform: scale(0.98); }

.btn-primary { background: #1565C0; color: #fff; border-color: #1565C0; }
.btn-primary:hover { background: #0D47A1; border-color: #0D47A1; }
.btn-outline { background: #fff; color: #1565C0; border-color: #1565C0; }
.btn-outline:hover { background: #E3F2FD; }
.btn-success { background: #2E7D32; color: #fff; border-color: #2E7D32; }
.btn-success:hover { background: #1B5E20; border-color: #1B5E20; }
.btn-small { padding: 6px 10px; font-size: 0.85rem; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.quote-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid #DDE5EE;
}
.quote-actions form,
.quote-actions .dropdown {
  display: flex;
  align-items: center;
  margin: 0;
}
.form-section-card .quote-actions form .btn,
.quote-actions .btn {
  height: 40px;
  margin: 0;
  box-sizing: border-box;
}
.row-actions { white-space: nowrap; }

.field { margin-bottom: 16px; }
.form-card { max-width: 760px; }

label, legend { font-weight: 700; }
legend { padding: 0; margin-bottom: 8px; }

input, select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #cfd8e3;
  border-radius: 8px;
  font: inherit;
  color: var(--text);
  background: var(--white);
  font-size: 1rem;
}

textarea { min-height: 120px; resize: vertical; }

.req { color: var(--red); }

.field-error {
  color: var(--red);
  font-size: 0.82rem;
  min-height: 1.1em;
  margin: 4px 0 0;
}

input.invalid, select.invalid, textarea.invalid {
  border-color: var(--red);
  background: #fff6f6;
}

.form-error, .banner {
  padding: 12px 14px;
  border-radius: 10px;
  margin: 0 0 14px;
}

.form-error { background: #fdecea; color: var(--red); }
.banner { background: var(--ice); color: var(--navy); border: 1px solid #bbdefb; }

.check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-weight: 700;
}

.check input { width: auto; margin-top: 3px; }

.choices { display: flex; gap: 18px; flex-wrap: wrap; }
.choices label { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.choices input { width: auto; }

.help { color: var(--muted); font-size: 0.85rem; margin: 6px 0 0; }

.summary {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 8px 16px;
  margin: 0;
}

.summary dt { color: var(--muted); }
.summary dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

#closureWrap { display: none; }
#closeBox:has(#isClosed:checked) #closureWrap { display: block; }

#cashFields, #chequeFields { display: none; }
.pay-form:has(input[name="payment_mode"][value="Cash"]:checked) #cashFields { display: block; }
.pay-form:has(input[name="payment_mode"][value="Cheque"]:checked) #chequeFields { display: block; }

.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.timeline li {
  border-left: 3px solid var(--blue);
  background: var(--off);
  border-radius: 0 10px 10px 0;
  padding: 10px 12px;
}

.tl-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tl-text { white-space: pre-wrap; margin: 8px 0 0; }

.status-hero {
  background: var(--navy);
  color: var(--white);
  border-radius: 14px;
  padding: 22px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.status-hero p { margin: 6px 0 0; color: #c5d4e4; }
.status-kicker {
  margin: 0;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 0.75rem;
  color: #9fb3c8;
}

.steps {
  list-style: none;
  padding: 0;
  margin: 16px 0 0;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.steps li {
  padding: 8px 12px;
  border-radius: 999px;
  background: #e8eef4;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
}

.steps li.done { background: #e8f5e9; color: var(--green); }
.steps li.current { background: #fff3e0; color: #e65100; }

.empty {
  padding: 28px 16px;
  text-align: center;
  color: var(--muted);
  background: var(--white);
  border: 1px dashed #c5d0dc;
  border-radius: 12px;
}

.back { font-weight: 700; text-decoration: none; }

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at top left, rgba(21, 101, 192, 0.45), transparent 42%),
    linear-gradient(155deg, var(--navy), #12395f 58%, #0e4f86);
  padding: 24px;
}

.login-card {
  width: min(440px, 100%);
  background: var(--white);
  border-radius: 18px;
  padding: 32px 28px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25);
}

.login-brand {
  margin: 0;
  color: var(--navy);
  letter-spacing: 0.04em;
  font-size: 1.35rem;
}

.login-sub {
  margin: 4px 0 22px;
  color: var(--muted);
}

.login-card .btn { width: 100%; }

@media (max-width: 1000px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .dash-grid { grid-template-columns: 1fr; }
}

@media (max-width: 800px) {
  .menu-btn { display: inline-flex; align-items: center; justify-content: center; }
  .sidebar {
    position: fixed;
    z-index: 40;
    transform: translateX(-105%);
    transition: transform 0.2s ease;
  }
  .sidebar.open { transform: translateX(0); }
  .content { padding: 18px 14px 36px; }
  .page-head { flex-direction: column; align-items: stretch; }
  .summary, .grid-3 { grid-template-columns: 1fr; }
  .status-hero { flex-direction: column; align-items: flex-start; }
  .who { display: none; }
}

@media (max-width: 560px) {
  .stats { grid-template-columns: 1fr; }
}

.form-section-card {
  background: #fff;
  border: 1px solid #DDE5EE;
  border-radius: 12px;
  padding: 28px 32px;
  margin-bottom: 24px;
  box-shadow: 0 2px 8px rgba(11, 28, 46, 0.06);
}

.form-section-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #1565C0;
  border-left: 3px solid #1565C0;
  padding-left: 10px;
  margin: 0 0 20px;
}

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
}

.quote-columns { align-items: start; margin-bottom: 24px; }
.quote-columns .form-section-card { margin-bottom: 0; }

.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: #1A2B3C;
  margin-bottom: 6px;
}

.form-label .required { color: #C62828; margin-left: 2px; }

.form-input {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border: 1px solid #DDE5EE;
  border-radius: 8px;
  font-size: 0.9rem;
  color: #1A2B3C;
  background: #fff;
  transition: border-color 0.2s;
}

.form-input:focus {
  outline: none;
  border-color: #1565C0;
  box-shadow: 0 0 0 3px rgba(21, 101, 192, 0.1);
}

.validity-input { max-width: 160px; }

.form-textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #DDE5EE;
  border-radius: 8px;
  font-size: 0.9rem;
  color: #1A2B3C;
  resize: vertical;
  min-height: 80px;
  font-family: inherit;
}

.form-textarea:focus {
  outline: none;
  border-color: #1565C0;
  box-shadow: 0 0 0 3px rgba(21, 101, 192, 0.1);
}

.items-scroll { overflow-x: auto; }

.items-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  margin-bottom: 16px;
  font-size: 0.875rem;
}

.items-table th {
  background: #0B1C2E;
  color: #fff;
  padding: 10px 12px;
  text-align: left;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: none;
}

.items-table td {
  padding: 8px 10px;
  border-bottom: 1px solid #DDE5EE;
  vertical-align: middle;
}

.items-table tr:nth-child(even) td { background: #F4F7FA; }

.items-table input,
.items-table select {
  width: 100%;
  height: 36px;
  padding: 0 8px;
  border: 1px solid #DDE5EE;
  border-radius: 6px;
  font-size: 0.85rem;
  background: #fff;
}

.items-table input:focus,
.items-table select:focus {
  outline: none;
  border-color: #1565C0;
}

.col-sr { width: 40px; }
.col-desc { width: 28%; }
.col-make { width: 18%; }
.col-qty { width: 70px; }
.col-unit { width: 90px; }
.col-price { width: 130px; }
.col-total { width: 120px; }
.col-warranty { width: 130px; }
.col-wmonths { width: 70px; }
.col-del { width: 40px; }
.warranty-months { display: none; }
.warranty-months.is-on { display: block; }
.badge-warranty {
  background: #E8F5E9;
  color: #2E7D32;
  font-size: 0.78rem;
  padding: 3px 8px;
  border-radius: 4px;
  font-weight: 600;
}
.warranty-none { color: #5A6E82; font-size: 0.8rem; }
.line-total { font-weight: 700; white-space: nowrap; }

.btn-add-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border: 2px dashed #1565C0;
  border-radius: 8px;
  color: #1565C0;
  font-size: 0.875rem;
  font-weight: 600;
  background: none;
  cursor: pointer;
  font-family: inherit;
}

.btn-add-row:hover { background: #E3F2FD; }

.btn-delete-row {
  background: none;
  border: none;
  color: #C62828;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
}

.btn-delete-row:hover { background: #FFEBEE; }

.totals-box,
.totals-block {
  margin-top: 16px;
  margin-left: auto;
  width: 420px;
  max-width: 100%;
}

.totals-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 8px 0;
  border-bottom: 1px solid #EEF2F7;
  font-size: 0.9rem;
  color: #1A2B3C;
}
.totals-row:last-child { border-bottom: none; }
.totals-label,
.totals-row .label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #5A6E82;
  font-weight: 500;
}
.totals-value,
.totals-row .amount {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.totals-grand .totals-label,
.totals-grand .totals-value,
.totals-row.grand-total {
  font-size: 1.05rem;
  font-weight: 700;
  color: #0B1C2E;
}
.grand-total-value,
.totals-row.grand-total .amount {
  color: #1565C0;
  font-size: 1.15rem;
}
.tax-percent-input {
  width: 64px;
  height: 32px;
  padding: 3px 6px;
  border: 1px solid #C5D0DC;
  border-radius: 5px;
  font-size: 0.85rem;
  text-align: right;
  color: #1A2B3C;
  background: #fff;
}
.tax-percent-input:focus {
  outline: none;
  border-color: #1565C0;
  box-shadow: 0 0 0 2px rgba(21, 101, 192, 0.15);
}
.tax-pct-symbol { color: #5A6E82; font-size: 0.8rem; }

.tax-field { display: inline-flex; align-items: center; gap: 6px; color: #5A6E82; }
.tax-input {
  width: 72px;
  height: 36px;
  padding: 0 8px;
  border: 1px solid #DDE5EE;
  border-radius: 6px;
  font: inherit;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 8px;
}

.info-item .info-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #5A6E82;
  margin-bottom: 4px;
}

.info-item .info-value {
  font-size: 0.95rem;
  color: #1A2B3C;
  font-weight: 500;
  overflow-wrap: anywhere;
}

.format-options { display: flex; gap: 12px; }

.format-option {
  flex: 1;
  border: 2px solid #DDE5EE;
  border-radius: 8px;
  padding: 12px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}

.format-option input[type="radio"] { display: none; }

.format-option:has(input:checked) {
  border-color: #1565C0;
  background: #E3F2FD;
  color: #1565C0;
}

.format-icon { font-size: 1.2rem; font-weight: 800; display: block; margin-bottom: 4px; }
.format-label { font-size: 0.8rem; font-weight: 600; }

.btn-generate { width: 100%; margin-top: 18px; }
.btn-green { background: #2E7D32; color: #fff; border-color: #2E7D32; }
.btn-green:hover { background: #1B5E20; border-color: #1B5E20; }
.btn-danger { background: #C62828; color: #fff; border-color: #C62828; }
.btn-danger:hover { background: #B71C1C; border-color: #B71C1C; }
.btn-sm { padding: 5px 10px; font-size: 0.78rem; }

.nav-group { margin-top: 16px; }
.nav-group-label {
  display: block;
  padding: 6px 14px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #9fb3c8;
}
.nav-sub { padding-left: 22px; font-size: 0.85rem; }

.badge-role-admin { background: #0B1C2E; color: #fff; }
.badge-role-sales { background: #1565C0; color: #fff; }
.badge-role-finance { background: #2E7D32; color: #fff; }
.badge-role-viewer { background: #5A6E82; color: #fff; }
.badge-active { background: #E8F5E9; color: #2E7D32; }
.row-muted td { opacity: 0.55; }
.card {
  background: #fff;
  border: 1px solid #DDE5EE;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(11, 28, 46, 0.05);
}
.section-heading { margin: 0; color: #0B1C2E; }
.inline-form { display: inline; }
.user-form { max-width: 560px; }
code { font-size: 0.85rem; }

.filter-row {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
}
.filter-input { width: 180px; }
.activity-filters { margin-bottom: 20px; }
.activity-count {
  padding: 16px 20px;
  border-bottom: 1px solid #DDE5EE;
  font-size: 0.85rem;
  color: #5A6E82;
}
.activity-time { font-size: 0.8rem; color: #5A6E82; white-space: nowrap; }
.type-pill {
  font-size: 0.75rem;
  color: #5A6E82;
  background: #F4F7FA;
  padding: 3px 8px;
  border-radius: 4px;
}

.activity-timeline { position: relative; padding-left: 28px; }
.activity-timeline::before {
  content: "";
  position: absolute;
  left: 9px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: #DDE5EE;
}
.timeline-item { position: relative; margin-bottom: 20px; }
.timeline-item:last-child { margin-bottom: 0; }
.timeline-dot {
  position: absolute;
  left: -24px;
  top: 4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #1565C0;
  border: 2px solid #fff;
  box-shadow: 0 0 0 2px #DDE5EE;
}
.timeline-content {
  background: #F4F7FA;
  border: 1px solid #DDE5EE;
  border-radius: 8px;
  padding: 10px 14px;
}
.timeline-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.timeline-meta strong { color: #0B1C2E; font-size: 0.875rem; }
.timeline-action {
  font-size: 0.78rem;
  background: #E3F2FD;
  color: #1565C0;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 600;
}
.timeline-time { font-size: 0.78rem; color: #5A6E82; margin-left: auto; }
.timeline-detail { font-size: 0.85rem; color: #5A6E82; }

.action-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
  background: #E3F2FD;
  color: #1565C0;
}
.action-create-quote, .action-create-order, .action-create-user { background: #E8F5E9; color: #2E7D32; }
.action-edit-quote, .action-edit-user { background: #FFF8E1; color: #F57F17; }
.action-invalidate-quote, .action-deactivate-user { background: #FFEBEE; color: #C62828; }
.action-login { background: #F3E5F5; color: #6A1B9A; }
.action-logout { background: #F4F7FA; color: #5A6E82; }
.action-record-payment, .action-issue-billing { background: #E3F2FD; color: #0277BD; }

.preview-panel {
  margin-top: 24px;
  border: 1px solid #DDE5EE;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(11, 28, 46, 0.1);
}
.preview-panel[hidden] { display: none; }
.preview-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  background: #0B1C2E;
  color: #fff;
  font-weight: 600;
  font-size: 0.9rem;
}
.preview-panel iframe { width: 100%; height: 700px; border: none; background: #fff; }
.btn-close {
  background: none;
  border: none;
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
}
.btn-close:hover { background: rgba(255, 255, 255, 0.15); }

.download-dropdown { position: relative; display: inline-block; }
.dropdown { position: relative; }
.dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  background: #fff;
  border: 1px solid #DDE5EE;
  border-radius: 10px;
  box-shadow: 0 6px 20px rgba(11, 28, 46, 0.12);
  min-width: 160px;
  z-index: 100;
  overflow: hidden;
}
.dropdown-menu[hidden] { display: none; }
.dropdown-item {
  display: block;
  padding: 10px 16px;
  font-size: 0.875rem;
  color: #1A2B3C;
  text-decoration: none;
}
.dropdown-item:hover { background: #E3F2FD; color: #1565C0; }

.alert-banner {
  background: #FFEBEE;
  border: 1px solid #C62828;
  border-radius: 8px;
  padding: 12px 16px;
  color: #C62828;
}
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal[hidden] { display: none; }
.modal-card {
  background: #fff;
  border-radius: 12px;
  padding: 32px;
  max-width: 420px;
  width: 100%;
}
.modal-card h3 { margin: 0 0 8px; color: #C62828; }
.modal-card p { color: #5A6E82; font-size: 0.9rem; }
.modal-actions { display: flex; gap: 12px; }
.modal-actions .btn { flex: 1; }
.edit-actions { display: flex; gap: 12px; margin-top: 18px; }
.edit-actions .btn-primary { flex: 1; }

.notes-callout {
  background: #FFF8E1;
  border: 1px solid #FFE082;
  border-radius: 12px;
  padding: 18px 20px;
}

.notif-bell { position: relative; }
.bell-btn {
  position: relative;
  border: 0;
  background: transparent;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 1.2rem;
  line-height: 1;
}
.bell-btn:hover { background: #F4F7FA; }
.bell-badge {
  position: absolute;
  top: 0;
  right: 0;
  background: #C62828;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 99px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}
.bell-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 320px;
  background: #fff;
  border: 1px solid #DDE5EE;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(11, 28, 46, 0.15);
  z-index: 200;
  overflow: hidden;
  color: #1A2B3C;
  text-align: left;
}
.bell-dropdown[hidden] { display: none; }
.bell-header {
  padding: 12px 16px;
  background: #0B1C2E;
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
}
.bell-item {
  display: block;
  padding: 12px 16px;
  border-bottom: 1px solid #DDE5EE;
  text-decoration: none;
}
.bell-item:hover { background: #F4F7FA; }
.bell-item-name { font-size: 0.875rem; font-weight: 600; color: #1A2B3C; }
.bell-item-meta { font-size: 0.78rem; color: #5A6E82; margin-top: 2px; }
.bell-critical .bell-item-name,
.bell-expired .bell-item-name { color: #C62828; }
.bell-warning .bell-item-name { color: #F57F17; }
.bell-view-all {
  display: block;
  padding: 10px 16px;
  text-align: center;
  font-size: 0.8rem;
  color: #1565C0;
  font-weight: 600;
  text-decoration: none;
  background: #E3F2FD;
}
.bell-empty {
  padding: 16px;
  text-align: center;
  color: #5A6E82;
  font-size: 0.85rem;
}

.alert-warning-banner {
  background: #FFF8E1;
  border: 1px solid #F9A825;
  border-left: 4px solid #F9A825;
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 20px;
  font-size: 0.9rem;
  color: #5D4037;
}
.alert-warning-banner a { color: #C62828; font-weight: 600; margin-left: 8px; }
.tab-badge {
  display: inline-block;
  background: #C62828;
  color: #fff;
  font-size: 0.65rem;
  padding: 1px 5px;
  border-radius: 99px;
  margin-left: 4px;
  font-weight: 700;
}
.tab.active .tab-badge { background: #fff; color: #C62828; }

.warranty-progress { margin-top: 20px; }
.warranty-progress-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: #5A6E82;
  margin-bottom: 6px;
}
.warranty-progress-bar {
  height: 10px;
  background: #E3F2FD;
  border-radius: 99px;
  overflow: hidden;
}
.warranty-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #1565C0, #42A5F5);
  border-radius: 99px;
}
.warranty-remaining {
  text-align: center;
  font-size: 0.85rem;
  margin: 6px 0 0;
  color: #1565C0;
  font-weight: 600;
}
.warranty-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.warranty-head h2 { margin: 0 0 6px; color: #0B1C2E; }
.warranty-head .badge { font-size: 0.95rem; padding: 8px 14px; }
.warranty-notes {
  white-space: pre-line;
  font-size: 0.875rem;
  color: #1A2B3C;
  background: #F4F7FA;
  padding: 14px;
  border-radius: 8px;
  margin-bottom: 16px;
  border: 1px solid #DDE5EE;
}
.form-section-card form .btn { margin-top: 16px; }
.form-section-card .quote-actions form .btn { margin-top: 0; }
.cell-sub { font-size: 0.8rem; color: #5A6E82; margin-top: 2px; }
.days-expired, .days-critical { color: #C62828; font-weight: 700; }
.days-warning { color: #F57F17; font-weight: 600; }
.days-ok { color: #2E7D32; }
.page-back { margin: 0 0 12px; }
.page-back a { color: #1565C0; font-weight: 600; text-decoration: none; }

.section-title-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.section-title-row .form-section-title { margin-bottom: 0; }
.section-title-row .help { margin: 0; }
.terms-textarea {
  width: 100%;
  font-family: inherit;
  font-size: 0.875rem;
  line-height: 1.6;
  color: #1A2B3C;
  background: #FAFBFC;
  border: 1.5px solid #C5D0DC;
  border-radius: 8px;
  padding: 12px 14px;
  resize: vertical;
}
.terms-textarea:focus {
  outline: none;
  border-color: #1565C0;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(21, 101, 192, 0.12);
}
.terms-display {
  font-size: 0.875rem;
  line-height: 1.8;
  color: #1A2B3C;
  white-space: pre-line;
  background: #F4F7FA;
  border: 1px solid #DDE5EE;
  border-radius: 8px;
  padding: 14px 16px;
}
.alert-success-banner {
  background: #E8F5E9;
  border: 1px solid #A5D6A7;
  border-left: 4px solid #2E7D32;
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 20px;
  font-size: 0.9rem;
  color: #1B5E20;
  font-weight: 500;
}

@media (max-width: 900px) {
  .info-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 800px) {
  .form-grid-2,
  .form-grid-3,
  .quote-columns,
  .info-grid { grid-template-columns: 1fr; }
  .form-section-card { padding: 18px 14px; }
  .format-options { flex-direction: column; }
  .totals-box { align-items: stretch; }
  .totals-row { justify-content: space-between; }
}
