/* The v2 screens use the shared SLATT shell and components from styles.css. */
:root {
  --workspace-accent: #254cb7;
  --workspace-accent-soft: #eaf0fe;
}
#workspace :is(a, button, summary):focus-visible { outline-color: var(--workspace-accent); }
#workspace :is(input, select, textarea):focus {
  border-color: var(--workspace-accent);
  box-shadow: 0 0 0 3px var(--workspace-accent-soft);
}
#main { flex: 1; min-width: 0; outline: none; }
#workspace > .file-help { display: none; }
#main:has(.result-form) { scroll-padding-bottom: calc(150px + env(safe-area-inset-bottom)); }
.result-form :is(input,select,textarea) { scroll-margin-bottom: calc(150px + env(safe-area-inset-bottom)); }
#main:focus-visible { outline: none; }
.topbar-session { flex-wrap: wrap; justify-content: flex-end; }
#navigation a, #mobile-navigation-list a {
  display: flex; align-items: center; gap: 10px; min-height: 35px;
  padding: 8px 12px; border-radius: var(--r-sm); color: var(--text-2);
  font-size: .928571rem; line-height: 1.4;
}
#navigation a:hover, #mobile-navigation-list a:hover { background: var(--hover); text-decoration: none; }
#navigation a[aria-current], #mobile-navigation-list a[aria-current] {
  background: var(--workspace-accent-soft); color: var(--workspace-accent); font-weight: 500;
}
#navigation a[aria-current] .icon { color: currentColor; }
#mobile-navigation-list a { min-height: var(--touch-target); }
.profile-menu .action-menu-body a, .profile-menu .action-menu-body a:hover { display: block; }
.login-shell .card { box-shadow: var(--shadow-card); }
.login-shell .form { grid-template-columns: 1fr; }
#screen > .card:first-of-type { margin-top: 0; }
#screen .metrics { align-items: center; }
#screen .metrics > .button-link { justify-self: start; margin-left: 12px; }
#screen .metric:hover { text-decoration: none; background: var(--hover); border-radius: var(--r-xs); }
#screen .metric strong { white-space: nowrap; }
#screen a.metric { display: grid; grid-template-columns: minmax(0,1fr); grid-template-rows: auto auto; align-content: start; gap: 8px; }
#screen .metrics .metric strong { margin: 0; line-height: 1.15; }
.registry-tools { align-items: end; }
.registry-search { display: grid; grid-template-columns: minmax(220px,1fr) auto; gap: 8px; align-items: end; flex: 1 1 360px; min-width: 0; }
.registry-search label { min-width: 0; }
.registry-search .error { grid-column: 1 / -1; margin: 0; }
.registry-search .error:empty { display: none; }
#screen .card .empty { min-height: 0; padding: 14px 18px; text-align: left; align-items: flex-start; }
.form-divider { margin: 4px 0 0; padding-bottom: 6px; border-bottom: 1px solid var(--line); color: var(--text-2); font-weight: 600; }
.result-form label[hidden] { display: none; }
.result-form details { border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px; }
.result-form details[open] { display: grid; gap: 12px; }
.result-form details > summary { cursor: pointer; font-weight: 500; }
.result-form .form-actions { position: sticky; bottom: 12px; z-index: 3; padding: 10px; margin: 0 -10px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--panel); box-shadow: var(--shadow-lift); justify-content: flex-end; }
.result-form .form-actions .error { flex-basis: 100%; }
.result-form .form-actions .error:empty { display: none; }
.report-filters { padding: 12px 16px; border: 1px solid var(--line); border-radius: var(--r-md); }
.report-filters > form { margin-top: 12px; }
.report-summary { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,145px),1fr)); gap: 8px 12px; margin: 0; }
.report-summary > div { border-bottom: 1px solid var(--line); padding-block: 4px; }
.report-summary dd { margin: 2px 0 0; font-weight: 600; }
.row > :last-child:empty { display: none; }
.row { overflow-wrap: anywhere; }
.row {
  display: grid; grid-template-columns: minmax(0,1fr) minmax(90px,auto) auto;
  gap: 12px; align-items: center; min-height: var(--row-size);
  border-bottom: 1px solid var(--line); padding: 7px 0;
}
.row:last-child { border-bottom: 0; }
.row:hover { background: var(--col); }
.row strong { display: block; }
.row p { margin: 1px 0 0; font-size: .857143rem; white-space: pre-line; }
[data-form="stop"] button[aria-disabled="true"] { background: var(--active); color: var(--muted); cursor: default; }
.file-thumbnail { display: block; width: 64px; height: 48px; object-fit: contain; border-radius: var(--r-xs); background: var(--col); }
.late { color: var(--bad); font-weight: 600; }
.flex, .tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.tools { margin: 0 0 14px; }
.tools .stretch { flex: 1 1 220px; }
#screen .tabs > .button-link {
  color: var(--muted); background: transparent; border: 0; border-radius: 0;
  flex: none; white-space: nowrap; padding-inline: 1px; margin-right: 16px;
}
#screen .tabs > .primary { color: var(--workspace-accent); box-shadow: inset 0 -2px var(--workspace-accent); }
.split { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1.6fr); gap: 16px; align-items: start; }
.split > .card { margin-top: 0; }
.form { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px 16px; }
.form .wide { grid-column: 1 / -1; }
.form label:has(input[type=checkbox]), .form label:has(input[type=radio]) { flex-direction: row; align-items: center; }
.form .error { margin: 0; }
.form .error:empty { display: none; }
fieldset.form { padding: 12px; margin: 0; }
.empty { color: var(--muted); }
#screen details { margin-top: 12px; }
#screen details > summary { cursor: pointer; font-weight: 500; }
#notice {
  position: fixed; z-index: 80; left: calc(232px + 32px); bottom: 24px;
  max-width: min(560px,calc(100vw - 296px)); padding: 12px 16px;
  border-radius: var(--r-md); background: var(--text); color: var(--panel); box-shadow: var(--shadow-lift);
}
#notice:empty { display: none; }
@media (max-width: 1023px) {
  #content { padding-bottom: calc(82px + env(safe-area-inset-bottom)); }
  .mobile-nav a {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 4px; min-height: 52px; padding: 6px 2px; color: var(--muted);
    border-radius: var(--r-sm); font-size: .857143rem;
  }
  .mobile-nav a[aria-current] { color: var(--workspace-accent); background: var(--workspace-accent-soft); font-weight: 500; }
  #notice { left: 16px; bottom: calc(82px + env(safe-area-inset-bottom)); max-width: calc(100vw - 32px); }
  .result-form .form-actions { bottom: calc(82px + env(safe-area-inset-bottom)); }
}
@media (max-width: 650px) {
  .topbar #breadcrumb { flex: 1 1 120px; min-width: 0; }
  .split, .form { grid-template-columns: minmax(0,1fr); }
  #screen .metrics { grid-template-columns: repeat(2,minmax(0,1fr)); row-gap: 12px; }
  #screen .metric { padding-inline: 8px; }
  #screen .metric:nth-child(even) { border: 0; }
  #screen .metrics > .button-link { margin-left: 0; }
  #screen .metric { gap: 7px; min-height: 78px; }
  #screen .metric > span { line-height: 1.45; }
  #screen .metric strong { align-self: start; }
  .row { grid-template-columns: minmax(0,1fr) auto; gap: 6px 10px; }
  .row > :first-child { grid-column: 1 / -1; }
  .report-results .row > :first-child { grid-column: 1; }
  .report-results .row > :last-child { grid-area: 1 / 2 / span 2; }
  .report-summary { gap: 4px 12px; }
  .registry-search { grid-template-columns: minmax(0,1fr) auto; flex-basis: 100%; }
  #screen .wrap-tabs { flex-wrap: wrap; column-gap: 14px; row-gap: 0; }
  #screen .wrap-tabs > .button-link { margin-right: 0; }
  .responsive { display: block; min-width: 0; }
  .responsive thead { display: none; }
  .responsive tbody { display: grid; gap: 10px; }
  .responsive tr { display: grid; grid-template-columns: minmax(0,1fr); gap: 0; height: auto; min-height: 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-md); }
  .responsive td { display: block; min-height: 0; height: auto; padding: 6px 0; border: 0; line-height: 1.5; overflow-wrap: anywhere; }
  .responsive td + td { border-top: 1px solid var(--line); }
  .responsive td[data-label]::before { content: attr(data-label); display: block; margin-bottom: 3px; color: var(--muted); font-size: .857143rem; }
  .responsive td p { margin: 3px 0 0; }
  .responsive .flex { gap: 5px; }
  .result-form .form-actions { margin-inline: -4px; padding: 8px; }
}

