:root {
  --bg: #f6f4f1;
  --panel: #ffffff;
  --ink: #1f1b17;
  --muted: #6f665e;
  --line: #e4ded6;
  --accent: #b4532a;
  --accent-ink: #ffffff;
  --accent-soft: #f6e6dc;
  --side: #1f1b17;
  --side-ink: #e9e2da;
  --side-muted: #9b9188;
  --ok: #15803d;
  --warn: #b45309;
  --err: #b91c1c;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(31, 27, 23, .06), 0 4px 16px rgba(31, 27, 23, .06);
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 14px;
  color: var(--ink);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 22px; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }
p { margin: 0 0 8px; line-height: 1.5; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.mono { font-variant-numeric: tabular-nums; }

/* layout */
.shell { display: grid; grid-template-columns: 232px 1fr; height: 100vh; }
.side { background: var(--side); color: var(--side-ink); display: flex; flex-direction: column; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 10px; font-weight: 700; font-size: 18px; letter-spacing: .02em; }
.brand .logo { width: 31px; height: 24px; flex: none; }
/* símbolo do Notch (Mikami Hub): lâminas e aros na cor do texto, pino sempre em Brasa */
.logo .t { fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }
.logo .n { fill: currentColor; }
.logo .a { fill: #ff4d2e; }
.brand small { display: block; font-weight: 400; font-size: 11px; color: var(--side-muted); letter-spacing: 0; }
.nav-group { padding: 10px 10px 4px; }
.nav-group h6 { margin: 6px 10px; font-size: 10.5px; text-transform: uppercase; letter-spacing: .09em; color: var(--side-muted); font-weight: 600; }
.nav-group a { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 7px; color: var(--side-ink); font-size: 13.5px; }
.nav-group a:hover { background: rgba(255, 255, 255, .06); text-decoration: none; }
.nav-group a.active { background: var(--accent); color: var(--accent-ink); }
.nav-group a .ic { width: 18px; text-align: center; opacity: .9; }
.side .me { margin-top: auto; padding: 14px 18px; border-top: 1px solid rgba(255, 255, 255, .08); font-size: 12.5px; color: var(--side-muted); }
.side .me b { color: var(--side-ink); display: block; font-weight: 600; }
.side .me button { margin-top: 8px; background: none; border: 1px solid rgba(255, 255, 255, .15); color: var(--side-ink); border-radius: 6px; padding: 4px 10px; cursor: pointer; }
.main { overflow-y: auto; min-width: 0; }
.page { padding: 24px 28px 60px; max-width: 1400px; }
.page.full { max-width: none; padding: 0; height: 100vh; display: flex; flex-direction: column; }
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head .grow { flex: 1; }
.crumbs { font-size: 12.5px; color: var(--muted); margin-bottom: 4px; }
.menu-btn { display: none; }

/* cards e tabelas */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card.pad { padding: 16px 18px; }
.card > header { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.card > header h2, .card > header h3 { flex: 1; }
.card .body { padding: 14px 18px; }
.grid { display: grid; gap: 16px; }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat { padding: 14px 16px; }
.stat .v { font-size: 26px; font-weight: 700; letter-spacing: -.02em; }
.stat .l { color: var(--muted); font-size: 12.5px; }
table.t { width: 100%; border-collapse: collapse; }
table.t th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; padding: 9px 12px; border-bottom: 1px solid var(--line); background: #fbfaf8; }
table.t td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t tr.click { cursor: pointer; }
table.t tr.click:hover td { background: #faf6f2; }
table.t input, table.t select { width: 100%; }
table.t td.num, table.t th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; }

/* botões e campos */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: 8px; padding: 7px 13px; font: inherit; font-weight: 550; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: #cfc6bc; background: #fbfaf8; text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.danger { color: var(--err); }
.btn.danger.primary, .modal .btn.danger { background: var(--err); border-color: var(--err); color: #fff; }
.btn.sm { padding: 4px 9px; font-size: 12.5px; }
.btn:disabled { opacity: .55; cursor: default; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.icon-btn { border: 0; background: none; cursor: pointer; font-size: 15px; color: var(--muted); padding: 4px 6px; border-radius: 6px; }
.icon-btn:hover { background: #f1ece6; color: var(--ink); }
input, select, textarea { font: inherit; color: inherit; border: 1px solid var(--line); border-radius: 7px; padding: 7px 9px; background: #fff; min-width: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
textarea { resize: vertical; width: 100%; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.form-grid .span-2 { grid-column: span 2; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 12.5px; color: var(--muted); font-weight: 550; }
.check { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.chip { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 12px; background: #f1ece6; color: var(--ink); white-space: nowrap; }
.chip.ok { background: #dcfce7; color: var(--ok); }
.chip.warn { background: #fef3c7; color: var(--warn); }
.chip.err { background: #fee2e2; color: var(--err); }
.chip.accent { background: var(--accent-soft); color: var(--accent); }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs button { border: 0; background: none; font: inherit; padding: 10px 14px; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; font-weight: 550; white-space: nowrap; }
.tabs button.on { color: var(--accent); border-bottom-color: var(--accent); }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.bar { height: 8px; background: #efe9e2; border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.thumb { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; background: #efe9e2; display: block; }

/* kanban */
.kanban { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 10px; align-items: flex-start; }
.kcol { flex: 0 0 250px; background: #efeae4; border-radius: var(--radius); padding: 10px; min-height: 120px; }
.kcol h4 { font-size: 12.5px; display: flex; justify-content: space-between; margin: 2px 4px 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.kcol.over { outline: 2px dashed var(--accent); }
.kcard { background: var(--panel); border-radius: 8px; padding: 10px; margin-bottom: 8px; box-shadow: var(--shadow); cursor: grab; display: grid; grid-template-columns: 40px 1fr; gap: 10px; }
.kcard .thumb { width: 40px; height: 40px; }
.kcard b { display: block; font-size: 13px; }
.kcard .meta { font-size: 11.5px; color: var(--muted); display: flex; gap: 6px; flex-wrap: wrap; margin-top: 3px; }

/* modal e avisos */
.modal-wrap { position: fixed; inset: 0; background: rgba(31, 27, 23, .42); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { background: var(--panel); border-radius: 12px; width: min(560px, 100%); max-height: 92vh; display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0, 0, 0, .25); }
.modal.wide { width: min(980px, 100%); }
.modal header { display: flex; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal header h3 { flex: 1; }
.modal-body { padding: 16px 18px; overflow-y: auto; }
.modal footer { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line); }
#toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.toast { background: var(--ink); color: #fff; padding: 10px 14px; border-radius: 8px; box-shadow: var(--shadow); transition: opacity .4s, transform .4s; max-width: 380px; }
.toast.error { background: var(--err); }
.toast.out { opacity: 0; transform: translateY(8px); }

/* login */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.auth .card { width: min(420px, 100%); padding: 28px; }
.auth h1 { margin-bottom: 4px; }
.auth-brand { display: flex; align-items: center; gap: 10px; }
.auth-brand .logo { width: 34px; height: 26px; flex: none; }
.auth form { display: grid; gap: 12px; margin-top: 18px; }
.auth input { width: 100%; }

/* CAD */
.cad { display: grid; grid-template-columns: 52px 1fr 300px; flex: 1; min-height: 0; }
.cad-top { display: flex; align-items: center; gap: 10px; padding: 8px 14px; border-bottom: 1px solid var(--line); background: var(--panel); flex-wrap: wrap; }
.cad-top .name { font-weight: 650; font-size: 15px; border: 1px solid transparent; background: none; padding: 4px 6px; width: 260px; }
.cad-top .name:hover, .cad-top .name:focus { border-color: var(--line); background: #fff; }
.tools { background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; padding: 8px 0; gap: 3px; overflow-y: auto; }
.tools button { width: 38px; height: 36px; border: 0; border-radius: 7px; background: none; cursor: pointer; font-size: 16px; color: var(--ink); position: relative; }
.tools button:hover { background: #f1ece6; }
.tools button.on { background: var(--accent); color: #fff; }
.tools hr { width: 26px; border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
.stage { position: relative; overflow: hidden; background: #fbfaf8; min-width: 0; }
.stage svg { width: 100%; height: 100%; display: block; user-select: none; touch-action: none; }
.stage .hint { position: absolute; left: 12px; bottom: 10px; background: rgba(31, 27, 23, .82); color: #fff; padding: 6px 10px; border-radius: 7px; font-size: 12.5px; pointer-events: none; max-width: 70%; }
.stage .coords { position: absolute; right: 12px; bottom: 10px; font-size: 12px; color: var(--muted); background: rgba(255, 255, 255, .9); padding: 3px 8px; border-radius: 6px; font-variant-numeric: tabular-nums; }
.props { background: var(--panel); border-left: 1px solid var(--line); overflow-y: auto; }
.props section { padding: 12px 14px; border-bottom: 1px solid var(--line); }
.props h4 { font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin-bottom: 10px; display: flex; align-items: center; justify-content: space-between; }
.props .row { display: grid; grid-template-columns: 92px 1fr; align-items: center; gap: 8px; margin-bottom: 7px; }
.props .row label { font-size: 12.5px; color: var(--muted); }
.props input, .props select { width: 100%; padding: 5px 7px; }
.props .pair { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.props .piece-item { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 7px; cursor: pointer; font-size: 13px; }
.props .piece-item:hover { background: #f6f2ee; }
.props .piece-item.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.props .piece-item span { flex: 1; }
.sizes { display: flex; flex-wrap: wrap; gap: 5px; }
.sizes label { display: flex; align-items: center; gap: 4px; font-size: 12.5px; padding: 3px 8px; border: 1px solid var(--line); border-radius: 99px; cursor: pointer; }
.sizes label i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.grade-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.grade-table td, .grade-table th { padding: 3px 4px; text-align: center; }
.grade-table input { width: 58px; padding: 3px 4px; text-align: right; }

/* encaixe */
.marker-view { background: #fff; border: 1px solid var(--line); border-radius: 8px; overflow: auto; }
.marker-view svg { display: block; }

/* moodboard */
.mood { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.mood figure { margin: 0; background: #fff; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; position: relative; }
.mood img { width: 100%; height: 180px; object-fit: cover; display: block; }
.mood figcaption { padding: 6px 8px; font-size: 12.5px; }
.mood figure button { position: absolute; top: 6px; right: 6px; background: rgba(255, 255, 255, .9); }
.concept { border: 1px solid var(--line); border-radius: 10px; padding: 14px; background: #fff; }
.concept ul { margin: 6px 0; padding-left: 18px; }

/* ficha técnica impressa */
.sheet { background: #fff; }
@media print {
  .side, .no-print, .page-head .btn-row, .tabs { display: none !important; }
  .shell { display: block; height: auto; }
  .main { overflow: visible; }
  .page { padding: 0; }
  .card { box-shadow: none; break-inside: avoid; }
  body { background: #fff; }
}

@media (max-width: 1100px) {
  .cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cad { grid-template-columns: 48px 1fr 260px; }
}
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 30% 0 0; z-index: 40; transform: translateX(-100%); transition: transform .2s; }
  .side.open { transform: none; }
  .menu-btn { display: inline-flex; }
  .page { padding: 16px 16px 60px; }
  .cols-2, .cols-3, .cols-4 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
  .cad { grid-template-columns: 44px 1fr; }
  .cad .props { display: none; }
}
