@font-face { font-family: AWI; src: url('./assets/TTDrugs-Regular.otf') format('opentype'); font-weight: 400; font-display: swap; }
@font-face { font-family: AWI; src: url('./assets/TTDrugs-Bold.otf') format('opentype'); font-weight: 700; font-display: swap; }

:root {
    color-scheme: light;
    --ink: #102a43;
    --muted: #526974;
    --paper: #f5f3ed;
    --border: #e0e5e6;
    --light: #f0f4f6;
    --gold: #9c5d17;
    --green: #006653;
    --radius: 16px;
    --shadow: 0 8px 24px #1731490a, 0 1px 3px #1731490a;
    font: 15px/1.55 AWI, system-ui, sans-serif;
    color: var(--ink);
    background: var(--paper);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { min-height: 100vh; margin: 0; background: linear-gradient(180deg, #fbfaf7 0, var(--paper) 420px); }
img { max-width: 100%; display: block; }
a { color: inherit; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .55em; }
h1 { letter-spacing: -.025em; font-size: clamp(1.8rem, 3.5vw, 2.55rem); }
h2 { font-size: clamp(1.23rem, 2.35vw, 1.55rem); }
h3 { font-size: 1.02rem; }
p { margin: 0 0 1em; }
small, .small, .muted, .field small { color: var(--muted); font-size: .88rem; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.app-header { border-bottom: 1px solid var(--border); background: #fff; box-shadow: 0 2px 16px #17314909; }
.bar-inner { max-width: 1160px; width: calc(100% - 48px); margin-inline: auto; }
.bar-inner:not(.tab-strip) { min-height: 70px; display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.wordmark { flex: 0 1 168px; min-width: 92px; }
.wordmark img { width: 168px; height: auto; }
.bar-controls { display: flex; align-items: center; justify-content: flex-end; gap: 16px; min-width: 0; }
.header-phone { font-weight: 700; white-space: nowrap; text-decoration: none; }
.org-name { max-width: 34ch; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 700; }
.workspace-nav { overflow-x: auto; scrollbar-width: thin; border-top: 1px solid #edf0f1; }
.tab-strip { display: flex; gap: 5px; width: max-content; min-width: min(100% - 48px, 1160px); padding: 7px 4px 9px; }
.tab-strip button { display: inline-flex; gap: 7px; align-items: center; min-height: 42px; white-space: nowrap; color: var(--muted); border: 0; border-radius: 9px; padding: 8px 12px; background: transparent; }
.tab-strip button:hover { color: var(--ink); background: #f3f5f6; }
.tab-strip button[aria-current="page"] { background: #eaf0f5; color: var(--ink); font-weight: 700; }
.tab-strip svg { stroke: currentColor; fill: none; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }

#app, .app-notice { width: min(1160px, calc(100% - 48px)); margin-inline: auto; }
#app { padding-block: clamp(20px, 4vw, 48px) 52px; }
#app:focus { outline: none; }
.app-notice { margin-top: 16px; padding: 10px 14px; border: 1px solid #d4b275; border-radius: 4px; color: #613d0b; background: #fff5df; overflow-wrap: anywhere; }
.loading { max-width: 40rem; margin: 30px auto; color: var(--muted); }
.flow-leading, .workspace-head { margin-bottom: 24px; }
.flow-leading > p, .workspace-head > div > p { color: var(--muted); margin-block: 4px 0; }
.step-rail { margin: 0 0 20px; padding: 5px; overflow-x: auto; scrollbar-width: thin; border: 1px solid var(--border); border-radius: 12px; background: #fff; }
.step-rail ol { display: flex; gap: 5px; width: max-content; padding: 0; margin: 0; list-style: none; }
.step-rail button { min-height: 40px; background: transparent; border: 0; border-radius: 8px; color: var(--muted); padding: 6px 11px; white-space: nowrap; }
.step-rail button:hover:not(:disabled) { background: var(--light); }
.step-rail button span { margin-right: .4rem; font-size: .8em; color: var(--gold); }
.step-rail button.is-current { color: var(--ink); background: #f3eadd; font-weight: 700; }

.split-view { display: grid; align-items: start; grid-template-columns: minmax(0, 2.25fr) minmax(235px, .95fr); gap: 22px; }
.surface { min-width: 0; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; box-shadow: var(--shadow); }
.surface { padding: clamp(15px, 2.8vw, 29px); }
.surface > :last-child { margin-bottom: 0; }
.summary-card { padding: clamp(16px, 2vw, 23px); }
.flow-form + .summary-card { position: sticky; top: 16px; }
.summary-card > .toolbar { justify-content: space-between; align-items: center; margin-bottom: 14px; }
.summary-card > .toolbar h2 { margin: 0; }
.summary-card p { color: var(--muted); font-size: .9rem; margin: 12px 0 0; }
.summary-card dl, .detail-list { margin: 0; }
.summary-card dl > div, .detail-list > div, .record-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: .65rem 0; border-top: 1px solid var(--border); }
.summary-card dt, .detail-list dt { min-width: 0; color: var(--muted); }
.summary-card dd, .detail-list dd { min-width: 0; margin: 0; text-align: right; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.summary-card .summary-total, .summary-total { border-top: 2px solid #c19c61; color: var(--ink); font-weight: 700; }
.flow-foot, .actions, .toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.flow-foot { margin-top: 23px; padding-top: 17px; border-top: 1px solid var(--border); }
.flow-foot p, .actions p { margin: 0; }

.primary, .secondary { display: inline-flex; align-items: center; justify-content: center; min-height: 42px; border-radius: 8px; padding: 8px 14px; font-weight: 700; font-size: .94rem; text-decoration: none; text-align: center; line-height: 1.28; }
.primary { color: #fff; background: var(--ink); border: 1px solid var(--ink); }
.primary:hover:not(:disabled) { background: #164a65; }
.secondary { color: var(--ink); background: #fff; border: 1px solid var(--border); }
.secondary:hover:not(:disabled) { border-color: var(--ink); }
.primary:disabled, .secondary:disabled { opacity: .5; }
.link-button { background: transparent; border: 0; padding: 3px 0; text-align: left; text-decoration: underline; text-underline-offset: .24em; text-decoration-color: #8196a7; color: var(--ink); }
.tile-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.option { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; color: var(--ink); background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 15px 16px; min-width: 0; text-align: left; }
.option small, .option span { color: var(--muted); }
.option:hover:not(:disabled) { border-color: var(--ink); }
.option.is-current, .option[aria-pressed="true"], .option[aria-selected="true"] { border-color: #b89255; background: #fcf7ef; box-shadow: inset 0 0 0 1px #b89255; }
.option:disabled { background: var(--light); color: var(--muted); }
.row-list, .tier-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; }
ul.row-list { margin: 0; padding: 0; list-style: none; }
.record-row { flex-wrap: wrap; overflow-wrap: anywhere; }
.tier-option { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; width: 100%; column-gap: 12px; align-items: center; }
.tier-option strong { font-variant-numeric: tabular-nums; }

.field-grid, .contact-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
.field { display: grid; min-width: 0; gap: 5px; margin-bottom: 11px; }
.field input, .field select, .field textarea, .toolbar input, .toolbar select { width: 100%; min-width: 0; padding: 9px 11px; min-height: 44px; border-radius: 8px; border: 1px solid #c7d3da; color: var(--ink); background: #fff; }
.field textarea { min-height: 90px; resize: vertical; }
input[type="checkbox"] { width: 18px; height: 18px; margin: .15em 0 0; accent-color: var(--green); flex: 0 0 auto; }
.consent { display: flex; gap: 9px; align-items: flex-start; margin-block: 14px; }
.organization-search { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.organization-search .field { flex: 1 1 220px; margin-bottom: 0; }
.seat-notice { background: #e5f4ef; padding: 10px 13px; margin: 13px 0; border-left: 3px solid var(--green); color: var(--green); }
.team-groups { margin-top: 13px; }
.team-group, .group-card { padding: 12px 0; border-top: 1px solid var(--border); }
.team-group summary, .group-card summary { cursor: pointer; font-weight: 700; }
.team-role-list { margin-block: 8px 0; }
.team-role { display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; border-top: 1px solid var(--border); padding: 6px 0; }
.team-role button, .team-count button { border: 1px solid var(--border); border-radius: 4px; color: var(--ink); background: #fff; padding: 5px 8px; min-height: 32px; }
.team-count { display: flex; gap: 6px; align-items: center; font-variant-numeric: tabular-nums; }
.group-count { color: var(--green); margin-left: 5px; }
.payment-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 0 0 24px; }
.payment-option { min-height: 114px; }
.section-title { margin: 22px 0 10px; }

.workspace-head { display: flex; justify-content: space-between; gap: 12px 20px; align-items: flex-start; flex-wrap: wrap; }
.workspace-head > div { min-width: 0; }
.workspace-head h1 { overflow-wrap: anywhere; }
.signin-card { max-width: 510px; margin: 0 auto; }
.receipt { max-width: 820px; margin-inline: auto; }
.stack { display: grid; min-width: 0; gap: 16px; }
.stack > .surface + .surface { margin-top: 0; }
.tile { min-width: 0; padding: 13px; border: 1px solid var(--border); border-radius: 10px; overflow-wrap: anywhere; }
.tile p { margin: 6px 0; }
.surface + .surface, .summary-card + .summary-card { margin-top: 14px; }
.empty-state { text-align: center; padding: clamp(22px, 5vw, 55px) 12px; color: var(--muted); border: 1px dashed #ced9df; border-radius: 11px; background: #f9fbfc; }
.empty-state strong { color: var(--ink); }
.status { display: inline-block; padding: 3px 8px; color: #724a12; background: #fff1d6; border-radius: 99px; font-weight: 700; font-size: .78rem; }
.kpi-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-block: 12px; }
.kpi-row > * { padding: 10px; border: 1px solid var(--border); border-radius: 6px; background: #fff; }
.kpi-row strong { font-size: 1.3rem; display: block; }
.check-list { list-style: none; padding: 0; margin: 0; }
.check-list li { border-top: 1px solid var(--border); padding: 8px 0; }
.cabinet-content > .toolbar { margin-bottom: 13px; }
.cabinet-content > .toolbar.surface { align-items: flex-end; }
.cabinet-content > .toolbar.surface .field { flex: 1 1 140px; margin: 0; }
.table-wrap { width: 100%; max-width: 100%; overflow-x: auto; }
table, .table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
thead th { font-size: .86rem; color: var(--muted); background: var(--light); }
.upload-field input[type="file"] { font-size: .85rem; }
.upload-field input[type="file"]::file-selector-button { border: 0; border-radius: 5px; background: var(--light); color: var(--ink); padding: 5px 8px; margin-right: 6px; }
progress, .progress-line { width: 100%; accent-color: var(--green); }

.overview-hero {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(205px, .34fr);
    align-items: center;
    gap: clamp(18px, 4vw, 52px);
    margin-bottom: 21px;
    padding: clamp(20px, 4vw, 42px);
    border-radius: 22px;
    overflow: hidden;
    color: #fff;
    background: radial-gradient(ellipse at 93% -10%, #34557b 0, #193553 37%, transparent 68%), linear-gradient(120deg, #081a30, #152f49);
    box-shadow: 0 12px 28px #15283f21;
}
.overview-hero::before {
    content: '';
    position: absolute;
    inset: 0 0 0 49%;
    background-image: linear-gradient(#e9c79316 1px, transparent 1px), linear-gradient(90deg, #e9c79316 1px, transparent 1px);
    background-size: 32px 32px;
    mask-image: linear-gradient(90deg, transparent, #000 78%);
    pointer-events: none;
}
.overview-intro, .overview-figures { position: relative; min-width: 0; }
.overview-label { margin: 0 0 8px; color: #edc891; font-size: .82rem; font-weight: 700; }
.overview-hero h1 { max-width: 20ch; margin: 0 0 7px; font-size: clamp(1.7rem, 4vw, 3rem); overflow-wrap: anywhere; }
.overview-reference { margin-bottom: 19px; color: #ccd9e4; overflow-wrap: anywhere; }
.overview-actions { gap: 8px; }
.overview-actions .primary { background: #eed2a5; border-color: #eed2a5; color: #152d48; }
.overview-actions .primary:hover { background: #f8deba; border-color: #f8deba; }
.overview-actions .secondary { border-color: #ffffff4d; background: #ffffff12; color: #fff; }
.overview-actions .secondary:hover { border-color: #ffffffa6; background: #ffffff29; }
.overview-actions :focus-visible { outline-color: #f1d5aa; }
.overview-figures { margin: 0; padding: 5px 16px; border: 1px solid #ffffff38; border-radius: 12px; background: #0a203580; }
.overview-figures > div { padding-block: 10px; }
.overview-figures > div + div { border-top: 1px solid #ffffff30; }
.overview-figures dt { color: #cddae6; font-size: .84rem; }
.overview-figures dd { margin: 0; color: #ffe3b9; font-variant-numeric: tabular-nums; font-size: clamp(1.22rem, 2.1vw, 1.65rem); font-weight: 700; line-height: 1.22; overflow-wrap: anywhere; }

.overview-layout { grid-template-columns: minmax(0, 2.2fr) minmax(258px, 1fr); gap: 18px; }
.overview-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.overview-document, .overview-company { display: flex; flex-direction: column; align-items: flex-start; gap: 9px; }
.overview-document { background: linear-gradient(160deg, #f7f7f4, #fff 72%); }
.overview-document > strong { min-height: 3em; line-height: 1.35; }
.overview-document > .link-button { margin-top: auto; }
.document-topline { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 7px; width: 100%; }
.document-symbol { position: relative; display: grid; width: 34px; height: 34px; flex: 0 0 34px; place-items: center; border-radius: 9px; background: #e7eef4; color: #203e5f; }
.document-symbol::before { content: ''; width: 13px; height: 17px; border: 1.5px solid currentColor; border-radius: 2px; }
.document-symbol::after { position: absolute; content: ''; width: 7px; height: 5px; border-block: 1px solid currentColor; }
.overview-company { background: #f3f6f8; border-color: #e3eaee; }
.overview-company > span { color: var(--muted); }
.overview-company strong { font-size: clamp(1.28rem, 2vw, 1.65rem); line-height: 1; font-variant-numeric: tabular-nums; }
.overview-count { background: #eaf1f5; white-space: nowrap; border-radius: 99px; color: var(--ink); padding: 3px 9px; font-weight: 700; font-size: .82rem; }
.overview-aside progress { display: block; height: 8px; border: 0; border-radius: 99px; overflow: hidden; background: #e8edf0; margin-bottom: 12px; }
.overview-aside progress::-webkit-progress-bar { background: #e8edf0; }
.overview-aside progress::-webkit-progress-value { background: #228071; border-radius: 99px; }
.overview-aside progress::-moz-progress-bar { background: #228071; border-radius: 99px; }
.overview-aside .check-list li { display: flex; align-items: flex-start; gap: 9px; padding-block: 9px; color: #425767; }
.task-mark { flex: 0 0 18px; width: 18px; height: 18px; margin-top: 2px; border: 1px solid #acbdc8; border-radius: 50%; }
.is-done .task-mark { display: grid; place-items: center; background: #e3f3ee; border-color: #8cc6b7; color: #066456; font: 700 12px/1 system-ui, sans-serif; }
.overview-stages { margin: 0 0 0 6px; padding: 0; list-style: none; }
.overview-stages li { position: relative; border-left: 1px solid #d8e1e6; padding: 5px 0 9px 15px; }
.overview-stages li::before { content: ''; position: absolute; top: 11px; left: -4px; width: 7px; height: 7px; border-radius: 50%; background: #bf9b61; }
.overview-stages li:last-child { padding-bottom: 4px; }
.overview-workspace { border-color: #e8dcc8; background: linear-gradient(150deg, #fcf6eb, #fff 80%); }
.overview-workspace h2 { font-size: 1.23rem; margin: 0; }
.overview-workspace p { margin: 7px 0 14px; color: var(--muted); }
.overview-workspace .primary { display: flex; width: 100%; gap: 10px; }

.company-settings { display: grid; gap: 16px; }
.company-settings > .workspace-head { margin: 0; }
.company-summary { display: flex; align-items: center; gap: 18px; overflow-wrap: anywhere; }
.company-summary p { margin: 4px 0 8px; color: var(--muted); }
.company-logo { flex: 0 0 70px; height: 70px; display: grid; place-items: center; border: 1px solid #ddcfb7; border-radius: 16px; background: #f8f0e1; color: #18344d; font-size: 1.4rem; font-weight: 700; }
.company-logo img { display: block; width: 100%; height: 100%; object-fit: contain; border-radius: inherit; }
.company-figures { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); padding: 10px 0 0; margin: 15px 0 0; border-top: 1px solid var(--line); gap: 9px; }
.company-figures dt { color: var(--muted); line-height: 1.2; }
.company-figures dd { margin: 5px 0 0; font-size: 1.35rem; font-weight: 700; }
.company-settings :is(input, .split-view > *) { min-width: 0; }
.company-settings [data-company-message]:empty { display: none; }

@media (max-width: 980px) {
    .overview-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
    #app, .app-notice, .bar-inner { width: calc(100% - 28px); }
    .bar-inner:not(.tab-strip) { min-height: 62px; }
    .tab-strip { width: max-content; min-width: calc(100% - 28px); }
    .split-view { grid-template-columns: minmax(0, 1fr); gap: 14px; }
    .flow-form + .summary-card { position: static; }
    .wordmark { flex-basis: 133px; }
    .header-phone { display: none; }
    .flow-leading, .workspace-head { margin-bottom: 14px; }
    .overview-hero { grid-template-columns: minmax(0, 1fr); gap: 13px; margin-bottom: 15px; }
    .overview-figures { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); padding-inline: 11px; }
    .overview-figures > div { padding-right: 7px; }
    .overview-figures > div + div { border-top: 0; border-left: 1px solid #ffffff30; padding-left: 11px; }
}

@media (max-width: 435px) {
    .tier-option { grid-template-columns: minmax(0, 1fr) auto; gap: 4px 7px; }
    .tier-option > :first-child { grid-column: 1 / -1; }
    .tile-grid, .field-grid, .contact-fields { grid-template-columns: 1fr; }
    .payment-option { padding: 9px; }
    .org-name { max-width: 14ch; }
    .bar-controls { gap: 6px; }
    .team-role { flex-wrap: wrap; }
    .overview-hero { border-radius: 17px; }
    .overview-grid { grid-template-columns: minmax(0, 1fr); }
    .overview-document > strong { min-height: 0; }
    .overview-company { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; align-items: start; }
    .overview-company .link-button { grid-column: 1 / -1; }
}
