:root {
  --brand: #2098cb;
  --brand-dark: #1176a2;
  --brand-soft: #eaf7fc;
  --ink: #201918;
  --muted: #706b69;
  --line: #dedbd8;
  --surface: #ffffff;
  --canvas: #f6f7f8;
  --yellow: #ffd51c;
  --yellow-soft: #fff8cf;
  --green: #16885c;
  --green-soft: #e8f6ef;
  --red: #c44135;
  --red-soft: #fff0ed;
  --shadow: 0 8px 24px rgba(32, 25, 24, 0.08);
  --sidebar: 224px;
}

* { box-sizing: border-box; }

html { color-scheme: light; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: var(--canvas);
  color: var(--ink);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  letter-spacing: 0;
}

button,
input,
select,
textarea { font: inherit; }

button { letter-spacing: 0; }

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(32, 152, 203, 0.24);
  outline-offset: 2px;
}

button:disabled { cursor: not-allowed; opacity: 0.48; }

.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.icon {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.app-shell { min-height: 100vh; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  display: flex;
  width: var(--sidebar);
  flex-direction: column;
  border-right: 1px solid #2e2927;
  background: var(--ink);
  color: #fff;
}

.brand {
  display: flex;
  min-height: 78px;
  align-items: center;
  gap: 11px;
  padding: 15px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.11);
}

.brand-mark {
  width: 43px;
  height: 43px;
  overflow: hidden;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #fff;
}

.brand-mark img {
  width: 60px;
  height: 60px;
  transform: translate(-8px, -7px);
  object-fit: cover;
  object-position: 50% 5%;
}

