/* axalar-ui.css — Axalar ERP UI System (Shipments aesthetic) */

/* ── RESET + TOKENS ─────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --ink:    #0a0a0f;
  --paper:  #f5f4f0;
  --mid:    #e8e6df;
  --dim:    #9b9890;
  --accent: #d64a1e;
  --accent2:#f0a500;
  --good:   #1a9966;
  --mono:   'JetBrains Mono', monospace;
  --sans:   'DM Sans', sans-serif;
  --display:'Outfit', sans-serif;
  --r:      6px;
  --r-lg:   14px;
  --shadow: 0 2px 16px rgba(10,10,15,.10);
  --shadow-md: 0 4px 32px rgba(10,10,15,.14);
}

html, body {
  height: 100%;
}

body {
  font-family: var(--sans);
  background: var(--paper);
  color: var(--ink);
  min-height: 100vh; min-height: 100dvh;
  overflow-x: hidden;
}

/* ── SCROLLBAR ──────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--mid); border-radius: 99px; }

/* ── NAV ────────────────────────────────────────────── */
.top-nav {
  position: sticky; top: 0; z-index: 200;
  display: flex; align-items: center; gap: 16px;
  padding: 0 28px;
  height: 54px;
  background: var(--ink);
  border-bottom: 1px solid rgba(255,255,255,.06);
}

.nav-brand {
  font-family: var(--display);
  font-size: 22px;
  letter-spacing: .04em;
  color: #fff;
  text-decoration: none;
  flex-shrink: 0;
}

.nav-sep { width: 1px; height: 24px; background: rgba(255,255,255,.12); }

.nav-crumb {
  font-size: 13px;
  font-weight: 500;
  color: rgba(255,255,255,.45);
  letter-spacing: .02em;
}

.nav-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.nav-badge {
  font-family: var(--mono);
  font-size: 11px;
  padding: 3px 10px;
  background: rgba(255,255,255,.09);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 99px;
  color: rgba(255,255,255,.7);
}

.btn-ghost-light {
  font-size: 12px; font-weight: 600; letter-spacing: .04em;
  padding: 5px 14px;
  background: transparent;
  border: 1px solid rgba(255,255,255,.22);
  border-radius: var(--r);
  color: rgba(255,255,255,.7);
  cursor: pointer;
  transition: all .15s;
}
.btn-ghost-light:hover { background: rgba(255,255,255,.08); color: #fff; }

/* ── LAYOUT ─────────────────────────────────────────── */
.layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  grid-template-rows: auto 1fr;
  height: calc(100vh - 54px);
}

.page-head {
  grid-column: 1 / -1;
  display: flex; align-items: center; gap: 20px;
  padding: 22px 28px 18px;
  border-bottom: 1px solid var(--mid);
  background: var(--paper);
}

.page-title { font-family: var(--display); font-size: 38px; letter-spacing: .02em; line-height: 1; }
.page-sub { font-size: 12px; color: var(--dim); margin-top: 4px; font-weight: 400; }

.head-actions { margin-left: auto; display: flex; gap: 10px; }

/* ── SIDEBAR ────────────────────────────────────────── */
.sidebar {
  border-right: 1px solid var(--mid);
  display: flex; flex-direction: column;
  overflow: hidden;
}

.filter-bar {
  padding: 14px 16px;
  border-bottom: 1px solid var(--mid);
  display: flex; flex-direction: column; gap: 8px;
}

.search-wrap { position: relative; }
.search-wrap svg {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  opacity: .35; pointer-events: none;
}

