:root {
  --ink: #1d2928;
  --muted: #667573;
  --line: #dbe3e1;
  --surface: #ffffff;
  --canvas: #f4f7f6;
  --primary: #176b66;
  --primary-dark: #0f514d;
  --primary-soft: #dcefeb;
  --amber: #bd6f32;
  --amber-soft: #f8e8d9;
  --red: #b94747;
  --red-soft: #fbe2e2;
  --blue: #3e6e9e;
  --blue-soft: #e3edf7;
  --sidebar-width: 248px;
  --radius: 6px;
}

* { box-sizing: border-box; }
html { background: var(--canvas); }
body {
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  font-family: "Segoe UI", "Yu Gothic UI", "Meiryo", sans-serif;
  font-size: 14px;
  letter-spacing: 0;
}

svg { width: 18px; height: 18px; flex: 0 0 auto; }
a { color: var(--primary); }
.min-w-0 { min-width: 0; }
.btn {
  border-radius: var(--radius);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-weight: 600;
  white-space: nowrap;
}
.btn-primary {
  --bs-btn-bg: var(--primary);
  --bs-btn-border-color: var(--primary);
  --bs-btn-hover-bg: var(--primary-dark);
  --bs-btn-hover-border-color: var(--primary-dark);
}
.form-control, .form-select {
  border-color: #cbd6d4;
  border-radius: var(--radius);
  min-height: 38px;
}
.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(23, 107, 102, .12);
}

.sidebar {
  width: var(--sidebar-width) !important;
  background: #153b3a;
  color: #fff;
  position: fixed;
  inset: 0 auto 0 0;
  display: flex;
  flex-direction: column;
  z-index: 1045;
}
.sidebar-brand {
  min-height: 84px;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,.12);
}
.sidebar-brand strong, .sidebar-brand small { display: block; }
.sidebar-brand strong { font-size: 17px; }
.sidebar-brand small { color: rgba(255,255,255,.62); margin-top: 2px; font-size: 11px; }
.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 6px;
  display: inline-grid;
  place-items: center;
  color: #153b3a;
  background: #f2c96d;
}
.brand-mark.large { width: 58px; height: 58px; }
.brand-mark.large svg { width: 30px; height: 30px; }
.sidebar-nav { padding: 14px 10px; flex: 1; }
.sidebar-nav a {
  color: rgba(255,255,255,.72);
  text-decoration: none;
  padding: 11px 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 2px 0;
  border-radius: 5px;
  font-weight: 600;
}
.sidebar-nav a:hover { color: #fff; background: rgba(255,255,255,.08); }
.sidebar-nav a.active {
  color: #fff;
  background: rgba(255,255,255,.14);
  box-shadow: inset 3px 0 #f2c96d;
}
.sidebar-user {
  border-top: 1px solid rgba(255,255,255,.12);
  padding: 14px;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) 34px;
  align-items: center;
  gap: 9px;
}
.sidebar-user strong, .sidebar-user small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user small { color: rgba(255,255,255,.62); font-size: 11px; }
.user-avatar {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
  background: #e8f2ef; color: var(--primary-dark); font-weight: 700;
}
.icon-button {
  border: 0; background: transparent; width: 36px; height: 36px; display: inline-grid; place-items: center;
  border-radius: 5px; color: inherit;
}
.icon-button:hover { background: rgba(255,255,255,.1); }
.icon-button.light { color: rgba(255,255,255,.72); }
.icon-button.bordered { border: 1px solid var(--line); color: var(--ink); }
.icon-button.bordered:hover { background: var(--canvas); }

