:root {
    --bg: #f4f7fb;
    --panel: #fff;
    --line: #dce5ee;
    --text: #10233f;
    --muted: #607386;
    --primary: #17a2b8;
    --primary-dark: #0d7789;
    --danger: #c0392b;
    --warning: #9a6b00;
}
* { box-sizing: border-box; }
body {
    background: var(--bg);
    color: var(--text);
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.45;
    margin: 0;
}
a { color: var(--primary-dark); text-decoration: none; }
.app-shell { min-height: 100vh; }
.sidebar {
    background: #071a3d;
    bottom: 0;
    color: #dce8f5;
    display: flex;
    flex-direction: column;
    left: 0;
    padding: 18px 14px;
    position: fixed;
    top: 0;
    width: 246px;
}
.brand, .auth-brand {
    align-items: center;
    color: inherit;
    display: flex;
    gap: 10px;
}
.brand-mark {
    align-items: center;
    background: var(--primary);
    border-radius: 8px;
    color: #fff;
    display: inline-flex;
    font-weight: 900;
    height: 34px;
    justify-content: center;
    width: 34px;
}
.brand strong, .auth-brand strong { display: block; font-size: 15px; }
.brand small, .auth-brand small { color: #8fa6bd; display: block; font-size: 12px; margin-top: 1px; }
.sidebar nav { display: grid; gap: 4px; margin-top: 26px; }
.sidebar nav a {
    border-radius: 6px;
    color: #dce8f5;
    font-weight: 700;
    padding: 10px 12px;
}
.sidebar nav a:hover { background: rgba(255,255,255,.08); }
.sidebar-footer {
    border-top: 1px solid rgba(255,255,255,.13);
    display: grid;
    gap: 3px;
    margin-top: auto;
    padding-top: 14px;
}
.sidebar-footer span { font-weight: 800; }
.sidebar-footer small { color: #a9bdd0; }
.sidebar-footer a { color: #fff; font-size: 12px; font-weight: 800; margin-top: 8px; }
.content {
    margin-left: 246px;
    padding: 26px;
}
.auth-content {
    align-items: center;
    display: flex;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}
.auth-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(13,31,57,.08);
    max-width: 430px;
    padding: 28px;
    width: 100%;
}
.auth-card h1, .page-head h1 {
    color: #001957;
    font-size: 28px;
    font-weight: 800;
    line-height: 1.15;
    margin: 18px 0 5px;
}
.auth-card p, .page-head p { color: var(--muted); margin: 0; }
.page-head {
    align-items: flex-start;
    display: flex;
    gap: 16px;
    justify-content: space-between;
    margin-bottom: 18px;
}
.page-head h1 { margin-top: 0; }
.actions, .form-actions { align-items: center; display: flex; gap: 8px; justify-content: flex-end; }
.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    margin-bottom: 16px;
    overflow: hidden;
}
.panel-head {
    align-items: center;
    border-bottom: 1px solid var(--line);
    display: flex;
    justify-content: space-between;
    padding: 14px 16px;
}
.panel-head h2 {
    color: #17233b;
    font-size: 15px;
    font-weight: 800;
    margin: 0;
}
.panel > form, .panel > table, .panel > .filters, .panel > .approval-grid, .panel > .details { margin: 0; }
.grid-form, .form-stack { display: grid; gap: 12px; padding: 16px; }
.grid-form { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-stack { grid-template-columns: 1fr; }
.full { grid-column: 1 / -1; }
label { color: #334b66; display: grid; font-size: 12px; font-weight: 800; gap: 6px; }
input, select, textarea {
    background: #fff;
    border: 1px solid #cfdbe6;
    border-radius: 6px;
    color: var(--text);
    font: inherit;
    min-height: 36px;
    padding: 8px 10px;
    width: 100%;
}
textarea { min-height: 88px; resize: vertical; }
.btn {
    align-items: center;
    background: #fff;
    border: 1px solid #cfdbe6;
    border-radius: 7px;
    color: #173450;
    cursor: pointer;
    display: inline-flex;
    font-size: 13px;
    font-weight: 800;
    height: 36px;
    justify-content: center;
    padding: 0 14px;
    white-space: nowrap;
}
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.small { font-size: 12px; height: 30px; padding: 0 10px; }
.metric-grid {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    margin-bottom: 16px;
}
.metric-grid.compact { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.metric {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px;
}
.metric span { color: var(--muted); display: block; font-size: 12px; font-weight: 800; margin-bottom: 5px; }
.metric strong { color: #001957; font-size: 24px; font-weight: 850; }
.split, .detail-grid, .approval-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: minmax(0, 1.4fr) minmax(320px, .6fr);
}
.approval-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); padding: 16px; }
table { border-collapse: collapse; width: 100%; }
th, td {
    border-bottom: 1px solid #edf2f6;
    padding: 11px 12px;
    text-align: left;
    vertical-align: middle;
}
th {
    background: #f8fafc;
    color: #607386;
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
}
td small { color: var(--muted); display: block; font-size: 12px; margin-top: 2px; }
tr:last-child td { border-bottom: 0; }
.empty { color: var(--muted); padding: 26px; text-align: center; }
.badge {
    background: #eef3f7;
    border: 1px solid #d9e4ec;
    border-radius: 999px;
    color: #385273;
    display: inline-flex;
    font-size: 11px;
    font-weight: 900;
    padding: 3px 8px;
    text-transform: uppercase;
}
.badge.approved, .badge.active, .badge.paid { background: #e7f7ef; border-color: #b8e6ce; color: #137044; }
.badge.pending, .badge.possible { background: #fff6df; border-color: #efd384; color: #8a5d00; }
.badge.rejected, .badge.blocked, .badge.inactive, .badge.cancelled { background: #fdebea; border-color: #f2bbb7; color: #a72b20; }
.badge.won { background: #e6f6ff; border-color: #b4e1f7; color: #075d83; }
.flash {
    background: #eaf7f4;
    border: 1px solid #bfe5dd;
    border-radius: 7px;
    color: #13705f;
    font-weight: 750;
    margin-bottom: 14px;
    padding: 11px 13px;
}
.flash.error { background: #fdebea; border-color: #f2bbb7; color: #a72b20; }
.flash.warning { background: #fff6df; border-color: #efd384; color: var(--warning); }
.filters {
    align-items: center;
    display: grid;
    gap: 10px;
    grid-template-columns: minmax(220px, 1fr) 190px auto;
    padding: 12px;
}
.details {
    display: grid;
    grid-template-columns: 150px 1fr;
    margin: 0;
    padding: 16px;
}
.details dt, .details dd { border-bottom: 1px solid #edf2f6; margin: 0; padding: 9px 0; }
.details dt { color: var(--muted); font-size: 12px; font-weight: 900; }
.details dd { font-weight: 750; }
.details dd small { color: var(--muted); display: block; font-weight: 500; }
.statement { display: grid; gap: 10px; padding: 16px; }
.statement div { align-items: center; border: 1px solid #edf2f6; border-radius: 7px; display: flex; justify-content: space-between; padding: 12px; }
.statement span { color: var(--muted); font-weight: 800; }
.statement strong { color: #001957; font-size: 18px; }
.inline-form { align-items: center; display: flex; gap: 6px; }
.inline-form select { min-width: 120px; }
.opportunity-hero {
    align-items: center;
    background: #fff;
    border: 1px solid #dce7ef;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    margin-bottom: 16px;
    min-height: 118px;
    overflow: hidden;
    padding: 24px 26px;
    position: relative;
}
.opportunity-hero::before {
    background: var(--primary);
    content: "";
    height: 100%;
    left: 0;
    position: absolute;
    top: 0;
    width: 5px;
}
.hero-kicker {
    color: var(--primary-dark);
    display: block;
    font-size: 12px;
    font-weight: 900;
    margin-bottom: 6px;
    text-transform: uppercase;
}
.opportunity-hero h1 {
    color: #001957;
    font-size: 30px;
    font-weight: 850;
    line-height: 1.1;
    margin: 0 0 7px;
}
.opportunity-hero p {
    color: var(--muted);
    margin: 0;
}
.hero-status {
    background: #f3fbfd;
    border: 1px solid #bde8ef;
    border-radius: 8px;
    display: grid;
    gap: 3px;
    min-width: 148px;
    padding: 12px 14px;
}
.hero-status span {
    color: #4c6a80;
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
}
.hero-status strong {
    color: #08356f;
    font-size: 14px;
}
.opportunity-form-panel {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
}
.opportunity-form {
    display: grid;
    gap: 0;
}
.form-section {
    border-bottom: 1px solid #e8eef4;
    display: grid;
    gap: 16px;
    padding: 20px 22px;
}
.section-title {
    align-items: flex-start;
    display: flex;
    gap: 12px;
}
.section-title span {
    align-items: center;
    background: #eaf8fb;
    border: 1px solid #bde8ef;
    border-radius: 8px;
    color: var(--primary-dark);
    display: inline-flex;
    flex: 0 0 34px;
    font-size: 12px;
    font-weight: 900;
    height: 34px;
    justify-content: center;
}
.section-title h2 {
    color: #10233f;
    font-size: 16px;
    font-weight: 850;
    line-height: 1.2;
    margin: 0 0 3px;
}
.section-title p {
    color: var(--muted);
    font-size: 13px;
    margin: 0;
}
.opportunity-grid {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}
.opportunity-grid.compact {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}
.opportunity-grid .wide { grid-column: span 2; }
.opportunity-form input,
.opportunity-form select,
.opportunity-form textarea {
    min-height: 42px;
}
.opportunity-form label {
    color: #28415e;
}
.opportunity-actions {
    background: #f8fbfd;
    padding: 16px 22px;
}
.platform-error {
    align-items: center;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    display: grid;
    gap: 22px;
    grid-template-columns: 120px minmax(0, 1fr);
    margin: 32px auto;
    max-width: 760px;
    padding: 34px;
}
.error-mark {
    align-items: center;
    background: #eaf8fb;
    border: 1px solid #bde8ef;
    border-radius: 8px;
    color: var(--primary-dark);
    display: inline-flex;
    font-size: 30px;
    font-weight: 900;
    height: 96px;
    justify-content: center;
    width: 96px;
}
.platform-error h1 {
    color: #001957;
    font-size: 28px;
    font-weight: 850;
    line-height: 1.1;
    margin: 0 0 8px;
}
.platform-error p {
    color: var(--muted);
    margin: 0 0 18px;
}
@media (max-width: 1100px) {
    .metric-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .grid-form, .split, .detail-grid, .approval-grid, .opportunity-grid, .opportunity-grid.compact { grid-template-columns: 1fr; }
    .opportunity-grid .wide { grid-column: auto; }
}
@media (max-width: 760px) {
    .sidebar { position: static; width: auto; }
    .content { margin-left: 0; padding: 16px; }
    .page-head { flex-direction: column; }
    .opportunity-hero { align-items: flex-start; flex-direction: column; padding: 20px; }
    .hero-status { width: 100%; }
    .platform-error { grid-template-columns: 1fr; padding: 22px; }
    .metric-grid, .metric-grid.compact, .filters { grid-template-columns: 1fr; }
    table { display: block; overflow-x: auto; }
}