.input-search {
  width: 100%; padding: 8px 10px 8px 34px;
  background: var(--mid); border: 1.5px solid transparent;
  border-radius: var(--r); font-family: var(--sans); font-size: 13px; color: var(--ink);
  outline: none; transition: border .15s;
}
.input-search:focus { border-color: var(--ink); background: #fff; }
.input-search::placeholder { color: var(--dim); }

.filter-row { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.filter-row.three { grid-template-columns: 1fr 1fr 1fr; }

.select-mini {
  width: 100%; padding: 6px 8px;
  background: var(--mid); border: 1.5px solid transparent;
  border-radius: var(--r); font-family: var(--sans); font-size: 12px; color: var(--ink);
  outline: none; cursor: pointer; transition: border .15s; appearance: none;
}
.select-mini:focus { border-color: var(--ink); background: #fff; }

.filter-actions { display: flex; justify-content: space-between; align-items: center; }
.list-meta { font-size: 11px; color: var(--dim); font-family: var(--mono); }

.btn-xs {
  font-size: 11px; font-weight: 600; letter-spacing: .04em;
  padding: 4px 10px; border-radius: var(--r);
  border: 1.5px solid var(--mid); background: #fff;
  color: var(--ink); cursor: pointer; transition: all .12s;
}
.btn-xs:hover { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ── LIST ITEMS ──────────────────────────────────────── */
.list { flex: 1; overflow-y: auto; padding: 8px; }

.list-item {
  padding: 12px 14px; margin-bottom: 4px;
  border: 1.5px solid transparent; border-radius: var(--r-lg);
  cursor: pointer; transition: all .12s; background: #fff;
  display: block; width: 100%; text-align: left;
}
.list-item:hover { border-color: var(--ink); }
.list-item.active {
  background: var(--ink); color: #fff;
  border-color: var(--ink);
}
.list-item.active .muted, .list-item.active .chip { color: rgba(255,255,255,.55) !important; }
.list-item.active .chip { background: rgba(255,255,255,.1) !important; border-color: rgba(255,255,255,.15) !important; }

.item-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.item-code { font-family: var(--mono); font-size: 12px; font-weight: 500; }
.item-sub { font-size: 11px; color: var(--dim); margin-top: 4px; }
.item-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }

/* ── CHIPS ───────────────────────────────────────────── */
.chip {
  font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  padding: 2px 8px; border-radius: 99px;
  border: 1.5px solid; font-family: var(--mono);
}
.chip-muted { background: transparent; border-color: var(--mid); color: var(--dim); font-size: 10px; }
.chip-good { background: #e0ffe8; border-color: #60d480; color: #004420; }
.chip-warn { background: #fff8e0; border-color: #f0c800; color: #5a4000; }
.chip-bad  { background: #ffe8e8; border-color: #ff9999; color: #880000; }

/* ── DETAIL PANEL ───────────────────────────────────── */
.detail-panel {
  display: flex; flex-direction: column;
  overflow: hidden;
  background: #fafaf8;
}

.empty-state {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 12px;
  color: var(--dim);
}
.empty-icon { font-size: 52px; opacity: .4; }
.empty-title { font-family: var(--display); font-size: 24px; color: var(--ink); opacity: .3; letter-spacing: .04em; }
.empty-sub { font-size: 12px; }

.detail-content { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

/* ── DETAIL HEADER ──────────────────────────────────── */
.detail-head {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--mid);
  background: var(--paper);
}

.detail-head-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.detail-head-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.detail-code { font-family: var(--display); font-size: 28px; letter-spacing: .02em; }
.detail-sub { font-size: 12px; color: var(--dim); margin-top: 4px; font-family: var(--mono); }

.detail-actions { display: flex; gap: 8px; flex-shrink: 0; flex-wrap: wrap; }

/* ── SUMMARY STRIPS ──────────────────────────────────── */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--mid);
  border-top: 1px solid var(--mid);
}

.sum-card { padding: 12px 16px; background: var(--paper); }
.sum-label { font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--dim); margin-bottom: 4px; }
.sum-val { font-size: 14px; font-weight: 600; font-family: var(--mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── TABS ───────────────────────────────────────────── */
.tab-bar {
  display: flex; border-bottom: 1px solid var(--mid);
  background: var(--paper); padding: 0 24px;
}
.tab-btn {
  font-size: 12px; font-weight: 600; letter-spacing: .04em;
  padding: 10px 16px; background: none; border: none;
  border-bottom: 2.5px solid transparent;
  color: var(--dim); cursor: pointer; transition: all .12s;
}
.tab-btn.active { color: var(--ink); border-bottom-color: var(--ink); }
.tab-btn:hover:not(.active) { color: var(--ink); }

/* ── TAB CONTENT ────────────────────────────────────── */
.tab-body { flex: 1; overflow-y: auto; }
.tab-pane { display: none; padding: 20px 24px; }
.tab-pane.active { display: block; }

/* ── TABLE ──────────────────────────────────────────── */
.tbl-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--dim); padding: 8px 10px; text-align: left;
  border-bottom: 1.5px solid var(--mid); white-space: nowrap;
}
thead th:last-child { text-align: right; }
tbody tr { transition: background .08s; }
tbody tr:hover { background: var(--mid); }
tbody td { padding: 10px 10px; vertical-align: top; border-bottom: 1px solid var(--mid); }
tbody td:last-child { text-align: right; white-space: nowrap; }

.cell-code { font-family: var(--mono); font-size: 11px; color: var(--dim); }
.cell-primary { font-weight: 600; }
.cell-secondary { font-size: 11px; color: var(--dim); margin-top: 2px; }

.table-toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.table-toolbar-label { font-size: 12px; color: var(--dim); }

.kbd {
  font-family: var(--mono);
  font-size: 10px;
  padding: 2px 6px;
  border: 1.5px solid var(--mid);
  border-radius: 999px;
  background: #fff;
  color: var(--dim);
}

/* ── BUTTONS ────────────────────────────────────────── */
.btn {
  font-family: var(--sans); font-size: 13px; font-weight: 600;
  padding: 8px 18px; border-radius: var(--r);
  border: 1.5px solid; cursor: pointer; transition: all .12s;
  letter-spacing: .01em; white-space: nowrap;
}
.btn-primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-primary:hover { background: #222; }

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

.btn-outline { background: transparent; border-color: var(--mid); color: var(--ink); }
.btn-outline:hover { border-color: var(--ink); }

.btn-sm { padding: 5px 12px; font-size: 12px; }

.btn-danger { background: #ffe8e8; border-color: #ffb0b0; color: #880000; }
.btn-danger:hover { background: #880000; border-color: #880000; color: #fff; }

/* ── MODALS ─────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 900;
  background: rgba(10,10,15,.55);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  opacity: 0; pointer-events: none;
  transition: opacity .2s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal-box {
  background: var(--paper);
  border: 1.5px solid var(--mid);
  border-radius: var(--r-lg);
  width: 100%; max-width: 760px;
  max-height: 90vh; overflow-y: auto;
  transform: translateY(12px) scale(.98);
  transition: transform .2s;
  box-shadow: var(--shadow-md);
}
.modal-overlay.open .modal-box { transform: none; }

.modal-head {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--mid);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-title { font-family: var(--display); font-size: 22px; letter-spacing: .02em; }
.modal-close {
  background: none; border: none; cursor: pointer;
  font-size: 20px; color: var(--dim); line-height: 1;
}
.modal-close:hover { color: var(--ink); }

.modal-body { padding: 20px 24px; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--mid);
  display: flex; justify-content: flex-end; gap: 10px;
}

/* ── FORM CONTROLS ──────────────────────────────────── */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--dim); margin-bottom: 5px; }
.field-row { display: grid; gap: 12px; }
.field-row.cols-2 { grid-template-columns: 1fr 1fr; }
.field-row.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.field-row.cols-4 { grid-template-columns: 1fr 1fr 1fr 1fr; }

.form-control {
  width: 100%; padding: 9px 12px;
  background: #fff; border: 1.5px solid var(--mid);
  border-radius: var(--r); font-family: var(--sans); font-size: 13px; color: var(--ink);
  outline: none; transition: border .15s;
}
.form-control:focus { border-color: var(--ink); }
.form-control::placeholder { color: var(--dim); }
textarea.form-control { resize: vertical; min-height: 72px; }

.form-hint { font-size: 11px; color: var(--dim); margin-top: 4px; }

.section-divider {
  border: none; border-top: 1px solid var(--mid);
  margin: 18px 0;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 11px;
  padding: 4px 10px;
  border: 1.5px solid var(--mid);
  border-radius: 999px;
  background: #fff;
  color: var(--dim);
}

/* ── TOAST ──────────────────────────────────────────── */
.toast-zone {
  position: fixed; bottom: 24px; right: 24px; z-index: 9999;
  display: flex; flex-direction: column; gap: 8px;
}
.toast-item {
  padding: 12px 18px;
  background: var(--ink); color: #fff;
  border-radius: var(--r-lg);
  font-size: 13px; font-weight: 500;
  box-shadow: var(--shadow-md);
  animation: slideUp .2s ease;
}
@keyframes slideUp {
  from { transform: translateY(12px); opacity: 0; }
  to   { transform: none; opacity: 1; }
}

/* ── RESPONSIVE ─────────────────────────────────────── */
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; grid-template-rows: auto auto 1fr; }
  .sidebar { border-right: none; border-bottom: 1px solid var(--mid); max-height: 40vh; }
  .summary-grid { grid-template-columns: 1fr 1fr; }
  .field-row.cols-3, .field-row.cols-4 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .filter-row { grid-template-columns: 1fr; }
  .summary-grid { grid-template-columns: 1fr 1fr; }
  .field-row.cols-2, .field-row.cols-3, .field-row.cols-4 { grid-template-columns: 1fr; }
}