/* TicketManager — визуальная система Martynov Labs (как в ML Console): плавающие карточки,
   боковое меню, светлая и тёмная тема. Шрифт Onest встроен в приложение (OFL), внешних запросов нет. */

@font-face {
  font-family: "Onest"; font-style: normal; font-weight: 400 800; font-display: swap;
  src: url("fonts/onest-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Onest"; font-style: normal; font-weight: 400 800; font-display: swap;
  src: url("fonts/onest-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --coral: #3B5BDB; --coral-hi: #5570E6; --coral-bg: rgba(59, 91, 219, .10);
  --bg: #EAEDF5; --bg-2: #F6F8FC;
  --card: #FFFFFF; --card-2: #F4F6FB; --elev: #EEF1F6;
  --line: #E7EAF0; --line-2: #EFF1F6; --line-strong: #D6DBE6;
  --t1: #1B2236; --t2: #5E6675; --t3: #9AA1B4;
  --success: #1FA971; --warning: #C47F1A; --danger: #D8604F; --info: #3B5BDB;
  --success-bg: rgba(31, 169, 113, .12); --warning-bg: rgba(217, 145, 42, .15);
  --danger-bg: rgba(216, 96, 79, .12); --info-bg: rgba(59, 91, 219, .10);
  --shadow: 0 1px 2px rgba(38, 50, 90, .05), 0 12px 30px -18px rgba(38, 50, 90, .2);
  --sans: "Onest", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}
html.dark {
  --coral: #5B7BF0; --coral-hi: #6E8BF5; --coral-bg: rgba(91, 123, 240, .18);
  --bg: #0D1017; --bg-2: #161B24;
  --card: #171D27; --card-2: #1E2530; --elev: #252D3A;
  --line: #28303C; --line-2: #222A35; --line-strong: #39434F;
  --t1: #E9ECF2; --t2: #A3ABBA; --t3: #6E7686;
  --success: #34C98A; --warning: #E0A53A; --danger: #EC7666; --info: #7E98F7;
  --success-bg: rgba(52, 201, 138, .16); --warning-bg: rgba(224, 165, 58, .18);
  --danger-bg: rgba(236, 118, 102, .16); --info-bg: rgba(91, 123, 240, .18);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 12px 30px -18px rgba(0, 0, 0, .6);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--t1); font: 14.5px/1.55 var(--sans); -webkit-font-smoothing: antialiased; }
input, button, select, textarea { font-family: inherit; color: inherit; }
a { color: var(--coral); text-decoration: none; }
a:hover { text-decoration: underline; }
::selection { background: var(--coral); color: #fff; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; color: var(--t1); }
h1 { font-size: 26px; font-weight: 700; letter-spacing: -.025em; }
h2 { font-size: 18px; font-weight: 600; letter-spacing: -.01em; margin-top: 1.4em; }
h3 { font-size: 15px; font-weight: 600; }
p { margin: 0 0 .75em; }
small, .muted { color: var(--t2); }
tr.muted td, th.muted { color: var(--t3); }
.nowrap { white-space: nowrap; }
.pre { white-space: pre-line; }
hr { border: 0; border-top: 1px solid var(--line); margin: 1.5rem 0; }
.ico { width: 18px; height: 18px; flex: none; }
@keyframes fadeup { from { transform: translateY(6px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ===== Оболочка: боковое меню, верхняя панель, контент ===== */
.app { display: flex; gap: 14px; padding: 14px; min-height: 100vh; align-items: flex-start; }
.sidebar {
  position: sticky; top: 14px; width: 236px; flex: none; height: calc(100vh - 28px);
  background: var(--card); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; padding: 18px 14px; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 6px 8px 20px; color: var(--t1); }
.brand:hover { text-decoration: none; }
.brand-logo {
  width: 38px; height: 38px; flex: none; border-radius: 11px; background: var(--coral); color: #fff;
  display: grid; place-items: center; font-weight: 800; font-size: 14px; letter-spacing: -.5px;
  box-shadow: 0 6px 14px -5px rgba(59, 91, 219, .6);
}
.brand-name { font-weight: 600; font-size: 15px; letter-spacing: -.01em; }
.nav-label { font-size: 10.5px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--t3); padding: 14px 10px 8px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 9px 11px; border-radius: 9px; color: var(--t2); font-size: 13.5px; font-weight: 500; }
.nav a:hover { background: var(--card-2); color: var(--t1); text-decoration: none; }
.nav a.active { background: var(--coral-bg); color: var(--coral); font-weight: 600; }
.side-foot { margin-top: auto; padding-top: 14px; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 10px 8px; border-top: 1px solid var(--line); }
.user-ava {
  width: 32px; height: 32px; flex: none; border-radius: 50%; background: var(--card-2); border: 1px solid var(--line-strong);
  display: grid; place-items: center; font-size: 13px; font-weight: 600; color: var(--coral);
}
.user-ava:hover { text-decoration: none; border-color: var(--coral); }
.user-meta { min-width: 0; line-height: 1.25; }
.user-name { display: block; font-size: 12.5px; font-weight: 500; color: var(--t1); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-meta form { margin: 0; }
.user-sub { background: none; border: 0; padding: 0; cursor: pointer; font-size: 11px; color: var(--t3); }
.user-sub:hover { color: var(--danger); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.topbar {
  min-height: 62px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow);
  display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px 10px 22px;
}
.crumb { font-size: 11px; color: var(--t3); font-weight: 500; letter-spacing: .02em; }
.page-title { font-weight: 600; font-size: 18px; letter-spacing: -.01em; line-height: 1.2; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.tb-search { position: relative; flex: 1; max-width: 460px; }
.tb-search .ico { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--t3); width: 16px; height: 16px; }
.tb-search input[type=search] { padding-left: 36px; background: var(--bg-2); border-color: var(--line); }
/* Контент лежит прямо на фоне, а каждая карточка «плавает» отдельно — как в ML Console. */
.content { flex: 1; min-width: 0; padding: 12px 8px 0; animation: fadeup .25s ease; }
.container { max-width: none; }
.container.narrow { max-width: 600px; }
.container.medium { max-width: 920px; }

/* Страницы без меню: вход, регистрация, билет по ссылке — колонка по центру, логотип над карточкой */
.solo { min-height: 100vh; display: flex; flex-direction: column; align-items: center; padding: 56px 16px 0; }
.solo-tools { position: absolute; top: 16px; right: 16px; display: flex; gap: 8px; align-items: center; }
.solo-tools form { margin: 0; }
.solo-brand { display: flex; align-items: center; gap: 13px; margin-bottom: 22px; color: var(--t1); }
.solo-brand:hover { text-decoration: none; }
.solo-brand .brand-logo { width: 46px; height: 46px; border-radius: 13px; font-size: 16px; }
.sb-title { display: block; font-size: 19px; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; }
.sb-sub { display: block; font-size: 12.5px; color: var(--t3); }
.solo > .container { width: 100%; max-width: 920px; animation: fadeup .25s ease; }
.solo > .container.narrow { max-width: 460px; }
.solo > .container.medium { max-width: 760px; }
.solo .card { padding: 26px 28px; border-radius: 18px; }
.solo .card h1 { font-size: 24px; }
.solo .demo-bar { width: 100%; max-width: 760px; margin-bottom: 18px; }

.footer { color: var(--t3); font-size: 12px; padding: 26px 4px 22px; line-height: 1.6; }
.solo .footer { max-width: 620px; text-align: center; margin-top: auto; }
.footer a { color: var(--t3); text-decoration: underline; }

/* Тема */
.theme-toggle { display: flex; align-items: center; gap: 2px; background: var(--bg-2); border-radius: 9px; padding: 3px; }
.theme-toggle button {
  display: grid; place-items: center; width: 30px; height: 28px; border: 0; background: transparent; color: var(--t3);
  border-radius: 7px; cursor: pointer;
}
.theme-toggle button .ico { width: 15px; height: 15px; }
.theme-toggle button.active { background: var(--card); color: var(--coral); box-shadow: 0 1px 2px rgba(38, 50, 90, .14); }

/* Выпадающее меню «Добавить» */
.dd { position: relative; }
.dd > summary { list-style: none; }
.dd > summary::-webkit-details-marker { display: none; }
.dd-menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 30; min-width: 250px; padding: 6px;
  background: var(--card); border: 1px solid var(--line-strong); border-radius: 12px; box-shadow: 0 16px 40px -12px rgba(21, 30, 60, .35);
}
.dd-menu a { display: block; padding: 9px 11px; border-radius: 8px; color: var(--t1); }
.dd-menu a:hover { background: var(--card-2); text-decoration: none; }
.dd-menu b { display: block; font-size: 13.5px; font-weight: 600; }
.dd-menu span { display: block; font-size: 11.5px; color: var(--t3); }

/* ===== Заголовки страниц и разделов ===== */
.page-head { display: flex; gap: 1rem; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { margin: 0; }
.page-head .actions, .actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 6px 0 12px; }
.section-head h2 { margin: 0; }
.breadcrumbs { font-size: 12.5px; color: var(--t3); margin-bottom: 8px; }
.breadcrumbs a { color: var(--t2); font-weight: 500; }
.grid { display: grid; gap: 14px; margin: 14px 0; }
.grid > .card + .card { margin-top: 0; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

/* Вкладки-сегменты (настройки, переключатель мероприятий) */
.seg { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--line-strong); border-radius: 10px; overflow: hidden; background: var(--card-2); margin-bottom: 18px; }
.seg a, .seg button {
  border: 0; background: transparent; color: var(--t2); font-size: 13px; font-weight: 500; padding: 8px 14px;
  border-right: 1px solid var(--line); white-space: nowrap; cursor: pointer;
}
.seg a:last-child, .seg button:last-child { border-right: 0; }
.seg a:hover { color: var(--t1); text-decoration: none; }
.seg a.active, .seg button.active { background: var(--coral-bg); color: var(--coral); font-weight: 600; }

/* ===== Карточки ===== */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 20px 22px; box-shadow: var(--shadow); }
.card .card { box-shadow: none; }
.card > h2:first-child, .card > h3:first-child, .card > h1:first-child { margin-top: 0; }
.card + .card, .card + details.card, details.card + .card { margin-top: 14px; }
.card-head { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; }
.card-title { font-size: 17px; font-weight: 600; margin: 0 0 2px; }
.card-sub { color: var(--t2); font-size: 13.5px; }
details.card > summary { cursor: pointer; font-weight: 600; }
details > summary { cursor: pointer; font-weight: 600; }
details[open] > summary { margin-bottom: 12px; }

.ticket-card { border-left: 4px solid var(--coral); }
.ticket-card.state-issued { border-left-color: var(--success); }
.ticket-card.state-reserved { border-left-color: var(--info); }
.ticket-card.state-pending { border-left-color: var(--warning); }
.when { font-size: 16px; font-weight: 600; }
.where { margin-top: 8px; }
.program { margin-top: 8px; font-size: 13.5px; color: var(--t2); white-space: pre-line; }
.ticket-list { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 8px; }
.ticket-list li {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  background: var(--card-2); border: 1px solid var(--line); border-radius: 11px; padding: 9px 11px;
}
.ticket-list .ticket-name { font-weight: 600; margin-right: auto; }

/* Цифры */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 14px 0; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; box-shadow: var(--shadow); }
.stat-value { font-size: 26px; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; }
.stat-label { font-size: 12px; color: var(--t2); margin-top: 3px; }

/* Бейджи и точки */
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 20px; white-space: nowrap;
  font-size: 11.5px; font-weight: 600; background: var(--card-2); color: var(--t2); border: 1px solid var(--line);
}
.badge-ok { background: var(--success-bg); color: var(--success); border-color: transparent; }
.badge-info { background: var(--info-bg); color: var(--info); border-color: transparent; }
.badge-warn { background: var(--warning-bg); color: var(--warning); border-color: transparent; }
.badge-danger { background: var(--danger-bg); color: var(--danger); border-color: transparent; }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--t3); vertical-align: middle; margin-left: 4px; }
.dot-warn { background: var(--warning); box-shadow: 0 0 0 3px var(--warning-bg); }
.dot-info { background: var(--info); box-shadow: 0 0 0 3px var(--info-bg); }

