:root {
  color-scheme: light;
  --ink: #1b3329;
  --forest: #164b3a;
  --forest-dark: #103a2c;
  --muted: #52655b;
  --canvas: #f5f7f1;
  --paper: #ffffff;
  --wash: #edf2e8;
  --line: #cfd9cf;
  --mint: #dcecc4;
  --amber: #94571c;
  --error: #882d25;
  --radius: 12px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; background: var(--canvas); color: var(--ink); font: 15px/1.5 "Segoe UI", system-ui, sans-serif; }
h1, h2, h3, p { margin: 0; }
button, input, select { font: inherit; }
button, input, select, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .55; }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 3px; }
h1, h2 { font-family: Georgia, "Times New Roman", serif; font-weight: normal; }
h1 { font-size: clamp(2rem, 4.25vw, 3.3rem); line-height: 1.06; letter-spacing: -.045em; }
h2 { font-size: 1.5rem; line-height: 1.14; letter-spacing: -.025em; }
.primary, .secondary, .danger, .tab-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--paper);
  font-weight: 650;
  line-height: 1.25;
  text-align: center;
  text-decoration: none;
}
.primary { border-color: var(--forest); color: white; background: var(--forest); }
.primary:hover:not(:disabled) { background: var(--forest-dark); }
.secondary:hover:not(:disabled), .tab-button:hover:not(:disabled) { background: var(--wash); }
.danger { border-color: #d9aea9; color: var(--error); background: #fff8f7; }
.danger:hover:not(:disabled) { background: #f7e7e3; }
.site-header { border-bottom: 1px solid var(--line); background: var(--paper); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: min(100%, 1480px); margin: 0 auto; padding: 14px clamp(16px, 3.2vw, 44px); }
.identity { display: flex; align-items: center; gap: 11px; min-width: 0; }
.identity strong { display: block; font: normal 1.25rem/1.16 Georgia, serif; white-space: nowrap; }
.identity div > span { display: block; margin-top: 2px; color: var(--muted); font-size: .77rem; }
.brand-mark { display: grid; place-items: center; width: 37px; height: 37px; flex: 0 0 37px; border-radius: 10px; background: var(--forest); color: var(--mint); font: bold .91rem Georgia, serif; }
.session-tools { display: flex; align-items: center; gap: 12px; min-width: 0; }
.viewer-name { overflow-wrap: anywhere; font-weight: 650; }
.workspace { width: min(100%, 1480px); margin: 0 auto; padding: clamp(20px, 3.5vw, 48px) clamp(14px, 3.2vw, 44px); }
.auth-card { max-width: 440px; margin: clamp(10px, 6dvh, 58px) auto 0; padding: clamp(21px, 5vw, 32px); border: 1px solid var(--line); border-radius: 16px; background: var(--paper); }
.auth-card h1 { margin-bottom: 20px; font-size: clamp(2rem, 8vw, 2.55rem); }
.segmented { display: inline-flex; flex-wrap: wrap; gap: 3px; padding: 3px; border: 1px solid var(--line); border-radius: 9px; background: var(--wash); }
.tab-button { border-color: transparent; background: transparent; font-size: .94rem; }
.tab-button[aria-pressed="true"] { border-color: var(--line); background: var(--paper); color: var(--forest-dark); }
.auth-card .segmented { display: flex; }
.auth-card .tab-button { flex: 1 1 auto; }
.stack { display: grid; gap: 6px; margin-top: 18px; }
.stack label:not(:first-child) { margin-top: 6px; }
label { color: var(--ink); font-size: .9rem; font-weight: 650; }
input, select { width: 100%; min-width: 0; min-height: 42px; padding: 8px 10px; border: 1px solid #aabaae; border-radius: 7px; color: var(--ink); background: var(--paper); }
small, .status { color: var(--muted); }
.form-action { margin-top: 12px; }
.form-error { margin-top: 10px; color: var(--error); font-weight: 600; }
.notice { margin-bottom: 16px; padding: 11px 14px; border: 1px solid #b9d5ac; border-radius: 8px; background: #eef5e9; }
.notice.is-error { border-color: #d9aea9; background: #fff1ee; color: var(--error); }
.page-heading { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.week-heading { margin-top: 6px; color: var(--muted); }
.week-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.week-controls { display: flex; align-items: center; gap: 6px; }
.icon-button { width: 42px; padding: 0; font-size: 1.65rem; }
.date-field { display: flex; align-items: center; gap: 8px; }
.date-field input { width: auto; }
#week-status { margin-bottom: 10px; }
.week-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.day { min-width: 0; min-height: 145px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); overflow: hidden; }
.day.today { border-color: #729581; }
.day-heading { display: flex; align-items: center; justify-content: space-between; gap: 5px; padding: 9px 10px; border-bottom: 1px solid var(--line); background: var(--wash); }
.day.today .day-heading { background: #dcebd9; }
.day-heading h2 { font: 650 .93rem/1.25 "Segoe UI", system-ui, sans-serif; letter-spacing: 0; }
.day-heading time { color: var(--muted); white-space: nowrap; }
.day-services { display: grid; gap: 6px; padding: 7px; }
.day-empty { padding: 6px 4px; color: var(--muted); font-size: .86rem; }
.shift {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 53px;
  padding: 8px 8px 8px 9px;
  border: 1px solid #d4e1d3;
  border-left: 3px solid #779f81;
  border-radius: 7px;
  color: var(--ink);
  background: #eff5ed;
  text-align: left;
  overflow-wrap: anywhere;
}
button.shift:hover { background: #e3eedf; }
.shift-time { display: block; margin-bottom: 2px; color: var(--forest-dark); font-weight: 700; font-variant-numeric: tabular-nums; }
.shift-name { display: block; font-weight: 650; }
.shift-position { display: block; color: var(--muted); font-size: .84rem; }
.card { margin-bottom: 14px; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); }
.card h2 { margin-bottom: 12px; }
.invite-form { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) auto; align-items: end; gap: 10px; }
.invite-form input, .invite-form select, .shift-fields input, .shift-fields select { display: block; margin-top: 4px; }
.activation-result { border-color: #96b58e; background: #f1f7ed; }
dl { display: flex; flex-wrap: wrap; gap: 10px 24px; margin: 0 0 10px; }
dt { color: var(--muted); font-size: .83rem; }
dd { margin: 0; font-weight: 650; overflow-wrap: anywhere; }
dd code { font-size: 1rem; }
.account-list { display: grid; }
.account-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 9px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.account-row:last-child { border-bottom: 0; }
.account-meta { display: block; color: var(--muted); font-size: .85rem; }
.actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
dialog { width: min(530px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); padding: 0; border: 1px solid var(--line); border-radius: 14px; color: var(--ink); background: var(--paper); }
dialog::backdrop { background: #172c24a6; }
.edit-form { padding: clamp(14px, 4vw, 22px); }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.shift-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.full-width { grid-column: 1 / -1; }
.confirmation { margin-top: 13px; padding: 12px; border: 1px solid #d9aea9; border-radius: 8px; background: #fff5f1; }
#overnight, #account-action-text { margin-top: 9px; }

@media (max-width: 1120px) {
  .week-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 780px) {
  .week-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .invite-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 490px) {
  .header-inner { align-items: flex-start; }
  .session-tools { flex-direction: column; align-items: end; gap: 3px; }
  .viewer-name { max-width: 42vw; font-size: .8rem; text-align: right; }
  .session-tools .secondary { min-height: 36px; padding: 6px 9px; font-size: .8rem; }
  .week-grid, .invite-form { grid-template-columns: minmax(0, 1fr); }
  .day { min-height: auto; }
  .day-services { gap: 5px; }
  .day-heading { padding: 8px 10px; }
  .date-field { justify-content: space-between; width: 100%; }
  .account-row .actions { margin-top: 0; }
}
