* { box-sizing: border-box; }
[hidden] { display: none !important; }
:root {
  color-scheme: light;
  --page: #f2f3f6;
  --paper: #fff;
  --soft: #f3f4f7;
  --line: #e0e3ea;
  --grid-line: #edf0f4;
  --ink: #1a2030;
  --sub: #3f485c;
  --muted: #5d6576;
  --accent: #1764d4;
  --accent-strong: #1b52a3;
  --accent-soft: #eaf2ff;
  --warning: #80500d;
  --red: #8a4035;
  --red-soft: #faf0ee;
  --control: 9px;
  --panel: 16px;
  --header: #f7f8fa;
  --lock-fill: #e9ecf1;
  --lift: 0 1px 2px #252f4314, 0 5px 10px -6px #252f4338;
}
body { margin: 0; background: var(--page); color: var(--ink); font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei UI", sans-serif; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .52; }
button, .roster-table td { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.top { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 16px; padding: 10px clamp(18px, 3vw, 42px); border-bottom: 1px solid #e4e6ed; background: #fcfcfd; }
.brand { display: flex; align-items: center; gap: 9px; font-size: 14px; font-weight: 600; }
.brand-mark { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: #29354e; }
.brand-mark::after { content: ''; width: 11px; height: 11px; border: 1px solid #fff; border-radius: 3px; box-shadow: inset 0 3px #fff; }
.work { max-width: 1540px; margin-inline: auto; padding: 20px clamp(16px, 2.6vw, 36px) 28px; }
.heading, .tools, .actions, .week, .week-picker { display: flex; align-items: center; }
.heading { justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.heading h1 { margin: 1px 0 0; font-size: clamp(25px, 2.6vw, 34px); line-height: 1.2; font-weight: 650; }
.heading p { margin: 4px 0 0; color: var(--muted); font-size: 13px; font-weight: 500; }
.actions, .tools { gap: 6px; }
.week { flex-wrap: wrap; gap: 8px; font-variant-numeric: tabular-nums; }
.week-picker { position: relative; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); box-shadow: 0 1px 3px #252f4308; }
.week-trigger { display: grid; grid-template-columns: 1fr 12px; align-items: center; gap: 9px; min-height: 48px; min-width: 186px; padding: 5px 11px; border: 0; border-inline: 1px solid var(--grid-line); background: var(--paper); }
.week-trigger:hover, .week-trigger[aria-expanded='true'] { background: var(--soft); }
.week-chevron { justify-self: center; width: 6px; height: 6px; border: solid var(--sub); border-width: 0 1.5px 1.5px 0; transform: translateY(-2px) rotate(45deg); }
.week-trigger[aria-expanded='true'] .week-chevron { transform: translateY(2px) rotate(225deg); }
.week-title { display: grid; justify-items: start; line-height: 1.3; white-space: nowrap; }
.week-title strong { font-size: 20px; font-weight: 650; }
#weeklabel { color: var(--sub); font-size: 12px; font-weight: 500; }
.week-step { display: grid; place-items: center; flex: 0 0 32px; height: 46px; width: 32px; padding: 0; border: 0; border-radius: var(--control); background: var(--paper); }
.week-step:hover:not(:disabled) { color: var(--accent); background: var(--accent-soft); }
.week-step::before { content: ''; width: 6px; height: 6px; border: solid currentColor; border-width: 1.5px 1.5px 0 0; transform: rotate(45deg); }
.week-step.previous::before { transform: rotate(-135deg); }
.week-menu { position: absolute; z-index: 9; inset-block-start: calc(100% + 7px); inset-inline-end: 0; width: min(298px,calc(100vw - 24px)); padding: 6px; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); box-shadow: 0 10px 28px #252f4324; }
.week-menu-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 9px 9px; border-bottom: 1px solid var(--grid-line); }
.week-menu-head strong { font-size: 14px; font-weight: 600; }
.week-menu-head span { font-size: 12px; color: var(--muted); }
.week-list { position: relative; max-height: min(284px, 43vh); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; padding: 5px 2px; }
.week-option { display: grid; grid-template-columns: 64px 1fr auto; align-items: center; gap: 8px; width: 100%; min-height: 39px; padding: 5px 8px; border: 1px solid transparent; border-radius: 6px; background: var(--paper); text-align: left; }
.week-option:hover { background: var(--soft); }
.week-option:focus-visible { outline-offset: -2px; }
.week-option[aria-current='true'] { border-color: #b7cdef; background: var(--accent-soft); color: var(--accent-strong); }
.week-option-number { font-weight: 600; }
.week-option-dates { color: var(--sub); font-size: 13px; white-space: nowrap; }
.week-option-badge { padding: 1px 5px; border-radius: 4px; background: var(--soft); color: var(--accent); font-size: 11px; white-space: nowrap; }
.ghost, .primary, .quiet { min-height: 32px; padding: 4px 11px; border: 1px solid var(--line); border-radius: var(--control); background: var(--paper); white-space: nowrap; }
.quiet { border-color: transparent; background: transparent; color: var(--sub); }
.quiet:hover:not(:disabled) { background: var(--soft); }
.ghost:hover:not(:disabled) { border-color: #b7c3d5; background: var(--soft); }
.primary { border-color: var(--accent); background: var(--accent); color: #fff; font-weight: 600; }
.primary:hover:not(:disabled) { background: var(--accent-strong); }
.primary:disabled { border-color: #dee5ef; background: #eff3f8; color: var(--muted); opacity: 1; }
.panel, .card, dialog { background: var(--paper); border: 1px solid var(--line); border-radius: var(--panel); }
.roster-sheet { box-shadow: 0 2px 8px #252f430a, 0 12px 36px -24px #252f4338; }
.light { color: var(--muted); font-size: 12px; }
.empty { padding: 24px 12px; text-align: center; color: var(--sub); }
.roster-toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 4px 12px; padding: 8px 16px; }
.roster-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; }
.edit-tools, .lock-tools { gap: 0; padding-inline-start: 6px; border-inline-start: 1px solid var(--line); }
:is(.edit-tools,.lock-tools) .quiet { padding-inline: 7px; font-size: 13px; }
.roster-actions { margin-inline-start: auto; flex-wrap: wrap; justify-content: flex-end; }
.week-unlock:not(:disabled) { color: var(--accent-strong); font-weight: 600; }
.role-switch { display: inline-flex; gap: 2px; padding: 2px; border: 1px solid transparent; border-radius: 9px; background: #eef0f4; }
.role-switch button { min-height: 28px; padding: 2px 8px; border: 0; border-radius: 7px; background: transparent; color: var(--sub); font-size: 13px; white-space: nowrap; }
.role-switch button:hover:not(:disabled) { background: #e7ebf1; }
.role-switch button[aria-pressed='true'] { background: var(--paper); color: var(--accent-strong); font-weight: 600; box-shadow: 0 1px 2px #19283a18; }
.roster-pool { display: grid; grid-template-columns: auto minmax(0,1fr); align-items: center; gap: 8px 16px; padding: 14px 16px; border-bottom: 1px solid var(--line); border-radius: 15px 15px 0 0; background: #f8f9fb; }
.pool-label { display: grid; line-height: 1.35; }
.pool-label strong { font-size: 13px; font-weight: 600; }
.pool-label span, .pool-empty { color: var(--muted); font-size: 11px; }
.pool-people { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-height: 32px; }
.person-card { --person-edge: hsl(var(--person-hue), 48%, var(--person-edge-light, 43%)); --person-paper: hsl(var(--person-hue), 46%, var(--person-tint, 94%)); background: var(--person-paper); color: var(--ink); border-radius: 7px; font-weight: 600; }
.pool-card { position: relative; display: block; width: max-content; min-height: 32px; max-width: 100%; padding: 4px 8px 4px 20px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border: 1px solid #fff; border-radius: 999px; background: color-mix(in srgb, var(--person-paper) 58%, #fff); box-shadow: var(--lift); text-align: left; font-size: 13px; cursor: grab; user-select: none; transition: transform 140ms ease, box-shadow 140ms ease; }
.pool-card::before { content: ''; position: absolute; top: 50%; left: 7px; width: 6px; height: 6px; transform: translateY(-50%); border-radius: 50%; background: var(--person-edge); }
.pool-card:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 2px 4px #252f4316, 0 7px 12px -6px #252f4352; }
.pool-card:active:not(:disabled) { transform: translateY(0); }
.draft-status { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.draft-status.has-changes { color: var(--warning); }
.roster-error { margin: 0; padding: 8px 16px; color: var(--red); background: var(--red-soft); }
.roster-scroll { position: relative; overflow: auto; max-height: min(72vh,680px); border-block: 1px solid var(--line); overscroll-behavior-inline: contain; }
.roster-table { width: 100%; min-width: calc(92px + var(--roster-columns) * var(--roster-column-width)); border-spacing: 0; table-layout: fixed; font-size: 12px; font-variant-numeric: tabular-nums; }
.roster-table thead { position: sticky; top: 0; z-index: 3; }
.roster-table th, .roster-table td { height: 32px; padding: 0; border-right: 1px solid var(--line); border-bottom: 1px solid var(--grid-line); }
.roster-table :is(th,td):last-child { border-right: 0; }
.roster-table tbody tr:last-child > * { border-bottom: 0; }
.roster-table th { color: var(--sub); background: var(--soft); font-weight: 500; }
.roster-table .roster-time { position: sticky; z-index: 2; left: 0; width: 92px; vertical-align: middle; white-space: nowrap; text-align: left; padding-inline: 8px; }
.roster-table .roster-axis { background: var(--header); color: var(--sub); border-right-color: var(--line); border-bottom-color: var(--line); text-align: center; }
.roster-table .roster-day-header { padding: 8px 4px 6px; background: var(--header); color: var(--ink); border-color: var(--line); }
.roster-table .roster-weekend { background: #f1f3f7; }
.roster-table .roster-today { background: #eaf3ff; color: var(--accent-strong); box-shadow: inset 0 3px #3478e8; }
.roster-table .roster-tomorrow { background: #f3f6fb; color: #5c6f8f; box-shadow: inset 0 1px #a9bee0; }
.roster-date { display: flex; align-items: baseline; justify-content: center; flex-wrap: wrap; gap: 0 6px; line-height: 1.2; white-space: nowrap; }
.roster-date time { font-size: 21px; font-weight: 600; letter-spacing: -.02em; }
.roster-date > span { font-size: 12px; color: var(--sub); }
.today-label, .tomorrow-label { margin-inline-start: 4px; font-size: 11px; font-weight: 600; }
.today-label { color: var(--accent-strong); }
.tomorrow-label { color: #6f89b4; }
.day-status-wrap { --status-dot: #8992a4; position: relative; display: inline-block; text-align: start; margin-top: 4px; }
.day-status-wrap[data-status='live'] { --status-dot: #32825d; }
.day-status-wrap[data-status='off'] { --status-dot: #a85f52; }
.day-status-wrap[data-status='planned'] { --status-dot: #5687cf; }
.day-status-wrap::before { content: ''; position: absolute; top: 50%; left: 2px; width: 5px; height: 5px; border-radius: 50%; transform: translateY(-50%); background: var(--status-dot); pointer-events: none; }
.day-status-wrap::after { content: ''; position: absolute; top: 8px; right: 4px; width: 4px; height: 4px; border: solid var(--muted); border-width: 0 1px 1px 0; transform: rotate(45deg); pointer-events: none; }
.day-status { appearance: none; min-height: 22px; padding: 0 14px 0 12px; border: 0; border-radius: 4px; background: transparent; color: var(--muted); font-size: 11px; cursor: pointer; }
.day-status:hover:not(:disabled) { background: #25344b0a; }
.day-status:focus-visible { outline-color: var(--accent); }
.day-status option { background: var(--paper); color: var(--ink); }
.day-status[data-status='live'] { color: #246948; }
.day-status[data-status='off'] { color: var(--red); }
.roster-table .roster-role { height: 28px; border-bottom-color: var(--line); font-size: 11px; }
.roster-table .roster-today-role { background: #eaf3ff; color: var(--accent-strong); }
.roster-table .roster-today-role.roster-host { box-shadow: inset 2px 0 #6f9ff0; }
.roster-table .roster-today-role:not(.roster-host) { box-shadow: inset -2px 0 #6f9ff0; }
.roster-table .roster-tomorrow-role { background: #f2f6fb; color: #667a9c; }
.roster-table .roster-tomorrow-role.roster-host { box-shadow: inset 1px 0 #b7c8e0; }
.roster-table .roster-tomorrow-role:not(.roster-host) { box-shadow: inset -1px 0 #b7c8e0; }
.roster-table :is(td,th).roster-host { border-right-color: var(--grid-line); }
.roster-table td { position: relative; background: var(--paper); cursor: cell; touch-action: manipulation; }
.roster-table tbody tr:nth-child(even) td { background: #fcfcfd; }
.roster-table td.roster-today-cell { background: var(--paper) !important; box-shadow: none; }
.roster-table td.roster-today-cell.roster-host { box-shadow: inset 2px 0 #6f9ff0; }
.roster-table td.roster-today-cell:not(.roster-host) { box-shadow: inset -2px 0 #6f9ff0; }
.roster-table td.roster-tomorrow-cell { background: var(--paper) !important; box-shadow: none; }
.roster-table td.roster-tomorrow-cell.roster-host { box-shadow: inset 1px 0 #b7c8e0; }
.roster-table td.roster-tomorrow-cell:not(.roster-host) { box-shadow: inset -1px 0 #b7c8e0; }
.roster-table .new-month { border-left: 2px solid #9ba9be; }
.roster-custom > * { border-top: 2px solid #9ba9be; }
.roster-table .roster-day-header.day-off { background: #f8efed; color: var(--red); }
.roster-table td.day-off, .roster-table tbody tr:nth-child(even) td.day-off { background: var(--red-soft); }
.roster-table td.day-off .slot-card { opacity: .72; cursor: default; text-decoration: line-through; }
.time-start { color: var(--ink); font-size: 14px; font-weight: 600; }
.time-end { color: var(--muted); font-size: 11px; }
.roster-table td.roster-frozen { background: repeating-linear-gradient(135deg,#f5f7fa 0 5px,#ebeff5 5px 7px); }
.roster-table td.roster-conflict { background: var(--red-soft); }
.roster-table td.roster-dirty:not(.roster-selected) { box-shadow: inset 0 -2px #c8964b; }
.roster-table td.roster-selected { background: var(--accent-soft) !important; }
.roster-table td.roster-anchor { outline: 1px solid var(--accent); outline-offset: -1px; }
.roster-table td.roster-drop { background: #dce9ff !important; outline: 2px solid var(--accent); outline-offset: -2px; }
.slot-card { position: absolute; inset: 4px 3px; display: block; overflow: hidden; padding: 0 1px; border: 1px solid #fff2; text-align: center; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; line-height: 22px; user-select: none; cursor: default; }
.slot-card.person-card { box-shadow: 0 1px 2px #252f4318; }
.slot-card[draggable='true'] { cursor: grab; }
.slot-card[draggable='true']:hover { box-shadow: inset 0 0 0 1px var(--person-edge), var(--lift); }
:is(.slot-card,.pool-card)[draggable='true']:active { cursor: grabbing; }
.is-dragging { opacity: .58; }
.off-card { background: #f7e8e4; color: var(--red); border-radius: 4px; }
.roster-table input { position: absolute; inset: 0; width: 100%; height: 100%; min-width: 0; padding: 2px; border: 0; outline: none; opacity: 0; pointer-events: none; text-align: center; }
.roster-table td.roster-editing input { opacity: 1; pointer-events: auto; background: var(--paper); box-shadow: inset 0 0 0 2px var(--accent); }
.roster-editing .slot-card { visibility: hidden; }
.gridfoot { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 5px 16px; padding: 8px 16px; color: var(--muted); font-size: 12px; }
.gridfoot kbd { display: inline-block; margin-inline: 1px; padding: 0 4px; border: 1px solid var(--line); border-radius: 4px; background: var(--soft); color: var(--sub); font: inherit; }
.gridfoot kbd:not(:first-child) { margin-left: 4px; }
dialog { width: min(calc(100% - 24px), 540px); max-height: calc(100% - 24px); padding: 0; box-shadow: 0 12px 32px #18233521; }
dialog::backdrop { background: #1823355c; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; padding: 11px 15px; border-bottom: 1px solid var(--line); }
.dialog-head h2 { margin: 0; font-size: 17px; font-weight: 600; }
.dialog-body { display: grid; gap: 10px; padding: 14px 15px; }
.dialog-body textarea { width: 100%; padding: 8px; border: 1px solid var(--line); border-radius: var(--control); }
.dialog-body .actions { justify-content: flex-end; }
.error { margin: 0; color: var(--red); }
.personal-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.personal-controls > label { color: var(--sub); }
.personal-controls > select { min-width: 95px; max-width: 100%; padding: 5px 8px; border: 1px solid var(--line); border-radius: var(--control); background: var(--paper); }
.personal-controls > .role-switch { margin-left: auto; }
.personal-week-title { display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px; padding-block: 8px; color: var(--sub); }
.person-name { display: inline-block; padding: 2px 8px; border-radius: 999px; box-shadow: 0 1px 2px #252f4312; }
.personal-days { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.personal-days > li { display: grid; grid-template-columns: 95px 1fr; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.personal-days > li > span { line-height: 1.7; }
.personal-empty { margin: 0; padding-block: 8px; color: var(--muted); }
.dialog-body .personal-footer { justify-content: space-between; flex-wrap: wrap; }
#toast { position: fixed; right: 16px; bottom: 16px; z-index: 5; padding: 8px 14px; border-radius: var(--control); background: var(--ink); color: #fff; }
@media (max-width: 1100px) {
  .roster-date time { font-size: 19px; }
  .roster-toolbar { padding-inline: 12px; }
  .roster-tools { column-gap: 6px; }
}
@media (max-width: 600px) {
  .work { padding: 16px 12px 24px; }
  .top { padding-inline: 12px; }
  .top .actions { gap: 5px; }
  #sourceClock { font-size: 10px; }
  .heading { align-items: flex-start; flex-direction: column; gap: 8px; margin-bottom: 12px; }
  .week-title strong { font-size: 17px; }
  .week-trigger { min-width: 145px; min-height: 43px; padding-inline: 7px; }
  .week-step { height: 42px; }
  .week-menu { inset-inline: 0 auto; }
  .roster-toolbar, .roster-pool, .gridfoot { padding-inline: 8px; }
  .roster-tools { gap: 4px; }
  .edit-tools { gap: 0; padding-inline-start: 4px; }
  .edit-tools .quiet { padding-inline: 5px; }
  .roster-actions { margin-inline-start: auto; }
  .roster-pool { column-gap: 8px; }
  .pool-card { min-height: 28px; padding-inline-end: 8px; }
  .roster-scroll { max-height: min(65vh,650px); }
}
.roster-table td.roster-cell-locked { background: var(--lock-fill) !important; }
.roster-table td.roster-cell-locked.roster-empty-cell::after { content: ""; position: absolute; inset: 50% auto auto 50%; width: 8px; height: 2px; border-radius: 2px; transform: translate(-50%, -50%); background: #aab2c0; pointer-events: none; }
.roster-table td.roster-cell-locked.roster-selected { box-shadow: inset 0 0 0 1px #7ba5e7; background: #e1eaf8 !important; }
.roster-table td.roster-cell-locked .slot-card { cursor: default; }

#phoneLinkStatus { margin: 0; }
#phoneLinkText { width: 100%; padding: 8px; border: 1px solid var(--line); border-radius: var(--control); }
.phone-view :is(#sourceClock,#sync,#openPhone) { display: none; }
.phone-view .work { max-width: 760px; }
.phone-days { display: grid; grid-template-columns: repeat(auto-fit,minmax(0,1fr)); padding: 6px; gap: 2px; border-bottom: 1px solid var(--line); background: var(--soft); border-radius: 15px 15px 0 0; }
.phone-days button { display: grid; align-content: center; justify-items: center; min-height: 52px; padding: 4px 1px; border: 0; border-radius: 5px; background: transparent; color: var(--sub); white-space: nowrap; font-size: 12px; font-variant-numeric: tabular-nums; }
.phone-days button[aria-pressed='true'] { background: var(--accent-soft); color: var(--accent-strong); box-shadow: inset 0 0 0 1px #b9d0f7; }
.phone-days button.phone-today { background: linear-gradient(180deg,#e4f0ff,#f3f8ff); color: var(--accent-strong); box-shadow: inset 0 2px #3478e8, inset 1px 0 #8bb2ef, inset -1px 0 #8bb2ef; }
.phone-days button.phone-tomorrow { background: linear-gradient(180deg,#f1f5fb,#fafbfd); color: #667a9c; box-shadow: inset 0 1px #b7c8e0, inset 1px 0 #d0dbea, inset -1px 0 #d0dbea; }
.phone-day-marker { color: inherit !important; font-weight: 600; }
.phone-days small { color: #80504b; font-size: 10px; }
.phone-date { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 12px; border-bottom: 1px solid var(--line); }
.phone-date h2 { margin: 0; font-size: 18px; font-weight: 600; }
.phone-date > span { color: var(--accent-strong); }
.phone-date-today { background: linear-gradient(90deg,#eef6ff,#fff); box-shadow: inset 3px 0 #3478e8; }
.phone-date-tomorrow { background: linear-gradient(90deg,#f5f8fc,#fff); box-shadow: inset 2px 0 #b7c8e0; }
.phone-shifts { list-style: none; margin: 0; padding: 0 12px; }
.phone-shifts li { display: grid; grid-template-columns: 93px minmax(0,1fr); gap: 8px; padding: 12px 0; align-items: start; }
.phone-shifts li + li { border-top: 1px solid var(--grid-line); }
.phone-time { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.phone-assignment-list { display: grid; gap: 4px; }
.phone-assignment { display: flex; gap: 6px; align-items: baseline; flex-wrap: wrap; overflow-wrap: anywhere; }
.phone-assignment > span { color: var(--sub); font-size: 12px; }
.phone-lock { padding: 1px 5px; color: var(--sub); background: var(--lock-fill); border-radius: 5px; }
.phone-empty { margin: 0; padding: 16px 12px; color: var(--muted); }
.phone-off { color: var(--red); }

@media (prefers-reduced-motion: reduce) {
  .pool-card { transition: none; }
}
