
/* ================== VARIABLES ================== */
:root {
    --primary: rgb(17, 140, 149);
    --primary-hover: rgb(10, 120, 128);
    --accent: rgb(255, 133, 98);
    --accent-soft: rgba(255, 133, 98, 0.08);

    --danger: #dc2626;
    --bg: #f3f4f6;
    --bg-page: radial-gradient(circle at top, #e0f7f4 0, #f3f4f6 40%, #e5e7eb 100%);

    --text-main: #111827;
    --text-muted: #6b7280;
    --border: #d1d5db;

    --radius: 16px;
    --shadow: 0 14px 32px rgba(15, 23, 42, 0.18);

    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 14px;
    --spacing-lg: 18px;
    --spacing-xl: 24px;
}

/* ================== BASE ================== */
* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    min-height: 100vh;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--text-main);
    background: var(--bg-page);
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    margin: 3rem;
}

/* ================== UTILITIES ================== */
.hide {
    display: none;
    width: 1px;
    visibility: hidden;
}

.gray {
    color: #ccc !important;
}

.hidden {
    display: none;
}

/* ================== TYPOGRAPHY ================== */
h2 {
    color: #1b3659;
}

.main-title {
    margin: 0;
    font-size: 26px;
    font-weight: 650;
    letter-spacing: 0.01em;
}

.subtitle {
    margin: 10px 0 22px;
    font-size: 15px;
    color: var(--text-muted);
}

/* ================== BUTTONS ================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 5px 10px;
    margin-left: 10px;
    font-size: 0.9rem;
    color: #184c70;
    background: #f4f7fc;
    border: 1.5px solid #baccdc;
    border-radius: 6px;
    box-shadow: 0 1px 2px 0 rgba(126, 165, 218, 0.085);
    outline: none;
    text-decoration: none;
    cursor: pointer;
    transition: border-color 0.22s, box-shadow 0.18s, background 0.22s;
    font-family: inherit;
}

.btn:hover {
    background: #e7f0fa;
    border-color: #3e98d3;
    box-shadow: 0 0 5px 0 #97c9f6;
    color: #184c70;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 6px 14px rgba(17, 140, 149, 0.35);
    border: none;
}

.btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: 0 8px 20px rgba(17, 140, 149, 0.45);
}

.btn-secondary {
    background: #f3f4f6;
    color: #111827;
    border: 1px solid #e5e7eb;
}

.btn-secondary:hover {
    background: #e5e7eb;
}

.btn:active {
    transform: translateY(1px);
    box-shadow: none;
}

.btn:disabled {
    opacity: 0.6;
    cursor: default;
    box-shadow: none;
}

.btn-row {
    display: flex;
    gap: 12px;
    margin-top: 16px;
}

.btn-main {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    padding: 7px 10px;
    border-radius: 10px;
    border: none;
    background: var(--primary);
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    width: 100%;
    box-sizing: border-box;
}

.btn-main:hover {
    background: var(--primary-hover);
}

/* Меню кнопки */
.menu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 16px 18px;
    border-radius: 999px;
    border: none;
    text-decoration: none;
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    background: var(--primary);
    box-shadow: 0 6px 14px rgba(17, 140, 149, 0.35);
    cursor: pointer;
    transition: background-color 0.15s, box-shadow 0.15s, transform 0.05s;
}

.menu-btn:hover {
    background: var(--primary-hover);
    box-shadow: 0 8px 20px rgba(17, 140, 149, 0.45);
}

.menu-btn:active {
    transform: translateY(1px);
    box-shadow: none;
}

.menu-btn-secondary {
    background: #fff;
    color: var(--primary);
    border: 1px solid rgba(17, 140, 149, 0.25);
    box-shadow: 0 3px 10px rgba(15, 23, 42, 0.12);
}

.menu-btn-secondary:hover {
    background: rgba(17, 140, 149, 0.06);
    box-shadow: 0 5px 14px rgba(15, 23, 42, 0.18);
}

/* ================== FORMS & INPUTS ================== */
label {
    display: block;
    margin-bottom: 8px;
    font-size: 15px;
    font-weight: 500;
}

input[type="email"],
input[type="text"],
input[type="number"],
select,
textarea {
    border-radius: 10px;
    border: 1px solid var(--border);
    padding: 12px 13px;
    font-size: 16px;
    transition: border-color 0.15s, box-shadow 0.15s, background-color 0.15s;
    background-color: #f9fafb;
    font-family: inherit;
}

input[type="email"]:focus,
input[type="text"]:focus,
input[type="number"]:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    background-color: #fff;
    box-shadow: 0 0 0 1px rgba(17, 140, 149, 0.35);
}

input[type="file"] {
    width: 135px;
}

