:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-2: #eef3f8;
  --ink: #172033;
  --muted: #69758a;
  --line: #dce3ee;
  --primary: #155e75;
  --primary-2: #0f766e;
  --accent: #f59e0b;
  --danger: #b42318;
  --success: #15803d;
  --shadow: 0 18px 50px rgba(23, 32, 51, 0.12);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family:
    Inter, "Hiragino Sans", "Yu Gothic UI", "Yu Gothic", Meiryo, system-ui,
    sans-serif;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: start center;
  background: var(--bg);
  padding: 12vh 24px 24px;
}

.auth-card {
  width: min(520px, 100%);
}

button,
input,
select {
  font: inherit;
}

select[multiple] {
  min-height: 150px;
  padding: 4px;
}

select[multiple] option {
  border-radius: 5px;
  padding: 6px 8px;
}

.checkbox-filter {
  display: grid;
  gap: 4px;
  max-height: 190px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 6px;
}

.checkbox-option {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  gap: 7px;
  min-height: 30px;
  border-radius: 5px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  padding: 4px 6px;
}

.checkbox-option:hover {
  background: var(--surface-2);
}

.checkbox-option input {
  width: 16px;
  min-height: 16px;
  height: 16px;
  padding: 0;
}

.checkbox-option span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

button,
.file-button {
  min-height: 44px;
  border: 0;
  border-radius: var(--radius);
  background: var(--primary);
  color: #fff;
  padding: 0 14px;
  font-weight: 700;
  cursor: pointer;
  transition:
    transform 160ms ease,
    background 160ms ease,
    box-shadow 160ms ease;
}

button:hover,
.file-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(21, 94, 117, 0.16);
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(245, 158, 11, 0.45);
  outline-offset: 2px;
}

input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  padding: 9px 10px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.app-shell {
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  padding: 16px;
  border-right: 1px solid var(--line);
  background: #fbfcfe;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: var(--radius);
  background: var(--ink);
  color: #fff;
  font-weight: 800;
}

.brand strong,
.brand span {
  display: block;
}

.brand span {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.nav-tabs,
.filter-panel,
.data-panel {
  display: grid;
  gap: 10px;
}

.nav-tabs {
  grid-template-columns: 1fr 1fr;
  margin-bottom: 22px;
}

.nav-tab {
  background: var(--surface-2);
  color: var(--ink);
  box-shadow: none;
}

.nav-tab.active {
  background: var(--primary);
  color: #fff;
}

.filter-panel,
.data-panel {
  padding-top: 18px;
  border-top: 1px solid var(--line);
  margin-top: 18px;
}

.ghost-button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  box-shadow: none;
}

.danger-button {
  background: #fff2f0;
  color: var(--danger);
  border: 1px solid #ffd6d1;
}

.file-button {
  display: grid;
  place-items: center;
  background: var(--primary-2);
}

.file-button input {
  display: none;
}

.main {
  min-width: 0;
  padding: 16px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(26px, 3vw, 36px);
  line-height: 1.15;
}

h2 {
  font-size: 19px;
}

.topbar-actions,
.calendar-head,
.table-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.quick-days {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}

.login-status {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 8px 10px;
  margin-bottom: 8px;
}

.login-status > div {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 340px;
}

.content-filter-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 118px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 6px;
}

.content-filter-tabs button {
  min-height: 28px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  padding: 0 9px;
  box-shadow: none;
  font-size: 12px;
}

.content-filter-tabs button.active {
  border-color: rgba(21, 94, 117, 0.35);
  background: #e9f7f6;
  color: var(--primary-dark);
}

.login-status strong {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  background: #dcfce7;
  color: #14532d;
  padding: 0 10px;
  font-size: 12px;
}

.read-only-mode .login-status strong {
  background: #fff4df;
  color: #7c2d12;
}

.login-status span,
.login-status em,
.login-status li strong {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 700;
}

#currentUserLabel {
  color: var(--ink);
  font-weight: 900;
}

.login-status ol {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
  min-width: 0;
}

.login-status li {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 26px;
  border-radius: 999px;
  background: var(--surface-2);
  padding: 0 9px 0 5px;
  font-size: 12px;
  font-weight: 800;
}

