:root {
  --bg: #0e1117;
  --surface: #161b27;
  --surface2: #1d2535;
  --border: #2a3349;
  --accent: #4fc3f7;
  --accent2: #81d4fa;
  --gold: #f0b429;
  --green: #4caf7d;
  --red: #e05c5c;
  --amber: #f0a030;
  --text: #e8edf5;
  --muted: #7a8ba8;
  --radius: 10px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Outfit', sans-serif;
  font-size: 14px;
  min-height: 100vh;
}

/* ── HEADER ── */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 32px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky; top: 0; z-index: 100;
}
.menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--muted);
  border-radius: 8px;
  font-size: 18px;
  cursor: pointer;
}
.logo { font-family: 'DM Serif Display', serif; font-size: 1.5rem; color: var(--accent); letter-spacing: -0.5px; }
.logo span { color: var(--gold); font-style: italic; }
.nav { display: flex; gap: 4px; }
.nav-btn {
  background: none; border: none; color: var(--muted); cursor: pointer;
  font-family: 'Outfit', sans-serif; font-size: 13px; font-weight: 500;
  padding: 8px 18px; border-radius: 8px; transition: all .2s;
}
.nav-btn:hover { background: var(--surface2); color: var(--text); }
.nav-btn.active { background: var(--accent); color: #000; font-weight: 600; }

/* ── LAYOUT ── */
main { padding: 32px; max-width: 1400px; margin: 0 auto; }

.page { display: none; }
.page.active { display: block; animation: fadein .25s ease; }
@keyframes fadein { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:translateY(0); } }

/* ── DASHBOARD ── */
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px,1fr)); gap: 16px; margin-bottom: 32px; }
.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 20px;
  position: relative; overflow: hidden;
}
.kpi::before {
  content:''; position:absolute; top:0; left:0; right:0; height:3px;
}
.kpi.blue::before { background: var(--accent); }
.kpi.gold::before { background: var(--gold); }
.kpi.green::before { background: var(--green); }
.kpi.red::before { background: var(--red); }
.kpi-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); margin-bottom: 8px; }
.kpi-value { font-family: 'DM Serif Display', serif; font-size: 2.2rem; color: var(--text); }
.kpi-sub { font-size: 11px; color: var(--muted); margin-top: 4px; }

.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
@media (max-width: 900px) {
  .dash-grid { grid-template-columns: 1fr; }
  .menu-toggle { display: inline-flex; }
  .nav { display: none; flex-direction: column; width: 100%; gap: 6px; }
  .nav.open { display: flex; }
  .nav-btn { padding: 10px; text-align: left; }
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.panel-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.panel-title { font-weight: 600; font-size: 13px; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); }
.panel-body { padding: 0; }

.mini-job {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  cursor: pointer; transition: background .15s;
}
.mini-job:last-child { border-bottom: none; }
.mini-job:hover { background: var(--surface2); }
.mini-job-name { font-weight: 500; flex: 1; }
.mini-job-date { font-size: 12px; color: var(--muted); font-family: 'DM Mono', monospace; }

/* ── STATUS BADGES ── */
.badge {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .8px;
  padding: 3px 9px; border-radius: 20px;
}
.badge-quoted   { background: #1e2d4a; color: var(--accent2); }
.badge-booked   { background: #2a2410; color: var(--gold); }
.badge-progress { background: #1a2e20; color: var(--green); }
.badge-done     { background: #2a1a1a; color: var(--red); }

/* ── SECTION HEADER ── */
.section-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
}
.section-title { font-family: 'DM Serif Display', serif; font-size: 1.6rem; }

/* ── BUTTONS ── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px; border-radius: 8px; border: none;
  font-family: 'Outfit', sans-serif; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all .15s;
}
.btn-primary { background: var(--accent); color: #000; }
.btn-primary:hover { background: var(--accent2); }
.btn-ghost { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-danger { background: #3a1a1a; color: var(--red); border: 1px solid #5a2a2a; }
.btn-danger:hover { background: #4a2222; }
.btn-sm { padding: 5px 12px; font-size: 12px; }

/* ── TABLE ── */
.tbl-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
  text-align: left; padding: 10px 16px;
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px;
  color: var(--muted); border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody tr { border-bottom: 1px solid var(--border); transition: background .12s; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--surface2); }
td { padding: 12px 16px; vertical-align: middle; }
td .mono { font-family: 'DM Mono', monospace; font-size: 12px; color: var(--muted); }
.low-stock { color: var(--red); font-weight: 600; }
.ok-stock { color: var(--green); }

/* ── MODAL ── */
.overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.6); backdrop-filter: blur(4px);
  z-index: 200; align-items: center; justify-content: center;
}
.overlay.open { display: flex; }
.modal {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  width: 540px; max-width: 95vw; max-height: 90vh; overflow-y: auto;
  padding: 28px;
  animation: modal-in .2s ease;
}
@keyframes modal-in { from { transform:scale(.95); opacity:0; } to { transform:scale(1); opacity:1; } }
.modal-title { font-family: 'DM Serif Display', serif; font-size: 1.3rem; margin-bottom: 20px; }