/* Специфичные стили для фильтров */
.filter-select,
.filter-date {
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid var(--border);
    font-size: 14px;
    background-color: #f9fafb;
    transition: border-color .15s, box-shadow .15s, background-color .15s;
    width: 100%;
    box-sizing: border-box;
}

.filter-select:focus,
.filter-date:focus {
    outline: none;
    border-color: var(--primary);
    background-color: #fff;
    box-shadow: 0 0 0 1px rgba(17, 140, 149, 0.25);
}

.filter-submit {
    padding: 8px 12px;
    border-radius: 10px;
    border: none;
    background: var(--primary);
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background .15s, box-shadow .15s;
    width: 100%;
}

.filter-submit:hover {
    background: var(--primary-hover);
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.2);
}

/* ================== INLINE EDIT ================== */
.inline-edit-input {
    width: 96%;
    padding: 6px 10px;
    font-size: 13px;
    border: 1.5px solid #baccdc;
    border-radius: 6px;
    transition: border-color 0.22s, box-shadow 0.22s;
    background: #f4f7fc;
    color: #184c70;
    box-shadow: 0 1px 2px 0 rgba(126, 165, 218, 0.09);
    outline: none;
}

.inline-edit-input:focus {
    background: #e7f0fa;
    border-color: #4597da;
    box-shadow: 0 0 5px 0 #97c9f6;
}

/* ================== TABLES ================== */
.dbtable,
.rel-table,
.simple-table,
.schedule-table,
.form-inline {
    border-collapse: collapse;
    width: 100%;
}

.dbtable th, .dbtable td,
.rel-table th, .rel-table td,
.simple-table th, .simple-table td,
.schedule-table th, .schedule-table td,
.form-inline th, .form-inline td {
    border: 1px solid #d2dbe8;
    padding: 6px 8px;
    vertical-align: top;
}

.dbtable th,
.simple-table th,
.schedule-table th,
.form-inline th {
    background: #f0f5fb;
    color: #1b3659;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
}

.dbtable tbody tr:nth-child(even),
.simple-table tbody tr:nth-child(even) {
    background: #f9fbff;
}

.dbtable tbody tr:hover,
.simple-table tbody tr:hover {
    background: #eef4ff;
}

/* Специфика для dbstable (основная таблица) */
.dbstable {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    margin-top: 6px;
}

.dbstable th,
.dbstable td {
    border: 1px solid #e5e7eb;
    padding: 6px 8px;
    text-align: center;
    white-space: nowrap;
}

.dbstable th:first-child,
.dbstable td:first-child {
    text-align: left;
}

.dbstable thead th {
    background: #f9fafb;
    font-weight: 600;
    font-size: 12px;
}

.dbstable tbody tr:nth-child(even) {
    background: #f9fafb;
}

.dbstable tbody tr:hover {
    background: #eef8f9;
}

/* Таблица расписания */
.schedule-table th,
.schedule-table td {
    border-bottom: 1px solid #e5e7eb;
    text-align: left;
}

.schedule-table tr:hover td {
    background: #f3f4ff;
}

/* Форма inline */
.form-inline th,
.form-inline td {
    border-bottom: 1px solid #e5e7eb;
}

.form-inline input[type="text"],
.form-inline input[type="number"],
.form-inline select {
    width: 100%;
    box-sizing: border-box;
    padding: 6px 8px;
    border-radius: 8px;
    border: 1px solid var(--border);
    font-size: 13px;
    background-color: #f9fafb;
}

.form-inline input:focus,
.form-inline select:focus {
    outline: none;
    border-color: var(--primary);
    background-color: #fff;
    box-shadow: 0 0 0 1px rgba(17, 140, 149, 0.25);
}

/* ================== STATUS ================== */
.status-auto,
.status-on {
    background-color: #e6ffe6;
}

.status-off {
    background-color: #ffe6e6;
}

  .placeholder {
            margin-top: 6px;
            font-size: 13px;
            color: var(--text-muted);
        }
 .schedule-block {
            margin-top: 10px;
            padding-top: 10px;
            border-top: 1px dashed #e5e7eb;
            font-size: 13px;
            white-space: pre-wrap;
        }
/* ================== CARDS & BLOCKS ================== */
.card,
.content-card,
.filter-card,
.summary-block,
.dict-card,
.box,
.menu-wrapper {
    background: #ffffff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.box {
    width: 100%;
    max-width: 520px;
    margin: 16px;
    padding: 36px 34px 30px;
}

.menu-wrapper {
    width: 100%;
    max-width: 720px;
    padding: 34px 36px 30px;
    margin: auto;
}

.content-card {
    padding: 14px 10px 16px;
    overflow-x: auto;
}

.filter-card {
    width: 100%;
    padding: 12px 14px;
    margin-bottom: 14px;
}