.login-status li strong {
  color: var(--ink);
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.login-status li span {
  display: grid;
  width: 18px;
  height: 18px;
  place-items: center;
  border-radius: 999px;
  background: #fff;
  color: var(--primary);
  font-size: 11px;
}

.view-mode-button {
  min-height: 30px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  padding: 0 10px;
  font-size: 12px;
  box-shadow: none;
}

.view-mode-button[aria-pressed="true"] {
  border-color: #fed7aa;
  background: #fff7ed;
  color: #7c2d12;
}

.lock-warning {
  border: 1px solid #fed7aa;
  border-radius: var(--radius);
  background: #fff7ed;
  color: #7c2d12;
  padding: 9px 10px;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 800;
}

.quick-days article {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 10px;
  min-width: 0;
}

.quick-day-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.quick-day-head h2 {
  font-size: 16px;
}

.quick-day-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.quick-event-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.quick-event {
  display: grid;
  min-height: 36px;
  gap: 1px;
  border: 1px solid #d8ebe9;
  background: #effafa;
  color: #083b3a;
  padding: 5px 7px;
  text-align: left;
  box-shadow: none;
}

.quick-event strong,
.quick-event span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quick-event strong {
  font-size: 12px;
}

.quick-event span,
.quick-empty {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.quick-empty {
  grid-column: 1 / -1;
  min-height: 36px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: #fbfcfe;
}

.metric,
.summary-grid article,
.master-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 12px;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.metric strong {
  display: block;
  margin-top: 4px;
  font-size: 22px;
  line-height: 1.2;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.calendar-head {
  justify-content: center;
  margin: 6px 0 14px;
}

.icon-button {
  width: 44px;
  padding: 0;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  font-size: 24px;
  line-height: 1;
}

.weekday-row,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.weekday-row {
  margin-bottom: 8px;
}

.weekday-row span {
  color: var(--muted);
  text-align: center;
  font-size: 12px;
  font-weight: 800;
}

.day-cell {
  min-height: 148px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 10px;
  overflow: hidden;
}

.day-cell.is-muted {
  opacity: 0.42;
}

.day-cell.is-today {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 2px rgba(245, 158, 11, 0.22);
}

.day-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.day-number {
  font-weight: 800;
  min-height: 28px;
  border: 0;
  background: transparent;
  color: var(--ink);
  padding: 0 4px;
  box-shadow: none;
}

.add-day-button {
  width: 28px;
  min-height: 28px;
  padding: 0;
  border-radius: 7px;
  background: var(--surface-2);
  color: var(--ink);
  box-shadow: none;
}

.day-popup {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  background: rgba(15, 23, 42, 0.28);
  padding: 18px;
}

.day-popup[hidden] {
  display: none;
}

.day-popup-card {
  width: min(680px, 100%);
  max-height: min(720px, 86vh);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 16px;
  box-shadow: var(--shadow);
}

.day-popup-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.day-popup-list {
  display: grid;
  gap: 8px;
  overflow: auto;
}

.day-popup-item {
  display: grid;
  gap: 3px;
  min-height: 48px;
  border: 1px solid rgba(23, 32, 51, 0.1);
  border-radius: var(--radius);
  background: var(--row-content-color, #fff);
  color: var(--ink);
  padding: 8px 10px;
  text-align: left;
  box-shadow: none;
}

.day-popup-item strong,
.day-popup-item span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.day-popup-item span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.event-chip {
  display: grid;
  gap: 2px;
  width: 100%;
  margin-top: 6px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: #e9f7f6;
  color: #083b3a;
  padding: 7px;
  text-align: left;
  min-height: auto;
}

.event-chip[data-type="屋台"] {
  background: #fff4df;
  color: #5f3708;
}

.event-chip strong,
.event-chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.event-chip strong {
  font-size: 12px;
}

.event-chip span {
  font-size: 11px;
  font-weight: 600;
  opacity: 0.86;
}

.table-toolbar {
  justify-content: space-between;
  margin-bottom: 10px;
}

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

table {
  width: 100%;
  min-width: 1120px;
  border-collapse: collapse;
  table-layout: fixed;
}

th,
td {
  border-bottom: 1px solid var(--line);
  height: 30px;
  padding: 4px 6px;
  text-align: left;
  vertical-align: middle;
  font-size: 12px;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

th {
  position: sticky;
  top: 0;
  background: #f8fafc;
  color: var(--muted);
  font-size: 11px;
  z-index: 1;
}

tbody tr:hover {
  background: #f6fafb;
}

.schedule-table tbody tr {
  background: var(--row-content-color, #fff);
}

.schedule-table tbody tr td {
  background: var(--row-content-color, #fff);
}

.schedule-table th:first-child,
.schedule-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--row-content-color, #fff);
}

.schedule-table th:first-child {
  z-index: 3;
  background: #f8fafc;
}

.schedule-table .date-col {
  width: 48px;
  min-width: 48px;
  font-weight: 800;
}

.schedule-table .weekday-col {
  width: 36px;
  min-width: 36px;
  color: var(--muted);
  font-weight: 800;
}

.schedule-table th:nth-child(3),
.schedule-table td:nth-child(3) {
  width: 76px;
}

.schedule-table th:nth-child(4),
.schedule-table td:nth-child(4) {
  width: 64px;
}

.schedule-table th:nth-child(5),
.schedule-table td:nth-child(5) {
  width: 84px;
}

.schedule-table th:nth-child(6),
.schedule-table td:nth-child(6) {
  width: 78px;
}

.schedule-table th:nth-child(7),
.schedule-table td:nth-child(7) {
  width: 150px;
}

.schedule-table th:nth-child(8),
.schedule-table td:nth-child(8) {
  width: 82px;
}

.schedule-table th:nth-child(9),
.schedule-table td:nth-child(9) {
  width: 92px;
}

.schedule-table th:nth-child(10),
.schedule-table td:nth-child(10),
.schedule-table th:nth-child(12),
.schedule-table td:nth-child(12) {
  width: 72px;
}

.schedule-table th:nth-child(11),
.schedule-table td:nth-child(11) {
  width: 112px;
}

.schedule-table th:nth-child(13),
.schedule-table td:nth-child(13) {
  width: 56px;
}

.schedule-table tr.day-start td {
  border-top: 3px solid #cbd8e7;
}

.schedule-table tr.day-start td:first-child {
  color: var(--primary);
}

.type-badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  border-radius: 999px;
  background: #e9f7f6;
  color: #083b3a;
  padding: 0 7px;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.type-badge[data-type="屋台"] {
  background: #fff4df;
  color: #5f3708;
}

.type-cell,
.content-cell {
  transition: background 120ms ease;
}

.type-cell .cell-select,
.content-cell .cell-input {
  background: transparent;
  font-weight: 800;
}

.auto-gray-cell {
  background: #e5e7eb;
}

.auto-gray-cell .cell-input {
  background: transparent;
}

.cell-input {
  width: 100%;
  min-height: 24px;
  height: 24px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: var(--ink);
  padding: 2px 4px;
  font-size: 12px;
  line-height: 1.2;
}

.cell-input:hover {
  border-color: #cbd8e7;
  background: #fff;
}

.cell-input:focus {
  border-color: var(--primary);
  background: #fff;
  outline: 2px solid rgba(21, 94, 117, 0.16);
  outline-offset: 0;
}

button:disabled,
input:disabled,
select:disabled {
  cursor: not-allowed;
}

.cell-input:disabled {
  opacity: 1;
  color: var(--ink);
  -webkit-text-fill-color: var(--ink);
  background: transparent;
  border-color: transparent;
}

.date-input {
  padding-right: 0;
}

.number-input {
  text-align: right;
}

.cell-select {
  appearance: auto;
  font-weight: 700;
}

.row-actions {
  display: flex;
  gap: 8px;
}

.small-button {
  min-height: 24px;
  padding: 0 8px;
  font-size: 12px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.summary-grid-single {
  grid-template-columns: 1fr;
}

.master-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.master-tab {
  min-height: 36px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  box-shadow: none;
}

.master-tab.active {
  border-color: rgba(21, 94, 117, 0.35);
  background: #e9f7f6;
  color: var(--primary-dark);
}

.master-panels {
  display: grid;
}

.master-panel[hidden] {
  display: none;
}

.placeholder-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 16px;
}

.placeholder-panel h2 {
  margin: 0 0 6px;
}

.placeholder-panel p {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
}

.summary-toolbar,
.production-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 12px;
  margin-bottom: 12px;
}

.production-toolbar {
  justify-content: space-between;
}

.production-toolbar h2 {
  margin: 0;
}

.production-table-wrap {
  max-height: calc(100vh - 190px);
}

.production-table {
  min-width: 1040px;
}

.production-table th,
.production-table td {
  border-right: 1px solid var(--line);
}

.production-table th:last-child,
.production-table td:last-child {
  border-right: 0;
}

.production-table th:nth-child(1),
.production-table td:nth-child(1) {
  width: 96px;
}

.production-table th:nth-child(2),
.production-table td:nth-child(2),
.production-table th:nth-child(3),
.production-table td:nth-child(3),
.production-table th:nth-child(4),
.production-table td:nth-child(4),
.production-table th:nth-child(5),
.production-table td:nth-child(5),
.production-table th:nth-child(7),
.production-table td:nth-child(7) {
  width: 110px;
}

.production-table th:nth-child(6),
.production-table td:nth-child(6) {
  width: 360px;
}

.production-table th:nth-child(8),
.production-table td:nth-child(8),
.production-table th:nth-child(9),
.production-table td:nth-child(9) {
  width: 90px;
}

.payroll-toolbar {
  display: grid;
  grid-template-columns: 180px 120px minmax(220px, 1fr) repeat(4, minmax(150px, auto));
  gap: 12px;
  align-items: end;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 12px;
  margin-bottom: 12px;
}

.mypage-toolbar {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 12px;
  margin-bottom: 12px;
}

.password-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 10px 12px;
  margin-bottom: 12px;
}

.password-panel summary {
  cursor: pointer;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.password-change-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  gap: 8px;
  margin-top: 10px;
}

.mypage-login {
  max-width: 520px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 18px;
}

.mypage-shell {
  min-height: 100vh;
  background: var(--bg);
  padding: 28px;
}

.mypage-shell .mypage-login {
  margin: 8vh auto 0;
}

.mypage-shell .mypage-shift-only {
  max-width: 1180px;
  margin: 0 auto;
}

.mypage-login-form {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.remember-login {
  display: flex;
  gap: 8px;
  align-items: center;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.remember-login input {
  width: 16px;
  height: 16px;
}

.form-message {
  min-height: 20px;
  color: var(--danger);
  font-size: 13px;
  font-weight: 800;
}

.mypage-period {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.mypage-period strong {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  color: var(--ink);
  font-size: 16px;
}

.mypage-count {
  border-radius: 999px;
  background: #e9f7f6;
  color: var(--primary-dark);
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 900;
}

.mypage-metrics {
  margin-bottom: 12px;
}

.shift-page-table {
  min-width: 980px;
  table-layout: fixed;
}

.shift-page-table tbody tr,
.shift-page-table tbody td {
  background: var(--row-content-color, #fff);
}

.account-master-form {
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr) 110px 110px;
  gap: 12px;
  margin-top: 16px;
  margin-bottom: 14px;
}

.account-master-form select,
.account-master-form button {
  min-height: 36px;
}

.account-master-form button {
  grid-column: 1 / -1;
}

.permission-checks {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8fafc;
  padding: 10px;
}

.permission-option {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  font-size: 12px;
  font-weight: 800;
}

.account-master-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
  max-height: 70vh;
  overflow: auto;
}

.account-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) 62px 58px 100px 54px minmax(180px, 1.4fr) auto;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 8px;
  font-size: 12px;
  font-weight: 800;
}

.account-row span,
.account-row code {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-row code {
  color: var(--muted);
}

.account-permissions {
  color: var(--muted);
}

.account-status {
  border-radius: 999px;
  padding: 4px 8px;
  text-align: center;
  font-size: 11px;
}

.account-status.enabled {
  background: #dcfce7;
  color: #166534;
}

.account-status.disabled {
  background: #fee2e2;
  color: #991b1b;
}

.audit-log-list {
  display: grid;
  gap: 8px;
  margin-top: 16px;
  max-height: 72vh;
  overflow: auto;
}

.audit-row {
  display: grid;
  grid-template-columns: 96px 120px 110px 140px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 9px 10px;
  font-size: 12px;
  font-weight: 800;
}

.audit-row span,
.audit-row strong,
.audit-row em {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.audit-row span {
  color: var(--muted);
}

.audit-row em {
  color: var(--ink);
  font-style: normal;
}

.payroll-period {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.payroll-period strong {
  color: var(--ink);
  font-size: 16px;
}

.payroll-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.payroll-selector {
  position: sticky;
  top: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 12px;
}

.payroll-results {
  min-width: 0;
}

.payroll-metrics {
  margin-bottom: 12px;
}

.payroll-list {
  display: grid;
  gap: 12px;
}

.payroll-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 12px;
}

.payroll-card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 10px;
}

.payroll-card-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.payroll-table-wrap {
  max-height: 420px;
}

.payroll-table {
  min-width: 980px;
  table-layout: fixed;
}

.payroll-table tbody tr,
.payroll-table tbody td {
  background: var(--row-content-color, #fff);
}

.summary-list,
.pill-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  max-height: 70vh;
  overflow: auto;
}

#siteSummary.summary-list {
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  align-items: start;
  gap: 12px;
  max-height: none;
  overflow: visible;
}

.summary-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding: 8px 0;
}

.summary-row strong,
.summary-row span {
  overflow-wrap: anywhere;
}

.summary-row span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.corp-site-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 0;
  overflow: hidden;
}

.corp-site-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  background: #e9f7f6;
  padding: 10px 12px;
}

.corp-site-head strong {
  color: var(--ink);
  font-size: 15px;
  overflow-wrap: anywhere;
}

.corp-site-head span {
  color: var(--primary-dark);
  font-size: 13px;
  font-weight: 900;
}

.corp-site-list {
  display: grid;
  gap: 2px;
  padding: 4px 12px 8px;
}

.corp-site-list .summary-row:last-child {
  border-bottom: 0;
}

.pill-list {
  display: grid;
  gap: 8px;
  align-content: flex-start;
  margin-top: 12px;
}

.master-form {
  position: relative;
  z-index: 100;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  margin-top: 12px;
}

.site-master-form {
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.9fr) minmax(0, 0.9fr) auto;
}

