:root {
    --primary: #314256;
    --accent: #5F758D;
    --success: #819564;
    --warning: #AF6D57;
    --bg: #F7F8FA;
    --surface: #FFFFFF;
    --soft: #F1F4F7;
    --text: #1F2933;
    --line: #DDE3EA;
    --muted: #667587;
    --white: #FFFFFF;
}
.dark {
    --primary: #D7E2ED;
    --accent: #A8B8C9;
    --success: #A9BE8A;
    --warning: #D99A84;
    --bg: #0B1220;
    --surface: #111827;
    --soft: #182233;
    --text: #E6EDF5;
    --line: #263244;
    --muted: #A6B3C2;
    --white: #111827;
}
* { box-sizing: border-box; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Montserrat, Arial, system-ui, sans-serif;
    font-size: 14px;
}
a { color: var(--primary); text-decoration: none; }
.app-shell { min-height: 100vh; display: flex; }
.sidebar {
    width: 248px;
    background: #F4F6F8;
    color: var(--text);
    padding: 22px 16px;
    display: flex;
    flex-direction: column;
    gap: 22px;
    border-right: 1px solid var(--line);
}
.dark .sidebar { background: #111827; color: #E6EDF5; border-right: 1px solid var(--line); }
.dark .brand { background: transparent; }
.brand {
    display: block;
    background: transparent;
    border-radius: 8px;
    padding: 4px 0;
}
.brand img, .auth-logo {
    display: block;
    width: 100%;
    height: auto;
}
.logo-dark { display: none !important; }
.dark .logo-light { display: none !important; }
.dark .logo-dark { display: block !important; }
.auth-logo {
    width: min(260px, 100%);
    margin-bottom: 14px;
}
.sidebar nav { display: grid; gap: 4px; overflow: auto; padding-right: 2px; }
.nav-section {
    margin: 13px 8px 3px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
}
.sidebar nav a {
    color: var(--text);
    padding: 11px 12px;
    border-radius: 6px;
    font-weight: 700;
}
.sidebar nav a.active, .sidebar nav a:hover { background: #EEF3F7; color: var(--primary); }
.dark .sidebar nav a { color: rgba(255,255,255,.82); }
.dark .sidebar nav a.active, .dark .sidebar nav a:hover { background: rgba(255,255,255,.12); color: #FFFFFF; }
.sidebar-user { margin-top: auto; display: grid; gap: 6px; font-size: 12px; color: var(--muted); }
.sidebar-user a { color: var(--primary); }
.dark .sidebar-user { color: rgba(255,255,255,.72); }
.dark .sidebar-user a { color: #FFFFFF; }
.main { flex: 1; padding: 28px; min-width: 0; max-width: 1480px; }
.auth-main { width: 100%; max-width: 460px; margin: 7vh auto; padding: 24px; }
.page-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 20px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--line);
}
.page-head > div:first-child { display: grid; gap: 4px; }
h1 { margin: 0; font-size: 28px; }
h2 { font-size: 18px; margin: 0 0 14px; }
.page-kicker { margin: 0; color: var(--muted); max-width: 680px; line-height: 1.45; }
.panel, .card {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 18px;
    margin-bottom: 18px;
}
.grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.metric strong { display: block; font-size: 26px; color: var(--text); }
.metric span { color: var(--muted); }
.metric.urgent { border-color: #E7B6A8; background: #FFF5F1; }
.dark .metric.urgent { background: #2B1817; border-color: #573028; }
table { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--surface); color: var(--text); }
th, td { padding: 14px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; background: var(--soft); }
thead th:first-child { border-top-left-radius: 6px; }
thead th:last-child { border-top-right-radius: 6px; }
tbody tr:hover { background: rgba(95,117,141,.07); }
td a:not(.btn) { font-weight: 800; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.money, .num { text-align: right; white-space: nowrap; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.btn, button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    border: 1px solid var(--primary);
    background: var(--primary);
    color: var(--white);
    border-radius: 6px;
    padding: 10px 16px;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}
.btn.secondary, button.secondary { background: var(--surface); color: var(--primary); }
.btn.danger, button.danger { background: var(--warning); border-color: var(--warning); color: #FFFFFF; }
input, select, textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 12px 14px;
    min-height: 44px;
    font: inherit;
    background: var(--surface);
    color: var(--text);
}
textarea { min-height: 92px; resize: vertical; }
label { display: grid; gap: 7px; color: var(--muted); font-size: 12px; font-weight: 800; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.full { grid-column: 1 / -1; }
.flash { padding: 12px 14px; border-radius: 6px; margin-bottom: 14px; border: 1px solid var(--line); background: var(--surface); }
.flash-success { border-color: #c7d7b5; background: #f3f8ee; }
.flash-error { border-color: #e1b9ad; background: #fff3ef; }
.badge {
    display: inline-flex;
    border-radius: 999px;
    padding: 4px 9px;
    font-size: 12px;
    background: #E8EDF2;
    color: var(--primary);
}
.badge-approved, .badge-accepted, .badge-paid, .badge-delivered, .badge-ready { background: #EAF2E2; color: #52683A; }
.badge-rejected, .badge-declined, .badge-cancelled, .badge-overdue { background: #F8E9E3; color: #8C4D3B; }
.badge-sent, .badge-dispatched, .badge-in-production { background: #E6EEF6; color: #405B77; }
.dark .badge { background: #263244; color: #E6EDF5; }
.dark .badge-approved, .dark .badge-accepted, .dark .badge-paid, .dark .badge-delivered, .dark .badge-ready { background: #23351F; color: #CDE4B3; }
.dark .badge-rejected, .dark .badge-declined, .dark .badge-cancelled, .dark .badge-overdue { background: #45251F; color: #F2C0B1; }
.dark .badge-sent, .dark .badge-dispatched, .dark .badge-in-production { background: #1D334A; color: #BBD7F2; }
.item-row { display: grid; grid-template-columns: 1fr 1.2fr 2fr .6fr .75fr .75fr .7fr .7fr 90px 44px; gap: 8px; margin-bottom: 10px; align-items: start; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--soft); }
.item-row textarea { min-height: 38px; }
.item-row:hover, .po-item-row:hover, .tier-row:hover { border-color: var(--accent); }
.selected-product { border-color: var(--success); box-shadow: 0 0 0 2px rgba(129,149,100,.16); }
.po-item-row { display: grid; grid-template-columns: minmax(220px, 1fr) .45fr .65fr .65fr .55fr 44px; gap: 8px; margin-bottom: 10px; align-items: start; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--soft); }
.line-description { margin-top: 4px; color: var(--muted); white-space: normal; }
.compact-check { display: flex; align-items: center; gap: 6px; min-height: 36px; }
.compact-check input { width: auto; }
.tier-row { display: grid; grid-template-columns: 1fr 1fr 1fr 44px; gap: 8px; margin-bottom: 10px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--soft); }
.print-page { background: var(--surface); max-width: 900px; margin: 0 auto; padding: 36px; border: 1px solid var(--line); }
.print-actions { max-width: 900px; margin: 0 auto 16px; }
.muted { color: var(--muted); }
.help-text, .field-help { color: var(--muted); font-size: 12px; line-height: 1.45; font-weight: 600; }
.section-title { margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line); }
.toolbar, .filter-bar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}
.filter-bar { padding: 12px; border-radius: 8px; background: var(--soft); border: 1px solid var(--line); }
.filter-bar input { max-width: 360px; }
.empty-state {
    padding: 26px;
    border: 1px dashed var(--line);
    border-radius: 8px;
    background: var(--soft);
    color: var(--muted);
    text-align: center;
}
.summary-strip {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin: 12px 0 18px;
}
.summary-item {
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--soft);
}
.summary-item span { display: block; color: var(--muted); font-size: 12px; font-weight: 800; }
.summary-item strong { display: block; margin-top: 3px; font-size: 18px; }
.next-step {
    border-left: 4px solid var(--success);
    background: var(--soft);
    padding: 12px;
    border-radius: 8px;
}
.danger-zone { border-color: #E7B6A8; background: #FFF5F1; }
.dark .danger-zone { background: #2B1817; border-color: #573028; }
.action-link { font-weight: 800; }
.copy-done { outline: 2px solid var(--success); outline-offset: 2px; }
.tab-panel { padding: 10px; }
.tab-nav {
    gap: 6px;
    padding: 4px;
    border-radius: 8px;
    background: var(--soft);
    border: 1px solid var(--line);
}
.tab-nav a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 9px 14px;
    border-radius: 6px;
    color: var(--text);
    font-weight: 700;
    border: 1px solid transparent;
}
.tab-nav a:hover, .tab-nav a.active {
    background: var(--surface);
    border-color: var(--line);
    color: var(--primary);
}
.dark .tab-nav { background: #182233; }
.dark .tab-nav a { color: #E6EDF5; }
.dark .tab-nav a:hover, .dark .tab-nav a.active { background: #111827; color: #FFFFFF; }
.logo-preview, .document-logo-wrap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: max-content;
    max-width: 100%;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #FFFFFF;
}
.logo-preview img, .document-logo {
    display: block;
    max-width: 220px;
    max-height: 90px;
    object-fit: contain;
}
.help-toc a.card {
    display: grid;
    gap: 6px;
    color: var(--text);
}
.help-search-panel {
    position: sticky;
    top: 0;
    z-index: 3;
    box-shadow: 0 8px 18px rgba(31,41,51,.05);
}
.help-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}
.help-actions a {
    display: grid;
    gap: 5px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--soft);
    color: var(--text);
}
.help-actions a:hover {
    border-color: var(--accent);
    background: var(--surface);
}
.help-actions strong { font-size: 15px; }
.help-actions span { color: var(--muted); line-height: 1.4; }
.help-backtop { justify-content: center; margin: 8px 0 24px; }
.help-toc a.card:hover {
    border-color: var(--accent);
    background: var(--soft);
}
.help-toc strong { font-size: 16px; }
.help-toc span { color: var(--muted); line-height: 1.4; }
.help-section { scroll-margin-top: 24px; }
.help-steps, .help-list {
    margin: 0;
    padding-left: 22px;
    display: grid;
    gap: 10px;
    line-height: 1.55;
}
.help-flow {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}
.help-flow div, .help-check {
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--soft);
}
.help-flow span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 999px;
    background: var(--primary);
    color: var(--white);
    font-weight: 800;
    margin-bottom: 8px;
}
.help-flow strong, .help-check strong { display: block; margin-bottom: 4px; }
.help-flow p, .help-check span { margin: 0; color: var(--muted); line-height: 1.4; }
details {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px 14px;
    background: var(--soft);
    margin-bottom: 10px;
}
summary {
    cursor: pointer;
    font-weight: 800;
    color: var(--text);
}
details p { margin: 10px 0 0; color: var(--muted); line-height: 1.5; }
.landing-shell { min-height: 100vh; background: linear-gradient(180deg, #FFFFFF 0%, #F6F8FA 420px, var(--bg) 900px); }
.dark .landing-shell { background: linear-gradient(180deg, #0F1728 0%, #111827 420px, var(--bg) 900px); }
.beta-banner { background: var(--primary); color: #FFFFFF; text-align: center; padding: 10px 16px; font-weight: 800; }
.landing-nav { max-width: 1220px; margin: 0 auto; padding: 22px 24px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.landing-brand img { display: block; width: 190px; height: auto; }
.landing-nav nav, .landing-footer nav { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.landing-nav nav a:not(.btn), .landing-footer nav a { color: var(--text); font-weight: 800; }
.landing-hero, .landing-section, .landing-final { max-width: 1220px; margin: 0 auto; padding: 72px 24px; }
.landing-hero { position: relative; display: grid; gap: 34px; min-height: 720px; padding-top: 54px; overflow: hidden; }
.landing-hero::before {
    content: "";
    position: absolute;
    inset: 18px 24px auto;
    height: 74%;
    border-radius: 8px;
    background: linear-gradient(135deg, rgba(10,72,111,.10), rgba(129,149,100,.16));
    border: 1px solid rgba(95,117,141,.14);
    z-index: 0;
}
.hero-copy { position: relative; z-index: 1; display: grid; gap: 18px; align-content: start; max-width: 820px; padding: 62px 44px 0; }
.landing-eyebrow { margin: 0 0 12px; color: var(--success); font-weight: 900; text-transform: uppercase; letter-spacing: .06em; }
.landing-hero h1 { font-size: clamp(46px, 6.2vw, 84px); line-height: .94; margin: 0; max-width: 820px; }
.landing-hero p, .landing-section p, .landing-final p { color: var(--muted); font-size: 16px; line-height: 1.65; }
.hero-copy > p:not(.landing-eyebrow) { max-width: 720px; font-size: 18px; color: var(--text); }
.hero-proof { display: flex; gap: 8px; flex-wrap: wrap; }
.hero-proof span { padding: 7px 10px; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; color: var(--muted); font-size: 12px; font-weight: 800; }
.app-preview {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 164px 1fr;
    min-height: 420px;
    margin: 0 44px 30px;
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
    background: var(--surface);
    box-shadow: 0 30px 80px rgba(49,66,86,.24);
}
.preview-sidebar { background: #F4F6F8; padding: 28px 18px 18px; display: grid; gap: 8px; align-content: start; border-right: 1px solid var(--line); }
.dark .preview-sidebar { background: #111827; }
.preview-sidebar strong { margin-bottom: 18px; color: var(--primary); }
.preview-sidebar span { display: block; border-radius: 6px; padding: 9px 10px; color: var(--muted); font-size: 12px; font-weight: 800; }
.preview-sidebar span:nth-child(2) { background: #EEF3F7; color: var(--primary); }
.dark .preview-sidebar span:nth-child(2) { background: rgba(255,255,255,.12); color: #FFFFFF; }
.preview-top, .preview-metrics span, .preview-table b, .preview-table i { display: block; border-radius: 6px; }
.preview-main { padding: 30px; }
.preview-top { min-height: 54px; margin-bottom: 18px; display: flex; align-items: center; justify-content: space-between; gap: 10px; border-bottom: 1px solid var(--line); border-radius: 0; }
.preview-top strong { font-size: 18px; }
.preview-top em { font-style: normal; color: var(--warning); font-weight: 800; font-size: 12px; }
.preview-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 18px; }
.preview-metrics span { min-height: 96px; background: #EEF3F7; border: 1px solid var(--line); padding: 16px; }
.preview-metrics strong { display: block; font-size: 26px; color: var(--text); }
.preview-metrics em { display: block; margin-top: 4px; font-style: normal; color: var(--muted); font-size: 12px; font-weight: 800; }
.dark .preview-metrics span { background: #182233; }
.preview-table { display: grid; grid-template-columns: 1.2fr 1fr .8fr .8fr; gap: 10px; }
.preview-table b { color: var(--muted); font-size: 11px; text-transform: uppercase; padding: 0 4px 6px; border-bottom: 1px solid var(--line); }
.preview-table i { min-height: 34px; font-style: normal; padding: 8px 4px; border-bottom: 1px solid var(--line); color: var(--text); font-size: 12px; }
.section-head { display: flex; justify-content: space-between; align-items: end; gap: 24px; margin-bottom: 22px; }
.section-head h2, .landing-final h2 { font-size: clamp(30px, 3.5vw, 48px); line-height: 1.08; margin: 0; max-width: 760px; }
.section-head .landing-eyebrow { margin-bottom: 8px; }
.problem-section, .solution-section { padding-top: 56px; padding-bottom: 56px; }
.landing-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
.landing-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.landing-card, .pricing-card { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 22px; }
.landing-card h3, .pricing-card h3 { margin: 0 0 8px; font-size: 18px; }
.landing-card p { margin: 0; font-size: 14px; }
.landing-card { box-shadow: 0 10px 24px rgba(49,66,86,.04); }
.feature-card { min-height: 188px; display: grid; align-content: start; }
.feature-card span { display: inline-flex; width: max-content; margin-bottom: 18px; padding: 4px 8px; border-radius: 999px; background: var(--soft); color: var(--muted); font-size: 11px; font-weight: 900; text-transform: uppercase; letter-spacing: .05em; }
.landing-center { text-align: center; margin-top: 18px; }
.landing-narrow { max-width: 760px; }
.process-flow { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 10px; margin: 26px 0; padding: 16px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line); }
.process-flow span { min-height: 74px; display: flex; align-items: center; justify-content: center; text-align: center; padding: 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--soft); font-weight: 800; position: relative; }
.process-flow span:not(:last-child)::after { content: ">"; position: absolute; right: -9px; color: var(--muted); z-index: 1; }
.pricing-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; align-items: stretch; margin-top: 24px; }
.pricing-card { position: relative; display: grid; align-content: start; gap: 12px; }
.pricing-card.recommended { border-color: var(--success); box-shadow: 0 22px 45px rgba(49,66,86,.14), 0 0 0 3px rgba(129,149,100,.16); transform: translateY(-10px); }
.pricing-card .btn { margin-top: auto; width: 100%; }
.plan-badge { position: absolute; top: 14px; right: 14px; border-radius: 999px; padding: 4px 9px; background: var(--success); color: #FFFFFF; font-size: 12px; font-weight: 900; }
.plan-price { display: block; font-size: 26px; color: var(--text); }
.pricing-card ul, .pricing-notes { margin: 0; padding-left: 20px; display: grid; gap: 8px; color: var(--muted); }
.pricing-notes { margin-top: 20px; grid-template-columns: repeat(5, minmax(0, 1fr)); list-style: none; padding-left: 0; }
.pricing-notes li { background: var(--soft); border: 1px solid var(--line); border-radius: 8px; padding: 12px; }
.comparison-wrap { overflow-x: auto; }
.comparison-table { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.comparison-table td:not(:first-child), .comparison-table th:not(:first-child) { text-align: center; }
.split-section { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.split-section > div { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 28px; }
.split-section h2 { font-size: clamp(26px, 2.6vw, 36px); line-height: 1.12; margin-bottom: 14px; }
.faq-section { max-width: 860px; }
.landing-final { text-align: center; background: var(--primary); color: #FFFFFF; border: 1px solid var(--primary); border-radius: 8px; margin-bottom: 38px; }
.landing-final p { color: rgba(255,255,255,.82); }
.landing-final .btn { background: #FFFFFF; color: var(--primary); border-color: #FFFFFF; }
.landing-footer { max-width: 1180px; margin: 0 auto; padding: 28px 22px 46px; display: grid; gap: 14px; color: var(--muted); }
.landing-footer img { width: 180px; height: auto; }
@media (max-width: 860px) {
    .app-shell { display: block; }
    .sidebar { width: 100%; }
    .main { padding: 18px; }
    .grid, .grid.two, .grid.three, .form-grid, .summary-strip, .help-flow, .help-actions { grid-template-columns: 1fr; }
    .help-search-panel { position: static; }
    .item-row, .po-item-row { grid-template-columns: 1fr 1fr; }
    .page-head { display: grid; }
    .panel { overflow-x: auto; }
    .landing-nav { display: grid; }
    .landing-nav nav { gap: 10px; }
    .section-head { display: grid; align-items: start; }
    .landing-hero, .pricing-grid, .split-section { grid-template-columns: 1fr; min-height: auto; }
    .landing-grid, .landing-grid.three { grid-template-columns: 1fr; }
    .landing-hero::before { inset: 10px 12px auto; height: 80%; }
    .hero-copy { padding: 36px 12px 0; }
    .app-preview { grid-template-columns: 96px 1fr; min-height: 280px; margin: 0 0 10px; }
    .preview-sidebar { padding: 18px 10px; }
    .preview-sidebar strong { margin-bottom: 8px; font-size: 12px; }
    .preview-sidebar span { padding: 8px 6px; font-size: 10px; }
    .preview-main { padding: 16px; }
    .preview-top { display: grid; align-items: start; min-height: auto; padding-bottom: 12px; }
    .preview-metrics { grid-template-columns: 1fr; }
    .preview-table { grid-template-columns: 1fr 1fr; }
    .process-flow { grid-template-columns: 1fr 1fr; }
    .process-flow span:not(:last-child)::after { display: none; }
    .pricing-notes { grid-template-columns: 1fr; }
    .landing-hero, .landing-section, .landing-final { padding: 38px 18px; }
}
@media print {
    .sidebar, .print-actions, .flash { display: none; }
    .main, .auth-main { padding: 0; }
    body { background: white; }
    .print-page { border: 0; max-width: none; padding: 0; }
}
