/* The directory shares the calendars' typography, account controls, and palette. */
body[data-calendar-page="companies"] { --company-forest: #326e52; --company-surface: rgba(255, 255, 255, 0.48); --company-field: rgba(255, 255, 255, 0.6); background: var(--paper); overflow-x: clip; }
body[data-calendar-page="companies"]:has(dialog[open]) { overflow: hidden; }
.companies-shell { width: min(1540px, 100%); }
.companies-shell .content-header::before { width: 100%; }
#companies-main { padding-top: 46px; }
.companies-hero { display: flex; align-items: center; justify-content: space-between; gap: 32px; margin-bottom: 36px; }
.companies-hero .content-eyebrow { color: var(--company-forest); }
.companies-hero h1 { margin: 0; font-size: clamp(42px, 4.9vw, 68px); line-height: 1.06; font-weight: 600; letter-spacing: -0.065em; }
.companies-hero h1 > span { color: var(--company-forest); }
.companies-intro { max-width: 550px; margin: 16px 0 0; color: var(--muted); font-size: 16px; line-height: 1.6; }
.companies-hero > button { flex: 0 0 auto; min-height: 48px; padding: 0 20px; font-size: 14px; }
.company-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 34px; padding: 26px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.company-metric { min-width: 0; padding: 0 28px; border-left: 1px solid var(--line); }
.company-metric:first-child { padding-left: 0; border-left: 0; }
.company-metric > span { display: block; color: var(--muted); font: 400 10px/1.5 var(--font-mono); letter-spacing: 0.06em; text-transform: uppercase; }
.company-metric strong { display: block; margin: 7px 0; font: 500 clamp(27px, 2.7vw, 38px)/1.2 var(--font-heading); letter-spacing: -0.055em; overflow-wrap: anywhere; }
.company-metric:nth-child(2) strong, .company-metric:nth-child(3) strong { color: var(--company-forest); }
.company-metric small { display: block; color: var(--subtle); font-size: 12px; line-height: 1.4; }
.company-filters { padding: 20px; border: 1px solid var(--line); border-radius: 16px; background: var(--company-surface); }
.company-filter-primary { display: grid; grid-template-columns: minmax(220px, 1fr) minmax(150px, 0.36fr) minmax(165px, 0.4fr); align-items: end; gap: 14px; }
.company-search { min-width: 0; min-height: 46px; padding: 0 14px; display: flex; align-items: center; gap: 10px; border: 1px solid var(--border-strong); border-radius: 9px; background: var(--company-field); }
.company-search svg { flex: 0 0 19px; color: var(--muted); }
.company-search:focus-within { outline: 3px solid rgba(49, 88, 223, 0.28); outline-offset: 2px; }
.company-search input { width: 100%; min-width: 0; height: 44px; padding: 0; border: 0; outline: 0; color: var(--ink); background: transparent; font-size: 14px; }
.company-search input:focus-visible { outline: 0; }
.company-search input::placeholder { color: var(--subtle); }
.company-filter { min-width: 0; display: grid; gap: 7px; }
.company-filter > span, .company-amount-filter legend { color: var(--muted); font-size: 11px; font-weight: 600; }
.company-filter select { width: 100%; min-width: 0; height: 46px; padding: 0 30px 0 12px; border: 1px solid var(--border-strong); border-radius: 9px; color: var(--ink); background-color: var(--company-field); font-size: 13px; }
.company-filter-contract { display: grid; grid-template-columns: minmax(150px, 0.7fr) minmax(230px, 1fr) minmax(150px, 0.7fr) minmax(130px, 0.75fr); align-items: end; gap: 14px; margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.company-amount-filter { min-width: 0; margin: 0; padding: 0; border: 0; }
.company-amount-filter legend { margin-bottom: 7px; padding: 0; }
.company-amount-inputs { display: flex; align-items: center; gap: 8px; color: var(--subtle); font-size: 12px; }
.company-amount-inputs label { display: flex; align-items: center; flex: 1; min-width: 0; gap: 5px; padding: 0 10px; border: 1px solid var(--border-strong); border-radius: 9px; background: var(--company-field); }
.company-amount-inputs input { width: 100%; min-width: 0; height: 44px; padding: 0; border: 0; color: var(--ink); background: transparent; font-size: 13px; }
.company-amount-inputs label:focus-within { outline: 3px solid rgba(49, 88, 223, 0.28); outline-offset: 2px; }
.company-amount-inputs input:focus-visible { outline: 0; }
.company-filter-note { margin: 0; padding-bottom: 5px; color: var(--subtle); font-size: 11px; line-height: 1.5; }
.company-results-row { min-height: 66px; display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.company-results-row > p { margin: 0; color: var(--muted); font-size: 13px; }
.company-text-button { min-height: 40px; padding: 4px 0 4px 10px; display: inline-flex; align-items: center; gap: 7px; border: 0; color: var(--muted); background: transparent; font-size: 12px; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 4px; }
.company-text-button:hover { color: var(--ink); text-decoration-color: currentColor; }
.company-text-button svg { width: 14px; }
.company-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.company-card { min-width: 0; min-height: 294px; padding: 24px; display: flex; flex-direction: column; align-items: stretch; border: 1px solid var(--border-strong); border-radius: 16px; color: var(--ink); background: var(--company-surface); text-align: left; transition: border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease; }
.company-card:hover { transform: translateY(-3px); border-color: var(--company-forest); box-shadow: 4px 5px 0 rgba(50, 110, 82, 0.16); }
.company-card:focus-visible { outline-color: var(--company-forest); }
.company-card-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.company-avatar { width: 50px; height: 50px; flex: 0 0 50px; display: grid; place-items: center; border: 1px solid rgba(50, 110, 82, 0.23); border-radius: 13px; color: #234e3a; background: #e5edc6; font: 700 18px var(--font-heading); letter-spacing: -0.04em; }
.company-status { width: fit-content; max-width: 100%; padding: 5px 8px; display: inline-flex; align-items: center; gap: 5px; border-radius: 6px; color: var(--muted); background: rgba(11, 19, 37, 0.06); font-size: 11px; font-weight: 600; overflow-wrap: anywhere; }
.company-status::before { content: ""; width: 5px; height: 5px; flex: 0 0 5px; border-radius: 50%; background: currentColor; }
.company-status.status--active { color: #2b6246; background: #dfeddf; }
.company-status.status--onboarding { color: #2341a9; background: #e0e7fa; }
.company-status.status--paused { color: #86561c; background: #f8e8ce; }
.company-status.status--completed { color: #62645b; background: #e7e6e0; }
.company-card h2 { margin: 0; font-size: 23px; font-weight: 600; line-height: 1.22; letter-spacing: -0.04em; overflow-wrap: anywhere; }
.company-industry { margin: 7px 0 0; color: var(--muted); font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; }
.company-services { min-height: 30px; margin: 17px 0 20px; display: flex; flex-wrap: wrap; align-items: flex-start; gap: 5px; }
.company-services > span { max-width: 100%; padding: 5px 8px; border: 1px solid var(--line); border-radius: 5px; color: var(--muted); font-size: 10px; line-height: 1.25; overflow-wrap: anywhere; }
.company-contract { margin-top: auto; padding-top: 16px; display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; border-top: 1px solid var(--line); }
.contract-value { min-width: 0; display: block; color: var(--ink); font: 600 21px/1.3 var(--font-heading); letter-spacing: -0.04em; overflow-wrap: anywhere; }
.contract-value small { display: block; margin-top: 3px; color: var(--subtle); font: 400 11px/1.4 var(--font-body); letter-spacing: 0; }
.contract-term { max-width: 48%; color: var(--muted); font-size: 11px; text-align: right; line-height: 1.4; overflow-wrap: anywhere; }
.company-card-footer { margin-top: 18px; display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--company-forest); font-size: 11px; font-weight: 500; }
.company-card-footer > span { min-width: 0; overflow-wrap: anywhere; }
.company-card-footer svg { width: 16px; flex: 0 0 16px; transition: transform 160ms ease; }
.company-card:hover .company-card-footer svg { transform: translateX(3px); }
.company-empty { padding: 64px 24px; border: 1px dashed var(--border-strong); border-radius: 16px; text-align: center; }
.company-empty-symbol { width: 64px; height: 64px; margin: 0 auto 24px; display: grid; place-items: center; border: 1px solid rgba(50, 110, 82, 0.2); border-radius: 18px; color: var(--company-forest); background: #e5edc6; }
.company-empty-symbol svg { width: 28px; stroke-width: 1.4; }
.company-empty h2 { margin: 0 0 10px; font-size: 27px; font-weight: 500; letter-spacing: -0.045em; }
.company-empty p { max-width: 390px; margin: 0 auto 24px; color: var(--muted); font-size: 14px; line-height: 1.6; }
.companies-footer { margin-top: 36px; padding-top: 20px; display: flex; align-items: center; justify-content: space-between; gap: 20px; border-top: 1px solid var(--line); color: var(--subtle); }
.companies-footer > span { font: 400 9px/1.5 var(--font-mono); letter-spacing: 0.04em; text-transform: uppercase; }
.companies-footer p { margin: 0; max-width: 60%; font-size: 11px; text-align: right; line-height: 1.5; }
.company-dialog { width: min(720px, calc(100vw - 32px)); max-height: min(900px, calc(100dvh - 32px)); }
.company-dialog[open] { display: flex; flex-direction: column; }
.company-dialog .content-dialog-header { align-items: flex-start; flex-shrink: 0; }
.company-dialog .content-dialog-footer { flex-shrink: 0; }
.company-dialog .content-dialog-header h2 { font-size: 24px; font-weight: 600; }
.company-dialog .content-eyebrow { color: var(--company-forest); font-size: 9px; }
.company-detail-content { min-height: 0; padding: 0 26px 26px; overflow-y: auto; overflow-wrap: anywhere; }
.detail-header { display: flex; align-items: center; gap: 16px; padding: 8px 0 25px; }
.detail-header > div { min-width: 0; }
.detail-header .company-avatar { width: 64px; height: 64px; flex-basis: 64px; font-size: 22px; }
.detail-header h2, .detail-header h3 { margin: 0 0 7px; font: 600 31px/1.2 var(--font-heading); letter-spacing: -0.05em; overflow-wrap: anywhere; }
.detail-header p { margin: 0 0 8px; color: var(--muted); font-size: 14px; }
.detail-metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 26px; }
.detail-metrics > div { min-width: 0; padding: 17px; border: 1px solid var(--line); border-radius: 12px; background: var(--company-surface); }
.detail-metrics span, .detail-metrics dt { display: block; margin: 0 0 8px; color: var(--muted); font: 400 9px/1.5 var(--font-mono); text-transform: uppercase; letter-spacing: 0.04em; }
.detail-metrics strong, .detail-metrics dd { display: block; margin: 0; font: 500 24px/1.3 var(--font-heading); letter-spacing: -0.035em; }
.detail-metrics small { display: block; margin-top: 5px; color: var(--subtle); font: 400 12px/1.4 var(--font-body); letter-spacing: 0; }
.detail-section { margin-top: 22px; padding-top: 22px; border-top: 1px solid var(--line); }
.detail-section h3 { margin: 0 0 16px; font: 600 16px var(--font-heading); letter-spacing: -0.025em; }
.detail-section > p { color: var(--muted); font-size: 14px; line-height: 1.6; }
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 24px; margin: 0; }
.detail-grid > div { min-width: 0; }
.detail-grid dt { margin-bottom: 6px; color: var(--subtle); font-size: 11px; }
.detail-grid dd { margin: 0; color: var(--ink); font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }
.detail-grid a, .detail-section a { color: var(--company-forest); text-decoration-thickness: 1px; text-underline-offset: 3px; }
.detail-notes { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; }
.detail-actions { margin-top: 28px; padding-top: 22px; display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 10px; border-top: 1px solid var(--line); }
.detail-actions a { text-decoration: none; }
.detail-actions .detail-delete { margin-right: auto; }
.company-form-body { min-height: 0; padding: 22px 26px 26px; display: grid; gap: 24px; overflow-y: auto; }
.company-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 19px 16px; }
.company-form-grid > .full-row { grid-column: 1 / -1; }
.company-form-section { min-width: 0; margin: 0; padding: 22px 0 0; border: 0; border-top: 1px solid var(--line); }
.company-form-section legend { padding: 0 10px 0 0; color: var(--ink); font: 600 17px var(--font-heading); letter-spacing: -0.025em; }
.company-section-help { margin: 0 0 18px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.company-dialog .content-form-field { min-width: 0; }
.company-dialog .content-form-field > span { color: var(--muted); font-size: 12px; }
.company-dialog .content-form-field input, .company-dialog .content-form-field select, .company-dialog .content-form-field textarea { min-width: 0; background: var(--company-field); font-size: 14px; }
.company-dialog .content-form-field input, .company-dialog .content-form-field select { height: 46px; }
.company-dialog .content-form-field small { color: var(--subtle); font-size: 11px; }
.company-dialog .content-dialog-footer { background: var(--company-surface); }
.company-form-error { margin: 0; padding: 12px 14px; border: 1px solid var(--coral); border-radius: 8px; color: var(--ink); background: rgba(255, 104, 70, 0.1); font-size: 13px; line-height: 1.5; }
.company-dialog button:disabled { opacity: 0.55; cursor: wait; }
.company-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
html[data-theme="dark"] body[data-calendar-page="companies"] { --company-forest: #a8d6ac; --company-surface: #151f31; --company-field: #111a2d; --line: rgba(244, 240, 232, 0.12); --border-strong: rgba(244, 240, 232, 0.2); background: var(--canvas); }
html[data-theme="dark"] .company-card:hover { box-shadow: 4px 5px 0 rgba(168, 214, 172, 0.14); }
html[data-theme="dark"] .company-avatar, html[data-theme="dark"] .company-empty-symbol { color: #d6edc7; border-color: #476147; background: #2a3b2d; }
html[data-theme="dark"] .company-status.status--active { color: #afd5b8; background: #233f35; }
html[data-theme="dark"] .company-status.status--onboarding { color: #c3d4ff; background: #253558; }
html[data-theme="dark"] .company-status.status--paused { color: #efc88f; background: #443827; }
html[data-theme="dark"] .company-status.status--completed { color: #c6c5be; background: #323633; }
@media (max-width: 1100px) {
  .company-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .company-metric { padding: 0 18px; }
  .company-filter-contract { grid-template-columns: minmax(135px, 0.7fr) minmax(220px, 1fr) minmax(150px, 0.7fr); }
  .company-filter-note { grid-column: 1 / -1; padding: 0; }
}
@media (max-width: 760px) {
  #companies-main { padding-top: 32px; }
  .companies-hero { gap: 22px; align-items: flex-start; margin-bottom: 28px; }
  .companies-intro { font-size: 14px; }
  .companies-hero > button { margin-top: 24px; min-height: 44px; padding: 0 13px; font-size: 12px; }
  .company-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 0; padding: 22px 0; }
  .company-metric:nth-child(3) { padding-left: 0; border-left: 0; }
  .company-metric small { font-size: 11px; }
  .company-filter-primary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .company-search { grid-column: 1 / -1; }
  .company-filter-contract { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .company-amount-filter { grid-column: 1 / -1; grid-row: 2; }
  .company-card { padding: 20px; }
  .company-card h2 { font-size: 21px; }
  .company-grid { gap: 14px; }
}
@media (max-width: 520px) {
  .companies-hero { flex-direction: column; gap: 22px; }
  .companies-hero > button { margin-top: 0; }
  .companies-intro { max-width: 360px; margin-top: 12px; }
  .company-metrics { margin-bottom: 24px; }
  .company-metric { padding: 0 12px; }
  .company-metric > span { font-size: 9px; }
  .company-filters { padding: 15px; }
  .company-filter-primary, .company-filter-contract { gap: 12px; }
  .company-search { padding: 0 10px; }
  .company-search input { font-size: 12px; }
  .company-filter select { padding-left: 9px; padding-right: 8px; font-size: 12px; }
  .company-grid { grid-template-columns: minmax(0, 1fr); }
  .company-card { min-height: 278px; padding: 23px; }
  .company-card h2 { font-size: 25px; }
  .company-empty { padding: 44px 20px; }
  .company-empty h2 { font-size: 25px; }
  .companies-footer { align-items: flex-start; flex-direction: column; gap: 10px; }
  .companies-footer p { max-width: 100%; text-align: left; }
  .company-dialog { width: calc(100vw - 18px); max-height: calc(100dvh - 18px); }
  .company-detail-content, .company-form-body { padding-left: 18px; padding-right: 18px; }
  .company-form-grid { grid-template-columns: minmax(0, 1fr); }
  .detail-header { align-items: flex-start; }
  .detail-header .company-avatar { width: 50px; height: 50px; flex-basis: 50px; font-size: 18px; }
  .detail-header h2, .detail-header h3 { font-size: 26px; }
  .detail-metrics { gap: 8px; }
  .detail-metrics > div { padding: 14px; }
  .detail-metrics strong { font-size: 21px; }
  .detail-grid { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .detail-actions > a, .detail-actions > button { flex: 1 1 auto; }
}
@media (prefers-reduced-motion: reduce) {
  .company-card, .company-card-footer svg { transition: none; }
  .company-card:hover, .company-card:hover .company-card-footer svg { transform: none; }
}
