/* GRAMIL US MANAGER — sleek sidebar UI, Gramil identity */
:root {
  --ink: #1c1c1c;
  --ink-soft: #55524c;
  --line: #e5e2dc;
  --bg: #f5f4f1;
  --panel: #ffffff;
  --accent: #b3924f;
  --accent-dark: #97793c;
  --side: #17150f;
  --side-ink: #cfc9bd;
  --ok: #2e7d32;
  --warn: #b26a00;
  --err: #b3261e;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(20, 18, 12, .07), 0 6px 18px rgba(20, 18, 12, .05);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: "Poppins", "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
}
a { color: var(--accent-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
img { display: block; max-width: 100%; }
h1 { font-size: 24px; font-weight: 600; letter-spacing: .01em; }
h2 { font-size: 15px; font-weight: 600; margin-bottom: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-soft); }

/* ---------- shell ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 232px; flex: 0 0 232px;
  background: var(--side); color: var(--side-ink);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.brand { padding: 26px 22px 20px; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand-name { display: block; font-weight: 700; letter-spacing: .16em; color: #fff; font-size: 17px; }
.brand-sub { display: block; color: var(--accent); font-size: 12px; letter-spacing: .3em; text-transform: uppercase; margin-top: 3px; }
.nav { padding: 14px 10px; flex: 1; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  color: var(--side-ink); padding: 11px 14px; border-radius: 9px;
  font-size: 14px; margin-bottom: 2px;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; text-decoration: none; }
.nav-item.active { background: var(--accent); color: #17150f; font-weight: 600; }
.nav-ico { width: 18px; text-align: center; opacity: .85; }
.nav-sep { font-size: 11px; text-transform: uppercase; letter-spacing: .18em; opacity: .5; padding: 16px 14px 6px; }
.side-user { padding: 16px 22px; border-top: 1px solid rgba(255,255,255,.08); font-size: 13px; }
.side-user-name { color: #fff; font-weight: 500; }
.side-user-role { opacity: .7; margin-top: 2px; }
.side-user a { color: var(--accent); }
.menu-btn { display: none; }

.content { flex: 1; padding: 30px 34px 60px; max-width: 1240px; min-width: 0; }

/* ---------- header & cards ---------- */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px 22px; margin-bottom: 20px;
}
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat { text-align: left; padding: 18px 20px; }
.stat-n { font-size: 30px; font-weight: 600; }
.stat-n.small-n { font-size: 17px; line-height: 1.4; }
.stat-l { color: var(--ink-soft); font-size: 12.5px; margin-top: 2px; }
.two-col { display: grid; grid-template-columns: 1.4fr 1fr; gap: 20px; align-items: start; }

/* ---------- buttons, forms ---------- */
.btn {
  display: inline-block; background: var(--accent); color: #17150f;
  border: 1px solid var(--accent); border-radius: 9px; cursor: pointer;
  font: inherit; font-weight: 600; font-size: 14px; padding: 9px 18px;
}
.btn:hover { background: var(--accent-dark); border-color: var(--accent-dark); color: #fff; text-decoration: none; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); font-weight: 500; }
.btn-ghost:hover { background: #efede8; color: var(--ink); }
.btnrow { display: flex; gap: 8px; flex-wrap: wrap; }
.link, .link-danger { background: none; border: none; cursor: pointer; font: inherit; font-size: 13px; color: var(--accent-dark); padding: 0; }
.link-danger { color: var(--err); }
.link:hover, .link-danger:hover { text-decoration: underline; }
.inline { display: inline; }

label { display: block; font-size: 13.5px; color: var(--ink-soft); margin-bottom: 12px; }
input, select, textarea {
  width: 100%; font: inherit; font-size: 14.5px; color: var(--ink);
  border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px;
  background: #fff; margin-top: 5px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
input[type="checkbox"] { width: auto; margin: 0 8px 0 0; }
input[type="file"] { padding: 7px; background: var(--bg); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 22px; }
.form-grid .span2 { grid-column: 1 / -1; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding: 14px 16px; }
.filters input[type="search"] { flex: 1 1 220px; margin: 0; }
.filters select { width: auto; margin: 0; }
.upload-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--line); }
.upload-form input[type="file"] { flex: 1 1 220px; margin: 0; }
.upload-form input[type="text"] { flex: 1 1 160px; margin: 0; }
.check-inline { display: flex; align-items: center; font-size: 13.5px; width: 100%; margin-bottom: 8px; }

/* ---------- tables ---------- */
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); padding: 8px 10px; border-bottom: 2px solid var(--line); }
.tbl td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.kv { width: 100%; font-size: 14px; }
.kv th { text-align: left; color: var(--ink-soft); font-weight: 500; padding: 6px 10px 6px 0; white-space: nowrap; vertical-align: top; }
.kv td { padding: 6px 0; }

