/* VitaMed MAX admin — design system replicated from the Infinity8 reference
   admin dashboard (its ds.ts tokens): #F4F6F9 canvas, white 12px-radius cards
   with #E8EAED borders, dark-navy #0D1F40 sidebar, compact 12px type scale,
   11px uppercase labels, tinted status pills and icon boxes. */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Montserrat:wght@600;700;800&display=swap');

:root {
    /* Backgrounds */
    --page-bg: #F4F6F9;
    --card-bg: #FFFFFF;
    --sidebar-bg: #0D1F40;
    --sidebar-active: #1B365D;

    /* Text */
    --title: #111827;
    --body: #374151;
    --muted: #6B7280;
    --faint: #9CA3AF;

    /* Borders */
    --border: #E8EAED;
    --divider: #F3F4F6;

    /* Brand */
    --navy: #0D1F40;
    --navy-mid: #1B365D;
    --gold: #C29B55;

    /* Semantic */
    --blue: #3B82F6;
    --green: #10B981;
    --red: #EF4444;
    --amber: #F59E0B;
    --violet: #8B5CF6;
    --teal: #14B8A6;

    /* Tints */
    --blue-tint: #EFF6FF;
    --green-tint: #F0FDF4;
    --red-tint: #FFF1F2;
    --amber-tint: #FFFBEB;
    --violet-tint: #F5F3FF;
    --teal-tint: #F0FDFA;

    --radius: 12px;
    --radius-sm: 8px;
}

* { box-sizing: border-box; }

html { min-width: 320px; }

body {
    margin: 0;
    min-height: 100dvh;
    background: var(--page-bg);
    color: var(--body);
    font-family: 'Inter', ui-sans-serif, system-ui, sans-serif;
    font-size: 13px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--navy); text-decoration: none; }
a:hover { color: var(--navy-mid); }

button, input, select, textarea { font: inherit; color: inherit; }

.ic { flex-shrink: 0; vertical-align: -2px; }

/* ── Sidebar ────────────────────────────────────────────────────── */
.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 232px;
    display: flex;
    flex-direction: column;
    /* reduced top/bottom padding to keep logo and tabs close */
    padding: 10px 12px 8px;
    overflow-y: auto;
    overflow-x: hidden;
    background: var(--sidebar-bg);
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    /* smaller bottom padding so tabs sit closer under the logo */
    padding: 4px 8px 6px;
    color: #fff;
}

.brand:visited, .brand:hover { color: #fff; }

.brand-logo {
    display: block;
    width: 152px;
    height: 152px;
    object-fit: contain;
    margin-bottom: 6px;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    background: var(--gold);
    color: #fff;
    font-family: 'Montserrat', sans-serif;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.brand strong {
    display: block;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.2;
}

.brand small {
    display: block;
    color: rgba(255, 255, 255, 0.5);
    font-size: 11px;
}

.nav-label {
    padding: 12px 10px 6px;
    color: rgba(255, 255, 255, 0.35);
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.nav-section { display: grid; gap: 2px; min-width: 0; margin-top: 0; }

.nav-section a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    color: rgba(255, 255, 255, 0.6);
    font-size: 13px;
    font-weight: 500;
    transition: background-color 120ms ease, color 120ms ease;
}

.nav-section a:hover {
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.85);
}

.nav-section a.active {
    background: var(--sidebar-active);
    color: #fff;
}

.nav-link-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nav-notification {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 19px;
    height: 19px;
    margin-left: auto;
    padding: 0 6px;
    border-radius: 999px;
    background: #EF4444;
    color: #FFFFFF;
    font-size: 10px;
    font-weight: 800;
    line-height: 1;
    box-shadow: 0 0 0 2px rgba(13, 31, 64, 0.95);
}

.account-panel {
    margin-top: auto;
    padding: 12px 10px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.account-panel span {
    display: block;
    color: rgba(255, 255, 255, 0.85);
    font-size: 12.5px;
    font-weight: 600;
}

.account-panel small {
    display: block;
    color: rgba(255, 255, 255, 0.45);
    font-size: 11px;
}

.account-panel a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
    color: var(--gold);
    font-size: 12px;
    font-weight: 600;
}

.account-panel a:hover { color: #d9b98a; }

/* ── Layout ─────────────────────────────────────────────────────── */
.main { margin-left: 232px; padding: 24px 28px 40px; }

.main-auth { margin-left: 0; padding: 0; }

.page { max-width: 1240px; margin: 0 auto; }

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 20px;
}

.page-header h1 {
    margin: 0;
    color: var(--title);
    font-size: 20px;
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: -0.01em;
}

.page-header h2 { margin: 0; color: var(--title); font-size: 14px; font-weight: 700; }

.page-header p {
    max-width: 720px;
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 12.5px;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
}

.content-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(280px, 0.8fr);
    gap: 14px;
    align-items: start;
}