.app-main {
  min-height: 100vh;
  margin-left: var(--sidebar-width);
  padding: 30px 34px 56px;
}
.mobile-header { height: 58px; background: #153b3a; color: #fff; padding: 8px 12px; align-items: center; gap: 10px; }
.mobile-header strong, .mobile-header small { display: block; }
.mobile-header small { color: rgba(255,255,255,.65); font-size: 10px; }

.page-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  margin-bottom: 24px;
}
.page-heading h1 { font-size: 27px; margin: 0; font-weight: 700; }
.page-heading h1 span { color: var(--muted); font-size: 17px; }
.eyebrow { color: var(--primary); text-transform: uppercase; font-size: 12px; font-weight: 700; margin: 0 0 4px; }
.month-switch { display: flex; align-items: center; gap: 8px; }
.month-switch label { color: var(--muted); font-size: 12px; font-weight: 700; white-space: nowrap; }
.month-switch input { width: 150px; }
.heading-actions { display: flex; align-items: center; gap: 9px; }
.back-link { display: inline-flex; gap: 5px; align-items: center; font-weight: 600; text-decoration: none; margin-bottom: 5px; }

.status-strip {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--primary);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin-bottom: 24px;
}
.status-strip > div { padding: 18px 20px; border-right: 1px solid var(--line); }
.status-strip > div:last-child { border-right: 0; }
.status-strip span, .status-strip strong { display: block; }
.status-strip span { color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.status-strip strong { font-size: 25px; }
.status-strip strong small { display: inline; color: var(--muted); font-size: 13px; margin-left: 4px; }
.status-text { font-size: 17px !important; padding-top: 7px; }
.status-text.open { color: var(--primary); }
.status-text.closed { color: var(--red); }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(280px, .85fr); gap: 24px; }
.content-section {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 24px;
  padding: 22px;
}
.section-heading {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 16px;
  margin-bottom: 18px;
}
.section-heading h2 { font-size: 17px; margin: 0 0 3px; font-weight: 700; }
.section-heading p { color: var(--muted); margin: 0; font-size: 12px; }
.count-label { color: var(--muted); font-weight: 700; white-space: nowrap; }
.empty-state { color: var(--muted); min-height: 190px; display: grid; place-items: center; align-content: center; gap: 8px; text-align: center; }
.empty-state svg { width: 32px; height: 32px; color: #9aaba8; }
.empty-state p { margin: 0; }
.empty-state.large { min-height: 330px; }
.concentration-list > div { display: grid; grid-template-columns: 115px minmax(80px, 1fr) 45px; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid #edf1f0; }
.concentration-list > div:last-child { border-bottom: 0; }
.concentration-bar { height: 8px; background: #edf1f0; border-radius: 2px; overflow: hidden; }
.concentration-bar span { display: block; height: 100%; background: var(--amber); }
.action-list > a { display: grid; grid-template-columns: 42px minmax(0,1fr) 20px; align-items: center; gap: 12px; padding: 13px 0; border-top: 1px solid #edf1f0; text-decoration: none; color: var(--ink); }
.action-list > a strong, .action-list > a small { display: block; }
.action-list > a small { color: var(--muted); margin-top: 2px; }
.action-icon { width: 38px; height: 38px; border-radius: 6px; display: inline-grid; place-items: center; }
.action-icon.teal { color: var(--primary); background: var(--primary-soft); }
.action-icon.amber { color: var(--amber); background: var(--amber-soft); }

.filter-band, .generate-band, .shift-toolbar {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  margin-bottom: 18px; padding: 15px 18px;
}
.filter-band form { display: flex; align-items: center; gap: 10px; }
.filter-band label { font-weight: 700; white-space: nowrap; }
.filter-band select { max-width: 340px; }
.generate-band { display: flex; justify-content: space-between; align-items: center; gap: 20px; border-left: 4px solid var(--amber); }
.generate-band > div { display: flex; align-items: center; gap: 12px; }
.generate-band h2 { font-size: 16px; margin: 0 0 2px; }
.generate-band p { color: var(--muted); margin: 0; font-size: 12px; }
.generate-band form { display: flex; gap: 8px; }
.generate-band select { width: 220px; }
.shift-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.shift-toolbar p { margin: 0; display: flex; align-items: center; gap: 7px; color: var(--muted); }
.shift-toolbar form { display: flex; gap: 8px; }

.data-table { margin: 0; }
.data-table thead th { background: #f5f8f7; color: #53625f; font-size: 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.data-table td, .data-table th { padding: 11px 12px; vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.inactive-row { opacity: .55; }
.check-row { display: flex; flex-wrap: wrap; gap: 18px; }
.check-row label { display: flex; align-items: center; gap: 6px; }

.status-badge, .request-badge {
  display: inline-flex; align-items: center; min-height: 26px; padding: 3px 9px;
  border-radius: 999px; font-size: 11px; font-weight: 700; white-space: nowrap;
  background: #edf1f0; color: #53625f;
}
.status-badge.success, .status-draft { background: var(--primary-soft); color: var(--primary-dark); }
.status-badge.muted { background: #edf1f0; color: var(--muted); }
.status-candidate { background: var(--amber-soft); color: #8c4d1d; }
.status-confirmed { background: var(--blue-soft); color: #315f8b; }
.status-published { background: #dff1e4; color: #347147; }
.type-off_hard, .type-paid_leave_hard { background: var(--red-soft); color: #913737; }
.type-day_soft { background: var(--primary-soft); color: var(--primary-dark); }
.type-late_soft { background: var(--amber-soft); color: #8c4d1d; }
.type-night_soft { background: var(--blue-soft); color: #315f8b; }

.request-calendar {
  display: grid;
  grid-template-columns: repeat(7, minmax(118px, 1fr));
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
  min-width: 826px;
  overflow: auto;
}
.weekday-label { background: #f2f6f5; color: var(--muted); text-align: center; padding: 7px; font-size: 11px; font-weight: 700; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.request-day { min-height: 145px; padding: 8px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: #fff; }
.request-day.blank { background: #f7f9f8; }
.request-day.saturday { background: #f7fbff; }
.request-day.sunday { background: #fff8f8; }
.day-number { display: flex; justify-content: space-between; align-items: center; margin-bottom: 9px; }
.day-number span { font-weight: 700; font-size: 15px; }
.day-number small { color: var(--muted); }
.request-select, .request-note { margin-top: 6px; min-width: 0; width: 100%; }
.request-day[data-request-type="OFF_HARD"], .request-day[data-request-type="PAID_LEAVE_HARD"] { box-shadow: inset 0 3px var(--red); }
.request-day[data-request-type="DAY_SOFT"] { box-shadow: inset 0 3px var(--primary); }
.request-day[data-request-type="LATE_SOFT"] { box-shadow: inset 0 3px var(--amber); }
.request-day[data-request-type="NIGHT_SOFT"] { box-shadow: inset 0 3px var(--blue); }
.request-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
  padding: 0 0 14px;
  color: var(--muted);
  font-size: 12px;
}
.request-legend > span { display: inline-flex; align-items: center; gap: 6px; }
.request-symbol {
  width: 30px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  border-radius: 4px;
  font-weight: 700;
  font-size: 13px;
}
.request-off_hard { background: var(--red-soft); color: #913737; }
.request-paid_leave_hard { background: #eee6f8; color: #684b89; }
.request-day_soft { background: var(--primary-soft); color: var(--primary-dark); }
.request-late_soft { background: var(--amber-soft); color: #8c4d1d; }
.request-night_soft { background: var(--blue-soft); color: #315f8b; }
.request-grid-wrap { max-height: calc(100vh - 210px); }
.request-grid td .request-symbol { margin: auto; }
.empty-grid-cell { color: var(--muted); text-align: center; padding: 40px !important; }
.sticky-actions { position: sticky; bottom: 12px; display: flex; justify-content: flex-end; padding-top: 14px; z-index: 5; pointer-events: none; }
.sticky-actions .btn { pointer-events: auto; box-shadow: 0 6px 18px rgba(29,41,40,.18); }

.shift-grid-wrap { overflow: auto; background: #fff; border: 1px solid var(--line); max-height: calc(100vh - 245px); }
.shift-grid { border-collapse: separate; border-spacing: 0; table-layout: fixed; min-width: max-content; font-size: 12px; }
.shift-grid th, .shift-grid td { width: 46px; min-width: 46px; height: 42px; text-align: center; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 0; }
.shift-grid thead th { position: sticky; top: 0; z-index: 3; background: #f1f5f4; }
.shift-grid thead th span, .shift-grid thead th small { display: block; }
.shift-grid thead th small { color: var(--muted); font-size: 9px; }
.shift-grid .staff-column { width: 130px; min-width: 130px; position: sticky; left: 0; z-index: 2; background: #fff; text-align: left; padding: 5px 9px; }
.shift-grid thead .staff-column { z-index: 4; background: #f1f5f4; }
.shift-grid .staff-column strong, .shift-grid .staff-column small { display: block; white-space: nowrap; }
.shift-grid .staff-column strong { line-height: 16px; }
.shift-grid .staff-column small { color: var(--muted); font-size: 9px; line-height: 12px; }
.shift-grid .sat { background-color: #f4f9fd; }
.shift-grid .sun { background-color: #fff5f5; }
.shift-grid thead th.holiday { background-color: #ffe9a8; color: #7c5416; }
.shift-grid td.requested-cell { background-color: #fff0a6; }
.shift-grid td.manual { box-shadow: inset 0 0 0 2px #e1a46f; }
.shift-select { width: 38px; height: 30px; border: 0; border-radius: 4px; appearance: none; text-align: center; font-weight: 700; cursor: pointer; }
.shift-value { width: 30px; height: 30px; display: inline-grid; place-items: center; border-radius: 4px; font-weight: 700; }
.shift-off { background: #eef1f0; color: #697572; }
.shift-day { background: var(--primary-soft); color: var(--primary-dark); }
.shift-late { background: var(--amber-soft); color: #8c4d1d; }
.shift-night { background: var(--blue-soft); color: #315f8b; }
.shift-dou { background: #eee6f8; color: #684b89; }
.shift-daylate { background: #f7e3ef; color: #8a416d; }
.shift-select.shift-off[data-off-label]:not([data-off-label=""]) {
  background-color: #fff1f1; color: #c62828; -webkit-text-fill-color: #c62828;
}
.shift-value.off-replacement { background-color: #fff1f1; color: #c62828; }
.shift-grid tfoot th, .shift-grid tfoot td { height: 34px; background-color: #f8faf9; }
.shift-grid tfoot .staff-column { background-color: #f8faf9; }
.shift-grid tfoot tr:first-child th, .shift-grid tfoot tr:first-child td { border-top: 2px solid #9eaaa7; }
.shift-grid tfoot .sun { background-color: #fff5f5; }
.shift-summary-row .staff-column strong { font-size: 10px; }
.shift-count-summary { font-size: 10px; font-weight: 700; white-space: nowrap; color: #3f4d4a; }
.shift-grid tbody .clinical-shift-summary th,
.shift-grid tbody .clinical-shift-summary td { background-color: #eef5f3; }
.shift-grid tbody .clinical-shift-summary.sun,
.shift-grid tbody .clinical-shift-summary .sun { background-color: #fff5f5; }
.shift-grid tbody .clinical-summary-first th,
.shift-grid tbody .clinical-summary-first td { border-top: 2px solid #82938f; }
.shift-grid .month-count-column { width: 62px; min-width: 62px; background-color: #f4f7f6; }
.shift-grid .month-count-first { border-left: 2px solid #9eaaa7; }
.shift-grid thead .month-count-column { padding: 4px; font-size: 10px; line-height: 13px; white-space: normal; }
.month-count-value { font-size: 11px; font-weight: 700; color: #33423f; white-space: nowrap; }

.settings-layout { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 24px; }
.form-actions { display: flex; justify-content: flex-end; margin-top: 18px; }

.login-page { background: #e7ecea; min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.login-shell {
  width: min(1040px, 100%); min-height: 600px; display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(380px, 1fr);
  background: #fff; border: 1px solid #cfd8d5; border-radius: 8px; overflow: hidden; box-shadow: 0 24px 64px rgba(25,45,42,.2);
}
.login-brand { position: relative; min-width: 0; overflow: hidden; color: #fff; background: #0b3238; }
.login-brand::after { content: ""; position: absolute; inset: 0; background: rgba(5,32,38,.24); z-index: 1; pointer-events: none; }
.login-brand-photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center; }
.login-brand-logo {
  position: absolute; z-index: 2; top: 34px; left: 34px; width: min(390px, calc(100% - 68px));
  padding: 13px 18px; background: #fff; border-radius: 6px; box-shadow: 0 10px 30px rgba(0,0,0,.16);
}
.login-brand-logo img { display: block; width: 100%; height: auto; }
.login-brand-copy { position: absolute; z-index: 2; left: 40px; right: 40px; bottom: 38px; text-shadow: 0 2px 12px rgba(0,0,0,.65); }
.login-brand-copy p { margin: 0 0 5px; font-size: 15px; font-weight: 700; }
.login-brand-copy h1 { margin: 0; font-size: 38px; color: #fff; }
.login-form { display: grid; place-items: center; padding: 44px; }
.login-form-inner { width: min(330px, 100%); }
.login-form h2 { font-size: 25px; margin-bottom: 30px; }

@media (max-width: 1199px) {
  .dashboard-grid, .settings-layout { grid-template-columns: 1fr; }
}
@media (max-width: 991.98px) {
  .sidebar { color: var(--ink); background: #fff; }
  .sidebar-brand { display: none; }
  .sidebar-nav a { color: var(--ink); }
  .sidebar-nav a:hover { color: var(--ink); background: var(--canvas); }
  .sidebar-nav a.active { color: var(--primary-dark); background: var(--primary-soft); box-shadow: inset 3px 0 var(--primary); }
  .sidebar-user { border-color: var(--line); }
  .sidebar-user small { color: var(--muted); }
  .icon-button.light { color: var(--muted); }
  .app-main { margin-left: 0; padding: 22px 18px 50px; }
  .mobile-header { display: flex !important; }
  .status-strip { grid-template-columns: repeat(2, 1fr); }
  .status-strip > div:nth-child(2) { border-right: 0; }
  .status-strip > div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
}
@media (max-width: 767px) {
  .page-heading { align-items: stretch; flex-direction: column; }
  .page-heading h1 { font-size: 23px; }
  .month-switch { width: 100%; }
  .month-switch input { flex: 1; width: auto; }
  .month-switch label { display: none; }
  .status-strip { grid-template-columns: 1fr 1fr; }
  .status-strip > div { padding: 14px; }
  .status-strip strong { font-size: 21px; }
  .content-section { padding: 15px; }
  .generate-band, .shift-toolbar { align-items: stretch; flex-direction: column; }
  .generate-band form, .shift-toolbar form { width: 100%; }
  .generate-band select, .shift-toolbar select { flex: 1; width: auto; }
  .filter-band form { align-items: stretch; flex-direction: column; }
  .filter-band select { max-width: none; }
  .login-page { padding: 0; }
  .login-shell { min-height: 100vh; grid-template-columns: 1fr; border-radius: 0; }
  .login-brand { min-height: 250px; }
  .login-brand-logo { top: 22px; left: 22px; width: min(310px, calc(100% - 44px)); padding: 10px 14px; }
  .login-brand-copy { left: 24px; right: 24px; bottom: 22px; }
  .login-brand-copy p { font-size: 13px; }
  .login-brand-copy h1 { font-size: 30px; }
  .login-form { padding: 36px 24px; }
}
