*,
*::before,
*::after {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
}

body.theme-dark {
    font-family: -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
    background: radial-gradient(circle at top, #222 0, #050607 45%, #000 100%);
    color: #f5f0e6;
}

/* ====== LAYOUT ====== */

.layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 240px;
    background: linear-gradient(180deg, #050507 0%, #050507 40%, #050507 100%);
    border-right: 1px solid rgba(255, 215, 128, 0.25);
    padding: 20px 18px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: sticky;
    top: 0;
    height: 100vh;
}

.main {
    flex: 1;
    padding: 24px 32px;
    display: flex;
    flex-direction: column;
}

/* ====== LOGO ====== */

.logo {
    margin-bottom: 32px;
}

.logo-main {
    display: block;
    font-size: 22px;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: #f4e3bd;
}

.logo-v {
    color: #ffd76a;
    text-shadow: 0 0 6px rgba(255, 215, 106, 0.9), 0 0 14px rgba(255, 215, 106, 0.7);
    animation: logo-v-glow 1.6s ease-in-out infinite;
}

.logo-sub {
    display: inline-block;
    margin-top: 6px;
    padding: 2px 10px;
    border-radius: 999px;
    border: 1px solid rgba(255, 215, 128, 0.55);
    font-size: 11px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: #f2d9a2;
    background: radial-gradient(circle at top, rgba(255, 215, 128, 0.16), transparent 55%);
}

@keyframes logo-v-glow {
    0%, 100% {
        opacity: 0.7;
        text-shadow: 0 0 4px rgba(255, 215, 106, 0.6), 0 0 10px rgba(255, 215, 106, 0.4);
    }
    50% {
        opacity: 1;
        text-shadow: 0 0 8px rgba(255, 230, 150, 1), 0 0 18px rgba(255, 230, 150, 0.9);
    }
}

/* ====== SIDEBAR MENU ====== */

.menu {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.menu-item {
    display: block;
    padding: 8px 10px;
    border-radius: 10px;
    font-size: 14px;
    color: #d7cfb8;
    text-decoration: none;
    transition: background 0.15s ease, color 0.15s ease;
}

.menu-item:hover {
    background: radial-gradient(circle at left, rgba(255, 215, 128, 0.18), transparent 70%);
    color: #fff4da;
}

.menu-item.active {
    background: linear-gradient(90deg, rgba(255, 215, 128, 0.34), rgba(255, 215, 128, 0.05));
    color: #fff8de;
}

.menu-item.logout {
    margin-top: 10px;
    font-size: 13px;
    opacity: 0.9;
}

.sidebar-bottom {
    margin-top: 16px;
}

.user-info {
    margin-bottom: 8px;
}

.user-name {
    display: block;
    font-size: 14px;
}

.user-role {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: #b3a57c;
}

/* ====== TOPBAR ====== */

.topbar {
    min-height: 32px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.topbar-title {
    font-size: 18px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #f3dfb1;
}

/* ====== FLASHES ====== */

.flash-container {
    margin-bottom: 8px;
}

.flash {
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 4px;
}

.flash-success {
    background: rgba(76, 175, 80, 0.12);
    border: 1px solid rgba(76, 175, 80, 0.4);
}

.flash-error {
    background: rgba(244, 67, 54, 0.12);
    border: 1px solid rgba(244, 67, 54, 0.5);
}

/* ====== CONTENT LAYOUT ====== */

.content {
    flex: 1;
}

.grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
}

.grid.three-columns {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.card {
    background: radial-gradient(circle at top left, rgba(255, 215, 128, 0.12), rgba(8, 7, 5, 0.95));
    border-radius: 18px;
    border: 1px solid rgba(255, 215, 128, 0.35);
    padding: 16px 18px;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.7);
}

.card-wide {
    grid-column: 1 / -1;
}

/* Заголовки и текст */

h1, h2, h3 {
    margin: 0 0 8px;
    font-weight: 500;
}

h1 {
    font-size: 22px;
}

h2 {
    font-size: 18px;
}

h3 {
    font-size: 15px;
}

.meta {
    font-size: 12px;
    color: #b8af96;
}

/* ====== PAGE HEADER ====== */

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    gap: 10px;
}

.page-header h1 {
    font-size: 20px;
}

.page-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ====== TABLES ====== */

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

.table th,
.table td {
    padding: 7px 8px;
}

.table thead tr {
    border-bottom: 1px solid rgba(255, 215, 128, 0.3);
}

.table tbody tr {
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    cursor: pointer;
}

.table tbody tr:hover {
    background: rgba(255, 215, 128, 0.06);
}

.table th {
    text-align: left;
    font-weight: 500;
    color: #d4c39b;
}

/* ====== BADGES ====== */

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    color: #050505;
    background: #f0d58f;
}

