/* =========================================================
   SHIFSUKE — flat design system
   Blue (#1E66F5) primary, coral (#FF6F61) accent, paper base.
   No shadows, no gradients.
   ========================================================= */

:root {
  --paper: #EEF3F8;
  --surface: #FFFFFF;
  --surface-2: #F6F9FC;
  --surface-3: #EDF2F8;
  --line: #DDE5EE;
  --line-2: #C9D6E4;

  --ink: #0F1B2D;
  --ink-2: #3B4B63;
  --ink-3: #6B7A91;
  --ink-4: #9AA7B9;

  --blue: #1E66F5;
  --blue-600: #1857D6;
  --blue-700: #1347B2;
  --blue-800: #0F3A91;
  --blue-soft: #E4EDFE;
  --blue-soft-2: #C9DAFC;

  --accent: #FF6F61;
  --accent-600: #EC5A4C;
  --accent-700: #C9473B;
  --accent-soft: #FFEDEA;
  --accent-soft-2: #FFD3CC;

  --amber: #B86E00;
  --amber-2: #F2A114;
  --amber-soft: #FFF3D9;
  --amber-soft-2: #FBDFA3;

  --green: #17865A;
  --green-2: #2BA471;
  --green-soft: #DDF4E9;

  --lilac: #4B4BC4;
  --lilac-soft: #E8E8FB;
  --lilac-soft-2: #CFCFF5;

  --sat: #2F6FE0;
  --sun: #E0554A;
  --sat-tint: #F3F7FF;
  --sun-tint: #FFF5F4;

  --radius: 14px;
  --radius-md: 10px;
  --radius-sm: 8px;

  --font: "Noto Sans JP", -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Meiryo", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p { margin: 0; }

a { color: var(--blue); }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Generic stroke icons */
button svg, .icon-btn svg, .draft-new svg, .ws-icon, .save-state svg, .banner svg, .action-icon svg, .chip svg {
  width: 18px; height: 18px;
  fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
  flex: 0 0 auto;
}

code {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  background: var(--surface-3);
  border-radius: 4px;
  padding: 0 5px;
  font-size: 0.92em;
}

/* =========================================================
   Form controls
   ========================================================= */
input[type="text"],
input[type="date"],
input[type="number"],
input[type="email"],
select,
textarea {
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  min-height: 40px;
  transition: border-color .15s, background-color .15s;
}

input::placeholder, textarea::placeholder { color: var(--ink-4); }

input:hover, select:hover, textarea:hover { border-color: var(--ink-4); }

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--blue);
  background: #FBFDFF;
}

:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; }

select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236B7A91' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px;
}

input[type="number"] { font-feature-settings: "tnum"; }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-label { font-size: 12px; font-weight: 700; color: var(--ink-2); letter-spacing: .02em; }
.field-note { font-size: 12px; color: var(--ink-3); }
.field-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}
.field-row:last-child { margin-bottom: 0; }
.span-all { grid-column: 1 / -1; }

.input-unit { display: flex; align-items: center; gap: 8px; }
.input-unit input { max-width: 120px; }
.input-unit > span { font-size: 13px; color: var(--ink-3); white-space: nowrap; }

.quick-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.chip-btn {
  font: inherit; font-size: 12px; font-weight: 700;
  color: var(--blue-700); background: var(--blue-soft);
  border: 1px solid transparent; border-radius: 999px;
  padding: 4px 12px; cursor: pointer;
}
.chip-btn:hover { border-color: var(--blue-soft-2); }

.check-row { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); margin-top: 12px; cursor: pointer; }
.check-row input { width: 16px; height: 16px; min-height: 0; accent-color: var(--blue); }

/* Toggle switch */
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; margin-top: 4px; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track {
  width: 40px; height: 24px; border-radius: 999px;
  background: var(--line-2); position: relative; flex: 0 0 auto;
  transition: background-color .15s;
}
.switch-thumb {
  position: absolute; top: 3px; left: 3px; width: 18px; height: 18px;
  border-radius: 50%; background: #fff; transition: transform .15s;
}
.switch input:checked + .switch-track { background: var(--blue); }
.switch input:checked + .switch-track .switch-thumb { transform: translateX(16px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--blue); outline-offset: 2px; }
.switch-label { font-size: 14px; font-weight: 500; color: var(--ink); }

/* =========================================================
   Buttons
   ========================================================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-size: 14px; font-weight: 700; letter-spacing: .02em;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  padding: 9px 16px; min-height: 40px;
  cursor: pointer; white-space: nowrap;
  transition: background-color .15s, border-color .15s, color .15s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn svg { width: 16px; height: 16px; }

.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-600); }

.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--accent-600); }

.btn-secondary { background: var(--surface); color: var(--blue-700); border-color: var(--blue-soft-2); }
.btn-secondary:hover { background: var(--blue-soft); }

.btn-ghost { background: transparent; color: var(--blue-700); }
.btn-ghost:hover { background: var(--blue-soft); }

.btn-danger { background: var(--accent-700); color: #fff; }
.btn-danger:hover { background: #B33C31; }

.btn-sm { font-size: 13px; padding: 6px 12px; min-height: 34px; }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 36px; height: 36px; padding: 0;
  border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink-2); cursor: pointer;
  transition: background-color .15s, border-color .15s;
}
.icon-btn:hover { background: var(--surface-3); }
.icon-btn:disabled { opacity: .4; cursor: not-allowed; }
.icon-btn.on-dark { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.28); color: #fff; }
.icon-btn.on-dark:hover { background: rgba(255,255,255,.22); }
.icon-btn svg circle { fill: currentColor; stroke: none; }

/* =========================================================
   App bar
   ========================================================= */