.summary-block {
    margin-top: 16px;
    padding: 12px 14px 14px;
}

.dict-card {
    padding: 14px 14px 18px;
}

.dict-card h2 {
    margin: 0 0 10px;
    font-size: 18px;
    color: #1b3659;
}

/* ================== PAGE LAYOUT ================== */
.page {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 18px 18px 32px;
}

.page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 14px;
}

.page-title-block {
    display: flex;
    align-items: center;
    gap: 14px;
}

.logo-title {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 8px;
}

.logo-circle {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: url('../images/logo.jpg');
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
}

.logo-circle img {
    width: 50px !important;
    height: 50px !important;
    border-radius: 50px !important;
}

.page-texts {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.page-title {
    margin: 0;
    font-size: 22px;
    font-weight: 650;
    letter-spacing: 0.01em;
}

.page-title span {
    color: var(--primary);
}

.page-subtitle {
    margin: 0;
    font-size: 13px;
    color: var(--text-muted);
}

.tag-pill {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: #7c2d12;
    font-size: 11px;
    font-weight: 500;
}

/* ================== FILTER ROW ================== */
.filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 16px;
    align-items: flex-end;
    margin-bottom: 10px;
}

.filter-field {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1 1 200px;
}

.filter-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 3px;
}

/* ================== CONTENT HEADER ================== */
.content-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 10px;
    padding: 0 4px;
}

.content-header h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.content-header h3 {
    margin: 0;
    font-size: 13px;
    font-weight: 400;
    color: var(--text-muted);
}

/* ================== TABS ================== */
.tabs-wrapper {
    margin-top: 10px;
    margin-bottom: 14px;
}

.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tab-btn {
    background: #f5f7fa;
    color: #1b3659;
    border: 1px solid #c5d0e1;
    border-radius: 999px;
    padding: 6px 16px;
    font-size: 13px;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background-color .15s, color .15s, box-shadow .15s, transform .05s;
}

.tab-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    box-shadow: 0 4px 10px rgba(17, 140, 149, 0.35);
}

.tab-btn:hover {
    transform: translateY(-1px);
}

.tab-content {
    display: none;
    margin-top: 10px;
}

.tab-content.active {
    display: block;
}

/* ================== MENU SPECIFIC ================== */
.menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 14px;
}

.menu-title-group {
    display: flex;
    align-items: center;
    gap: 16px;
}

.menu-title {
    margin: 0;
    font-size: 26px;
    font-weight: 650;
}

.menu-role {
    margin: 4px 0 0;
    font-size: 15px;
    color: var(--text-muted);
}

.menu-logout {
    font-size: 15px;
}

.menu-logout a {
    color: var(--danger);
    text-decoration: none;
}

.menu-logout a:hover {
    text-decoration: underline;
}

.menu-subtitle {
    margin: 8px 0 20px;
    font-size: 15px;
    color: var(--text-muted);
}

.menu-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.menu-footer {
    margin-top: 20px;
    font-size: 13px;
    color: var(--text-muted);
}

/* ================== SUMMARY BLOCK ================== */
.summary-block h3 {
    margin: 0 0 8px;
    font-size: 15px;
    font-weight: 600;
}

.summary-block p {
    margin: 4px 0;
    font-size: 13px;
}

.summary-block label {
    margin-right: 10px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
}

.summary-block input[type="number"],
.summary-block textarea {
    border-radius: 8px;
    border: 1px solid var(--border);
    font-size: 13px;
    padding: 6px 8px;
    width: 95%;
}

.summary-block textarea {
    resize: vertical;
}

.summary-block input[type="number"]:focus,
.summary-block textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 1px rgba(17, 140, 149, 0.25);
}

#group-summary-save,
.group-shedule-edit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    border-radius: 999px;
    border: none;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    background: var(--primary);
    color: #fff;
    box-shadow: 0 4px 10px rgba(17, 140, 149, 0.3);
    transition: background-color .15s, box-shadow .15s, transform .05s;
}

.group-shedule-edit {
    text-decoration: none;
}

#group-summary-save:hover,
.group-shedule-edit:hover {
    background: var(--primary-hover);
    box-shadow: 0 6px 14px rgba(17, 140, 149, 0.4);
}

#group-summary-save:active,
.group-shedule-edit:active {
    transform: translateY(1px);
    box-shadow: none;
}

/* ================== LINKS ================== */
a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.actions a {
    font-size: 12px;
    margin-right: 8px;
    color: #0f766e;
    text-decoration: none;
}

.actions a:hover {
    text-decoration: underline;
}

.links-block {
    margin-top: 14px;
    font-size: 13px;
}

.back-link {
    font-size: 13px;
    margin-bottom: 10px;
}

.back-link a {
    color: #0f766e;
}

