:root {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  color: #272331;
  background: #f5f6f8;
  --purple: #5537a5;
  --purple-hover: #452989;
  --muted: #686474;
  --line: #e3e4ea;
  --soft: #f0ebfa;
  --surface: #fff;
  --danger: #a72c42;
  --danger-soft: #fff1f3;
  --warning: #8a591b;
  --warning-soft: #fff6e7;
  --success: #276649;
  --success-soft: #edf7f1;
  --radius: 16px;
  --nav-height: 76px;
}

* { box-sizing: border-box; }
html { scroll-padding-top: 88px; }
body { margin: 0; min-width: 280px; }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea, summary { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button, summary { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .58; }
a { color: var(--purple); text-underline-offset: 3px; }
:is(button, a, input, select, textarea, summary):focus-visible { outline: 3px solid #9877df; outline-offset: 3px; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: 1.7rem; line-height: 1.2; letter-spacing: -.035em; }
h2 { font-size: 1.125rem; line-height: 1.35; letter-spacing: -.02em; }
h3 { font-size: 1rem; line-height: 1.4; }
p { line-height: 1.55; }
svg { display: block; flex-shrink: 0; }
.muted, small { color: var(--muted); }
small { font-size: .8125rem; line-height: 1.45; }
[hidden] { display: none !important; }

/* Header and account */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 72px; padding: 10px max(16px, calc((100vw - 1200px) / 2)); background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; flex-shrink: 0; }
.brand strong { display: block; font-size: 1rem; line-height: 1.2; letter-spacing: .16em; }
.brand small { display: block; margin-top: 2px; font-size: .6875rem; }
.mark { display: grid; place-items: center; width: 40px; height: 44px; border-radius: 12px; background: var(--purple); color: #fff; font-size: 1.6rem; font-weight: 750; }
#account { display: flex; align-items: center; justify-content: flex-end; gap: 8px; min-width: 0; font-size: .8125rem; }
#account .name { max-width: 108px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-menu, .profile-menu { position: relative; }
.account-menu > summary, .profile-menu > summary { display: flex; align-items: center; justify-content: center; gap: 8px; min-width: 48px; min-height: 48px; padding: 4px; border: 1px solid transparent; border-radius: 12px; list-style: none; }
summary::-webkit-details-marker { display: none; }
.account-menu[open] > summary, .profile-menu[open] > summary { background: var(--soft); border-color: #d8cbed; }
.account-initials { display: grid; place-items: center; width: 36px; height: 36px; flex-shrink: 0; border-radius: 50%; background: var(--soft); color: var(--purple); font-size: .8125rem; font-weight: 750; }
.account-popover { position: absolute; top: calc(100% + 8px); right: 0; z-index: 40; display: grid; gap: 6px; width: min(280px, calc(100vw - 32px)); padding: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 12px 36px #2723311a; overflow-wrap: anywhere; }
.account-popover p { margin: 0 0 8px; font-size: .875rem; }
.account-popover strong { display: block; color: #272331; }
.account-popover .button { width: 100%; justify-content: flex-start; }

/* Overview and list controls */
#app { width: 100%; max-width: 1200px; margin: 0 auto; padding: 24px 16px calc(var(--nav-height) + 32px + env(safe-area-inset-bottom)); }
.heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.heading > div { min-width: 0; }
.heading p { margin: 0; color: var(--muted); font-size: .875rem; }
.heading > .button { flex-shrink: 0; }
.eyebrow { margin-bottom: 10px; color: var(--purple); font-size: .6875rem; font-weight: 750; line-height: 1.5; letter-spacing: .12em; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 12px 16px; border: 1px solid transparent; border-radius: 12px; background: var(--purple); color: #fff; font-size: .875rem; font-weight: 650; line-height: 1.35; text-align: center; text-decoration: none; }
.button svg { width: 18px; height: 18px; }
.button.secondary { background: var(--soft); color: var(--purple); }
.button.ghost { background: var(--surface); border-color: var(--line); color: #514b60; }
.small-button { min-height: 48px; padding: 10px 12px; font-size: .8125rem; }
.full { width: 100%; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 16px; }
.toolbar .button { flex-shrink: 0; }
.hero-summary { padding: 20px; margin-bottom: 20px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); }
.hero-summary .heading { margin-bottom: 12px; }
.hero-summary h1 { font-size: 1.75rem; }
.overview-caption { display: block; margin: 8px 0 0; color: var(--muted); font-size: .8125rem; line-height: 1.5; }
.status-count { display: inline-flex; align-items: center; justify-content: center; min-width: 24px; min-height: 24px; padding: 2px 7px; margin-left: 4px; border-radius: 7px; background: var(--soft); color: var(--purple); font-size: .75rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.scope-tabs { display: flex; gap: 4px; width: 100%; padding: 4px; border: 1px solid var(--line); border-radius: 14px; background: #ebedf1; }
.scope-tab { display: flex; align-items: center; justify-content: center; gap: 6px; flex: 1; min-height: 48px; min-width: 0; padding: 10px; border: 1px solid transparent; border-radius: 10px; background: transparent; color: var(--muted); font-size: .875rem; font-weight: 650; text-decoration: none; }
.scope-tab:is(.active, .selected, [aria-selected="true"], [aria-pressed="true"]) { background: var(--surface); color: var(--purple); border-color: #ded9e9; box-shadow: 0 1px 3px #27233108; }
.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 16px 0 24px; }
.metric { min-width: 0; padding: 14px 10px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.metric small { display: block; min-height: 2.8em; font-size: .75rem; line-height: 1.4; }
.metric strong { display: block; margin-top: 5px; font-size: clamp(1.3rem, 5.6vw, 2rem); font-weight: 750; line-height: 1.2; letter-spacing: -.035em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.metric-button { display: block; width: 100%; min-height: 96px; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.metric-button.selected, .metric-button[aria-pressed="true"] { border-color: var(--purple); background: #f7f3ff; box-shadow: inset 0 0 0 1px var(--purple); }
.metric-button.selected small { color: var(--purple); }
.hero-summary .metrics { margin-bottom: 0; }
.list-controls { display: flex; flex-direction: column; gap: 12px; margin: 20px 0; }
.filters, .filter-bar { display: flex; flex-direction: column; gap: 10px; margin: 0 0 20px; }
.filters input, .filter-bar input { margin: 0; flex: 1; min-width: 0; }
.filters select, .filter-bar select { margin: 0; }
.filter-bar .button { flex-shrink: 0; }
.list-controls .filters, .list-controls .filter-bar { margin: 0; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 12px; }
.section-heading h2, .section-heading h3 { margin: 0; }
.section-heading small { flex-shrink: 0; }
.job-section { margin: 24px 0 28px; }
.job-section:first-child { margin-top: 0; }

/* Job cards */
.cards { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.cards > .empty { grid-column: 1 / -1; }
.job-card { display: flex; flex-direction: column; min-width: 0; padding: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: inherit; text-decoration: none; }
.card-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.tag, .date-status, .sync-badge { display: inline-flex; align-items: center; gap: 5px; max-width: 100%; padding: 5px 8px; border-radius: 7px; background: var(--soft); color: var(--purple); font-size: .75rem; font-weight: 600; line-height: 1.4; }
.tag.late, .date-status.late { color: var(--danger); background: var(--danger-soft); }
.date-status.soon { color: var(--warning); background: var(--warning-soft); }
.tag.done, .date-status.done { color: var(--success); background: var(--success-soft); }
.date-status { font-weight: 650; }
.date-status svg { width: 15px; height: 15px; }
.job-card h2 { margin-bottom: 4px; font-size: 1.125rem; overflow-wrap: anywhere; }
.job-card p { margin-bottom: 12px; color: var(--muted); font-size: .875rem; }
.job-card .job-vendor { margin-bottom: 5px; color: #514b60; font-size: .875rem; font-weight: 550; overflow-wrap: anywhere; }
.job-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 12px; margin-top: 12px; color: var(--muted); font-size: .75rem; line-height: 1.5; overflow-wrap: anywhere; }
.job-meta small { font-size: inherit; }
.quantity-main { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; margin: 8px 0 12px; color: var(--muted); font-size: .8125rem; }
.quantity-main strong { color: #272331; font-size: 2rem; font-weight: 750; line-height: 1.1; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.quantity-main strong small { font-size: .75rem; font-weight: 500; letter-spacing: normal; }
.quantity-main > small { display: block; }
.numbers { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; padding-top: 14px; border-top: 1px solid var(--line); }
.numbers > div { min-width: 0; }
.numbers small { display: block; font-size: .75rem; }
.numbers strong { display: block; margin-top: 4px; font-size: 1.125rem; line-height: 1.3; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.progress-track { display: block; width: 100%; height: 6px; overflow: hidden; border: 0; border-radius: 10px; background: #edeaf2; color: var(--purple); accent-color: var(--purple); }
progress.progress-track { appearance: none; -webkit-appearance: none; }
progress.progress-track::-webkit-progress-bar { border-radius: 10px; background: #edeaf2; }
progress.progress-track::-webkit-progress-value { border-radius: 10px; background: var(--purple); }
progress.progress-track::-moz-progress-bar { border-radius: 10px; background: var(--purple); }
progress.progress-track.done::-webkit-progress-value { background: var(--success); }
progress.progress-track.done::-moz-progress-bar { background: var(--success); }
.progress-fill { display: block; height: 100%; max-width: 100%; min-width: 0; border-radius: inherit; background: var(--purple); }
.progress-fill.done { background: var(--success); }
.card-bottom { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 12px; margin-top: 14px; color: var(--muted); font-size: .75rem; line-height: 1.5; }
.job-card .notice { padding: 10px; margin: 12px 0 0; font-size: .8125rem; }
.job-card > small:last-child { margin-top: 12px; }
.empty { padding: 28px 20px; border: 1px dashed #cfd0d9; border-radius: var(--radius); background: var(--surface); color: var(--muted); font-size: .875rem; line-height: 1.65; text-align: center; }
.empty p { margin: 12px 0 0; }
.empty .button { margin-top: 8px; }
.last-updated { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin: 20px 0 0; color: var(--muted); font-size: .75rem; }

/* Navigation and connection status */
.navigation { position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; min-height: var(--nav-height); padding: 8px max(10px, env(safe-area-inset-left)) calc(8px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--surface); }
.navigation a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 56px; min-width: 0; padding: 6px; border-radius: 12px; color: var(--muted); font-size: .75rem; font-weight: 650; line-height: 1.3; text-decoration: none; }
.navigation a.active { background: var(--soft); color: var(--purple); }
.nav-icon { display: flex; align-items: center; justify-content: center; }
.nav-icon svg { width: 22px; height: 22px; }
.navigation .status-count { min-width: 18px; min-height: 18px; padding: 1px 5px; font-size: .625rem; }
.connection { position: relative; z-index: 21; padding: 12px 16px; background: var(--warning-soft); color: var(--warning); font-size: .8125rem; font-weight: 550; line-height: 1.5; text-align: center; }
.toast { position: fixed; bottom: calc(var(--nav-height) + 16px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); z-index: 60; width: max-content; max-width: calc(100vw - 32px); padding: 14px 18px; border-radius: 12px; background: #302b3c; color: #fff; font-size: .875rem; line-height: 1.5; box-shadow: 0 8px 28px #27233126; }
.sync-badge { background: #f1f2f5; color: var(--muted); font-size: .6875rem; }
.sync-badge.saved { background: var(--success-soft); color: var(--success); }
.sync-badge.pending { background: var(--warning-soft); color: var(--warning); }
.sync-badge.error { background: var(--danger-soft); color: var(--danger); }
.sync-badge svg { width: 14px; height: 14px; }
.sync-panel { margin-bottom: 20px; padding: 16px; border: 1px solid #ebd6b5; border-radius: var(--radius); background: var(--warning-soft); }
.sync-panel h2 { margin-bottom: 6px; font-size: 1rem; }
.sync-panel p { margin: 0; font-size: .8125rem; }
.sync-item { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 0; border-bottom: 1px solid #e8d9c4; }
.sync-item:last-child { padding-bottom: 0; border-bottom: 0; }
.sync-item > div { min-width: 0; flex: 1; }
.sync-item strong { display: block; font-size: .875rem; overflow-wrap: anywhere; }
.sync-item .button { flex-shrink: 0; }

/* Job details */
.panel { min-width: 0; margin: 16px 0; padding: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.panel > :last-child { margin-bottom: 0; }
.cards > .panel { margin: 0; }
.cards > .panel > h2 { margin-top: 12px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.actions .button { flex: 1; min-width: 112px; }
#app:has(.detail-header) { padding-bottom: calc(var(--nav-height) + 156px + env(safe-area-inset-bottom)); }
#app:has(.detail-header) > .actions { position: fixed; left: 12px; right: 12px; bottom: calc(var(--nav-height) + 10px + env(safe-area-inset-bottom)); z-index: 25; padding: 10px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: 0 6px 24px #27233114; }
#app:has(.detail-header) > .actions .button { padding: 10px 8px; font-size: .8125rem; }
#app:has(.detail-header) ~ .toast { bottom: calc(var(--nav-height) + 142px + env(safe-area-inset-bottom)); }
.line { padding: 14px 0; border-bottom: 1px solid var(--line); }
.line:last-child { border-bottom: 0; }
.line-heading { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 12px; margin-bottom: 6px; }
.line-heading strong { font-size: .875rem; overflow-wrap: anywhere; }
.line p { margin: 0; font-size: .8125rem; line-height: 1.7; }
.history { list-style: none; margin: 0; padding: 0; }
.history li { padding: 16px 0; border-bottom: 1px solid var(--line); }
.history li:first-child { padding-top: 4px; }
.history li:last-child { border: 0; padding-bottom: 0; }
.history strong { font-size: .875rem; }
.history li > strong { display: block; }
.history li > .sync-badge { margin-bottom: 8px; }
.history small { display: block; margin-top: 5px; font-size: .75rem; }
.history p { margin: 8px 0 0; font-size: .8125rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.back { display: inline-flex; align-items: center; min-height: 48px; margin: -8px 0 12px; text-decoration: none; font-size: .875rem; font-weight: 600; }
.detail-header h1 { margin-top: 12px; overflow-wrap: anywhere; }
.detail-header p { margin: 8px 0; color: var(--muted); font-size: .875rem; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; margin-top: 20px; }
.detail-grid .panel { margin-top: 0; }
.quality-summary { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin: 16px 0; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #f7f8fa; }
.quality-summary strong { display: block; font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.quality-summary p { margin: 4px 0 0; font-size: .8125rem; }
.score-empty { color: var(--muted); font-size: .8125rem; font-weight: 500; line-height: 1.5; }
.score-empty strong { color: #514b60; font-size: .875rem; font-weight: 600; }
.score-empty small { display: block; margin-top: 4px; font-size: .75rem; }

/* Login and form fields */
.login { width: 100%; max-width: 440px; margin: 16px auto 32px; padding: 24px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); }
.login h1 { font-size: 1.75rem; }
.login > .muted { margin-bottom: 20px; font-size: .9375rem; }
.login > p:last-child { margin: 14px 0 0; }
.login > p:last-child small { font-size: .75rem; line-height: 1.5; }
label { display: block; margin-bottom: 18px; color: #373141; font-size: .875rem; font-weight: 600; line-height: 1.45; }
input, select, textarea { display: block; width: 100%; min-height: 48px; min-width: 0; margin-top: 7px; padding: 12px 13px; border: 1px solid #cbcbd5; border-radius: 10px; background: var(--surface); color: #272331; font-size: 1rem; font-weight: 400; line-height: 1.4; }
input::placeholder, textarea::placeholder { color: #7a7584; opacity: 1; }
textarea { min-height: 104px; resize: vertical; }
input:disabled, select:disabled, textarea:disabled { background: #f1f2f5; color: #716b7b; }
label small { display: block; margin-top: 6px; color: var(--muted); font-size: .75rem; font-weight: 400; }
input[type="checkbox"], input[type="radio"] { display: inline-block; width: 20px; min-height: 20px; margin: 0 8px 0 0; accent-color: var(--purple); vertical-align: middle; }
input[type="search"] { padding-right: 12px; }
.field-error { display: block; margin: 6px 0 0; color: var(--danger); font-size: .75rem; font-weight: 500; line-height: 1.5; }
.field-error:empty { display: none; }
.field-invalid, [aria-invalid="true"] { border-color: var(--danger); background: #fffafb; }
.field-invalid:focus-visible, [aria-invalid="true"]:focus-visible { outline-color: #c65169; }
.form-error { margin: 14px 0; padding: 12px; border: 1px solid #efc7d1; border-radius: 10px; background: var(--danger-soft); color: var(--danger); font-size: .8125rem; font-weight: 500; line-height: 1.55; overflow-wrap: anywhere; }
.form-error:empty { display: none; }
.notice { margin: 16px 0; padding: 14px; border-radius: 12px; background: var(--soft); color: #54416f; font-size: .8125rem; line-height: 1.6; overflow-wrap: anywhere; }
.form-intro { margin: 0 0 20px; color: var(--muted); font-size: .875rem; line-height: 1.6; }
.form-intro p { margin: 0; }
.form-intro strong, .form-intro span { display: block; }
.form-intro strong { color: #373141; }
.form-summary { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin: 0 0 20px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #f5f6f8; font-size: .8125rem; line-height: 1.5; }
.form-summary strong { display: block; color: #272331; font-size: 1rem; }
.form-summary p { margin: 0; }
.form-summary small { font-size: .75rem; }
.form-footer { position: sticky; bottom: 0; z-index: 3; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-top: 20px; padding: 16px 0 max(16px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--surface); }
.form-footer > .button { flex: 1; min-width: 150px; }
.form-footer > p, .form-footer > small, .form-footer > .sync-badge { margin: 0; }
.form-footer > p, .form-footer > small { flex-basis: 100%; font-size: .75rem; }
.form-footer > .form-summary { flex-basis: 100%; margin: 0; padding: 10px 12px; }
.form-footer > .form-summary strong { font-size: .875rem; overflow-wrap: anywhere; }
.form-footer > .form-error:not(:empty) { padding: 10px 12px; }
.optional-fields { margin: 18px 0; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.optional-fields > summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; padding: 14px; color: #514b60; font-size: .875rem; font-weight: 650; line-height: 1.5; list-style: none; }
.optional-fields > summary::after { content: "+"; color: var(--muted); font-size: 1.25rem; line-height: 1; }
.optional-fields[open] > summary::after { content: "−"; }
.optional-fields[open] > summary { border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.optional-fields > :not(summary) { margin-right: 14px; margin-left: 14px; }
.two-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.two-fields label { min-width: 0; }
.variant-fields { margin: 12px 0; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #f7f8fa; }
.variant-fields .two-fields { gap: 10px; }
.variant-fields label { margin-bottom: 12px; }
.variant-fields > :last-child { margin-bottom: 0; }
.variant-title { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 8px; font-size: .875rem; font-weight: 600; }
.remove-line { min-width: 48px; min-height: 48px; padding: 10px 8px; border: 0; border-radius: 8px; background: transparent; color: var(--danger); font-size: .8125rem; }

/* The dialog shell stays fixed; forms scroll inside it. */
dialog { width: 100%; height: 100dvh; max-width: none; max-height: 100dvh; margin: 0; padding: 0; border: 0; border-radius: 0; background: var(--surface); color: inherit; overflow: hidden; }
dialog::backdrop { background: #21182b80; }
dialog[open] { display: flex; flex-direction: column; }
#dialog-content { display: flex; flex-direction: column; width: 100%; height: 100%; max-height: 100%; min-height: 0; padding: env(safe-area-inset-top) 0 0; }
dialog .heading { flex-shrink: 0; align-items: center; gap: 16px; margin: 0; padding: 12px 20px; border-bottom: 1px solid var(--line); background: var(--surface); }
dialog .heading h2 { margin: 0; font-size: 1.125rem; }
dialog .heading > .button { min-width: 48px; padding: 10px; }
dialog .form-intro { flex-shrink: 0; margin-bottom: 0; padding-top: 16px; }
#dialog-content > form { flex: 1; min-height: 0; margin: 0; padding: 20px 20px 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
#dialog-content > form:not(:has(.form-footer)) { padding-bottom: max(24px, env(safe-area-inset-bottom)); }
#dialog-content > form > .form-footer { margin-right: -20px; margin-left: -20px; padding-right: 20px; padding-left: 20px; }
#dialog-content > :not(.heading):not(form) { margin-right: 20px; margin-left: 20px; }

@media (hover: hover) {
  .button:not(:disabled):hover { background: var(--purple-hover); }
  .button.secondary:not(:disabled):hover { background: #e7ddf7; }
  .button.ghost:not(:disabled):hover { background: #f5f4f8; border-color: #c7bddb; }
  .job-card:hover { border-color: #b5a0d7; }
  .scope-tab:hover { color: var(--purple); }
  .remove-line:hover { background: var(--danger-soft); }
  .navigation a:hover { background: #f5f2fa; color: var(--purple); }
}

@media (min-width: 600px) {
  .topbar { padding-right: 24px; padding-left: 24px; }
  #app { padding-right: 24px; padding-left: 24px; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
  .metrics { gap: 12px; }
  .metric { padding: 18px; }
  .metric small { min-height: auto; font-size: .8125rem; }
  .metric strong { font-size: 2rem; }
  .hero-summary { padding: 24px; }
  .filters, .filter-bar { flex-direction: row; align-items: center; }
  .filters select, .filter-bar select { width: 190px; flex-shrink: 0; }
  .scope-tabs { width: auto; min-width: 280px; }
  .toolbar { flex-wrap: nowrap; }
  .login { margin-top: 48px; padding: 32px; }
  #app:has(.detail-header) > .actions { left: 50%; right: auto; transform: translateX(-50%); width: min(720px, calc(100% - 48px)); }
  dialog { width: min(640px, calc(100vw - 48px)); height: auto; max-height: min(90dvh, 900px); margin: auto; border: 1px solid var(--line); border-radius: 20px; box-shadow: 0 24px 80px #21182b38; }
  #dialog-content { height: auto; max-height: min(90dvh, 900px); padding-top: 0; }
  dialog .heading { padding: 16px 24px; }
  #dialog-content > form { padding: 24px 24px 0; }
  #dialog-content > form > .form-footer { margin-right: -24px; margin-left: -24px; padding-right: 24px; padding-left: 24px; padding-bottom: 20px; }
  #dialog-content > :not(.heading):not(form) { margin-right: 24px; margin-left: 24px; }
}

@media (max-width: 599px) {
  .metric-button .overview-caption { display: none; }
  .metric-button { min-height: 104px; }
  .form-footer .form-summary { max-height: 116px; overflow-y: auto; }
}

@media (min-width: 900px) {
  .topbar { min-height: 80px; padding: 12px max(24px, calc((100vw - 1152px) / 2)); }
  .brand strong { font-size: 1.125rem; }
  #account { font-size: .875rem; }
  #account .name { max-width: 170px; }
  .account-menu > summary, .profile-menu > summary { padding: 4px 8px; }
  #app { padding-top: 32px; padding-bottom: 48px; }
  .heading { align-items: center; margin-bottom: 24px; }
  h1 { font-size: 2rem; }
  .hero-summary h1 { font-size: 2rem; }
  .list-controls { flex-direction: row; align-items: center; justify-content: space-between; }
  .list-controls .filters, .list-controls .filter-bar { flex: 1; }
  .navigation { top: 12px; bottom: auto; left: 50%; right: auto; width: auto; min-height: 0; padding: 4px; transform: translateX(-50%); border: 1px solid var(--line); border-radius: 14px; background: #f7f8fa; }
  .navigation a { flex-direction: row; gap: 7px; min-height: 48px; padding: 8px 14px; white-space: nowrap; font-size: .8125rem; }
  .nav-icon svg { width: 18px; height: 18px; }
  .detail-grid { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); align-items: start; gap: 20px; }
  .detail-grid .panel { padding: 24px; }
  #app:has(.detail-header) { padding-bottom: 48px; }
  #app:has(.detail-header) > .actions { position: static; width: auto; padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; transform: none; }
  #app:has(.detail-header) > .actions .button { flex: initial; padding: 12px 18px; font-size: .875rem; }
  .toast, #app:has(.detail-header) ~ .toast { bottom: 24px; }
  .login { margin-top: 64px; }
}

@media (min-width: 1160px) {
  .cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .job-card { padding: 20px; }
}

@media (max-width: 359px) {
  #app { padding-right: 12px; padding-left: 12px; }
  .topbar { padding-right: 12px; padding-left: 12px; }
  .login { padding: 20px; }
  .heading { gap: 10px; }
  .heading > .button { padding-right: 12px; padding-left: 12px; }
  .metric { padding-right: 8px; padding-left: 8px; }
  .metric strong { font-size: 1.25rem; }
  .two-fields { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .scope-tab { padding-right: 6px; padding-left: 6px; font-size: .8125rem; }
}

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