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

body {
    font-family: "Segoe UI", system-ui, sans-serif;
    background: #f5f6fa;
    color: #222;
    font-size: 14px;
}

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

/* --- Верхняя лента этапов (StepBar десктопной версии) --- */
.stepbar {
    height: 54px;
    flex-shrink: 0;
    background: #fff;
    border-bottom: 1px solid #dfe3e8;
    display: flex;
    align-items: center;
    padding: 0 14px;
    gap: 12px;
    position: sticky;
    top: 0;
    z-index: 50;
}
.stepbar-logo { font-weight: 600; font-size: 14px; color: #2c3e50; white-space: nowrap; }
.stepbar-steps { display: flex; gap: 7px; }
.step-circle {
    width: 34px; height: 34px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 12px;
    text-decoration: none;
    background: #f2f4f7;
    color: #222;
    border: 1px solid #3498db;
    box-sizing: border-box;
}
.step-circle.done { background: #27ae60; color: #fff; border-color: #27ae60; }
.step-circle.locked { background: #f2f4f7; color: #aab4bf; border-color: #dfe3e8; cursor: not-allowed; }
/* Активный (открытый) шаг — всегда синий, поверх статуса done/available */
.step-circle.active {
    background: #3498db;
    color: #fff;
    border: 2px solid #2c81c0;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, .25);
}
.step-circle:not(.locked):hover { filter: brightness(0.95); }
.stepbar-title { flex: 1; text-align: center; font-size: 17px; font-weight: 500; color: #222; }
.stepbar-spacer { width: 420px; flex-shrink: 1; }

.content { flex: 1; padding: 16px 24px; min-width: 0; }
.content h1 { font-size: 22px; margin-bottom: 18px; }

/* --- Сообщения (flash) --- */
.flash { padding: 10px 14px; border-radius: 6px; margin-bottom: 14px; }
.flash.success { background: #e8f8ef; color: #1e7a45; border: 1px solid #b8e6cc; }
.flash.error { background: #fdeaea; color: #b03030; border: 1px solid #f2c4c4; }

/* --- Кнопки --- */
.btn {
    display: inline-block;
    padding: 7px 14px;
    border: 1px solid #ccc;
    border-radius: 6px;
    background: #fff;
    color: #222;
    cursor: pointer;
    font-size: 14px;
    text-decoration: none;
    line-height: 1.3;
}
.btn:hover { background: #f0f2f5; }
.btn-primary { background: #3498db; border-color: #3498db; color: #fff; }
.btn-primary:hover { background: #2f89c5; }
.btn-danger { background: #fff; border-color: #e74c3c; color: #e74c3c; }
.btn-danger:hover { background: #fdeaea; }
.btn-sm { padding: 3px 9px; font-size: 13px; }

/* --- Таблицы --- */
.table-wrap { overflow-x: auto; background: #fff; border: 1px solid #e2e5ea; border-radius: 8px; }
table.table { border-collapse: collapse; width: 100%; background: #fff; }
.table th, .table td { border-bottom: 1px solid #e8eaef; padding: 8px 12px; text-align: left; vertical-align: middle; }
.table th { background: #f7f8fa; font-weight: 600; white-space: nowrap; position: sticky; top: 0; }
.table tr:hover td { background: #f9fbfd; }
.table td.actions { white-space: nowrap; text-align: right; }

/* --- Формы --- */
.form-card { background: #fff; border: 1px solid #e2e5ea; border-radius: 8px; padding: 18px; max-width: 640px; }
.form-row { margin-bottom: 12px; }
.form-row label { display: block; margin-bottom: 4px; font-weight: 500; }
.form-row input[type="text"], .form-row input[type="number"], .form-row input[type="time"], .form-row select, .form-row textarea {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid #ccd2da;
    border-radius: 6px;
    font-size: 14px;
    background: #fff;
}
.form-inline { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.form-inline .form-row { margin-bottom: 0; }
.toolbar { display: flex; gap: 10px; margin-bottom: 14px; align-items: center; flex-wrap: wrap; }
.toolbar .spacer { flex: 1; }

/* --- Модальное окно --- */
.modal-backdrop {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,.35);
    z-index: 100;
    align-items: flex-start;
    justify-content: center;
    padding: 60px 16px;
}
.modal-backdrop.open { display: flex; }
.modal {
    background: #fff;
    border-radius: 10px;
    padding: 20px;
    width: 100%;
    max-width: 560px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0,0,0,.2);
}
.modal h2 { font-size: 18px; margin-bottom: 14px; }
.modal .modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }

/* --- Матрица ограничений (день × урок) --- */
.matrix { border-collapse: collapse; }
.matrix th, .matrix td { border: 1px solid #dfe3e8; padding: 4px; text-align: center; min-width: 34px; }
.matrix td.cell { cursor: pointer; height: 30px; background: #fff; }
.matrix td.cell.blocked { background: #e74c3c; }
.matrix td.cell:hover { outline: 2px solid #3498db; outline-offset: -2px; }

/* --- Бейджи --- */
.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 12px; background: #eef1f5; color: #444; }
.badge.blue { background: #e3f1fb; color: #2471a3; }
.badge.green { background: #e8f8ef; color: #1e7a45; }
.badge.red { background: #fdeaea; color: #b03030; }

.placeholder { color: #777; }
.muted { color: #888; font-size: 13px; }
.empty-state { color: #888; padding: 30px; text-align: center; }
