.sr-body { background: #f4f6f8; }
.period-banner {
  background: #e8f0f9;
  border: 1px solid #cfdcef;
  color: #1f4e78;
  border-radius: 6px;
  padding: 10px 14px;
  margin-top: 10px;
  font-size: 13px;
}
.period-banner strong { font-weight: 700; }

.calendar-wrap {
  background: #fff;
  border-radius: 10px;
  padding: 12px;
  margin: 0 14px 20px;
  border: 1px solid #e3e6ea;
}
.calendar-head {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-bottom: 4px;
}
.calendar-head-cell {
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: #555;
  padding: 4px 0;
}
.calendar-head-cell.sun { color: #c00; }
.calendar-head-cell.sat { color: #1f4e78; }

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.cal-cell {
  background: #fbf7ec;
  border: 1px solid #ecdfb8;
  border-radius: 6px;
  padding: 6px 4px;
  min-height: 64px;
  cursor: pointer;
  position: relative;
  transition: background 0.1s;
  overflow: hidden;
  min-width: 0;
}
.cal-cell:hover { background: #f6edd2; }
.cal-cell.cal-blank { background: transparent; border: none; cursor: default; }
.cal-cell.cal-blank:hover { background: transparent; }
.cal-cell.sun .cal-day-num { color: #c00; }
.cal-cell.sat .cal-day-num { color: #1f4e78; }
.cal-cell.today { border: 2px solid #1f4f5b; }
.cal-cell.has-any { background: #d6ecdd; border-color: #b8dbc4; }
.cal-cell.has-ok  { background: #e8f0f9; border-color: #c2d6ea; }
.cal-cell.has-ng  { background: #fde2e0; border-color: #f0c2bf; }
.cal-cell.out-of-period { background: #f5f5f5; border-color: #e0e0e0; }
.cal-cell.out-of-period .cal-day-num { color: #aaa; font-weight: 500; }
.cal-cell.out-of-period.has-any { background: #d6ecdd; border-color: #b8dbc4; }
.cal-cell.out-of-period.has-any .cal-day-num { color: #333; font-weight: 700; }
.cal-cell.out-of-period.has-ok { background: #e8f0f9; border-color: #c2d6ea; }
.cal-cell.out-of-period.has-ok .cal-day-num { color: #333; font-weight: 700; }
.cal-cell.out-of-period.has-ng { background: #fde2e0; border-color: #f0c2bf; }
.cal-cell.out-of-period.has-ng .cal-day-num { color: #333; font-weight: 700; }
.cal-day-num {
  font-size: 13px;
  font-weight: 700;
  color: #333;
  line-height: 1;
  margin-bottom: 4px;
}
.cal-badge {
  display: inline-block;
  font-size: 10px;
  padding: 2px 5px;
  border-radius: 8px;
  font-weight: 600;
  max-width: 100%;
  line-height: 1.25;
  word-break: break-all;
}
.cal-badge.any { background: #1e7a3a; color: #fff; }
.cal-badge.ok  { background: #1f4e78; color: #fff; font-family: ui-monospace, Consolas, monospace; }
.cal-badge.ng  { background: #b3261e; color: #fff; }

.cal-legend {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 12px;
  font-size: 11px;
  color: #666;
  justify-content: center;
}
.cal-legend-item { display: inline-flex; align-items: center; gap: 4px; }

/* TimeTree-style mobile: edge-to-edge calendar, bigger cells, no extra container chrome */
@media (max-width: 720px) {
  .calendar-wrap {
    margin: 0 4px 16px;
    padding: 6px 4px 10px;
    border-radius: 8px;
    border: none;
  }
  .calendar-head { gap: 2px; }
  .calendar-grid { gap: 2px; }
  .cal-cell {
    min-height: 68px;
    padding: 4px 2px;
    border-radius: 4px;
  }
  .cal-day-num { font-size: 12px; margin-bottom: 3px; }
  .cal-badge {
    font-size: 9px;
    padding: 1px 3px;
    border-radius: 6px;
    display: block;
    text-align: center;
  }
}
@media (max-width: 380px) {
  .calendar-wrap { margin: 0 2px 14px; padding: 4px 2px 8px; }
  .cal-cell { min-height: 60px; padding: 3px 1px; }
  .cal-badge { font-size: 8px; padding: 1px 2px; }
}
.deadline-bar {
  background: #c2410c;
  color: #fff;
  margin: 0 20px 14px;
  padding: 12px 18px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 14px;
  border-left: 6px solid #7c2d12;
  box-shadow: 0 2px 8px rgba(194, 65, 12, 0.25);
}
.deadline-bar.hidden { display: none; }
.deadline-bar.urgent {
  background: #b91c1c;
  border-left-color: #450a0a;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.18), 0 2px 10px rgba(185, 28, 28, 0.35);
  animation: fxPulse 1.4s ease-in-out infinite;
}
.deadline-bar.warning { background: #d97706; border-left-color: #78350f; }
.deadline-bar.passed { background: #555; border-left-color: #1f2937; box-shadow: none; }
.deadline-bar.unset { background: #6c757d; border-left-color: #1f2937; box-shadow: none; }
@keyframes fxPulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.18), 0 2px 10px rgba(185, 28, 28, 0.35); }
  50%      { box-shadow: 0 0 0 6px rgba(220, 38, 38, 0.10), 0 2px 14px rgba(185, 28, 28, 0.55); }
}
.db-label { font-weight: 600; }
.db-countdown {
  font-family: ui-monospace, Consolas, monospace;
  font-weight: 700;
  font-size: 16px;
  flex: 1;
}
.db-admin {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}
.db-admin label { font-size: 12px; opacity: 0.9; }
.db-admin input[type=datetime-local] {
  padding: 5px 8px;
  border-radius: 4px;
  border: none;
  font-family: inherit;
}
.sr-intro {
  background: #fff;
  margin: 0 20px 14px;
  padding: 12px 18px;
  border-radius: 8px;
  border: 1px solid #e3e6ea;
  font-size: 13px;
  color: #555;
}
#sr-content {
  padding: 0 20px 20px;
}
@media (max-width: 720px) {
  .sr-intro {
    margin: 0 8px 10px;
    padding: 10px 12px;
    font-size: 12.5px;
  }
  .period-banner {
    padding: 8px 10px;
    font-size: 12px;
  }
  .deadline-bar {
    margin: 0 8px 10px;
    padding: 10px 12px;
    font-size: 13px;
  }
  #sr-content {
    padding: 0 4px 16px;
  }
  .memo-section {
    margin: 0 8px 24px;
    padding: 12px 14px;
  }
  .view-tabs { margin: 12px 8px 6px; }
  .sub-picker { margin: 8px 8px 10px; }
}
/* Admin month view: per-week tables (same look as main admin shift table) */
.sr-week-block { margin-bottom: 18px; }
.sr-week-block-header {
  font-size: 12px;
  color: #555;
  background: #f4f6f8;
  padding: 6px 10px;
  border: 1px solid #e3e6ea;
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  font-weight: 600;
}
.sr-week-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  background: #fff;
  margin-bottom: 0;
}
.sr-week-table th, .sr-week-table td {
  border: 1px solid #d8dbe0;
  padding: 4px 4px;
  text-align: center;
  font-size: 12px;
  vertical-align: middle;
}
.sr-week-table th { background: #f0f3f6; font-weight: 600; }
.sr-week-table th.dow-mon, .sr-week-table th.dow-wed,
.sr-week-table th.dow-fri, .sr-week-table th.dow-sun { background: #fff200; }
.sr-week-table th.dow-sat { background: #cfe2f3; }
.sr-week-table th.date-cell { font-weight: 700; }
.sr-week-table th.date-sat { color: #1f4e78; }
.sr-week-table th.date-sun { color: #c00; }
.sr-week-table th.other-month { color: #aaa; font-weight: 400; }
.sr-week-table .col-no { width: 36px; }
.sr-week-table .col-name { width: 90px; }
.sr-week-table .name-cell { text-align: left; padding-left: 8px; font-weight: 500; }
.sr-week-table .sr-cell {
  cursor: pointer; min-height: 40px; height: 40px;
}
.sr-week-table .sr-cell:hover { background: #f5f8fa; }
.sr-week-table .sr-cell .sr-content { font-weight: 600; }
.sr-week-table .sr-cell.type-any { background: #d6ecdd; }
.sr-week-table .sr-cell.type-any .sr-content { color: #1e7a3a; }
.sr-week-table .sr-cell.type-ok { background: #e8f0f9; }
.sr-week-table .sr-cell.type-ok .sr-content { color: #1f4e78; font-size: 11px; }
.sr-week-table .sr-cell.type-ng { background: #fde2e0; }
.sr-week-table .sr-cell.type-ng .sr-content { color: #b3261e; }
.sr-week-table .sr-cell.no-day { background: #f7f7f7; cursor: default; }
.sr-week-table .sr-cell.no-day:hover { background: #f7f7f7; }
.sr-week-table .sr-cell.out-of-period { background: #fafafa; }
.sr-week-table .sr-cell.out-of-period.type-any { background: #d6ecdd; }
.sr-week-table .sr-cell.out-of-period.type-ok { background: #e8f0f9; }
.sr-week-table .sr-cell.out-of-period.type-ng { background: #fde2e0; }

@media (max-width: 720px) {
  .sr-week-table th, .sr-week-table td { font-size: 10.5px; padding: 3px 2px; }
  .sr-week-table .col-no { width: 22px; }
  .sr-week-table .col-name { width: 54px; }
  .sr-week-table .name-cell { padding-left: 4px; font-size: 11px; }
  .sr-week-table .sr-cell { min-height: 44px; height: auto; }
  .sr-week-table .sr-cell.type-ok .sr-content { font-size: 9.5px; line-height: 1.2; }
  .sr-week-block-header { font-size: 11px; padding: 5px 8px; }
}

.sr-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 14px;
  background: #fff;
}
.sr-table th, .sr-table td {
  border: 1px solid #d8dbe0;
  padding: 4px 4px;
  text-align: center;
  font-size: 12px;
  vertical-align: middle;
}
.sr-table th {
  background: #f0f3f6;
  font-weight: 600;
}
.sr-table th.dow-mon, .sr-table th.dow-wed, .sr-table th.dow-fri, .sr-table th.dow-sun {
  background: #fff200;
}
.sr-table th.dow-sat { background: #cfe2f3; }
.sr-table .date-sun { color: #c00; }
.sr-table .date-sat { color: #1f4e78; }
.sr-table .name-cell { text-align: left; padding-left: 8px; font-weight: 500; }
.sr-cell {
  cursor: pointer;
  min-height: 38px;
  height: 38px;
}
.sr-cell:hover { background: #f5f8fa; }
.sr-cell .sr-content {
  font-weight: 600;
}
.sr-cell.type-any { background: #d6ecdd; }
.sr-cell.type-any .sr-content { color: #1e7a3a; }
.sr-cell.type-ok { background: #e8f0f9; }
.sr-cell.type-ok .sr-content { color: #1f4e78; font-size: 11px; }
.sr-cell.type-ng { background: #fde2e0; }
.sr-cell.type-ng .sr-content { color: #b3261e; }
.sr-cell.no-day { background: #f7f7f7; cursor: default; }
.sr-cell.no-day:hover { background: #f7f7f7; }
.apply-btn {
  display: block;
  margin-top: 2px;
  font-size: 10px;
  padding: 2px 4px;
  border: 1px solid #1f4f5b;
  background: #1f4f5b;
  color: #fff;
  border-radius: 3px;
  cursor: pointer;
  font-family: inherit;
}
.apply-btn:hover { background: #163942; }
.apply-btn.ghost {
  background: #fff;
  color: #1f4f5b;
  border: 1px solid #1f4f5b;
}
.apply-btn.ghost:hover { background: #f0f5f6; }

.sr-type-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
  margin-bottom: 12px;
}
.type-btn {
  padding: 10px;
  justify-content: center;
  border: 1px solid #cfd4da;
  background: #fff;
  cursor: pointer;
  font-family: inherit;
}
.type-btn.active[data-type=any] { background: #1e7a3a; color: #fff; border-color: #1e7a3a; }
.type-btn.active[data-type=ok] { background: #1f4e78; color: #fff; border-color: #1f4e78; }
.type-btn.active[data-type=ng] { background: #b3261e; color: #fff; border-color: #b3261e; }

.memo-section {
  background: #fff;
  margin: 0 20px 30px;
  padding: 14px 18px;
  border-radius: 8px;
  border: 1px solid #e3e6ea;
}
.memo-section textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #cfd4da;
  border-radius: 6px;
  font-family: inherit;
  font-size: 13px;
  margin-bottom: 8px;
  resize: vertical;
}

.section-h {
  font-size: 14px; font-weight: 600;
  margin: 16px 0 8px;
}
.template-chips {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  background: #f4f6f8; border-radius: 6px; padding: 8px 10px;
  margin-bottom: 12px;
}
.template-chips .tpl-label { font-size: 12px; color: #666; margin-right: 4px; }
.template-chips .tpl-chip {
  border: 1px solid #4a86b3; background: #fff; color: #1f4e78;
  border-radius: 14px; padding: 4px 10px; font-size: 12px; cursor: pointer;
  font-family: inherit;
}
.template-chips .tpl-chip:hover { background: #e8f0f9; }
.template-chips .tpl-chip-del {
  border: none; background: transparent; color: #888;
  cursor: pointer; font-size: 14px; padding: 0 4px;
  font-family: inherit;
}
.template-chips .tpl-chip-del:hover { color: #b3261e; }

/* Period admin editor */
.period-admin {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 10px 0 8px;
  padding: 10px 12px;
  background: #fbf7ec;
  border: 1px solid #ecdfb8;
  border-radius: 6px;
  font-size: 13px;
}
.period-admin .pa-label { font-weight: 600; color: #5b4a16; }
.period-admin .pa-month { color: #555; font-size: 12px; }
.period-admin .pa-num {
  width: 56px;
  padding: 4px 6px;
  border: 1px solid #cfd4da;
  border-radius: 4px;
  font-size: 14px;
  text-align: center;
  font-family: inherit;
}
.period-admin .pa-dash { color: #888; }
.period-admin .pa-status { font-size: 11px; margin-left: 6px; }
.period-admin .pa-status.default { color: #999; }
.period-admin .pa-status.configured { color: #1e7a3a; font-weight: 600; }
@media (max-width: 720px) {
  .period-admin { gap: 6px; padding: 8px 10px; font-size: 12px; }
  .period-admin .pa-num { width: 48px; }
}

/* Stats */
.sr-stats {
  display: flex;
  gap: 12px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.stat-chip {
  background: #fff;
  border: 1px solid #cfd4da;
  border-radius: 14px;
  padding: 4px 12px;
  font-size: 12px;
  color: #555;
}
.stat-chip strong { color: #1f4f5b; margin: 0 4px; }
.stat-chip.ng strong { color: #b3261e; }
.stat-chip.missing strong { color: #a05c00; }

/* View tabs */
.view-tabs {
  display: flex;
  gap: 8px;
  margin: 14px 20px 6px;
  border-bottom: 1px solid #e3e6ea;
}
.view-tab {
  background: none;
  border: none;
  padding: 9px 18px;
  font-size: 14px;
  color: #666;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  font-family: inherit;
}
.view-tab.active {
  color: #1f4f5b;
  border-bottom-color: #1f4f5b;
  font-weight: 600;
}

/* Sub-pickers (week/day) */
.sub-picker {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 8px 20px 10px;
}
.picker-label {
  font-size: 14px; font-weight: 600;
  min-width: 200px; text-align: center;
}
.picker-input {
  padding: 6px 10px;
  border: 1px solid #cfd4da;
  border-radius: 6px;
  font-family: inherit;
}

/* Day view */
.day-view {
  background: #fff;
  margin: 0 20px 20px;
  padding: 18px 22px;
  border-radius: 8px;
  border: 1px solid #e3e6ea;
}
.day-view-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  flex-wrap: wrap;
  gap: 8px;
}
.day-view-title {
  font-size: 16px;
  font-weight: 600;
}
.day-view-actions {
  display: flex; gap: 8px;
}
.day-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.day-table th, .day-table td {
  border: 1px solid #d8dbe0;
  padding: 8px 12px;
  text-align: left;
}
.day-table th {
  background: #f0f3f6;
  font-weight: 600;
  text-align: center;
}
.day-table td.center { text-align: center; }
.req-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
}
.req-badge.ok { background: #d6e4f4; color: #1f4e78; }
.req-badge.any { background: #d6ecdd; color: #1e7a3a; }
.req-badge.ng { background: #fde2e0; color: #b3261e; }
.req-time {
  font-family: ui-monospace, Consolas, monospace;
  font-weight: 600;
}
.shift-state {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
}
.shift-state.has {
  background: #fff8e0; color: #a05c00;
}
.shift-state.none {
  background: #f0f3f6; color: #666;
}
.apply-btn-sm {
  background: #1f4f5b;
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 5px 10px;
  cursor: pointer;
  font-size: 12px;
  font-family: inherit;
}
.apply-btn-sm:hover { background: #163942; }
.apply-btn-sm:disabled {
  background: #ccc; cursor: not-allowed;
}
.apply-btn-sm.ghost {
  background: #fff;
  border: 1px solid #1f4f5b;
  color: #1f4f5b;
}
.apply-btn-sm.ghost:hover { background: #f0f5f6; }
.bulk-actions {
  margin-top: 12px;
  text-align: right;
}

/* Week view */
.week-view {
  background: #fff;
  margin: 0 20px 20px;
  padding: 18px 22px;
  border-radius: 8px;
  border: 1px solid #e3e6ea;
}
.week-table-2 {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  table-layout: fixed;
}
.week-table-2 th, .week-table-2 td {
  border: 1px solid #d8dbe0;
  padding: 6px 4px;
  text-align: center;
  vertical-align: top;
}
.week-table-2 th {
  background: #f0f3f6;
  font-weight: 600;
}
.week-table-2 th.dow-mon, .week-table-2 th.dow-wed,
.week-table-2 th.dow-fri, .week-table-2 th.dow-sun { background: #fff200; }
.week-table-2 th.dow-sat { background: #cfe2f3; }
.week-table-2 .name-cell { text-align: left; padding: 6px 8px; font-weight: 500; width: 90px; }
.week-table-2 .no-day { background: #f7f7f7; }
.week-table-2 .req-cell {
  cursor: default;
  min-height: 60px;
  padding: 4px 2px;
}
.week-cell-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
  font-size: 11px;
}
.week-cell-content .req-text {
  font-weight: 600;
}
.week-cell-content .shift-tag {
  background: #fff8e0; color: #a05c00;
  padding: 1px 5px; border-radius: 8px;
  font-size: 10px;
}
.week-cell-content .apply-mini {
  background: #1f4f5b;
  color: #fff;
  border: none;
  border-radius: 3px;
  padding: 2px 6px;
  cursor: pointer;
  font-size: 10px;
  font-family: inherit;
}
.week-cell-content .apply-mini:hover { background: #163942; }
.week-cell-content .apply-mini.ghost {
  background: #fff;
  border: 1px solid #1f4f5b;
  color: #1f4f5b;
}
.empty-day {
  text-align: center;
  padding: 28px 0;
  color: #888;
  font-size: 13px;
}