.site-corp-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.site-corp-tabs button {
  min-height: 32px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  box-shadow: none;
  font-size: 12px;
}

.site-corp-tabs button.active {
  border-color: rgba(21, 94, 117, 0.35);
  background: #e9f7f6;
  color: var(--primary-dark);
}

.site-master-list {
  display: grid;
  gap: 8px;
}

.master-form[data-master-form="contents"] {
  grid-template-columns: minmax(0, 1fr) minmax(190px, auto) auto;
  align-items: center;
}

.master-form input {
  min-height: 36px;
}

.master-form button {
  min-height: 36px;
}

.master-note {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.master-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 8px 10px;
}

.master-row strong {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.site-master-row {
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr) minmax(0, 0.8fr) auto;
}

.staff-master-row {
  grid-template-columns: minmax(0, 1fr) 90px auto;
}

.site-master-row span {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.staff-master-row span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.master-row-actions {
  display: flex;
  gap: 6px;
}

.master-row-actions button {
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  box-shadow: none;
  font-size: 12px;
}

.master-row-actions button:last-child {
  color: var(--danger);
}

.pill {
  border-radius: 999px;
  background: var(--surface-2);
  padding: 8px 10px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
}

.master-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 5px 5px 10px;
}

.master-pill span {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.master-pill button {
  display: grid;
  width: 24px;
  min-height: 24px;
  place-items: center;
  border-radius: 999px;
  background: #fff;
  color: var(--danger);
  padding: 0;
  box-shadow: none;
  font-size: 14px;
  line-height: 1;
}

.content-master-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  max-height: 70vh;
  overflow: auto;
}