/* ---------- inventory grid ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.grid-tight { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); color: var(--ink); }
.tile:hover { text-decoration: none; border-color: var(--accent); }
.tile-img { position: relative; aspect-ratio: 8/5; background: #e9e6e0; }
.tile-img img { width: 100%; height: 100%; object-fit: cover; }
.tile-img .badge { position: absolute; top: 8px; left: 8px; }
.tile-noimg { display: flex; align-items: center; justify-content: center; height: 100%; color: #8d887e; font-family: Georgia, serif; font-size: 17px; }
.tile-body { padding: 12px 14px 14px; }
.tile-title { font-weight: 600; font-size: 14.5px; }
.tile-sub { font-size: 13px; color: var(--ink-soft); margin-top: 2px; }
.check-tile { display: flex; align-items: center; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px; margin: 0; cursor: pointer; font-size: 13.5px; color: var(--ink); }
.check-tile:hover { border-color: var(--accent); }

/* ---------- badges, chips, flash ---------- */
.badge { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 3px 9px; border-radius: 20px; letter-spacing: .02em; }
.badge-available { background: #e3f2e4; color: var(--ok); }
.badge-on_hold { background: #fff3e0; color: var(--warn); }
.badge-refinishing { background: #e6ecf7; color: #29508f; }
.badge-sold { background: #eee9e2; color: #6f6a61; }
.badge-wo-received { background: #fff3e0; color: var(--warn); }
.badge-wo-in_progress { background: #e6ecf7; color: #29508f; }
.badge-wo-completed { background: #e3f2e4; color: var(--ok); }
.badge-wo-delivered { background: #eee9e2; color: #6f6a61; }
.chip { display: inline-block; background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 4px 12px; font-size: 13px; color: var(--ink-soft); margin: 0 6px 6px 0; }
.chip:hover { border-color: var(--accent); text-decoration: none; }
.chip-on { background: var(--accent); border-color: var(--accent); color: #17150f; font-weight: 600; }
.tagbar { margin-bottom: 14px; }
.flash { background: #e3f2e4; color: var(--ok); border-radius: 9px; padding: 11px 16px; margin-bottom: 18px; font-size: 14px; }
.flash-err { background: #fdeceb; color: var(--err); }
.muted { color: #8d887e; }
.small { font-size: 13px; }
.mt { margin-top: 12px; }
.feed { list-style: none; font-size: 13.5px; }
.feed li { padding: 6px 0; border-bottom: 1px solid var(--line); }
.feed li:last-child { border-bottom: none; }
.filelist { list-style: none; font-size: 14px; }
.filelist li { padding: 7px 0; border-bottom: 1px solid var(--line); }
.filelist li:last-child { border-bottom: none; }

/* ---------- gallery & video ---------- */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.gal-item img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; }
.gal-item figcaption { font-size: 12px; color: var(--ink-soft); margin-top: 4px; }
video { width: 100%; border-radius: 8px; margin-bottom: 8px; background: #000; }
.qrbox svg, .qrbox img { width: 150px; height: 150px; }

/* lightbox */
.lb-overlay { position: fixed; inset: 0; background: rgba(10, 9, 6, .92); display: flex; align-items: center; justify-content: center; z-index: 50; cursor: zoom-out; flex-direction: column; }
.lb-overlay img { max-width: 94vw; max-height: 88vh; border-radius: 6px; }
.lb-cap { color: #cfc9bd; font-size: 14px; margin-top: 10px; }

/* ---------- auth pages ---------- */
.auth-body { background: var(--side); min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; font-family: "Poppins", "Segoe UI", Arial, sans-serif; }
.auth-card { background: var(--panel); border-radius: 14px; box-shadow: 0 20px 60px rgba(0,0,0,.4); padding: 36px; width: 100%; max-width: 400px; }
.auth-brand { font-weight: 700; letter-spacing: .16em; margin-bottom: 20px; }
.auth-brand span { color: var(--accent); font-weight: 500; letter-spacing: .3em; text-transform: uppercase; font-size: 12px; margin-left: 8px; }
.auth-card h1 { font-size: 20px; margin-bottom: 8px; }
.auth-card .btn { width: 100%; margin-top: 6px; }

/* ---------- print: price list & labels ---------- */
.print-body { background: #fff; color: #1c1c1c; padding: 34px; font-family: "Poppins", "Segoe UI", Arial, sans-serif; font-size: 13px; }
.print-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 22px; }
.print-brand { font-size: 22px; font-weight: 700; letter-spacing: .16em; }
.print-meta { text-align: right; font-weight: 600; }
.print-tbl th { border-bottom: 2px solid #1c1c1c; }
.labels-sheet { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.label { display: flex; gap: 14px; align-items: center; border: 1.5px solid #1c1c1c; border-radius: 10px; padding: 14px; page-break-inside: avoid; }
.label-qr svg { width: 108px; height: 108px; display: block; }
.label-block { font-size: 26px; font-weight: 700; letter-spacing: .04em; }
.label-mat { font-size: 15px; font-weight: 600; margin-top: 2px; }
.label-fin { font-size: 13px; color: #444; }
.label-code { font-size: 11px; color: #777; margin-top: 6px; letter-spacing: .08em; }
@media print {
  .print-body { padding: 0; }
  .labels-sheet { gap: 8px; }
}

/* ---------- mobile ---------- */
@media (max-width: 860px) {
  .shell { display: block; }
  .sidebar {
    position: fixed; z-index: 40; height: 100vh; transform: translateX(-100%);
    transition: transform .2s ease; width: 250px;
  }
  .sidebar.open { transform: translateX(0); box-shadow: 0 0 60px rgba(0,0,0,.5); }
  .menu-btn {
    display: block; position: fixed; z-index: 41; top: 12px; left: 12px;
    background: var(--side); color: #fff; border: none; border-radius: 9px;
    font-size: 18px; padding: 8px 12px; cursor: pointer;
  }
  .content { padding: 60px 16px 40px; }
  .two-col, .form-grid { grid-template-columns: 1fr; }
  .cards { grid-template-columns: repeat(2, 1fr); }
}
