/* styles.css — Instyle Penates. Vesta-family LIGHT theme (Overpass + Tabler icons),
 * deliberately not Fortuna's dark-luxe: this is a working stock tool, not a showcase. */

:root {
  --bg: #faf8f5;
  --panel: #ffffff;
  --ink: #26221d;
  --muted: #8a8177;
  --line: #e8e2d9;
  --brand: #2f5d50;          /* Penates green — the storeroom */
  --brand-ink: #f5f2ec;
  --accent: #a33e16;         /* Instyle terracotta (shared with the suite) */
  --danger: #b3261e;
  --warn: #9a6b00;
  --ok: #2e7d32;
  --radius: 12px;
  --shadow: 0 8px 28px rgba(38, 34, 29, 0.10);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Overpass", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; font-size: 14px; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 15px; color: var(--ink); }

/* ── Shell ─────────────────────────────────────────────────────────────────── */
.pn-shell { max-width: 1180px; margin: 0 auto; padding: 0 16px 80px; }
.pn-header {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 18px 0 10px;
}
.pn-logo {
  width: 40px; height: 40px; border-radius: 10px; background: var(--brand);
  color: var(--brand-ink); font-family: Georgia, serif; font-size: 24px;
  display: flex; align-items: center; justify-content: center; flex: none;
}
.pn-title { font-weight: 800; font-size: 19px; letter-spacing: 0.2px; }
.pn-sub { color: var(--muted); font-size: 12.5px; margin-top: -3px; }

.pn-tabs { display: flex; gap: 4px; flex-wrap: wrap; margin: 6px 0 18px; border-bottom: 1px solid var(--line); }
.pn-tab {
  border: none; background: none; padding: 9px 13px 7px; border-radius: 8px 8px 0 0;
  color: var(--muted); font-weight: 600; display: flex; align-items: center; gap: 6px;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.pn-tab.on { color: var(--brand); border-bottom-color: var(--brand); background: rgba(47, 93, 80, 0.06); }
.pn-tab i { font-size: 17px; }

/* ── Cards / panels ────────────────────────────────────────────────────────── */
.pn-panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.pn-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pn-grow { flex: 1 1 auto; }
.pn-muted { color: var(--muted); }
.pn-small { font-size: 12.5px; }
h2.pn-h { font-size: 16px; margin: 0 0 10px; display: flex; align-items: center; gap: 8px; }

/* ── Buttons / inputs ──────────────────────────────────────────────────────── */
.pn-btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line); background: var(--panel); color: var(--ink);
  padding: 8px 13px; border-radius: 9px; font-weight: 600;
}
.pn-btn:hover { border-color: #cfc6b8; }
.pn-btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.pn-btn.danger { color: var(--danger); border-color: #e5c4c1; }
.pn-btn.danger.solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.pn-btn:disabled { opacity: 0.5; cursor: default; }
.pn-btn i { font-size: 16px; }

.pn-input, .pn-select, .pn-textarea {
  border: 1px solid var(--line); border-radius: 9px; padding: 8px 11px; background: #fff;
  outline: none; min-width: 0;
}
.pn-input:focus, .pn-select:focus, .pn-textarea:focus { border-color: var(--brand); }
.pn-label { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.4px; display: block; margin: 10px 0 4px; }

.pn-seg { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.pn-seg button { border: none; background: #fff; padding: 7px 13px; font-weight: 600; color: var(--muted); }
.pn-seg button.on { background: var(--brand); color: var(--brand-ink); }

.pn-chip {
  display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700;
  padding: 2px 9px 1px; border-radius: 99px; border: 1px solid var(--line); color: var(--muted);
}
.pn-chip.green { color: var(--ok); border-color: #bfdcc1; background: #f0f7f0; }
.pn-chip.red { color: var(--danger); border-color: #e5c4c1; background: #fbf1f0; }
.pn-chip.amber { color: var(--warn); border-color: #e3d2a8; background: #faf5e8; }
.pn-chip.brand { color: var(--brand); border-color: #bccfc9; background: #eef4f2; }

/* ── Item grid ─────────────────────────────────────────────────────────────── */
.pn-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 12px; }
.pn-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; cursor: pointer; transition: box-shadow 0.15s, transform 0.15s;
  display: flex; flex-direction: column;
}
.pn-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.pn-card.archived { opacity: 0.55; }
.pn-thumb {
  aspect-ratio: 4 / 3; background: #f1ede6; display: flex; align-items: center; justify-content: center;
  color: #c9c0b2; font-size: 34px; overflow: hidden;
}
.pn-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pn-card-body { padding: 9px 11px 10px; display: flex; flex-direction: column; gap: 3px; }
.pn-card-name { font-weight: 700; font-size: 13.5px; line-height: 1.25; }
.pn-card-meta { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.pn-qty { margin-left: auto; font-weight: 800; color: var(--brand); }
.pn-qty.zero { color: var(--muted); }
.pn-qty.neg { color: var(--danger); }

/* ── Tables (locations / history) ──────────────────────────────────────────── */
.pn-table { width: 100%; border-collapse: collapse; }
.pn-table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: 0.4px; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); }
.pn-table td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.pn-table tr.click { cursor: pointer; }
.pn-table tr.click:hover td { background: #fcfaf7; }

/* ── Modal ─────────────────────────────────────────────────────────────────── */
.pn-overlay {
  position: fixed; inset: 0; background: rgba(38, 34, 29, 0.45); z-index: 9000;
  display: flex; align-items: flex-start; justify-content: center; padding: 4vh 14px; overflow: auto;
}
.pn-modal {
  background: var(--panel); border-radius: 14px; box-shadow: var(--shadow);
  width: 100%; max-width: 560px; padding: 18px; position: relative;
}
.pn-modal-x { position: absolute; top: 10px; right: 10px; border: none; background: none; font-size: 20px; color: var(--muted); }

/* ── Toasts — plain text only (repo rule: no emoji, no icons in toasts) ────── */
.pn-toasts { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 10000; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.pn-toast {
  background: #33302b; color: #f6f3ee; padding: 10px 18px; border-radius: 10px;
  font-size: 14px; font-weight: 600; box-shadow: var(--shadow); max-width: min(92vw, 560px);
}
.pn-toast.error { background: var(--danger); }

/* ── Progress (import) ─────────────────────────────────────────────────────── */
.pn-bar { height: 8px; border-radius: 99px; background: #eee7dc; overflow: hidden; }
.pn-bar > div { height: 100%; background: var(--brand); border-radius: 99px; transition: width 0.2s; }
.pn-log { background: #f7f4ee; border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px; font-size: 12.5px; max-height: 260px; overflow: auto; white-space: pre-wrap; font-family: ui-monospace, monospace; }

/* ── Gate (access code) ────────────────────────────────────────────────────── */
.pn-gate { max-width: 380px; margin: 14vh auto 0; text-align: center; }
.pn-gate .pn-logo { width: 64px; height: 64px; font-size: 38px; margin: 0 auto 14px; border-radius: 16px; }

@media (max-width: 640px) {
  .pn-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .pn-modal { padding: 14px; }
}