.content-grid > *, .grid > * { min-width: 0; }

/* ── Cards ──────────────────────────────────────────────────────── */
.panel, .card {
    min-width: 0;
    margin-bottom: 14px;
    padding: 20px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.panel h2, .card h2, .panel h3, .card h3 {
    margin: 0 0 14px;
    color: var(--title);
    font-size: 13px;
    font-weight: 700;
}

.panel-narrow { max-width: 640px; }

.section-label {
    color: var(--faint);
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 4px;
}

.compact-brand { padding: 0; margin-bottom: 18px; color: var(--title); display: flex; align-items: center; gap: 10px; }
.compact-brand:hover { color: var(--title); }
.compact-brand strong { color: var(--title); }
.compact-brand small { color: var(--muted); }
.compact-logo { width: 152px; height: 152px; }

.full-width { width: 100%; }
.section-gap { margin-top: 14px; }
.section-divider { border: 0; border-top: 1px solid var(--divider); margin: 14px 0; }
.form-slab { padding: 14px 0; border-top: 1px solid var(--divider); }
.form-slab-compact { padding: 12px 0; border-top: 1px solid var(--divider); }
.inline-action { margin-top: 10px; }
.support-note { margin-top: 10px; }

/* ── KPI metrics ────────────────────────────────────────────────── */
.metric {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    min-height: 0;
    padding: 16px 18px;
}

.metric-label {
    color: var(--faint);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.metric-value, .number {
    margin-top: 4px;
    color: var(--title);
    font-size: 24px;
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.01em;
}

.metric-note, .label, .muted { color: var(--muted); font-size: 12px; }

.icon-box {
    display: grid;
    place-items: center;
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    border-radius: 10px;
}

.icon-box.blue { background: var(--blue-tint); color: var(--blue); }
.icon-box.green { background: var(--green-tint); color: var(--green); }
.icon-box.red { background: var(--red-tint); color: var(--red); }
.icon-box.amber { background: var(--amber-tint); color: var(--amber); }
.icon-box.violet { background: var(--violet-tint); color: var(--violet); }
.icon-box.teal { background: var(--teal-tint); color: var(--teal); }

/* ── Tables ─────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; margin: 0 -20px; padding: 0 20px; }

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

.row-new {
    background: rgba(220, 252, 231, 0.35);
}

.message-cell {
    max-width: 520px;
    white-space: pre-wrap;
    line-height: 1.45;
}

th {
    position: sticky;
    top: 0;
    z-index: 1;
    padding: 8px 12px;
    text-align: left;
    background: #FAFAFA;
    color: var(--faint);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

td {
    padding: 10px 12px;
    text-align: left;
    vertical-align: middle;
    color: var(--body);
    font-size: 12px;
    border-bottom: 1px solid var(--divider);
}

td strong { color: var(--title); font-weight: 600; }

tr:hover td { background: #FAFBFC; }

/* ── Buttons ────────────────────────────────────────────────────── */
.actions, .filter-bar, .pagination, .button-row {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 7px 12px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: #F3F4F6;
    color: var(--body);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.4;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
}

.btn:visited { color: inherit; }
.btn:active { transform: translateY(1px); }

.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:visited, .btn-primary:hover { background: var(--navy-mid); color: #fff; }

.btn-secondary { background: #fff; color: var(--body); border-color: var(--border); }
.btn-secondary:hover { border-color: #C9CFD6; color: var(--title); }

.btn-danger { background: var(--red-tint); color: #B91C1C; }
.btn-danger:visited { color: #B91C1C; }
.btn-danger:hover { background: #FFE4E6; color: #991B1B; }

.btn-success { background: var(--green-tint); color: #15803D; }
.btn-success:visited { color: #15803D; }
.btn-success:hover { background: #DCFCE7; color: #166534; }

.btn-sm { padding: 4px 9px; font-size: 11.5px; gap: 5px; }

.btn-icon {
    width: 30px;
    height: 30px;
    padding: 0;
}

.btn-icon.btn-sm {
    width: 28px;
    height: 28px;
}

.copy-phone-btn { white-space: nowrap; }
.copy-phone-btn.copy-success { background: var(--green-tint); border-color: #BBF7D0; color: #15803D; }
.phone-cell { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.inline-record-link {
    color: var(--blue);
    font-weight: 700;
    text-decoration: none;
}
.inline-record-link:hover { text-decoration: underline; }

/* ── Drag-and-drop ordering ──────────────────────────────────────── */
.drag-column { width: 74px; text-align: center; }

.drag-cell { text-align: center; }

.drag-handle {
    display: inline-grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #FFFFFF;
    color: var(--faint);
    cursor: grab;
    font-size: 16px;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -3px;
    user-select: none;
    transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease, box-shadow 120ms ease;
}

.drag-handle:hover {
    border-color: #C9CFD6;
    color: var(--title);
    box-shadow: 0 2px 8px rgba(13, 31, 64, 0.08);
}

.drag-handle:active { cursor: grabbing; }

.is-dragging {
    opacity: 0.48;
    background: var(--blue-tint);
}

.sortable-panels {
    display: grid;
    gap: 18px;
}

.sortable-panel.is-dragging {
    border-color: rgba(59, 130, 246, 0.42);
    box-shadow: 0 16px 36px rgba(13, 31, 64, 0.12);
}

.sortable-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sortable-title h2 { margin: 0; }

.reorder-hint {
    margin: 0 0 10px;
    color: var(--muted);
    font-size: 12px;
}

.reorder-status {
    min-height: 18px;
    margin: -4px 0 8px;
    color: var(--faint);
    font-size: 12px;
}

.reorder-status[data-type="success"] { color: #15803D; }

.reorder-status[data-type="error"] { color: #B91C1C; }

.filter-bar { margin-bottom: 14px; }

.records-toolbar {
    justify-content: space-between;
    align-items: flex-start;
}

.filter-group {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
}

.tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.tab-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    margin-bottom: -1px;
    border: 1px solid transparent;
    border-bottom-color: var(--border);
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
}

.tab-link:hover {
    color: var(--title);
    background: #FAFBFC;
}

.tab-link.active {
    border-color: var(--border);
    border-bottom-color: #FFFFFF;
    background: #FFFFFF;
    color: var(--title);
}

.panel-title-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
    margin-bottom: 14px;
}

.panel-title-row h2 { margin-bottom: 2px; }

.filter-bar .btn { background: #fff; border-color: var(--border); color: var(--muted); }
.filter-bar .btn:hover { color: var(--title); }
.filter-bar .btn.active { background: var(--navy); border-color: var(--navy); color: #fff; }

/* ── Dialogs ───────────────────────────────────────────────────── */
.modal-dialog {
    width: min(620px, calc(100vw - 32px));
    max-height: calc(100dvh - 32px);
    padding: 0;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: var(--card-bg);
    color: var(--body);
    box-shadow: 0 24px 80px rgba(13, 31, 64, 0.26);
}

.modal-dialog-sm { width: min(480px, calc(100vw - 32px)); }

.modal-dialog::backdrop {
    background: rgba(13, 31, 64, 0.52);
    backdrop-filter: blur(3px);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 22px;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(180deg, #FFFFFF 0%, #FAFBFC 100%);
}

.modal-header h2 {
    margin: 0;
    color: var(--title);
    font-size: 18px;
    font-weight: 700;
}

.modal-subtitle {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.modal-subtitle strong { color: var(--title); }

.modal-body { padding: 20px 22px; overflow-y: auto; max-height: calc(100dvh - 104px); }

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 16px;
}

.password-modal-form { margin: 0; }

.password-modal-header {
    padding: 20px 22px;
    background:
        radial-gradient(circle at top left, rgba(194, 155, 85, 0.16), transparent 38%),
        linear-gradient(180deg, #FFFFFF 0%, #FAFBFC 100%);
}

.modal-title-with-icon {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.modal-title-icon {
    display: inline-grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border: 1px solid rgba(194, 155, 85, 0.28);
    border-radius: 12px;
    background: #FFF8EA;
    color: #A16207;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.password-modal-alert {
    display: flex;
    gap: 8px;
    margin-bottom: 18px;
    padding: 12px 13px;
    border: 1px solid #FDE68A;
    border-radius: 12px;
    background: #FFFBEB;
    color: #92400E;
    font-size: 12.5px;
    line-height: 1.45;
}

.password-modal-alert::before {
    content: "!";
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    border-radius: 999px;
    background: #F59E0B;
    color: #FFFFFF;
    font-size: 11px;
    font-weight: 800;
    line-height: 1;
}

.password-modal-form .form-group { margin-bottom: 16px; }

.password-modal-form .form-group label {
    color: var(--title);
    font-size: 12.5px;
    font-weight: 700;
}

.password-field-group { gap: 7px; }

.password-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.password-input-wrap input[type="password"],
.password-input-wrap input[type="text"] {
    min-height: 44px;
    padding: 10px 44px 10px 12px;
    border-radius: 11px;
    font-size: 14px;
}

.password-input-wrap input[type="password"]:focus,
.password-input-wrap input[type="text"]:focus {
    border-color: rgba(13, 31, 64, 0.5);
    box-shadow: 0 0 0 4px rgba(13, 31, 64, 0.08);
}

.password-toggle {
    position: absolute;
    right: 8px;
    display: inline-grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--faint);
    cursor: pointer;
    transition: background-color 120ms ease, color 120ms ease;
}

.password-toggle:hover {
    background: #F3F4F6;
    color: var(--title);
}

.password-toggle:focus-visible {
    outline: 2px solid rgba(13, 31, 64, 0.28);
    outline-offset: 2px;
}

.password-modal-checklist {
    display: grid;
    gap: 8px;
    margin-top: 2px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #FAFBFC;
    color: var(--muted);
    font-size: 12px;
}

.password-modal-checklist span {
    display: flex;
    align-items: center;
    gap: 8px;
}

.password-modal-checklist .ic { color: #15803D; }

.password-modal-actions {
    position: sticky;
    bottom: 0;
    margin-top: 0;
    padding: 16px 22px;
    border-top: 1px solid var(--border);
    background: rgba(250, 251, 252, 0.96);
    backdrop-filter: blur(8px);
}

.password-modal-actions .btn {
    min-height: 40px;
    padding-inline: 14px;
}

.password-settings-card {
    background: linear-gradient(180deg, #FFFFFF 0%, #FBFCFD 100%);
}

/* ── Forms ──────────────────────────────────────────────────────── */
.form-group { display: grid; gap: 5px; margin-bottom: 12px; }

.form-group label {
    color: var(--body);
    font-size: 12px;
    font-weight: 600;
}

.form-help { color: var(--faint); font-size: 11px; font-weight: 400; }

input, select, textarea {
    width: 100%;
    min-height: 0;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: #fff;
    color: var(--title);
    font-size: 13px;
}

input::placeholder, textarea::placeholder { color: var(--faint); }

select { padding-right: 26px; }

textarea { min-height: 96px; resize: vertical; }

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--navy);
    box-shadow: 0 0 0 3px rgba(13, 31, 64, 0.08);
}

.rich-editor {
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: #fff;
}

.rich-toolbar {
    display: flex;
    gap: 4px;
    padding: 6px;
    border-bottom: 1px solid var(--divider);
    background: #FAFBFC;
}

.rich-toolbar .btn {
    width: 30px;
    height: 28px;
    padding: 0;
}

.rich-field {
    min-height: 128px;
    padding: 10px;
    color: var(--title);
    font-size: 13px;
    white-space: pre-wrap;
    word-break: break-word;
}

.rich-field:focus {
    outline: none;
    box-shadow: inset 0 0 0 3px rgba(13, 31, 64, 0.08);
}

.btn:focus-visible, a:focus-visible {
    outline: 2px solid var(--navy);
    outline-offset: 2px;
}

/* Checkboxes/radios must never inherit the full-width text-input sizing. */
input[type="checkbox"], input[type="radio"] {
    width: 15px;
    height: 15px;
    min-height: 0;
    padding: 0;
    margin: 0 2px 0 0;
    accent-color: var(--navy);
    vertical-align: -2px;
    cursor: pointer;
}

input[type="checkbox"]:focus, input[type="radio"]:focus { box-shadow: none; }

label:has(> input[type="checkbox"]), label:has(> input[type="radio"]) {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--body);
    cursor: pointer;
}

input[type="date"], input[type="time"] { width: auto; }

input[type="file"] { padding: 6px; font-size: 12px; }

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

/* Акции and Рассылки carry longer editorial content, so use a slightly
   roomier type scale on those pages without changing the compact admin shell. */
.page-comfortable-type { font-size: 14px; }
.page-comfortable-type .page-header h1 { font-size: 22px; }
.page-comfortable-type .page-header p { font-size: 13.5px; }
.page-comfortable-type .panel h2,
.page-comfortable-type .panel h3 { font-size: 14px; }
.page-comfortable-type .form-group label { font-size: 13px; }
.page-comfortable-type .form-help { font-size: 12px; }
.page-comfortable-type input,
.page-comfortable-type select,
.page-comfortable-type textarea { font-size: 14px; }
.page-comfortable-type input[type="file"] { font-size: 13px; }
.page-comfortable-type th { font-size: 12px; }
.page-comfortable-type td { font-size: 13px; }
.page-comfortable-type .muted { font-size: 13px; }
.page-comfortable-type .btn { font-size: 13px; }
.page-comfortable-type .btn-sm { font-size: 12.5px; }
.page-comfortable-type .badge { font-size: 11px; }
.page-comfortable-type .notice { font-size: 13.5px; }
.page-comfortable-type .empty-state { font-size: 13.5px; }

/* Compact table-embedded controls */
td input, td select { min-height: 30px; padding: 4px 8px; font-size: 12px; }
td form { margin: 0; }

/* ── Badges / status pills ──────────────────────────────────────── */
.status-badge, .badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 20px;
    background: #F3F4F6;
    color: var(--muted);
    font-size: 10px;
    font-weight: 700;
    line-height: 1.7;
    white-space: nowrap;
}

.badge-new, .badge-assigned { background: #DBEAFE; color: #1D4ED8; }
.badge-processing { background: #FEF9C3; color: #92400E; }
.badge-confirmed, .badge-active, .badge-success { background: #DCFCE7; color: #15803D; }
.badge-cancelled, .badge-danger { background: #FEE2E2; color: #B91C1C; }
.badge-completed, .badge-inactive, .badge-admin { background: #F3F4F6; color: #6B7280; }
.badge-superadmin { background: #DBEAFE; color: #1D4ED8; }

/* ── Notices ────────────────────────────────────────────────────── */
.notice, .alert {
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    margin-bottom: 14px;
    background: var(--green-tint);
    color: #15803D;
    border: 1px solid #BBF7D0;
    font-size: 12.5px;
}

.notice-error { background: var(--red-tint); color: #B91C1C; border-color: #FECDD3; }

.empty-state {
    padding: 28px 20px;
    text-align: center;
    color: var(--muted);
    background: #FAFBFC;
    border: 1px dashed #D5DAE1;
    border-radius: var(--radius);
    font-size: 12.5px;
}

.compact-dl {
    max-width: 360px;
    max-height: 260px;
    overflow: auto;
    margin: 8px 0 0;
    padding: 8px;
    background: #F8FAFC;
    border-radius: var(--radius-sm);
}

.compact-dl dt {
    font-weight: 700;
    color: var(--ink);
    margin-top: 8px;
}

.compact-dl dd {
    margin: 2px 0 6px;
    color: var(--muted);
    overflow-wrap: anywhere;
}

.empty-state strong {
    display: block;
    color: var(--title);
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 4px;
}

.details-row td {
    padding-top: 0;
    background: #FBFCFD;
}

.submission-details {
    margin: 0 0 8px;
    padding: 14px 16px;
    border: 1px solid var(--divider);
    border-radius: var(--radius-sm);
    background: #FFFFFF;
}

.submission-details-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px 24px;
}

.submission-details-section {
    min-width: 0;
    width: 100%;
}

.submission-details-section h3 {
    margin: 0 0 10px;
    color: var(--title);
    font-size: 15px;
    font-weight: 700;
}

.submission-details .compact-dl {
    max-width: none;
    max-height: none;
    margin: 0;
    padding: 0;
    background: transparent;
    border-radius: 0;
}

.survey-field {
    margin: 0 0 14px;
}

.submission-details .compact-dl dt {
    margin: 0 0 4px;
    color: var(--ink);
    font-size: 14px;
    font-weight: 700;
}

.submission-details .compact-dl dd {
    margin: 0 0 10px;
    color: var(--body);
    font-size: 15px;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.survey-field-important dt {
    color: #0F172A;
}

.survey-field-important dd {
    color: var(--title);
    font-weight: 800;
}

.survey-toggle-btn {
    background: var(--blue);
    border-color: var(--blue);
    color: #FFFFFF;
    box-shadow: 0 6px 16px rgba(42, 96, 157, 0.18);
}

.survey-toggle-btn:hover {
    background: #1F4E86;
    border-color: #1F4E86;
    color: #FFFFFF;
}

.survey-toggle-btn-active {
    background: #0F172A;
    border-color: #0F172A;
    color: #FFFFFF;
}

@media (max-width: 900px) {
    .submission-details-grid {
        grid-template-columns: 1fr;
    }
}

/* ── Auth ───────────────────────────────────────────────────────── */
.auth-shell {
    min-height: 100dvh;
    display: grid;
    place-items: center;
    padding: 24px;
    background: var(--page-bg);
}

.auth-card { width: min(100%, 400px); padding: 28px; }

/* ── Conversations ──────────────────────────────────────────────── */
.message-list { display: grid; gap: 10px; }

.message {
    max-width: 680px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    background: #F4F6F9;
    border: 1px solid var(--divider);
    font-size: 12.5px;
}

.message-out { margin-left: auto; background: var(--green-tint); border-color: #BBF7D0; }

.message-meta { margin-bottom: 3px; color: var(--faint); font-size: 11px; }

.pagination { justify-content: center; margin-top: 14px; }

/* ── Slot chips (Настройки) ─────────────────────────────────────── */
.slot-chip-list { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }

.slot-chip {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 3px 3px 3px 8px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: #FAFBFC;
}

.slot-chip input[type="time"] {
    min-height: 24px;
    width: 96px;
    padding: 1px 4px;
    border: 0;
    background: transparent;
    font-size: 12px;
}

.slot-chip input[type="time"]:focus { box-shadow: none; }

.slot-chip-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--faint);
    cursor: pointer;
    font-size: 15px;
    line-height: 1;
}

.slot-chip-remove:hover { background: var(--red-tint); color: var(--red); }

/* ── Images ─────────────────────────────────────────────────────── */
.thumb {
    display: block;
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--divider);
}

.thumb-sm { width: 38px; height: 38px; }

/* ── Calendar ───────────────────────────────────────────────────── */
.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    border-left: 1px solid var(--divider);
}

.cal-headcell {
    padding: 7px 10px;
    background: #FAFAFA;
    color: var(--faint);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-right: 1px solid var(--divider);
    border-top: 1px solid var(--divider);
}

.cal-headcell.cal-weekend { color: var(--red); }

.cal-cell {
    min-height: 96px;
    padding: 6px;
    border-right: 1px solid var(--divider);
    border-bottom: 1px solid var(--divider);
    display: flex;
    flex-direction: column;
    gap: 3px;
    overflow: hidden;
}

.cal-other { background: #FAFBFC; opacity: 0.5; }

.cal-today { background: #EFF6FF; box-shadow: inset 0 0 0 2px var(--blue); }

.cal-daynum { font-size: 12px; font-weight: 600; color: var(--title); }

.cal-chip {
    display: block;
    padding: 2px 6px;
    border-radius: 4px;
    background: #DBEAFE;
    color: #1D4ED8;
    font-size: 11px;
    font-weight: 500;
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cal-chip-confirmed { background: #DCFCE7; color: #15803D; }
.cal-chip-cancelled { background: #FEE2E2; color: #B91C1C; text-decoration: line-through; }
.cal-chip-completed { background: #F3F4F6; color: #6B7280; }

.cal-more { font-size: 11px; color: var(--faint); }

.clickable-row {
    cursor: pointer;
}

.cell-link {
    display: block;
    min-height: 100%;
    color: inherit;
    text-decoration: none;
}

.cell-link:visited {
    color: inherit;
}

.clickable-row:hover .cell-link {
    color: var(--blue);
}

.row-highlight td {
    background: var(--blue-tint);
    box-shadow: inset 0 1px 0 rgba(59, 130, 246, 0.18), inset 0 -1px 0 rgba(59, 130, 246, 0.18);
}

.switch-line {
    display: inline-flex;
    min-height: 38px;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 600;
}

/* ── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 980px) {
    .sidebar {
        position: static;
        width: auto;
        min-height: 0;
        flex-direction: column;
        padding: 12px;
    }

    .nav-section {
        display: flex;
        width: 100%;
        max-width: 100%;
        overflow-x: auto;
        padding-bottom: 4px;
        -webkit-overflow-scrolling: touch;
    }

    .nav-section a { white-space: nowrap; }

    .nav-label { display: none; }

    .account-panel { margin-top: 8px; }

    .main { margin-left: 0; padding: 16px; overflow-x: hidden; }

    .content-grid { grid-template-columns: 1fr; }

    .cal-cell { min-height: 68px; }
    .cal-chip { font-size: 10px; }
}

@media (max-width: 680px) {
    .page-header { display: grid; }
    .form-grid { grid-template-columns: 1fr; }
    th, td { padding: 8px; }
}
