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

:root {
  --navy-950: #0B1220;
  --navy-900: #101A2E;
  --navy-800: #17233C;
  --navy-700: #202F4E;
  --cyan: #35D0BA;
  --cyan-dim: #1E8C7C;
  --amber: #F5A623;
  --red: #E5484D;
  --bg: #F4F6F8;
  --card: #FFFFFF;
  --line: #E3E7EC;
  --text: #172033;
  --text-dim: #6B7686;
  --radius: 10px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}
h1, h2, h3, .brand-name { font-family: 'Space Grotesk', sans-serif; }
.mono, table td.num, .kpi-value, .price { font-family: 'IBM Plex Mono', monospace; }

.hidden { display: none !important; }

/* ---------- LOGIN ---------- */
.login-screen {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(circle at 15% 15%, rgba(53,208,186,0.18), transparent 38%),
    radial-gradient(circle at 82% 18%, rgba(245,166,35,0.16), transparent 36%),
    radial-gradient(circle at 50% 90%, rgba(255,255,255,0.08), transparent 20%),
    linear-gradient(180deg, #0A1220 0%, #121F35 100%);
}
.login-card {
  background: rgba(13, 24, 44, 0.92);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 24px;
  padding: 44px 40px;
  width: min(420px, calc(100vw - 40px));
  backdrop-filter: blur(20px);
  box-shadow: 0 32px 80px rgba(0,0,0,0.35);
}
.login-brand { text-align: center; margin-bottom: 28px; }
.login-logo {
  width: 68px; height: 68px; border-radius: 18px;
  background: #fff;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 20px;
  overflow: hidden;
  box-shadow: 0 8px 20px rgba(0,0,0,0.18);
}
.login-logo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.login-card h1 { color: #fff; font-size: 24px; margin: 0 0 6px; }
.login-sub { color: #B8C1D1; font-size: 13px; margin: 0; letter-spacing: 0.08em; text-transform: uppercase; }
#login-form label { display: block; color: #D1DCEB; font-size: 12px; margin-bottom: 16px; }
#login-form input {
  width: 100%; margin-top: 8px; padding: 12px 14px;
  background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.10); border-radius: 12px;
  color: #F8FAFC; font-size: 14px;
  transition: border-color 180ms ease, box-shadow 180ms ease;
}
#login-form input::placeholder { color: rgba(255,255,255,0.55); }
#login-form input:focus { outline: none; border-color: rgba(53,208,186,0.8); box-shadow: 0 0 0 4px rgba(53,208,186,0.12); }
.error-msg { color: var(--red); font-size: 12px; min-height: 18px; margin-bottom: 8px; }
.btn-primary { background: linear-gradient(135deg, var(--cyan), var(--cyan-dim)); color: var(--navy-950); box-shadow: 0 12px 24px rgba(53,208,186,0.18); }
.btn-primary:hover { background: linear-gradient(135deg, #4EE0CA, #33B69C); }
.login-hint {
  margin-top: 20px;
  color: #A7C4D9;
  font-size: 13px;
  text-align: center;
  line-height: 1.5;
}
.login-hint strong { color: #fff; }
.login-logo.small { width: 34px; height: 34px; margin: 0; border-radius: 9px; box-shadow: none; }
.login-card h1 { color: #fff; font-size: 20px; margin: 0 0 4px; }
.login-sub { color: var(--text-dim); font-size: 12px; margin: 0; letter-spacing: 0.03em; text-transform: uppercase; }
#login-form label { display: block; color: #B8C1D1; font-size: 12px; margin-bottom: 14px; }
#login-form input {
  width: 100%; margin-top: 6px; padding: 10px 12px;
  background: var(--navy-800); border: 1px solid var(--navy-700); border-radius: 8px;
  color: #fff; font-size: 14px;
}
#login-form input:focus { outline: none; border-color: var(--cyan); }
.error-msg { color: var(--red); font-size: 12px; min-height: 16px; margin-bottom: 8px; }

/* ---------- BUTTONS ---------- */
.btn {
  border: none; border-radius: 8px; padding: 9px 16px; font-size: 13px; font-weight: 600;
  cursor: pointer; font-family: inherit;
}
.btn-primary { background: var(--cyan); color: var(--navy-950); }
.btn-primary:hover { background: #4EE0CA; }
.btn-secondary { background: var(--navy-800); color: #fff; }
.btn-danger { background: #FDEDED; color: var(--red); }
.btn-outline { background: transparent; border: 1px solid var(--line); color: var(--text); }
.btn-block { width: 100%; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.link-btn {
  background: none; border: none; color: #8FA1BD; font-size: 12px; cursor: pointer;
  text-align: left; padding: 6px 0;
}
.link-btn:hover { color: #fff; }

/* ---------- APP SHELL ---------- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px; background: var(--navy-950); color: #fff;
  display: flex; flex-direction: column; padding: 20px 14px; flex-shrink: 0;
}
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 20px; }
.brand-name { font-size: 14px; font-weight: 600; color: #fff; }
.brand-sub { font-size: 11px; color: var(--cyan); text-transform: capitalize; }
.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-item {
  color: #B8C1D1; text-decoration: none; padding: 10px 12px; border-radius: 8px;
  font-size: 13px; font-weight: 500;
}
.nav-item:hover { background: var(--navy-800); color: #fff; }
.nav-item.active { background: var(--navy-800); color: var(--cyan); }
.sidebar-footer { border-top: 1px solid var(--navy-800); padding-top: 12px; margin-top: 12px; }
.current-user { color: #fff; font-size: 12px; font-weight: 600; margin-bottom: 4px; }
.company-switcher {
  width: 100%; margin-bottom: 10px; padding: 6px 8px; font-size: 12px; font-family: inherit;
  background: var(--navy-800); border: 1px solid var(--navy-700); border-radius: 6px; color: #fff;
}

/* ---------- COMPANY PICKER SCREEN ---------- */
.company-picker-list { display: flex; flex-direction: column; gap: 10px; }
.company-picker-item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--navy-800); border: 1px solid var(--navy-700); border-radius: 12px;
  padding: 14px 16px; color: #fff; font-size: 14px; font-weight: 600;
  cursor: pointer; text-align: left; width: 100%; font-family: inherit;
}
.company-picker-item:hover { border-color: var(--cyan); background: var(--navy-700); }
.company-picker-item span.arrow { color: var(--cyan); font-weight: 700; }

.main { flex: 1; padding: 28px 32px; max-width: 1200px; }

/* ---------- COMMON ---------- */
.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 22px; }
.page-header h2 { margin: 0; font-size: 20px; }
.page-header p { margin: 4px 0 0; color: var(--text-dim); font-size: 13px; }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px;
}

.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 24px; }
.kpi-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.kpi-label { font-size: 11px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 8px; }
.kpi-value { font-size: 22px; font-weight: 600; }
.kpi-value.positive { color: var(--cyan-dim); }
.kpi-value.negative { color: var(--red); }
.kpi-sub { font-size: 11px; color: var(--text-dim); margin-top: 4px; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.03em;
  color: var(--text-dim); border-bottom: 1px solid var(--line); padding: 8px 10px;
}
tbody td { padding: 10px; border-bottom: 1px solid var(--line); }
tbody tr:hover { background: #FAFBFC; }
td.num, th.num { text-align: right; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.badge-green { background: #E4F9F4; color: var(--cyan-dim); }
.badge-amber { background: #FDF3E2; color: #B4740E; }
.badge-red { background: #FDEDED; color: var(--red); }
.badge-gray { background: #EEF1F4; color: var(--text-dim); }

.toolbar { display: flex; gap: 10px; margin-bottom: 16px; align-items: center; flex-wrap: wrap; }
.toolbar input, .toolbar select {
  padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; font-family: inherit;
}
.spacer { flex: 1; }

form.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
form.form-grid label { grid-column: span 1; font-size: 12px; color: var(--text-dim); font-weight: 600; }
form.form-grid label.full { grid-column: span 2; }
form.form-grid input, form.form-grid select, form.form-grid textarea {
  width: 100%; margin-top: 6px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; font-family: inherit;
}
form.form-grid textarea { resize: vertical; line-height: 1.5; }
.form-actions { grid-column: span 2; display: flex; gap: 10px; justify-content: flex-end; margin-top: 6px; }

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(11,18,32,0.5);
  display: flex; align-items: center; justify-content: center; z-index: 50;
}
.modal-content {
  background: #fff; border-radius: 14px; padding: 26px 28px; width: 460px; max-width: 92vw;
  max-height: 88vh; overflow-y: auto; box-shadow: 0 30px 80px rgba(0,0,0,0.3);
}
.modal-content h3 { margin-top: 0; }

.toast {
  position: fixed; top: 20px; right: 24px; background: var(--navy-950); color: #fff;
  padding: 12px 18px; border-radius: 8px; font-size: 13px; z-index: 100; box-shadow: 0 10px 30px rgba(0,0,0,0.25);
}
.toast.error { background: var(--red); }
.toast.success { background: var(--cyan-dim); }

.empty-state { text-align: center; padding: 50px 20px; color: var(--text-dim); }

.cart-row { display: flex; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.cart-row .name { flex: 1; font-size: 13px; }
.cart-row input { width: 60px; padding: 6px; border: 1px solid var(--line); border-radius: 6px; }

.section-title { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; color: var(--text-dim); margin: 24px 0 10px; }

@media (max-width: 800px) {
  .app-shell { flex-direction: column; }
  .sidebar { width: 100%; flex-direction: row; overflow-x: auto; }
  .nav { flex-direction: row; }
  .main { padding: 16px; }
  form.form-grid { grid-template-columns: 1fr; }
  form.form-grid label.full, .form-actions { grid-column: span 1; }
}

.form-grid .full { grid-column: 1 / -1; }
.badge-green { background: #e7f7ed; color: #13804a; }
.badge-red { background: #fde8e8; color: #c62828; }
.badge-amber { background: #fff6de; color: #a16400; }

/* ========== WARRANTY MODULE ========== */
.warranty-page {
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.warranty-tab-btn {
  padding: 10px 16px;
  border: none;
  background: none;
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  position: relative;
  transition: color 180ms ease;
}

.warranty-tab-btn:hover {
  color: var(--text);
}

.warranty-tab-btn.active {
  color: var(--cyan);
}

.warranty-tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: -10px;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--cyan);
  border-radius: 2px 2px 0 0;
}

.warranty-tab-content {
  animation: slideIn 0.2s ease;
}

@keyframes slideIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.warranty-tab-content.hidden {
  display: none;
}

.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.badge-blue { background: #e3f2fd; color: #0d47a1; }
.badge-cyan { background: #e0f7f4; color: #00695c; }
.badge-yellow { background: #fff9e6; color: #f57f17; }
.badge-orange { background: #ffe8d6; color: #e65100; }
.badge-purple { background: #f3e5f5; color: #6a1b9a; }
.badge-gray { background: #f5f5f5; color: #424242; }
.badge-info { background: #e8f4f8; color: #01579b; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

table thead {
  background: var(--bg);
  border-bottom: 2px solid var(--line);
}

table th {
  padding: 12px;
  text-align: left;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.02em;
}

table td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
}

table tbody tr:hover {
  background: rgba(53, 208, 186, 0.03);
}

table td.empty-state {
  text-align: center;
  color: var(--text-dim);
  padding: 30px 12px;
}

table td.num {
  text-align: right;
}

.modal-backdrop.hidden {
  display: none;
}

#warranty-claim-modal {
  display: flex;
  align-items: center;
  justify-content: center;
}

#warranty-claim-modal .modal-content {
  width: 100%;
  max-width: 600px;
}

/* ---------- SHOWROOM SALES ---------- */
.sales-workspace {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.sales-panel {
  padding: 14px;
  border-radius: 12px;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.05);
}
.sales-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.sales-panel-head h3 { margin: 0; font-size: 16px; }
.sales-label {
  display: block;
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 8px;
  font-weight: 600;
}
.sales-input {
  width: 100%;
  margin-top: 5px;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
  background: #FCFEFF;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.sales-input:focus {
  outline: none;
  border-color: #2CA58D;
  box-shadow: 0 0 0 3px rgba(44, 165, 141, 0.12);
}
.sales-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.sales-form-grid .sales-full { grid-column: 1 / -1; }
.sales-customer-panel {
  background: linear-gradient(180deg, #FFFFFF 0%, #F8FCFB 100%);
}
.sales-customer-row {
  display: grid;
  grid-template-columns: 1.1fr 1fr 2fr 1.1fr;
  gap: 14px;
  align-items: end;
}
.sales-customer-address { grid-column: span 1; }
.sales-helper-text {
  margin: 0 0 10px 0;
  font-size: 12px;
  color: var(--text-dim);
}
.sales-quick-tips {
  margin-top: 10px;
  border: 1px solid #DCF3EE;
  background: #F3FBF9;
  border-radius: 10px;
  padding: 10px;
  display: grid;
  gap: 7px;
  font-size: 12px;
  color: #0F172A;
}
.sales-quick-tips i {
  color: #0E7666;
  margin-right: 5px;
}
.sales-metrics {
  margin-top: 10px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
  display: grid;
  gap: 8px;
}
.sales-metrics .k {
  display: block;
  color: var(--text-dim);
  font-size: 11px;
}
.sales-metrics .v {
  display: block;
  margin-top: 2px;
  font-weight: 600;
}
.sales-center-panel { min-height: 320px; }
.sales-shortcuts-hint { font-size: 11px; color: var(--text-dim); }
.sales-scan-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-bottom: 10px;
}
.sales-scan-input {
  width: 100%;
  font-size: 18px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 2px solid var(--cyan);
  outline: none;
}
.sales-scan-input:focus {
  box-shadow: 0 0 0 4px rgba(53, 208, 186, 0.16);
}
.sales-search-results {
  max-height: 180px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-bottom: 10px;
  background: #fff;
}
.sales-search-item {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 8px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.sales-search-item:hover { background: #F7FAFC; }
.sales-product-thumb {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: #E9F7F4;
  color: #0E7666;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}
.sales-search-title { font-weight: 600; }
.sales-search-sub { font-size: 11px; color: var(--text-dim); }
.sales-table-wrap {
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}
.sales-grid-table { font-size: 14px; }
.sales-grid-table th, .sales-grid-table td { padding: 12px 10px; }
.sales-grid-table tbody input {
  width: 84px;
  padding: 8px 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  font-size: 13px;
  font-family: inherit;
}
.sales-grid-table tbody input:focus {
  outline: none;
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(53, 208, 186, 0.12);
}
.sales-row-selected { background: #ECF8F5; }
.sales-summary-row {
  display: flex;
  justify-content: space-between;
  margin: 5px 0;
  font-size: 13px;
}
.sales-grand {
  padding-top: 8px;
  margin-top: 6px;
  border-top: 1px solid var(--line);
  font-size: 16px;
}
.sales-grand-band {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 12px 0;
  padding: 12px 14px;
  background: linear-gradient(135deg, var(--navy-950), var(--navy-900));
  border-radius: 10px;
  color: #fff;
}
.sales-grand-band span { font-size: 12px; color: #B8C1D1; text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; }
.sales-grand-band strong { font-size: 22px; color: var(--cyan); }
.sales-cart-count-badge {
  font-size: 11px;
  font-weight: 700;
  color: var(--cyan-dim);
  background: #E4F9F4;
  padding: 2px 9px;
  border-radius: 20px;
  margin-left: 8px;
  vertical-align: middle;
}
.sales-advanced {
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
}
.sales-advanced summary {
  cursor: pointer;
  font-size: 12px;
  color: var(--text-dim);
  font-weight: 600;
}
.sales-advanced-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 8px;
}
.sales-complete-btn {
  margin-top: 12px;
  padding: 12px;
  font-size: 15px;
}

.sales-summary-bar {
  display: grid;
  grid-template-columns: 1fr 1.2fr 1fr auto;
  gap: 20px;
  align-items: start;
}
.sales-summary-col { min-width: 0; }
.sales-summary-grand-col { display: flex; flex-direction: column; }
.sales-summary-action-col { display: flex; align-items: flex-end; height: 100%; }
.sales-summary-action-col .sales-complete-btn { margin-top: 0; width: 220px; }

@media (max-width: 1100px) {
  .sales-customer-row { grid-template-columns: 1fr 1fr; }
  .sales-customer-address { grid-column: 1 / -1; }
  .sales-summary-bar { grid-template-columns: 1fr 1fr; }
  .sales-summary-action-col { align-items: stretch; margin-top: 4px; }
  .sales-summary-action-col .sales-complete-btn { width: 100%; }
}
@media (max-width: 700px) {
  .sales-customer-row { grid-template-columns: 1fr; }
  .sales-summary-bar { grid-template-columns: 1fr; }
}

/* ---------- MODAL WIDE VARIANT ---------- */
.modal-content.modal-wide { width: 760px; max-width: 96vw; }

/* ---------- PURCHASE ITEMS (also reused by Quotation items) ---------- */
.purchase-items-panel, .quotation-items-panel { background: #FBFCFD; }
.purchase-items-head {
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px;
}
.purchase-item-card {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 12px;
  background: #fff;
}
.purchase-item-card label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: 0;
}
.purchase-item-card > label input {
  width: 100%; margin-top: 6px; padding: 9px 10px;
  border: 1px solid var(--line); border-radius: 8px; font-size: 13px; font-family: inherit;
}
.remove-item-btn {
  position: absolute; top: 10px; right: 10px;
  width: 24px; height: 24px; border-radius: 6px;
  background: none; border: none; color: var(--text-dim);
  cursor: pointer; font-size: 14px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
}
.remove-item-btn:hover { background: #FDEDED; color: var(--red); }
.purchase-item-search { position: relative; }
.purchase-item-suggest {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
  max-height: 240px; overflow: auto; z-index: 30;
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.14);
}
.purchase-item-suggest-row { padding: 8px 12px; cursor: pointer; border-bottom: 1px solid var(--line); }
.purchase-item-suggest-row:last-child { border-bottom: none; }
.purchase-item-suggest-row:hover { background: #F3FBF9; }
.purchase-item-suggest-name { font-weight: 600; font-size: 13px; }
.purchase-item-suggest-meta { font-size: 11px; color: var(--text-dim); margin-top: 2px; }
.purchase-item-suggest-empty { padding: 10px 12px; font-size: 12px; color: var(--text-dim); }
.purchase-item-linked { min-height: 16px; margin-top: 4px; font-size: 11px; font-weight: 600; color: var(--cyan-dim); }
.purchase-item-fields {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 10px;
}
.purchase-item-fields input {
  width: 100%; margin-top: 4px; padding: 8px 9px;
  border: 1px solid var(--line); border-radius: 7px; font-size: 13px; font-family: inherit;
}
.purchase-item-line-total {
  display: flex; flex-direction: column; justify-content: flex-end;
  font-size: 11px; color: var(--text-dim); font-weight: 600;
}
.purchase-item-line-total strong { font-size: 14px; color: var(--text); margin-top: 4px; }
.purchase-item-serials { margin-top: 12px; display: flex; gap: 8px; align-items: flex-start; }
.purchase-item-serials textarea {
  flex: 1; padding: 8px 9px; border: 1px solid var(--line); border-radius: 7px;
  font-size: 12px; font-family: inherit; resize: vertical;
}
.purchase-summary {
  border-top: 1px solid var(--line);
  margin-top: 6px; padding-top: 10px;
  display: grid; gap: 4px; max-width: 320px; margin-left: auto;
}
.purchase-summary-row { display: flex; justify-content: space-between; font-size: 13px; }
.purchase-summary-grand {
  font-size: 15px; font-weight: 700; color: var(--cyan-dim);
  border-top: 1px dashed var(--line); padding-top: 6px; margin-top: 2px;
}

@media (max-width: 700px) {
  .purchase-item-fields { grid-template-columns: repeat(2, 1fr); }
  .purchase-item-line-total { grid-column: span 2; flex-direction: row; justify-content: space-between; align-items: center; }
  .purchase-summary { max-width: 100%; }
}
@media (min-width: 701px) and (max-width: 900px) {
  .purchase-item-fields { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- SALES CART: EDITABLE WARRANTY ---------- */
.sales-warranty-edit {
  font-size: 12px;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 4px;
  background: var(--bg);
  border-radius: 6px;
  padding: 4px 8px;
  width: fit-content;
}
.sales-warranty-edit input {
  width: 52px; padding: 4px 6px; border: 1px solid var(--line); border-radius: 5px; font-size: 12px; font-family: inherit;
}
.sales-warranty-edit input:focus { outline: none; border-color: var(--cyan); }

/* ---------- WARRANTY LOOKUP ---------- */
.warranty-lookup-card {
  margin-bottom: 20px;
  background: linear-gradient(180deg, #FFFFFF 0%, #F8FCFB 100%);
}
.warranty-lookup-head h3 { margin: 0 0 4px; font-size: 16px; }
.warranty-lookup-head p { margin: 0 0 14px; font-size: 12px; color: var(--text-dim); max-width: 640px; }

.warranty-lookup-scan-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 6px 6px 14px;
  background: #fff;
  border: 2px solid var(--cyan);
  border-radius: 12px;
  box-shadow: 0 0 0 4px rgba(53, 208, 186, 0.08);
}
.warranty-lookup-scan-icon { font-size: 18px; color: var(--cyan-dim); }
.warranty-lookup-scan-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 15px;
  padding: 10px 0;
  background: transparent;
  font-family: inherit;
}
.warranty-lookup-clear-btn {
  border: none; background: var(--bg); color: var(--text-dim);
  width: 26px; height: 26px; border-radius: 50%; cursor: pointer; font-size: 12px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.warranty-lookup-clear-btn:hover { background: #FDEDED; color: var(--red); }
.warranty-lookup-scan-row .btn-primary { flex-shrink: 0; }

.warranty-lookup-placeholder {
  margin-top: 14px;
  padding: 34px 20px;
  text-align: center;
  color: var(--text-dim);
  font-size: 13px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.warranty-lookup-placeholder-icon { font-size: 28px; color: var(--line); }
.warranty-lookup-placeholder-error { border-color: #F6C9CA; color: var(--red); }
.warranty-lookup-placeholder-error .warranty-lookup-placeholder-icon { color: var(--red); }
.warranty-lookup-spinner {
  width: 22px; height: 22px; border-radius: 50%;
  border: 3px solid var(--line); border-top-color: var(--cyan);
  animation: warranty-spin 0.8s linear infinite;
}
@keyframes warranty-spin { to { transform: rotate(360deg); } }

.warranty-lookup-product {
  margin-top: 16px;
  padding: 12px 14px;
  background: var(--navy-950);
  color: #fff;
  border-radius: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.warranty-lookup-product-name { font-family: 'Space Grotesk', sans-serif; font-size: 16px; font-weight: 600; }
.warranty-lookup-product-meta { font-size: 12px; color: #B8C1D1; margin-top: 2px; }

.warranty-lookup-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.warranty-lookup-chip {
  background: var(--bg); border: 1px solid var(--line); border-radius: 20px;
  padding: 4px 12px; font-size: 11px; color: var(--text);
}

.warranty-lookup-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 14px;
}
.warranty-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  background: #fff;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.04);
}
.warranty-card-vendor { border-top: 3px solid var(--amber); }
.warranty-card-customer { border-top: 3px solid var(--cyan); }
.warranty-card-head { display: flex; justify-content: space-between; align-items: center; }
.warranty-card-head h4 { margin: 0; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; color: var(--text-dim); }
.warranty-card-subtitle { font-size: 11px; color: var(--text-dim); margin-top: 2px; }
.warranty-card-hero { text-align: center; margin: 16px 0 10px; }
.warranty-card-days { font-family: 'IBM Plex Mono', monospace; font-size: 34px; font-weight: 600; line-height: 1; color: var(--text); }
.warranty-card-days.expired { color: var(--red); font-size: 22px; font-family: 'Space Grotesk', sans-serif; }
.warranty-card-days-label { font-size: 11px; color: var(--text-dim); margin-top: 4px; text-transform: uppercase; letter-spacing: 0.03em; }
.warranty-card-bar-track { height: 6px; border-radius: 6px; background: var(--bg); overflow: hidden; }
.warranty-card-bar-fill { height: 100%; border-radius: 6px; transition: width 0.3s ease; }
.warranty-card-bar-fill.ok { background: var(--cyan); }
.warranty-card-bar-fill.mid { background: var(--amber); }
.warranty-card-bar-fill.low { background: #E8833B; }
.warranty-card-bar-fill.expired { background: var(--red); width: 100% !important; }
.warranty-card-meta { margin-top: 12px; display: grid; gap: 5px; }
.warranty-card-row { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; }
.warranty-card-row span { color: var(--text-dim); }
.warranty-card-row strong { text-align: right; }
.warranty-card-empty { display: flex; flex-direction: column; background: var(--bg); box-shadow: none; }
.warranty-card-empty-msg { margin-top: 24px; font-size: 12px; color: var(--text-dim); text-align: center; }

.warranty-lookup-claims { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 12px; }
.warranty-lookup-claims h4 { margin: 0 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.03em; color: var(--text-dim); }
.warranty-lookup-claim-row {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 6px; font-size: 12px;
}
.warranty-lookup-claim-date { margin-left: auto; color: var(--text-dim); }
.warranty-lookup-no-claims { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 12px; font-size: 12px; color: var(--text-dim); }
.warranty-lookup-actions { margin-top: 14px; display: flex; justify-content: flex-end; }

@media (max-width: 700px) {
  .warranty-lookup-grid { grid-template-columns: 1fr; }
  .warranty-lookup-product { flex-direction: column; align-items: flex-start; }
}

/* ---------- SERVICE TICKET MODAL ---------- */
.claim-context-card {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 14px;
  display: grid;
  gap: 6px;
}
.claim-context-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.claim-context-title { font-weight: 700; font-size: 14px; }
.claim-context-sub { font-size: 12px; color: var(--text-dim); }
.claim-open-warning {
  background: #FFF6E2;
  border: 1px solid #F3D9A6;
  color: #8A5A0E;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12px;
  margin-bottom: 14px;
}
.form-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--cyan-dim);
  margin: 4px 0 -4px;
  padding-top: 6px;
  border-top: 1px solid var(--line);
}
.form-grid .form-section-title:first-child { border-top: none; padding-top: 0; }

.condition-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.condition-tag {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  padding: 6px 13px;
  border-radius: 20px;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.condition-tag:hover { border-color: var(--cyan); }
.condition-tag.active { background: var(--cyan); border-color: var(--cyan); color: var(--navy-950); font-weight: 600; }
.condition-other-input {
  width: 100%;
  margin-top: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
}
.claim-problem-textarea { min-height: 100px; font-size: 14px; }
.claim-received-by {
  background: var(--bg) !important;
  color: var(--text) !important;
  font-weight: 600;
  cursor: not-allowed;
}

/* ---------- TICKET PROGRESS TRACKER ---------- */
.ticket-stepper {
  display: flex;
  align-items: flex-start;
  gap: 4px;
  margin: 16px 0;
  overflow-x: auto;
  padding-bottom: 4px;
}
.ticket-step {
  flex: 1;
  min-width: 84px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
}
.ticket-step::before {
  content: '';
  position: absolute;
  top: 13px;
  left: -50%;
  width: 100%;
  height: 2px;
  background: var(--line);
  z-index: 0;
}
.ticket-step:first-child::before { display: none; }
.ticket-step.done::before { background: var(--cyan); }
.ticket-step-dot {
  width: 26px; height: 26px; border-radius: 50%;
  background: #fff; border: 2px solid var(--line); color: var(--text-dim);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; position: relative; z-index: 1;
}
.ticket-step.done .ticket-step-dot { background: var(--cyan); border-color: var(--cyan); color: #fff; }
.ticket-step.current .ticket-step-dot { border-color: var(--cyan); color: var(--cyan-dim); box-shadow: 0 0 0 4px rgba(53, 208, 186, 0.15); }
.ticket-step-label { font-size: 10px; color: var(--text-dim); margin-top: 6px; line-height: 1.2; }
.ticket-step.current .ticket-step-label { color: var(--text); font-weight: 700; }
.ticket-stepper-closed {
  margin: 16px 0; padding: 12px; text-align: center; border-radius: 10px;
  background: var(--bg); color: var(--text-dim); font-size: 13px;
}
.ticket-problem-box {
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 12px; font-size: 13px; margin-top: 8px;
}
.ticket-history { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 12px; }
.ticket-history h4 { margin: 0 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.03em; color: var(--text-dim); }
.ticket-history-row {
  display: flex; gap: 12px; font-size: 12px; padding: 6px 0; border-bottom: 1px solid var(--line);
}
.ticket-history-row:last-child { border-bottom: none; }
.ticket-history-date { color: var(--text-dim); font-family: 'IBM Plex Mono', monospace; flex-shrink: 0; }
.ticket-history-empty { font-size: 12px; color: var(--text-dim); }

@media (max-width: 700px) {
  .ticket-step-label { display: none; }
}

/* ---------- FINANCE MODULE ---------- */
.text-positive { color: var(--cyan-dim); }
.text-negative { color: var(--red); }

.finance-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 18px;
  overflow-x: auto;
}
.finance-tab {
  border: none;
  background: none;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.finance-tab:hover { color: var(--text); }
.finance-tab.active { color: var(--cyan-dim); border-bottom-color: var(--cyan); }

.finance-tab-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-bottom: 14px;
}

.finance-bank-card { cursor: pointer; transition: box-shadow 0.15s ease, transform 0.1s ease; }
.finance-bank-card:hover { box-shadow: 0 8px 22px rgba(15, 23, 42, 0.1); transform: translateY(-1px); }

.finance-reminders-card { margin-top: 20px; }
.finance-reminder-row {
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  margin-top: 8px;
  border-left: 3px solid var(--line);
  background: var(--bg);
}
.finance-reminder-amber { border-left-color: var(--amber); background: #FFF9EE; }
.finance-reminder-red { border-left-color: var(--red); background: #FDF0F0; }

.finance-filter-pill.active { background: var(--cyan); color: var(--navy-950); border-color: var(--cyan); font-weight: 700; }

.finance-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-top: 14px;
}
.finance-calendar-dow {
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding-bottom: 4px;
}
.finance-calendar-month-label { min-width: 110px; text-align: center; display: inline-block; }
.finance-calendar-cell {
  min-height: 68px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px;
  background: #fff;
  cursor: pointer;
  position: relative;
}
.finance-calendar-cell.empty { visibility: hidden; }
.finance-calendar-cell.has-items { border-color: var(--cyan); background: #F3FBF9; }
.finance-calendar-cell:hover { box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08); }
.finance-calendar-date { font-size: 12px; font-weight: 600; color: var(--text-dim); }
.finance-calendar-dot {
  position: absolute;
  bottom: 6px;
  right: 6px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.finance-calendar-dot-green { background: var(--cyan-dim); }
.finance-calendar-dot-amber { background: var(--amber); }
.finance-calendar-dot-red { background: var(--red); }
.finance-calendar-day-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.finance-calendar-day-row:last-child { border-bottom: none; }

@media (max-width: 700px) {
  .finance-calendar-grid { gap: 3px; }
  .finance-calendar-cell { min-height: 46px; padding: 4px; }
  .finance-calendar-dot { width: 16px; height: 16px; font-size: 9px; bottom: 3px; right: 3px; }
}

/* ---------- FULL LEDGER / STATEMENT OF ACCOUNT ---------- */
.ledger-toggle-row { margin: 12px 0; }
.ledger-card { margin-top: 4px; border-top: 3px solid var(--cyan); }
.ledger-summary-row {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  background: var(--bg);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 14px;
  font-size: 13px;
}
.ledger-balance-label { font-size: 11px; color: var(--text-dim); }
.ledger-table-wrap { overflow-x: auto; }
.ledger-note { font-size: 11px; color: var(--red); }

/* ---------- FINANCE: MODE TOGGLE (Pay/Receive, List/Calendar) ---------- */
.finance-mode-toggle {
  display: inline-flex;
  background: var(--bg);
  border-radius: 10px;
  padding: 4px;
  gap: 4px;
  margin-bottom: 16px;
}
.finance-mode-btn {
  border: none;
  background: none;
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
  cursor: pointer;
  border-radius: 7px;
}
.finance-mode-btn:hover { color: var(--text); }
.finance-mode-btn.active { background: #fff; color: var(--cyan-dim); box-shadow: 0 2px 6px rgba(15, 23, 42, 0.08); }

/* ---------- FINANCE: PARTY (VENDOR/CUSTOMER) PAYMENT VIEW ---------- */
.finance-party-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  background: var(--navy-950);
  color: #fff;
  border-radius: 10px;
  padding: 14px 18px;
  margin-top: 14px;
}
.finance-party-name { font-family: 'Space Grotesk', sans-serif; font-size: 17px; font-weight: 600; }
.finance-party-meta { font-size: 12px; color: #B8C1D1; margin-top: 3px; }
.finance-party-balance { text-align: right; }
.finance-party-balance span { display: block; font-size: 11px; color: #B8C1D1; text-transform: uppercase; letter-spacing: 0.03em; }
.finance-party-balance strong { font-size: 20px; color: var(--cyan); }
.finance-party-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 14px;
  align-items: start;
}
.finance-payment-form-card { position: sticky; top: 12px; }

/* ---------- FINANCE: COMPACT TABLE SUBTEXT ---------- */
.finance-subtext { font-size: 11px; color: var(--text-dim); margin-top: 2px; }

@media (max-width: 900px) {
  .finance-party-columns { grid-template-columns: 1fr; }
  .finance-payment-form-card { position: static; }
}

/* ---------- USER PAGE ACCESS ---------- */
.user-page-access-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px;
  margin-top: 6px; padding: 12px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px;
}
.user-page-access-item {
  display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500;
  color: var(--text); text-transform: none; letter-spacing: normal;
}
.user-page-access-item input { width: auto; margin: 0; }
.user-page-access-item:has(input:disabled) { color: var(--text-dim); }

/* ---------- ACCOUNTS & DAY BOOK MODULE ---------- */
.row-voided { opacity: 0.55; }
.row-voided td { text-decoration: line-through; text-decoration-color: var(--text-dim); }
.row-voided .badge { text-decoration: none; }

.daybook-side { border-top: 3px solid transparent; }
.daybook-side-in { border-top-color: var(--cyan); }
.daybook-side-out { border-top-color: var(--red); }
.daybook-side table { font-size: 12.5px; }
.daybook-side td, .daybook-side th { padding: 8px 7px; }

/* ---------- DASHBOARD ---------- */
.dash-hero-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 16px; }
.dash-hero-card {
  background: linear-gradient(135deg, var(--navy-900), var(--navy-800));
  border-radius: 14px; padding: 20px 22px; box-shadow: 0 10px 28px rgba(11, 18, 32, 0.16);
}
.dash-hero-card .kpi-label { color: rgba(255, 255, 255, 0.62); }
.dash-hero-card .kpi-value { font-size: 26px; color: #fff; }
.dash-hero-card .kpi-value.positive { color: var(--cyan); }
.dash-hero-card .kpi-value.negative { color: #FF8A8F; }
.dash-hero-card .kpi-sub { color: rgba(255, 255, 255, 0.55); }

.kpi-trend { display: inline-flex; align-items: center; gap: 2px; font-weight: 700; padding: 1px 7px; border-radius: 10px; font-size: 11px; }
.kpi-trend.trend-up { color: var(--cyan-dim); background: rgba(53, 208, 186, 0.16); }
.kpi-trend.trend-down { color: var(--red); background: rgba(229, 72, 77, 0.14); }
.dash-hero-card .kpi-trend.trend-up { color: var(--cyan); background: rgba(53, 208, 186, 0.18); }
.dash-hero-card .kpi-trend.trend-down { color: #FF8A8F; background: rgba(255, 138, 143, 0.18); }

.dash-two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }
.dash-two-col .card table { margin-top: 8px; }
@media (max-width: 900px) {
  .dash-two-col { grid-template-columns: 1fr; }
}
