/* Панель управления ООО «Велий» — без внешних CSS/шрифтов */
:root {
    --panel-bg: #f4f6f8;
    --panel-card: #fff;
    --panel-text: #18212b;
    --panel-muted: #687482;
    --panel-line: #e4e9ee;
    --panel-accent: #4f667a;
    --panel-accent-dark: #354b5f;
    --panel-soft: #edf2f6;
    --panel-danger: #a12a27;
    --panel-success: #23643f;
    --panel-radius: 14px;
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; color: var(--panel-text); background: var(--panel-bg); font-size: 15px; line-height: 1.5; }
a { color: var(--panel-accent-dark); }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }

/* Sign in / first setup */
.control-auth-page { min-height: 100vh; padding: 28px 16px; display: grid; place-items: center; background: radial-gradient(circle at 15% 10%, #e8edf2 0, #f4f6f8 42%, #eef2f5 100%); }
.auth-card { width: min(100%, 460px); background: #fff; border: 1px solid var(--panel-line); border-radius: 18px; padding: 38px; box-shadow: 0 18px 60px rgba(28,42,56,.09); }
.auth-brand { display: inline-flex; align-items: center; gap: 10px; color: var(--panel-text); text-decoration: none; font-weight: 750; font-size: 18px; margin-bottom: 28px; }
.auth-brand::before { content: "В"; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: var(--panel-accent); color: #fff; font-size: 20px; }
.auth-card h1 { font-size: 28px; letter-spacing: -.5px; margin: 0 0 8px; }
.auth-lead, .auth-footnote { color: var(--panel-muted); font-size: 14px; margin: 0 0 22px; }
.auth-footnote { margin: 20px 0 0; text-align: center; }
.auth-footnote a { text-decoration: none; }
.auth-form { display: grid; gap: 17px; margin-top: 24px; }
.auth-form label, .field { display: grid; gap: 7px; color: #394655; font-size: 13px; font-weight: 650; }
.auth-form input, .field input, .field textarea, .field select, .filter-bar input, .filter-bar select { width: 100%; color: var(--panel-text); background: #fff; border: 1px solid #d8e0e7; border-radius: 9px; padding: 11px 12px; outline: none; min-height: 44px; }
.auth-form input:focus, .field input:focus, .field textarea:focus, .field select:focus, .filter-bar input:focus, .filter-bar select:focus { border-color: #8196a8; box-shadow: 0 0 0 3px rgba(79,102,122,.12); }
.field textarea { resize: vertical; min-height: 76px; }

/* Main shell */
.control-shell { min-height: 100vh; display: flex; }
.sidebar { width: 248px; flex: 0 0 248px; min-height: 100vh; padding: 24px 16px 20px; background: #172432; color: #f7f9fb; display: flex; flex-direction: column; }
.sidebar-brand { display: flex; align-items: center; gap: 11px; margin: 0 8px 34px; color: #fff; text-decoration: none; font-size: 15px; font-weight: 750; }
.sidebar-brand small { display: block; color: #a9bac9; font-size: 11px; font-weight: 500; margin-top: 1px; }
.brand-mark { display: grid; place-items: center; flex: 0 0 42px; width: 42px; height: 42px; border-radius: 13px; background: #72869a; color: #fff; font-size: 22px; }
.side-nav { display: grid; gap: 5px; }
.side-nav__link { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 9px 12px; border-radius: 9px; color: #c5d0da; text-decoration: none; font-size: 14px; transition: background .15s, color .15s; }
.side-nav__link:hover { color: #fff; background: rgba(255,255,255,.08); }
.side-nav__link.is-active { background: #354b5f; color: #fff; font-weight: 650; }
.side-nav__icon { display: inline-flex; align-items: center; justify-content: center; width: 23px; font-size: 18px; opacity: .9; }
.side-site-link { color: #b7c7d5; margin: auto 10px 0; padding-top: 24px; text-decoration: none; font-size: 13px; }
.control-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { min-height: 91px; padding: 18px clamp(20px, 4vw, 54px); display: flex; justify-content: space-between; align-items: center; gap: 16px; background: rgba(255,255,255,.92); border-bottom: 1px solid var(--panel-line); }
.topbar .eyebrow { margin: 0 0 2px; text-transform: uppercase; letter-spacing: .11em; color: var(--panel-muted); font-size: 10px; font-weight: 750; }
.topbar h1 { margin: 0; font-size: 22px; line-height: 1.2; letter-spacing: -.3px; }
.topbar__user { display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 700; }
.topbar__user small { display: block; color: var(--panel-muted); font-size: 11px; font-weight: 500; }
.user-avatar { flex: 0 0 36px; width: 36px; height: 36px; border-radius: 50%; background: #e5ebf0; color: #455d71; display: inline-grid; place-items: center; font-weight: 750; }
.logout-form { margin-left: 8px; }
.page-content { width: 100%; max-width: 1450px; margin: 0 auto; padding: 30px clamp(18px, 4vw, 54px) 40px; flex: 1; }
.panel-footer { color: #88939e; font-size: 11px; padding: 0 clamp(20px, 4vw, 54px) 20px; }
.page-intro, .welcome-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin: 0 0 20px; }
.page-intro h2, .welcome-row h2 { margin: 0 0 4px; font-size: 20px; }
.page-intro p, .welcome-row p { margin: 0; color: var(--panel-muted); font-size: 13px; }

/* Buttons / notices */
.button { border: 1px solid transparent; border-radius: 9px; min-height: 40px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 9px 14px; font-size: 13px; font-weight: 700; text-decoration: none; white-space: nowrap; transition: background .15s, border-color .15s, transform .15s; }
.button:hover { transform: translateY(-1px); }
.button--primary { color: #fff; background: var(--panel-accent); }
.button--primary:hover { background: var(--panel-accent-dark); }
.button--secondary { color: #33475a; background: #fff; border-color: #d8e0e7; }
.button--secondary:hover, .button--ghost:hover { background: #f1f4f6; }
.button--ghost { min-height: 34px; padding: 6px 10px; color: #465767; background: transparent; border-color: #dce3e9; font-size: 12px; }
.button--full { width: 100%; min-height: 46px; }
.button--small { min-height: 31px; padding: 6px 9px; font-size: 11px; }
.button--remove { align-self: end; min-height: 39px; background: #fff; color: var(--panel-danger); border-color: #f0cecc; }
.button--danger { color: #a12a27; background: #fff5f4; border-color: #efcfcd; }
.button--danger:hover { background: #fde7e5; }
.button:disabled { opacity: .55; cursor: wait; transform: none; }
.notice { padding: 13px 16px; border-radius: 10px; margin: 0 0 18px; font-size: 13px; border: 1px solid #d8e0e7; background: #fff; color: #475665; }
.notice--error { color: #8b2523; border-color: #efcfcd; background: #fff4f3; }
.notice--success { color: #21633c; border-color: #cce6d5; background: #f2faf5; }
.notice--info { color: #405a70; border-color: #d4e2ee; background: #edf5fb; }

/* Cards and tables */
.panel-card { padding: 22px; margin: 0 0 18px; border: 1px solid var(--panel-line); border-radius: var(--panel-radius); background: var(--panel-card); box-shadow: 0 3px 15px rgba(20,38,55,.025); }
.card-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; margin-bottom: 17px; }
.card-heading h2 { margin: 0 0 3px; font-size: 16px; }
.card-heading p { margin: 0; color: var(--panel-muted); font-size: 12px; }
.text-link { color: #405a70; text-decoration: none; font-size: 12px; font-weight: 700; }
.text-link:hover { text-decoration: underline; }
.table-wrap { overflow-x: auto; }
.data-table { border-collapse: collapse; width: 100%; font-size: 12px; }
.data-table th { color: #75808b; font-size: 10px; letter-spacing: .06em; text-transform: uppercase; font-weight: 750; text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--panel-line); white-space: nowrap; }
.data-table td { padding: 13px 12px; border-bottom: 1px solid #edf0f3; vertical-align: top; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table td strong { display: block; color: #26323e; font-size: 12px; }
.data-table td a { color: #405a70; text-decoration: none; }
.data-table td a:hover { text-decoration: underline; }
.table-secondary { display: block; margin-top: 3px; max-width: 350px; color: var(--panel-muted); font-size: 11px; }
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 13px; margin-bottom: 18px; }
.stat-card { min-height: 132px; padding: 18px; border-radius: 13px; border: 1px solid var(--panel-line); background: #fff; display: flex; flex-direction: column; align-items: flex-start; }
.stat-card strong { margin: 6px 0 2px; font-size: 30px; line-height: 1.05; letter-spacing: -.8px; }
.stat-label { color: var(--panel-muted); font-size: 11px; font-weight: 700; }
.stat-card a { margin-top: auto; color: #536b7f; font-size: 11px; font-weight: 700; text-decoration: none; }
.stat-card--soft { background: #eaf0f4; }
.stat-foot { margin-top: auto; color: #647584; font-size: 10px; }
.quick-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 13px; }
.quick-card { min-height: 106px; display: grid; align-content: center; gap: 4px; padding: 17px; border: 1px solid var(--panel-line); border-radius: 12px; background: #fff; text-decoration: none; }
.quick-card > span { color: #647b8e; font-size: 18px; }
.quick-card strong { color: #24313d; font-size: 13px; }
.quick-card small { color: var(--panel-muted); font-size: 11px; }
.empty-state { text-align: center; padding: 36px 20px; color: var(--panel-muted); }
.empty-state h3 { color: var(--panel-text); margin: 8px 0 5px; font-size: 15px; }
.empty-state p { margin: 0; font-size: 12px; }
.empty-icon { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: #eff3f6; color: #60768a; font-size: 20px; }
.status-pill { display: inline-flex; padding: 4px 8px; border-radius: 99px; font-size: 10px; font-weight: 750; white-space: nowrap; }
.status-pill--new { color: #785600; background: #fff3cd; }
.status-pill--in_progress { color: #31577a; background: #e2effa; }
.status-pill--closed { color: #286142; background: #e2f3e9; }

/* Site editor */
.editor-card { padding: 22px; }
.form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 15px; }
.field--wide { grid-column: 1 / -1; }
.field-help { margin: 12px 0 0; color: var(--panel-muted); font-size: 11px; }
.content-form { padding-bottom: 64px; }
.repeater { display: grid; gap: 10px; margin-top: 16px; }
.repeater-row { display: grid; grid-template-columns: minmax(180px,.75fr) minmax(250px,1.5fr) auto; gap: 12px; align-items: end; padding: 13px; border: 1px solid #edf0f3; border-radius: 10px; background: #fafbfc; }
.repeater-row--media { grid-template-columns: minmax(170px,.8fr) minmax(220px,1.2fr) auto; }
.add-row { margin-top: 12px; }
.sticky-save { position: sticky; z-index: 5; bottom: 12px; margin: 18px 0 0; padding: 12px 14px; border: 1px solid #d9e1e8; border-radius: 12px; background: rgba(255,255,255,.96); box-shadow: 0 8px 28px rgba(20,38,55,.1); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sticky-save span { color: var(--panel-muted); font-size: 12px; }

/* Requests */
.filter-bar { display: flex; align-items: center; gap: 9px; padding: 12px; margin-bottom: 15px; background: #fff; border: 1px solid var(--panel-line); border-radius: 12px; }
.filter-bar .search-field { flex: 1; min-width: 180px; }
.filter-bar input, .filter-bar select { min-height: 39px; padding: 8px 10px; font-size: 12px; }
.filter-bar select { width: 160px; }
.inquiry-list { display: grid; gap: 13px; }
.inquiry-card { padding: 19px; }
.inquiry-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.inquiry-heading h3 { margin: 9px 0 1px; font-size: 15px; }
.inquiry-heading p { margin: 0; color: var(--panel-muted); font-size: 11px; }
.inquiry-contact { margin: 13px 0 8px; font-size: 12px; }
.inquiry-contact a { color: #405a70; text-decoration: none; }
.inquiry-message { padding: 12px; border-radius: 8px; background: #f6f8f9; color: #394653; font-size: 12px; white-space: normal; overflow-wrap: anywhere; }
.inquiry-update { display: grid; grid-template-columns: 170px 200px minmax(200px,1fr) auto; gap: 10px; align-items: end; margin-top: 14px; }
.inquiry-update .field input, .inquiry-update .field textarea, .inquiry-update .field select { min-height: 39px; padding: 8px 9px; font-size: 12px; }
.inquiry-update .field--wide { grid-column: auto; }
.delete-inquiry-form { display: flex; justify-content: flex-end; margin-top: 9px; }

/* Media */
.upload-card { display: flex; align-items: center; gap: 15px; flex-wrap: wrap; }
.upload-icon { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px; background: #edf2f6; color: #506a80; font-size: 22px; }
.upload-card h3 { margin: 0 0 3px; font-size: 14px; }
.upload-card p { margin: 0; color: var(--panel-muted); font-size: 11px; }
.upload-form { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.file-picker { position: relative; overflow: hidden; cursor: pointer; }
.file-picker input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(180px,1fr)); gap: 13px; }
.media-item { min-width: 0; overflow: hidden; border: 1px solid var(--panel-line); border-radius: 10px; background: #fff; }
.media-item > img { width: 100%; height: 145px; object-fit: contain; background: #f4f6f8; }
.media-item__body { padding: 10px; display: grid; gap: 8px; }
.media-item__body code { display: block; overflow-wrap: anywhere; color: #5b6671; font-size: 10px; }

/* Users / backups / activity */
.profile-card { max-width: 760px; }
.profile-details { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; margin: 0; }
.profile-details div { padding: 12px; border-radius: 9px; background: #f6f8f9; }
.profile-details dt { color: var(--panel-muted); font-size: 11px; }
.profile-details dd { margin: 3px 0 0; font-size: 13px; font-weight: 700; }
.password-form { display: grid; gap: 14px; max-width: 420px; }
.password-form .button { justify-self: start; }
.user-create-form { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)) auto; gap: 10px; align-items: end; }
.user-list { display: grid; }
.user-row { display: grid; grid-template-columns: minmax(180px,1.3fr) 150px 90px minmax(170px,1fr) auto; align-items: end; gap: 12px; padding: 13px 0; border-top: 1px solid #edf0f3; }
.user-row__identity { display: flex; align-items: center; gap: 9px; padding-bottom: 7px; }
.user-row__identity strong { display: block; font-size: 12px; }
.user-row__identity small { display: block; color: var(--panel-muted); font-size: 10px; }
.check-field { display: flex; align-items: center; gap: 7px; min-height: 43px; color: #44515e; font-size: 12px; }
.check-field input { accent-color: var(--panel-accent); }
.version-list { display: grid; }
.version-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 0; border-top: 1px solid #edf0f3; }
.version-row strong, .version-row small { display: block; }
.version-row strong { font-size: 12px; }
.version-row small { color: var(--panel-muted); font-size: 10px; }
.count-badge { color: #4d657a; background: #eaf0f4; border-radius: 99px; padding: 4px 9px; font-size: 11px; font-weight: 750; }

@media (max-width: 1100px) {
    .sidebar { width: 220px; flex-basis: 220px; }
    .inquiry-update { grid-template-columns: 1fr 1fr; }
    .inquiry-update .field--wide { grid-column: 1/-1; }
    .user-create-form { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .user-row { grid-template-columns: minmax(160px,1fr) 140px 80px; }
    .user-row .field:nth-of-type(3) { grid-column: 1 / 3; }
}
@media (max-width: 800px) {
    .control-shell { display: block; }
    .sidebar { width: 100%; min-height: 0; padding: 12px 14px; }
    .sidebar-brand { margin: 0 4px 12px; }
    .side-nav { display: flex; overflow-x: auto; gap: 5px; padding-bottom: 2px; }
    .side-nav__link { flex: 0 0 auto; min-height: 38px; padding: 7px 10px; font-size: 12px; }
    .side-nav__icon { display: none; }
    .side-site-link { display: none; }
    .topbar { min-height: 72px; padding: 13px 18px; }
    .topbar h1 { font-size: 18px; }
    .page-content { padding: 21px 14px 30px; }
    .panel-footer { padding: 0 14px 16px; }
    .stats-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .quick-grid { grid-template-columns: 1fr; }
    .repeater-row, .repeater-row--media { grid-template-columns: 1fr; }
    .repeater-row .button--remove { justify-self: start; }
    .user-row { grid-template-columns: 1fr 1fr; align-items: end; }
    .user-row__identity { grid-column: 1/-1; }
    .user-row .field:nth-of-type(3) { grid-column: auto; }
    .user-row .button { grid-column: 1/-1; justify-self: start; }
    .upload-form { width: 100%; margin-left: 0; }
}
@media (max-width: 560px) {
    .auth-card { padding: 27px 21px; }
    .topbar__user { gap: 6px; }
    .topbar__user > span:not(.user-avatar) { display: none; }
    .logout-form { margin-left: 0; }
    .topbar .eyebrow { display: none; }
    .page-intro, .welcome-row { align-items: flex-start; flex-direction: column; }
    .page-intro .button, .welcome-row .button { align-self: flex-start; }
    .form-grid { grid-template-columns: 1fr; }
    .profile-details { grid-template-columns: 1fr; }
    .field--wide { grid-column: auto; }
    .filter-bar { align-items: stretch; flex-wrap: wrap; }
    .filter-bar .search-field { flex-basis: 100%; }
    .filter-bar select { flex: 1; width: auto; }
    .inquiry-heading { flex-direction: column; }
    .inquiry-update { grid-template-columns: 1fr; }
    .inquiry-update .field--wide { grid-column: auto; }
    .user-create-form { grid-template-columns: 1fr; }
    .user-row { grid-template-columns: 1fr; }
    .user-row .field:nth-of-type(3) { grid-column: auto; }
    .user-row .button { grid-column: auto; }
    .sticky-save { align-items: stretch; flex-direction: column; }
    .sticky-save .button { width: 100%; }
    .upload-form { flex-direction: column; align-items: stretch; }
    .upload-form .button { width: 100%; }
}