@media (max-width: 1023px) {
  .keyboard-open .result-form .form-actions { position: static; }
  .keyboard-open #workspace:has(.result-form) .mobile-nav { display: none; }
}
@media (max-height: 430px) {
  .result-form .form-actions { position: static; }
  #workspace:has(.result-form) .mobile-nav { position: static; }
}

.source-text { white-space: pre-wrap; overflow-wrap: anywhere; }

.template-step { margin-block: .5rem 1rem; border: 1px solid var(--line, #ddd); border-radius: 8px; padding: 12px; }
.template-step label { display: block; margin-block: 8px; }
.template-step input, .template-step textarea { width: 100%; }

/* Workspace search: primary action first, optional tools below. */
#screen .lead-query, #screen .registry-filter {
  display:grid; grid-template-columns:minmax(180px,2fr) minmax(145px,1fr) auto;
  align-items:end; gap:12px; max-width:860px;
}
#screen :is(.lead-query,.registry-filter,.option-fields) label {display:grid;gap:5px;min-width:0}
#screen :is(.lead-query,.registry-filter,.option-fields) :is(input:not([type=checkbox]),select,button) {width:100%;min-height:42px;min-width:0}
#screen .search-help {margin:9px 0;color:var(--text-2)}
#screen .search-options {margin-top:16px}
#screen .option-fields {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px;max-width:670px;margin:12px 0}
#screen .search-secondary {border-top:1px solid var(--line);padding:14px 0;margin:12px 0 0}
#screen .search-secondary[open]>summary {margin-bottom:12px}
#screen .registry-actions {display:flex;flex-wrap:wrap;gap:8px;margin:0 0 18px}
#screen .registry-filter {margin:0 0 14px}
#screen :is(.registry-filter,.lead-search)>.error {grid-column:1/-1;margin:0}
#screen :is(.registry-filter,.lead-search)>.error:empty {display:none}
@media(max-width:650px){
  #screen :is(.lead-query,.registry-filter,.option-fields) {grid-template-columns:minmax(0,1fr)}
}
#screen :is(.registry-filter,.option-fields) select {
  -webkit-appearance:none; appearance:none; height:42px;
  border:1px solid var(--line); border-radius:var(--r-sm); background-color:var(--panel);
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23565a60' stroke-width='1.5' viewBox='0 0 16 16'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E");
  background-position:right 10px center; background-repeat:no-repeat;
  padding:0 34px 0 12px; font:inherit; color:inherit;
}
.profile-menu>summary {width:auto;max-width:170px;gap:6px;padding-inline:9px}
.profile-menu .action-menu-body p {margin:6px 10px}
.card-options .tools,.contact-result {margin-top:10px}
#screen .order-totals {display:grid;grid-template-columns:repeat(auto-fit,minmax(145px,1fr));gap:16px;margin:4px 0 16px}
.order-totals dt {color:var(--muted)} .order-totals dd {font-weight:600;font-size:1.25rem;margin:4px 0}
#navigation {margin:22px 0}
#menu-desktop-slot {margin-top:auto}
.account-tools {display:grid;gap:4px;padding:12px 4px 0;border-top:1px solid var(--line)}
.account-tools :is(.account-link,summary,#mode) {display:flex;align-items:center;justify-content:flex-start;gap:8px;width:100%;max-width:none;min-height:40px;padding:7px 10px;color:var(--text);border-radius:var(--r-sm);text-align:left}
.account-tools .account-link:hover {background:var(--hover);text-decoration:none}
.account-tools .action-menu-body {bottom:100%;top:auto;right:auto;left:0}
#menu-mobile-slot .action-menu-body {position:static}
.search-sections {display:flex;gap:4px;flex-wrap:wrap;margin:0 0 16px;border-bottom:1px solid var(--line)}
.search-sections a {display:inline-flex;align-items:center;min-height:44px;padding:6px 12px;color:var(--text-2)}
.search-sections [aria-current] {box-shadow:inset 0 -2px var(--workspace-accent);color:var(--workspace-accent);font-weight:600}

/* Compact secondary actions keep their native focus and expanded state. */
#screen details > summary {
  list-style:none;display:inline-flex;align-items:center;min-height:36px;
  padding:6px 12px;border:1px solid var(--line);border-radius:var(--r-sm);
  background:var(--panel);color:var(--text);cursor:pointer;
}
#screen details > summary::-webkit-details-marker,.profile-menu>summary::-webkit-details-marker {display:none}
#screen details > summary::marker,.profile-menu>summary::marker {content:""}
#screen details[open] > summary {background:var(--workspace-accent-soft);color:var(--workspace-accent)}
#screen details > summary:hover {border-color:var(--workspace-accent)}
#screen [hidden] {display:none !important}
.oc-calendar,.oc-agenda {--accepted:#2455a6;--accepted-bg:#eaf1ff;--deadline:#985014;--deadline-bg:#fff1dc}
.oc-calendar {border:1px solid var(--line);border-radius:14px;overflow:hidden;background:var(--panel)}
.oc-top,.oc-agenda header {display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:12px}
.oc-top {padding:18px 20px 4px}
#screen .oc-top h2 {font-size:1.45rem;letter-spacing:-.035em;margin:0}
.oc-months {display:flex;flex-wrap:wrap;gap:2px;border:1px solid var(--line);border-radius:8px;padding:2px}
.oc-months a {padding:8px 10px;border-radius:5px;color:var(--text-2);text-decoration:none}
.oc-months a:hover,.oc-months a:focus-visible {background:var(--workspace-accent-soft);color:var(--workspace-accent)}
.oc-legend {display:flex;gap:16px;padding:6px 20px 15px}
.oc-kind {display:inline-flex;align-items:center;gap:7px;font-weight:550;white-space:nowrap;font-size:.86rem}
.oc-kind::before,.oc-dots i {content:"";width:7px;height:7px;border-radius:50%;background:currentColor;display:inline-block}
.oc-kind.accepted,.oc-dots .accepted {color:var(--accepted)}
.oc-kind.deadline,.oc-dots .deadline {color:var(--deadline)}
.oc-grid {display:grid;grid-template-columns:repeat(7,minmax(0,1fr));background:var(--line);gap:1px;border-top:1px solid var(--line)}
.oc-weekday {background:var(--col);padding:7px 10px;font-size:.83rem;color:var(--text-2);font-weight:600}
.oc-cell,.oc-blank {background:var(--panel);min-width:0;min-height:84px}
.oc-blank {background:var(--col)}
.oc-cell {padding:4px;position:relative}
.oc-cell.selected {box-shadow:inset 0 0 0 2px var(--workspace-accent)}
.oc-day {display:inline-flex;padding:0 3px;align-items:center;text-decoration:none;color:var(--text)}
.oc-day>span:first-child {display:grid;place-items:center;width:26px;height:26px;font-variant-numeric:tabular-nums;border-radius:50%}
.oc-day:hover>span:first-child {background:var(--workspace-accent-soft)}
.is-today .oc-day>span:first-child {background:var(--workspace-accent);color:white}
.oc-previews {display:grid;gap:3px;margin-top:3px}
.oc-preview {overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:2px 5px;border-radius:4px;font-size:.79rem;line-height:1.45;text-decoration:none}
.oc-preview.accepted {background:var(--accepted-bg);color:var(--accepted)}
.oc-preview.deadline {background:var(--deadline-bg);color:var(--deadline)}
.oc-more {font-size:.79rem;padding-left:5px}
.oc-dots {display:none}
.oc-agenda {margin-top:24px}
#screen .oc-agenda header h2 {margin:0;font-size:1.18rem}
.oc-agenda-day h3 {font-size:.92rem;margin:14px 0 0;padding:8px 0;color:var(--text-2);border-bottom:1px solid var(--line)}
.oc-entry,.oc-unscheduled {color:var(--text);display:grid;align-items:center;gap:10px;padding:10px 4px;border-bottom:1px solid var(--line);text-decoration:none}
.oc-entry {grid-template-columns:110px 1fr auto}
.oc-entry strong,.oc-entry small,.oc-unscheduled small {display:block;overflow-wrap:anywhere}
.oc-entry small,.oc-unscheduled small,.oc-state {color:var(--muted);font-size:.85rem}
.oc-entry:hover,.oc-unscheduled:hover {background:var(--col)}
.oc-unscheduled {grid-template-columns:minmax(0,1fr) minmax(0,1fr)}
@media(max-width:750px) {
  .oc-top {padding:12px 10px 4px}
  .oc-legend {padding:6px 10px 12px}
  .oc-cell,.oc-blank {min-height:43px}
  .oc-cell {padding:0}
  .oc-weekday {text-align:center;padding:5px 0}
  .oc-previews {display:none}
  .oc-day {width:100%;min-height:43px;display:flex;flex-direction:column;gap:1px;padding:4px 0 1px;justify-content:flex-start}
  .oc-dots {display:flex;gap:3px;min-height:5px}
  .oc-dots i {width:5px;height:5px}
  .oc-entry {grid-template-columns:auto minmax(0,1fr)}
  .oc-state {grid-column:2}
}
.oc-preview {padding:4px 6px;border-left:3px solid currentColor}
.oc-preview small,.oc-preview span {display:block;overflow:hidden;text-overflow:ellipsis}
.oc-preview small {font-size:.72rem;line-height:1.2}
.oc-preview span {font-weight:600}
.order-balance {margin:12px 0;padding:8px 12px;border-left:3px solid var(--workspace-accent);background:var(--workspace-accent-soft);font-variant-numeric:tabular-nums}
