:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --paper: #fff;
  --ink: #172438;
  --muted: #556780;
  --stroke: #dce3ed;
  --accent: #264da4;
  --accent-hover: #1f3c83;
  --round: 15px;
  font: 14px/1.55 Inter, "Hiragino Sans", "Yu Gothic", Meiryo, system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
}
* { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
a { color: inherit; }
button, .button {
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  border: 1px solid var(--stroke); border-radius: 8px; min-height: 36px; padding: 7px 13px;
  color: var(--ink); background: var(--paper); font: inherit; font-weight: 650;
  text-decoration: none; cursor: pointer; white-space: nowrap;
}
button:hover, .button:hover { background: #eef3fa; }
button:disabled { opacity: .54; cursor: default; }
button.primary { background: var(--accent); color: white; border-color: var(--accent); }
button.primary:hover:not(:disabled) { background: var(--accent-hover); }
button.quiet, .button.quiet { border-color: transparent; background: transparent; }
button.quiet:hover, .button.quiet:hover { background: #eef3fa; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(2rem, 4vw, 2.8rem); line-height: 1.16; letter-spacing: -.05em; margin: 5px 0 9px; }
h2 { font-size: 1.12rem; line-height: 1.35; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px max(4vw, 18px); background: var(--paper); border-bottom: 1px solid var(--stroke); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.04rem; text-decoration: none; }
.brand-mark { display: grid; grid-template-columns: 6px 6px; gap: 3px; padding: 7px; background: var(--accent); border-radius: 7px; }
.brand-mark i { width: 6px; height: 6px; border-radius: 1px; background: #fff; }
.brand-mark i:last-child { opacity: .52; }
.top-actions, .actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.page { margin: 0 auto; max-width: 1600px; padding: 33px max(4vw, 18px) 44px; }
.page-header { display: flex; align-items: end; justify-content: space-between; flex-wrap: wrap; gap: 17px; margin-bottom: 17px; }
.period { color: var(--accent); font-weight: 750; }
.meta { color: var(--muted); font-size: .89rem; }
.plan-context { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sample-label { border-radius: 5px; background: #e9eef7; color: #385476; padding: 2px 7px; font-size: .78rem; }
.quick-settings { display: flex; flex-wrap: wrap; gap: 7px; margin: 0 0 16px; padding: 10px; border: 1px solid var(--stroke); border-radius: 12px; background: var(--paper); }
.quick-settings button { min-height: 35px; }
#open-rule { color: var(--accent); border-color: #bdcced; background: #f3f6fd; }
.notice { margin: 0 0 14px; padding: 10px 13px; border: 1px solid #b9c9ed; background: #eef3ff; border-radius: 8px; overflow-wrap: anywhere; }
.notice.error { background: #fdf0ee; border-color: #edc2bc; color: #8c3429; }
.notice.subtle { margin: 10px 0 0; }
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) minmax(250px, 305px); align-items: start; gap: 16px; }
.cards { display: grid; gap: 16px; }
.card { min-width: 0; background: var(--paper); border: 1px solid var(--stroke); border-radius: var(--round); box-shadow: 0 2px 7px rgba(27, 50, 85, .04); }
.padded { padding: 17px; }
.section-heading { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; padding: 15px 17px; }
.section-heading p { margin-top: 3px; }
.section-heading.compact { padding: 0; margin-bottom: 10px; }
.schedule-empty { margin: 0 16px 16px; padding: clamp(20px,4vw,42px); border: 1px solid #e0e8f6; border-radius: 11px; background: #f6f9fe; }
.schedule-empty h3 { font-size: 1.25rem; }
.schedule-empty p { max-width: 43ch; margin: 6px 0 12px; color: var(--muted); }
.schedule-empty button.quiet { padding-inline: 6px; }
.scroll-grid { overflow: auto; max-height: 530px; min-height: 90px; border-block: 1px solid var(--stroke); }
table { border-collapse: separate; border-spacing: 0; width: 100%; }
.schedule th, .schedule td { white-space: nowrap; height: 36px; padding: 3px; text-align: center; border-bottom: 1px solid #edf1f6; }
.schedule thead th { position: sticky; top: 0; z-index: 2; background: #f7f9fc; font-size: .82rem; min-width: 40px; color: var(--muted); }
.schedule thead .weekend { color: #8d4a57; background: #faf7fa; }
.schedule tr > :first-child { position: sticky; left: 0; min-width: 122px; padding: 4px 12px; text-align: left; }
.schedule thead tr > :first-child { z-index: 3; }
.schedule tbody tr > th { z-index: 1; background: var(--paper); box-shadow: 1px 0 #edf1f6; font-size: .86rem; }
.schedule .name-skill { display: block; font-size: .71rem; font-weight: 500; color: var(--muted); }
.schedule tbody tr:hover th { background: #f5f8fd; }
.shift { min-width: 32px; min-height: 25px; border-radius: 6px; padding: 2px 5px; font-size: .76rem; line-height: 1.28; font-weight: 700; border: 1px solid #e1e7ef; color: #4c5c73; background: #f2f5f9; display: inline-flex; align-items: center; justify-content: center; gap: 2px; white-space: nowrap; }
.shift[data-tone="0"] { background: #fff1ce; color: #754807; border-color: #f4dfa9; }
.shift[data-tone="1"] { background: #deeffe; color: #1c5384; border-color: #c9e1f8; }
.shift[data-tone="2"] { background: #dff3ea; color: #255f4d; border-color: #c7e8d9; }
.shift[data-tone="3"] { background: #eae0fa; color: #5c397d; border-color: #ded1f2; }
.shift:hover { filter: brightness(.97); }
.shift.locked { box-shadow: inset 0 -2px #405478; }
.shift.changed { outline: 1px solid #315aaf; outline-offset: 1px; }
.legend { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; padding: 11px 15px; color: var(--muted); font-size: .8rem; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 0 0 16px; }
.metrics div { border: 1px solid var(--stroke); padding: 10px 13px; border-radius: 10px; background: var(--paper); }
.metrics dt { color: var(--muted); font-size: .82rem; }
.metrics dd { font-size: 1.15rem; font-weight: 800; margin: 0; font-variant-numeric: tabular-nums; }
.rules, .jobs, .issues { margin: 9px 0 0; padding: 0; list-style: none; }
.rules li { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 40px; padding: 6px 0; border-top: 1px solid #edf1f6; overflow-wrap: anywhere; }
.rule-actions { display: flex; gap: 4px; }
.rule-action { padding: 2px 7px; min-height: 28px; font-size: .8rem; }
#ai-form { display: grid; justify-items: start; gap: 8px; margin-top: 10px; }
#ai-form textarea { width: 100%; }
#ai-help { margin-top: 5px; }
.results { margin-bottom: 12px; }
.result-problem { border-color: #e6c3ba; }
.history { grid-column: 1 / -1; margin: 0; padding-block: 12px; }
#result-message { margin-top: 5px; }
.issues { max-height: 240px; overflow: auto; }
.issues:empty { margin: 0; }
.issues li { padding: 5px 0; border-top: 1px solid #edf1f6; overflow-wrap: anywhere; }
.issues .rule-action { margin: 3px 0 0 8px; }
.jobs li { padding: 5px 0; border-top: 1px solid #edf1f6; }
.job-button { display: flex; width: 100%; justify-content: space-between; text-align: left; gap: 12px; background: transparent; border-color: transparent; white-space: normal; }
.job-button[aria-current="true"] { background: #eef3ff; color: var(--accent); }
details { margin-top: 12px; }
summary { cursor: pointer; font-weight: 650; }
#employee-metrics-table { overflow: auto; }
#employee-metrics th, #employee-metrics td { text-align: left; padding: 5px 7px; border-bottom: 1px solid #edf1f6; }
dialog { width: min(520px, calc(100% - 28px)); max-height: 90dvh; border: 1px solid var(--stroke); border-radius: var(--round); padding: 22px; color: var(--ink); background: var(--paper); box-shadow: 0 15px 55px #1724384d; }
dialog::backdrop { background: #17243878; }
dialog form { display: grid; gap: 12px; }
dialog .notice.subtle { margin: 0; }
dialog label { display: flex; flex-direction: column; gap: 4px; font-weight: 650; }
dialog .check { flex-direction: row; align-items: center; gap: 7px; }
#rule-availability fieldset { min-width: 0; margin: 8px 0 0; padding: 8px; border: 1px solid var(--stroke); border-radius: 8px; }
#rule-availability legend { padding-inline: 4px; font-weight: 650; }
.day-choices { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.day-choices label { align-items: center; justify-content: center; gap: 0; min-height: 40px; text-align: center; font-size: .8rem; border-radius: 5px; cursor: pointer; }
.day-choices label:has(:checked) { background: #e9eefb; color: var(--accent); }
.day-choices input { margin: 3px; }
.dialog-actions { display: flex; justify-content: end; flex-wrap: wrap; gap: 8px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
input:not([type="checkbox"]), select, textarea { display: block; width: 100%; border: 1px solid var(--stroke); border-radius: 8px; background: var(--paper); color: var(--ink); min-height: 36px; padding: 7px 9px; font: inherit; }
textarea { resize: vertical; }
.reset-area { margin-top: 14px; padding-top: 11px; border-top: 1px solid var(--stroke); }
.reset-area .meta { margin-top: 4px; }
#reset-confirm .actions { margin-top: 7px; }
.import-help { overflow-wrap: anywhere; }
#settings-dialog { width: min(760px, calc(100% - 28px)); }
#settings-form { margin: 0; }
#settings-form section, #settings-form fieldset { min-width: 0; }
#settings-form fieldset { display: grid; gap: 10px; margin: 16px 0 0; padding: 12px; border: 1px solid var(--stroke); border-radius: 8px; }
#settings-form legend { font-weight: 750; }
#settings-form .dialog-actions { position: sticky; bottom: -22px; background: var(--paper); padding-block: 10px; }
.settings-nav, .coverage-bulk { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; }
.settings-nav button[aria-pressed="true"] { background: #eef3ff; color: var(--accent); border-color: #b9c9ed; }
.coverage-bulk { margin: 10px 0 6px; }
.coverage-mode { margin-block: 8px; }
.coverage-bulk label { flex: 1 1 92px; max-width: 140px; }
.settings-table { margin-top: 8px; overflow: auto; max-height: min(45dvh, 408px); }
.settings-table th, .settings-table td { padding: 5px 7px; text-align: left; border-bottom: 1px solid var(--stroke); white-space: nowrap; }
.settings-table thead th { position: sticky; top: 0; background: #f7f9fc; font-size: .86rem; }
.settings-table input { width: auto; max-width: 100%; }
.settings-table input[type="number"] { width: 92px; }
.shift-editors { display: grid; gap: 8px; margin-bottom: 10px; }
.shift-editor { margin: 0; border: 1px solid var(--stroke); border-radius: 8px; padding: 9px 12px; }
.shift-editor[open] summary { margin-bottom: 10px; }
.shift-break-list:not(:empty) { display: grid; gap: 8px; margin-top: 10px; }
.shift-break-row { display: grid; grid-template-columns: 1fr 1fr auto; align-items: end; gap: 8px; }
.shift-break-mode { grid-column: 1 / -1; }
.shift-break-mode ~ button { justify-self: start; }
.break-plan { margin: 0; padding: 0 15px 12px; }
.break-plan label { display: grid; max-width: 220px; gap: 4px; margin-top: 7px; }
.break-plan ul { margin: 8px 0 0; padding: 0; max-height: 205px; overflow: auto; list-style: none; }
.break-plan li { padding: 4px 0; border-bottom: 1px solid var(--stroke); }
.shift-editor-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.shift-remove-confirm { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 0; }
.shift-remove-confirm p { flex-basis: 100%; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
@media (max-width: 820px) { .workspace { grid-template-columns: minmax(0, 1fr); } .cards { grid-template-columns: 1fr 1fr; } }
@media (max-width: 530px) { .cards, .metrics, .form-grid { grid-template-columns: 1fr 1fr; } .cards { grid-template-columns: 1fr; } .page { padding-top: 22px; } .topbar { padding-block: 9px; } .top-actions { gap: 1px; } .top-actions .button, .top-actions button { padding-inline: 6px; } }
@media (max-width: 530px) { .quick-settings button, .page-header .actions > * { min-height: 42px; } .quick-settings { gap: 6px; padding: 8px; } }
@media (max-width: 480px) { .shift-break-row { grid-template-columns: 1fr 1fr; } .shift-break-row button { justify-self: start; } }
