:root {
  color-scheme: dark;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #d8dee9;
  background: #171b23;
  line-height: 1.4;
  --page: #171b23;
  --surface: #202630;
  --surface-raised: #262d38;
  --control: #181e27;
  --control-hover: #2c3441;
  --text: #d8dee9;
  --text-strong: #e7ebf2;
  --muted: #98a2b3;
  --border: #343d4a;
  --border-strong: #465263;
  --accent: #86a2ff;
  --accent-dark: #6f8fee;
  --accent-soft: #293552;
  --danger: #f97066;
  --warning: #fdb022;
  --success: #47cd89;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; color: var(--text); background: var(--page); }
.logout-form { margin: 0; }
.login-page { padding-top: 4rem; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 3px; font-size: 25px; line-height: 1.2; letter-spacing: -.025em; }
h2 { font-size: 16px; letter-spacing: -.01em; }

.site-header {
  position: sticky;
  z-index: 10;
  top: 0;
  height: 58px;
  border-bottom: 1px solid var(--border);
  background: rgba(32, 38, 48, .97);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(100%, 1480px);
  height: 100%;
  margin: auto;
  padding: 0 28px;
}
.brand { color: var(--text-strong); font-size: 19px; font-weight: 780; letter-spacing: -.02em; text-decoration: none; }
.header-actions { display: flex; align-items: center; gap: 15px; }
.manager-name { color: var(--muted); font-size: 12px; }
.top-nav { display: flex; align-self: stretch; gap: 4px; margin-right: auto; margin-left: 28px; }
.top-nav a { display: flex; align-items: center; padding: 0 10px; border-bottom: 2px solid transparent; color: var(--muted); font-size: 12px; font-weight: 680; text-decoration: none; }
.top-nav a:hover { color: var(--text); }
.top-nav a.is-active { border-bottom-color: var(--accent); color: var(--text-strong); }
main { width: min(100%, 1480px); margin: 0 auto; padding: 20px 28px 48px; }
.eyebrow { margin-bottom: 5px; color: var(--accent); font-size: 11px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.muted { color: var(--muted); }

.button {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  padding: 7px 13px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-weight: 680;
  text-decoration: none;
  cursor: pointer;
}
.button-primary { color: #131722; background: var(--accent); }
.button-primary:hover { background: var(--accent-dark); }
.button-secondary { border-color: var(--border-strong); color: var(--text); background: var(--surface-raised); }
.button-secondary:hover { background: var(--control-hover); }
.button-danger { border-color: #70403e; color: #f7aaa4; background: #382323; }
.button-danger:hover { background: #472929; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid rgba(134, 162, 255, .32);
  outline-offset: 2px;
}
.notice, .error { margin-bottom: 12px; padding: 9px 13px; border-radius: 8px; }
.notice { border: 1px solid #356a50; color: #9be8bd; background: #1c3329; }
.error { border: 1px solid #70403e; color: #f7aaa4; background: #382323; }

.page-intro { margin-bottom: 14px; }
.page-intro h1 { margin-bottom: 2px; }
.page-intro p { margin-bottom: 0; font-size: 12px; }
.summary { display: flex; gap: 6px; margin-bottom: 12px; }
.summary-item {
  display: flex;
  min-width: 130px;
  align-items: baseline;
  gap: 7px;
  padding: 7px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: inherit;
  background: var(--surface);
  text-decoration: none;
}
.summary-item strong { font-size: 18px; }
.summary-item span { color: var(--muted); font-size: 12px; }
.summary-item:hover, .summary-item.is-active { border-color: #607ac8; background: var(--accent-soft); }
.attention-panel { display: flex; align-items: center; gap: 14px; min-height: 40px; margin-bottom: 12px; padding: 7px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.attention-heading { display: flex; align-items: baseline; gap: 9px; white-space: nowrap; }
.attention-heading h2 { margin: 0; font-size: 13px; }
.attention-heading > span { color: var(--muted); font-size: 11px; }
.attention-list { display: flex; align-items: center; gap: 6px; min-width: 0; overflow-x: auto; }
.attention-item { padding: 3px 7px; border-radius: 999px; color: #c3cad5; background: var(--control-hover); font-size: 10px; white-space: nowrap; }
.attention-overdue, .attention-employee { color: #f6aaa4; background: #3a2728; }
.attention-today { color: #ffd18a; background: #3a3023; }
.attention-recurring { color: #bdc9ff; background: var(--accent-soft); }

.filters {
  display: flex;
  align-items: end;
  gap: 8px;
  margin-bottom: 15px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
}
.filter-tabs { display: flex; align-self: stretch; gap: 2px; padding: 2px; border-radius: 7px; background: var(--control); }
.filter-tab { display: flex; align-items: center; padding: 6px 9px; border-radius: 6px; color: var(--muted); font-size: 12px; font-weight: 650; text-decoration: none; white-space: nowrap; }
.filter-tab:hover, .filter-tab.is-active { color: #b8c7ff; background: var(--surface-raised); box-shadow: 0 1px 2px rgba(0, 0, 0, .24); }
.field { display: block; color: var(--text); font-size: 12px; font-weight: 650; }
.field > span, fieldset > legend { display: block; margin-bottom: 5px; }
.field small, .field-help { color: var(--muted); font-weight: 400; }
input, select, textarea { width: 100%; min-height: 38px; padding: 8px 10px; border: 1px solid var(--border-strong); border-radius: 7px; color: var(--text); background: var(--control); }
input::placeholder, textarea::placeholder { color: #778293; }
input:hover, select:hover, textarea:hover { border-color: #5b687a; }
input:disabled, select:disabled, textarea:disabled, button:disabled { color: #737d8c; background: #20252e; cursor: not-allowed; opacity: .72; }
textarea { resize: vertical; }
.filters .field > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
.compact { width: 170px; margin-left: auto; }
.search-field { width: min(230px, 18vw); }
.sort-field { width: 150px; }
.filter-submit { min-height: 38px; padding: 7px 10px; border: 1px solid var(--border-strong); border-radius: 7px; color: var(--text); background: var(--surface-raised); font-size: 12px; font-weight: 680; cursor: pointer; }
.filter-submit:hover { border-color: #667387; background: var(--control-hover); }
.clear-filter { align-self: center; padding: 6px 3px; font-size: 12px; }

.dashboard-layout { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 18px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 7px; }
.section-heading h2 { margin: 0; }
.section-heading > span { padding: 2px 7px; border-radius: 999px; color: var(--muted); background: var(--control-hover); font-size: 11px; }
.task-list { display: grid; gap: 5px; }
.task-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; overflow: hidden; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.task-card:hover { border-color: var(--border-strong); background: #232a35; box-shadow: 0 2px 8px rgba(0, 0, 0, .16); }
.task-main {
  display: grid;
  grid-template-columns: 8px minmax(220px, 1fr) minmax(130px, .34fr) minmax(105px, .22fr);
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 9px 11px;
  color: inherit;
  text-decoration: none;
}
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.due-overdue .status-dot { background: var(--danger); }
.due-today .status-dot { background: var(--warning); }
.due-future .status-dot { background: var(--success); }
.status-completed .status-dot, .status-closed .status-dot, .status-archived .status-dot { background: #778293; }
.status-completed .task-title, .status-closed .task-title, .status-archived .task-title { color: #aab3c0; }
.task-copy { min-width: 0; }
.task-title { display: block; overflow: hidden; font-size: 13px; font-weight: 680; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
.task-labels { display: flex; align-items: center; gap: 5px; min-height: 16px; margin-top: 2px; color: var(--muted); font-size: 10px; }
.status-chip, .group-chip { padding: 1px 5px; border-radius: 999px; color: #aeb7c5; background: #303845; font-size: 10px; font-weight: 680; }
.group-chip { color: #b8c7ff; background: var(--accent-soft); }
.task-assignee, .task-deadline { overflow: hidden; color: #b0b9c7; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.task-assignee { font-weight: 620; }
.due-overdue .deadline { color: var(--danger); font-weight: 680; }
.due-today .deadline { color: var(--warning); font-weight: 680; }
.task-actions { display: flex; align-items: center; gap: 9px; padding: 0 11px; border-left: 1px solid var(--border); }
.task-actions a { font-size: 11px; font-weight: 680; text-decoration: none; }

.team-panel { height: max-content; padding: 12px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); }
.team-list { display: grid; gap: 1px; }
.team-member { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 6px; border-radius: 7px; color: inherit; text-decoration: none; }
.team-member:hover, .team-member.is-active { background: var(--control-hover); }
.avatar { display: grid; width: 26px; height: 26px; place-items: center; border-radius: 50%; color: #c4d0ff; background: var(--accent-soft); font-size: 11px; font-weight: 750; }
.team-name { overflow: hidden; font-size: 12px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.workload { color: var(--muted); font-size: 11px; text-align: right; white-space: nowrap; }
.workload b { color: var(--text); font-size: 12px; }
.workload em { color: var(--danger); font-style: normal; }
.workload .today-work { color: var(--warning); }
.idle-team { margin-top: 5px; padding-top: 5px; border-top: 1px solid var(--border); }
.idle-team summary { padding: 5px 6px; color: var(--muted); font-size: 11px; cursor: pointer; }
.empty-state { padding: 28px; border: 1px dashed var(--border-strong); border-radius: 9px; background: var(--surface); text-align: center; }
.empty-state strong, .empty-state span { display: block; }
.empty-state span { margin-top: 4px; color: var(--muted); font-size: 12px; }

.narrow-page { max-width: 760px; margin: 0 auto; }
.back-link { display: inline-block; margin-bottom: 14px; color: var(--muted); font-size: 13px; text-decoration: none; }
.composer-heading { margin-bottom: 15px; }
.composer-heading .muted { margin-bottom: 0; font-size: 13px; }
.create-mode { display: inline-flex; gap: 2px; margin: 8px 0 10px; padding: 2px; border-radius: 8px; background: var(--control); }
.create-mode a { padding: 6px 13px; border-radius: 6px; color: var(--muted); font-size: 12px; font-weight: 680; text-decoration: none; }
.create-mode a.is-active { color: #c3ceff; background: var(--surface-raised); box-shadow: 0 1px 2px rgba(0, 0, 0, .24); }
.composer-card, .panel, .detail-hero { padding: 24px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
.composer-card { display: grid; gap: 19px; }
.task-input textarea { min-height: 130px; font-size: 17px; }
.composer-card fieldset { margin: 0; padding: 0; border: 0; }
.check-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.person-check { display: flex; align-items: center; gap: 9px; padding: 10px; border: 1px solid var(--border); border-radius: 9px; font-size: 13px; font-weight: 600; }
.person-check:has(input:checked) { border-color: #607ac8; background: var(--accent-soft); }
.person-check input { width: 18px; min-height: auto; margin: 0; }
.preset-row { display: flex; flex-wrap: wrap; gap: 7px; }
.preset { padding: 8px 11px; border: 1px solid var(--border-strong); border-radius: 8px; color: var(--text); background: var(--surface-raised); cursor: pointer; }
.preset:hover { border-color: #7188d3; color: #c3ceff; background: var(--control-hover); }
.date-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.form-actions { display: flex; align-items: center; gap: 15px; padding-top: 4px; }
.form-actions > a { font-size: 13px; }

.detail-page { max-width: 920px; margin: 0 auto; }
.detail-hero { margin-bottom: 16px; border-left: 4px solid var(--muted); }
.detail-hero.due-overdue { border-left-color: var(--danger); }
.detail-hero.due-today { border-left-color: var(--warning); }
.detail-hero h1 { max-width: 760px; overflow-wrap: anywhere; font-size: 27px; }
.detail-facts { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 16px; margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--border); }
.detail-facts span { display: block; margin-bottom: 3px; color: var(--muted); font-size: 11px; }
.detail-facts strong { font-size: 13px; }
.detail-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; margin-bottom: 16px; }
.panel h2 { margin-bottom: 5px; }
.inline-form { margin-top: 17px; }
.inline-form .field { margin-bottom: 12px; }
.inline-form textarea { min-height: 76px; }
.siblings { margin-bottom: 16px; }
.siblings > a { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--border); color: inherit; text-decoration: none; }
.siblings > a:last-child { border: 0; }
.history-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; }
.history h3 { font-size: 13px; }
.history p { color: #b0b9c7; font-size: 12px; }

.workspace-panel { margin-bottom: 14px; padding: 14px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); }
.team-table { display: grid; gap: 3px; }
.team-row { display: grid; grid-template-columns: 28px minmax(150px, 1.4fr) repeat(4, minmax(72px, .55fr)) auto; align-items: center; gap: 10px; padding: 8px; border-radius: 7px; background: var(--control); }
.team-row:hover { background: var(--control-hover); }
.team-row > strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.team-row > span:not(.avatar) { display: grid; }
.team-row b { font-size: 13px; }
.team-row small { color: var(--muted); font-size: 9px; }
.team-row > a { font-size: 11px; font-weight: 680; text-decoration: none; white-space: nowrap; }
.metric-danger b { color: var(--danger); }
.leaders-panel { margin-top: 18px; }
.leader-list { display: flex; flex-wrap: wrap; gap: 6px; }
.leader-list > div { display: grid; grid-template-columns: 26px auto; align-items: center; column-gap: 8px; min-width: 190px; padding: 7px; border-radius: 7px; background: var(--control); }
.leader-list > div > span:last-child { grid-column: 2; color: var(--muted); font-size: 10px; }

.recurring-list { display: grid; gap: 6px; }
.recurring-intro { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.recurring-card { display: grid; grid-template-columns: minmax(220px, 1fr) auto 100px 180px 90px 140px; align-items: center; gap: 12px; padding: 11px 13px; border: 1px solid var(--border); border-radius: 9px; color: inherit; background: var(--surface); text-decoration: none; }
.recurring-card:hover { border-color: var(--border-strong); background: #232a35; }
.recurring-card.is-paused { opacity: .72; }
.recurring-main { min-width: 0; }
.recurring-title, .recurring-description { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recurring-title { font-size: 13px; font-weight: 700; }
.recurring-description, .recurring-meta, .recurring-today { color: var(--muted); font-size: 10px; }
.recurring-meta b { color: var(--text); font-size: 12px; }
.status-chip.is-enabled { color: #9be8bd; background: #21372d; }
.recurring-detail-page { max-width: 1050px; margin: 0 auto; }
.recurring-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.recurring-actions { display: flex; align-items: center; gap: 8px; }
.recurring-heading h1 { margin-bottom: 5px; }
.schedule-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 18px; }
.schedule-grid > div { display: grid; gap: 2px; padding: 10px; border-radius: 7px; background: var(--control); }
.schedule-grid > div.is-disabled { opacity: .6; }
.schedule-grid b { color: #c3ceff; font-size: 16px; }
.schedule-grid span { color: var(--muted); font-size: 10px; }
.schedule-note { margin: 11px 0 0; color: var(--muted); font-size: 11px; }
.pause-control { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border); }
.pause-control details summary { color: var(--danger); font-size: 11px; cursor: pointer; }
.pause-control details p { max-width: 600px; margin: 8px 0; color: var(--muted); font-size: 11px; }
.recurring-detail-grid { display: grid; grid-template-columns: .8fr 1.2fr; gap: 14px; }
.status-counts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.status-counts > div { display: grid; padding: 9px; border-radius: 7px; background: var(--control); }
.status-counts b { font-size: 18px; }
.status-counts span { color: var(--muted); font-size: 10px; }
.participant-list { display: grid; gap: 2px; }
.participant-list > div { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 6px; border-radius: 7px; background: var(--control); }
.participant-list strong { overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.participant-status { color: var(--muted); font-size: 10px; }
.status-submitted { color: var(--success); }
.status-skipped, .status-missed { color: var(--warning); }
.status-invalid { color: var(--danger); }
.checkin-history { display: grid; gap: 2px; }
.checkin-history > div { display: grid; grid-template-columns: minmax(100px, 1fr) 70px minmax(180px, 1fr); align-items: center; gap: 10px; padding: 7px 9px; border-radius: 6px; background: var(--control); }
.checkin-history time { font-size: 11px; }
.checkin-history strong { font-size: 12px; }
.checkin-history span { color: var(--muted); font-size: 10px; }
.summary-recipients p { margin: 0; color: var(--muted); font-size: 11px; }
.recurring-form-page { max-width: 820px; }
.recurring-form .field-help { margin: 0 0 8px; font-size: 11px; }
.toggle-row { display: flex; align-items: flex-start; gap: 9px; padding: 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--control); }
.toggle-row input { width: 18px; min-height: 18px; margin: 1px 0 0; }
.toggle-row span { display: grid; }
.toggle-row b { font-size: 12px; }
.toggle-row small { color: var(--muted); font-size: 10px; }
.stage-editor { display: grid; gap: 6px; }
.stage-row { display: grid; grid-template-columns: 18px minmax(0, 1fr) 110px; align-items: center; gap: 10px; padding: 9px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--control); }
.stage-row > input[type="checkbox"] { width: 18px; min-height: 18px; margin: 0; }
.stage-row > span { font-size: 12px; font-weight: 650; }
.stage-row > input[type="time"] { min-height: 34px; padding: 6px 8px; }

@media (max-width: 1080px) {
  .filters { flex-wrap: wrap; }
  .filter-tabs { width: 100%; overflow-x: auto; }
  .compact { margin-left: 0; }
  .task-main { grid-template-columns: 8px minmax(180px, 1fr) minmax(120px, .32fr) 100px; }
  .recurring-card { grid-template-columns: minmax(220px, 1fr) auto 90px 160px; }
  .recurring-card > :nth-last-child(-n+2) { display: none; }
}

@media (max-width: 900px) {
  .dashboard-layout { grid-template-columns: 1fr; }
  .team-panel { order: -1; }
  .team-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-grid { grid-template-columns: 1fr; }
  .team-row { grid-template-columns: 28px minmax(130px, 1fr) repeat(3, 64px) auto; }
  .team-row > span:nth-of-type(5) { display: none; }
  .recurring-detail-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .site-header { height: 56px; }
  .header-inner, main { padding-right: 14px; padding-left: 14px; }
  main { padding-top: 16px; }
  .manager-name { display: none; }
  .header-inner { gap: 8px; }
  .top-nav { order: 3; position: absolute; top: 56px; right: 0; left: 0; height: 38px; margin: 0; padding: 0 14px; border-bottom: 1px solid var(--border); background: var(--surface); }
  .top-nav a { flex: 1; justify-content: center; }
  main { padding-top: 54px; }
  .header-actions .button { min-height: 36px; padding: 6px 10px; }
  .page-intro .muted { display: none; }
  .summary { display: grid; grid-template-columns: repeat(2, 1fr); }
  .summary-item { min-width: 0; }
  .filters { align-items: stretch; }
  .filter-tabs { overflow-x: auto; }
  .compact, .search-field, .sort-field { width: 100%; min-width: 0; }
  .filter-submit { width: 100%; }
  .task-card { grid-template-columns: 1fr; }
  .task-main { grid-template-columns: 8px minmax(0, 1fr); gap: 8px; padding: 10px 11px 6px; }
  .task-assignee, .task-deadline { grid-column: 2; }
  .task-assignee { margin-top: 3px; }
  .task-actions { justify-content: flex-start; padding: 7px 11px 9px 29px; border-top: 1px solid var(--border); border-left: 0; }
  .team-list, .check-grid, .date-fields, .detail-facts, .history-grid { grid-template-columns: 1fr; }
  .composer-card, .panel, .detail-hero { padding: 18px; }
  .form-actions { flex-wrap: wrap; align-items: flex-start; }
  .detail-hero h1 { font-size: 23px; }
  .attention-panel { align-items: flex-start; flex-direction: column; gap: 5px; }
  .attention-list { width: 100%; }
  .team-row { grid-template-columns: 28px minmax(0, 1fr) repeat(2, 54px); gap: 7px; }
  .team-row > span:nth-of-type(4), .team-row > span:nth-of-type(5), .team-row > a { display: none; }
  .recurring-card { grid-template-columns: minmax(0, 1fr) auto; gap: 7px; }
  .recurring-card > :not(.recurring-main):not(.status-chip):not(.recurring-today) { display: none; }
  .recurring-today { display: block; grid-column: 1 / -1; }
  .schedule-grid, .status-counts { grid-template-columns: 1fr; }
  .recurring-intro { align-items: flex-start; }
  .recurring-intro .button { min-height: 34px; padding: 6px 9px; font-size: 11px; }
  .recurring-heading { flex-direction: column; }
  .recurring-actions { width: 100%; justify-content: space-between; }
  .stage-row { grid-template-columns: 18px minmax(0, 1fr) 92px; gap: 7px; }
  .checkin-history > div { grid-template-columns: 1fr auto; }
  .checkin-history span { grid-column: 1 / -1; }
}