/* ====== FORMS & BUTTONS ====== */

.vertical-form label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
}

.vertical-form input[type="text"],
.vertical-form input[type="password"],
.vertical-form input[type="number"],
.vertical-form input[type="email"],
.vertical-form textarea,
.vertical-form select {
    width: 100%;
    margin-top: 4px;
    border-radius: 9px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 6px 8px;
    background: rgba(8, 8, 9, 0.9);
    color: #f8f3e4;
    font-size: 13px;
}

.vertical-form textarea {
    resize: vertical;
}

.checkbox {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
}

.checkbox input[type="checkbox"] {
    width: auto;
    margin: 0;
}

.two-columns {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 16px;
}

.btn-primary,
.btn-outline,
.btn-danger,
.btn-small {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    border: none;
    padding: 7px 14px;
    font-size: 13px;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.05s ease;
}

.btn-primary {
    background: linear-gradient(90deg, #f3d38b, #e4b95f);
    color: #241b08;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.6);
}

.btn-primary:hover {
    background: linear-gradient(90deg, #ffe3a5, #f0c771);
    transform: translateY(-1px);
}

.btn-outline {
    background: transparent;
    border: 1px solid rgba(255, 215, 128, 0.5);
    color: #f4e0b3;
}

.btn-outline:hover {
    background: rgba(255, 215, 128, 0.08);
}

.btn-danger {
    background: radial-gradient(circle at top, #ff6a6a, #c82424);
    color: #fffaf5;
}

.btn-danger:hover {
    background: radial-gradient(circle at top, #ff8585, #d52f2f);
}

.btn-small {
    padding: 4px 8px;
    font-size: 11px;
}

/* ====== LOGIN ====== */

.login-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 80vh;
}

.login-card {
    max-width: 360px;
    width: 100%;
    text-align: center;
}

/* ====== DIRECTORIES ====== */

.dir-list {
    list-style: none;
    padding: 0;
    margin: 0 0 12px 0;
}

.dir-list li {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 4px;
}

.dir-item-form {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.dir-item-form input[type="text"] {
    width: 140px;
}

.dir-item-form input[type="color"] {
    width: 32px;
    padding: 0;
    border-radius: 999px;
    background: transparent;
}

/* ====== MISC ====== */

.inline-form {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
}

.inline-form select {
    padding: 4px 8px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.09);
    background: rgba(8, 8, 9, 0.9);
    color: #f8f3e4;
    font-size: 13px;
}

.inline-form input[type="date"] {
    padding: 4px 8px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.09);
    background: rgba(8, 8, 9, 0.9);
    color: #f8f3e4;
    font-size: 13px;
}

.big-btn {
    font-size: 14px;
    padding: 8px 18px;
}

.big-number {
    font-size: 28px;
    margin-bottom: 4px;
}

.status-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px 12px;
    margin-top: 6px;
}

.status-item {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
}

.status-name {
    color: #d4c39b;
}

.status-value {
    color: #fff;
}

.actions-row {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.delete-form {
    margin-top: 10px;
}

/* ====== STATUS PILLS ====== */

.status-pill {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 500;
}

/* Цвета под статусы */
.status-new {
    background: rgba(0, 150, 255, 0.18);
    color: #a8d8ff;
}

.status-in-progress {
    background: rgba(255, 193, 7, 0.22);
    color: #ffdf88;
}

.status-printing {
    background: rgba(156, 39, 176, 0.22);
    color: #f1b0ff;
}

.status-printed {
    background: rgba(76, 175, 80, 0.22);
    color: #b5f2b8;
}

.status-assembly {
    background: rgba(33, 150, 243, 0.22);
    color: #a9d9ff;
}

.status-done {
    background: rgba(0, 200, 83, 0.28);
    color: #c9ffd9;
}

.status-cancelled {
    background: rgba(244, 67, 54, 0.26);
    color: #ffc0b8;
}

/* ====== RESPONSIVE ====== */

@media (max-width: 900px) {
    .sidebar {
        display: none;
    }
    .main {
        padding: 16px;
    }
    .grid.three-columns {
        grid-template-columns: 1fr;
    }
    .two-columns {
        grid-template-columns: 1fr;
    }
}

/* === Компактные таблицы заказов/печати/сборки === */

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 6px 10px;
    font-size: 13px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.table thead th {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    opacity: 0.85;
    white-space: nowrap;
}

.table tbody tr:hover {
    background: radial-gradient(circle at top left,
        rgba(255, 215, 128, 0.08),
        rgba(0, 0, 0, 0.8));
}

.table-orders td.col-id,
.table-orders td.col-date,
.table-orders td.col-wb,
.table-orders td.col-article,
.table-orders td.col-bumper,
.table-orders td.col-status,
.table-orders td.col-actions {
    white-space: nowrap;
}

.table-orders td.col-id {
    width: 60px;
}

.table-orders td.col-date {
    width: 130px;
}

.table-orders td.col-wb {
    width: 110px;
}

.table-orders td.col-article {
    width: 120px;
}

.table-orders td.col-bumper,
.table-orders td.col-status,
.table-orders td.col-actions {
    text-align: center;
}

.table-orders td.col-engraving {
    max-width: 320px;
    white-space: normal;
}

/* Компактные теги каналов / изделия / фурнитуры */
.tag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    font-size: 11px;
    padding: 3px 10px;
    color: #000;
    font-weight: 500;
    box-shadow: 0 0 12px rgba(0, 0, 0, 0.35);
}

.tag-compact {
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Небольшие бейджи Да/Нет */
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.badge-green {
    background: rgba(120, 255, 180, 0.16);
    color: #9cffc9;
    border: 1px solid rgba(120, 255, 180, 0.4);
}

.badge-gray {
    background: rgba(255, 255, 255, 0.03);
    color: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

/* Статус-плашки чтобы выглядели аккуратно в узкой колонке */
.status-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    white-space: nowrap;
}

/* Кнопки в таблице — компактные */
.btn-small {
    font-size: 11px;
    padding: 4px 10px;
}

/* Вспомогательный класс для компактных инпутов в таблицах */
.input-compact {
    padding: 4px 8px;
    font-size: 12px;
}

/* Ссылки внутри таблиц и кнопка "Сброс" — золотой стиль */
.table a,
.btn-link {
    color: #f1d79a;
    text-decoration: none;
}

.table a:hover,
.btn-link:hover {
    text-decoration: underline;
}

/* Пагинация */
.pagination-bar {
    margin-top: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
}

.pagination-controls {
    display: flex;
    gap: 6px;
    align-items: center;
}

.page-link {
    padding: 4px 8px;
    border-radius: 999px;
    border: 1px solid rgba(241, 215, 154, 0.35);
    color: #f1d79a;
    text-decoration: none;
}

.page-link.current {
    background: linear-gradient(135deg, #f1d79a, #c8943b);
    color: #000;
    border-color: transparent;
}

.page-link:hover {
    background: rgba(241, 215, 154, 0.12);
}

.page-dots {
    opacity: 0.6;
}

/* Чуть лучше поведение фильтров, если не влазят в одну строку */
.filters-row-wrap {
    flex-wrap: wrap;
    gap: 10px 16px;
}

/* ===== Дашборд ===== */

.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.3fr);
    gap: 18px;
    margin-top: 18px;
}

.dashboard-grid .card-wide {
    grid-column: 1 / -1;
}

.kpi-card .kpi-row {
    display: flex;
    gap: 24px;
    margin-top: 8px;
    margin-bottom: 12px;
}

.kpi-item {
    padding: 10px 14px;
    border-radius: 16px;
    background: radial-gradient(circle at top left,
        rgba(255, 215, 128, 0.16),
        rgba(0, 0, 0, 0.9));
}

.kpi-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    opacity: 0.7;
}

.kpi-value {
    font-size: 24px;
    font-weight: 600;
    color: #f1d79a;
}

.kpi-status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 8px;
}

.kpi-status {
    padding: 6px 10px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.02);
}

.kpi-status-label {
    font-size: 11px;
    opacity: 0.7;
}

.kpi-status-value {
    font-size: 16px;
    font-weight: 500;
}

/* Компактная таблица */
.table-compact th,
.table-compact td {
    padding: 4px 8px;
    font-size: 12px;
}
