:root {
    --bg: #f5f7fa;
    --ink: #17202a;
    --muted: #667085;
    --line: #d9e0e8;
    --panel: #ffffff;
    --nav: #132238;
    --accent: #0f7b6c;
    --accent-2: #d46b08;
    --danger: #b42318;
    --good: #087443;
    --shadow: 0 12px 30px rgba(16, 24, 40, 0.08);
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--ink);
    background: var(--bg);
}
a { color: inherit; text-decoration: none; }
.app-shell { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }
.sidebar {
    background: var(--nav);
    color: white;
    padding: 24px 18px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}
.brand { display: grid; gap: 2px; }
.brand strong { font-size: 22px; }
.brand span { color: rgba(255,255,255,0.72); font-size: 13px; }
.sidebar nav { display: grid; gap: 6px; }
.sidebar nav a, .sidebar-footer a {
    color: rgba(255,255,255,0.86);
    padding: 10px 12px;
    border-radius: 6px;
}
.sidebar nav a:hover, .sidebar-footer a:hover { background: rgba(255,255,255,0.1); }
.sidebar-footer { margin-top: auto; display: grid; gap: 8px; font-size: 14px; }
.main { padding: 28px; min-width: 0; }
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 22px;
}
.topbar h1, .detail-header h2 { margin: 0; font-size: 28px; letter-spacing: 0; }
.eyebrow { margin: 0 0 4px; color: var(--accent); font-size: 12px; font-weight: 700; text-transform: uppercase; }
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 9px 14px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: white;
    color: var(--ink);
    font-weight: 650;
    cursor: pointer;
}
.button.primary { background: var(--accent); border-color: var(--accent); color: white; }
.button.small { min-height: 32px; padding: 6px 10px; font-size: 13px; }
.button.full { width: 100%; }
.flash {
    padding: 12px 14px;
    border-radius: 6px;
    margin-bottom: 16px;
    border: 1px solid var(--line);
    background: white;
}
.flash.success { border-color: #8fd3b5; background: #ecfdf3; color: #05603a; }
.flash.error { border-color: #f5a9a2; background: #fff1f0; color: var(--danger); }
.decision-grid, .detail-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}
.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 18px;
    box-shadow: var(--shadow);
    min-width: 0;
}
.panel.wide { grid-column: span 2; }
.panel.single { max-width: 980px; }
.panel h2 { margin: 0 0 14px; font-size: 18px; letter-spacing: 0; }
.panel-head, .card-head, .detail-header, .detail-actions, .score-row, .card-actions, .toolbar, .inline-form {
    display: flex;
    align-items: center;
    gap: 10px;
}
.panel-head, .card-head, .detail-header, .toolbar { justify-content: space-between; }
.card-list, .task-list { display: grid; gap: 12px; }
.tender-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.tender-card {
    background: white;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 16px;
    display: grid;
    gap: 10px;
}
.card-title { font-size: 17px; font-weight: 750; line-height: 1.3; }
.muted { color: var(--muted); }
.score-row { flex-wrap: wrap; }
.score {
    display: inline-flex;
    padding: 5px 8px;
    border-radius: 999px;
    background: #eef2f6;
    font-size: 12px;
    font-weight: 700;
    color: #344054;
}
.score.good { background: #e7f6ee; color: var(--good); }
.score.risk { background: #fff4e5; color: var(--accent-2); }
.score.cancellation-badge {
    justify-self: start;
    background: #fff4e5;
    color: #8b4606;
    text-decoration: underline;
    text-underline-offset: 2px;
}
.score.cancellation-full { background: #fff1f0; color: var(--danger); }
.status {
    display: inline-flex;
    padding: 5px 8px;
    border-radius: 999px;
    background: #eef2f6;
    font-size: 12px;
    font-weight: 700;
    color: #344054;
    white-space: nowrap;
}
.risk-text { color: var(--danger); font-weight: 650; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 0; }
.chips span {
    padding: 4px 8px;
    border-radius: 999px;
    background: #e8f3f1;
    color: #0b5f55;
    font-size: 12px;
}
.compact-row, .task-row, .import-row, .source-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
}
.compact-row span { overflow: hidden; text-overflow: ellipsis; }
.compact-row.static { color: var(--ink); }
.task-row { display: grid; grid-template-columns: 1fr auto; align-items: start; }
.task-row small { grid-column: 1 / -1; color: var(--muted); }
.filters { display: grid; grid-template-columns: 1fr 140px 190px auto; gap: 10px; width: 100%; }
input, select, textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 10px 11px;
    font: inherit;
    background: white;
}
textarea { resize: vertical; }
.form { display: grid; gap: 14px; }
.form-panel {
    background: white;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 18px;
    max-width: 1040px;
}
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
label { display: grid; gap: 6px; font-weight: 650; }
.detail-header {
    background: white;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 18px;
    margin-bottom: 14px;
}
.status-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 16px;
}
.status-strip span {
    background: white;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 9px 12px;
}
.lead-text { font-size: 17px; line-height: 1.55; }
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 8px 12px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 650; overflow-wrap: anywhere; }
.risk-row, .message-box {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 10px;
    background: #fbfcfe;
}
.json-preview, .report-body, .message-box pre {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    background: #101828;
    color: #f8fafc;
    border-radius: 8px;
    padding: 14px;
    max-height: 460px;
    overflow: auto;
}
.report-body { background: #fbfcfe; color: var(--ink); border: 1px solid var(--line); }
.plain-list { padding-left: 20px; }
.upload-form { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-bottom: 10px; }
.equipment-form { margin-top: 14px; }
.checkbox-label { display: flex; align-items: center; gap: 8px; }
.checkbox-label input { width: auto; }
.empty-state {
    background: white;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 28px;
    text-align: center;
    grid-column: 1 / -1;
}
.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background: #eef3f7;
}
.login-box {
    width: min(420px, calc(100vw - 32px));
    background: white;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 24px;
    box-shadow: var(--shadow);
}
.login-brand { color: var(--ink); margin-bottom: 20px; }
.login-brand span { color: var(--muted); }
.offer-work-links, .pricing-nav, .pricing-filters, .pricing-save-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}
.offer-work-links { margin-bottom: 16px; }
.pricing-filters { align-items: end; margin: 14px 0; }
.pricing-filters label { min-width: 0; max-width: 100%; }
.pricing-filters label:first-of-type { flex: 1 1 230px; }
.pricing-nav [aria-current="page"] { color: var(--accent); border-color: var(--accent); }
.pricing-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(135px, 1fr));
    gap: 12px;
    margin: 14px 0;
}
.pricing-summary div { padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px; }
.pricing-summary dt { color: var(--muted); }
.pricing-summary dd { margin: 4px 0 0; font-weight: 700; font-variant-numeric: tabular-nums; }
.pricing-table { overflow-x: auto; }
.pricing-table table { width: 100%; border-collapse: collapse; }
.pricing-table th, .pricing-table td { padding: 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.pricing-table thead { background: #f7f9fb; }
.pricing-table td small { display: block; }
.pricing-table a, .status-strip a { text-decoration: underline; }
.pricing-table .pricing-money { min-width: 115px; font-variant-numeric: tabular-nums; }
.pricing-table .pricing-money input { min-width: 110px; }
.pricing-table .pricing-money input[data-changed] { border-color: var(--accent); background: #f1f8f6; }
.pricing-save-bar {
    position: sticky;
    top: 0;
    z-index: 1;
    padding: 9px 0;
    background: white;
    border-bottom: 1px solid var(--line);
}
.pricing-save-bar p { margin: 0; }
.pricing-help { margin: 8px 0; }
.pricing-page-links { margin-top: 14px; }
@media (max-width: 980px) {
    .app-shell { grid-template-columns: 1fr; }
    .sidebar { position: static; }
    .decision-grid, .detail-grid, .tender-grid { grid-template-columns: 1fr; }
    .panel.wide { grid-column: span 1; }
    .filters, .form-grid { grid-template-columns: 1fr; }
    .topbar, .detail-header { align-items: flex-start; flex-direction: column; }
}
