/* Layout: login landing (brand + miniature sheet | form), then app shell with side menu. Menus come from group permissions. */
:root {
  --bg: #eef1f3;
  --surface: #ffffff;
  --surface-2: #f4f6f7;
  --fg: #16212a;
  --muted: #5d6b76;
  --line: #d3dade;
  --accent: #0b6b6b;
  --accent-fg: #ffffff;
  --danger: #b3261e;
  --warn-bg: #fff4d6;
  --warn-fg: #6b4a00;
  --paper: #ffffff;
  --ink: #000000;
  --font-body: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
}
:root[data-accent="biru"] { --accent: #1f5fbf; }
:root[data-accent="jingga"] { --accent: #b4540a; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12191e; --surface: #1b252c; --surface-2: #222e36; --fg: #e6edf1; --muted: #93a2ad;
    --line: #34444e; --accent: #4fc3b8; --accent-fg: #07201e; --danger: #f08a82;
    --warn-bg: #3b3115; --warn-fg: #f3d98a; color-scheme: dark;
  }
  :root:not([data-theme="light"])[data-accent="biru"] { --accent: #86b3ff; }
  :root:not([data-theme="light"])[data-accent="jingga"] { --accent: #f2a465; }
}
:root[data-theme="dark"] {
  --bg: #12191e; --surface: #1b252c; --surface-2: #222e36; --fg: #e6edf1; --muted: #93a2ad;
  --line: #34444e; --accent: #4fc3b8; --accent-fg: #07201e; --danger: #f08a82;
  --warn-bg: #3b3115; --warn-fg: #f3d98a; color-scheme: dark;
}
:root[data-theme="dark"][data-accent="biru"] { --accent: #86b3ff; }
:root[data-theme="dark"][data-accent="jingga"] { --accent: #f2a465; }

* { box-sizing: border-box; }
body { background: var(--bg); color: var(--fg); font-family: var(--font-body); font-size: 14px; line-height: 1.45; padding-inline: 0; padding-block: 0; }
h1, h2, h3 { text-wrap: balance; }
button { font: inherit; font-size: 13px; font-weight: 500; border-radius: 4px; padding: 7px 12px; border: 1px solid var(--line); background: var(--surface-2); color: var(--fg); cursor: pointer; }
button:hover { border-color: var(--accent); }
button.primary { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
button.danger { color: var(--danger); }
button.armed { background: var(--danger); color: #fff; border-color: var(--danger); }
button.mini { font-size: 12px; padding: 3px 8px; }
button:disabled { opacity: 0.5; cursor: not-allowed; }
input[type=text], input[type=password], input[type=date], input[type=time], select, textarea { font: inherit; font-size: 14px; color: var(--fg); background: var(--surface-2); border: 1px solid var(--line); border-radius: 4px; padding: 7px 9px; width: 100%; min-width: 0; }
input[readonly], input:disabled, select:disabled { color: var(--muted); }
textarea { resize: vertical; min-height: 80px; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, .filebtn:focus-within { outline: 2px solid var(--accent); outline-offset: 1px; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); font-weight: 500; min-width: 0; }
label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--fg); font-size: 14px; }
label.check input { width: 16px; height: 16px; accent-color: var(--accent); }
.hint { color: var(--muted); font-size: 12px; margin: 0; }
.msg { color: var(--danger); font-size: 13px; }
.msg:empty { display: none; }
.logo { font-family: var(--font-mono); font-weight: 500; font-size: 12px; letter-spacing: 0.06em; background: var(--accent); color: var(--accent-fg); border-radius: 3px; padding: 3px 6px; }

/* landing */
.landing { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr); }
.brand { padding: 40px clamp(16px, 5vw, 64px); display: flex; flex-direction: column; justify-content: center; gap: 22px; border-right: 1px solid var(--line); min-width: 0; }
.brandtop { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 13px; }
.brand h1 { font-size: clamp(34px, 5vw, 54px); line-height: 1.02; margin: 0; letter-spacing: -0.02em; font-weight: 600; }
.lead { margin: 0; max-width: 46ch; color: var(--muted); font-size: 15px; }
.mini { background: var(--paper); color: var(--ink); font-family: Arial, Helvetica, sans-serif; border: 1px solid var(--line); box-shadow: 0 2px 10px rgba(0,0,0,0.12); padding: 14px; overflow-x: auto; max-width: 100%; }
.mini .t { text-align: center; font-weight: 700; font-size: 12px; }
.mini .c { text-align: center; font-weight: 700; font-size: 10px; margin-bottom: 8px; }
.mini table { border-collapse: collapse; width: 100%; min-width: 560px; font-size: 10px; }
.mini th, .mini td { border: 1px solid var(--ink); padding: 2px 4px; vertical-align: top; }
.mini th { background: #e9e9e9; }
.loginwrap { display: grid; place-items: center; padding: 32px 16px; }
.login { width: 100%; max-width: 360px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 18px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.panel h2 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); font-weight: 600; margin: 0; }
.login h2 { font-size: 18px; text-transform: none; letter-spacing: 0; color: var(--fg); }
.foot { padding: 14px 16px 22px; text-align: center; color: var(--muted); font-size: 12px; font-family: var(--font-mono); }
@media (max-width: 860px) { .landing { grid-template-columns: minmax(0, 1fr); } .brand { border-right: 0; border-bottom: 1px solid var(--line); padding-block: 28px; } }

/* shell */
.bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; }
.bl, .br { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.brandname { font-size: 16px; font-weight: 600; }
.ver { font-family: var(--font-mono); font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 1px 8px; }
.who { color: var(--muted); font-size: 13px; }
.shell { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 20px; max-width: 1500px; margin: 0 auto; padding: 16px; align-items: start; }
.side { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 64px; }
.side .grp { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); font-weight: 600; margin: 14px 0 4px 10px; }
.navbtn { text-align: left; border: 0; background: transparent; padding: 8px 10px; border-radius: 4px; width: 100%; }
.navbtn:hover { background: var(--surface-2); }
.navbtn.on { background: var(--surface); box-shadow: inset 3px 0 0 var(--accent); font-weight: 600; border: 0; }
@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { flex-direction: row; overflow-x: auto; position: static; gap: 4px; padding-bottom: 4px; }
  .side .grp { display: none; }
  .navbtn { width: auto; white-space: nowrap; border: 1px solid var(--line); }
}
.main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.vt { font-size: 22px; margin: 0; font-weight: 600; letter-spacing: -0.01em; }
.vhead { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.callout { background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 4px; padding: 10px 14px; }
.callout.warn { background: var(--warn-bg); color: var(--warn-fg); border-color: var(--warn-fg); }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 12px 14px; min-width: 0; }
.tile .k { font-size: 12px; color: var(--muted); }
.tile .v { font-size: 22px; font-weight: 600; font-family: var(--font-mono); overflow-wrap: anywhere; }
.tile .v.sm { font-size: 14px; font-family: var(--font-body); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.card { text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.card:hover { border-color: var(--accent); }
.card b { font-size: 14px; }
.card span.d { color: var(--muted); font-size: 12px; }
.badges { display: flex; gap: 4px; flex-wrap: wrap; }
.badge { font-family: var(--font-mono); font-size: 11px; border: 1px solid var(--line); border-radius: 3px; padding: 0 5px; color: var(--muted); }
.badge.on { color: var(--accent); border-color: var(--accent); }
.sect { font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); font-weight: 600; margin: 0; }
.tblwrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
table.dt { border-collapse: collapse; width: 100%; font-size: 13px; }
table.dt th, table.dt td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.dt th { font-size: 12px; color: var(--muted); font-weight: 600; white-space: nowrap; }
table.dt tr:last-child td { border-bottom: 0; }
table.dt td.ctr, table.dt th.ctr { text-align: center; }
.mono { font-family: var(--font-mono); }
.two { display: grid; grid-template-columns: minmax(0, 420px) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1100px) { .two { grid-template-columns: minmax(0, 1fr); } }
.row2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 2px 4px 2px 10px; font-size: 13px; }
.chip button { border: 0; background: transparent; padding: 0 6px; font-size: 15px; line-height: 1; color: var(--muted); }
.total { font-family: var(--font-mono); font-size: 13px; background: var(--surface-2); border: 1px dashed var(--line); border-radius: 4px; padding: 8px 10px; display: flex; justify-content: space-between; }
.photos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.photo { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.photo .cap { font-size: 12px; color: var(--muted); font-weight: 500; }
.thumb { aspect-ratio: 4 / 3; max-width: 100%; border: 1px dashed var(--line); border-radius: 4px; background: var(--surface-2); display: grid; place-items: center; overflow: hidden; color: var(--muted); font-size: 12px; text-align: center; padding: 4px; }
.thumb img { width: 100%; height: 100%; object-fit: contain; display: block; }
.filebtn { position: relative; display: inline-block; text-align: center; font-size: 13px; font-weight: 500; border: 1px solid var(--line); border-radius: 4px; padding: 6px 10px; background: var(--surface-2); cursor: pointer; }
.filebtn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.list li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.list li.editing { background: var(--surface-2); box-shadow: inset 3px 0 0 var(--accent); }
.list .n { font-family: var(--font-mono); color: var(--muted); font-size: 12px; }
.list .t { min-width: 0; }
.list .t b { font-weight: 600; display: block; overflow-wrap: anywhere; }
.list .t span { color: var(--muted); font-size: 12px; }
.pill { display: inline-block; font-size: 11px; font-weight: 600; color: var(--danger); border: 1px solid var(--danger); border-radius: 999px; padding: 0 6px; margin-left: 6px; }
.btns { display: flex; gap: 6px; flex-wrap: wrap; }
.hidebox { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px 12px; }
.scroller { overflow-x: auto; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-2); padding: 16px; }
.paper { background: var(--paper); color: var(--ink); font-family: Arial, Helvetica, sans-serif; font-size: 11px; width: 1040px; max-width: none; margin: 0; padding: 0; }
.pagepreview { background: var(--paper); box-shadow: 0 1px 6px rgba(0,0,0,0.25); margin: 0 auto; box-sizing: content-box; }
.sheetgrid { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 16px; align-items: start; }
.psettings { position: sticky; top: 64px; }
@media (max-width: 1100px) { .sheetgrid { grid-template-columns: minmax(0, 1fr); } .psettings { order: -1; position: static; } }
.paper.nophoto td.ph img { display: none; }
.rad { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.rad legend { font-size: 12px; color: var(--muted); font-weight: 500; margin-bottom: 6px; padding: 0; }
.paper .title { text-align: center; font-weight: 700; font-size: 16px; letter-spacing: 0.02em; }
.paper .company { text-align: center; font-weight: 700; font-size: 13px; margin-bottom: 14px; }
.paper .info { display: grid; grid-template-columns: 70px 1fr 1fr; row-gap: 4px; margin-bottom: 10px; font-size: 12px; }
.paper .info b { font-weight: 700; }
.paper .legend { grid-column: 3; grid-row: 2 / span 2; display: flex; gap: 6px; align-items: flex-start; }
.paper table { border-collapse: collapse; width: 100%; table-layout: fixed; }
.paper th, .paper td { border: 1px solid var(--ink); padding: 2px 5px; vertical-align: top; overflow-wrap: anywhere; }
.paper th { background: #e9e9e9; text-align: center; font-weight: 700; vertical-align: middle; }
.paper td.c { text-align: center; }
.paper td.nm { height: 19px; }
.paper td.ph { padding: 3px; text-align: center; vertical-align: middle; }
.paper td.ph img { max-width: 100%; max-height: 175px; display: block; margin: 0 auto; }
.paper td.tm { text-align: center; font-weight: 700; }
.paper tbody { break-inside: avoid; page-break-inside: avoid; }
.paper .libur { font-weight: 700; }
.paper .empty { text-align: center; padding: 28px; color: #555; }

@media print {
  body { background: #fff; }
  .bar, .side, .vhead, .foot, .landing, .noprint { display: none !important; }
  .shell { display: block; padding: 0; max-width: none; }
  .scroller { border: 0; padding: 0; background: #fff; overflow: visible; }
  .sheetgrid { display: block; }
  .pagepreview { zoom: 1 !important; width: auto !important; padding: 0 !important; box-shadow: none !important; background: none !important; }
  .paper th { background: #e9e9e9 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .paper thead { display: table-header-group; }
}

/* v0.0.6: dasar halaman penuh, status koneksi, toast */
[hidden] { display: none !important; }
body { margin: 0; }
img { max-width: 100%; }
.netwarn { position: fixed; left: 0; right: 0; top: 0; z-index: 50; background: var(--danger); color: #fff; text-align: center; padding: 6px 12px; font-size: 13px; }
.toast { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 40; background: var(--fg); color: var(--bg); border-radius: 6px; padding: 8px 14px; font-size: 13px; max-width: calc(100vw - 32px); box-shadow: 0 2px 10px rgba(0,0,0,0.3); }
@media print { .netwarn, .toast { display: none !important; } }
