:root {
  --blue: #0A6FB0; --blue-dark: #0B2E59; --blue-50: #E6F1FA; --blue-100: #C9D8EA;
  --ink: #13233A; --ink-2: #3C4C60; --muted: #5A6B80; --line: #DCE4EE; --bg: #F3F6FA; --card: #FFFFFF;
  --green: #13693C; --green-50: #E3F4EA; --orange: #8A4105; --orange-50: #FCEFE2; --red: #A61B22; --red-50: #FBE9EA;
  --radius: 14px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font-family: 'Be Vietnam Pro', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; font-size: 16px; line-height: 1.45;
  -webkit-tap-highlight-color: transparent; min-height: 100dvh; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--blue); }
.hidden { display: none !important; }

#app { max-width: 560px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 5; background: var(--blue-dark); color: #fff; padding: calc(env(safe-area-inset-top) + 10px) 16px 12px;
  display: flex; align-items: center; gap: 12px; }
.topbar h1 { font-size: 18px; margin: 0; font-weight: 600; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .icon-btn { color: #fff; }
.icon-btn { background: none; border: 0; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 10px; cursor: pointer; flex: none; }
.icon-btn:active { background: rgba(255,255,255,.15); }
.icon-btn svg { width: 24px; height: 24px; }
main { flex: 1; padding: 16px 16px calc(env(safe-area-inset-bottom) + 24px); display: flex; flex-direction: column; gap: 16px; }

.hero { background: var(--blue-dark); color: #fff; margin: -16px -16px 0; padding: 4px 16px 20px; }
.hero .hello { font-size: 14px; opacity: .8; }
.hero .name { font-size: 22px; font-weight: 700; }
.hero .role { display: inline-block; margin-top: 6px; font-size: 13px; background: rgba(255,255,255,.14); padding: 3px 10px; border-radius: 99px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card h2 { font-size: 16px; margin: 0 0 12px; }
.section-title { font-size: 14px; font-weight: 600; color: var(--muted); margin: 4px 2px -6px; text-transform: uppercase; letter-spacing: .04em; }

.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 6px 12px; text-align: center; text-decoration: none; color: var(--ink);
  display: flex; flex-direction: column; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; min-height: 104px; cursor: pointer; }
.tile:active { background: var(--blue-50); }
.tile .ic { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; background: var(--blue-50); color: var(--blue); }
.tile .ic svg { width: 26px; height: 26px; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.stat .v { font-size: 22px; font-weight: 700; }
.stat .l { font-size: 12px; color: var(--muted); }
.stat.ok .v { color: var(--green); } .stat.warn .v { color: var(--orange); } .stat.bad .v { color: var(--red); }

label.field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 500; color: var(--ink-2); }
input, select, textarea { width: 100%; padding: 12px 14px; border: 1px solid var(--blue-100); border-radius: 10px; background: #fff; min-height: 48px; font-size: 16px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--blue); outline-offset: 0; border-color: var(--blue); }
.form { display: flex; flex-direction: column; gap: 14px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.hint { font-size: 13px; color: var(--muted); }

.btn { appearance: none; border: 0; border-radius: 12px; min-height: 50px; padding: 12px 18px; font-weight: 600; font-size: 16px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; }
.btn svg { width: 20px; height: 20px; }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:active { background: #0A5A90; }
.btn-ghost { background: var(--blue-50); color: var(--blue-dark); }
.btn-danger { background: var(--red); color: #fff; }
.btn-green { background: var(--green); color: #fff; }
.btn-sm { min-height: 40px; padding: 8px 12px; font-size: 14px; border-radius: 10px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: default; }

.login { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 24px; gap: 20px; }
.login .brand { text-align: center; }
.login .brand img { width: 120px; height: 120px; }
.login .brand h1 { margin: 8px 0 0; font-size: 20px; color: var(--red); letter-spacing: .02em; }
.login .brand p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }

.list { display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-top: 1px solid var(--line); min-height: 64px; }
.item:first-child { border-top: 0; }
.item .grow { flex: 1; min-width: 0; }
.item .t { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .s { font-size: 13px; color: var(--muted); }
.item a.t { color: var(--ink); text-decoration: none; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--blue-50); color: var(--blue-dark); display: grid; place-items: center; font-weight: 700; flex: none; }

.badge { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: var(--blue-50); color: var(--blue-dark); white-space: nowrap; }
.badge.ok { background: var(--green-50); color: var(--green); }
.badge.warn { background: var(--orange-50); color: var(--orange); }
.badge.bad { background: var(--red-50); color: var(--red); }

.notice { border-radius: 12px; padding: 12px 14px; font-size: 14px; background: var(--blue-50); color: var(--blue-dark); }
.notice.ok { background: var(--green-50); color: var(--green); }
.notice.warn { background: var(--orange-50); color: var(--orange); }
.notice.bad { background: var(--red-50); color: var(--red); }

.big-clock { text-align: center; }
.big-clock .time { font-size: 44px; font-weight: 700; letter-spacing: .02em; font-variant-numeric: tabular-nums; }
.big-clock .date { color: var(--muted); }
.check-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.check-actions .btn { min-height: 64px; font-size: 18px; }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 14px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; font-weight: 500; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
table { border-collapse: collapse; font-size: 13px; width: 100%; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { background: var(--bg); font-weight: 600; position: sticky; top: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.sheet td.d { text-align: center; min-width: 30px; padding: 8px 4px; }
table.sheet th.d { text-align: center; padding: 8px 4px; }

.photo-thumb { width: 52px; height: 52px; border-radius: 10px; object-fit: cover; background: var(--line); flex: none; }
.cccd-photos { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.photo-slot { border: 2px dashed var(--blue-100); border-radius: 12px; aspect-ratio: 1.58; display: grid; place-items: center; text-align: center; font-size: 13px;
  color: var(--muted); background: #fff; cursor: pointer; overflow: hidden; padding: 0; }
.photo-slot img { width: 100%; height: 100%; object-fit: cover; }

.modal { position: fixed; inset: 0; z-index: 50; background: #000; display: flex; flex-direction: column; }
.modal video, .modal .preview { flex: 1; width: 100%; object-fit: cover; min-height: 0; background: #000; }
.modal .bar { display: flex; align-items: center; justify-content: space-around; gap: 12px; padding: 16px 16px calc(env(safe-area-inset-bottom) + 18px); background: #000; }
.modal .bar .btn { min-width: 110px; }
.shutter { width: 76px; height: 76px; border-radius: 50%; border: 5px solid #fff; background: rgba(255,255,255,.25); cursor: pointer; }
.shutter:active { background: rgba(255,255,255,.6); }
.modal .msg { position: absolute; top: calc(env(safe-area-inset-top) + 14px); left: 16px; right: 16px; color: #fff; text-align: center; font-size: 15px;
  background: rgba(0,0,0,.45); padding: 8px 12px; border-radius: 10px; }
.modal .frame { position: absolute; left: 10%; right: 10%; top: 25%; aspect-ratio: 1; border: 3px solid rgba(255,255,255,.85); border-radius: 18px; pointer-events: none; }
.modal.sheet { background: rgba(0,0,0,.5); justify-content: flex-end; }
.modal.sheet .panel { background: #fff; border-radius: 18px 18px 0 0; padding: 20px 16px calc(env(safe-area-inset-bottom) + 20px); max-height: 90dvh; overflow: auto;
  display: flex; flex-direction: column; gap: 14px; max-width: 560px; width: 100%; margin: 0 auto; }
.modal.sheet .panel h2 { margin: 0; font-size: 18px; }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(env(safe-area-inset-bottom) + 24px); z-index: 80; background: var(--ink); color: #fff;
  padding: 12px 18px; border-radius: 12px; font-size: 15px; max-width: calc(100% - 32px); box-shadow: 0 6px 24px rgba(0,0,0,.25); }
.toast.bad { background: var(--red); } .toast.ok { background: var(--green); }

.pin-reveal { font-size: 32px; font-weight: 700; letter-spacing: .2em; text-align: center; padding: 12px; background: var(--blue-50); border-radius: 12px; color: var(--blue-dark); }
.tabs { display: flex; gap: 8px; overflow-x: auto; }
.tabs button { border: 1px solid var(--blue-100); background: #fff; border-radius: 99px; padding: 8px 14px; min-height: 40px; white-space: nowrap; cursor: pointer; }
.tabs button.on { background: var(--blue); border-color: var(--blue); color: #fff; }
.spinner { width: 28px; height: 28px; border: 3px solid var(--blue-100); border-top-color: var(--blue); border-radius: 50%; animation: spin 0.8s linear infinite; margin: 24px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty { text-align: center; color: var(--muted); padding: 24px 12px; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: -6px; }
.section-head .section-title { margin: 4px 2px 0; }
.section-head a { font-size: 14px; font-weight: 500; }
.order-list { display: flex; flex-direction: column; gap: 10px; }
.card.order { display: flex; flex-direction: column; gap: 8px; padding: 14px; }
.order-top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.order h3 { margin: 0; font-size: 16px; line-height: 1.3; }
.order h3 a { color: var(--ink); text-decoration: none; }
.order .s { font-size: 13px; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 12px; padding: 3px 9px; border-radius: 99px; background: var(--bg); border: 1px solid var(--line); color: var(--ink-2); }
.bar-track { height: 6px; background: var(--blue-50); border-radius: 99px; overflow: hidden; }
.bar-track span { display: block; height: 100%; background: var(--blue); border-radius: 99px; }
.card.boss { border-color: var(--blue-100); }
.card.boss h2 { display: flex; align-items: center; gap: 8px; }
.stat-link { text-decoration: none; color: var(--blue); background: var(--blue-50); border-color: var(--blue-100); }
.stat-link .l { color: var(--blue-dark); }
.role-pick { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--blue-100); border-radius: 99px; padding: 8px 14px; min-height: 44px; cursor: pointer; background: #fff; }
.role-pick input { width: 18px; min-height: 18px; margin: 0; accent-color: var(--blue); }
.role-pick:has(input:checked) { background: var(--blue-50); border-color: var(--blue); font-weight: 600; }
.wage { font-size: 15px; color: var(--ink); }
.wage b { color: var(--red); font-size: 17px; }
