:root {
  --bg: #e8ebf0; --card: #fff; --head: #dde1e7; --line: #cfd5dd; --soft-line: #e4e7ec;
  --ink: #1d2733; --soft: #5b6673; --navy: #0f2d57; --blue: #0f4c97; --blue-dark: #0b3a75; --blue-soft: #e4eefa;
  --green: #17794a; --green-soft: #e0f3e9; --amber: #8f5a00; --amber-soft: #fdf0d5; --red: #b3261e; --red-soft: #fbe6e4;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { min-height: 100%; }
body { margin: 0; color: var(--ink); background: var(--bg); font-family: "Noto Sans", "Segoe UI", system-ui, sans-serif; font-size: 15px; line-height: 1.4; }
button, input, select, textarea { font: inherit; }
h1, h2, h3, p { margin: 0; }
a { color: var(--blue); }

.topbar { position: sticky; top: 0; z-index: 10; min-height: 58px; padding: 8px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; color: #fff; background: var(--navy); }
.topbar img { display: block; width: 104px; height: auto; }
.topbar-text { min-width: 0; text-align: right; }
.topbar-text strong { display: block; overflow: hidden; font-size: 13px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.topbar-text span { color: #c6d8ee; font-size: 12px; }
.wrap { width: min(100%, 680px); margin: 0 auto; padding: 16px 16px 96px; }
.setup-wrap { padding-bottom: 32px; }
.page-title { margin-bottom: 12px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.page-title h1 { font-size: 21px; font-weight: 700; }
.muted { color: var(--soft); font-size: 13px; }

.card { margin-bottom: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.card-head { min-height: 44px; padding: 8px 14px; display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--head); border-bottom: 1px solid var(--line); }
.card-head h2 { font-size: 14px; font-weight: 700; }
.card-body { padding: 14px; }
.field { margin-bottom: 13px; min-width: 0; }
.field:last-child { margin-bottom: 0; }
.field label { display: block; margin-bottom: 5px; color: var(--soft); font-size: 13px; font-weight: 500; }
.field small { display: block; margin-top: 4px; color: var(--soft); font-size: 12px; }
input, select, textarea { width: 100%; min-height: 46px; padding: 0 12px; color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: 6px; outline: none; font-size: 16px; }
textarea { min-height: 110px; padding: 10px 12px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 2px rgba(15, 76, 151, .16); }
.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 12px; }
.two .field:last-child { margin-bottom: 13px; }
.input-action { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }

.btn { min-height: 44px; padding: 0 16px; color: var(--ink); background: #fff; border: 1px solid #aeb6c1; border-radius: 6px; cursor: pointer; font-size: 14px; font-weight: 600; white-space: nowrap; }
a.btn { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.btn:hover { background: #f1f3f6; }
.btn.primary { color: #fff; background: var(--blue); border-color: var(--blue); }
.btn.primary:hover { background: var(--blue-dark); }
.btn.danger { color: #fff; background: var(--red); border-color: var(--red); }
.btn.small { min-height: 36px; padding: 0 11px; font-size: 13px; }
.btn.block { width: 100%; }
.btn:disabled { cursor: wait; opacity: .6; }
.actions { display: flex; justify-content: space-between; gap: 10px; margin-top: 14px; }
.actions .btn.primary:only-child { width: 100%; }
.link-btn { min-height: 34px; padding: 0 4px; color: var(--blue); background: none; border: 0; cursor: pointer; font-size: 13px; font-weight: 600; }
.link-btn.red { color: var(--red); }

.error { margin: 10px 0 0; padding: 9px 11px; color: var(--red); background: var(--red-soft); border-radius: 5px; font-size: 13px; }
.note { margin-bottom: 12px; padding: 10px 12px; color: #5a4300; background: var(--amber-soft); border: 1px solid #ecd6a6; border-radius: 6px; font-size: 13px; }
.note.red { color: var(--red); background: var(--red-soft); border-color: #f0c8c4; }
.badge { display: inline-block; padding: 2px 7px; border-radius: 4px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.badge.gray { color: #47515c; background: #e5e8ec; }
.badge.green { color: var(--green); background: var(--green-soft); }
.badge.amber { color: var(--amber); background: var(--amber-soft); }
.badge.red { color: var(--red); background: var(--red-soft); }
.badge.blue { color: var(--blue); background: var(--blue-soft); }

.steps { margin-bottom: 14px; display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
.steps i { height: 5px; background: #cfd5dd; border-radius: 2px; }
.steps i.on { background: var(--blue); }
.step-label { margin-bottom: 4px; color: var(--soft); font-size: 12px; font-weight: 600; }
.done-code { padding: 12px; background: #f1f3f6; border-radius: 6px; }
.done-code div { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; }
.done-code strong { text-align: right; overflow-wrap: anywhere; }

.day-tabs { margin-bottom: 10px; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; }
.day-tabs button { min-height: 44px; padding: 0; color: #3b4652; background: #dce0e6; border: 0; border-radius: 5px; cursor: pointer; font-size: 12px; font-weight: 600; }
.day-tabs button.has::after { content: ""; display: block; width: 5px; height: 5px; margin: 2px auto 0; background: var(--blue); border-radius: 50%; }
.day-tabs button.active { color: #fff; background: var(--blue); }
.day-tabs button.active.has::after { background: #fff; }
.slot-list { display: grid; gap: 6px; margin-bottom: 10px; }
.slot { padding: 7px 8px 7px 10px; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px; background: #f6f7f9; border: 1px solid var(--soft-line); border-left: 4px solid var(--blue); border-radius: 5px; }
.slot.break { border-left-color: #2a9d6f; }
.slot.lunch { border-left-color: #c98a12; }
.slot strong { display: block; font-size: 14px; font-weight: 600; }
.slot span { color: var(--soft); font-size: 12px; }
.stepper { display: flex; align-items: center; gap: 3px; }
.stepper button { width: 36px; height: 36px; color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: 5px; cursor: pointer; font-size: 17px; }
.stepper button.remove { color: var(--red); }
.stepper b { min-width: 42px; font-size: 13px; font-weight: 600; text-align: center; }
.add-row { margin-bottom: 8px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.add-row .btn { min-height: 42px; padding: 0 4px; font-size: 13px; }
.tool-row { display: flex; flex-wrap: wrap; gap: 6px; }
.empty-day { padding: 18px 8px; color: var(--soft); text-align: center; }
.summary-day { padding: 9px 0; border-bottom: 1px solid var(--soft-line); }
.summary-day:last-child { border-bottom: 0; }
.summary-day strong { display: block; margin-bottom: 2px; font-size: 14px; }
.summary-day span { color: var(--soft); font-size: 13px; }

.hero { margin-bottom: 12px; padding: 16px; color: #fff; background: var(--navy); border-radius: 8px; }
.hero h1 { font-size: 19px; font-weight: 700; overflow-wrap: anywhere; }
.hero p { margin-top: 2px; color: #c6d8ee; font-size: 13px; }
.hero-weather { margin-top: 12px; padding-top: 11px; display: flex; align-items: baseline; gap: 8px; border-top: 1px solid rgba(255, 255, 255, .2); }
.hero-weather strong { font-size: 24px; font-weight: 700; }
.hero-weather span { color: #d7e5f5; font-size: 13px; }
.tiles { margin-bottom: 12px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.tile { min-height: 104px; padding: 13px; display: flex; flex-direction: column; justify-content: space-between; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 8px; text-decoration: none; }
.tile:active { background: #f1f3f6; }
.tile svg { width: 26px; height: 26px; color: var(--blue); }
.tile strong { display: block; margin-top: 8px; font-size: 14px; font-weight: 700; }
.tile span { color: var(--soft); font-size: 12px; }
.row { padding: 11px 14px; display: flex; align-items: center; justify-content: space-between; gap: 10px; border-bottom: 1px solid var(--soft-line); }
.row:last-child { border-bottom: 0; }
.row-main { min-width: 0; flex: 1; }
.row-main strong { display: block; font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.row-main span { color: var(--soft); font-size: 12px; }
.row-side { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.row-buttons { display: flex; gap: 8px; }
.board-toggle { min-width: 118px; min-height: 46px; }
.board-row { min-height: 68px; }
.board-row strong { font-size: 18px; font-weight: 700; }
.news { padding: 12px 14px; border-bottom: 1px solid var(--soft-line); }
.news:last-child { border-bottom: 0; }
.news.high { box-shadow: inset 3px 0 var(--red); }
.news-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.news h3 { font-size: 15px; font-weight: 700; overflow-wrap: anywhere; }
.news p { margin-top: 4px; font-size: 14px; white-space: pre-line; overflow-wrap: anywhere; }
.news small { display: block; margin-top: 5px; color: var(--soft); font-size: 12px; }
.empty { padding: 26px 14px; color: var(--soft); text-align: center; }
.empty strong { display: block; color: var(--ink); }

.scanner { position: relative; aspect-ratio: 1; margin-bottom: 10px; overflow: hidden; background: #0b1420; border-radius: 8px; }
.scanner video { width: 100%; height: 100%; display: block; object-fit: cover; }
.scanner i { position: absolute; inset: 14%; border: 3px solid rgba(255, 255, 255, .9); border-radius: 10px; }
.code-box { padding: 20px 14px; text-align: center; }
.code-value { margin: 6px 0; color: var(--navy); font-size: clamp(38px, 13vw, 54px); font-weight: 700; letter-spacing: .12em; font-variant-numeric: tabular-nums; }
.timer { height: 6px; margin: 10px 0 4px; overflow: hidden; background: #e7eaee; border-radius: 3px; }
.timer em { display: block; height: 100%; width: 100%; background: var(--blue); }
.chips { margin-bottom: 8px; display: flex; flex-wrap: wrap; gap: 6px; }
.chips button { min-height: 38px; padding: 0 13px; color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: 19px; cursor: pointer; font-size: 13px; }
.chips button.active { color: #fff; background: var(--blue); border-color: var(--blue); }

.bottom-nav { position: fixed; right: 0; bottom: 0; left: 0; z-index: 10; padding-bottom: env(safe-area-inset-bottom); display: grid; grid-template-columns: repeat(5, 1fr); background: #fff; border-top: 1px solid var(--line); }
.bottom-nav a { min-height: 60px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: #5b6673; font-size: 11px; font-weight: 500; text-decoration: none; }
.bottom-nav a.active { color: var(--blue); font-weight: 700; }
.bottom-nav svg { width: 22px; height: 22px; }

dialog { width: min(calc(100vw - 24px), 480px); max-height: calc(100dvh - 24px); padding: 0; color: var(--ink); background: #fff; border: 1px solid #9fa8b4; border-radius: 8px; }
dialog::backdrop { background: rgba(21, 30, 42, .5); }
.sheet-head { min-height: 48px; padding: 6px 8px 6px 16px; display: flex; align-items: center; justify-content: space-between; background: var(--head); border-bottom: 1px solid var(--line); }
.sheet-head h2 { font-size: 15px; font-weight: 700; }
.sheet-head button { width: 38px; height: 38px; color: var(--soft); background: none; border: 0; cursor: pointer; font-size: 22px; }
.sheet-body { max-height: calc(100dvh - 170px); padding: 14px; overflow-y: auto; }
.sheet-foot { padding: 10px 14px; display: flex; justify-content: flex-end; gap: 8px; border-top: 1px solid var(--line); }
#toast { position: fixed; right: 12px; bottom: 74px; left: 12px; z-index: 30; max-width: 480px; margin: 0 auto; padding: 11px 14px; color: #fff; background: #17324f; border-radius: 6px; font-size: 14px; }
#toast.error { background: var(--red); }
.notice-page { min-height: 100dvh; padding: 16px; display: grid; place-items: center; }
.notice-page .card { width: min(100%, 420px); text-align: center; }
.notice-page img { display: block; width: 130px; margin: 0 auto 14px; padding: 9px 12px; background: var(--navy); border-radius: 6px; }

@media (min-width: 760px) {
  .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .bottom-nav { right: auto; left: 50%; width: 560px; transform: translateX(-50%); border: 1px solid var(--line); border-bottom: 0; border-radius: 8px 8px 0 0; }
}
@media (max-width: 400px) {
  .two { grid-template-columns: minmax(0, 1fr); }
  .stepper button { width: 32px; }
  .stepper b { min-width: 36px; }
}