/* ── FORM ── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-full { grid-column: 1/-1; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); }
input, select, textarea {
  background: var(--bg); border: 1px solid var(--border);
  color: var(--text); border-radius: 7px; padding: 9px 12px;
  font-family: 'Outfit', sans-serif; font-size: 13px;
  transition: border .15s; outline: none;
  width: 100%;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
select option { background: var(--surface); }
textarea { resize: vertical; min-height: 70px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }

/* ── UPCOMING TIMELINE ── */
.timeline { display: flex; flex-direction: column; gap: 0; }
.tl-item {
  display: flex; gap: 16px; padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  cursor: pointer; transition: background .12s;
}
.tl-item:last-child { border-bottom: none; }
.tl-item:hover { background: var(--surface2); }
.tl-date {
  font-family: 'DM Mono', monospace; font-size: 11px; color: var(--accent);
  min-width: 70px; padding-top: 2px;
}
.tl-content { flex: 1; }
.tl-name { font-weight: 600; font-size: 14px; }
.tl-detail { font-size: 12px; color: var(--muted); margin-top: 3px; }
.tl-days {
  font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 20px;
  align-self: center;
}
.tl-days.soon { background: #3a2010; color: var(--amber); }
.tl-days.future { background: #0e2a1a; color: var(--green); }
.tl-days.today { background: #1a0e2a; color: #b39ddb; }
.tl-days.overdue { background: #2a1010; color: var(--red); }

/* ── SEARCH ── */
.search-bar {
  display: flex; gap: 10px; margin-bottom: 20px;
  align-items: center;
}
.search-bar input { max-width: 300px; }

/* ── EMPTY STATE ── */
.empty {
  text-align: center; padding: 48px 20px; color: var(--muted);
}
.empty-icon { font-size: 2.5rem; margin-bottom: 12px; opacity: .4; }
.empty p { font-size: 13px; margin-top: 6px; }

/* ── TOAST ── */
#toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 999;
  background: var(--green); color: #000; font-weight: 600;
  padding: 12px 20px; border-radius: 8px;
  transform: translateY(80px); opacity: 0; transition: all .3s;
  font-size: 13px;
}
#toast.show { transform: translateY(0); opacity: 1; }

/* ── STOCK PROGRESS ── */
.stock-bar { height: 4px; background: var(--border); border-radius: 2px; margin-top: 6px; overflow: hidden; }
.stock-fill { height: 100%; border-radius: 2px; transition: width .4s; }

.chip { display: inline-block; background: var(--surface2); border: 1px solid var(--border); border-radius: 6px; padding: 2px 8px; font-size: 11px; color: var(--muted); margin: 1px; }

.action-row { display: flex; gap: 6px; }

/* mobile-friendly tweaks */
@media (max-width: 900px) {
  header { flex-direction: column; align-items: flex-start; padding: 14px 16px; gap: 10px; }
  .logo { font-size: 1.2rem; }
  .nav { width: 100%; flex-wrap: wrap; gap: 6px; }
  .nav-btn { flex: 1 1 calc(50% - 6px); text-align: center; padding: 9px 8px; }
  main { padding: 20px 16px; }
  .section-head { flex-direction: column; align-items: flex-start; gap: 10px; }
  .section-title { font-size: 1.3rem; }
  .kpi-row { gap: 10px; }
  .kpi { padding: 16px 14px; }
  .kpi-value { font-size: 1.8rem; }
  .dash-grid { grid-template-columns: 1fr; }
  .panel-header { flex-direction: column; align-items: flex-start; gap: 8px; padding: 12px 14px; }
  .panel-body { padding: 0; }
  .btn { width: 100%; justify-content: center; }
  .search-bar { flex-direction: column; align-items: stretch; gap: 8px; }
  .search-bar input, .search-bar select { max-width: 100%; }
  .tbl-wrap { overflow-x: auto; }
  .panel { border-radius: 12px; }
  .form-grid { grid-template-columns: 1fr; }
  .modal { width: 92vw; max-width: 92vw; padding: 18px; }
  .timeline { gap: 8px; }
  .tl-item { flex-direction: column; align-items: flex-start; gap: 10px; }
  .tl-date { min-width: auto; }
  .inspect list, #inspect-list { padding: 10px; }
}

@media (max-width: 600px) {
  header { padding: 12px 12px; }
  .logo { font-size: 1.1rem; }
  .nav-btn { flex: 1 1 100%; }
  .kpi-value { font-size: 1.4rem; }
  .btn { font-size: 12px; padding: 8px 10px; }
  .panel-header, .form-group { padding: 10px; }
  .modal { padding: 14px; }
}

