:root {
  color-scheme: light;
  --background: #f4f7fb;
  --paper: #fff;
  --ink: #142238;
  --muted: #4f6179;
  --rule: #d9e2ee;
  --navy: #142744;
  --blue: #1f56c3;
  --blue-hover: #1948a8;
  --blue-soft: #eaf1ff;
  --red: #a02a35;
  --red-soft: #fff0f1;
  --green: #126445;
  --green-soft: #eaf7f0;
  --amber: #785013;
  --amber-soft: #fff4df;
  --radius: 12px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; font: 1rem/1.55 var(--font); color: var(--ink); background: var(--background); }
a { color: var(--blue); text-underline-offset: .2em; text-decoration-thickness: 1px; }
a:hover { color: var(--blue-hover); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid #477ce5;
  outline-offset: 2px;
}
::selection { color: #102749; background: #c9dcff; }
input, textarea { caret-color: var(--blue); }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(1.65rem, 2.4vw, 2.3rem); line-height: 1.2; letter-spacing: -.02em; overflow-wrap: anywhere; }
h2 { font-size: 1.075rem; line-height: 1.35; }
.num, time { font-variant-numeric: tabular-nums; }
.muted, .subtext, .field-hint { color: var(--muted); }
.subtext { margin-top: .45rem; }
.skip-link { position: absolute; z-index: 1; inset: .5rem auto auto .5rem; background: var(--paper); padding: .6rem .9rem; transform: translateY(-150%); }
.skip-link:focus { transform: none; }

