:root {
    --color-graphite: #2B2F36;
    --color-accent: #F26B21;
    --color-steel: #8A9099;
    --color-white: #FFFFFF;
    --color-light: #F4F5F7;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "Inter", "Open Sans", Arial, sans-serif;
    color: var(--color-graphite);
    background: var(--color-white);
}

h1, h2, h3 { font-family: "Montserrat", "Manrope", Arial, sans-serif; }

.container { max-width: 1100px; margin: 0 auto; padding: 0 20px; }

.admin-header { background: var(--color-graphite); color: var(--color-white); }
.admin-header-inner { display: flex; align-items: center; gap: 24px; padding: 16px 20px; }
.admin-header-inner nav { display: flex; gap: 16px; flex: 1; }
.admin-header-inner a { color: var(--color-white); text-decoration: none; }
.link-button {
    background: none; border: none; color: var(--color-white);
    text-decoration: underline; cursor: pointer; padding: 0; font-size: 1em;
}

.btn {
    display: inline-block; padding: 10px 20px; border-radius: 4px;
    text-decoration: none; font-weight: bold; border: none; cursor: pointer;
}
.btn-accent { background: var(--color-accent); color: var(--color-white) !important; }
.btn-danger { background: #c0392b; color: var(--color-white); border: none; padding: 6px 14px; border-radius: 4px; cursor: pointer; }
.delete-warning { background: #fdecea; border-left: 4px solid #c0392b; padding: 10px 16px; margin-bottom: 12px; border-radius: 4px; }

.dashboard-tiles { display: flex; gap: 20px; margin: 20px 0; }
.tile { background: var(--color-light); border-radius: 6px; padding: 20px; flex: 1; text-align: center; text-decoration: none; color: inherit; }
.tile .tile-number { font-size: 2em; font-weight: bold; color: var(--color-accent); display: block; }

table.admin-table { width: 100%; border-collapse: collapse; margin: 20px 0; }
table.admin-table th, table.admin-table td {
    text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--color-light);
}
table.admin-table th { background: var(--color-light); }

.status-badge { display: inline-block; padding: 2px 10px; border-radius: 12px; font-size: 0.85em; background: var(--color-light); }

.admin-form div { margin-bottom: 12px; }
.admin-form label { display: block; margin-bottom: 4px; font-weight: bold; }
.admin-form input, .admin-form textarea, .admin-form select {
    width: 100%; max-width: 480px; padding: 8px;
    border: 1px solid var(--color-steel); border-radius: 4px;
}

.actions { display: flex; gap: 8px; }
.actions form { display: inline; }

.order-section { margin: 30px 0; }
.chart-box { max-width: 600px; height: 260px; margin-bottom: 16px; }
.comment { border-bottom: 1px solid var(--color-light); padding: 10px 0; }
.comment .meta { color: var(--color-steel); font-size: 0.85em; }

.alert-success {
    background: #e6f4ea;
    border: 1px solid #34a853;
    padding: 12px 16px;
    border-radius: 4px;
}

.alert-error {
    background: #fce8e6;
    border: 1px solid #ea4335;
    padding: 12px 16px;
    border-radius: 4px;
}

/* Orders list shipping-date highlighting (Order.getShippingAlert). */
table.admin-table tr.row-red td { background: #f8d7da; }
table.admin-table tr.row-closed td { background: #d4edda; }
.date-red { color: #c0392b; font-weight: bold; }
.date-overdue { background: #c0392b; color: #fff; font-weight: bold; border-radius: 3px; padding: 0 6px; display: inline-block; }
.planned-date + .planned-date { margin-top: 3px; }
.planned-date.date-overdue { display: table; } /* block-level, so several dates still stack */
.legend { color: var(--color-steel); font-size: 0.85em; }
.legend-swatch { display: inline-block; width: 14px; height: 14px; border-radius: 3px; vertical-align: middle; margin: 0 4px 0 12px; }
.legend-swatch.row-red { background: #f8d7da; }
.legend-swatch.row-closed { background: #d4edda; }
.new-nomenclature { border: 1px dashed var(--color-steel); border-radius: 4px; padding: 10px 16px; margin: 10px 0; }

/* Order page: one sticky "Сохранить" bar for every editable field (orders/detail.html). */
.save-bar { position: sticky; bottom: 0; z-index: 10; display: flex; justify-content: flex-end; align-items: center; gap: 16px;
            background: var(--color-white); border-top: 2px solid var(--color-accent); padding: 12px 0; margin: 30px 0; }
.save-bar .btn-save { font-size: 1.1em; padding: 10px 36px; border: none; cursor: pointer; }
.save-bar-hint { color: #c0392b; font-weight: bold; }
.save-notice { background: #d4edda; border-left: 4px solid #2e7d32; padding: 8px 14px; border-radius: 4px; }
.hint { color: var(--color-steel); font-size: 0.9em; }
.add-item { border: 1px solid var(--color-light); border-radius: 4px; padding: 10px 16px; }
.add-item > legend { font-weight: bold; padding: 0 6px; }

/* Order page: "Расходы по заказу". */
.admin-table td.num, .admin-table th.num { text-align: right; white-space: nowrap; }
.expense-file { white-space: nowrap; }
.file-action { margin-left: 6px; text-decoration: none; }
button.file-action { background: none; border: none; cursor: pointer; padding: 0; font-size: 1em; }
.link-danger { color: #c0392b; }
.no-docs { color: #c0392b; font-size: 0.85em; }
.add-files { display: inline-block; margin-top: 4px; font-size: 0.85em; color: var(--color-accent); cursor: pointer; }
.add-files input[type=file] { display: block; font-size: 0.9em; margin-top: 2px; }
.admin-form .field-label { display: block; margin-bottom: 4px; font-weight: bold; }
.admin-form label.radio { display: inline-flex; align-items: center; gap: 6px; margin-right: 18px; font-weight: normal; }
.admin-form label.radio input { width: auto; }
.save-error { background: #f8d7da; border-left: 4px solid #c0392b; color: #7b1c13; padding: 8px 14px; border-radius: 4px; font-weight: bold; }
.save-bar-error { color: #c0392b; font-weight: bold; max-width: 60%; }
input.date-error { border: 2px solid #c0392b !important; background: #fdecea; }
.admin-table tr.subtotal td { color: var(--color-steel); font-size: 0.9em; background: var(--color-light); }
.totals-table { max-width: 640px; }
.totals-table .tax-input { width: 90px; display: inline-block; padding: 4px 6px; }
.admin-table tr.loss th { color: #c0392b; }
.admin-table td.order-items div + div { margin-top: 2px; }
.admin-table td.loss { color: #c0392b; font-weight: bold; }
.btn-link { background: none; border: none; color: var(--color-accent); cursor: pointer; padding: 4px 6px; text-decoration: underline; }
.admin-table td.item-actions { white-space: nowrap; }
.admin-table .item-number { width: 110px; text-align: right; }
.admin-table tr.editing td { background: #fff7f0; }
.report-dialog { border: none; border-radius: 8px; padding: 22px 26px; max-width: 560px; width: 92vw; box-shadow: 0 10px 40px rgba(0,0,0,.25); }
.report-dialog::backdrop { background: rgba(43,47,54,.55); }
.report-dialog h3 { margin-top: 0; }
.report-dialog label.report-style, .report-dialog label.report-docs { display: flex; gap: 10px; align-items: flex-start; font-weight: normal; padding: 8px 10px; border: 1px solid var(--color-light); border-radius: 6px; margin-bottom: 6px; cursor: pointer; }
.report-dialog label.report-style:has(input:checked) { border-color: var(--color-accent); background: #fff7f0; }
.report-dialog label input { width: auto; margin-top: 3px; }
.report-dialog small { display: block; color: var(--color-steel); }
.report-dialog .dialog-buttons { display: flex; justify-content: flex-end; gap: 10px; margin-top: 10px; }

/* Заказы / Архив tabs, archived order (view only), Финансы → Счета */
.tabs a { display: inline-block; padding: 6px 16px; margin-right: 4px; border-radius: 4px 4px 0 0; border-bottom: 3px solid transparent; text-decoration: none; }
.tabs a.active { border-bottom-color: var(--color-accent, #c9a227); font-weight: bold; }
.archive-banner { background: #eef1f4; border-left: 4px solid var(--color-steel, #6c7a89); padding: 8px 14px; border-radius: 4px; margin-bottom: 12px; }
.archive-banner p { margin: 0 0 6px; }
.order-archived .add-item, .order-archived .add-files, .order-archived .item-actions, .order-archived .comment-new,
.order-archived .btn-danger, .order-archived .link-danger { display: none; }
.money-negative { color: #c0392b; font-weight: bold; }
.money-positive { color: #1e7e34; }
.account-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; margin: 12px 0 20px; }
.account-card { display: block; padding: 14px 16px; border: 1px solid #d8dde3; border-radius: 6px; text-decoration: none; color: inherit; background: #fff; }
.account-card.active { border-color: var(--color-accent, #c9a227); box-shadow: 0 0 0 2px var(--color-accent, #c9a227) inset; }
.account-card .account-name { font-size: 0.9em; color: var(--color-steel, #6c7a89); }
.account-card .account-balance { font-size: 1.5em; font-weight: bold; margin-top: 4px; }
.adjust-forms { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; margin-bottom: 20px; }
.adjust-forms fieldset { border: 1px solid #d8dde3; border-radius: 6px; padding: 10px 14px; }
.adjust-forms input { width: 100%; box-sizing: border-box; margin-bottom: 6px; }

/* «Добавить расход»: fields filled from the attached document (ExpenseDocumentReader). */
.autofilled { background: #fff8d6; outline: 1px solid #e0c040; }
.recognize-status { color: #c0392b; font-size: 0.9em; margin: 4px 0 0; }
.recognize-status.recognize-ok { color: #2e7d32; }
