:root {
  color-scheme: light;
  --ink: #1d1d1f;
  --muted: #6e6e73;
  --paper: #fff;
  --soft: #f5f5f7;
  --line: #d2d2d7;
  --accent: #242426;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --content: min(1180px, calc(100% - 64px));
}

* { box-sizing: border-box; }
html { scroll-padding-top: 100px; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
}
::selection { background: #dedee2; }
a { color: inherit; text-decoration: none; }
a, button, input, select, textarea, summary { touch-action: manipulation; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 4px; }
h1, h2, p, figure { margin: 0; }
.frame { width: var(--content); margin-inline: auto; }

.sitehead {
  position: sticky;
  z-index: 20;
  top: 0;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
.head-inner { min-height: 65px; display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.identity { font-size: 28px; font-weight: 650; letter-spacing: -1.5px; white-space: nowrap; }
.brand-dot { color: #8a8a90; }
.head-inner nav { display: flex; align-items: center; gap: 27px; font-size: 14px; }
.head-inner nav a { min-height: 44px; display: inline-flex; align-items: center; }
.head-inner nav a:hover { text-decoration: underline; text-underline-offset: 5px; }
.hero { padding: 45px 0 35px; }
.workspace-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 20px;
  padding: 25px 0 20px;
}
.workspace-header h1 { font-size: clamp(34px, 4vw, 52px); margin: 5px 0 8px; }
.workspace-links { display: flex; flex-wrap: wrap; gap: 0 16px; font-size: 14px; }
.workspace-links a { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; }
.workspace-links a:hover { text-decoration: underline; text-underline-offset: 4px; }
.agent-status { display: grid; gap: 2px; padding: 11px 14px; border: 1px solid var(--line); border-radius: 12px; }
.agent-status:hover { background: var(--soft); }
.agent-status strong { font-weight: 600; }
.agent-status strong span { margin-left: 4px; }
.agent-status .muted { font-size: 12px; }
.eyebrow { color: var(--muted); font-size: 11px; font-weight: 650; letter-spacing: .14em; text-transform: uppercase; }
h1 { margin: 15px 0; font-size: clamp(39px, 4.9vw, 66px); font-weight: 650; line-height: 1.035; letter-spacing: -.055em; overflow-wrap: anywhere; }
h2 { font-size: clamp(28px, 3.35vw, 42px); font-weight: 650; line-height: 1.1; letter-spacing: -.045em; }
.hero p, .muted { color: var(--muted); }
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  min-height: 46px;
  padding: 10px 20px;
  border: 0;
  border-radius: 30px;
  background: var(--accent);
  color: white;
  font: inherit;
  font-weight: 550;
  cursor: pointer;
}
button:hover { background: #414145; }

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  background: var(--soft);
  border-radius: 18px;
  padding: 8px 0;
  margin-bottom: 28px;
}
.metric { min-width: 0; padding: 14px clamp(13px, 3vw, 30px); display: grid; gap: 4px; border-right: 1px solid #dedee2; }
.metric:last-child { border-right: 0; }
.metric:hover span { text-decoration: underline; text-underline-offset: 4px; }
.metric span { color: var(--muted); font-size: 13px; }
.metric strong { font-size: clamp(26px, 3.2vw, 42px); font-weight: 650; letter-spacing: -.05em; line-height: 1.1; }

.panel { margin-bottom: 20px; padding: 30px 0; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.panel h2 { margin-bottom: 12px; }
.panel p { margin: .6em 0; }
.section-head { margin-bottom: 23px; }
.section-head h2 { margin: 7px 0 0; }
.filters, .editform { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) auto; gap: 12px; align-items: end; }
.editform { grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 15px 0; }
.wide { grid-column: 1 / -1; }
label { display: grid; gap: 5px; font-size: 13px; font-weight: 500; }
input, select, textarea {
  width: 100%;
  min-height: 46px;
  border: 1px solid #d9d9df;
  border-radius: 9px;
  padding: 9px 12px;
  color: var(--ink);
  background: #fafafa;
  font: inherit;
  font-size: 16px;
}
input::placeholder { color: #77777d; }
textarea { min-height: 84px; resize: vertical; }

.factory-list, .eventlist { list-style: none; margin: 14px 0 0; padding: 0; }
.factory-list li, .eventlist li { border-bottom: 1px solid #e1e1e5; }
.factory-list li:first-child, .eventlist li:first-child { border-top: 1px solid #e1e1e5; }
.factory-list li a { padding: 13px 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: start; }
.factory-list strong { font-weight: 600; letter-spacing: -.015em; }
.factory-list p { font-size: 13px; color: var(--muted); margin: 1px 0 0; }
.factory-list .products { color: #525259; }
.factory-list li a:hover strong { text-decoration: underline; text-underline-offset: 4px; }
.badge {
  display: inline-block;
  padding: 3px 9px;
  border: 1px solid #dedee3;
  border-radius: 20px;
  color: #55555b;
  font-size: 11px;
  font-weight: 650;
  white-space: nowrap;
}
.badge.comm, .badge.sent, .badge.paid { color: var(--ink); background: #ededf0; border-color: #d1d1d6; }
.badge.ncomm, .badge.handoff, .badge.manual, .badge.uncertain_send, .badge.delivery_report {
  color: #fff;
  border-color: var(--accent);
  background: var(--accent);
}
.textlink, .pagination a { text-decoration: underline; text-decoration-color: #b0b0b5; text-underline-offset: 4px; }
.textlink:hover, .pagination a:hover { text-decoration-color: currentColor; }
.pagination { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding-top: 12px; font-size: 13px; }
.pagination div { display: flex; gap: 14px; }
.eventlist li { display: grid; gap: 4px; padding: 13px 0; }
.eventlist p { margin: 0; }
.event-time { margin-left: 8px; font-size: 13px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 9px 0; }
.chips span { padding: 4px 9px; border-radius: 20px; background: var(--soft); color: #525259; font-size: 12px; }
.insights { padding-left: 19px; }
.insights li { margin: 5px 0; }
details { border-bottom: 1px solid #e1e1e5; padding: 12px 0; }
details:first-of-type { border-top: 1px solid #e1e1e5; }
summary { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; list-style: none; cursor: pointer; }
summary::-webkit-details-marker { display: none; }
summary::after { content: "+"; color: var(--muted); margin-left: auto; }
details[open] > summary::after { content: "−"; }
details summary span { color: var(--muted); font-size: 13px; }
pre { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--soft); border-radius: 12px; padding: 15px; font: inherit; font-size: 14px; }
blockquote { margin: 12px 0; padding: 6px 0 6px 14px; border-left: 2px solid var(--line); color: #525259; }
.profile-hero .badge { margin: 2px 0 7px; }
footer.frame { display: flex; justify-content: space-between; gap: 12px; border-top: 1px solid var(--line); padding: 16px 0 22px; font-size: 12px; color: var(--muted); }

.account-menu { position: relative; margin: 0; padding: 0; border: 0; }
.account-menu:first-of-type { border: 0; }
.account-menu summary { min-height: 38px; align-items: center; padding: 6px 11px; border: 1px solid var(--line); border-radius: 20px; }
.account-menu > div { position: absolute; top: calc(100% + 6px); right: 0; width: 180px; padding: 12px; display: grid; gap: 4px; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 8px 24px #0001; }
.head-inner nav .account-menu a { min-height: 32px; }
.account-menu button { min-height: 34px; padding: 4px 12px; font-size: 13px; }
.login-card { max-width: 430px; margin: clamp(35px, 12vh, 110px) auto; padding: clamp(18px, 5vw, 30px); border: 1px solid var(--line); border-radius: 18px; }
.login-card h1 { font-size: clamp(32px, 6vw, 44px); margin: 8px 0 13px; }
.account-form { display: grid; gap: 13px; margin-top: 16px; }
.account-form .muted { font-size: 13px; }
.form-error { background: var(--soft); border-left: 2px solid var(--ink); margin-top: 12px; padding: 7px 10px; }
.task-list, .task-factories { margin: 10px 0 0; padding: 0; list-style: none; }
.task-list > li { padding: 16px 0; border-top: 1px solid var(--line); }
.task-top { display: flex; gap: 10px; justify-content: space-between; align-items: start; }
.task-top h3, .proposal-list h3 { margin: 0; font-size: 19px; line-height: 1.3; }
.task-top .badge { flex-shrink: 0; }
.task-meta { font-size: 13px; }
.task-description { white-space: pre-wrap; }
.task-status { max-width: 480px; display: grid; gap: 9px; justify-items: start; margin-top: 12px; }
.task-status label { width: 100%; }
.call-plan { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px 16px; background: var(--soft); padding: 10px 14px; border-radius: 9px; }
.call-plan div { overflow-wrap: anywhere; }
.call-plan dt { color: var(--muted); font-size: 12px; }
.call-plan dd { margin: 0; }
.task-factories li { display: grid; padding: 7px 0; border-top: 1px solid #e1e1e5; }
.task-factories span, .factory-picker small { color: var(--muted); font-size: 13px; }
.factory-picker { border: 0; padding: 0; margin: 12px 0; }
.factory-picker label { display: grid; grid-template-columns: auto minmax(0,1fr) auto; gap: 10px; align-items: center; padding: 9px 0; border-top: 1px solid var(--line); }
.factory-picker input { width: 19px; min-height: 19px; accent-color: var(--ink); }
.factory-picker small { display: block; }
.proposal-list { margin: 16px 0; }

@media (max-width: 760px) {
  :root { --content: calc(100% - 44px); }
  html { scroll-padding-top: 82px; }
  .head-inner { min-height: 59px; }
  .head-inner nav { gap: 13px; font-size: 13px; }
  .head-inner nav a.compact-hidden { display: none; }
  .identity { font-size: 26px; }
  .workspace-header { grid-template-columns: 1fr; gap: 10px; padding-block: 14px 16px; }
  .agent-status { grid-template-columns: 1fr auto; padding: 8px 10px; align-items: baseline; }
  .agent-status .muted { grid-column: 1 / -1; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 0; }
  .metric { padding: 12px 14px; }
  .metric:nth-child(2) { border-right: 0; }
  .metric:nth-child(-n+2) { border-bottom: 1px solid #dedee2; }
  .panel { padding: 24px 0; margin-bottom: 10px; }
  .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filters label:first-child { grid-column: 1 / -1; }
  .editform { grid-template-columns: 1fr; }
  .editform .wide { grid-column: auto; }
  .call-plan { grid-template-columns: 1fr; }
}
@media (max-width: 360px) {
  :root { --content: calc(100% - 32px); }
  .head-inner { gap: 10px; }
  .head-inner nav { gap: 9px; }
}
