:root {
    --bg-page: #F3F1ED;
    --bg-surface: #FFFFFF;
    --bg-subtle: #F9F8F6;
    --ink-main: #1C1B18;
    --ink-muted: #5C5852;
    --ink-faint: #8C877E;
    --line: #DFDCD6;
    --green: #166534;
    --green-hover: #14532D;
    --green-soft: #ECFDF5;
    --accent-dark: #1E242B;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-page);
    color: var(--ink-main);
    line-height: 1.48;
    -webkit-font-smoothing: antialiased;
}

.mono {
    font-family: 'IBM Plex Mono', monospace;
}

.pos {
    color: var(--green);
}

.wrap {
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Верхняя служебная панель */
.sys-bar {
    background: var(--accent-dark);
    color: #E5E7EB;
    font-size: 12px;
    border-bottom: 1px solid #11151A;
}

.sys-bar-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 40px;
}

.sys-brand {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sys-code {
    background: #333C47;
    color: #fff;
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 11px;
}

.sys-name {
    font-weight: 600;
    color: #fff;
}

.sys-divider {
    color: #6B7280;
}

.sys-sub {
    color: #9CA3AF;
}

.sys-telemetry {
    display: flex;
    align-items: center;
    gap: 16px;
    color: #D1D5DB;
}

.lang-tag {
    border: 1px solid #4B5563;
    padding: 1px 6px;
    border-radius: 3px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
}

/* Основная область */
.workspace {
    padding: 28px 0 48px;
}

.page-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 24px;
    padding-bottom: 20px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--line);
}

.head-left {
    max-width: 700px;
}

.page-head h1 {
    font-size: 25px;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--ink-main);
    margin-bottom: 6px;
}

.page-head p {
    font-size: 14px;
    color: var(--ink-muted);
}

.head-meta {
    text-align: right;
    font-size: 12px;
    color: var(--ink-muted);
    white-space: nowrap;
}

/* Сетка рабочего стола */
.desk-grid {
    display: grid;
    grid-template-columns: 1.5fr 0.75fr;
    gap: 20px;
    align-items: start;
}

.sheet {
    background: var(--bg-surface);
    border: 1px solid var(--line);
    border-radius: 6px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

/* Тулбар и KPI */
.sheet-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    background: var(--bg-subtle);
    border-bottom: 1px solid var(--line);
    border-radius: 6px 6px 0 0;
}

.kpi-strip {
    display: flex;
    gap: 28px;
}

.kpi-lbl {
    display: block;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: var(--ink-faint);
    margin-bottom: 2px;
}

.kpi-val {
    font-size: 18px;
    font-weight: 600;
}

.kpi-val.state {
    font-size: 14px;
    color: var(--ink-muted);
}

.btn-run {
    background: var(--green);
    color: #fff;
    border: 1px solid var(--green-hover);
    padding: 10px 16px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s;
}

.btn-run:hover {
    background: var(--green-hover);
}

.btn-run:disabled {
    background: #9CA3AF;
    border-color: #9CA3AF;
    cursor: not-allowed;
}

/* График */
.canvas-box {
    position: relative;
    height: 230px;
    background: #FCFBF9;
    border-bottom: 1px solid var(--line);
}

.equity-svg {
    width: 100%;
    height: 100%;
    display: block;
}

