:root {
  --gold: #FFB800; --orange: #FF8A00; --amber: #E89B00; --amber-ink: #B35400;
  --navy: #1E2B48; --deep: #121A2E; --cream: #FBF6EC; --line: #E7DFCF; --muted: #556079;
  --bg: #F6F2EA; --danger: #C8371D; --ok: #1F8A5B; --blue: #2F6FDB;
  --s-off: #8A93A8; --s-work: #1F8A5B; --s-break: #E89B00; --s-done: #1E2B48;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: 'Inter Tight', 'Noto Sans SC', 'Noto Sans JP', system-ui, sans-serif; background: var(--bg); color: var(--navy); font-size: 15px; line-height: 1.55; -webkit-font-smoothing: antialiased; }
html[lang="ja"] body { font-family: 'Inter Tight', 'Noto Sans JP', 'Noto Sans SC', system-ui, sans-serif; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
.num, .tnum { font-variant-numeric: tabular-nums; }
.mark { width: 34px; height: 34px; flex: 0 0 auto; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 42px; padding: 0 18px; border-radius: 999px; border: 1px solid transparent; font-weight: 700; font-size: 14px; white-space: nowrap; text-decoration: none; transition: background .15s, border-color .15s, transform .1s, opacity .15s; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: default; }
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--deep); }
.btn-gold { background: var(--gold); color: var(--deep); box-shadow: 0 6px 18px -8px rgba(255,138,0,.7); }
.btn-gold:hover:not(:disabled) { background: #FFC633; }
.btn-ghost { background: #fff; border-color: var(--line); }
.btn-ghost:hover:not(:disabled) { border-color: var(--navy); }
.btn-text { background: none; border: 0; height: 36px; padding: 0 10px; color: var(--muted); font-weight: 600; }
.btn-text:hover { color: var(--navy); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-ok { background: var(--ok); color: #fff; }
.btn-sm { height: 34px; padding: 0 14px; font-size: 13px; }
.btn svg { width: 17px; height: 17px; }
.icon-btn { width: 38px; height: 38px; border-radius: 10px; border: 1px solid transparent; background: none; display: inline-flex; align-items: center; justify-content: center; color: var(--muted); flex: 0 0 auto; }
.icon-btn:hover { background: var(--cream); color: var(--navy); }
.icon-btn svg { width: 18px; height: 18px; }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label { font-size: 13px; font-weight: 700; }
.field > label small { font-weight: 500; color: var(--muted); margin-left: 6px; }
.input { height: 44px; border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; background: #fff; width: 100%; min-width: 0; outline: none; transition: border-color .15s, box-shadow .15s; }
textarea.input { height: auto; padding: 10px 12px; resize: vertical; line-height: 1.6; }
.input:focus { border-color: var(--amber); box-shadow: 0 0 0 3px rgba(255,184,0,.25); }
.hint { font-size: 12px; color: var(--muted); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--amber); }
.msg-err { color: var(--danger); font-size: 13px; font-weight: 600; min-height: 1em; }

/* auth */
.auth-wrap { min-height: 100vh; min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; background: radial-gradient(1200px 600px at 80% -10%, rgba(255,184,0,.18), transparent 60%), var(--deep); }
.auth-card { width: 100%; max-width: 400px; background: #fff; border-radius: 22px; padding: 36px 28px 28px; box-shadow: 0 30px 80px -30px rgba(0,0,0,.6); }
.auth-card .brand { display: flex; align-items: center; gap: 12px; margin-bottom: 26px; }
.auth-card h1 { margin: 0; font-size: 22px; }
.auth-card .sub { font-size: 13px; color: var(--muted); }
.auth-card form { display: flex; flex-direction: column; gap: 16px; }
.auth-card .btn-block { width: 100%; height: 48px; margin-top: 6px; }
.auth-foot { margin-top: 18px; display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
.lang { display: inline-flex; gap: 2px; background: var(--cream); border-radius: 999px; padding: 3px; }
.lang button { border: 0; background: none; height: 28px; padding: 0 12px; border-radius: 999px; font-size: 12px; font-weight: 700; color: var(--muted); }
.lang button[aria-pressed="true"] { background: #fff; color: var(--navy); box-shadow: 0 1px 4px rgba(0,0,0,.08); }

/* top */
.top { position: sticky; top: 0; z-index: 20; background: rgba(255,255,255,.94); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.top-in { max-width: 1180px; margin: 0 auto; padding: 10px clamp(12px, 3vw, 32px); display: flex; align-items: center; gap: 12px; }
.top .brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.top .brand b { font-size: 17px; white-space: nowrap; }
.top .brand small { display: block; font-size: 11px; color: var(--muted); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top .sp { flex: 1; }
.menu-wrap { position: relative; }
.menu { position: absolute; right: 0; top: calc(100% + 8px); background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 20px 40px -20px rgba(18,26,46,.35); padding: 6px; min-width: 210px; display: flex; flex-direction: column; z-index: 40; }
.menu button, .menu a { display: flex; align-items: center; gap: 10px; text-align: left; border: 0; background: none; padding: 10px 12px; border-radius: 10px; font-size: 14px; font-weight: 600; text-decoration: none; }
.menu button:hover, .menu a:hover { background: var(--cream); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 6px 4px; }
.menu-btn { width: 42px; height: 42px; border: 1px solid var(--line); background: #fff; }

.tabs-bar { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 63px; z-index: 15; }
.tabs { max-width: 1180px; margin: 0 auto; padding: 0 clamp(12px, 3vw, 32px); display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { border: 0; background: none; padding: 14px 12px 12px; font-weight: 700; font-size: 14px; color: var(--muted); border-bottom: 3px solid transparent; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.tabs button[aria-selected="true"] { color: var(--navy); border-bottom-color: var(--gold); }
.count { display: inline-flex; min-width: 20px; height: 20px; padding: 0 6px; align-items: center; justify-content: center; border-radius: 999px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 800; }

main { max-width: 1180px; margin: 0 auto; padding: 22px clamp(12px, 3vw, 32px) 80px; }
.panel-h { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; margin-bottom: 16px; }
.panel-h h2 { margin: 0; font-size: clamp(20px, 2.6vw, 26px); }
.panel-h p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.card { background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: clamp(16px, 2.4vw, 24px); margin-bottom: 16px; }
.card h3 { margin: 0 0 12px; font-size: 16px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; flex-direction: column; gap: 0; border-radius: 14px; padding: 10px 14px; background: #fff; border: 1px solid var(--line); min-width: 110px; }
.chip span { font-size: 12px; color: var(--muted); font-weight: 600; }
.chip b { font-size: 20px; font-variant-numeric: tabular-nums; letter-spacing: .01em; }
.chip.warn b { color: var(--amber-ink); }
.chip.bad b { color: var(--danger); }

.pill { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 700; background: #EEF0F5; color: var(--s-off); white-space: nowrap; }
.pill::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.working { background: #E3F4EC; color: var(--s-work); }
.pill.break { background: #FFF3D6; color: var(--amber-ink); }
.pill.done { background: #E6E9F1; color: var(--s-done); }
.pill.leave { background: #EEE8FB; color: #6741C7; }
.badge { display: inline-block; font-size: 11px; font-weight: 700; border-radius: 999px; padding: 1px 8px; background: var(--cream); color: var(--amber-ink); white-space: nowrap; }
.badge.bad { background: #FBE9E5; color: var(--danger); }
.badge.ok { background: #E3F4EC; color: var(--ok); }
.badge.info { background: #E8EEFB; color: var(--blue); }
.badge.mute { background: #EEF0F5; color: var(--muted); }
.badge.leave { background: #EEE8FB; color: #6741C7; }

/* table */
.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 16px; background: #fff; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 760px; }
.tbl th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 700; padding: 10px 10px; background: var(--cream); white-space: nowrap; position: sticky; top: 0; }
.tbl td { padding: 9px 10px; border-top: 1px solid #F0EADF; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tbl tr.rest td { background: #FCFAF6; color: #7D869A; }
.tbl tr.rest td.d { color: var(--danger); }
.tbl tr.sat td.d { color: var(--blue); }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover td { background: #FFF8E6; }
.tbl tr.today td { box-shadow: inset 0 0 0 9999px rgba(255,184,0,.08); }
.tbl .sum td { font-weight: 800; background: var(--cream); }

.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid #F0EADF; flex-wrap: wrap; }
.list-item:first-child { border-top: 0; }
.list-item .grow { flex: 1 1 200px; min-width: 0; }
.list-item .meta { font-size: 12px; color: var(--muted); }
.empty { padding: 36px 16px; text-align: center; color: var(--muted); }

dialog { border: 0; border-radius: 20px; padding: 0; width: min(520px, calc(100vw - 24px)); max-height: calc(100dvh - 32px); color: var(--navy); box-shadow: 0 40px 100px -30px rgba(0,0,0,.5); }
dialog::backdrop { background: rgba(18,26,46,.55); backdrop-filter: blur(3px); }
.dlg-h { display: flex; align-items: center; justify-content: space-between; padding: 20px 22px 6px; gap: 10px; }
.dlg-h h3 { margin: 0; font-size: 19px; }
.dlg-b { padding: 10px 22px 18px; display: flex; flex-direction: column; gap: 14px; }
.dlg-b p { margin: 0; color: var(--muted); font-size: 14px; }
.dlg-f { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; padding: 0 22px 22px; }

.toast { position: fixed; top: 76px; left: 50%; transform: translate(-50%, -20px); opacity: 0; pointer-events: none; z-index: 90; background: var(--navy); color: #fff; padding: 12px 20px; border-radius: 12px; font-size: 14px; font-weight: 600; transition: all .25s; box-shadow: 0 16px 40px -16px rgba(0,0,0,.5); max-width: calc(100vw - 24px); text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: var(--danger); }
.toast.ok { background: var(--ok); }
.loading { min-height: 60vh; display: flex; align-items: center; justify-content: center; color: var(--muted); }

/* clock + punch */
.clock-card { background: var(--deep); color: #fff; border-radius: 24px; padding: clamp(20px, 4vw, 36px); position: relative; overflow: hidden; margin-bottom: 16px; }
.clock-card::after { content: ''; position: absolute; right: -120px; top: -140px; width: 360px; height: 360px; border-radius: 50%; background: radial-gradient(circle, rgba(255,184,0,.28), transparent 65%); pointer-events: none; }
.clock-date { font-size: 14px; color: #B8C3DA; font-weight: 600; }
.clock-time { font-family: 'Inter Tight', sans-serif; font-weight: 800; font-size: clamp(52px, 12vw, 88px); line-height: 1.05; letter-spacing: -.01em; font-variant-numeric: tabular-nums; margin: 4px 0 10px; }
.clock-time small { font-size: .42em; color: #8E9BB8; font-weight: 700; margin-left: 6px; }
.clock-card .pill { background: rgba(255,255,255,.1); color: #fff; }
.clock-card .pill.working { background: rgba(31,138,91,.25); color: #7FE0B0; }
.clock-card .pill.break { background: rgba(255,184,0,.2); color: #FFD36B; }
.clock-card .pill.done { background: rgba(255,255,255,.14); color: #DDE3F0; }
.punch-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 22px; position: relative; z-index: 1; }
.punch { height: 84px; border-radius: 18px; border: 0; font-size: 19px; font-weight: 800; letter-spacing: .04em; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; transition: transform .1s, opacity .2s, box-shadow .2s; }
.punch small { font-size: 11px; font-weight: 700; letter-spacing: .12em; opacity: .7; }
.punch:active:not(:disabled) { transform: scale(.98); }
.punch:disabled { opacity: .22; cursor: default; }
.p-in { background: var(--gold); color: var(--deep); box-shadow: 0 10px 30px -12px rgba(255,184,0,.9); }
.p-out { background: #fff; color: var(--deep); }
.p-bstart, .p-bend { background: rgba(255,255,255,.1); color: #fff; border: 1px solid rgba(255,255,255,.2); }
.timeline { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-top: 18px; font-size: 14px; color: #B8C3DA; position: relative; z-index: 1; }
.timeline b { color: #fff; font-variant-numeric: tabular-nums; margin-left: 6px; }

@media (max-width: 640px) {
  .top .brand small, .hide-sm { display: none !important; }
  .tabs-bar { top: 61px; }
  .row3 { grid-template-columns: 1fr 1fr; }
  .chip { min-width: calc(50% - 4px); flex: 1 1 calc(50% - 4px); }
}
