:root {
  --ink: #18332f;
  --muted: #6d7b77;
  --paper: #f4f0e8;
  --card: #fffdf8;
  --accent: #f0784b;
  --accent-soft: #fbe4d8;
  --sage: #a9c6b7;
  --line: #dedbd2;
  --danger: #b6473d;
  --shadow: 0 14px 40px rgba(25, 50, 45, .09);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; color: var(--ink); background: var(--paper); font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif; }
button, input, select { font: inherit; }
button { cursor: pointer; }

.hero { min-height: 310px; padding: 54px max(6vw, 24px) 48px; display: flex; align-items: end; justify-content: space-between; gap: 40px; color: #fffdf8; background: var(--ink); position: relative; overflow: hidden; }
.hero::after { content: ""; position: absolute; width: 360px; height: 360px; right: 26%; top: -190px; border: 60px solid rgba(169,198,183,.12); border-radius: 50%; }
.eyebrow { margin: 0 0 9px; color: var(--accent); font-size: 12px; font-weight: 800; letter-spacing: .2em; }
h1 { margin: 0; font-size: clamp(38px, 5vw, 68px); line-height: 1.08; letter-spacing: -.04em; }
h1 span { color: var(--sage); }
.lead { max-width: 530px; margin: 20px 0 0; color: #c9d5d1; }
.hero-card { min-width: 235px; padding: 24px; display: grid; gap: 6px; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.14); border-radius: 18px; backdrop-filter: blur(8px); z-index: 1; }
.hero-card span { margin-top: 8px; color: #b7c6c2; font-size: 12px; }
.hero-card strong { font-family: Georgia, serif; font-size: 20px; }

main { width: min(1180px, calc(100% - 32px)); margin: 0 auto 80px; padding-top: 22px; position: relative; z-index: 2; }
.tabs { display: inline-flex; padding: 6px; gap: 4px; background: var(--card); border-radius: 14px; box-shadow: var(--shadow); }
.sync-status { align-self: center; margin: 0 8px; color: var(--muted); font-size: 10px; font-weight: 800; white-space: nowrap; }
.sync-status.ok { color: #3c7a5b; }
.sync-status.error { color: var(--danger); }
.tab { padding: 10px 18px; color: var(--muted); border: 0; border-radius: 10px; background: transparent; font-weight: 700; }
.tab.active { color: white; background: var(--accent); }
.view { display: none; padding-top: 26px; }
.view.active { display: block; }
.panel { background: var(--card); border: 1px solid rgba(222,219,210,.8); border-radius: 18px; box-shadow: var(--shadow); }

.toolbar { padding: 16px 20px; display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
label { display: grid; gap: 7px; color: var(--muted); font-size: 12px; font-weight: 700; }
input, select { min-height: 40px; padding: 8px 11px; color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: 9px; outline: none; }
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.store-switch { display: flex; padding: 4px; gap: 4px; background: #eeece5; border-radius: 11px; }
.store-switch button { padding: 8px 15px; color: var(--muted); border: 0; border-radius: 8px; background: transparent; font-weight: 700; }
.store-switch button.active { color: var(--ink); background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.summary { margin-left: auto; display: flex; gap: 18px; color: var(--muted); font-size: 13px; }
.summary b { color: var(--ink); font-size: 20px; }
.notice { margin: 18px 0; padding: 16px 20px; display: flex; justify-content: space-between; align-items: center; background: var(--accent-soft); border-radius: 14px; }
.notice small { color: var(--muted); }
.notice button { padding: 9px 14px; color: white; background: var(--accent); border: 0; border-radius: 9px; font-weight: 700; }

.calendar-scroll { margin-top: 18px; overflow-x: auto; padding-bottom: 5px; }
.calendar { min-width: 820px; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 7px; }
.weekday { padding: 8px; color: var(--muted); text-align: center; font-size: 12px; font-weight: 700; }
.weekday.sun { color: var(--danger); } .weekday.sat { color: #416f92; }
.day { min-height: 138px; padding: 9px; display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: 12px; transition: border-color .15s, transform .15s; }
.day:not(.blank):hover { border-color: var(--sage); transform: translateY(-1px); }
.day.blank { visibility: hidden; }
.day.closed { background: #e9e6df; opacity: .8; }
.day-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 7px; }
.day-num { width: 26px; height: 26px; display: grid; place-items: center; font-family: Georgia, serif; font-size: 16px; border-radius: 50%; }
.day.today .day-num { color: white; background: var(--accent); }
.day.sun .day-num { color: var(--danger); } .day.sat .day-num { color: #416f92; }
.day.today .day-num { color: white; }
.mode-badge { padding: 3px 7px; color: var(--muted); background: #efede7; border-radius: 20px; font-size: 9px; font-weight: 800; }
.shift-summary { min-height: 35px; padding: 6px 0; border-top: 1px dashed var(--line); }
.shift-summary:first-of-type { border-top: 0; }
.shift-summary > span { display: block; color: var(--muted); font-size: 9px; font-weight: 800; }
.shift-summary strong { display: block; margin-top: 2px; overflow: hidden; color: var(--ink); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.shift-summary.shortage strong { color: var(--danger); }
.edit-day { width: 100%; margin-top: auto; padding: 4px; color: var(--muted); background: transparent; border: 0; border-radius: 6px; font-size: 10px; font-weight: 700; }
.edit-day:hover { color: var(--accent); background: var(--accent-soft); }
.assignment { width: 100%; min-height: 31px; margin-top: 4px; padding: 4px 6px; font-size: 11px; }

dialog { width: min(460px, calc(100% - 28px)); padding: 0; color: var(--ink); background: var(--card); border: 0; border-radius: 18px; box-shadow: 0 24px 80px rgba(18,42,37,.28); }
dialog::backdrop { background: rgba(15,31,28,.55); backdrop-filter: blur(3px); }
.dialog-shell { padding: 24px; }
.dialog-head { display: flex; align-items: start; justify-content: space-between; margin-bottom: 18px; }
.dialog-head small { color: var(--accent); font-weight: 800; }
.dialog-head h3 { margin: 3px 0 0; font-size: 26px; }
.dialog-close { width: 34px; height: 34px; color: var(--muted); background: #efede7; border: 0; border-radius: 50%; font-size: 22px; line-height: 1; }
.mode-field { margin-bottom: 16px; }
.editor-slot { margin-top: 12px; padding: 14px; background: #f4f1ea; border-radius: 12px; }
.editor-slot-head { display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; font-weight: 800; }
.editor-people { margin-top: 8px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.dialog-done { width: 100%; margin-top: 20px; }
.auto-day { width: 100%; margin-top: 18px; }
.closed-message { padding: 28px 0 10px; color: var(--muted); text-align: center; }

.section-heading { margin: 24px 4px; display: flex; justify-content: space-between; align-items: end; }
.section-heading h2 { margin: 0; font-size: 32px; }
.section-heading > p { color: var(--muted); }
.staff-form, .settings-form { padding: 24px; }
.staff-form { display: grid; grid-template-columns: minmax(180px, 1fr) 1.4fr auto; gap: 22px; align-items: end; }
fieldset { margin: 0; padding: 0; border: 0; }
legend { margin-bottom: 10px; color: var(--muted); font-size: 12px; font-weight: 700; }
.check-row { display: flex; gap: 18px; }
.check-row label { display: flex; align-items: center; gap: 7px; color: var(--ink); font-size: 14px; }
.check-row input { min-height: auto; accent-color: var(--accent); }
.primary { min-height: 42px; padding: 9px 18px; color: white; background: var(--accent); border: 0; border-radius: 10px; font-weight: 800; }
.secondary { min-height: 40px; padding: 8px 14px; color: var(--ink); background: #fff; border: 1px solid var(--sage); border-radius: 10px; font-size: 12px; font-weight: 800; }
.secondary:hover { background: #eaf2ee; }
.secondary.subtle { color: var(--muted); border-color: var(--line); }
.staff-list { margin-top: 18px; display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 12px; }
.staff-card { padding: 18px; display: flex; align-items: center; gap: 14px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; }
.avatar { width: 42px; height: 42px; display: grid; place-items: center; flex: 0 0 auto; color: var(--ink); background: var(--sage); border-radius: 50%; font-weight: 800; }
.staff-card strong { display: block; }
.staff-card small { color: var(--muted); }
.staff-card button { margin-left: auto; padding: 6px 9px; color: var(--danger); background: transparent; border: 1px solid #e6c4bf; border-radius: 8px; }
.staff-card .share-staff { margin-left: auto; color: var(--ink); border-color: var(--sage); }
.staff-card .share-staff + button { margin-left: 0; }
.empty { padding: 48px; color: var(--muted); text-align: center; border: 1px dashed var(--line); border-radius: 14px; }

.settings-form { max-width: 720px; }
.time-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.hint { margin: 14px 0 20px; color: var(--muted); font-size: 12px; }
.data-actions { max-width: 720px; margin-top: 18px; padding: 20px 24px; display: flex; align-items: center; justify-content: space-between; }
.data-actions p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.danger { padding: 8px 12px; color: var(--danger); background: #fff; border: 1px solid #e6c4bf; border-radius: 9px; }
.toast { position: fixed; right: 22px; bottom: 22px; padding: 12px 18px; color: white; background: var(--ink); border-radius: 10px; box-shadow: var(--shadow); opacity: 0; transform: translateY(10px); pointer-events: none; transition: .2s; }
.toast.show { opacity: 1; transform: translateY(0); }

.request-toolbar { padding: 16px 20px; display: flex; align-items: end; gap: 18px; flex-wrap: wrap; }
.request-toolbar label { min-width: 180px; }
.request-legend { margin-left: auto; display: flex; gap: 14px; color: var(--muted); font-size: 11px; }
.request-legend span { display: flex; align-items: center; gap: 5px; }
.request-legend i { width: 9px; height: 9px; display: inline-block; border-radius: 50%; }
.legend-any { background: #5f9e7d; } .legend-shift { background: #e59a4f; } .legend-off { background: #bfc3c0; }
.request-calendar { min-width: 820px; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 7px; }
.request-day { min-height: 108px; padding: 9px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
.request-day.blank { visibility: hidden; }
.request-day-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.request-day-head strong { font-family: Georgia, serif; font-size: 16px; }
.request-day-head small { color: var(--muted); }
.request-select { width: 100%; min-height: 36px; padding: 6px; font-size: 11px; font-weight: 700; }
.request-select.request-any { color: #327151; border-color: #a9cdb9; background: #f1f8f4; }
.request-select.request-shift { color: #a95d24; border-color: #ecc39f; background: #fff7ed; }
.request-select.request-off { color: #727976; background: #eee; }

.ai-grid { display: grid; grid-template-columns: .8fr 1.2fr; gap: 16px; }
.ai-panel { padding: 22px; }
.ai-panel h3, .staff-rules-panel h3 { margin: 0; font-size: 18px; }
.ai-panel > p, .rules-heading p { margin: 6px 0 18px; color: var(--muted); font-size: 12px; }
.pair-form { display: grid; grid-template-columns: 1fr auto 1fr auto; align-items: center; gap: 8px; }
.pair-form select { min-width: 0; }
.pair-list { margin-top: 12px; display: flex; gap: 7px; flex-wrap: wrap; }
.pair-chip { padding: 6px 8px 6px 10px; display: inline-flex; align-items: center; gap: 7px; color: var(--danger); background: #fff2ef; border-radius: 20px; font-size: 11px; font-weight: 700; }
.pair-chip button { width: 20px; height: 20px; padding: 0; color: var(--danger); background: #fff; border: 0; border-radius: 50%; }
.staff-rules-panel { margin-top: 16px; padding: 22px; }
.rules-heading { display: flex; align-items: start; justify-content: space-between; gap: 20px; }
.rules-heading span { color: #4d8067; font-size: 11px; font-weight: 800; }
.rules-table-wrap { overflow-x: auto; }
.rules-table { width: 100%; border-collapse: collapse; }
.rules-table th { padding: 10px 8px; color: var(--muted); border-bottom: 1px solid var(--line); text-align: left; font-size: 10px; }
.rules-table td { padding: 9px 8px; border-bottom: 1px solid #ece9e2; }
.rules-table td:first-child { min-width: 120px; font-weight: 800; }
.rule-select { width: 100%; min-width: 116px; min-height: 35px; padding: 5px 7px; font-size: 11px; }
.ai-note { margin-top: 16px; padding: 14px 18px; display: flex; gap: 12px; color: var(--muted); background: #e8f0ec; border-radius: 12px; font-size: 12px; }
.ai-note strong { flex: 0 0 auto; color: var(--ink); }

.request-page { padding-bottom: 90px; }
.request-main { padding-top: 24px; }
.request-intro { padding: 24px; display: grid; grid-template-columns: 1fr auto; gap: 6px 24px; align-items: end; }
.request-intro .eyebrow, .request-intro h1, .request-intro p { grid-column: 1; }
.request-intro h1 { color: var(--ink); font-family: inherit; font-size: clamp(25px, 5vw, 38px); }
.request-intro p { margin: 8px 0 0; color: var(--muted); }
.request-intro label { grid-column: 2; grid-row: 1 / 4; min-width: 150px; }
.request-public-legend { margin: 18px 4px -4px; display: flex; gap: 14px; color: var(--muted); font-size: 11px; }
.request-public-legend span { display: flex; align-items: center; gap: 5px; }
.request-public-legend i { width: 9px; height: 9px; display: inline-block; border-radius: 50%; }
.public-savebar { position: fixed; z-index: 10; right: 0; bottom: 0; left: 0; padding: 12px max(calc((100vw - 1180px) / 2), 16px); display: flex; align-items: center; justify-content: flex-end; gap: 18px; color: #fff; background: var(--ink); box-shadow: 0 -10px 30px rgba(18,42,37,.18); }
.public-savebar span { font-size: 12px; }
.public-error { margin-top: 18px; padding: 24px; color: var(--danger); }

@media (max-width: 900px) {
  .ai-grid { grid-template-columns: 1fr; }
  .staff-form { grid-template-columns: 1fr; }
  .time-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  main { width: min(100% - 20px, 1180px); }
  .tabs { width: 100%; }
  .tab { flex: 1; padding-inline: 8px; }
  .sync-status { display: none; }
  .summary { width: 100%; margin-left: 0; }
  .section-heading { align-items: start; flex-direction: column; }
  .pair-form { grid-template-columns: 1fr auto 1fr; }
  .pair-form button { grid-column: 1 / -1; }
  .request-intro { display: block; }
  .request-intro label { margin-top: 18px; }
  .staff-card { flex-wrap: wrap; }
}