.back-link-input {
    display: inline-block;
    padding: 7px 16px;
    font-size: 1.03em;
    color: #184c70;
    background: #f4f7fc;
    border: 1.5px solid #baccdc;
    border-radius: 6px;
    box-shadow: 0 1px 2px 0 rgba(126, 165, 218, 0.085);
    outline: none;
    text-decoration: none;
    cursor: pointer;
    transition: border-color 0.22s, box-shadow 0.18s, background 0.22s;
    font-family: inherit;
}

.back-link-input:focus,
.back-link-input:hover {
    background: #e7f0fa;
    border-color: #3e98d3;
    box-shadow: 0 0 5px 0 #97c9f6;
    color: #184c70;
    text-decoration: none;
}

/* ================== CODE INPUT (авторизация) ================== */
.code-input {
    position: relative;
    margin: 14px 0 8px;
}

.code-hidden-input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.code-boxes {
    display: flex;
    gap: 10px;
}

.code-box {
    width: 44px;
    height: 52px;
    border-bottom: 2px solid #d1d5db;
    font-size: 30px;
    text-align: center;
    line-height: 52px;
    font-family: "Tahoma", "Arial", sans-serif;
    box-sizing: border-box;
    color: #111827;
    transition: border-color 0.15s, transform 0.1s;
}

.code-box.active {
    border-bottom-color: var(--primary);
    transform: translateY(-1px);
}

.code-box.filled {
    border-bottom-color: #111827;
}

.email-target {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.email-target span {
    color: #111827;
    font-weight: 500;
}

/* ================== MESSAGES ================== */
.msg {
    margin: 14px 0 14px;
    font-size: 14px;
    min-height: 20px;
}

.msg-error {
    color: #b91c1c;
}

.msg-success {
    color: rgb(255, 133, 98);
}

.hint {
    margin-top: 8px;
    font-size: 13px;
    color: var(--text-muted);
}

/* ================== ДРУГИЕ КЛАССЫ ================== */
.ctx-ditem {
    max-width: 30px;
}

.pencil,
.penciladd {
    cursor: pointer;
    display: inline-block;
    text-align: center;
}

.pencil img,
.penciladd img {
    width: 20px !important;
    height: 20px !important;
}

.penciladd {
    margin-left: 10px;
}

.expand-row {
    background: #f9f9fc;
}

/* ================== MOBILE ================== */
@media (max-width: 768px) {
    body {
        align-items: flex-start;
        background: #f3f4f6;
        margin: 0;
    }

    .page {
        padding: 12px 10px 26px;
    }

    .content-card {
        padding: 10px 6px 12px;
    }

    .dbstable {
        font-size: 12px;
        min-width: 220px;
    }

    .filter-card {
        padding: 10px;
    }

    .summary-block {
        padding: 10px;
    }

    .page-title {
        font-size: 20px;
    }

    .content-header h2 {
        font-size: 16px;
    }

    .box {
        max-width: 100%;
        min-height: 100vh;
        border-radius: 0;
        box-shadow: none;
        margin: 0;
        padding: 20px 14px 24px;
    }

    .logo-title {
        gap: 10px;
    }

    .logo-circle {
        width: 50px;
        height: 50px;
    }

    .logo-circle img {
        width: 50px;
        height: 50px;
        border-radius: 50px;
    }

    .main-title {
        font-size: 22px;
    }

    .subtitle {
        font-size: 13px;
        margin: 6px 0 18px;
    }

    label {
        font-size: 13px;
    }

    input[type="email"],
    input[type="text"] {
        font-size: 16px;
        padding: 11px 12px;
    }

    .btn-row {
        flex-direction: column;
    }

    .btn {
        width: 100%;
        font-size: 15px;
        padding: 12px 16px;
    }

    .msg {
        font-size: 13px;
    }

    .hint,
    .email-target {
        font-size: 12px;
    }

    .code-boxes {
        gap: 6px;
        justify-content: space-between;
    }

    .code-box {
        flex: 1;
        max-width: 44px;
        font-size: 26px;
        height: 48px;
        line-height: 48px;
    }

    /* меню на мобильном */
    .menu-wrapper {
        max-width: 100%;
        min-height: 100vh;
        border-radius: 0;
        box-shadow: none;
        padding: 20px 14px 24px;
    }

    .menu-title {
        font-size: 20px;
    }

    .menu-role {
        font-size: 13px;
    }

    .menu-subtitle {
        font-size: 13px;
    }

    .menu-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .menu-btn {
        width: 100%;
        font-size: 15px;
        padding: 13px 16px;
    }

    .menu-footer {
        font-size: 12px;
    }

    .dbtable {
        font-size: 12px;
    }

    .tab-btn {
        font-size: 12px;
        padding: 5px 12px;
    }

    .dict-card {
        padding: 10px;
    }
}
