:root {
  --green: #008060;
  --green-dark: #00664d;
  --sidebar: #12352c;
  --bg: #f4f7f6;
  --card: #ffffff;
  --text: #1c2b27;
  --muted: #3f4b48;
  --line: #e2e8e6;
  --header-bg: #f3f5f4;
  --sat: #1d4f91;
  --sun: #c0392b;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", "Hiragino Sans", "Yu Gothic", sans-serif;
  background: var(--bg);
  color: var(--text);
}
a { color: var(--green-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

.app-body { display: flex; min-height: 100vh; }
.sidebar {
  width: 240px;
  background: var(--sidebar);
  color: #fff;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}
.sidebar-brand {
  color: #fff;
  font-weight: 700;
  font-size: 18px;
  padding: 24px 20px 16px;
  text-decoration: none;
  line-height: 1.4;
}
.sidebar-brand small { font-weight: 400; opacity: 0.75; }
.sidebar-nav { display: flex; flex-direction: column; padding: 8px; gap: 4px; }
.sidebar-nav a {
  color: #d7eee6;
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.sidebar-nav a:hover,
.sidebar-nav a.is-active { background: #1d5c4d; color: #fff; text-decoration: none; }
.badge {
  background: #e6a817;
  color: #1c2b27;
  border-radius: 999px;
  font-size: 12px;
  min-width: 20px;
  text-align: center;
  padding: 1px 6px;
}
.sidebar-foot {
  margin-top: auto;
  padding: 16px;
  display: grid;
  gap: 8px;
  border-top: 1px solid #2a5a4d;
}
.app-main { flex: 1; padding: 24px; min-width: 0; }
.shift-create-page .app-main { padding: 16px 18px 28px; }

.leave-block { margin-bottom: 20px; }
.leave-layout {
  display: grid;
  grid-template-columns: minmax(240px, 320px) minmax(0, 1fr);
  gap: 14px 18px;
  align-items: start;
  margin-top: 10px;
}
.form-card.leave-card {
  max-width: none;
  margin: 0;
  padding: 14px;
}
.leave-status {
  background: #e8f6f1;
  border: 1px solid #b7e0d4;
  padding: 8px 10px;
  border-radius: 8px;
  margin: 0 0 10px;
}
.leave-status.is-error {
  background: #fdecea;
  border-color: #f5c2c0;
}
.leave-side {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  overflow: auto;
}
.leave-side .leave-summary { margin: 0; }
.leave-side .leave-summary th:last-child,
.leave-side .leave-summary td:last-child {
  white-space: normal;
}
.leave-emp-link {
  color: inherit;
  text-decoration: none;
  font-weight: 700;
}
.leave-emp-link:hover { color: var(--green); text-decoration: underline; }
.leave-summary tr.is-editing { background: #e8f6f1; }
.leave-editor-title { margin: 0 0 8px; font-size: 18px; }

.create-form { margin-bottom: 16px; }
.create-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 20px 28px;
  background: #e8f6f1;
  border: 2px solid var(--green);
  border-radius: 16px;
  padding: 22px 24px;
  margin-bottom: 12px;
}
.ym-fields {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.ym-label { font-weight: 800; font-size: 22px; }
.ym-fields select {
  width: auto;
  min-width: 170px;
  height: 60px;
  font-size: 22px;
  font-weight: 700;
  padding: 12px 16px;
  border: 2px solid var(--green);
  border-radius: 12px;
  background: #fff;
}
.create-bar .form-actions { gap: 12px; }
.create-bar .create-btn {
  font-size: 22px;
  font-weight: 800;
  padding: 16px 36px;
  min-height: 60px;
  border-radius: 12px;
}
.create-bar .btn-icon.large {
  width: 60px;
  height: 60px;
}
.avail-details {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 16px 12px;
}
.avail-details summary {
  cursor: pointer;
  font-weight: 700;
  padding: 6px 0;
}

.month-wrap {
  margin-top: 12px;
  width: 100%;
  border-radius: 10px;
}
.shift-table.full {
  table-layout: auto;
  width: max-content;
  min-width: 100%;
}
.shift-table.full th,
.shift-table.full td {
  min-width: 122px;
  font-size: 15px;
  padding: 8px 6px;
  text-align: center;
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
}
.shift-table.full .emp,
.shift-table.full thead th.sticky {
  min-width: 148px;
  max-width: 168px;
  text-align: left;
  font-size: 15px;
  padding: 10px 12px;
}
.shift-table.full .shift-select {
  min-width: 108px;
  min-height: 44px;
  font-size: 14px;
  padding: 8px 4px;
  border-radius: 8px;
}
.shift-table.full .rest-chip {
  font-size: 15px;
  padding: 10px 8px;
}
.shift-table.full th.col-sat,
.shift-table.full td.col-sat { background: #e7f1fb; }
.shift-table.full th.col-sun,
.shift-table.full td.col-sun { background: #fdecea; }
.shift-table.full th.col-holiday,
.shift-table.full td.col-holiday { background: #fce8d5; }
.shift-table.full th.col-closed,
.shift-table.full td.col-closed { background: #ececec; color: var(--muted); }
.shift-table.full thead th.col-sat { background: #d5e6f8; color: var(--sat); }
.shift-table.full thead th.col-sun { background: #f8d7d3; color: var(--sun); }
.shift-table.full thead th.col-holiday { background: #f8dcc4; color: #9a4b12; }
.shift-table.full thead th.col-closed { background: #e4e4e4; }
.shift-table.full tbody .emp { background: var(--card); }

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: var(--sidebar);
}
.login-card {
  background: #fff;
  padding: 28px;
  border-radius: 16px;
  width: min(400px, 92vw);
  display: grid;
  gap: 12px;
}
.login-card h1 { margin: 0; color: var(--green-dark); }
.login-card p { margin: 0 0 8px; color: var(--muted); }
.back-link { text-align: center; color: var(--muted); }
.portal-wrap { text-align: center; color: #fff; }
.portal-wrap h1 { margin: 0 0 8px; }
.portal-wrap > p { margin: 0 0 20px; opacity: 0.85; }
.portal-grid { display: grid; gap: 12px; width: min(840px, 92vw); grid-template-columns: 1fr 1fr; }
.portal-grid.store-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.portal-card {
  background: #fff;
  color: var(--text);
  border-radius: 16px;
  padding: 24px 16px;
  text-decoration: none;
  display: grid;
  gap: 8px;
  border-top: 4px solid var(--green);
}
.portal-card.is-daiso,
.portal-card.is-nagasakiya { border-top-color: #2457d6; }
.portal-card:hover { text-decoration: none; box-shadow: 0 8px 24px rgba(0,0,0,0.18); }
.portal-card strong { font-size: 18px; color: var(--green-dark); }
.portal-card span { color: var(--muted); font-size: 13px; }
.portal-logout { margin-top: 20px; }

.dash-body {
  min-height: 100vh;
  margin: 0;
  background: #f3f6f5;
  color: var(--text);
  padding: 32px 24px 48px;
}
.dash-top {
  max-width: 980px;
  margin: 0 auto 28px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}
.dash-kicker {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--green-dark);
  text-transform: uppercase;
}
.dash-top h1 { margin: 0 0 6px; font-size: 28px; }
.dash-lead { margin: 0; color: var(--muted); }
.dash-grid {
  max-width: 980px;
  margin: 0 auto;
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.dash-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 22px 20px 24px;
  text-decoration: none;
  color: inherit;
  display: grid;
  gap: 8px;
  box-shadow: 0 1px 2px rgba(18, 53, 44, 0.06);
  border-top: 4px solid var(--green);
  min-height: 168px;
}
.dash-card:hover {
  text-decoration: none;
  box-shadow: 0 10px 28px rgba(18, 53, 44, 0.12);
  transform: translateY(-1px);
}
.dash-card.is-daiso,
.dash-card.is-nagasakiya { border-top-color: #2457d6; }
.dash-card.is-ramen { border-top-color: var(--green); }
.dash-badge {
  display: inline-block;
  width: fit-content;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  background: #e8f6f1;
  color: var(--green-dark);
}
.dash-card.is-daiso .dash-badge,
.dash-card.is-nagasakiya .dash-badge {
  background: #e7eefb;
  color: #2457d6;
}
.dash-card strong { font-size: 18px; line-height: 1.4; }
.dash-card span { color: var(--muted); font-size: 13px; line-height: 1.6; }
.dash-placeholder {
  max-width: 980px;
  margin: 0 auto;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 28px 24px;
  color: var(--muted);
}
@media (max-width: 860px) {
  .dash-grid { grid-template-columns: 1fr; }
  .portal-grid.store-grid { grid-template-columns: 1fr; }
}
.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 20px;
}
.page-head h1 { margin: 0 0 4px; font-size: 24px; }
.section-title { margin: 28px 0 12px; font-size: 18px; }
.muted { color: var(--muted); margin: 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

.btn {
  display: inline-block;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  font-size: 14px;
  background: none;
  font-family: inherit;
}
.btn:hover { text-decoration: none; }
.btn.primary { background: var(--green); color: #fff; }
.btn.ghost { background: #fff; border-color: var(--line); color: var(--text); }
.btn.danger { background: #b42318; color: #fff; }
.btn.small { padding: 4px 10px; font-size: 13px; }
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 0;
  padding: 0;
  color: #fff;
  text-decoration: none;
  cursor: pointer;
  font: inherit;
  background: none;
}
.btn-icon svg { width: 12px; height: 12px; display: block; }
.btn-icon:hover { text-decoration: none; opacity: 0.85; }
.btn-icon.approve { background: var(--green); }
.btn-icon.reject { background: #b42318; }
.btn-icon.large { width: 36px; height: 36px; border-radius: 8px; }
.btn-icon.large svg { width: 16px; height: 16px; }
.btn-icon:disabled { opacity: 0.35; cursor: not-allowed; }
.form-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.list-table .col-actions {
  width: 1%;
  white-space: nowrap;
  text-align: right;
}
.row-actions {
  display: inline-flex;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 12px;
  align-items: center;
  white-space: nowrap;
}
.row-actions a,
.action-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 12px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 12px;
  line-height: 1.3;
  text-decoration: none;
  color: var(--text);
}
.row-actions a:hover,
.action-link:hover {
  background: var(--header-bg);
  text-decoration: none;
}
.row-actions a.danger,
.action-link.danger {
  color: #b42318;
  border-color: #f0c4c0;
}
.row-actions a.danger:hover,
.action-link.danger:hover {
  background: #fdecea;
}

.messages { list-style: none; padding: 0; }
.messages li {
  background: #e8f6f1;
  border: 1px solid #b7e0d4;
  padding: 10px 12px;
  border-radius: 8px;
  margin-bottom: 12px;
}
.messages li.error { background: #fdecea; border-color: #f5c2c0; }

.table-wrap { overflow-x: auto; background: var(--card); border-radius: 12px; border: 1px solid var(--line); }
.month-wrap { margin-top: 16px; }
.shift-table, .list-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
}
.shift-table th, .shift-table td,
.list-table th, .list-table td {
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
  vertical-align: middle;
  text-align: left;
}
.list-table thead th,
.shift-table thead th {
  background: var(--header-bg);
  font-weight: 600;
  color: var(--text);
}
.list-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.list-table .col-narrow {
  width: 6.5em;
  white-space: nowrap;
}
.list-table .col-reason {
  width: 42%;
}
.shift-table.compact th, .shift-table.compact td {
  min-width: 96px;
  font-size: 12px;
  padding: 4px;
  text-align: center;
}
.shift-select {
  width: 100%;
  min-width: 88px;
  border: 0;
  border-radius: 6px;
  padding: 5px 2px;
  font: inherit;
  font-size: 11px;
  color: #fff;
  background: var(--green);
  cursor: pointer;
}
.shift-select.is-rest,
.shift-select option[value="rest"] {
  background: #8a9692;
}
.shift-select option {
  color: #1c2b27;
  background: #fff;
}
.shift-select:disabled { opacity: 0.65; }
.shift-table th.sticky, .shift-table .emp {
  position: sticky;
  left: 0;
  min-width: 120px;
  z-index: 1;
  text-align: left;
}
.shift-table thead th.sticky { background: var(--header-bg); }
.shift-table tbody .emp { background: var(--card); }
.emp span { display: block; }
.emp small { color: var(--muted); }
.closed { background: #eee; color: var(--muted); }
.sat { color: var(--sat); }
.sun { color: var(--sun); }

.shift-chip, .rest-chip {
  display: block;
  color: #fff;
  background: var(--green);
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 12px;
  text-align: center;
}
.rest-chip { background: #8a9692; }

.form-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px;
  max-width: 520px;
  display: grid;
  gap: 12px;
  margin-bottom: 20px;
}
.form-card.wide { max-width: 860px; }
.form-card label { display: grid; gap: 6px; font-weight: 600; }
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}
.input, select, textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
}
.errorlist { color: #b42318; margin: 0; padding-left: 16px; font-weight: 400; }
.danger { color: #b42318; }
.empty { background: var(--card); padding: 20px; border-radius: 12px; }

.rule-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.info-card, .warn-box {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
}
.info-card h2, .warn-box h3 { margin: 0 0 8px; font-size: 16px; }
.info-card ul, .warn-box ul { margin: 0; padding-left: 18px; }
.warn-box { border-color: #e6a817; background: #fff8e8; margin-bottom: 16px; }
.dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 6px;
}
.weekday-checks ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  padding: 0;
  margin: 0;
  font-weight: 400;
}
.weekday-checks li { display: flex; align-items: center; }
.check-cell { text-align: center; vertical-align: middle; }
.avail-table th, .avail-table td { min-width: 40px; text-align: center; }
.avail-table th:nth-child(1),
.avail-table th:nth-child(2),
.avail-table td:nth-child(1),
.avail-table td:nth-child(2) {
  text-align: left;
}

.leave-date-field {
  display: grid;
  gap: 8px;
  font-weight: 600;
}
.leave-calendar {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: #fff;
  font-weight: 400;
}
.leave-cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.leave-cal-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}
.leave-cal-icon {
  width: 20px;
  height: 20px;
  color: var(--green);
}
.leave-cal-weekdays,
.leave-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  text-align: center;
}
.leave-cal-weekdays {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}
.leave-cal-weekdays .is-sun { color: var(--sun); }
.leave-cal-weekdays .is-sat { color: var(--sat); }
.leave-cal-day {
  border: 0;
  background: transparent;
  border-radius: 8px;
  height: 40px;
  font: inherit;
  cursor: pointer;
}
.leave-cal-day:hover:not(:disabled) { background: #e8f5f0; }
.leave-cal-day.is-sun { color: var(--sun); }
.leave-cal-day.is-sat { color: var(--sat); }
.leave-cal-day.is-selected {
  background: var(--green);
  color: #fff;
  font-weight: 700;
}
.leave-cal-day.is-selected.is-sun,
.leave-cal-day.is-selected.is-sat { color: #fff; }
.leave-cal-day:disabled {
  opacity: 0.35;
  cursor: default;
}
.leave-cal-empty { height: 40px; }
.leave-cal-hint { margin: 8px 0 0; font-size: 13px; }
.leave-cal-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
  min-height: 28px;
  align-items: center;
}
.leave-chip {
  background: #e8f5f0;
  color: var(--green-dark);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 13px;
  font-weight: 600;
}
.leave-calendar.is-compact {
  padding: 8px;
}
.leave-calendar.is-compact .leave-cal-head { margin-bottom: 6px; }
.leave-calendar.is-compact .leave-cal-title { font-size: 14px; }
.leave-calendar.is-compact .leave-cal-weekdays { font-size: 11px; }
.leave-calendar.is-compact .leave-cal-day,
.leave-calendar.is-compact .leave-cal-empty { height: 30px; font-size: 13px; }
.leave-calendar.is-compact .leave-cal-hint { font-size: 12px; margin-top: 6px; }
.leave-calendar.is-compact .leave-cal-chips { margin-top: 6px; min-height: 22px; }
.leave-calendar.is-compact .leave-chip { font-size: 12px; padding: 2px 8px; }
@media (max-width: 900px) {
  .leave-layout { grid-template-columns: 1fr; }
}

.day-toggle {
  display: block;
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
  padding: 0;
  line-height: 1.25;
}
.day-toggle:hover { text-decoration: underline; }
.day-closed-mark {
  display: block;
  font-size: 10px;
  font-weight: 700;
}
.day-toggle.is-override { font-weight: 800; }
.print-label { display: none; }
.print-month { display: none; }

@media print {
  @page { size: A4 landscape; margin: 4mm; }
  html, body {
    background: #fff !important;
    height: auto !important;
    width: 100% !important;
    overflow: visible !important;
  }
  .app-body {
    display: block;
    width: 100% !important;
    overflow: visible !important;
  }
  .sidebar, .messages, .create-form, .leave-block, .warn-box,
  .no-print, .page-head .muted, .avail-details { display: none !important; }
  .app-main { padding: 0; width: 100% !important; overflow: visible !important; }
  .page-head, .section-title { display: none !important; }
  .shift-select { display: none !important; }
  .screen-month { display: none !important; }
  .month-wrap { overflow: visible; border: none; }
  .day-toggle { cursor: default; }

  /* 半月ずつA4横1枚。行の高さは人数で割って、用紙の下まで表を広げる */
  .print-month { display: block; width: 100%; }
  .print-page {
    break-inside: avoid;
    break-after: page;
    page-break-after: always;
  }
  .print-page:last-child { break-after: auto; page-break-after: auto; }
  .print-range {
    margin: 0 0 2mm;
    font-size: 16pt;
    line-height: 1.2;
    font-weight: 800;
    color: #000;
  }
  .print-month .shift-table.full tbody tr {
    height: calc(168mm / var(--print-rows, 6));
  }
  .print-month .shift-table.full {
    table-layout: fixed;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    margin: 0;
    border-collapse: collapse;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .print-month .shift-table.full th,
  .print-month .shift-table.full td {
    min-width: 0 !important;
    max-width: none;
    width: auto;
    padding: 1mm 0.5mm;
    border: 0.4mm solid #444;
    font-size: 12pt;
    line-height: 1.2;
    color: #000;
    text-align: center;
    vertical-align: middle;
    overflow: hidden;
    white-space: normal;
  }
  .print-month .shift-table.full thead th {
    font-size: 11pt;
    font-weight: 800;
    height: 12mm;
  }
  .print-month .shift-table.full .emp,
  .print-month .shift-table.full thead th.sticky {
    position: static;
    min-width: 0 !important;
    max-width: none;
    width: 30mm;
    padding: 1mm 1.5mm;
    font-size: 13pt;
    font-weight: 800;
    text-align: left;
  }
  .print-month .shift-table.full .emp small { display: none; }
  .print-month .day-closed-mark { font-size: 10pt; }
  .print-month .day-toggle {
    border: none;
    background: none;
    padding: 0;
    cursor: default;
    box-shadow: none;
  }
  .print-month .print-label,
  .print-label.is-visible {
    display: block;
    font-size: 13pt;
    font-weight: 800;
    line-height: 1.15;
    white-space: nowrap;
  }
  .print-month .print-time span { display: block; }
  .print-month .print-label.is-rest,
  .print-month .rest-chip {
    background: none;
    padding: 0;
    font-size: 12pt;
    font-weight: 700;
    color: #666;
  }

  .print-month .help-print {
    display: grid;
    gap: 0.5mm;
    font-size: 8pt;
    font-weight: 700;
    line-height: 1.15;
  }
  .print-month .help-print-away {
    background: #c2410c !important;
    color: #fff !important;
    border-radius: 1mm;
    padding: 0.3mm 0;
  }
  .print-month .help-print-warn { color: #9a3412; font-size: 7pt; }

  /* ヘルプの札は時間より小さく。色だけで目立たせる */
  .print-month .help-stamp,
  .print-month .help-chip {
    gap: 0.5mm;
    padding: 0;
    border-width: 0.3mm;
    border-radius: 1mm;
    font-size: 8pt;
    line-height: 1.15;
  }
  .print-month .help-stamp-away,
  .print-month .help-stamp-home,
  .print-month .help-stamp-back {
    padding: 0.5mm;
    border-radius: 1mm;
    font-size: 8pt;
    font-weight: 700;
    line-height: 1.15;
  }
  .print-month .help-stamp-warn { font-size: 7pt; }
  .print-month .help-badge {
    padding: 0 1mm;
    font-size: 7pt;
  }
  .print-month .help-chip strong { font-size: 10pt; }
  .print-month .help-stamp-away,
  .print-month .help-badge {
    background: #c2410c !important;
    color: #fff !important;
  }
}
.cover-intro { margin-bottom: 8px; }
.cover-stories {
  display: grid;
  gap: 12px;
  margin-bottom: 24px;
}
.cover-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 18px;
  border-left: 6px solid var(--green);
}
.cover-when {
  margin: 0 0 8px;
  font-weight: 700;
  color: var(--green-dark);
}
.cover-then { margin: 0; line-height: 1.6; }
.cover-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.cover-card-head .cover-when { margin: 0; }
.cover-advanced {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 16px;
  margin: 12px 0 16px;
}
.cover-advanced summary {
  cursor: pointer;
  font-weight: 700;
  margin-bottom: 8px;
}
.confirm-dialog {
  position: fixed;
  inset: 0;
  background: rgba(18, 32, 28, 0.45);
  display: grid;
  place-items: center;
  z-index: 40;
}
.confirm-dialog[hidden] { display: none; }
.confirm-card {
  background: #fff;
  border-radius: 16px;
  padding: 24px;
  width: min(420px, calc(100% - 32px));
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.2);
}
.confirm-card p {
  margin: 0 0 16px;
  font-size: 16px;
  font-weight: 700;
}
.help-card { width: min(480px, calc(100% - 32px)); }
.help-card h3 { margin: 0 0 8px; font-size: 18px; }
.help-field { display: grid; gap: 6px; margin: 0 0 12px; font-size: 14px; font-weight: 700; }
.help-field select { font: inherit; font-weight: 600; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); }
.help-times { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: end; }
.help-tilde { padding-bottom: 18px; font-weight: 700; }
.help-call, .help-edit {
  width: 100%;
  margin-top: 4px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
}
.help-call {
  min-height: 64px;
  padding: 8px 4px;
  font-size: 12px;
  line-height: 1.35;
  white-space: normal;
  color: #9a3412;
  background: #fff7ed;
  border: 1px solid #fdba74;
}
td.needs-help .help-call {
  color: #fff;
  background: #c2410c;
  border-color: #9a3412;
}
.help-edit {
  padding: 4px 6px;
  font-size: 12px;
  color: #9a3412;
  background: #fff;
  border: 1px solid #fdba74;
}
.help-chip, .help-stamp {
  display: grid;
  gap: 3px;
  justify-items: center;
}
.help-chip {
  background: #fff7ed;
  border: 2px solid #c2410c;
  border-radius: 8px;
  padding: 6px 4px;
  color: #9a3412;
  line-height: 1.3;
}
.help-badge, .help-stamp-away {
  background: #c2410c;
  color: #fff;
  font-weight: 800;
}
.help-badge {
  display: inline-block;
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 11px;
}
.help-stamp-away, .help-stamp-home, .help-stamp-back {
  display: block;
  width: 100%;
  border-radius: 8px;
  padding: 5px 4px;
  line-height: 1.3;
  font-size: 12px;
  font-weight: 800;
}
.help-stamp-home, .help-stamp-back {
  background: #ecfdf5;
  color: #065f46;
}
.help-stamp-warn {
  color: #9a3412;
  font-size: 11px;
  font-weight: 700;
}
td.has-help { background: #fff7ed; }

/* ===== スマホ（幅 768px 以下）=====
   出先での確認・ちょっとした修正向け。シフト作成はパソコンを推奨。 */
@media screen and (max-width: 768px) {
  /* 左のメニューを、上の帯（横スクロールのタブ）にする */
  .app-body { flex-direction: column; }
  .sidebar {
    width: auto;
    position: sticky;
    top: 0;
    z-index: 30;
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
  }
  .sidebar-brand { padding: 10px 14px 4px; font-size: 15px; }
  .sidebar-brand br { display: none; }
  .sidebar-brand small { margin-left: 6px; }
  .sidebar-foot {
    grid-row: 1;
    grid-column: 2;
    margin: 0;
    padding: 8px 12px 4px;
    border-top: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
  }
  .sidebar-foot span { opacity: 0.75; max-width: 8em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .sidebar-nav {
    grid-column: 1 / -1;
    flex-direction: row;
    overflow-x: auto;
    padding: 4px 8px 8px;
    gap: 6px;
    scrollbar-width: none;
  }
  .sidebar-nav::-webkit-scrollbar { display: none; }
  .sidebar-nav a {
    flex: 0 0 auto;
    white-space: nowrap;
    padding: 8px 12px;
    font-size: 14px;
    border: 1px solid #2a5a4d;
  }

  .app-main,
  .shift-create-page .app-main { padding: 14px 12px 28px; }
  .messages { padding-left: 0; }

  .page-head { flex-direction: column; align-items: stretch; gap: 10px; margin-bottom: 14px; }
  .page-head h1 { font-size: 20px; }
  .page-head .btn { align-self: flex-start; }
  .section-title { margin: 20px 0 10px; font-size: 16px; }

  /* 入力欄は 16px 以上にして、iPhone で勝手に拡大されないようにする */
  .input, select, textarea, input[type="text"], input[type="password"], input[type="number"], input[type="time"] {
    font-size: 16px;
  }
  .btn { padding: 10px 14px; }
  .form-card { padding: 14px; max-width: none; }
  .form-grid { grid-template-columns: 1fr; }
  .form-card input[type="checkbox"] { width: 22px; height: 22px; justify-self: start; }

  /* シフト作成の上の帯 */
  .create-bar { padding: 14px; gap: 12px; border-radius: 12px; }
  .ym-fields { gap: 8px; flex-wrap: nowrap; width: 100%; }
  .ym-fields .ym-label { display: none; }
  .ym-fields select { flex: 1; min-width: 0; font-size: 18px; height: 48px; padding: 8px 12px; }
  .form-actions { width: 100%; }
  .form-actions .create-btn { flex: 1; }

  /* 月のシフト表：左の名前は固定したまま、横にスクロールして見る */
  .month-wrap { -webkit-overflow-scrolling: touch; }
  .shift-table.full th,
  .shift-table.full td { min-width: 92px; font-size: 13px; padding: 6px 4px; }
  .shift-table.full .emp,
  .shift-table.full thead th.sticky {
    min-width: 84px;
    max-width: 96px;
    font-size: 13px;
    padding: 6px 8px;
    box-shadow: 2px 0 0 var(--line);
  }
  .shift-table.full .emp small { font-size: 11px; }
  .shift-table.full .shift-select { width: 96px; min-width: 96px; max-width: 96px; min-height: 40px; font-size: 13px; text-overflow: ellipsis; }
  .shift-table.full .rest-chip { font-size: 13px; padding: 8px 4px; }

  /* 一覧表：文字を折り返さず、表だけ横にスクロールする */
  .list-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 12px;
  }
  .list-table th, .list-table td { padding: 8px 10px; font-size: 14px; white-space: nowrap; }
  .row-actions { gap: 14px; }

  /* 希望休のカレンダー */
  .leave-calendar.is-compact .leave-cal-day,
  .leave-calendar.is-compact .leave-cal-empty { height: 38px; font-size: 14px; }

  /* 店舗を選ぶ画面・ログイン画面 */
  .dash-top { flex-direction: column; align-items: stretch; gap: 12px; }

  .confirm-card { padding: 18px; }
}
