body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
    margin: 0;
    padding: 16px;
    background: #020617;
    color: #f9fafb;
    font-size: 16px;
}

h1 {
    margin-top: 0;
    margin-bottom: 18px;
    font-size: 28px;
}

.app {
    width: 100%;
    max-width: none;
    background: #020617;
    border-radius: 16px;
    padding: 24px 28px 30px;
    box-sizing: border-box;
    box-shadow: 0 22px 55px rgba(0, 0, 0, 0.55);
    border: 1px solid #111827;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 14px 22px;
    margin-bottom: 16px;
}

label {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #9ca3af;
    display: block;
    margin-bottom: 6px;
}

input[type="number"] {
    width: 100%;
    box-sizing: border-box;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid #374151;
    background: #020617;
    color: #f9fafb;
    font-size: 14px;
}

input[type="number"]:focus {
    outline: none;
    border-color: #22c55e;
    box-shadow: 0 0 0 1px #22c55e33;
}

.section-title {
    margin: 18px 0 10px;
    font-size: 15px;
    font-weight: 600;
    color: #e5e7eb;
}

.summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 10px 18px;
    font-size: 14px;
    margin-bottom: 6px;
}

.summary-item strong {
    color: #f9fafb;
}

.bar-wrapper {
    margin-top: 18px;
}

.bar {
    position: relative;
    display: flex;
    height: 64px;
    overflow: hidden;
    border-radius: 999px;
    background: #020617;
    border: 1px solid #111827;
    margin-bottom: 10px;
}

/* слой поверх основного бара */
.bar-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    pointer-events: none;
}

.seg {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    white-space: nowrap;
    padding: 0 10px;
    box-sizing: border-box;
    min-width: 0;
    overflow: hidden;
}

.seg-tiny {
    font-size: 0;
    padding: 0;
}

.seg.electricity {
    background: #facc15;
    color: #111827;
}

.seg.tax {
    background: #f97316;
}

.seg.stripe {
    background: #22c55e;
    color: #052e16;
}

.seg.loc {
    background: #bbf7d0;
    color: #052e16;
}

.seg.org {
    background: #4ade80;
    color: #052e16;
}

.seg.cl {
    background: #16a34a;
    color: #ecfdf5;
}

.seg.markup {
    background: #22c55e;
    color: #022c22;
}

.muted {
    color: #9ca3af;
    font-size: 13px;
}

.card {
    background: #020617;
    border-radius: 12px;
    padding: 14px 16px;
    border: 1px solid #111827;
    margin-bottom: 10px;
}

.two-cols {
    display: flex;
    gap: 22px;
    flex-wrap: wrap;
    margin-top: 6px;
}

.two-cols > div {
    flex: 1 1 320px;
}

/* Legend */

.legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 18px;
    margin-top: 10px;
    font-size: 12px;
}

.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.legend-color {
    width: 18px;
    height: 10px;
    border-radius: 999px;
    border: 1px solid #111827;
}

.seg.stripe-pct {
    background: #fef08a;
    color: #78350f;
}

.seg.stripe-fixed {
    background: #eab308;
    color: #422006;
}

.seg.discount {
    background: #38bdf8;
    color: #0f172a;
}

/* полупрозрачный DISC-оверлей для верхних двух баров */
.seg.discount-overlay {
    background: rgba(56, 189, 248, 0.35);
    color: transparent;
    font-size: 0;
}

.seg.customer {
    background: #0ea5e9;
    color: #e0f2fe;
}

.seg.returned {
    background: #ef4444;
    color: #fee2e2;
}

/* New: right-aligned bars */
.bar-right {
    justify-content: flex-end;
}

/* Общий вид explanation-блоков */
.explanation {
    display: block;
}

.explanation h3 {
    margin: 0 0 12px;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: #e5e7eb;
}

/* Карточка summary чуть “важнее” визуально */
.card.card-summary {
    margin-bottom: 16px;
    padding: 18px 20px;
    border-radius: 16px;
    background: radial-gradient(circle at top left, #0f172a 0, #020617 55%);
    border: 1px solid #111827;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
}

/* Таблица summary/final */
.exp-table-summary {
    width: 100%;
    border-collapse: collapse;
    border-spacing: 0;
    font-size: 15px;           /* БОЛЬШЕ ШРИФТ В ТАБЛИЦЕ */
    table-layout: fixed;
}

.exp-col-metric {
    width: auto;
}

.exp-col-req,
.exp-col-del {
    width: 130px;
}

.exp-table-summary thead th {
    font-size: 13px;           /* Крупнее заголовки */
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #9ca3af;
    padding: 8px 10px 10px;
    border-bottom: 1px solid #111827;
}

.exp-table-summary tbody td {
    padding: 8px 10px;
    border-bottom: 1px solid #020617;
}

.exp-table-summary tbody tr:last-child td {
    border-bottom: none;
}

.exp-label {
    color: #9ca3af;
    padding-right: 12px;
    font-size: 15px;           /* Подписи крупнее */
}

.exp-value {
    color: #f9fafb;
    font-size: 15px;           /* Цифры и текст в ячейках крупнее */
}

.exp-num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* лёгкий hover, как в macOS таблицах */
.exp-table-summary tbody tr:hover {
    background: rgba(15, 23, 42, 0.9);
}

/* немного воздуха между колонками в explanation-grid (на будущее) */
.explanation-grid .card {
    padding-top: 16px;
    padding-bottom: 16px;
    border-radius: 14px;
}

.field-error input { border-color: #e74c3c; box-shadow: 0 0 6px rgba(231,76,60,.3); }
.error-message { color: #e74c3c; font-size: 0.85em; margin-top: 4px; }
.error-global {
    background: #ffebee; color: #c62828; padding: 12px; border-radius: 6px;
    margin: 16px 0; border: 1px solid #ffcdd2; font-weight: 500;
}

.app-container {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 32px;
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

.main-content {
    min-width: 0; /* важно для grid */
}

.tips-panel {
    background: #0f172a;           /* тёмно-синий/чёрный как у тебя */
    color: #cbd5e1;                 /* светло-серый текст */
    border: 1px solid #1e293b;
    border-radius: 12px;
    padding: 20px;
    height: fit-content;
    position: sticky;
    top: 20px;
    font-size: 0.95em;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}

.tips-title {
    margin: 0 0 16px 0;
    color: #60a5fa;
    font-size: 1.3em;
    font-weight: 600;
}

.tips-list {
    margin: 0;
    padding-left: 20px;
    line-height: 1.6;
    color: #94a3b8;
}

.tips-list li {
    margin-bottom: 12px;
}

.tips-list strong {
    color: #93c5fd;
}

.tips-list em {
    color: #a78bfa;
    font-style: normal;
}

.tips-footer {
    margin-top: 24px;
    font-size: 0.8em;
    color: #64748b;
    text-align: center;
    opacity: 0.7;
}