/* ===== Кнопки ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 8px 14px; border-radius: 9px;
  border: 1px solid var(--line-strong); background: var(--card-2); color: var(--t1); font: inherit; font-size: 13px;
  font-weight: 500; line-height: 1.25; cursor: pointer; white-space: nowrap; transition: border-color .12s, background .12s, color .12s;
}
.btn:hover { border-color: var(--coral); color: var(--coral); text-decoration: none; }
.btn .ico { width: 15px; height: 15px; }
.btn-primary { background: var(--coral); border-color: var(--coral); color: #fff; font-weight: 600;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 2px 8px rgba(59, 91, 219, .28); }
.btn-primary:hover { background: var(--coral-hi); border-color: var(--coral-hi); color: #fff; }
.btn-ok { background: var(--success); border-color: var(--success); color: #fff; font-weight: 600; }
.btn-ok:hover { filter: brightness(1.07); color: #fff; border-color: var(--success); }
.btn-danger { color: var(--danger); border-color: var(--danger); background: var(--card); }
.btn-danger:hover { background: var(--danger-bg); color: var(--danger); border-color: var(--danger); }
.btn-link { border: 0; background: none; color: var(--coral); padding: 0; font-weight: 500; box-shadow: none; }
.btn-link:hover { text-decoration: underline; }
.btn-sm { padding: 5px 10px; font-size: 12.5px; border-radius: 8px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
form.inline { display: inline; margin: 0; }

/* ===== Формы ===== */
.field { margin-bottom: 16px; }
.field label, .field .label { display: block; font-size: 12.5px; color: var(--t2); font-weight: 500; margin-bottom: 6px; }
.field .help, .hint { font-size: 11.5px; color: var(--t3); margin-top: 6px; line-height: 1.5; }
.field .errors { color: var(--danger); font-size: 12.5px; margin: 6px 0 0; padding: 0; list-style: none; }
.field.checkbox label { display: flex; gap: 9px; align-items: flex-start; font-size: 13.5px; color: var(--t1); }
.field.checkbox input { margin-top: 3px; }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--danger); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=url], input[type=tel],
input[type=date], input[type=time], input[type=datetime-local], input[type=search], select, textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--line-strong); background: var(--card-2); color: var(--t1);
  border-radius: 9px; font-size: 13.5px; outline: none; transition: border-color .12s, box-shadow .12s;
}
input:focus, select:focus, textarea:focus { border-color: var(--coral); box-shadow: 0 0 0 3px var(--coral-bg); }
input::placeholder, textarea::placeholder { color: var(--t3); }
/* select без серой системной кнопки Safari: своя стрелка */
select {
  -webkit-appearance: none; appearance: none; padding-right: 34px; cursor: pointer; line-height: 1.35;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238a94a6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center; background-size: 16px;
}
select[multiple] { background-image: none; padding-right: 12px; }
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--coral); }
input[type=file] { font-size: 13px; color: var(--t2); max-width: 100%; }
input[type=file]::file-selector-button {
  margin-right: 10px; padding: 7px 13px; border-radius: 9px; border: 1px solid var(--line-strong); background: var(--card-2);
  color: var(--t1); font: inherit; font-size: 13px; font-weight: 500; cursor: pointer;
}
input[type=file]::file-selector-button:hover { border-color: var(--coral); color: var(--coral); }
html.dark input[type=date]::-webkit-calendar-picker-indicator, html.dark input[type=time]::-webkit-calendar-picker-indicator,
html.dark input[type=datetime-local]::-webkit-calendar-picker-indicator { filter: invert(1) opacity(.6); }
textarea { resize: vertical; min-height: 80px; }
input[type=number] { -moz-appearance: textfield; appearance: textfield; }
input[type=number]::-webkit-inner-spin-button, input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type=number].qty { width: 64px; text-align: center; padding-left: 6px; padding-right: 6px; font-weight: 600; }
/* «число + ОК» в строке таблицы */
.inline-qty { display: inline-flex; gap: 6px; align-items: center; flex-wrap: nowrap; margin: 0; }
.form-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 20px; }
.form-errors { background: var(--danger-bg); color: var(--danger); padding: 11px 14px; border-radius: 10px; margin: 12px 0; font-size: 13.5px; border: 1px solid rgba(216, 96, 79, .3); }
.form-grid { display: grid; gap: 0 14px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.radio-list { list-style: none; padding: 0; margin: 0; display: flex; gap: 6px 16px; flex-wrap: wrap; }
.radio-list label { display: flex; gap: 6px; align-items: center; font-size: 13.5px; color: var(--t1); }
fieldset { border: 1px solid var(--line); border-radius: 12px; padding: 14px 18px; margin: 0 0 16px; }
legend { color: var(--coral); padding: 0 8px; font-size: 13px; font-weight: 600; }

.suggest { position: relative; }
.suggest-list {
  position: absolute; z-index: 20; left: 0; right: 0; top: 100%; margin-top: 4px; display: none;
  background: var(--card); border: 1px solid var(--line-strong); border-radius: 10px; box-shadow: 0 16px 40px -12px rgba(21, 30, 60, .35);
  max-height: 320px; overflow-y: auto; list-style: none; padding: 4px;
}
.suggest-list.open { display: block; }
.suggest-list li { padding: 8px 10px; border-radius: 7px; cursor: pointer; }
.suggest-list li:hover, .suggest-list li.active { background: var(--coral-bg); }
.suggest-list .sub { display: block; font-size: 11.5px; color: var(--t3); }
.org-details { font-size: 12px; color: var(--t3); margin-top: 4px; }

/* ===== Таблицы ===== */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; background: var(--card); box-shadow: var(--shadow); }
.card .table-wrap { box-shadow: none; border-radius: 12px; }
.sub { display: block; font-size: 12px; color: var(--t3); margin-top: 1px; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { padding: 11px 13px; text-align: left; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
th { color: var(--t3); font-weight: 600; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; background: var(--bg-2); }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: color-mix(in srgb, var(--card-2) 60%, transparent); }
td.num, th.num { text-align: right; white-space: nowrap; }
td.center, th.center { text-align: center; }
.cell-ok { color: var(--success); font-weight: 700; }
.cell-info { color: var(--info); font-weight: 700; }
.cell-warn { color: var(--warning); font-weight: 700; }
table.kv th { width: 34%; text-transform: none; letter-spacing: 0; font-size: 12.5px; color: var(--t2); background: none; vertical-align: top; }
table.kv { border: 0; }
table.kv td, table.kv th { padding: 10px 0; }
table.kv th { padding-right: 16px; }
table.kv tr:last-child th { border-bottom: 0; }
table.kv tr:hover td { background: none; }

/* ===== Таблица распределения билетов ===== */
.sheet-card { padding: 18px 18px 14px; }
.sheet-card .card-head { padding: 0 4px 12px; }
.sheet-wrap { max-height: calc(100vh - 180px); overflow: auto; }
table.sheet { font-size: 13px; border-collapse: separate; border-spacing: 0; }
.sheet th, .sheet td { padding: 6px 8px; border-bottom: 1px solid var(--line-2); border-right: 1px solid var(--line-2); }
.sheet th:last-child, .sheet td:last-child { border-right: 0; }
.sheet thead th { position: sticky; z-index: 2; background: var(--bg-2); text-transform: none; letter-spacing: 0; font-size: 12px; color: var(--t2); }
.sheet thead tr:first-child th { top: 0; }
.sheet thead tr:nth-child(2) th { top: 37px; }
.sheet .sheet-total th { font-size: 15px; font-weight: 700; color: var(--t1); height: 37px; }
.sheet .sheet-name { position: sticky; left: 0; z-index: 1; background: var(--card); min-width: 210px; max-width: 280px; }
.sheet thead .sheet-name { z-index: 3; background: var(--bg-2); }
.sheet .sheet-contact { min-width: 110px; max-width: 170px; color: var(--t2); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sheet-col a { color: var(--t1); font-weight: 600; white-space: nowrap; }
.sheet-meta { font-size: 10.5px; color: var(--t3); font-weight: 500; white-space: nowrap; }
.sheet-cell { position: relative; text-align: center; min-width: 76px; padding: 10px 6px !important; }
.sheet-cell input {
  width: 58px; padding: 4px; text-align: center; font-size: 14px; font-weight: 600; border-color: transparent;
  background: transparent; -moz-appearance: textfield; appearance: textfield;
}
.sheet-cell input::-webkit-outer-spin-button, .sheet-cell input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.sheet-cell input:hover { border-color: var(--line-strong); background: var(--card-2); }
.sheet-cell input:focus { background: var(--card); }
.sheet-cell input.changed { background: var(--warning-bg); border-color: var(--warning); }
.sheet-sum { font-weight: 700; min-width: 64px; }
.sheet-new td { background: var(--bg-2); }
.sheet-new .sheet-name { background: var(--bg-2); }
.sheet-new input[type=text] { padding: 6px 9px; font-size: 13px; background: var(--card); }
.sheet-new .sheet-cell input { background: var(--card); border-color: var(--line); }
.cell-note { position: absolute; left: 0; right: 0; bottom: 1px; line-height: 10px; }
.cell-pdf, .cell-req { font-size: 10px; font-weight: 600; white-space: nowrap; }
.cell-pdf { color: var(--success); }
.cell-req { color: var(--warning); }
.sheet-legend .cell-pdf, .sheet-legend .cell-req { display: inline; font-size: 11.5px; }
.sheet-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 12px 4px 0; }
.sheet-legend { font-size: 11.5px; margin-left: 6px; }

.matrix td, .matrix th { text-align: center; }
.matrix td:first-child, .matrix th:first-child { text-align: left; position: sticky; left: 0; background: var(--card); }

/* ===== Сообщения ===== */
.messages { list-style: none; padding: 0; margin: 0 0 16px; display: grid; gap: 8px; }
.messages li { padding: 11px 14px; border-radius: 10px; font-size: 13.5px; background: var(--info-bg); color: var(--info); border: 1px solid transparent; }
.messages li.success { background: var(--success-bg); color: var(--success); border-color: rgba(31, 169, 113, .25); }
.messages li.warning { background: var(--warning-bg); color: var(--t1); border-color: rgba(217, 145, 42, .3); }
.messages li.error { background: var(--danger-bg); color: var(--danger); border-color: rgba(216, 96, 79, .3); }
.notice { padding: 11px 14px; border-radius: 10px; background: var(--card-2); border: 1px dashed var(--line-strong); font-size: 13.5px; }
.notice.warn { background: var(--warning-bg); color: var(--t1); border: 0; }
.notice.info { background: var(--info-bg); color: var(--info); border: 0; }
.notice.ok { background: var(--success-bg); color: var(--success); border: 0; }

.linkbox { display: flex; gap: 8px; align-items: stretch; flex-wrap: wrap; }
.linkbox input { flex: 1; min-width: 200px; font-family: var(--mono); font-size: 12.5px; }
code { background: var(--card-2); border: 1px solid var(--line); padding: 1px 5px; border-radius: 5px; font-size: 12.5px; font-family: var(--mono); }

.legal { font-size: 14px; }
.legal h2 { font-size: 16px; }
.legal ol, .legal ul { padding-left: 1.3rem; }
.legal li { margin-bottom: .35rem; }
.empty { text-align: center; color: var(--t2); padding: 2rem 1rem; }

/* ===== Демонстрация ===== */
.demo-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 9px 14px; border-radius: 12px; font-size: 13px;
  background: var(--warning-bg); color: var(--t1); border: 1px solid rgba(217, 145, 42, .3);
}
.demo-bar .btn { margin-left: auto; }
.hero { text-align: center; padding: 12px 0 6px; }
.hero .muted { max-width: 640px; margin: 0 auto; }
.demo-tiles { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.demo-tile { display: flex; flex-direction: column; gap: 8px; color: var(--t1); box-shadow: var(--shadow); transition: border-color .12s, transform .12s; }
.demo-tile:hover { border-color: var(--coral); text-decoration: none; transform: translateY(-1px); }
.demo-tile .card-sub { flex: 1; margin: 0; }
.demo-tile .btn { align-self: flex-start; }

/* ===== Телефон ===== */
@media (max-width: 900px) {
  .app { flex-direction: column; padding: 10px; gap: 10px; align-items: stretch; }
  .sidebar { position: static; width: 100%; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 10px 12px; border-radius: 14px; }
  .brand { padding: 0 4px; }
  .brand-name { display: none; }
  .nav-label { display: none; }
  .nav { flex-direction: row; gap: 2px; }
  .nav a { padding: 7px 9px; font-size: 13px; gap: 6px; }
  .side-foot { margin: 0 0 0 auto; padding: 0; }
  .user-chip { border: 0; padding: 0; }
  .user-name { max-width: 120px; }
  .topbar { padding: 10px 12px; border-radius: 14px; flex-wrap: wrap; }
  .tb-search { max-width: none; order: 3; flex-basis: 100%; }
  .content { padding: 6px 2px 0; }
  .seg { display: flex; flex-wrap: nowrap; overflow-x: auto; max-width: 100%; }
  .demo-bar { font-size: 12px; padding: 7px 10px; }
  .demo-bar .btn { padding: 4px 8px; font-size: 11.5px; }
  .solo { padding-top: 64px; }
  h1 { font-size: 22px; }
  .card { padding: 15px; }
  th, td { padding: 9px 9px; }
  .sheet-wrap { max-height: none; }
}
@media (max-width: 520px) {
  .nav a span { display: none; }
  .nav a .ico { width: 20px; height: 20px; }
  .user-meta { display: none; }
}
@media print {
  .sidebar, .topbar, .demo-bar, .footer, .sheet-actions, .sheet-new { display: none !important; }
  .app, .content { padding: 0; }
  .card, .table-wrap { box-shadow: none; }
}