.canvas-prompt {
    position: absolute;
    inset: 0;
    background: rgba(243, 241, 237, 0.82);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.prompt-card {
    background: #FFFFFF;
    border: 1px solid var(--line);
    padding: 20px 24px;
    border-radius: 6px;
    max-width: 420px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.prompt-title {
    display: block;
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 6px;
}

.prompt-card p {
    font-size: 13px;
    color: var(--ink-muted);
    margin-bottom: 14px;
}

.btn-run-lg {
    background: var(--green);
    color: #fff;
    border: none;
    padding: 11px 20px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.btn-run-lg:hover {
    background: var(--green-hover);
}

/* Таблица ордеров */
.orders-table-wrap {
    padding: 16px 20px;
}

.table-caption {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    font-weight: 600;
    color: var(--ink-muted);
    margin-bottom: 10px;
}

.orders-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.orders-table th {
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    color: var(--ink-faint);
    text-transform: uppercase;
    padding: 8px 10px;
    border-bottom: 1px solid var(--line);
    background: var(--bg-subtle);
}

.orders-table td {
    padding: 9px 10px;
    border-bottom: 1px solid #EFECE6;
}

.orders-table th.num,
.orders-table td.num {
    text-align: right;
}

.empty-cell {
    text-align: center;
    color: var(--ink-faint);
    padding: 22px 10px !important;
}

.side-badge {
    display: inline-block;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    padding: 1px 5px;
    border-radius: 3px;
    background: var(--green-soft);
    color: var(--green);
    border: 1px solid #BBF7D0;
}

/* Правая панель */
.side-sheet {
    padding: 20px;
}

.side-sheet h2 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
}

.side-lead {
    font-size: 13px;
    color: var(--ink-muted);
    margin-bottom: 16px;
}

.spec-list {
    border-top: 1px solid var(--line);
    margin-bottom: 16px;
}

.spec-row {
    padding: 10px 0;
    border-bottom: 1px solid #EFECE6;
}

.spec-row dt {
    font-size: 11px;
    color: var(--ink-faint);
}

.spec-row dd {
    font-size: 13px;
    font-weight: 500;
    margin-top: 2px;
}

.note-block {
    background: var(--bg-subtle);
    border-left: 3px solid var(--accent-dark);
    padding: 10px 12px;
    font-size: 12px;
    color: var(--ink-muted);
}

.btn-outline {
    width: 100%;
    margin-top: 14px;
    padding: 10px;
    background: #fff;
    border: 1px solid var(--accent-dark);
    color: var(--accent-dark);
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.btn-outline:hover {
    background: var(--bg-subtle);
}

/* ПОП-АП МОДАЛЬНОЕ ОКНО */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(28, 27, 24, 0.62);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    z-index: 1000;
}

.modal-backdrop.open {
    display: flex;
    animation: modalFade 0.2s ease-out;
}

@keyframes modalFade {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-window {
    position: relative;
    background: #FFFFFF;
    border: 1px solid var(--line);
    border-radius: 6px;
    width: 100%;
    max-width: 470px;
    padding: 26px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.22);
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 14px;
    background: none;
    border: none;
    font-size: 24px;
    line-height: 1;
    color: var(--ink-faint);
    cursor: pointer;
}

.modal-close:hover {
    color: var(--ink-main);
}

.modal-summary {
    background: var(--green-soft);
    border: 1px solid #BBF7D0;
    border-radius: 4px;
    padding: 10px 14px;
    margin-bottom: 16px;
}

.sum-tag {
    display: block;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--green);
    margin-bottom: 3px;
}

.sum-numbers {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
}

.modal-window h3 {
    font-size: 19px;
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 6px;
}

.modal-sub {
    font-size: 13px;
    color: var(--ink-muted);
    margin-bottom: 18px;
}

.f-row {
    margin-bottom: 12px;
}

.f-row label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 4px;
}

.f-row input[type="text"],
.f-row input[type="email"],
.f-row select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #C8C4BC;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    background: #fff;
}

.f-row input:focus,
.f-row select:focus,
.phone-box:focus-within {
    outline: none;
    border-color: var(--accent-dark);
}

.phone-box {
    display: flex;
    border: 1px solid #C8C4BC;
    border-radius: 4px;
    overflow: hidden;
}

.phone-code {
    background: var(--bg-subtle);
    padding: 10px 12px;
    font-size: 14px;
    font-weight: 600;
    border-right: 1px solid #C8C4BC;
    color: var(--ink-main);
}

.phone-box input {
    border: none;
    padding: 10px 12px;
    width: 100%;
    font-size: 14px;
    font-family: 'IBM Plex Mono', monospace;
    outline: none;
}

.f-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.btn-submit {
    width: 100%;
    margin-top: 6px;
    padding: 12px;
    background: var(--green);
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.btn-submit:hover {
    background: var(--green-hover);
}

.legal-small {
    font-size: 11px;
    color: var(--ink-faint);
    text-align: center;
    margin-top: 10px;
}

/* Спасибо */
.thanks-box {
    text-align: center;
    padding: 14px 0;
}

.thanks-mark {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--green-soft);
    color: var(--green);
    font-size: 22px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
}

.thanks-box p {
    font-size: 13px;
    color: var(--ink-muted);
    margin: 8px 0 18px;
}

.btn-wa {
    display: inline-block;
    background: #1F7A3E;
    color: #fff;
    text-decoration: none;
    padding: 11px 18px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
}

/* Футер */
.site-footer {
    border-top: 1px solid var(--line);
    padding: 24px 0;
    font-size: 12px;
    color: var(--ink-muted);
}

.footer-meta {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}

.footer-nav {
    display: flex;
    gap: 16px;
}

.footer-nav a {
    color: var(--ink-muted);
}

.risk-disclaimer {
    font-size: 11px;
    color: var(--ink-faint);
}

@media (max-width: 840px) {
    .desk-grid { grid-template-columns: 1fr; }
    .page-head { flex-direction: column; align-items: flex-start; }
    .head-meta { text-align: left; }
    .sheet-toolbar { flex-direction: column; align-items: stretch; }
    .kpi-strip { justify-content: space-between; gap: 12px; }
    .f-grid-2 { grid-template-columns: 1fr; }
    .footer-meta { flex-direction: column; gap: 8px; }
    .sys-sub { display: none; }
}
