/* Punalu'u Bake Shop — Master Record. Internal. Tablet-first. */
:root {
  --ink: #10243f;
  --ink-soft: #3d5270;
  --paper: #f4f7fb;
  --panel: #ffffff;
  --line: #d5e2f2;
  --line-strong: #b7cbe6;
  --lava: #1d4f9c;
  --lava-deep: #163e7a;
  --crust: #e0a21a;
  --moss: #2f6b32;
  --sea: #1d4f9c;
  --danger: #9f1239;
  --warn: #b45309;
  --ok: #2f6b32;
  --side: #10243f;
  --side-text: #f4f7fb;
  --side-dim: #c5d4ea;
  --shadow: 0 1px 0 rgba(28, 23, 18, 0.04), 0 10px 28px rgba(28, 23, 18, 0.05);
  --sans: "Segoe UI", "Avenir Next", "Helvetica Neue", sans-serif;
  --serif: "Iowan Old Style", Palatino, "Palatino Linotype", Georgia, serif;
  --mono: "ui-monospace", "SF Mono", Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--sans);
  color: var(--ink);
  background: var(--paper);
  font-size: 15px;
  line-height: 1.45;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--lava-deep); }

.app { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side {
  background: var(--side);
  color: var(--side-text);
  padding: 18px 12px 24px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
}
.brand { display: flex; gap: 10px; align-items: center; padding: 4px 8px 16px; }
.mark {
  width: 36px; height: 36px; flex: none;
  border-radius: 10px;
  background: linear-gradient(160deg, #c2410c, #7c2d12 55%, #1c1712);
  display: grid; place-items: center;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.15);
}
.brand h1 { font-family: var(--serif); font-size: 16px; margin: 0; font-weight: 600; letter-spacing: 0.01em; }
.brand p { margin: 1px 0 0; color: var(--side-dim); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav button {
  text-align: left;
  background: transparent;
  border: 0;
  color: var(--side-dim);
  padding: 9px 10px;
  border-radius: 8px;
  display: flex; gap: 8px; align-items: center;
}
.nav button.on, .nav button:hover { background: rgba(255,255,255,.06); color: white; }
.nav svg { width: 16px; height: 16px; flex: none; opacity: .85; }
.side-foot { margin-top: 22px; padding: 10px; color: var(--side-dim); font-size: 12px; border-top: 1px solid rgba(255,255,255,.08); }

.main { min-width: 0; }
.top {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(255,252,247,.9);
  position: sticky; top: 0; z-index: 5;
  backdrop-filter: blur(8px);
}
.top h2 { font-family: var(--serif); font-size: 22px; margin: 0; font-weight: 600; }
.top .sub { color: var(--ink-soft); font-size: 12px; }
.spacer { flex: 1; }
.role, .search {
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 7px 10px;
}
.search { width: 220px; }
.view { padding: 18px 20px 48px; }

.banner {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #7c2d12;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  margin-bottom: 14px;
}
.grid-4, .grid-3, .grid-2 { display: grid; gap: 12px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: 1.2fr .8fr; }
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  box-shadow: var(--shadow);
}
.card h3 { margin: 0 0 8px; font-size: 13px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-soft); font-weight: 650; }
.metric { font-family: var(--serif); font-size: 28px; font-variant-numeric: tabular-nums; }
.metric small { font-family: var(--sans); font-size: 12px; color: var(--ink-soft); margin-left: 4px; }
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  border-radius: 999px; padding: 3px 8px; font-size: 12px; font-weight: 650;
  background: #f5f5f4; color: var(--ink);
}
.pill.ok { background: #ecfccb; color: #3f6212; }
.pill.warn { background: #ffedd5; color: #9a3412; }
.pill.bad { background: #ffe4e6; color: #9f1239; }
.pill.sea { background: #e0f2fe; color: #0c4a6e; }
.pill.muted { background: #f5f5f4; color: #57534e; }

table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
th, td { padding: 7px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { font-size: 11px; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-soft); font-weight: 650; background: #faf7f2; position: sticky; top: 0; }
tr.click:hover { background: #fff7ed; cursor: pointer; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.neg { color: var(--danger); font-weight: 650; }
.pos { color: var(--moss); }
.miss { color: var(--warn); font-weight: 650; }
.scroll { overflow: auto; max-height: 68vh; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.scroll table { min-width: 720px; }
.wide { min-width: 1680px; }
.sticky { position: sticky; left: 0; background: #fffcf7; z-index: 1; }

.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.btn, .btn-ghost, .btn-bad {
  border-radius: 8px; padding: 8px 12px; border: 1px solid var(--lava);
  background: var(--lava); color: white; font-weight: 650;
}
.btn-ghost { background: var(--panel); color: var(--ink); border-color: var(--line-strong); font-weight: 600; }
.btn-bad { background: var(--danger); border-color: var(--danger); }
.btn[disabled], .btn-ghost[disabled] { opacity: .45; cursor: not-allowed; }
.seg button { background: transparent; border: 1px solid var(--line-strong); padding: 6px 10px; border-radius: 8px; }
.seg button.on { background: var(--ink); color: white; border-color: var(--ink); }

label.f { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--ink-soft); min-width: 120px; }
label.f input, label.f select, label.f textarea {
  border: 1px solid var(--line-strong); border-radius: 8px; padding: 8px; background: white; color: var(--ink);
}
.codes { display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 8px; }
.codes label { font-size: 12px; }
.help { color: var(--ink-soft); font-size: 13px; }
.kvs { display: grid; grid-template-columns: 160px 1fr; gap: 4px 10px; font-size: 14px; }
.kvs b { font-weight: 600; }

.modal-back {
  position: fixed; inset: 0; background: rgba(28,23,18,.45);
  display: flex; justify-content: flex-end; z-index: 20;
}
.drawer {
  width: min(760px, 100%); background: var(--paper); height: 100%; overflow: auto;
  padding: 18px 18px 40px; box-shadow: -20px 0 40px rgba(0,0,0,.15);
}
.packet { background: white; border: 1px solid var(--line); padding: 22px; border-radius: 8px; }
.packet h2, .packet h3 { font-family: var(--serif); }
.key { background: #fff1f2; border: 1px dashed #fda4af; }

.map-list { display: grid; gap: 8px; }
.map-item { display: grid; grid-template-columns: 180px 1fr 1.2fr; gap: 10px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.map-item b { font-family: var(--serif); }

.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal .d { border: 1px solid var(--line); border-radius: 8px; padding: 8px; background: var(--panel); min-height: 72px; cursor: pointer; }
.cal .d.off { background: #f5f5f4; color: #78716c; }
.cal .d small { display: block; color: var(--ink-soft); }
.preview img { max-width: 100%; border-radius: 8px; margin-top: 8px; }
.preview table { font-size: 12px; }
.file-card { margin-bottom: 10px; }

@media (max-width: 980px) {
  .app { grid-template-columns: 1fr; }
  .side { position: relative; height: auto; }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .grid-4, .grid-3, .grid-2, .map-item { grid-template-columns: 1fr; }
  .search { width: 140px; }
}
@media print {
  .side, .top, .no-print, .banner { display: none !important; }
  .app { display: block; }
  .view { padding: 0; }
  body { background: white; }
  .card, .packet { box-shadow: none; }
  a { color: black; text-decoration: none; }
}

.choose { text-align: left; cursor: pointer; min-height: 140px; }
.choose p { margin: 0 0 12px; color: var(--ink-soft); }
.choose-grid { grid-template-columns: 1fr 1fr; }
.prod-layout { display: grid; grid-template-columns: 1.3fr .7fr; gap: 16px; align-items: start; }
.cal .d.on { border-color: var(--lava); box-shadow: inset 0 0 0 1px var(--lava); }
.cal .d b { font-family: var(--serif); font-size: 18px; }
.preview { overflow: auto; max-height: 280px; }
@media (max-width: 980px) {
  .prod-layout, .choose-grid { grid-template-columns: 1fr; }
}


.logo { width: 220px; display: block; margin: 0 auto 8px; }
.logo-side { width: 100%; border-radius: 12px; background: white; }
.login-card { text-align: center; }
.month-title { font-family: var(--serif); font-size: 22px; }
.month-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.month-grid .month { min-height: 84px; align-items: flex-start; }
.month-grid .month span { color: var(--ink-soft); font-size: 12px; }
.section { margin: 16px 0 8px; font-size: 13px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-soft); }
.alert-row { width: 100%; text-align: left; background: transparent; border: 0; border-bottom: 1px solid var(--line); padding: 8px 2px; display: flex; gap: 10px; align-items: center; }
.alert-row:hover { background: #eef5ff; }
.link { background: none; border: 0; color: var(--lava); padding: 0; font-weight: 650; }
.ok-banner { background: #ecfccb; border-color: #bef264; color: #3f6212; }
.preview iframe { width: 100%; height: 280px; border: 1px solid var(--line); border-radius: 8px; background: white; }
.btn { background: var(--lava); }
.cal .d.on { border-color: var(--lava); background: #e8f1ff; }
@media (max-width: 980px) { .month-grid { grid-template-columns: repeat(3, 1fr); } }

.light { width: 14px; height: 14px; border-radius: 50%; display: inline-block; flex: none; vertical-align: middle; }
.light.on { background: #16a34a; box-shadow: 0 0 0 4px rgba(22,163,74,.18); }
.light.off { background: #dc2626; box-shadow: 0 0 0 4px rgba(220,38,38,.16); }
.file-card { display: flex; gap: 12px; align-items: flex-start; }
.subtabs { margin-bottom: 12px; }
.month-grid .month { display: flex; flex-direction: column; gap: 4px; }

.nav button { white-space: normal; line-height: 1.3; }
.unit-list { display: grid; gap: 12px; margin-top: 12px; }
.unit { display: grid; grid-template-columns: 180px 1fr; gap: 14px; align-items: start; }
.unit-photo { width: 180px; height: 140px; object-fit: cover; border-radius: 10px; background: #e8f1ff; border: 1px solid var(--line); }
.unit-photo.empty { display: grid; place-items: center; color: var(--ink-soft); font-size: 13px; }
.file-btn { position: relative; overflow: hidden; display: inline-flex; margin-top: 8px; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
textarea { width: 100%; min-height: 72px; border: 1px solid var(--line-strong); border-radius: 8px; padding: 8px; background: white; }
@media (max-width: 800px) { .unit { grid-template-columns: 1fr; } }

.home-layout { display: grid; grid-template-columns: 1.4fr .6fr; gap: 14px; align-items: start; }
.post { border-top: 1px solid var(--line); margin-top: 10px; padding-top: 8px; }
.cal .d { position: relative; }
.cal .d .tip { display: none; position: absolute; left: 0; top: 100%; z-index: 4; width: 180px; background: #10243f; color: white; border-radius: 8px; padding: 6px 8px; font-size: 12px; text-align: left; }
.cal .d:hover .tip { display: block; }
@media (max-width: 900px) { .home-layout { grid-template-columns: 1fr; } }

.batch-bar { display: flex; gap: 16px; align-items: end; margin: 12px 0; }
.batch-bar select { margin-left: 8px; background: white; border: 1px solid var(--line-strong); border-radius: 8px; padding: 7px 10px; }
.batch-cal .d { min-height: 72px; }
.batch-day.has { background: #ecfdf3; }
.batch-day.has b { color: #166534; }

.bar-row { display: grid; grid-template-columns: 90px 1fr auto; gap: 8px; align-items: center; margin: 8px 0; }
.bar { display: flex; height: 16px; background: #eef3f8; border-radius: 8px; overflow: hidden; }
.bar i { display: block; height: 100%; }
.bar i.bad { background: #dc2626; }
.bar i.ok { background: #16a34a; }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 4px; }
.swatch.bad { background: #dc2626; }
.swatch.ok { background: #16a34a; }
