/* ===== Kaski Productions – Supplier Portal ===== */
:root {
  --bg: #F6F5F2;
  --card: #FFFFFF;
  --ink: #16161A;
  --muted: #5C5C66;
  --line: #ECE9E2;
  --line-strong: #D9D6CF;
  --soft: #E7E4DD;
  --accent: #B4430A;
  --accent-ink: #8A3307;
  --accent-soft: #F6E6D6;
  --ok: #1E5B36;
  --ok-soft: #DCEFE3;
  --info: #1F4A80;
  --info-soft: #DDE7F5;
  --bad: #8A1F1F;
  --bad-soft: #F5DCDC;
  --radius: 14px;
  --font: "Heebo", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 16px; }
body { min-height: 100vh; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); }
a:hover { color: var(--accent-ink); }
h1, h2, h3, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; }

.boot { padding: 48px; text-align: center; color: var(--muted); }

/* ----- layout ----- */
.shell { display: flex; flex-wrap: wrap; min-height: 100vh; }
.side {
  flex: 1 1 220px; max-width: 260px; background: var(--ink); color: var(--bg);
  padding: 24px 16px; display: flex; flex-direction: column; gap: 4px;
}
.side .brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 20px; }
.logo {
  width: 36px; height: 36px; border-radius: 9px; background: var(--bg); color: var(--ink);
  display: inline-flex; align-items: center; justify-content: center; font-weight: 800; flex: none;
}
.logo.dark { background: var(--ink); color: var(--bg); }
.side a.nav {
  color: #D9D6CF; text-decoration: none; padding: 11px 12px; border-radius: 10px; font-size: 15px;
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
}
.side a.nav:hover { background: #24242A; color: #fff; }
.side a.nav.on { background: var(--bg); color: var(--ink); font-weight: 700; }
.side .count { background: var(--accent); color: #fff; border-radius: 99px; padding: 0 9px; font-size: 13px; }
.side .grow { flex: 1; }
.side .who { color: #A8A59E; font-size: 13px; padding: 8px; word-break: break-all; }
.main { flex: 999 1 560px; min-width: 0; padding: 28px; display: flex; flex-direction: column; gap: 20px; }

.topbar {
  background: var(--card); border-bottom: 1px solid var(--line); padding: 12px 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.topbar .brand { display: flex; align-items: center; gap: 10px; }
.topbar nav { display: flex; gap: 4px; flex-wrap: wrap; }
.topbar nav a { color: var(--muted); text-decoration: none; padding: 9px 12px; border-radius: 10px; font-size: 15px; }
.topbar nav a.on { background: var(--bg); color: var(--ink); font-weight: 700; }
.page { width: 100%; max-width: 1100px; margin: 0 auto; padding: 24px 16px 48px; display: flex; flex-direction: column; gap: 18px; }
.narrow { max-width: 560px; }

.head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; }
.head h1 { font-size: 28px; font-weight: 800; }
.sub { color: var(--muted); font-size: 14px; }

/* ----- cards & grids ----- */
.card { background: var(--card); border-radius: 16px; padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.card h2 { font-size: 17px; font-weight: 800; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.stat { background: var(--card); border-radius: 16px; padding: 16px; display: flex; flex-direction: column; gap: 4px; }
.stat .label { font-size: 14px; color: var(--muted); }
.stat .value { font-size: 26px; font-weight: 800; }
.row { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.col-main { flex: 3 1 520px; min-width: 0; }
.col-side { flex: 2 1 340px; min-width: 0; }
.alert { border-radius: 14px; padding: 14px 16px; font-size: 14px; line-height: 1.55; }
.alert.warn { background: var(--accent-soft); color: #4A1C03; }
.alert.bad { background: var(--bad-soft); color: #5E1212; }
.alert.ok { background: var(--ok-soft); color: #123A22; }
.alert.info { background: var(--info-soft); color: #13305A; }
.alert b { font-weight: 800; }

/* ----- buttons ----- */
.btn {
  min-height: 44px; padding: 0 18px; border-radius: 12px; border: 1.5px solid var(--ink);
  background: var(--card); color: var(--ink); font-weight: 700; font-size: 15px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none;
}
.btn:hover { background: var(--bg); color: var(--ink); }
.btn.primary { background: var(--ink); color: var(--bg); }
.btn.primary:hover { background: #2B2B31; color: #fff; }
.btn.accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.accent:hover { background: var(--accent-ink); color: #fff; }
.btn.good { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.danger { border-color: var(--line-strong); color: var(--bad); }
.btn.ghost { border-color: var(--line-strong); }
.btn.sm { min-height: 36px; padding: 0 12px; font-size: 14px; border-radius: 10px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btns { display: flex; flex-wrap: wrap; gap: 10px; }

.tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.tab {
  min-height: 44px; padding: 0 14px; border-radius: 12px; border: 1.5px solid var(--line-strong);
  background: var(--card); font-weight: 700; font-size: 15px; cursor: pointer; display: inline-flex; align-items: center; gap: 8px;
}
.tab.on { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.tab .n { font-size: 12px; padding: 1px 8px; border-radius: 99px; background: var(--line); color: var(--ink); }
.tab.on .n { background: var(--bg); }

/* ----- forms ----- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 14px; font-weight: 500; color: var(--muted); }
.field .hint { font-size: 13px; color: var(--muted); }
.input, select.input, textarea.input {
  min-height: 48px; border: 1.5px solid var(--line-strong); border-radius: 12px; padding: 0 14px;
  background: var(--card); width: 100%; font-size: 16px;
}
textarea.input { padding: 12px 14px; min-height: 80px; resize: vertical; }
.input:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(22,22,26,.08); }
.input.ltr { direction: ltr; text-align: right; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.err { color: var(--bad); font-size: 14px; }

.drop {
  background: var(--card); border: 2px dashed var(--ink); border-radius: 18px; padding: 32px 20px;
  display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; cursor: pointer;
}
.drop.over { background: var(--accent-soft); }
.drop .big { font-size: 18px; font-weight: 800; }

/* ----- lists & tables ----- */
.list { display: flex; flex-direction: column; gap: 10px; }
.item {
  background: var(--card); border-radius: 14px; padding: 14px 16px; display: flex; align-items: center;
  justify-content: space-between; gap: 12px; border: none; width: 100%; text-align: right; cursor: default;
}
button.item { cursor: pointer; }
.item.on { background: var(--accent-soft); }
.item .t { font-size: 15px; font-weight: 700; }
.item .s { font-size: 13px; color: var(--muted); }
.item .end { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; }
.stack { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tablewrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: right; color: var(--muted); font-weight: 500; padding: 10px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 11px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--bg); }

.pill { font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 99px; white-space: nowrap; display: inline-block; }
.pill.submitted { background: var(--accent-soft); color: var(--accent-ink); }
.pill.approved { background: var(--info-soft); color: var(--info); }
.pill.paid, .pill.active { background: var(--ok-soft); color: var(--ok); }
.pill.returned, .pill.pending { background: #FBEFC9; color: #6B4A00; }
.pill.rejected, .pill.blocked, .pill.flag { background: var(--bad-soft); color: var(--bad); }
.pill.muted { background: var(--line); color: var(--muted); }

.kv { display: flex; flex-direction: column; }
.kv > div { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.kv > div > span:first-child { color: var(--muted); }
.kv > div > span:last-child { font-weight: 700; text-align: left; }
.preview { border: 1px solid var(--line); border-radius: 12px; background: var(--bg); overflow: hidden; }
.preview iframe { width: 100%; height: 460px; border: 0; display: block; background: #fff; }
.preview img { display: block; margin: 0 auto; max-height: 460px; }
.events { display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
.events div { display: flex; gap: 8px; }
.events .when { color: var(--muted); white-space: nowrap; }
.empty { color: var(--muted); text-align: center; padding: 28px 12px; font-size: 15px; }

/* ----- login ----- */
.login { max-width: 420px; margin: 0 auto; padding: 56px 24px 32px; display: flex; flex-direction: column; gap: 22px; min-height: 100vh; }
.login h1 { font-size: 32px; line-height: 1.15; font-weight: 800; }
.code { direction: ltr; text-align: center; letter-spacing: 10px; font-size: 26px; font-weight: 800; }

.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--bg);
  padding: 12px 18px; border-radius: 12px; font-size: 15px; z-index: 50; max-width: calc(100% - 32px); box-shadow: 0 8px 30px rgba(0,0,0,.2);
}
.toast.bad { background: var(--bad); }

.spin { width: 18px; height: 18px; border: 2.5px solid currentColor; border-top-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 700px) {
  .side { max-width: none; flex-basis: 100%; flex-direction: row; flex-wrap: wrap; padding: 12px; gap: 6px; }
  .side .brand { padding: 0 4px; width: 100%; }
  .side .grow, .side .who { display: none; }
  .main { padding: 16px; }
  .head h1 { font-size: 24px; }
  .preview iframe { height: 360px; }
}