.appbar { background: var(--blue); color: #fff; border-bottom: 3px solid var(--accent); }
.appbar-inner {
  max-width: 1440px; margin: 0 auto; padding: 10px 24px;
  display: flex; align-items: center; gap: 20px;
}
.brand { display: inline-flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; }
.brand-mark {
  position: relative; display: grid; place-items: center;
  width: 34px; height: 34px; border-radius: 9px;
  background: #fff; color: var(--blue);
  font-weight: 800; font-size: 13px; letter-spacing: .04em;
}
.brand-mark::after {
  content: ""; position: absolute; right: -3px; bottom: -3px;
  width: 11px; height: 11px; border-radius: 3px;
  background: var(--accent); border: 2px solid var(--blue);
}
.brand-mark svg { width: 26px; height: 26px; }
.brand-name { font-weight: 800; font-size: 16px; letter-spacing: .16em; }

.ws-switch { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ws-icon { width: 18px; height: 18px; opacity: .85; }
.ws-select {
  width: auto; min-width: 150px; max-width: 260px; min-height: 36px;
  padding: 6px 32px 6px 12px;
  background-color: rgba(255,255,255,.12);
  border-color: rgba(255,255,255,.28);
  color: #fff; font-weight: 700;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
}
.ws-select:hover { border-color: rgba(255,255,255,.5); }
.ws-select:focus { background-color: rgba(255,255,255,.2); border-color: #fff; }
.ws-select option { color: var(--ink); }

.appbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }

.save-state {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 700; letter-spacing: .04em;
  padding: 5px 12px; border-radius: 999px;
  background: rgba(255,255,255,.14); color: #fff;
}
.save-state svg { width: 14px; height: 14px; stroke-width: 2.6; }
.save-state.is-saving { background: rgba(255,255,255,.08); color: rgba(255,255,255,.75); }
.save-state.is-error { background: var(--accent); color: #fff; }

/* Menus */
.menu-wrap { position: relative; }
.menu {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 60;
  min-width: 220px; padding: 6px;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line-2); border-radius: var(--radius-md);
}
.menu button {
  display: block; width: 100%; text-align: left;
  font: inherit; font-size: 13px; font-weight: 500;
  padding: 9px 12px; border: none; border-radius: 6px;
  background: transparent; color: var(--ink); cursor: pointer;
}
.menu button:hover { background: var(--surface-3); }
.menu button.danger { color: var(--accent-700); }
.menu button.danger:hover { background: var(--accent-soft); }
.menu-sep { height: 1px; background: var(--line); margin: 6px 4px; }

/* =========================================================
   Tab bar
   ========================================================= */
.tabbar {
  position: sticky; top: 0; z-index: 40;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.tabbar-inner {
  max-width: 1440px; margin: 0 auto; padding: 0 24px;
  display: flex; align-items: center; gap: 16px; min-height: 58px;
}
.tabs { display: flex; align-items: stretch; gap: 4px; align-self: stretch; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  position: relative; display: inline-flex; align-items: center; gap: 8px;
  font: inherit; font-size: 14px; font-weight: 700; color: var(--ink-3);
  background: none; border: none; padding: 0 14px; cursor: pointer; white-space: nowrap;
}
.tab::after {
  content: ""; position: absolute; left: 10px; right: 10px; bottom: 0; height: 3px;
  border-radius: 3px 3px 0 0; background: transparent;
}
.tab:hover { color: var(--ink); }
.tab-num {
  display: grid; place-items: center; width: 22px; height: 22px; border-radius: 7px;
  font-size: 12px; font-weight: 800; background: var(--surface-3); color: var(--ink-3);
  font-feature-settings: "tnum";
}
.tab-count {
  font-size: 11px; font-weight: 700; color: var(--ink-3);
  background: var(--surface-3); border-radius: 999px; padding: 1px 7px;
}
.tab-count:empty { display: none; }
.tab.is-active { color: var(--blue-700); }
.tab.is-active::after { background: var(--blue); }
.tab.is-active .tab-num { background: var(--blue); color: #fff; }
.tab.is-active .tab-count { background: var(--blue-soft); color: var(--blue-700); }

.tabbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.period-chip {
  font-size: 12px; font-weight: 700; color: var(--ink-2);
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 999px; padding: 4px 12px; white-space: nowrap;
  font-feature-settings: "tnum";
}
.period-chip:empty { display: none; }

/* What this tab is editing + its 保存 (part of the sticky tab bar) */
.ctxbar { border-top: 1px solid var(--line); background: var(--surface-2); }
.ctxbar-inner {
  max-width: 1440px; margin: 0 auto; padding: 6px 24px;
  display: flex; align-items: center; gap: 10px; min-height: 48px;
}
.ctx-icon {
  display: grid; place-items: center; flex: 0 0 auto;
  width: 30px; height: 30px; border-radius: 8px;
  background: var(--blue-soft); color: var(--blue-700);
}
.ctx-icon svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ctxbar.is-shift .ctx-icon { background: var(--accent-soft); color: var(--accent-700); }
.ctx-text { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1 1 auto; }
.ctx-kind { font-size: 12px; font-weight: 700; color: var(--ink-3); white-space: nowrap; }
.ctx-line { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ctx-name { font-size: 15px; font-weight: 800; color: var(--ink); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ctx-name.is-muted { color: var(--ink-3); font-weight: 700; }
.ctx-state { flex: 0 0 auto; font-size: 11.5px; font-weight: 800; border-radius: 999px; padding: 2px 9px; white-space: nowrap; }
.ctx-state.is-saved { background: var(--green-soft); color: var(--green); }
.ctx-state.is-changed { background: var(--amber-soft); color: var(--amber); }
.ctx-state.is-unsaved { background: var(--surface-3); color: var(--ink-2); }
.ctx-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
#ctx-save { gap: 0; min-width: 64px; }

/* =========================================================
   Layout
   ========================================================= */
.container { max-width: 1120px; margin: 0 auto; padding: 28px 24px 56px; }
.container.is-wide { max-width: 1440px; }

.view-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 16px;
  flex-wrap: wrap; margin-bottom: 20px;
}
.view-title { font-size: 24px; font-weight: 800; letter-spacing: .02em; line-height: 1.3; }
.view-lead { margin-top: 4px; color: var(--ink-3); font-size: 13px; }
.view-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.view-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 24px; }

.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.span-2 { grid-column: span 2; }

.panel {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px 22px;
}
.panel + .panel { margin-top: 16px; }
.grid > .panel + .panel { margin-top: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 4px; }
.panel-title { font-size: 15px; font-weight: 800; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.panel-head .panel-title { margin-bottom: 0; }
.panel-lead { font-size: 12.5px; color: var(--ink-3); margin: 4px 0 14px; }
.optional {
  white-space: nowrap;
  font-size: 11px; font-weight: 700; color: var(--ink-3);
  background: var(--surface-3); border-radius: 999px; padding: 1px 8px;
}

.section-title { font-size: 15px; font-weight: 800; margin: 28px 0 12px; }

/* Segmented control */
.seg-control { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
.seg-btn {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  text-align: left; font: inherit; cursor: pointer;
  padding: 12px 14px; border-radius: var(--radius-md);
  background: var(--surface); border: 1px solid var(--line-2); color: var(--ink);
  transition: border-color .15s, background-color .15s;
}
.seg-btn strong { font-size: 14px; font-weight: 800; }
.seg-btn small { font-size: 12px; color: var(--ink-3); }
.seg-btn:hover { border-color: var(--ink-4); }
.seg-btn.is-active { border: 2px solid var(--blue); padding: 11px 13px; background: var(--blue-soft); }
.seg-btn.is-active strong { color: var(--blue-700); }

/* Per-weekday minimums */
.dow-mins { margin: 0 0 14px; }
.dow-mins > summary {
  cursor: pointer; list-style: none; font-size: 13px; font-weight: 700; color: var(--blue-700);
  display: inline-flex; align-items: center; gap: 6px;
}
.dow-mins > summary::-webkit-details-marker { display: none; }
.dow-mins > summary::before { content: "＋"; font-weight: 800; }
.dow-mins[open] > summary::before { content: "−"; }
.dow-grid { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 6px; margin: 10px 0 6px; }
.dow-cell { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; }
.dow-cell span { font-size: 12px; font-weight: 800; color: var(--ink-2); }
.dow-cell span.sun { color: var(--sun); }
.dow-cell span.sat { color: var(--sat); }
.dow-cell input { text-align: center; padding: 7px 2px; min-height: 36px; }
.dow-cell.is-holiday input::placeholder { font-size: 11px; }

/* Holidays in the chosen period */
.holiday-list { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin-top: 12px; }
.holiday-list:empty { display: none; }
.hl-label { font-size: 12px; font-weight: 700; color: var(--ink-3); }
.hl-item {
  font-size: 12px; font-weight: 700; color: var(--sun);
  background: var(--sun-tint); border: 1px solid var(--accent-soft-2); border-radius: 999px; padding: 1px 10px;
}

/* 役割・スキル rules + 特別な日 rows */
.rule-list { display: flex; flex-direction: column; gap: 8px; }
.rule-row {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2);
}
.rule-row.is-out { opacity: .6; }
.rule-row select, .rule-row input { min-height: 38px; padding-top: 7px; padding-bottom: 7px; }
.rule-row select { width: auto; }
.rule-row .icon-btn { margin-left: auto; }
.rule-tag { flex: 1 1 150px; max-width: 220px; }
.rule-sep { font-size: 13px; color: var(--ink-3); white-space: nowrap; }
.rule-row input.rule-count { width: 64px; flex: 0 0 64px; text-align: center; padding-left: 6px; padding-right: 6px; }
.rule-hint { font-size: 12px; color: var(--ink-3); white-space: nowrap; }
.rule-hint.is-warn { color: var(--accent-700); font-weight: 700; }
.rule-chips { flex-basis: 100%; }
.sp-date { width: auto; max-width: 170px; }
.sp-note { flex: 1 1 140px; max-width: 220px; }
.sp-min-wrap input { width: 64px; text-align: center; }

/* Templates: 呼び出す / 新しく作る at the top of 条件設定 */
.tpl-panel { margin-bottom: 16px; }
.tpl-seg { margin-bottom: 12px; }
.tpl-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.tpl-row input { flex: 1 1 220px; }
.tpl-base { display: flex; flex-wrap: wrap; gap: 0 20px; }
.tpl-base .check-row { margin-top: 8px; }
.tpl-list { display: flex; flex-direction: column; gap: 6px; }
.tpl-item {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.tpl-item.is-active { border: 2px solid var(--blue); padding: 9px 11px; background: var(--blue-soft); }
.tpl-main { flex: 1 1 220px; min-width: 0; display: flex; flex-direction: column; }
.tpl-title { display: flex; align-items: center; gap: 8px; min-width: 0; }
.tpl-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tpl-badge {
  flex: 0 0 auto; font-size: 11px; font-weight: 800; white-space: nowrap;
  border-radius: 999px; padding: 1px 8px; background: var(--blue); color: #fff;
}
.tpl-badge.is-changed { background: var(--amber-soft); color: var(--amber); }
.tpl-meta { font-size: 12px; color: var(--ink-3); }
.tpl-item.is-empty .tpl-meta { color: var(--accent-700); }
.tpl-actions { display: flex; align-items: center; gap: 6px; }
.muted-note { font-size: 12.5px; color: var(--ink-3); padding: 10px 12px; border: 1px dashed var(--line-2); border-radius: var(--radius-sm); }

/* =========================================================
   Roster
   ========================================================= */
.roster { display: flex; flex-direction: column; gap: 8px; }

/* 希望休を LINE で集める */
.wish-panel {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--lilac);
  border-radius: var(--radius-md); padding: 14px 16px; margin-bottom: 16px;
}
.wish-panel-text { flex: 1 1 300px; min-width: 0; }
.wish-panel-title { font-size: 15px; font-weight: 800; }
.wish-panel-sub { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }
.wish-panel-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.staff-row {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-md); transition: border-color .15s;
}
.staff-row:hover { border-color: var(--line-2); }
.staff-row.is-open { border-color: var(--blue-soft-2); }

.staff-summary {
  display: grid; grid-template-columns: auto minmax(160px, 1.1fr) minmax(0, 2fr) auto;
  align-items: center; gap: 14px;
  padding: 12px 14px; cursor: pointer; border-radius: var(--radius-md);
}
.staff-summary:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; }

.avatar {
  display: grid; place-items: center;
  width: 38px; height: 38px; border-radius: 11px;
  font-weight: 800; font-size: 15px;
  background: var(--blue-soft); color: var(--blue-700);
}
.avatar.sm { width: 26px; height: 26px; border-radius: 8px; font-size: 12px; }
.avatar.c1 { background: var(--blue-soft); color: var(--blue-700); }
.avatar.c2 { background: var(--accent-soft); color: var(--accent-700); }
.avatar.c3 { background: var(--amber-soft); color: var(--amber); }
.avatar.c4 { background: var(--green-soft); color: var(--green); }
.avatar.c5 { background: var(--lilac-soft); color: var(--lilac); }

.staff-ident { min-width: 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.staff-name { font-size: 15px; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.staff-name.is-empty { color: var(--ink-4); font-weight: 500; }
.badge-role {
  font-size: 11px; font-weight: 700; color: var(--blue-700);
  background: var(--blue-soft); border-radius: 6px; padding: 1px 7px; white-space: nowrap;
}
.badge-role.more { color: var(--ink-3); background: var(--surface-3); }

/* 役割・スキル editor */
.tag-editor { display: flex; flex-direction: column; gap: 8px; }
.tag-chips {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  min-height: 40px; padding: 5px 6px; background: var(--surface);
  border: 1px solid var(--line-2); border-radius: var(--radius-sm);
}
.tag-chips:focus-within { border-color: var(--blue); }
.tag-chip {
  display: inline-flex; align-items: center; gap: 2px;
  font-size: 12.5px; font-weight: 700; color: var(--blue-700);
  background: var(--blue-soft); border-radius: 6px; padding: 2px 2px 2px 8px;
}
.tag-x {
  display: grid; place-items: center; width: 20px; height: 20px; padding: 0;
  border: 0; border-radius: 5px; background: transparent; color: var(--blue-700); cursor: pointer;
}
.tag-x:hover { background: var(--blue-soft-2); }
.tag-x svg { width: 12px; height: 12px; }
.tag-chips .tag-input {
  flex: 1 1 90px; min-width: 90px; border: 0; padding: 4px 6px; min-height: 28px; background: transparent;
}
.tag-chips .tag-input:focus { background: transparent; }
.tag-suggest { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.tag-suggest-label { font-size: 12px; color: var(--ink-3); }

.staff-chips { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; font-weight: 700; line-height: 1.5;
  padding: 2px 9px; border-radius: 999px; white-space: nowrap;
  background: var(--surface-3); color: var(--ink-2);
}
.chip-off { background: var(--blue-soft); color: var(--blue-700); }
.chip-must { background: var(--accent-soft); color: var(--accent-700); }
.chip-want { background: var(--amber-soft); color: var(--amber); }
.chip-shift { background: var(--lilac-soft); color: var(--lilac); }
.chip-muted { background: transparent; color: var(--ink-3); font-weight: 500; padding-left: 2px; padding-right: 2px; }
.chip-week { background: var(--green-soft); color: var(--green); }
.field-note.is-warn { color: var(--accent-700); font-weight: 700; }

.staff-actions { display: flex; align-items: center; gap: 4px; }
.staff-actions .icon-btn { width: 32px; height: 32px; border-color: transparent; background: transparent; color: var(--ink-3); }
.staff-actions .icon-btn:hover { background: var(--surface-3); color: var(--ink); }
.staff-actions .icon-btn.del:hover { background: var(--accent-soft); color: var(--accent-700); }
.staff-actions .chev svg { transition: transform .15s; }
.staff-row.is-open .staff-actions .chev svg { transform: rotate(180deg); }

.staff-editor {
  border-top: 1px solid var(--line);
  background: var(--surface-2);
  padding: 18px 18px 20px;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px 28px;
}
.editor-col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.editor-col .field-row { margin-bottom: 0; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); }
.editor-col .input-unit input { max-width: 96px; }

.wd-picker { display: flex; gap: 6px; flex-wrap: wrap; }
.wd-btn {
  width: 38px; height: 38px; border-radius: 9px;
  font: inherit; font-size: 13px; font-weight: 700;
  background: var(--surface); color: var(--ink-2);
  border: 1px solid var(--line-2); cursor: pointer;
}
.wd-btn.sun { color: var(--sun); }
.wd-btn.sat { color: var(--sat); }
.wd-btn:hover { border-color: var(--ink-4); }
.wd-btn.is-on { background: var(--ink-2); border-color: var(--ink-2); color: #fff; }
.wd-btn.sm { width: 32px; height: 32px; border-radius: 8px; font-size: 12px; }

/* Calendar picker */
.cal { width: 100%; max-width: 440px; }
.cal-month { font-size: 12px; font-weight: 800; color: var(--ink-2); margin: 10px 0 6px; }
.cal-month:first-child { margin-top: 0; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-dow { text-align: center; font-size: 11px; font-weight: 700; color: var(--ink-3); padding-bottom: 2px; }
.cal-dow.sun { color: var(--sun); }
.cal-dow.sat { color: var(--sat); }
.cal-cell {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center;
  height: 42px; border-radius: 8px;
  font: inherit; font-size: 13px; font-weight: 700; font-feature-settings: "tnum";
  background: var(--surface); color: var(--ink); border: 1px solid var(--line);
  cursor: pointer; padding: 0; line-height: 1.1;
}
.cal-cell small { font-size: 9.5px; font-weight: 800; letter-spacing: .02em; margin-top: 2px; }
.cal-cell.sun, .cal-cell.hol { color: var(--sun); }
.cal-cell.sat { color: var(--sat); }
.cal-cell:hover { border-color: var(--ink-4); }
.cal-cell.is-out { visibility: hidden; }
.cal-cell.is-fixed { background: var(--surface-3); color: var(--ink-3); border-color: transparent; cursor: default; }
.cal-cell.is-want { background: var(--amber-soft); border-color: var(--amber-soft-2); color: var(--amber); }
.cal-cell.is-must { background: var(--accent); border-color: var(--accent); color: #fff; }
.cal-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--ink-3); margin-top: 8px; }
.cal-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; }
.cal-legend .lg-want { background: var(--amber-soft); border: 1px solid var(--amber-soft-2); }
.cal-legend .lg-must { background: var(--accent); }
.cal-legend .lg-fixed { background: var(--surface-3); border: 1px solid var(--line-2); }
.cal-legend .lg-hol-text { color: var(--sun); }
.cal-extra { font-size: 12px; color: var(--ink-3); margin-top: 6px; }

.roster-empty {
  text-align: center; padding: 40px 20px;
  border: 1px dashed var(--line-2); border-radius: var(--radius);
  color: var(--ink-3); background: var(--surface);
}

/* =========================================================
   Empty states
   ========================================================= */
.empty {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: 12px; padding: 56px 24px;
  background: var(--surface); border: 1px dashed var(--line-2); border-radius: var(--radius);
}
.empty-sm { padding: 32px 20px; gap: 6px; }
.empty-illustration {
  width: 92px; height: 92px; border-radius: 50%;
  display: grid; place-items: center; background: var(--blue-soft); color: var(--blue);
  margin-bottom: 4px;
}
.empty-illustration svg { width: 52px; height: 52px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.empty-illustration .f1 { fill: var(--blue-soft-2); stroke: none; }
.empty-illustration .f2 { fill: var(--accent); stroke: none; }
.empty-title { font-size: 17px; font-weight: 800; }
.empty-sub { font-size: 13px; color: var(--ink-3); max-width: 460px; }

/* シフト表: 新しく作る / 保存したシフト表を開く */
.choice-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 8px; width: 100%; }
.choice-btn {
  flex: 0 1 270px; display: flex; flex-direction: column; align-items: center; gap: 4px;
  font: inherit; text-align: center; cursor: pointer;
  padding: 18px 16px; border-radius: var(--radius-md);
  background: var(--surface); border: 1px solid var(--blue-soft-2); color: var(--blue-700);
  transition: background-color .15s, border-color .15s;
}
.choice-btn svg { width: 26px; height: 26px; margin-bottom: 2px; }
.choice-btn strong { font-size: 15px; font-weight: 800; }
.choice-btn small { font-size: 12px; color: var(--ink-3); }
.choice-btn:hover { background: var(--blue-soft); }
.choice-btn.is-primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.choice-btn.is-primary small { color: rgba(255,255,255,.85); }
.choice-btn.is-primary:hover { background: var(--blue-600); }
.choice-btn:disabled { opacity: .55; cursor: progress; }
.choice-btn[hidden] { display: none; }

/* =========================================================
   Drafts
   ========================================================= */
.drafts-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px 16px; flex-wrap: wrap; margin-bottom: 14px; }
.drafts-strip { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 16px; scrollbar-width: thin; }

.draft-card {
  position: relative; flex: 0 0 auto; min-width: 176px;
  text-align: left; font: inherit; color: var(--ink); cursor: pointer;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 14px 12px;
  transition: border-color .15s, background-color .15s;
}
.draft-card:hover { border-color: var(--line-2); }
.draft-card.is-active { border: 2px solid var(--accent); padding: 11px 13px 11px; background: #FFFBFA; }
.draft-top { display: flex; align-items: center; gap: 6px; padding-right: 22px; }
.draft-label { font-size: 13px; font-weight: 800; }
.draft-flag {
  font-size: 10.5px; font-weight: 800; border-radius: 5px; padding: 0 6px; line-height: 1.7;
  background: var(--green-soft); color: var(--green);
}
.draft-flag.stale { background: var(--amber-soft); color: var(--amber); }
.draft-score { display: flex; align-items: baseline; gap: 3px; margin: 4px 0 2px; font-feature-settings: "tnum"; }
.draft-score b { font-size: 26px; font-weight: 800; line-height: 1.1; }
.draft-score span { font-size: 12px; color: var(--ink-3); font-weight: 700; }
.draft-score.good b { color: var(--green); }
.draft-score.ok b { color: var(--blue-700); }
.draft-score.low b { color: var(--accent-700); }
.draft-bar { height: 4px; border-radius: 999px; background: var(--surface-3); overflow: hidden; margin: 6px 0 8px; }
.draft-bar > span { display: block; height: 100%; border-radius: 999px; background: var(--blue); }
.draft-card.is-active .draft-bar > span { background: var(--accent); }
.draft-meta { font-size: 11.5px; color: var(--ink-3); line-height: 1.5; }
.draft-del {
  position: absolute; top: 8px; right: 8px; width: 24px; height: 24px;
  display: grid; place-items: center; border-radius: 6px;
  border: none; background: transparent; color: var(--ink-4); cursor: pointer; padding: 0;
}
.draft-del svg { width: 14px; height: 14px; }
.draft-del:hover { background: var(--accent-soft); color: var(--accent-700); }

.draft-new {
  flex: 0 0 auto; min-width: 150px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  font: inherit; cursor: pointer;
  background: var(--accent-soft); color: var(--accent-700);
  border: 1px dashed var(--accent); border-radius: 12px; padding: 12px 16px;
}
.draft-new svg { width: 22px; height: 22px; }
.draft-new strong { font-size: 13px; font-weight: 800; }
.draft-new small { font-size: 11px; font-weight: 800; letter-spacing: .14em; opacity: .8; }
.draft-new:hover { background: #FFE2DD; }

/* Banners */
.banner {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 14px; border-radius: var(--radius-md); margin-bottom: 16px;
  font-size: 13px; font-weight: 500;
}
.banner svg { width: 18px; height: 18px; }
.banner span { flex: 1 1 260px; }
.banner-warn { background: var(--amber-soft); color: #7A4A00; border: 1px solid var(--amber-soft-2); }

/* =========================================================
   Shift table
   ========================================================= */
.panel-table { padding: 16px 16px 12px; }
.table-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar-right { display: flex; align-items: center; gap: 8px; }
.toolbar-right .icon-btn { width: 34px; height: 34px; }
.toolbar-right .icon-btn svg { width: 17px; height: 17px; }

.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--ink-2); }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.sw { display: inline-grid; place-items: center; width: 22px; height: 18px; border-radius: 5px; font-size: 10.5px; font-weight: 800; }
.sw-work { background: var(--blue-soft); color: var(--blue-700); }
.sw-morning { background: var(--amber-soft); color: var(--amber); }
.sw-evening { background: var(--lilac-soft); color: var(--lilac); }
.sw-allday { background: var(--blue-soft-2); color: var(--blue-800); }
.sw-off { background: var(--surface); color: var(--ink-4); border: 1px solid var(--line); }
.sw-short { background: var(--accent-soft); color: var(--accent-700); }
.sw-want { position: relative; background: var(--surface); border: 1px solid var(--line); }
.sw-want::after { content: ""; position: absolute; top: 2px; right: 2px; width: 6px; height: 6px; border-radius: 50%; background: var(--amber-2); }

.table-wrap {
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line); border-radius: var(--radius-md);
  background: var(--surface);
}

.shift-table {
  border-collapse: separate; border-spacing: 0;
  width: 100%; font-size: 12.5px; font-feature-settings: "tnum";
}
.shift-table th, .shift-table td {
  border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
  text-align: center; white-space: nowrap; padding: 0;
}
.shift-table tr > :last-child { border-right: none; }
.shift-table thead th {
  background: var(--surface-2); color: var(--ink-2); font-weight: 700;
  position: sticky; top: 0; z-index: 2;
}
.shift-table thead tr:first-child th { padding: 7px 2px 0; font-size: 13px; font-weight: 800; color: var(--ink); border-bottom: none; }
.shift-table thead tr:nth-child(2) th { padding: 0 2px 6px; font-size: 11px; top: 30px; }
.shift-table th.sat, .shift-table td.sat { background-color: var(--sat-tint); }
.shift-table th.sun, .shift-table td.sun { background-color: var(--sun-tint); }
.shift-table thead th.sat { color: var(--sat); }
.shift-table thead th.sun { color: var(--sun); }
.shift-table th.closed, .shift-table td.closed { background-color: var(--surface-3); }
.shift-table thead th.closed { color: var(--ink-3); }
.shift-table thead tr:nth-child(2) th.closed { font-size: 10px; letter-spacing: -.02em; }
.shift-table thead th.is-hol { font-weight: 800; }
.shift-table thead th.is-special { box-shadow: inset 0 3px 0 var(--amber-2); }

.shift-table .name-col {
  position: sticky; left: 0; z-index: 3;
  background: var(--surface); text-align: left;
  min-width: 168px; max-width: 220px; padding: 0 10px;
  border-right: 1px solid var(--line-2);
}
.shift-table thead .name-col { z-index: 4; background: var(--surface-2); font-size: 12px; color: var(--ink-3); }
.shift-table .sum-col { min-width: 40px; padding: 0 6px; font-weight: 700; color: var(--ink-2); background: var(--surface-2); }
.shift-table thead .sum-col { font-size: 11px; color: var(--ink-3); }

.name-cell { display: flex; align-items: center; gap: 8px; min-height: 40px; }
.name-cell .nm { font-weight: 700; overflow: hidden; text-overflow: ellipsis; max-width: 120px; }
.name-cell .badge-role { font-size: 10px; padding: 0 5px; }
.shift-table td.name-col.clickable { cursor: pointer; }
.shift-table td.name-col.clickable:hover .nm { color: var(--blue-700); text-decoration: underline; text-underline-offset: 3px; }

.shift-table td.cell { min-width: 34px; height: 40px; padding: 3px; cursor: pointer; user-select: none; position: relative; }
.shift-table.is-readonly td.cell { cursor: default; }
.cell .p {
  display: grid; place-items: center; height: 100%; min-height: 32px; border-radius: 6px;
  font-weight: 800; font-size: 12.5px;
}
.cell .p.work { background: var(--blue-soft); color: var(--blue-700); }
.cell .p.morning { background: var(--amber-soft); color: var(--amber); }
.cell .p.evening { background: var(--lilac-soft); color: var(--lilac); }
.cell .p.allday { background: var(--blue-soft-2); color: var(--blue-800); }
.cell .p.off { color: var(--ink-4); font-weight: 500; }
.cell .p.none { color: var(--line-2); font-weight: 500; }
.shift-table:not(.is-readonly) td.cell:hover .p { outline: 2px solid var(--blue-soft-2); outline-offset: -1px; }
.shift-table tbody tr:hover td { background-color: #FAFCFF; }
.shift-table tbody tr:hover td.sat { background-color: #ECF2FF; }
.shift-table tbody tr:hover td.sun { background-color: #FFEEEC; }
.shift-table tbody tr:hover td.closed { background-color: #E3EAF2; }

/* Issue markers */
.cell.iss-want::after {
  content: ""; position: absolute; top: 4px; right: 4px;
  width: 7px; height: 7px; border-radius: 50%; background: var(--amber-2);
  border: 1.5px solid var(--surface);
}
.cell.iss-consec .p { box-shadow: none; outline: 2px solid var(--accent) !important; outline-offset: -2px; }
.cell.iss-must .p { background: var(--accent); color: #fff; }

.shift-table td.cell.dragging { opacity: .4; }
.shift-table td.cell.drag-over .p { outline: 2px dashed var(--accent) !important; outline-offset: -1px; }

/* Totals */
.shift-table tfoot td, .shift-table tfoot th {
  background: var(--surface-2); font-weight: 800; color: var(--ink-2);
  height: 32px; font-size: 12px; padding: 0 2px;
}
.shift-table tfoot .name-col { font-size: 12px; color: var(--ink-3); font-weight: 700; background: var(--surface-2); }
.shift-table tfoot td.short { background: var(--accent-soft); color: var(--accent-700); }
.shift-table tfoot tr:last-child td, .shift-table tfoot tr:last-child th { border-bottom: none; }

.table-hint { font-size: 12px; color: var(--ink-3); margin-top: 10px; }

/* Issues */
.score-badge {
  font-size: 13px; font-weight: 800; border-radius: 999px; padding: 3px 12px;
  background: var(--surface-3); color: var(--ink-2); font-feature-settings: "tnum";
}
.score-badge.good { background: var(--green-soft); color: var(--green); }
.score-badge.ok { background: var(--blue-soft); color: var(--blue-700); }
.score-badge.low { background: var(--accent-soft); color: var(--accent-700); }

.issues { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.issue {
  display: flex; align-items: flex-start; gap: 10px;
  font-size: 13px; padding: 9px 12px; border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.issue::before { content: ""; flex: 0 0 8px; height: 8px; border-radius: 50%; margin-top: 6px; background: var(--ink-4); }
.issue.bad::before { background: var(--accent); }
.issue.warn::before { background: var(--amber-2); }
.issue.ok { background: var(--green-soft); color: var(--green); font-weight: 700; }
.issue.ok::before { background: var(--green-2); }
.issue.more { background: transparent; color: var(--ink-3); padding-top: 2px; }
.issue.more::before { display: none; }

/* =========================================================
   Output
   ========================================================= */
.summary-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  background: var(--blue-soft); border: 1px solid var(--blue-soft-2);
  border-radius: var(--radius); padding: 18px 20px; margin-bottom: 14px;
}
.summary-banner-left { min-width: 0; flex: 1 1 320px; }
.summary-label { font-size: 12px; font-weight: 700; color: var(--blue-700); margin-bottom: 2px; }
.summary-title { font-size: 18px; font-weight: 800; color: var(--blue-800); }
.summary-meta { font-size: 13px; color: var(--ink-2); margin-top: 2px; }

.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.stat-cell {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md);
  padding: 14px 16px; border-top: 3px solid var(--blue);
}
.stat-cell:nth-child(2) { border-top-color: var(--green-2); }
.stat-cell:nth-child(3) { border-top-color: var(--accent); }
.stat-cell:nth-child(4) { border-top-color: var(--amber-2); }
.stat-key { font-size: 12px; font-weight: 700; color: var(--ink-3); margin-bottom: 6px; }
.stat-val { display: flex; align-items: baseline; gap: 4px; font-size: 28px; font-weight: 800; line-height: 1.1; font-feature-settings: "tnum"; }
.stat-unit { font-size: 12px; font-weight: 700; color: var(--ink-3); }

.action-rows { display: grid; gap: 8px; }
.action-row {
  display: flex; align-items: center; gap: 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md);
  padding: 12px 14px;
}
.action-row:hover { border-color: var(--line-2); }
.action-icon { width: 40px; height: 40px; flex: 0 0 40px; border-radius: 11px; display: grid; place-items: center; background: var(--blue-soft); color: var(--blue-700); }
.action-icon svg { width: 20px; height: 20px; }
.action-icon.green { background: var(--green-soft); color: var(--green); }
.action-icon.blue { background: var(--blue-soft); color: var(--blue-700); }
.action-icon.amber { background: var(--amber-soft); color: var(--amber); }
.action-icon.accent { background: var(--accent-soft); color: var(--accent-700); }
.action-icon.lilac { background: var(--lilac-soft); color: var(--lilac); }
.action-text { flex: 1; min-width: 0; }
.action-t { font-size: 14px; font-weight: 800; }
.action-s { font-size: 12px; color: var(--ink-3); }

.archive-list { display: flex; flex-direction: column; gap: 8px; }
.archive-item {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md);
  padding: 12px 14px;
}
.archive-item.is-active { border: 2px solid var(--blue); padding: 11px 13px; background: var(--blue-soft); }
.archive-main { flex: 1 1 260px; min-width: 0; }
.archive-title { font-weight: 800; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.archive-meta { font-size: 12px; color: var(--ink-3); }
.archive-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* Footer */
.app-footer {
  max-width: 1120px; margin: 0 auto; padding: 0 24px 40px;
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  font-size: 12px; color: var(--ink-3);
}
.app-footer a { color: var(--ink-3); }
.footer-links { display: inline-flex; gap: 16px; flex-wrap: wrap; }

/* =========================================================
   Modals
   ========================================================= */
.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 16px; }
#dialog { z-index: 120; }
.modal-overlay { position: absolute; inset: 0; background: rgba(15, 27, 45, .45); }
.modal-body {
  position: relative; width: 100%; max-width: 560px; max-height: 88vh;
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface); border-radius: var(--radius); border: 1px solid var(--line);
}
.modal-sm { max-width: 420px; }
.modal-xl { max-width: 1200px; }
.modal-header {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 20px; border-bottom: 1px solid var(--line);
}
.modal-header h3 { font-size: 16px; font-weight: 800; }
.modal-close {
  width: 32px; height: 32px; border: none; border-radius: 8px;
  background: transparent; color: var(--ink-3); font-size: 22px; line-height: 1; cursor: pointer;
}
.modal-close:hover { background: var(--surface-3); color: var(--ink); }
.modal-content { padding: 18px 20px; overflow-y: auto; }
.modal-footer {
  display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap;
  padding: 12px 20px; border-top: 1px solid var(--line); background: var(--surface-2);
}
.modal-lead { font-size: 13px; color: var(--ink-2); margin-bottom: 10px; }
.dlg-msg { font-size: 14px; color: var(--ink-2); white-space: pre-line; }
.dlg-msg:empty { display: none; }
#dlg-input { margin-top: 12px; }
.code-input {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 12.5px; line-height: 1.55; resize: vertical; min-height: 140px;
}

/* Staff view modal */
.sv-summary {
  background: var(--blue-soft); color: var(--blue-800); font-weight: 700; font-size: 13px;
  border-radius: var(--radius-sm); padding: 10px 12px; margin-bottom: 12px;
}
.staff-view-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.sv-item {
  display: grid; grid-template-columns: 52px 26px 1fr; align-items: center; gap: 6px;
  padding: 7px 10px; border-radius: var(--radius-sm); font-size: 13px;
  border: 1px solid var(--line); background: var(--surface);
}
.sv-item.off { background: var(--surface-2); color: var(--ink-3); }
.sv-item.work { background: var(--blue-soft); border-color: transparent; color: var(--blue-700); }
.sv-item.morning { background: var(--amber-soft); border-color: transparent; color: var(--amber); }
.sv-item.evening { background: var(--lilac-soft); border-color: transparent; color: var(--lilac); }
.sv-item.allday { background: var(--blue-soft-2); border-color: transparent; color: var(--blue-800); }
.sv-date { font-weight: 800; font-feature-settings: "tnum"; }
.sv-week { font-size: 11px; }
.sv-date.sun, .sv-week.sun { color: var(--sun); }
.sv-date.sat, .sv-week.sat { color: var(--sat); }
.sv-status { text-align: right; font-weight: 800; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 28px; z-index: 200;
  transform: translate(-50%, 8px); opacity: 0; pointer-events: none;
  background: var(--ink); color: #fff; font-size: 13px; font-weight: 700;
  padding: 11px 18px; border-radius: 10px; max-width: calc(100vw - 32px);
  transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Print-only title */
.print-title { display: none; }

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 960px) {
  .grid { grid-template-columns: minmax(0, 1fr); }
  .span-2 { grid-column: auto; }
  .staff-summary { grid-template-columns: auto minmax(0, 1fr) auto; }
  .staff-chips { grid-column: 2 / 4; grid-row: 2; }
  .staff-editor { grid-template-columns: minmax(0, 1fr); }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .period-chip { display: none; }
}

@media (max-width: 640px) {
  body { font-size: 14px; }
  .appbar-inner { padding: 8px 14px; gap: 10px; }
  .brand-name { display: none; }
  .ws-icon { display: none; }
  .ws-select { min-width: 0; max-width: 46vw; }
  .save-text { display: none; }
  .save-state { padding: 6px; }

  .tabbar-inner { padding: 0 6px; min-height: 52px; gap: 6px; }
  .tabs { flex: 1; gap: 0; }
  .tab { flex: 1; flex-direction: column; justify-content: center; gap: 2px; padding: 6px 4px 8px; font-size: 11px; }
  .tab-num { width: 20px; height: 20px; font-size: 11px; }
  .tab-count { display: none; }
  .tabbar-right { display: none; }

  .ctxbar-inner { padding: 6px 12px; gap: 8px; min-height: 52px; }
  .ctx-icon { width: 28px; height: 28px; }
  .ctx-text { flex-direction: column; align-items: flex-start; gap: 0; }
  .ctx-kind { font-size: 10.5px; line-height: 1.35; }
  .ctx-name { font-size: 14px; }
  .ctx-state { font-size: 10.5px; padding: 1px 7px; }
  .ctx-save-pre { display: none; }

  .wish-panel { padding: 12px; gap: 10px; }
  .wish-panel-actions { width: 100%; }
  .wish-panel-actions .btn { flex: 1 1 0; white-space: normal; }
  .choice-btn { flex-basis: 100%; }
  .drafts-head > .btn { width: 100%; }

  .container { padding: 18px 14px 40px; }
  .view-title { font-size: 20px; }
  .view-head { margin-bottom: 14px; }
  .view-actions { width: 100%; }
  .view-actions > .btn { flex: 1; }
  .panel { padding: 16px; }
  .seg-control { grid-template-columns: minmax(0, 1fr); }
  .rule-row { gap: 6px; padding: 10px; }
  .rule-tag { flex: 1 1 calc(100% - 40px); max-width: none; }
  .rule-days, .rule-slot { flex: 1 1 calc(50% - 3px); }
  .sp-date { flex: 1 1 0; max-width: none; }
  .sp-note { max-width: none; }
  .dow-grid { gap: 4px; }

  .staff-summary { gap: 10px; padding: 10px 12px; }
  .staff-editor { padding: 14px; }

  .shift-table .name-col { min-width: 112px; padding: 0 8px; }
  .name-cell .avatar, .name-cell .badge-role { display: none; }
  .name-cell .nm { max-width: 88px; }
  .shift-table td.cell { min-width: 32px; }

  .stat-val { font-size: 22px; }
  .action-row { gap: 10px; padding: 10px 12px; }
  .action-icon { width: 34px; height: 34px; flex-basis: 34px; }
  .staff-view-list { grid-template-columns: minmax(0, 1fr); }
  .app-footer { padding-bottom: 32px; }
  .modal { align-items: flex-end; padding: 0; }
  .modal-body { max-height: 92vh; border-radius: var(--radius) var(--radius) 0 0; }
}

/* =========================================================
   Print — only the selected shift table
   ========================================================= */
@media print {
  @page { size: A4 landscape; margin: 10mm; }
  body { background: #fff; font-size: 10px; }
  .appbar, .tabbar, .app-footer, .modal, .toast,
  .view:not([data-view="table"]),
  #empty-card, .drafts-head, .drafts-strip, #stale-banner, .table-toolbar, #issues-panel, .table-hint { display: none !important; }
  .view[data-view="table"], #table-body { display: block !important; }
  .container { max-width: none; padding: 0; }
  .panel-table { border: none; padding: 0; }
  .table-wrap { overflow: visible; border: 1px solid #999; border-radius: 0; }
  .print-title { display: block; font-size: 14px; font-weight: 800; margin-bottom: 8px; }
  .shift-table { font-size: 9.5px; table-layout: fixed; }
  .shift-table thead tr:first-child th.name-col { width: 108px; }
  .shift-table thead tr:first-child th.sum-col { width: 30px; }
  .shift-table .badge-role { display: none; }
  .shift-table th, .shift-table td { border-color: #bbb; }
  .shift-table thead th { position: static; }
  .shift-table .name-col { position: static; min-width: 0; }
  .shift-table td.cell { height: 22px; min-width: 0; padding: 1px; }
  .cell .p { min-height: 0; border-radius: 3px; }
  .name-cell { min-height: 22px; }
  .name-cell .avatar { display: none; }
  .cell.iss-want::after { display: none; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* =========================================================
   SHIFSUKE Pro (preview): cloud indicator + account window
   ========================================================= */
.cloud-state { border: 0; font: inherit; cursor: pointer; }
.cloud-state.is-saving { background: rgba(255,255,255,.08); color: rgba(255,255,255,.75); }
.cloud-state.is-error { background: var(--amber-soft); color: var(--amber); }
.account-plan { margin-left: 8px; vertical-align: 1px; }
.account-plan.is-free { background: var(--surface-3); color: var(--ink-2); }
.account-note { font-size: 13px; color: var(--ink-2); margin-top: 8px; }
.account-code-row { margin-top: 8px; }
.account-code-row input { flex: 0 1 11em; font-size: 18px; letter-spacing: .25em; font-variant-numeric: tabular-nums; }
.account-h { font-size: 13px; font-weight: 800; color: var(--ink-2); margin: 16px 0 8px; }
.account-foot { margin-top: 16px; display: flex; justify-content: flex-end; }
