/* Ecom Express Packers & Movers - Quotation Software UI */
:root {
  --primary: #173B68;
  --primary-dark: #0E2646;
  --primary-light: #24508A;
  --secondary: #FF7900;
  --secondary-dark: #E06A00;
  --bg: #F4F6F9;
  --text: #202938;
  --muted: #6B778C;
  --white: #FFFFFF;
  --line: #E3E8EF;
  --success: #12935B;
  --danger: #D63D3D;
  --warning: #E59A00;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16,24,40,.05), 0 4px 16px rgba(16,24,40,.06);
  --sidebar-w: 264px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 14.5px; line-height: 1.5;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--secondary-dark); }
h1, h2, h3, h4 { margin: 0 0 .5rem; color: var(--primary); line-height: 1.25; }
code { background: #eef2f7; padding: 1px 6px; border-radius: 5px; font-size: .9em; }
.icon { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.muted { color: var(--muted); }
.text-right { text-align: right; }
.mt-1 { margin-top: .5rem; } .mt-2 { margin-top: 1rem; } .mb-2 { margin-bottom: 1rem; }

/* ---------- Layout ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); background: linear-gradient(180deg, #0B1F3A 0%, #12305A 100%);
  color: #cdd8ea; position: fixed; inset: 0 auto 0 0; z-index: 60; display: flex; flex-direction: column;
  transition: transform .25s ease;
}
.sidebar-brand { padding: 18px 20px 14px; border-bottom: 1px solid rgba(255,255,255,.08); }
.sidebar-brand .logo-chip { background: #fff; border-radius: 10px; padding: 8px 10px; display: block; }
.sidebar-brand img { width: 100%; height: auto; display: block; }
.nav { padding: 14px 12px; flex: 1; overflow-y: auto; }
.nav-label { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: #7f93b3; padding: 12px 12px 6px; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 11px 14px; margin-bottom: 3px; border-radius: 10px;
  color: #cdd8ea; font-weight: 500; transition: background .2s, color .2s, transform .2s;
}
.nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav a.active { background: linear-gradient(90deg, var(--secondary), #FF9A3C); color: #fff; box-shadow: 0 6px 16px rgba(255,121,0,.28); }
.sidebar-foot { padding: 14px 20px; font-size: 12px; color: #7f93b3; border-top: 1px solid rgba(255,255,255,.08); }
.main { margin-left: var(--sidebar-w); flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 40; background: rgba(255,255,255,.92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between;
  padding: 12px 28px; gap: 12px;
}
.topbar-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.topbar h1 { font-size: 19px; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu-toggle { display: none; background: none; border: 0; padding: 6px; color: var(--primary); cursor: pointer; border-radius: 8px; }
.menu-toggle:hover { background: var(--bg); }
.user-menu { position: relative; }
.user-btn { display: flex; align-items: center; gap: 10px; background: none; border: 1px solid var(--line); border-radius: 999px; padding: 5px 14px 5px 5px; cursor: pointer; color: var(--text); font: inherit; }
.user-btn:hover { background: var(--bg); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--primary); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.dropdown { position: absolute; right: 0; top: 48px; min-width: 210px; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 6px; display: none; }
.dropdown.show { display: block; animation: pop .15s ease-out; }
.dropdown a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px; color: var(--text); }
.dropdown a:hover { background: var(--bg); color: var(--primary); }
.dropdown hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }
@keyframes pop { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.content { padding: 28px; max-width: 1400px; width: 100%; margin: 0 auto; }
.backdrop { display: none; position: fixed; inset: 0; background: rgba(8,16,30,.5); z-index: 50; }

/* ---------- Cards / grid ---------- */
.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 22px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.card-head h2, .card-head h3 { margin: 0; font-size: 16px; }
.card-body { padding: 22px; }
.grid { display: grid; gap: 18px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.stat { display: flex; align-items: center; gap: 16px; padding: 20px; }
.stat-icon { width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; background: rgba(23,59,104,.09); color: var(--primary); }
.stat-icon.orange { background: rgba(255,121,0,.12); color: var(--secondary-dark); }
.stat-icon.green { background: rgba(18,147,91,.12); color: var(--success); }
.stat-value { font-size: 26px; font-weight: 700; color: var(--primary); line-height: 1.1; }
.stat-label { color: var(--muted); font-size: 13px; }
.hero {
  background: linear-gradient(120deg, var(--primary) 0%, var(--primary-light) 60%, #2d63a8 100%); color: #fff;
  border-radius: 16px; padding: 28px; margin-bottom: 22px; display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap;
  position: relative; overflow: hidden;
}
.hero::after { content: ''; position: absolute; right: -60px; top: -60px; width: 220px; height: 220px; border-radius: 50%; background: rgba(255,121,0,.25); }
.hero h2 { color: #fff; font-size: 22px; } .hero p { margin: 0; color: #d6e2f5; }
.hero .btn { position: relative; z-index: 1; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 18px; border-radius: 10px;
  border: 1px solid transparent; font: inherit; font-weight: 600; cursor: pointer; transition: all .2s; line-height: 1.2; white-space: nowrap;
  text-decoration: none; background: #fff; color: var(--text);
}
.btn:hover { transform: translateY(-1px); }
.btn:disabled { opacity: .6; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-light); color: #fff; box-shadow: 0 6px 16px rgba(23,59,104,.25); }
.btn-accent { background: var(--secondary); color: #fff; }
.btn-accent:hover { background: var(--secondary-dark); color: #fff; box-shadow: 0 6px 16px rgba(255,121,0,.3); }
.btn-outline { border-color: var(--line); background: #fff; color: var(--primary); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger { background: var(--danger); color: #fff; } .btn-danger:hover { background: #b83030; color: #fff; }
.btn-info { background: #0e8ba6; color: #fff; } .btn-info:hover { background: #0b7389; color: #fff; }
.btn-success { background: var(--success); color: #fff; } .btn-success:hover { background: #0e7a4b; color: #fff; }
.btn-warning { background: #f2b01e; color: #3b2a00; } .btn-warning:hover { background: #e0a010; color: #3b2a00; }
.btn-sm { padding: 7px 11px; font-size: 13px; border-radius: 8px; }
.btn-block { display: flex; width: 100%; margin-top: 16px; padding: 12px; }
.btn-icon { padding: 8px; border-radius: 8px; }
.btn-group { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- Forms ---------- */
.form-label, label { display: block; font-weight: 600; font-size: 13px; margin: 0 0 6px; color: var(--text); }
.form-control, .form-grid input[type=text], .form-grid input[type=email], .form-grid input[type=number], .form-grid input[type=password], .form-grid input[type=tel], .form-grid select, .form-grid textarea,
.charges input[type=text], .charges input[type=number], .charges select {
  width: 100%; padding: 10px 12px; border: 1px solid #cfd7e3; border-radius: 10px; background: #fff; color: var(--text); font: inherit; transition: border-color .2s, box-shadow .2s;
}
.form-control:focus, .form-grid input:focus, .form-grid select:focus, .form-grid textarea:focus, .charges input:focus, .charges select:focus {
  outline: 0; border-color: var(--secondary); box-shadow: 0 0 0 3px rgba(255,121,0,.15);
}
textarea { resize: vertical; min-height: 84px; }
.form-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 16px 18px; }
.col-3 { grid-column: span 3; } .col-4 { grid-column: span 4; } .col-6 { grid-column: span 6; } .col-8 { grid-column: span 8; } .col-12 { grid-column: span 12; }
.f_req, .req { color: var(--danger); }
.hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.input-icon { position: relative; }
.input-icon input { padding-right: 44px !important; }
.input-icon button { position: absolute; right: 4px; top: 4px; bottom: 4px; width: 38px; border: 0; border-radius: 8px; background: transparent; color: var(--primary); cursor: pointer; display: grid; place-items: center; }
.input-icon button:hover { background: var(--bg); }
.input-icon input[type=date] { position: absolute; opacity: 0; pointer-events: none; width: 1px; height: 1px; right: 0; bottom: 0; }
.check { display: flex; align-items: center; gap: 10px; font-weight: 500; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--secondary); }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 10px; background: #fafbfd; }

/* ---------- Charges table (quotation form) ---------- */
.charges { width: 100%; border-collapse: separate; border-spacing: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.charges th { background: var(--primary); color: #fff; text-align: left; padding: 12px 14px; font-size: 13px; letter-spacing: .04em; }
.charges th:nth-child(2) { background: var(--primary); } .charges th:nth-child(3) { background: var(--secondary); }
.charges td { padding: 9px 12px; border-top: 1px solid var(--line); vertical-align: middle; }
.charges tr:nth-child(even) td { background: #fafbfd; }
.charges td:first-child { width: 34%; font-weight: 500; }
.charges td label { margin: 0; }
.charges td:first-child input { margin-top: 6px; }
.charges .total-field { font-weight: 700; background: #fff7ee !important; border-color: #ffd6a8; }
.charges tr.sum-row td { background: #eef3fa !important; }
.charges .inline-row { display: flex; gap: 8px; margin: 6px 0; }
.fill-bar { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-start; margin-bottom: 14px; }
.extras-box { border: 1px dashed #c3cfe0; border-radius: 12px; padding: 16px; background: #fbfcfe; }
.calc-preview { margin-top: 12px; background: #fff; border: 1px solid var(--line); border-radius: 10px; }
.calc-preview table { width: 100%; border-collapse: collapse; }
.calc-preview th, .calc-preview td { padding: 8px 12px; text-align: right; border-bottom: 1px solid var(--line); }
.calc-preview th:first-child, .calc-preview td:first-child { text-align: left; }
.calc-preview tr:last-child td { border-bottom: 0; font-weight: 700; color: var(--primary); }
.form-actions { display: flex; gap: 12px; flex-wrap: wrap; justify-content: flex-end; margin-top: 8px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; }
table.data th { text-align: left; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 12px 16px; background: #f8fafc; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data td { padding: 14px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data tr:hover td { background: #fafcff; }
.qno { font-weight: 700; color: var(--primary); white-space: nowrap; }
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: #e8eef7; color: var(--primary); }
.badge.legacy { background: #f1f3f6; color: #5b667a; }
.badge.new { background: rgba(255,121,0,.14); color: var(--secondary-dark); }
.search-bar { display: flex; gap: 10px; flex-wrap: wrap; }
.search-bar .form-control { min-width: 260px; }
.pagination { display: flex; gap: 6px; flex-wrap: wrap; padding: 16px 22px; align-items: center; justify-content: space-between; }
.pagination .pages { display: flex; gap: 6px; flex-wrap: wrap; }
.pagination a, .pagination span.cur { padding: 7px 12px; border-radius: 8px; border: 1px solid var(--line); background: #fff; }
.pagination span.cur { background: var(--primary); color: #fff; border-color: var(--primary); }
.empty { text-align: center; padding: 48px 20px; color: var(--muted); }

/* ---------- Alerts / toast / modal ---------- */
.alert { padding: 12px 16px; border-radius: 10px; margin-bottom: 14px; border: 1px solid; font-size: 14px; }
.alert-success { background: #eafaf2; border-color: #b9ead2; color: #0b6a42; }
.alert-danger { background: #fdeeee; border-color: #f5c3c3; color: #9a2020; }
.alert-warning { background: #fff7e6; border-color: #ffe0a3; color: #7a5200; }
.alert-info { background: #eaf3ff; border-color: #bcd6f7; color: #174a86; }
.toast-stack { position: fixed; top: 76px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast { min-width: 260px; max-width: 360px; background: #fff; border-left: 4px solid var(--primary); border-radius: 10px; box-shadow: 0 10px 30px rgba(16,24,40,.18); padding: 12px 16px; animation: slidein .25s ease-out; display: flex; gap: 10px; align-items: flex-start; }
.toast.success { border-color: var(--success); } .toast.danger { border-color: var(--danger); } .toast.warning { border-color: var(--warning); }
@keyframes slidein { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: none; } }
.modal-back { position: fixed; inset: 0; background: rgba(8,16,30,.55); display: none; align-items: center; justify-content: center; z-index: 300; padding: 16px; }
.modal-back.show { display: flex; animation: fade .15s ease-out; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal { background: #fff; border-radius: 16px; width: 100%; max-width: 440px; box-shadow: 0 24px 60px rgba(8,16,30,.35); overflow: hidden; }
.modal-head { padding: 20px 24px 6px; } .modal-head h3 { margin: 0; font-size: 18px; }
.modal-body { padding: 6px 24px 18px; color: var(--muted); }
.modal-foot { padding: 14px 24px 20px; display: flex; gap: 10px; justify-content: flex-end; }

/* ---------- Auth (login / installer) ---------- */
.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 20px; background:
  radial-gradient(900px 500px at 85% -10%, rgba(255,121,0,.28), transparent 60%),
  radial-gradient(800px 500px at -10% 110%, rgba(36,80,138,.7), transparent 60%),
  linear-gradient(135deg, #0B1F3A, #173B68); }
.auth-card { width: 100%; max-width: 430px; background: #fff; border-radius: 20px; padding: 34px 32px; box-shadow: 0 30px 80px rgba(5,12,26,.45); }
.auth-logo { text-align: center; margin-bottom: 14px; } .auth-logo img { max-width: 260px; width: 100%; height: auto; }
.auth-title { text-align: center; font-size: 22px; margin-bottom: 4px; }
.auth-sub { text-align: center; color: var(--muted); margin: 0 0 18px; }
.auth-card .form-control { margin-bottom: 14px; }
.auth-foot { text-align: center; color: var(--muted); font-size: 12px; margin-top: 18px; }
.install-log { padding-left: 18px; color: var(--text); } .install-log li { margin-bottom: 4px; }
.pw-row { position: relative; } .pw-row button { position: absolute; right: 6px; top: 6px; border: 0; background: none; color: var(--muted); cursor: pointer; padding: 6px; }

/* ---------- Settings ---------- */
.upload-box { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.upload-preview { width: 200px; height: 110px; border: 1px dashed #c3cfe0; border-radius: 12px; display: grid; place-items: center; background: #fff; padding: 8px; }
.upload-preview img { max-width: 100%; max-height: 100%; }
.upload-preview.sig { background: repeating-conic-gradient(#f4f6f9 0% 25%, #fff 0% 50%) 50% / 16px 16px; }
.profile-row { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.profile-row:last-child { border-bottom: 0; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } .col-4 { grid-column: span 6; } .col-3 { grid-column: span 6; } }
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: none; box-shadow: 10px 0 40px rgba(0,0,0,.35); }
  .backdrop.show { display: block; }
  .main { margin-left: 0; }
  .menu-toggle { display: inline-flex; }
  .content { padding: 18px 14px; }
  .topbar { padding: 10px 14px; }
  .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .col-4, .col-6, .col-8, .col-3 { grid-column: span 12; }
  .user-name { display: none; }
}
@media (max-width: 560px) {
  .grid-4 { grid-template-columns: 1fr; }
  .card-body { padding: 16px; }
  .charges td, .charges th { padding: 8px; }
  .charges td:first-child { width: 36%; font-size: 13px; }
  .form-actions .btn, .fill-bar .btn { flex: 1; }
  .hero { padding: 20px; }
  .search-bar .form-control { min-width: 0; width: 100%; }
  .toast-stack { left: 12px; right: 12px; } .toast { max-width: none; }
}
@media print { .sidebar, .topbar, .btn { display: none !important; } .main { margin: 0; } }