.brand-copy { min-width: 0; }
.brand-copy strong { display: block; font-size: 16px; line-height: 1.2; }
.brand-copy span { display: block; margin-top: 3px; color: #bdb8b5; font-size: 12px; }

.side-nav {
  display: grid;
  gap: 6px;
  padding: 18px 12px;
}

.nav-button {
  display: flex;
  width: 100%;
  min-height: 48px;
  align-items: center;
  gap: 12px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #d8d4d2;
  cursor: pointer;
  font: inherit;
  padding: 0 14px;
  text-align: left;
  text-decoration: none;
}

.nav-button:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.nav-button.active { background: var(--brand); color: #fff; }
.nav-button .icon { width: 21px; height: 21px; }

.sidebar-foot {
  margin-top: auto;
  padding: 14px 12px 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 5px 12px;
}

.avatar {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--yellow);
  color: var(--ink);
  font-weight: 800;
}

.user-chip-copy { min-width: 0; }
.user-chip-copy strong,
.user-chip-copy span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chip-copy span { color: #aaa4a1; font-size: 12px; }

.sidebar-logout {
  display: flex;
  width: 100%;
  min-height: 40px;
  align-items: center;
  gap: 10px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #bdb8b5;
  cursor: pointer;
  padding: 0 9px;
}
.sidebar-logout:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }

.main-shell { min-height: 100vh; margin-left: var(--sidebar); }

.topbar {
  position: sticky;
  top: 0;
  z-index: 15;
  display: flex;
  min-height: 64px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  padding: 10px clamp(18px, 3vw, 40px);
}

.topbar-title { min-width: 0; }
.topbar-title strong { display: block; font-size: 18px; line-height: 1.2; }
.topbar-title span { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }

.page {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 28px clamp(18px, 3vw, 40px) 56px;
}

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.page-heading h1,
.page-heading h2,
.panel-heading h2,
.panel-heading h3 { margin: 0; letter-spacing: 0; }
.page-heading h1 { font-size: clamp(25px, 3vw, 34px); line-height: 1.15; }
.page-heading p,
.panel-heading p { margin: 5px 0 0; color: var(--muted); }

.primary-button,
.secondary-button,
.danger-button,
.icon-button,
.task-action,
.text-button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 5px;
  cursor: pointer;
  padding: 0 15px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.primary-button { border: 1px solid var(--brand); background: var(--brand); color: #fff; }
.primary-button:hover { border-color: var(--brand-dark); background: var(--brand-dark); }
.secondary-button { border: 1px solid var(--line); background: #fff; color: var(--ink); }
.secondary-button:hover { border-color: #aaa4a1; background: #fafafa; }
.danger-button { border: 1px solid #ecc8c3; background: var(--red-soft); color: var(--red); }
.danger-button:hover { border-color: var(--red); }
.text-button { min-height: 34px; border: 0; background: transparent; color: var(--brand-dark); padding: 0 7px; }
.text-button:hover { background: var(--brand-soft); }

.icon-button {
  width: 42px;
  padding: 0;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}
.icon-button:hover { border-color: #aaa4a1; background: #fafafa; }

.section-band {
  margin-bottom: 24px;
  border-top: 3px solid var(--brand);
  background: var(--surface);
  box-shadow: 0 1px 0 var(--line);
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.panel-heading h2 { font-size: 18px; }
.panel-heading h3 { font-size: 16px; }

.queue-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
}

.queue-metric {
  min-width: 0;
  padding: 16px 20px;
  border-right: 1px solid var(--line);
}
.queue-metric:last-child { border-right: 0; }
.queue-metric span { display: block; color: var(--muted); font-size: 13px; }
.queue-metric strong { display: block; margin-top: 3px; font-size: 27px; line-height: 1.1; }
.queue-metric.risk strong { color: var(--red); }

.segmented {
  display: inline-flex;
  max-width: 100%;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #efefef;
  padding: 3px;
}

.segment {
  min-height: 34px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 0 13px;
  white-space: nowrap;
}
.segment.active { background: #fff; color: var(--ink); box-shadow: 0 1px 4px rgba(32, 25, 24, 0.12); font-weight: 700; }

.task-list { display: grid; }

.task-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}
.task-card:last-child { border-bottom: 0; }
.task-card:hover { background: #fcfcfc; }
.task-card.is-overdue { box-shadow: inset 4px 0 0 var(--red); }
.task-card.is-urgent:not(.is-overdue) { box-shadow: inset 4px 0 0 var(--yellow); }
.task-card.is-done { opacity: 0.72; }

.task-main { min-width: 0; }
.task-title-row { display: flex; min-width: 0; align-items: center; gap: 9px; }
.task-title-row h3 { min-width: 0; margin: 0; font-size: 17px; line-height: 1.35; overflow-wrap: anywhere; }
.task-description { margin: 8px 0 0; color: #514c49; white-space: pre-wrap; overflow-wrap: anywhere; }
.task-meta { display: flex; flex-wrap: wrap; gap: 6px 15px; margin-top: 10px; color: var(--muted); font-size: 13px; }
.task-meta span { display: inline-flex; align-items: center; gap: 5px; }
.task-meta .icon { width: 15px; height: 15px; }
.task-meta .overdue { color: var(--red); font-weight: 700; }

.status-pill,
.tiny-pill {
  display: inline-flex;
  min-height: 25px;
  align-items: center;
  border-radius: 999px;
  padding: 2px 9px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.status-pill.doing { background: var(--brand-soft); color: var(--brand-dark); }
.status-pill.done { background: var(--green-soft); color: var(--green); }
.tiny-pill.urgent { background: var(--yellow-soft); color: #725f00; }
.tiny-pill.pending { background: var(--red-soft); color: var(--red); }
.tiny-pill.reminder { background: rgba(52, 199, 89, 0.12); color: #167743; }

.member-check-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.member-check-option { display: flex; min-width: 0; min-height: 44px; align-items: center; gap: 9px; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: var(--surface); }
.member-check-option input { width: 18px; height: 18px; flex: 0 0 auto; accent-color: var(--blue); }
.member-check-option span { min-width: 0; overflow-wrap: anywhere; }

.task-actions {
  display: flex;
  min-width: 220px;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  flex-wrap: wrap;
}

.task-action {
  min-height: 38px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  padding: 0 12px;
  font-size: 13px;
}
.task-action:hover { border-color: var(--brand); color: var(--brand-dark); }
.task-action.complete { border-color: var(--green); background: var(--green); color: #fff; }
.task-action.complete:hover { background: #0f7049; }
.task-action.approve { border-color: var(--brand); background: var(--brand); color: #fff; }
.task-action.reject { border-color: #ecc8c3; color: var(--red); }
.task-action .icon { width: 17px; height: 17px; }

.pending-request {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: -5px;
  border: 1px solid #eed56b;
  border-radius: 5px;
  background: var(--yellow-soft);
  padding: 11px 13px;
}
.pending-request p { margin: 0; }
.pending-request-actions { display: flex; gap: 7px; }

.empty-state {
  display: grid;
  min-height: 210px;
  place-items: center;
  padding: 32px;
  color: var(--muted);
  text-align: center;
}
.empty-state .icon { width: 34px; height: 34px; margin: 0 auto 10px; color: #aaa4a1; }
.empty-state p { margin: 0; }

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.toolbar-filters { display: flex; min-width: 0; align-items: center; gap: 9px; flex-wrap: wrap; }
.search-field { position: relative; display: block; min-width: 240px; }
.search-field .icon { position: absolute; top: 50%; left: 11px; width: 17px; height: 17px; color: var(--muted); transform: translateY(-50%); }
.search-field input { width: 100%; padding-left: 37px; }

.form-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, .65fr);
  gap: 24px;
  align-items: start;
}

.form-layout.single { grid-template-columns: minmax(0, 820px); }

.form-panel,
.manage-panel {
  border-top: 3px solid var(--brand);
  background: #fff;
  box-shadow: 0 1px 0 var(--line);
}

.form-body { padding: 20px; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.field { display: grid; min-width: 0; gap: 7px; }
.field[hidden] { display: none !important; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 13px; font-weight: 700; }
.field small { color: var(--muted); }

input,
select,
textarea {
  width: 100%;
  min-height: 43px;
  border: 1px solid #cfcac7;
  border-radius: 5px;
  background: #fff;
  color: var(--ink);
  padding: 9px 11px;
}
input:hover,
select:hover,
textarea:hover { border-color: #aaa4a1; }
textarea { min-height: 110px; resize: vertical; }
.large-input { min-height: 180px; }

.check-row { display: flex; align-items: center; gap: 9px; }
.check-row input { width: 18px; height: 18px; min-height: 0; }
.check-row label { font-weight: 500; }

.form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.tips-panel {
  padding: 20px;
  border-top: 3px solid var(--yellow);
  background: #fff;
  box-shadow: 0 1px 0 var(--line);
}
.tips-panel h3 { margin: 0 0 12px; font-size: 16px; }
.tips-panel ol { margin: 0; padding-left: 21px; color: var(--muted); }
.tips-panel li + li { margin-top: 9px; }

.ai-drafts { display: grid; gap: 12px; margin-top: 16px; }
.draft-row { display: grid; grid-template-columns: 1.4fr 1fr 150px auto; gap: 9px; align-items: end; border-top: 1px solid var(--line); padding-top: 14px; }
.draft-row .field label { font-size: 12px; }

.recurring-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 20px; border-bottom: 1px solid var(--line); }
.recurring-toolbar h3 { margin: 0 0 4px; font-size: 17px; }
.recurring-toolbar p { margin: 0; color: var(--muted); font-size: 13px; }
.recurring-list { display: grid; padding: 0 20px; }
.recurring-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; align-items: center; min-height: 80px; border-bottom: 1px solid var(--line); padding: 14px 0; }
.recurring-row:last-child { border-bottom: 0; }
.recurring-row.paused { opacity: .62; }
.recurring-main { min-width: 0; }
.recurring-title { display: flex; min-width: 0; align-items: center; gap: 8px; flex-wrap: wrap; }
.recurring-title strong { overflow-wrap: anywhere; }
.recurring-meta { margin-top: 7px; color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.recurring-actions { display: flex; align-items: center; gap: 3px; }
.danger-text { color: var(--red); }
.empty-state.compact { min-height: 150px; }
.empty-state.compact strong { color: var(--ink); }
.empty-state.compact p { margin-top: 7px; }

.manage-tabs { padding: 14px 20px; border-bottom: 1px solid var(--line); }
.manage-content { padding: 20px; }
.settings-section + .settings-section { margin-top: 26px; padding-top: 24px; border-top: 1px solid var(--line); }
.settings-section h3 { margin: 0 0 4px; font-size: 17px; }
.settings-section > p { margin: 0 0 16px; color: var(--muted); }

.member-list { display: grid; }
.member-row { display: grid; grid-template-columns: minmax(170px, 1.1fr) minmax(150px, .8fr) minmax(190px, 1fr) auto; gap: 16px; align-items: center; min-height: 68px; border-bottom: 1px solid var(--line); padding: 10px 0; }
.member-row:last-child { border-bottom: 0; }
.member-name { display: flex; min-width: 0; align-items: center; gap: 10px; }
.member-name strong,
.member-name span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member-name span,
.member-cell small { color: var(--muted); font-size: 12px; }
.member-actions { display: flex; gap: 4px; }

.screen-list { display: grid; }
.screen-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 18px; align-items: center; min-height: 82px; border-bottom: 1px solid var(--line); padding: 13px 0; }
.screen-row:last-child { border-bottom: 0; }
.screen-row.paused { opacity: .65; }
.screen-main { min-width: 0; }
.screen-title { display: flex; min-width: 0; align-items: center; gap: 9px; flex-wrap: wrap; }
.screen-title strong { overflow-wrap: anywhere; }
.screen-meta { margin-top: 7px; color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.screen-meta span { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; }
.screen-actions { display: flex; align-items: center; gap: 3px; }
.screen-heading-actions { display: flex; align-items: center; gap: 8px; }
.kindle-token-field { margin-top: 18px; }
.kindle-token-field textarea { min-height: 118px; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 13px; }

.config-status {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 16px;
  border-left: 4px solid var(--line);
  background: #f8f8f8;
  padding: 11px 13px;
}
.config-status.ready { border-color: var(--green); background: var(--green-soft); }
.config-status.warn { border-color: var(--yellow); background: var(--yellow-soft); }
.config-status .icon { width: 18px; height: 18px; }

.delivery-log { display: grid; gap: 8px; }
.delivery-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; border-bottom: 1px solid var(--line); padding: 10px 0; }
.delivery-item:last-child { border-bottom: 0; }
.delivery-item p { margin: 0; }
.delivery-item small { color: var(--muted); }

.modal {
  width: min(560px, calc(100vw - 28px));
  max-height: min(84vh, 760px);
  margin: auto;
  border: 0;
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  padding: 0;
  box-shadow: 0 24px 70px rgba(32, 25, 24, 0.32);
}
.modal::backdrop { background: rgba(32, 25, 24, 0.58); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); padding: 17px 20px; }
.modal-head h2 { margin: 0; font-size: 19px; }
.modal-body { overflow: auto; max-height: calc(84vh - 140px); padding: 20px; }
.modal-foot { display: flex; align-items: center; justify-content: flex-end; gap: 9px; border-top: 1px solid var(--line); padding: 14px 20px; }
.modal-message { margin: 0; font-size: 16px; }
.modal-subtle { margin: 8px 0 0; color: var(--muted); }

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 80;
  max-width: min(400px, calc(100vw - 32px));
  border-radius: 5px;
  background: var(--ink);
  color: #fff;
  box-shadow: var(--shadow);
  padding: 12px 16px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity .18s ease, transform .18s ease;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: var(--red); }

.login-screen {
  display: grid;
  min-height: 100vh;
  grid-template-columns: minmax(360px, .8fr) minmax(520px, 1.2fr);
  background: #fff;
}

.login-brand {
  position: relative;
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  background: var(--ink);
  color: #fff;
  padding: clamp(34px, 5vw, 72px);
}
.login-brand img { position: relative; z-index: 1; width: min(290px, 80%); background: #fff; }
.login-brand-copy { position: relative; z-index: 1; max-width: 430px; }
.login-brand-copy h1 { margin: 0; font-size: clamp(32px, 5vw, 58px); line-height: 1.05; }
.login-brand-copy p { margin: 16px 0 0; color: #c7c2bf; font-size: 17px; }

.login-panel { display: grid; place-items: center; padding: 28px; }
.login-form { width: min(410px, 100%); }
.login-form h2 { margin: 0; font-size: 29px; }
.login-form > p { margin: 8px 0 26px; color: var(--muted); }
.login-form .field + .field { margin-top: 16px; }
.login-form .primary-button { width: 100%; min-height: 48px; margin-top: 22px; }
.login-help { margin-top: 18px; color: var(--muted); font-size: 12px; }

.mobile-nav { display: none; }
.mobile-only { display: none; }

@media (max-width: 920px) {
  .form-layout { grid-template-columns: 1fr; }
  .tips-panel { order: -1; }
  .draft-row { grid-template-columns: 1fr 1fr; }
  .draft-row .text-button { justify-self: start; }
  .member-row { grid-template-columns: 1fr 1fr auto; }
  .member-row .member-contact { display: none; }
  .login-screen { grid-template-columns: minmax(300px, .7fr) minmax(430px, 1.3fr); }
}

@media (max-width: 720px) {
  .member-check-grid { grid-template-columns: 1fr; }
  :root {
    --brand: #1598ce;
    --brand-dark: #0878aa;
    --brand-soft: #e8f6fc;
    --ink: #111114;
    --muted: #6e6e73;
    --line: #d9d9de;
    --surface: #ffffff;
    --canvas: #f2f2f7;
    --green: #198754;
    --green-soft: #eaf6ef;
    --red: #d13b32;
    --red-soft: #fff0ef;
    --yellow-soft: #fff8d6;
  }
  html { background: var(--canvas); }
  body {
    background: var(--canvas);
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
  }
  .sidebar { display: none; }
  .main-shell { margin-left: 0; padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
  .topbar {
    min-height: 54px;
    justify-content: center;
    border-bottom-color: rgba(60, 60, 67, 0.18);
    background: rgba(249, 249, 249, 0.9);
    padding: 7px 58px;
    backdrop-filter: saturate(180%) blur(18px);
    -webkit-backdrop-filter: saturate(180%) blur(18px);
  }
  .topbar-title { text-align: center; }
  .topbar-title strong { font-size: 17px; font-weight: 650; }
  .topbar-title span { display: none; }
  .topbar-actions {
    position: absolute;
    inset: 5px 10px auto auto;
    gap: 2px;
  }
  .topbar .icon-button {
    width: 42px;
    min-height: 42px;
    border: 0;
    background: transparent;
    color: var(--brand-dark);
  }
  .topbar-actions .secondary-button { display: none; }
  .topbar-actions .primary-button { display: none; }
  .page { padding: 20px 0 32px; }
  .page-heading { align-items: center; margin-bottom: 16px; padding: 0 18px; }
  .page-heading h1 { font-size: 30px; line-height: 1.16; font-weight: 720; }
  .page-heading p { margin-top: 6px; color: var(--muted); font-size: 14px; }
  .page-heading .primary-button { min-height: 40px; padding: 0 11px; }
  .section-band,
  .form-panel,
  .manage-panel,
  .tips-panel {
    margin-bottom: 16px;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }
  .panel-heading { align-items: flex-start; border-bottom: 0; padding: 10px 18px 12px; }
  .panel-heading h2 { font-size: 20px; }
  .panel-heading p { font-size: 13px; }
  .section-band > .panel-heading,
  .form-panel > .panel-heading { align-items: stretch; flex-direction: column; }
  .section-band > .panel-heading .segmented,
  .form-panel > .panel-heading .segmented {
    display: grid;
    width: 100%;
    max-width: none;
    grid-auto-columns: minmax(0, 1fr);
    grid-auto-flow: column;
    overflow: visible;
  }
  .section-band > .panel-heading .segment,
  .form-panel > .panel-heading .segment { min-width: 0; padding: 0 5px; font-size: 13px; }
  .segmented {
    gap: 2px;
    border: 0;
    border-radius: 8px;
    background: #e5e5ea;
    padding: 2px;
  }
  .segment {
    min-height: 34px;
    border-radius: 7px;
    color: #5f5f65;
  }
  .segment.active { box-shadow: 0 1px 3px rgba(0, 0, 0, 0.14); font-weight: 650; }
  .queue-summary {
    grid-template-columns: repeat(3, 1fr);
    margin: 0 16px 10px;
    overflow: hidden;
    border: 1px solid rgba(60, 60, 67, 0.12);
    border-radius: 8px;
    background: #fff;
  }
  .queue-metric { padding: 14px 12px; border-right-color: rgba(60, 60, 67, 0.12); }
  .queue-metric span { font-size: 12px; }
  .queue-metric strong { margin-top: 4px; font-size: 25px; font-weight: 700; }
  .task-list { gap: 10px; padding: 0 16px 4px; }
  .task-card {
    grid-template-columns: 1fr;
    gap: 14px;
    overflow: hidden;
    border: 1px solid rgba(60, 60, 67, 0.12);
    border-radius: 8px;
    background: #fff;
    padding: 16px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.025);
  }
  .task-card:last-child { border-bottom: 1px solid rgba(60, 60, 67, 0.12); }
  .task-card:hover { background: #fff; }
  .task-card.is-overdue { box-shadow: inset 3px 0 0 var(--red); }
  .task-card.is-urgent:not(.is-overdue) { box-shadow: inset 3px 0 0 #e0b600; }
  .task-title-row { align-items: flex-start; flex-wrap: wrap; }
  .task-title-row h3 { font-size: 18px; font-weight: 680; }
  .task-description { color: #48484a; }
  .task-meta { display: grid; gap: 6px; margin-top: 12px; font-size: 13px; }
  .status-pill,
  .tiny-pill { min-height: 23px; border-radius: 8px; padding: 2px 7px; font-size: 11px; }
  .task-actions {
    display: grid;
    min-width: 0;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    justify-content: stretch;
    gap: 8px;
    border-top: 1px solid rgba(60, 60, 67, 0.12);
    padding-top: 12px;
  }
  .task-action {
    width: 100%;
    min-height: 46px;
    border: 0;
    border-radius: 8px;
    background: #f2f2f7;
    color: #1c1c1e;
    padding: 0 10px;
    font-size: 14px;
    font-weight: 650;
  }
  .task-action:hover { background: #e9e9ee; color: #1c1c1e; }
  .task-action.complete { flex-basis: 120px; }
  .task-action.complete { background: var(--green); color: #fff; }
  .pending-request { align-items: stretch; flex-direction: column; border: 0; border-radius: 8px; padding: 12px; }
  .pending-request-actions .task-action { min-height: 40px; }
  .empty-state {
    min-height: 180px;
    margin: 0 16px;
    border: 1px solid rgba(60, 60, 67, 0.12);
    border-radius: 8px;
    background: #fff;
  }
  .toolbar { align-items: stretch; flex-direction: column; margin: 0 16px 10px; border: 1px solid rgba(60, 60, 67, 0.12); border-radius: 8px; padding: 12px; }
  .toolbar-filters { width: 100%; }
  .search-field { min-width: 0; flex: 1 1 100%; }
  .toolbar select { flex: 1 1 130px; }
  .field-grid { grid-template-columns: 1fr; }
  .field.full { grid-column: auto; }
  .form-body,
  .manage-content {
    margin: 0 16px;
    border: 1px solid rgba(60, 60, 67, 0.12);
    border-radius: 8px;
    background: #fff;
    padding: 16px;
  }
  .form-body {
    margin: 0 16px;
    border: 1px solid rgba(60, 60, 67, 0.12);
    border-radius: 8px;
    background: #fff;
    padding: 16px;
  }
  input,
  select,
  textarea {
    min-height: 48px;
    border: 0;
    border-radius: 8px;
    background: #f2f2f7;
    padding: 11px 12px;
  }
  input:focus-visible,
  select:focus-visible,
  textarea:focus-visible { outline: 2px solid rgba(21, 152, 206, 0.28); outline-offset: 0; }
  textarea { min-height: 112px; }
  .form-actions { position: sticky; bottom: calc(73px + env(safe-area-inset-bottom)); z-index: 5; margin: 18px -16px -16px; border-radius: 0 0 8px 8px; background: rgba(255, 255, 255, 0.96); padding: 12px 16px; }
  .form-actions .primary-button { flex: 1; }
  .primary-button,
  .secondary-button,
  .danger-button,
  .icon-button,
  .text-button { border-radius: 8px; }
  .draft-row { grid-template-columns: 1fr; }
  .recurring-toolbar { align-items: stretch; flex-direction: column; margin: 0 16px; border: 1px solid rgba(60, 60, 67, 0.12); border-radius: 8px 8px 0 0; background: #fff; padding: 16px; }
  .recurring-toolbar .primary-button { align-self: stretch; }
  .recurring-list { margin: 0 16px; border: 1px solid rgba(60, 60, 67, 0.12); border-top: 0; border-radius: 0 0 8px 8px; background: #fff; padding: 0 16px; }
  .recurring-row { grid-template-columns: 1fr; gap: 10px; }
  .recurring-actions { justify-content: flex-start; flex-wrap: wrap; }
  .manage-tabs { margin: 0 16px 10px; overflow-x: auto; border: 0; padding: 0; }
  .member-row { grid-template-columns: minmax(0, 1fr) auto; gap: 10px; padding: 13px 0; }
  .member-row .member-account { display: none; }
  .member-actions .text-button { width: 38px; padding: 0; font-size: 0; }
  .member-actions .text-button .icon { width: 18px; height: 18px; }
  .screen-row { grid-template-columns: 1fr; gap: 9px; }
  .screen-actions { justify-content: flex-start; flex-wrap: wrap; }
  .screen-heading-actions { width: 100%; flex-wrap: wrap; }
  .delivery-item { grid-template-columns: 1fr; gap: 4px; }
  .modal { width: calc(100% - 16px); max-height: 92vh; margin: auto 8px 8px; border-radius: 8px; }
  .modal::backdrop { background: rgba(0, 0, 0, 0.32); backdrop-filter: blur(2px); }
  .modal-head { padding: 15px 16px; }
  .modal-body { padding: 16px; }
  .modal-foot { padding: 12px 16px; }
  .modal-body { max-height: calc(90vh - 136px); }
  .modal-foot .primary-button,
  .modal-foot .danger-button { flex: 1; }
  .toast { right: 16px; bottom: calc(82px + env(safe-area-inset-bottom)); }
  .mobile-nav {
    position: fixed;
    inset: auto 0 0 0;
    z-index: 40;
    display: grid;
    min-height: 72px;
    grid-template-columns: repeat(var(--nav-count, 4), minmax(0, 1fr));
    border-top: 1px solid rgba(60, 60, 67, 0.18);
    background: rgba(249, 249, 249, 0.92);
    padding: 5px 6px calc(5px + env(safe-area-inset-bottom));
    backdrop-filter: saturate(180%) blur(18px);
    -webkit-backdrop-filter: saturate(180%) blur(18px);
  }
  .mobile-nav .nav-button { display: grid; min-width: 0; min-height: 56px; place-items: center; align-content: center; gap: 2px; border-radius: 0; color: #747479; padding: 3px; text-align: center; }
  .mobile-nav .nav-button .icon { width: 21px; height: 21px; }
  .mobile-nav .nav-button span { max-width: 100%; overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
  .mobile-nav .nav-button.active { background: transparent; color: var(--brand-dark); }
  .mobile-only { display: inline-flex; }
  .login-screen { display: block; min-height: 100vh; background: var(--canvas); }
  .login-brand { min-height: 220px; align-items: center; justify-content: flex-start; border-bottom: 1px solid rgba(60, 60, 67, 0.12); background: #fff; color: var(--ink); padding: 38px 24px 28px; text-align: center; }
  .login-brand img { width: 118px; border-radius: 8px; }
  .login-brand-copy { margin-top: 22px; }
  .login-brand-copy h1 { font-size: 28px; line-height: 1.16; }
  .login-brand-copy p { display: none; }
  .login-panel { min-height: calc(100vh - 220px); align-items: start; padding: 28px 20px; }
  .login-form {
    border: 1px solid rgba(60, 60, 67, 0.12);
    border-radius: 8px;
    background: #fff;
    padding: 20px;
  }
  .login-form h2 { font-size: 24px; }
  .login-form > p { margin-bottom: 22px; }
  .login-form .primary-button { border-radius: 8px; }
}

@media (max-width: 430px) {
  .queue-metric span { font-size: 11px; }
  .task-meta { gap: 5px 10px; }
  .task-action { width: 100%; }
}
