/* vesto form back office — shares the studio's palette (app.css) but lays out
   as a classic admin: dark topbar, side nav, table screens. */

:root {
  --bg: #f4f2ee;
  --panel: #ffffff;
  --ink: #232323;
  --muted: #777;
  --soft: #999;
  --line: #ddd6cc;
  --accent: #9a7b4f;
  --accent-dark: #7a5f3a;
  --danger: #c0392b;
  --ok: #2e7d32;
  font-size: 14px;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: "Helvetica Neue", Arial, sans-serif;
  background: var(--bg); color: var(--ink);
  display: flex; flex-direction: column; overflow: hidden;
}
a { color: var(--accent-dark); }

/* ---------- topbar ---------- */
#topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 10px 18px; background: #1f1c18; color: #f5efe6;
  border-bottom: 3px solid var(--accent); flex: 0 0 auto;
}
.brand-name { font-size: 19px; font-weight: 700; letter-spacing: 2px; }
.brand-name span { font-weight: 300; letter-spacing: 0; color: #d8c9ae; font-size: 15px; }
.brand-sub { font-size: 11px; color: #a99c86; margin-top: 2px; }
.top-links { display: flex; align-items: center; gap: 8px; }
.top-links a, .top-links button {
  font-size: 12px; padding: 6px 12px; border-radius: 4px; cursor: pointer;
  background: #2e2a24; border: 1px solid #4a443b; color: #f5efe6; text-decoration: none;
}
.top-links a:hover, .top-links button:hover { background: var(--accent); border-color: var(--accent); }

/* ---------- layout ---------- */
#layout { display: flex; flex: 1 1 auto; min-height: 0; }
#sidenav {
  width: 196px; flex: 0 0 auto; background: var(--panel);
  border-right: 1px solid var(--line); padding: 14px 10px; display: flex;
  flex-direction: column; gap: 2px;
}
.nav-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 12px; border-radius: 6px; font-size: 13.5px; font-weight: 600;
  color: var(--ink); text-decoration: none;
}
.nav-item:hover { background: #f6efe3; }
.nav-item.active { background: var(--accent); color: #fff; }
.nav-item .count {
  font-size: 10.5px; font-weight: 700; background: var(--danger); color: #fff;
  border-radius: 999px; padding: 1px 7px; min-width: 18px; text-align: center;
}
.nav-item.active .count { background: #ffffff33; }

#screen { flex: 1 1 auto; min-width: 0; overflow-y: auto; padding: 20px 26px 60px; }

/* ---------- screen chrome ---------- */
.screen-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; margin-bottom: 14px; flex-wrap: wrap;
}
.screen-head h1 { font-size: 20px; margin: 0; display: flex; align-items: center; gap: 10px; }
.h-sub { font-size: 12px; color: var(--muted); font-weight: 400; }
.head-actions { display: flex; gap: 10px; align-items: center; }
.back { font-size: 13px; text-decoration: none; color: var(--muted); font-weight: 400; }
.back:hover { color: var(--accent-dark); }
.search {
  border: 1px solid var(--line); border-radius: 6px; padding: 7px 12px;
  font-size: 13px; width: 240px; background: var(--panel);
}
.empty { color: var(--muted); font-size: 13px; padding: 28px 4px; }
.mt { margin-top: 16px; }

/* chips (status filter) */
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.chip {
  font-size: 12px; padding: 5px 11px; border: 1px solid var(--line);
  background: var(--panel); border-radius: 999px; cursor: pointer; color: var(--ink);
}
.chip:hover { border-color: var(--accent); }
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }

/* toolbar (parts filters) */
.toolbar { display: flex; gap: 14px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.toolbar select {
  border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px;
  font-size: 12.5px; background: var(--panel);
}
.check { font-size: 12.5px; display: flex; gap: 5px; align-items: center; color: var(--ink); }
.toolbar-note { font-size: 11.5px; color: var(--soft); }

/* ---------- data tables ---------- */
table.data {
  width: 100%; border-collapse: collapse; background: var(--panel);
  border: 1px solid var(--line); border-radius: 8px; overflow: hidden; font-size: 13px;
}
table.data th {
  text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: .5px;
  color: var(--muted); padding: 9px 12px; border-bottom: 1px solid var(--line);
  background: #faf8f4;
}
table.data td { padding: 9px 12px; border-bottom: 1px solid #f0ebe2; vertical-align: top; }
table.data tbody tr:last-child td { border-bottom: none; }
table.data tbody tr[data-id], table.data tbody tr[data-sku] { cursor: pointer; }
table.data tbody tr[data-id]:hover, table.data tbody tr[data-sku]:hover { background: #f6efe3; }
table.data .num, table.data th.num { text-align: right; white-space: nowrap; }
table.data .ref { font-weight: 700; white-space: nowrap; }
table.data .sub { display: block; font-size: 11px; color: var(--muted); font-weight: 400; }
table.data .sub-cell { color: var(--muted); font-size: 12px; }
table.data .group-row td {
  font-weight: 700; font-size: 11.5px; color: var(--accent-dark);
  background: #f8f4ec; padding: 7px 12px;
}
table.data.inner { border: none; border-radius: 0; }

/* ---------- status badges ---------- */
.badge {
  display: inline-block; font-size: 10.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .5px; border-radius: 999px; padding: 2px 9px; white-space: nowrap;
}
.st-placed { background: #e3edff; color: #2456b8; }
.st-confirmed { background: #e0f2f1; color: #00695c; }
.st-ordered { background: #fdf0d5; color: #9a6b00; }
.st-scheduled { background: #ede7f6; color: #5e35b1; }
.st-delivered { background: #e6f2e6; color: var(--ok); }
.st-cancelled { background: #eee9e3; color: #8a8378; }

/* ---------- order detail ---------- */
.detail-grid { display: grid; grid-template-columns: 1fr 320px; gap: 16px; align-items: start; }
@media (max-width: 900px) { .detail-grid { grid-template-columns: 1fr; } }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  padding: 14px 16px; margin-bottom: 16px;
}
.card h2 {
  font-size: 11px; text-transform: uppercase; letter-spacing: 1px;
  color: var(--accent-dark); margin: 0 0 10px;
}
.card h2.mt { margin-top: 18px; }
.card-actions { margin-top: 8px; display: flex; justify-content: flex-end; }
.kv { font-size: 13px; margin-bottom: 6px; line-height: 1.45; }
.kv.sub { color: var(--soft); font-size: 11.5px; }

.order-totals { margin-top: 10px; border-top: 2px solid var(--accent); padding-top: 8px; font-size: 13px; }
.order-totals > div { display: flex; justify-content: space-between; padding: 2px 0; }
.order-totals .grand { font-weight: 700; font-size: 15px; border-top: 1px solid var(--line); margin-top: 4px; padding-top: 6px; }

.status-row { display: flex; gap: 8px; }
.status-row select {
  flex: 1; border: 1px solid var(--line); border-radius: 6px; padding: 7px 8px;
  font-size: 13px; background: var(--panel);
}
.timeline { display: flex; flex-direction: column; gap: 7px; }
.tl-row { display: flex; align-items: baseline; gap: 8px; font-size: 12.5px; }
.tl-dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; align-self: center; background: #ccc; }
.tl-dot.st-placed { background: #2456b8; } .tl-dot.st-confirmed { background: #00695c; }
.tl-dot.st-ordered { background: #c8961e; } .tl-dot.st-scheduled { background: #5e35b1; }
.tl-dot.st-delivered { background: var(--ok); } .tl-dot.st-cancelled { background: #8a8378; }
.tl-at { margin-left: auto; color: var(--soft); font-size: 11px; }

textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px;
  font-size: 13px; font-family: inherit; resize: vertical; background: var(--panel);
}

/* ---------- buttons ---------- */
.btn {
  font-size: 12.5px; padding: 7px 14px; border: 1px solid var(--line); border-radius: 6px;
  background: #faf8f4; cursor: pointer; color: var(--ink);
}
.btn:hover { background: #f0e9dc; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }
.btn.primary:hover { background: var(--accent-dark); }

/* ---------- toast ---------- */
#toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: #232323ee; color: #fff; padding: 9px 18px; border-radius: 6px;
  font-size: 12.5px; display: none; z-index: 50; max-width: 70%;
}
#toast.show { display: block; }
#toast.err { background: #a93226ee; }

/* ---------- login overlay (matches the studio) ---------- */
#login-overlay {
  position: fixed; inset: 0; z-index: 100; display: flex;
  align-items: center; justify-content: center; background: #1f1c18f2;
}
#login-overlay[hidden] { display: none; }
#login-form {
  background: var(--panel); border-radius: 10px; padding: 28px 32px; width: 320px;
  box-shadow: 0 24px 80px #00000066; display: flex; flex-direction: column; gap: 12px;
}
#login-form h3 { margin: 0 0 6px; font-size: 18px; letter-spacing: 2px; }
#login-form h3 span { font-weight: 300; letter-spacing: 0; font-size: 14px; color: var(--muted); }
#login-form label { display: flex; flex-direction: column; gap: 4px; font-size: 11px; color: var(--muted); }
#login-form input { border: 1px solid var(--line); border-radius: 5px; padding: 8px 10px; font-size: 14px; }
#login-form button {
  margin-top: 4px; padding: 9px; border: none; border-radius: 5px; cursor: pointer;
  background: var(--accent); color: #fff; font-size: 14px; font-weight: 700;
}
#login-form button:hover { background: var(--accent-dark); }
.login-error { color: var(--danger); font-size: 12px; min-height: 15px; }

/* ---------- dialogs ---------- */
dialog {
  border: 1px solid var(--line); border-radius: 10px; padding: 0;
  width: 430px; max-width: calc(100vw - 40px); box-shadow: 0 20px 60px #00000033;
}
dialog::backdrop { background: #1f1c1866; }
.dlg-head { padding: 14px 18px 10px; border-bottom: 1px solid var(--line); }
.dlg-head h3 { margin: 0; font-size: 15px; }
.dlg-sub { font-size: 11.5px; color: var(--muted); margin-top: 3px; font-weight: 400; }
.dlg-body { padding: 14px 18px 18px; display: flex; flex-direction: column; gap: 11px; }
.dlg-body label { display: flex; flex-direction: column; gap: 4px; font-size: 11.5px; color: var(--muted); }
.dlg-body label.check { flex-direction: row; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink); }
.dlg-body input, .dlg-body textarea {
  border: 1px solid var(--line); border-radius: 5px; padding: 7px 10px;
  font-size: 13.5px; color: var(--ink); font-family: inherit;
}
.dlg-body input[type="checkbox"] { width: auto; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row-inline { display: flex; gap: 8px; }
.row-inline input { flex: 1; }
.row-inline button {
  font-size: 12px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 5px;
  background: #faf8f4; cursor: pointer;
}
.row-inline button:hover { background: #f0e9dc; }
.dlg-sep { border-top: 1px dashed var(--line); margin: 4px 0; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }
.dlg-actions button {
  font-size: 12.5px; padding: 7px 14px; border: 1px solid var(--line); border-radius: 5px;
  background: #faf8f4; cursor: pointer;
}
.dlg-actions button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }
.dlg-actions button.primary:hover { background: var(--accent-dark); }
