:root {
  --bg: #f5f2ed; --panel: #fff; --ink: #1f1a16; --ink2: #4b433c; --muted: #7d736a; --line: #e7e0d6;
  --head: #2a211b; --accent: #1d7a4c; --bad: #b3261e; --warn: #9a6400; --bar: #8a5a3c; --sel: #fff6e2;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 14.5px/1.4 system-ui, "Segoe UI", Roboto, Arial, sans-serif; }
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.num, td.r, th.r { font-variant-numeric: tabular-nums; text-align: right; }

.loginwrap { min-height: 100vh; display: grid; place-items: center; background: var(--head); }
.loginwrap .card { width: 320px; display: flex; flex-direction: column; gap: 10px; }
.loginwrap h1 { margin: 0; }
.loginwrap input { height: 48px; font-size: 22px; text-align: center; letter-spacing: .3em; border: 1px solid var(--line); border-radius: 8px; }

#shell { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
nav { background: var(--head); color: #efe6db; padding: 14px 10px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
nav .brand { font-weight: 800; font-size: 17px; padding: 4px 10px 14px; }
nav .sec { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; opacity: .55; padding: 14px 10px 4px; }
nav a { display: block; color: inherit; text-decoration: none; padding: 8px 10px; border-radius: 7px; }
nav a:hover { background: rgba(255,255,255,.07); }
nav a.on { background: rgba(255,255,255,.14); font-weight: 650; }
main { padding: 22px 28px 60px; min-width: 0; }
h1.pt { margin: 0 0 4px; font-size: 24px; }
.sub { color: var(--muted); margin: 0 0 18px; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; margin-bottom: 16px; }
.card h2 { margin: 0 0 10px; font-size: 16px; }
.card h3 { margin: 14px 0 6px; font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.tile .l { color: var(--muted); font-size: 12.5px; font-weight: 600; }
.tile .v { font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; margin-top: 2px; }
.tile .s { color: var(--muted); font-size: 12.5px; }

.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.toolbar .grow { flex: 1; }
.btn { height: 36px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line); background: #fff; font-weight: 600; color: var(--ink); }
.btn:hover { background: #faf7f2; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.danger { color: var(--bad); }
.btn.solid-danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.sm { height: 28px; padding: 0 10px; font-size: 13px; }
.chip { height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: #fff; font-weight: 600; color: var(--ink2); }
.chip.on { background: var(--head); color: #fff; border-color: var(--head); }
input.in, select.in { height: 36px; padding: 0 10px; border: 1px solid #d9d0c4; border-radius: 8px; background: #fff; }

table.t { width: 100%; border-collapse: collapse; background: var(--panel); }
table.t th, table.t td { padding: 7px 10px; border-bottom: 1px solid #f0ebe3; text-align: left; vertical-align: middle; }
table.t th { font-size: 12px; color: var(--muted); font-weight: 650; position: sticky; top: 0; background: #fbf9f6; white-space: nowrap; }
table.t tr.grp td { background: #f7f2ea; font-weight: 700; }
table.t tr.tot td { font-weight: 800; border-top: 2px solid var(--line); }
table.t tr.click { cursor: pointer; } table.t tr.click:hover td { background: var(--sel); }
table.t tr.inactive td { opacity: .45; }
.wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
.sw { display: inline-block; width: 14px; height: 14px; border-radius: 4px; vertical-align: -2px; margin-right: 6px; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; background: #eee7dc; color: var(--ink2); }
.tag.good { background: #def0e5; color: #145a36; } .tag.bad { background: #f8dfdc; color: var(--bad); } .tag.warn { background: #fbecc8; color: #7a4e00; }
.gp-low { color: var(--bad); font-weight: 700; }

/* single-series magnitude bars inside table cells */
.barcell { width: 38%; }
.bar { height: 14px; background: var(--bar); border-radius: 0 4px 4px 0; min-width: 1px; }

/* menu engineering */
.me-legend { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 12px; }
.me-legend div { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: #fff; font-size: 13px; }
.me-legend b { display: block; font-size: 14px; }
.cls { font-weight: 800; }
.cls::before { margin-right: 4px; }
.cls.Star::before { content: "★"; } .cls.Ploughhorse::before { content: "▲"; } .cls.Puzzle::before { content: "?"; } .cls.Dog::before { content: "▼"; }
.quad { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.quad > div { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; min-height: 70px; background: #fff; }
.quad h4 { margin: 0 0 4px; font-size: 13px; }
.quad .items-l { font-size: 13px; color: var(--ink2); }

/* drawer form */
.ov { position: fixed; inset: 0; background: rgba(20,14,10,.4); z-index: 40; display: flex; justify-content: flex-end; }
.drawer { width: min(560px, 100vw); height: 100%; background: #fff; overflow-y: auto; padding: 20px 22px 80px; box-shadow: -10px 0 30px rgba(0,0,0,.2); }
.drawer h2 { margin: 0 0 14px; }
.f { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.f label { font-size: 12.5px; font-weight: 650; color: var(--muted); }
.f input, .f select, .f textarea { height: 38px; padding: 0 10px; border: 1px solid #d9d0c4; border-radius: 8px; }
.f .hint { font-size: 12px; color: var(--muted); }
.f2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.f3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.checks { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.checks label { font-size: 14px; color: var(--ink); font-weight: 500; display: flex; gap: 6px; align-items: center; }
.calc { background: #f7f3ec; border-radius: 10px; padding: 10px 12px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 12px; }
.calc div { font-size: 12px; color: var(--muted); } .calc b { display: block; font-size: 17px; color: var(--ink); font-variant-numeric: tabular-nums; }
.foot { position: sticky; bottom: -80px; background: #fff; padding: 14px 0; display: flex; gap: 8px; justify-content: flex-end; border-top: 1px solid var(--line); margin-top: 16px; }

.alert { border-radius: 10px; padding: 10px 14px; margin-bottom: 12px; font-weight: 600; }
.alert.bad { background: #f8dfdc; color: var(--bad); } .alert.warn { background: #fbecc8; color: #6d4600; } .alert.good { background: #def0e5; color: #145a36; }

#toast { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 90; }
#toast div { background: var(--head); color: #fff; padding: 10px 16px; border-radius: 8px; font-weight: 600; }
#toast div.bad { background: var(--bad); }

@media print {
  nav, .toolbar, .noprint { display: none !important; }
  #shell { display: block; } main { padding: 0; } .card, .wrap { border: 0; }
  body { background: #fff; }
}
.f { min-width: 0; }
.f input.in, .f select.in { width: 100%; min-width: 0; }

/* menu engineering chart */
.mechart svg { width: 100%; height: auto; display: block; }
.mechart .g { stroke: #efe9e0; stroke-width: 1; }
.mechart .cross { stroke: #9b8f84; stroke-width: 1.5; stroke-dasharray: 5 4; }
.mechart .ax { fill: var(--muted); font-size: 11.5px; }
.mechart .at { fill: var(--ink2); font-size: 12.5px; font-weight: 600; }
.mechart .ql { fill: var(--ink2); font-size: 14px; font-weight: 700; }
.mechart .lb { fill: var(--ink); font-size: 11.5px; font-weight: 600; paint-order: stroke; stroke: #fff; stroke-width: 3px; stroke-linejoin: round; }
.mechart .dot { fill: var(--bar); fill-opacity: .82; stroke: #fff; stroke-width: 2; cursor: pointer; }
.mechart .dot:hover, .mechart .dot:focus { fill-opacity: 1; stroke: var(--ink); outline: none; }
.metip { position: absolute; width: 290px; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.15); padding: 10px 12px; font-size: 13px; line-height: 1.45; z-index: 5; pointer-events: none; }

/* ---- cloud admin additions ---- */
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.pill.active { background: #def0e5; color: #145a36; }
.pill.overdue { background: #fbecc8; color: #7a4e00; }
.pill.suspended { background: #f8dfdc; color: var(--bad); }
.pill.cancelled { background: #e9e4dd; color: #6d655d; }
.code { font: 700 26px/1.2 ui-monospace, Menlo, Consolas, monospace; letter-spacing: .12em; background: #f7f3ec; border: 1px dashed #cdbfae; border-radius: 10px; padding: 6px 12px; display: inline-block; }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 6px 14px; font-size: 14px; }
.kv div:nth-child(odd) { color: var(--muted); }
.banner-preview { background: #fbecc8; color: #6d4600; border-radius: 8px; padding: 10px 12px; font-weight: 600; }
.banner-preview.bad { background: #f8dfdc; color: var(--bad); }
.toggle { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 600; }
.toggle input { width: 18px; height: 18px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.err { color: var(--bad); font-weight: 600; min-height: 20px; }
.loginwrap .card { width: 340px; }
.loginwrap .card input { height: 44px; font-size: 16px; letter-spacing: normal; text-align: left; padding: 0 12px; }
.loginwrap #totp { letter-spacing: .3em; text-align: center; font-size: 22px; }
.small { font-size: 12.5px; }