.content-master-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(190px, auto) auto;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 8px 10px;
}

.content-master-row span {
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.content-master-row .color-current {
  width: 42px;
  min-height: 28px;
  height: 28px;
  background: var(--swatch-color);
}

.color-palette {
  position: relative;
  width: max-content;
}

.color-palette.compact {
  width: max-content;
}

.color-current {
  width: 38px;
  min-height: 28px;
  height: 28px;
  border: 1px solid rgba(23, 32, 51, 0.24);
  border-radius: 6px;
  background: var(--swatch-color);
  padding: 0;
  box-shadow: none;
}

.color-current.no-color,
.color-swatch.no-color {
  background:
    linear-gradient(135deg, transparent 46%, #b42318 47%, #b42318 53%, transparent 54%),
    #fff;
}

.color-current[aria-expanded="true"] {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(21, 94, 117, 0.18);
}

.color-popover {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 1000;
  display: grid;
  grid-template-columns: repeat(6, 30px);
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 10px;
  box-shadow: var(--shadow);
}

.color-popover[hidden] {
  display: none;
}

.color-swatch {
  width: 30px;
  min-height: 22px;
  height: 22px;
  border: 1px solid rgba(23, 32, 51, 0.18);
  border-radius: 4px;
  background: var(--swatch-color);
  padding: 0;
  box-shadow: none;
  font-size: 9px;
  font-weight: 900;
}

.color-swatch.selected {
  border-color: var(--ink);
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px rgba(21, 94, 117, 0.35);
}

.editor-panel {
  position: fixed;
  inset: 0 0 0 auto;
  z-index: 30;
  width: min(390px, 100vw);
  height: 100vh;
  overflow: auto;
  border-left: 1px solid var(--line);
  background: var(--surface);
  padding: 22px;
  box-shadow: -10px 0 35px rgba(23, 32, 51, 0.06);
  transform: translateX(100%);
  transition: transform 180ms ease;
}

.editor-panel.open {
  transform: translateX(0);
}

.editor-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 18px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-grid .wide {
  grid-column: 1 / -1;
}

.editor-actions {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 18px;
}

.editor-actions button {
  flex: 1;
}

.empty-state {
  padding: 28px;
  color: var(--muted);
  text-align: center;
}

.muted {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 250px minmax(0, 1fr);
  }

  .editor-panel {
    width: min(420px, 100vw);
  }
}

@media (max-width: 820px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .main {
    padding: 18px;
  }

  .topbar {
    display: grid;
  }

  .metric-grid,
  .quick-days,
  .summary-grid,
  .mypage-toolbar,
  .payroll-toolbar,
  .payroll-layout,
  .master-panels {
    grid-template-columns: 1fr;
  }

  .payroll-selector {
    position: static;
  }

  .quick-event-list {
    grid-template-columns: 1fr;
  }

  .login-status {
    grid-template-columns: 1fr;
  }

  .weekday-row,
  .calendar-grid {
    gap: 4px;
  }

  .day-cell {
    min-height: 118px;
    padding: 7px;
  }

  .event-chip {
    padding: 6px;
  }

  .mypage-shell {
    padding: 12px;
  }

  .mypage-toolbar {
    gap: 10px;
    padding: 10px;
  }

  .mypage-toolbar label {
    width: 100%;
  }

  .mypage-toolbar input,
  .mypage-toolbar button {
    width: 100%;
  }

  .mypage-period {
    order: -1;
  }

  .password-change-form {
    grid-template-columns: 1fr;
  }

  .mypage-shift-only .table-wrap {
    border: 0;
    background: transparent;
    overflow: visible;
  }

  .mypage-shift-only .shift-page-table {
    min-width: 0;
    border-collapse: separate;
    border-spacing: 0 6px;
  }

  .mypage-shift-only .shift-page-table thead {
    display: none;
  }

  .mypage-shift-only .shift-page-table,
  .mypage-shift-only .shift-page-table tbody,
  .mypage-shift-only .shift-page-table tr,
  .mypage-shift-only .shift-page-table td {
    display: block;
    width: 100%;
  }

  .mypage-shift-only .shift-page-table tr {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--row-content-color, #fff);
    padding: 7px 9px;
    box-shadow: 0 5px 16px rgba(23, 32, 51, 0.05);
  }

  .mypage-shift-only .shift-page-table td {
    min-height: 0;
    height: auto;
    border-bottom: 0;
    padding: 2px 0;
    overflow: visible;
    white-space: normal;
    text-overflow: clip;
    font-size: 12px;
    line-height: 1.25;
  }

  .mypage-shift-only .shift-page-table td:empty {
    display: none;
  }

  .mypage-shift-only .shift-page-table td::before {
    content: attr(data-label);
    display: inline-block;
    min-width: 48px;
    margin-right: 6px;
    color: var(--muted);
    font-size: 10px;
    font-weight: 800;
  }

  .mypage-shift-only .shift-page-table td[data-label="日付"] {
    grid-column: 1 / -1;
    padding-bottom: 3px;
    color: var(--ink);
    font-size: 13px;
    font-weight: 900;
  }

  .mypage-shift-only .shift-page-table td[data-label="日付"]::before {
    display: none;
  }

  .mypage-shift-only .shift-page-table td[data-label="現場"] {
    grid-column: 1 / -1;
    color: var(--primary-dark);
    font-size: 14px;
    font-weight: 900;
  }

  .mypage-shift-only .shift-page-table td[data-label="現場"]::before {
    display: none;
  }

  .mypage-shift-only .shift-page-table td[data-label="内容"],
  .mypage-shift-only .shift-page-table td[data-label="時間"] {
    font-weight: 800;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
