:root {
    --bg: #0f172a;
    --card: #1e293b;
    --border: #334155;
    --accent: #38bdf8;
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --danger: #ef4444;
}

* { box-sizing: border-box; }

body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; background: var(--bg); color: var(--text); padding: 15px; margin: 0; }
.container { max-width: 1100px; margin: 0 auto; }
.hidden { display: none !important; }

/* Шапка */
.header-main { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; flex-wrap: wrap; gap: 15px;}
.header-main h1 { margin: 0; font-size: 1.5rem;}
.add-actions { display: flex; gap: 10px; flex-wrap: wrap;}

.header-center { display: flex; flex-direction: column; align-items: center; gap: 8px; flex: 1; min-width: 200px; }
.header-center h1 { text-align: center; }
.editor-price-badge { background: rgba(56, 189, 248, 0.1); border: 1px solid var(--accent); color: var(--accent); padding: 6px 16px; border-radius: 8px; font-size: 1.15rem; font-weight: 600; box-shadow: 0 0 15px rgba(56, 189, 248, 0.15); transition: all 0.2s;}
.editor-price-badges { display: flex; flex-direction: column; gap: 8px; align-items: center; }
.editor-profit-line { margin-top: 4px; color: var(--text-muted); font-size: 0.8rem; font-weight: 500; line-height: 1.2; }

.card { background: var(--card); border-radius: 12px; border: 1px solid var(--border); padding: 20px; box-shadow: 0 10px 15px -3px rgba(0,0,0,0.5); }

/* Таблица Dashboard */
.table-container { overflow-x: auto; padding: 0; }
.product-table { width: 100%; border-collapse: collapse; text-align: left; min-width: 860px; }
.product-table th { padding: 15px; border-bottom: 2px solid var(--border); color: var(--text-muted); font-size: 0.8rem; text-transform: uppercase; white-space: nowrap; }
.product-table td { padding: 12px 15px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.product-table tr:hover { background: rgba(255,255,255,0.02); }

.row-calc-input { background: transparent; border: 1px solid var(--border); color: #fff; padding: 8px; border-radius: 4px; width: 100px; text-align: right; font-size: 1rem;}
.row-calc-input:focus { border-color: var(--accent); outline: none; background: #0f172a;}
.final-price-tag { font-weight: bold; color: var(--accent); font-family: monospace; font-size: 1.1rem; }
.dashboard-profit-line { margin-top: 4px; color: var(--text-muted); font-size: 0.75rem; line-height: 1.2; white-space: nowrap; }

/* Форма редактора */
.form-grid-columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; }
.form-section { background: rgba(0,0,0,0.2); padding: 15px; border-radius: 8px; border: 1px solid var(--border); display: flex; flex-direction: column; gap: 12px;}
.section-title { margin: 0 0 5px 0; font-size: 1rem; color: var(--accent); border-bottom: 1px dashed var(--border); padding-bottom: 8px; }
.form-grid-mini { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.input-group { display: flex; flex-direction: column; width: 100%; }
.input-group label { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.input-group input { background: #0f172a; border: 1px solid var(--border); padding: 10px; border-radius: 6px; color: #fff; width: 100%; font-size: 0.95rem; transition: border-color 0.2s;}
.input-group input:focus { outline: none; border-color: var(--accent); }

/* Кнопки */
.btn { padding: 10px 16px; border-radius: 6px; cursor: pointer; border: none; font-weight: 600; font-size: 0.9rem; transition: all 0.2s; display: inline-flex; align-items: center; justify-content: center; height: 38px;}
.btn-primary { background: var(--accent); color: #000; }
.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--text-muted); }
select.btn-outline, .input-group select { background: #0f172a; color: var(--text); }
select option, select optgroup { background: #ffffff; color: #0f172a; }
select option:checked { background: #2563eb; color: #ffffff; }
.btn-danger { background: transparent; color: var(--danger); border: 1px solid var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }

.actions-cell { display: flex; gap: 8px; justify-content: flex-end; }
.btn-icon { padding: 6px 10px; font-size: 1.1rem; height: auto; }
.shipment-items-card { margin-top: 20px; }
.shipment-items-table { min-width: 940px; }
.selected-row { background: rgba(56, 189, 248, 0.08); }
.shipment-item-editor-header { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-bottom: 15px; }
.shipment-item-editor-header h2 { margin: 0; font-size: 1.2rem; color: var(--accent); }

/* === АДАПТАЦИЯ ДЛЯ МОБИЛЬНЫХ УСТРОЙСТВ === */
@media (max-width: 768px) {
    .header-main { flex-direction: column; align-items: flex-start; }
    .add-actions { width: 100%; flex-direction: column; }
    .add-actions .btn, .add-actions select { width: 100%; }
    
    .table-container { padding: 0; background: transparent; border: none; box-shadow: none; }
    .product-table { min-width: 100%; }
    
    /* Прячем классическую шапку таблицы */
    .product-table thead { display: none; }
    
    /* Превращаем строки в карточки */
    .product-table tr {
        display: flex;
        flex-direction: column;
        margin-bottom: 16px;
        background: var(--card);
        border: 1px solid var(--border);
        border-radius: 12px;
        padding: 10px;
    }
    
    .product-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        border-bottom: 1px dashed var(--border);
        padding: 12px 5px;
    }
    
    .product-table td:last-child { border-bottom: none; justify-content: stretch; }
    
    /* Достаем названия колонок из data-label */
    .product-table td::before {
        content: attr(data-label);
        color: var(--text-muted);
        font-size: 0.8rem;
        text-transform: uppercase;
        margin-right: 15px;
    }
    
    .row-calc-input { width: 130px; }
    .actions-cell { width: 100%; justify-content: space-between; }
    .actions-cell .btn { flex: 1; }
}