.shell { display: grid; grid-template-columns: 216px minmax(0, 1fr); min-height: 100dvh; }
.sidebar { position: sticky; inset-block-start: 0; height: 100dvh; align-self: start; display: flex; flex-direction: column; gap: 2.3rem; padding: 1.75rem 1rem 1.25rem; background: var(--navy); color: #edf3ff; }
.brand { display: flex; align-items: center; gap: .65rem; color: inherit; font-weight: 750; font-size: 1.14rem; text-decoration: none; white-space: nowrap; }
.brand:hover { color: inherit; }
.brand small { font-weight: 700; font-size: .85rem; opacity: .84; }
.brand-mark { display: grid; place-items: center; width: 2.25rem; height: 2.25rem; border-radius: .6rem; color: #fff; background: #2b64d0; font-size: 1.1rem; }
.sidebar nav { display: grid; gap: .35rem; }
.sidebar nav a { padding: .58rem .75rem; color: #d9e7fa; border-radius: 7px; text-decoration: none; font-size: .94rem; }
.sidebar nav a:hover { background: #213959; color: #fff; }
.sidebar nav a[aria-current] { background: #29476d; font-weight: 700; color: #fff; }
.sidebar-account { margin-top: auto; padding: .8rem .55rem 0; border-top: 1px solid #3c5270; display: grid; gap: .4rem; }
.account-name { color: #f1f6ff; overflow-wrap: anywhere; font-weight: 650; text-decoration: none; }
.account-name:hover { color: #fff; text-decoration: underline; }
.logout { border: 0; padding: .2rem 0; color: #c4d5ed; background: transparent; font-size: .875rem; }
.logout:hover { color: #fff; text-decoration: underline; }
.main { min-width: 0; width: min(100%, 1530px); margin: 0 auto; padding: 2.1rem clamp(1rem, 3.5vw, 3rem) 3rem; }
.page-heading { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1.45rem; }
.page-heading > div:first-child { min-width: 0; }
.back-link { display: inline-block; margin-bottom: .9rem; font-size: .875rem; }
.detail-sub { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .7rem; margin-top: .65rem; color: var(--muted); }
.actions, .small-actions, .form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .55rem .75rem; }
.small-actions { font-size: .875rem; }
.form-actions.end { justify-content: flex-end; }
.button {
  display: inline-flex; justify-content: center; align-items: center; min-height: 2.65rem;
  padding: .44rem .9rem; border: 1px solid #b9c8d9; border-radius: 7px; background: var(--paper);
  color: var(--ink); font-size: .94rem; font-weight: 650; line-height: 1.25; text-decoration: none; text-align: center;
}
.button:hover { color: var(--blue-hover); background: #f0f5fd; border-color: #9cb3d1; }
.button.primary { border-color: var(--blue); background: var(--blue); color: #fff; }
.button.primary:hover { background: var(--blue-hover); border-color: var(--blue-hover); }
.button.danger { color: var(--red); border-color: #dab2b7; }
.button.danger:hover { background: var(--red-soft); border-color: #cb929a; }
.button.quiet { border-color: transparent; background: transparent; color: var(--blue); }
.button.quiet:hover { background: var(--blue-soft); }
.button.small { min-height: 2.15rem; padding: .35rem .65rem; font-size: .875rem; }

.workspace-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr); align-items: start; gap: 1.05rem; }
.primary-column, .side-column, .stack { display: grid; align-content: start; gap: 1rem; min-width: 0; }
.panel { min-width: 0; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--paper); }
.panel-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .55rem 1rem; padding: .95rem 1.1rem; border-bottom: 1px solid var(--rule); }
.panel-head > a, .panel-head > span { font-size: .875rem; }
.panel-note { display: grid; gap: .7rem; padding: .8rem 1.1rem 1rem; font-size: .9rem; overflow-wrap: anywhere; }
.count { display: inline-block; min-width: 1.65rem; padding: .08rem .35rem; margin-inline-start: .18rem; border-radius: 5px; color: var(--blue-hover); background: var(--blue-soft); font-size: .825rem; text-align: center; }
.count.overdue { background: var(--red-soft); color: var(--red); }
.empty { padding: 1.55rem 1.1rem; }
.empty strong { color: #384e6a; font-weight: 650; font-size: .95rem; }
.empty p { margin-top: .3rem; font-size: .875rem; color: var(--muted); }
.task-list, .contact-list, .pipeline, .timeline { margin: 0; list-style: none; padding: 0 1.1rem; }
.task-list li, .contact-list li { padding: .75rem 0; }
.task-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .75rem; align-items: start; }
.task-list li + li, .contact-list li + li, .pipeline li + li { border-top: 1px solid #e8edf4; }
.task-main, .task-date { display: grid; gap: .2rem; min-width: 0; }
.task-main { overflow-wrap: anywhere; }
.task-main a, .row-title { font-weight: 700; text-decoration: none; }
.task-main a:hover, .row-title:hover { text-decoration: underline; }
.task-main span, .task-date span, .contact-list .muted { color: var(--muted); font-size: .875rem; }
.task-date { text-align: right; font-size: .875rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.late { color: var(--red); }
.pipeline li > a { display: flex; justify-content: space-between; align-items: center; gap: .7rem; min-height: 2.7rem; color: var(--ink); text-decoration: none; font-size: .94rem; }
.pipeline li > a:hover { color: var(--blue); }
.pipeline strong { color: var(--blue-hover); font-variant-numeric: tabular-nums; font-size: 1rem; }
.badge { display: inline-block; max-width: 100%; overflow-wrap: anywhere; border-radius: 5px; padding: .12rem .45rem; font-size: .82rem; line-height: 1.55; font-weight: 650; background: #eef2f7; color: #40536b; }
.badge-reached, .badge-qualified, .badge-demo, .badge-quoted { background: var(--blue-soft); color: var(--blue-hover); }
.badge-lost, .badge-invalid { background: var(--red-soft); color: var(--red); }
.badge-paused { background: var(--amber-soft); color: var(--amber); }
.badge-won { background: var(--green-soft); color: var(--green); }
.line-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: .15rem .8rem; }
.line-head time, .line-head a { color: var(--muted); font-size: .875rem; }
.contact-list p { margin-top: .22rem; overflow-wrap: anywhere; }
.contact-list form { margin-top: .25rem; }
.timeline { padding-block: .15rem; }
.timeline li { padding: .85rem 0; overflow-wrap: anywhere; }
.timeline li + li { border-top: 1px solid var(--rule); }
.timeline p { margin-top: .35rem; }
.timeline .muted { font-size: .875rem; }
.timeline a { display: inline-block; margin-top: .4rem; }
.prewrap { white-space: pre-wrap; overflow-wrap: anywhere; }
.metadata { margin: 0; padding: 1rem 1.1rem; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: .8rem 1.2rem; }
.metadata dt { color: var(--muted); font-size: .875rem; }
.metadata dd { margin: .12rem 0 0; overflow-wrap: anywhere; }
.inline-details { padding: .7rem 1.1rem; }
.panel > .inline-details:not(:first-child) { border-top: 1px solid var(--rule); }
summary { cursor: pointer; color: var(--blue-hover); font-weight: 600; font-size: .9rem; }
.nested-form { margin-top: .8rem; }
.side-column .fields { grid-template-columns: minmax(0, 1fr); }

.form-panel, .filter-panel { padding: 1.1rem; }
.form-panel h2 { margin-bottom: .82rem; }
.form-panel.narrow { max-width: 36rem; }
.fields, .filter-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem 1rem; align-items: start; }
.wide { grid-column: 1 / -1; }
.filter-fields { grid-template-columns: minmax(200px, 1.4fr) repeat(3, minmax(0, 1fr)); }
.report-filter { grid-template-columns: minmax(10rem, 14rem) minmax(10rem, 14rem) auto; align-items: end; justify-content: start; }
.filter-panel .form-actions { margin-top: .85rem; }
.more-filters { margin-top: .65rem; }
.more-filters .filter-fields { margin-top: .6rem; }
.field { display: grid; gap: .32rem; min-width: 0; font-size: .9rem; font-weight: 650; }
.required { color: var(--red); }
.field-hint { font-size: .875rem; }
input:not([type=checkbox]), select, textarea {
  display: block; width: 100%; min-width: 0; min-height: 2.65rem; padding: .45rem .6rem; border: 1px solid #afc0d4;
  border-radius: 6px; background-color: var(--paper); color: var(--ink); font-size: max(16px, .95rem); font-weight: 400;
}
input[type=checkbox] { width: 1rem; height: 1rem; accent-color: var(--blue); }
input[type=file] { padding: .39rem .6rem; }
input[type=file]::file-selector-button { margin-inline-end: .55rem; background: var(--blue-soft); border: 0; border-radius: 4px; color: var(--blue-hover); padding: .25rem .45rem; }
input::placeholder, textarea::placeholder { color: var(--muted); }
select { appearance: none; padding-inline-end: 1.95rem; background-image: linear-gradient(45deg, transparent 50%, #50667f 50%), linear-gradient(135deg, #50667f 50%, transparent 50%); background-position: calc(100% - 14px) 52%, calc(100% - 9px) 52%; background-size: 5px 5px; background-repeat: no-repeat; }
textarea { resize: vertical; }
.checkbox { display: inline-flex; align-items: center; gap: .32rem; font-size: .9rem; }
.customer-table, .report-cohort, .upload-panel { margin-top: 1rem; }
.table-scroll { overflow-x: auto; scrollbar-color: #8ea8ca #f1f5fa; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th, td { padding: .69rem .85rem; border-bottom: 1px solid #e8edf4; vertical-align: top; overflow-wrap: anywhere; }
th:first-child, td:first-child { padding-inline-start: 1.1rem; }
th:last-child, td:last-child { padding-inline-end: 1.1rem; }
th { font-size: .875rem; color: #405573; font-weight: 700; white-space: nowrap; background: #f5f8fc; }
td { font-size: .94rem; }
td select { min-width: 11rem; max-width: 24rem; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #f9fbfe; }
.customer-table table { min-width: 680px; }
.mobile-label { display: none; }
.cell-sub { display: block; margin-top: .14rem; color: var(--muted); font-size: .875rem; }
.pagination { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: .55rem; padding: .7rem 1.1rem; border-top: 1px solid var(--rule); font-size: .875rem; }
.tabs { margin-bottom: 1rem; }
.tabs ul { display: flex; flex-wrap: wrap; gap: .3rem; list-style: none; padding: 0; margin: 0; }
.tabs a { display: inline-flex; min-height: 2.6rem; align-items: center; padding: .35rem .72rem; border-radius: 6px; text-decoration: none; color: var(--muted); font-size: .94rem; }
.tabs a:hover, .tabs a[aria-current] { color: var(--blue-hover); background: var(--blue-soft); }
.tabs a[aria-current] { font-weight: 700; }
.metric-strip { display: flex; flex-wrap: wrap; gap: .8rem 1.15rem; margin: 0; padding: 1rem 1.1rem; }
.metric-strip > div { flex: 1 1 7rem; min-width: 6rem; }
.metric-strip dt { color: var(--muted); font-size: .875rem; }
.metric-strip dd { font-size: 1.65rem; font-variant-numeric: tabular-nums; font-weight: 750; margin: .1rem 0 0; }
.upload-heading { display: flex; justify-content: space-between; flex-wrap: wrap; align-items: start; gap: .6rem 1.2rem; }
.upload-heading h2 { margin-bottom: .3rem; }
.upload-form { display: flex; flex-wrap: wrap; align-items: end; gap: .65rem; margin-top: 1rem; }
.upload-form .field { flex: 1 1 16rem; max-width: 30rem; }
.notice { border: 1px solid #b9d8c7; background: var(--green-soft); color: var(--green); padding: .6rem .85rem; border-radius: 7px; margin: 0 0 .85rem; overflow-wrap: anywhere; }
.notice.error { border-color: #e4b9bf; background: var(--red-soft); color: var(--red); }
.notice.warning { border-color: #e0cca4; background: var(--amber-soft); color: var(--amber); }
.error-page { padding: 1.25rem; display: grid; justify-items: start; gap: .8rem; }
.auth-page { width: min(100% - 2rem, 27rem); min-height: 100dvh; display: grid; align-content: center; margin: 0 auto; }
.login-wrap { padding: clamp(1.1rem, 5vw, 2.1rem); background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius); }
.login-brand { color: var(--navy); margin-bottom: 1.45rem; }
.login-wrap h1 { font-size: 1.63rem; }
.login-wrap .subtext { font-size: .95rem; margin-bottom: .95rem; }
.login-form { display: grid; gap: .85rem; }

@media (max-width: 1050px) {
  .shell { grid-template-columns: 175px minmax(0, 1fr); }
  .filter-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .report-filter { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .workspace-grid { grid-template-columns: minmax(0, 1.35fr) minmax(235px, 1fr); }
}
@media (max-width: 790px) {
  .shell { display: block; }
  .sidebar { position: static; height: auto; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .5rem; padding: .65rem 1rem .45rem; }
  .sidebar nav { display: flex; flex-wrap: wrap; grid-column: 1 / -1; grid-row: 2; gap: .28rem; }
  .sidebar nav a { padding: .45rem .58rem; }
  .sidebar-account { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .6rem; justify-content: end; border: 0; padding: 0; margin: 0; }
  .main { padding-block-start: 1.25rem; }
}
@media (max-width: 600px) {
  .workspace-grid { grid-template-columns: minmax(0, 1fr); }
  .page-heading { flex-wrap: wrap; align-items: flex-start; margin-bottom: 1rem; }
  .panel-head { padding-inline: .85rem; }
  .fields { grid-template-columns: minmax(0, 1fr); }
  .form-panel, .filter-panel { padding: .8rem; }
  .filter-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .65rem; }
  .filter-fields > :first-child:has(input[type=search]) { grid-column: 1 / -1; }
  .sidebar-account .account-name { max-width: 6.5rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .9rem; }
  .sidebar nav { gap: .13rem; }
  .sidebar nav a { padding-inline: .42rem; font-size: .875rem; }
  .task-date { white-space: normal; }
  .customer-table table, .customer-table tbody { display: block; min-width: 0; }
  .customer-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .customer-table tbody tr {
    display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, .75fr);
    grid-template-areas: "name stage" "area contact" "due restore";
    gap: .4rem .65rem; padding: .75rem .85rem;
  }
  .customer-table tbody tr + tr { border-top: 1px solid var(--rule); }
  .customer-table td { border: 0; padding: 0; }
  .customer-name { grid-area: name; }
  .customer-stage { grid-area: stage; justify-self: end; }
  .customer-area { grid-area: area; }
  .customer-contact { grid-area: contact; }
  .customer-due { grid-area: due; color: var(--muted); font-size: .875rem; }
  .customer-table tr:not(:has(.customer-restore)) .customer-due { grid-column: 1 / -1; }
  .customer-restore { grid-area: restore; justify-self: end; }
  .mobile-label { display: inline; margin-inline-end: .4rem; }
}
@media (max-width: 360px) {
  .filter-fields { grid-template-columns: minmax(0, 1fr); }
  .sidebar { padding-inline: .65rem; }
  .sidebar nav a { font-size: .875rem; }
  .main { padding-inline: .65rem; }
}
