/* ============================================================
   STAMP APPROVAL — Design System
   Тёмная/светлая тема, современный IT-стиль
   ============================================================ */

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

/* ── Переменные тёмной темы (по умолчанию) ─────────────────── */
:root {
  --bg:          #0d1117;
  --surface:     #161b22;
  --surface-2:   #21262d;
  --surface-3:   #2d333b;
  --border:      #30363d;
  --border-soft: rgba(48,54,61,.6);
  --text:        #e6edf3;
  --text-2:      #8b949e;
  --text-3:      #6e7681;

  --accent:      #6e40c9;
  --accent-h:    #8957e5;
  --accent-soft: rgba(110,64,201,.15);
  --accent-text: #d2a8ff;

  --green:       #3fb950;
  --green-bg:    rgba(63,185,80,.12);
  --green-text:  #56d364;
  --red:         #f85149;
  --red-bg:      rgba(248,81,73,.12);
  --red-text:    #ff7b72;
  --yellow:      #e3b341;
  --yellow-bg:   rgba(227,179,65,.12);
  --yellow-text: #e3b341;
  --blue:        #388bfd;
  --blue-bg:     rgba(56,139,253,.12);
  --blue-text:   #79c0ff;

  --sidebar-w:   248px;
  --header-h:    56px;
  --radius:      8px;
  --radius-lg:   12px;
  --shadow:      0 8px 24px rgba(1,4,9,.4);
  --shadow-sm:   0 2px 8px rgba(1,4,9,.3);
}

/* ── Светлая тема ───────────────────────────────────────────── */
[data-theme="light"] {
  --bg:          #f6f8fa;
  --surface:     #ffffff;
  --surface-2:   #f0f2f5;
  --surface-3:   #e8ecf0;
  --border:      #d0d7de;
  --border-soft: rgba(208,215,222,.6);
  --text:        #1f2328;
  --text-2:      #636c76;
  --text-3:      #8c959f;

  --accent:      #6e40c9;
  --accent-h:    #5a32a3;
  --accent-soft: rgba(110,64,201,.1);
  --accent-text: #5a32a3;

  --green:       #1a7f37;
  --green-bg:    rgba(26,127,55,.1);
  --green-text:  #1a7f37;
  --red:         #cf222e;
  --red-bg:      rgba(207,34,46,.1);
  --red-text:    #cf222e;
  --yellow:      #9a6700;
  --yellow-bg:   rgba(154,103,0,.1);
  --yellow-text: #9a6700;
  --blue:        #0969da;
  --blue-bg:     rgba(9,105,218,.1);
  --blue-text:   #0969da;

  --shadow:      0 8px 24px rgba(0,0,0,.08);
  --shadow-sm:   0 2px 8px rgba(0,0,0,.06);
}

/* ── Сброс и базовые стили ─────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; overflow-x: hidden; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  transition: background .2s, color .2s;
}

a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 16px 0;
}

/* ── Типографика ────────────────────────────────────────────── */
h1, h2, h3, h4, h5 { font-weight: 600; color: var(--text); line-height: 1.3; }
h1 { font-size: 22px; }
h2 { font-size: 18px; }
h3 { font-size: 16px; }
h4 { font-size: 14px; }
.text-muted { color: var(--text-2) !important; }
.small, small { font-size: 12px; }
.mono { font-family: 'SFMono-Regular', Consolas, monospace; font-size: 12px; }

/* ── Лэйаут: sidebar + main ─────────────────────────────────── */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 200;
  overflow-y: auto;
  transition: transform .25s;
}
.sidebar-logo {
  height: var(--header-h);
  min-height: var(--header-h);
  max-height: var(--header-h);
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 9px;
  flex-shrink: 0;
  overflow: hidden;  /* не даём тексту растягивать блок */
}
.sidebar-logo img {
  max-height: 34px;
  max-width: 130px;
  width: auto;
  object-fit: contain;
  flex-shrink: 0;
  background: transparent;
}
.sidebar-logo-icon {
  width: 32px; height: 32px;
  background: var(--accent);
  border-radius: 7px;
  display: grid; place-items: center;
  font-size: 16px; flex-shrink: 0;
}
.sidebar-logo-text {
  font-weight: 700; font-size: 13px; color: var(--text); letter-spacing: -.2px;
  /* Обрезаем длинный текст в одну строку */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.sidebar-nav { flex: 1; padding: 10px 8px; }
.nav-section { margin-bottom: 20px; }
.nav-section-label {
  font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .08em;
  color: var(--text-3); padding: 0 10px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 10px; border-radius: 6px;
  color: var(--text-2); font-size: 13.5px; font-weight: 500;
  cursor: pointer; transition: all .12s;
  text-decoration: none;
  white-space: nowrap;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav-item.active { background: var(--accent-soft); color: var(--accent-text) !important; }
.nav-item i { width: 16px; text-align: center; font-size: 15px; flex-shrink: 0; }
.nav-badge {
  margin-left: auto;
  background: var(--accent);
  color: #fff;
  font-size: 10px; font-weight: 700;
  padding: 1px 6px; border-radius: 99px;
}

/* ── Раскрывающиеся группы навигации ──────────────────────────────── */
.nav-group { margin-bottom: 2px; }
.nav-group-toggle {
  width: 100%; display: flex; align-items: center; gap: 9px;
  padding: 7px 10px; border-radius: 6px;
  background: none; border: none; cursor: pointer;
  color: var(--text-2); font-size: 13.5px; font-weight: 500;
  font-family: inherit; transition: background .12s, color .12s;
}
.nav-group-toggle:hover { background: var(--surface-2); color: var(--text); }
.nav-group-icon { width: 16px; text-align: center; font-size: 15px; flex-shrink: 0; }
.nav-group-label { flex: 1; text-align: left; }
.nav-chevron { font-size: 11px !important; width: auto !important; transition: transform .2s ease; opacity: .5; }
.nav-group.is-open .nav-chevron { transform: rotate(90deg); opacity: .8; }
.nav-group.is-open .nav-group-toggle { color: var(--text); }
.nav-group-body { overflow: hidden; max-height: 0; transition: max-height .25s ease; }
.nav-group.is-open .nav-group-body { max-height: 1200px; }
.nav-group-body .nav-item { padding-left: 34px; }
/* Вложенные группы (Доступы, Логи внутри Системы) */
.nav-group-body .nav-group { margin-bottom: 1px; }
.nav-group-body .nav-group .nav-group-toggle { padding: 6px 10px 6px 28px; font-size: 13px; }
.nav-group-body .nav-group .nav-group-icon { font-size: 13px; }
.nav-group-body .nav-group-body .nav-item { padding-left: 50px; }
.nav-badge-sm { margin-left: 0; }
.nav-badge-danger { background: var(--red-text, #e55) !important; }
.sidebar-version { display: block; font-size: 11px; color: var(--text-3); padding: 2px 10px 6px; }
/* ─────────────────────────────────────────────────────────────────── */

.sidebar-footer {
  padding: 12px 8px;
  border-top: 1px solid var(--border);
}
.sidebar-user {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px; border-radius: 6px;
  cursor: pointer; color: var(--text-2);
  transition: background .12s;
}
.sidebar-user:hover { background: var(--surface-2); }
.sidebar-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff; font-size: 12px; font-weight: 700;
  display: grid; place-items: center;
  flex-shrink: 0;
}
.sidebar-user-name { font-size: 13px; font-weight: 500; color: var(--text); }
.sidebar-user-role { font-size: 11px; color: var(--text-3); }

/* ── Топбар ─────────────────────────────────────────────────── */
.topbar {
  min-height: var(--header-h);
  height: var(--header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
  padding: 0 20px 0 24px;
  position: sticky; top: 0; z-index: 100;
  box-sizing: border-box;
  flex-shrink: 0;
}
.topbar-title { font-size: 15px; font-weight: 600; flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }

/* ── Основной контент ───────────────────────────────────────── */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.page-content { padding: 24px 28px 60px; flex: 1; }

/* ── Page header ─────────────────────────────────────────────── */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 20px;
}
.page-header-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.page-title { font-size: 20px; font-weight: 700; color: var(--text); margin: 0; }
.page-subtitle { font-size: 13px; color: var(--text-2); margin: 2px 0 0; }

/* ── Поиск ──────────────────────────────────────────────────── */
.search-wrap { position: relative; }
.search-input {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  padding: 7px 12px 7px 34px;
  width: 240px;
  outline: none;
  transition: border-color .15s, width .25s;
}
.search-input:focus { border-color: var(--accent); width: 320px; }
.search-input::placeholder { color: var(--text-3); }
.search-icon {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  color: var(--text-3); font-size: 14px; pointer-events: none;
}

/* ── Кнопки ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px;
  font-size: 13px; font-weight: 500; font-family: inherit;
  border-radius: var(--radius); border: 1px solid transparent;
  cursor: pointer; transition: all .12s; white-space: nowrap;
  text-decoration: none;
}
.btn:hover { text-decoration: none; filter: brightness(1.1); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .45; cursor: not-allowed; filter: none; transform: none; }

.btn-primary   { background: var(--accent); color: #fff; }
.btn-secondary { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--surface-3); filter: none; }
.btn-danger    { background: var(--red-bg); color: var(--red-text); border-color: var(--red-bg); }
.btn-success   { background: var(--green-bg); color: var(--green-text); border-color: var(--green-bg); }
.btn-ghost     { background: transparent; color: var(--text-2); border-color: transparent; }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); filter: none; }
.btn-sm  { padding: 4px 10px; font-size: 12px; }
.btn-lg  { padding: 10px 20px; font-size: 15px; }
.btn-icon { padding: 7px; width: 32px; height: 32px; justify-content: center; }

/* ── Карточки ───────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.card-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.card-header-title { font-size: 14px; font-weight: 600; }
.card-body   { padding: 18px; }
.card-footer { padding: 12px 18px; border-top: 1px solid var(--border); }

/* Сворачиваемые карточки */
.card.collapsed .card-body,
.card.collapsed .card-footer { display: none !important; }
.card:not(.collapsed) .card-body { display: block; }
.card.collapsed .card-header { border-bottom: none; }
.card.collapsed .card-header .bi-chevron-right,
.card.collapsed .card-header .bi-chevron-up { transform: rotate(-90deg); transition: transform .2s; }
.card:not(.collapsed) .card-header .bi-chevron-right,
.card:not(.collapsed) .card-header .bi-chevron-up { transform: rotate(0deg); transition: transform .2s; }
/* section-card collapsed */
.section-card.collapsed .section-body { display: none; }
.section-card.collapsed .section-header { border-bottom: none; }
.section-card.collapsed .section-header .bi-chevron-down { transform: rotate(-90deg); }
.section-card:not(.collapsed) .section-header .bi-chevron-down { transform: rotate(0deg); }

/* ── Инпуты ─────────────────────────────────────────────────── */
.form-label { font-size: 13px; font-weight: 500; color: var(--text-2); margin-bottom: 5px; display: block; }
.form-label .req { color: var(--red-text); margin-left: 2px; }

.input, .select, .textarea {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: inherit;
  font-size: 13.5px;
  padding: 8px 12px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.textarea { resize: vertical; min-height: 72px; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238b949e' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 30px; }

.input-group { display: flex; }
.input-group .input { border-radius: var(--radius) 0 0 var(--radius); }
.input-group .input-addon {
  display: flex; align-items: center;
  background: var(--surface-3); border: 1px solid var(--border); border-left: none;
  padding: 0 10px; border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--text-2); font-size: 13px;
}

.form-row { margin-bottom: 16px; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.form-grid-3 { grid-template-columns: repeat(3, 1fr); }
.form-grid.full { grid-template-columns: 1fr; }

.checkbox-wrap { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.checkbox-wrap input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--accent); cursor: pointer; }
.radio-wrap    { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.radio-wrap    input[type="radio"]    { accent-color: var(--accent); cursor: pointer; }

/* ── Бейджи ─────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 99px;
  font-size: 11px; font-weight: 600; white-space: nowrap;
}
.badge-draft     { background: var(--surface-3); color: var(--text-2); }
.badge-awaiting  { background: var(--yellow-bg); color: var(--yellow-text); }
.badge-revision  { background: var(--red-bg);    color: var(--red-text); }
.badge-approved  { background: var(--green-bg);  color: var(--green-text); }
.badge-production{ background: var(--blue-bg);   color: var(--blue-text); }
.badge-ready     { background: var(--accent-soft);color: var(--accent-text); }
.badge-completed  { background: var(--surface-3); color: var(--text-3); }
.badge-cancelled  { background: #f1f5f9;          color: #64748b; }
.badge-paid      { background: var(--green-bg);  color: var(--green-text); }
.badge-unpaid    { background: var(--red-bg);    color: var(--red-text); }

/* ── Таблицы ────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); padding: 10px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 11px 14px; border-bottom: 1px solid var(--border-soft); font-size: 13.5px; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--surface-2); }

/* ── Алерты ─────────────────────────────────────────────────── */
.alert {
  padding: 11px 14px; border-radius: var(--radius);
  font-size: 13.5px; border: 1px solid; margin-bottom: 14px;
  display: flex; align-items: flex-start; gap: 9px;
}
.alert-success { background: var(--green-bg);  border-color: rgba(63,185,80,.3); color: var(--green-text); }
.alert-danger  { background: var(--red-bg);    border-color: rgba(248,81,73,.3); color: var(--red-text); }
.alert-info    { background: var(--blue-bg);   border-color: rgba(56,139,253,.3);color: var(--blue-text); }
.alert-warning { background: var(--yellow-bg); border-color: rgba(227,179,65,.3);color: var(--yellow-text); }

/* ── Модальное окно ─────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.65); backdrop-filter: blur(4px);
  z-index: 500; display: flex; align-items: center; justify-content: center;
  padding: 20px; opacity: 0; pointer-events: none; transition: opacity .2s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); width: 100%; max-width: 520px;
  box-shadow: var(--shadow); transform: scale(.96); transition: transform .2s;
}
.modal-overlay.open .modal { transform: scale(1); }
.modal-header { padding: 18px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-title  { font-size: 15px; font-weight: 600; }
.modal-close  { background: none; border: none; color: var(--text-2); cursor: pointer; font-size: 18px; padding: 2px 6px; border-radius: 4px; }
.modal-close:hover { background: var(--surface-2); color: var(--text); }
.modal-body   { padding: 20px; }
.modal-footer { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }

/* ── Tabs ───────────────────────────────────────────────────── */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 20px; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab-item {
  padding: 8px 14px; font-size: 13px; font-weight: 500;
  color: var(--text-2); cursor: pointer; border: none; background: none;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: color .12s; font-family: inherit;
}
.tab-item:hover { color: var(--text); }
.tab-item.active { color: var(--text); border-bottom-color: var(--accent); }
.tab-badge { background: var(--surface-3); color: var(--text-2); padding: 0 5px; border-radius: 99px; font-size: 10px; margin-left: 5px; }

/* ── Карточки заказов ───────────────────────────────────────── */
.order-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; align-items: stretch; }
.order-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  color: inherit;
}
.oc-footer { margin-top: auto; }

.order-card:hover { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), var(--shadow-sm); text-decoration: none; color: inherit; }
.order-card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 10px; gap: 8px; overflow: hidden; }
.oc-name-block { min-width: 0; flex: 1; overflow: hidden; }
.oc-status-pay { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; max-width: 50%; }
.oc-urgency-pill { display: inline-block; font-size: 10px; font-weight: 700; color: #fff; padding: 1px 6px; border-radius: 10px; margin-left: 5px; vertical-align: middle; letter-spacing: .3px; }
.order-card-name { font-weight: 600; font-size: 14px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.order-card-id   { font-size: 11px; color: var(--text-3); }
.order-card-meta { font-size: 12px; color: var(--text-2); margin-top: 3px; }

/* ── Список-вид ────────────────────────────────────────── */
.order-grid--list { grid-template-columns: 1fr; gap: 2px; }
.order-grid--list .order-card { flex-direction: row; align-items: center; padding: 8px 14px 8px 36px; gap: 0; min-height: 52px; border-radius: 6px; }
.order-grid--list .order-card-header { flex: 1; min-width: 0; margin-bottom: 0; }
.order-grid--list .oc-name-block { flex: 1; min-width: 0; }
.order-grid--list .order-card-name { font-size: 13px; }
.order-grid--list .oc-status-pay { flex-shrink: 0; margin-left: 16px; max-width: none; min-width: 130px; }
.order-grid--list .oc-meta,
.order-grid--list .oc-progress,
.order-grid--list .oc-badge,
.order-grid--list .oc-footer { display: none !important; }
.progress-bar { height: 4px; background: var(--surface-3); border-radius: 99px; overflow: hidden; margin-top: 8px; }
.progress-fill { height: 100%; background: var(--green); border-radius: 99px; transition: width .3s; }

/* ── Блоки в форме заказа ───────────────────────────────────── */
.section-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 16px;
}
.section-header {
  padding: 13px 18px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 8px;
}
.section-header-icon { font-size: 14px; color: var(--accent-text); }
.section-header-title { font-size: 13.5px; font-weight: 600; }
.section-body { padding: 18px; }

/* ── Оснастки ───────────────────────────────────────────────── */
.osnastka-picker { display: flex; flex-wrap: wrap; gap: 8px; }
.osnastka-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 99px; padding: 4px 10px 4px 6px;
  font-size: 12px; cursor: pointer; transition: all .12s;
}
.osnastka-chip:hover { border-color: var(--accent); background: var(--accent-soft); }
.osnastka-chip.selected { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); }
.osnastka-chip img { width: 20px; height: 20px; border-radius: 50%; object-fit: cover; }
.osnastka-qty { background: var(--surface-3); border: 1px solid var(--border); border-radius: 4px; width: 36px; font-size: 12px; text-align: center; padding: 1px 4px; color: var(--text); }

/* ── Комментарии менеджеров ─────────────────────────────────── */
.comment-list { display: flex; flex-direction: column; gap: 10px; }
.comment-item {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 14px;
}
.comment-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.comment-author { font-size: 12px; font-weight: 600; color: var(--text); }
.comment-time   { font-size: 11px; color: var(--text-3); }
.comment-text   { font-size: 13px; color: var(--text-2); line-height: 1.5; white-space: pre-wrap; }

/* ── Телефон + TG ───────────────────────────────────────────── */
.phone-row { display: flex; align-items: center; gap: 6px; }
.phone-row .input { flex: 1; }
.tg-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: var(--radius);
  background: #0088cc; color: #fff; font-size: 16px;
  text-decoration: none; border: none; cursor: pointer;
  flex-shrink: 0; transition: background .15s;
}
.tg-btn:hover { background: #006fa8; text-decoration: none; color: #fff; }

/* ── Переключатель темы ─────────────────────────────────────── */
.theme-toggle {
  width: 32px; height: 32px; border-radius: 6px;
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text-2); font-size: 15px;
  display: grid; place-items: center; cursor: pointer;
  transition: all .12s;
}
.theme-toggle:hover { background: var(--surface-3); color: var(--text); }

/* ── Мобильный бургер ───────────────────────────────────────── */
.sidebar-toggle {
  display: none;
  width: 32px; height: 32px; border-radius: 6px;
  background: none; border: 1px solid var(--border);
  color: var(--text-2); font-size: 15px;
  place-items: center; cursor: pointer;
}

/* ── Утилиты ────────────────────────────────────────────────── */
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.items-start  { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-end  { justify-content: flex-end; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }
.w-full { width: 100%; }
.mt-auto { margin-top: auto; }
.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.p-0 { padding: 0; }
.text-center { text-align: center; }
.text-right  { text-align: right; }
.overflow-hidden { overflow: hidden; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.opacity-50 { opacity: .5; }
.cursor-pointer { cursor: pointer; }
.d-none   { display: none !important; }
.d-inline { display: inline !important; }
.d-block  { display: block !important; }
.d-flex   { display: flex !important; }
.ms-auto  { margin-left: auto; }
.ms-1 { margin-left: 4px; }
.ms-2 { margin-left: 8px; }
.ms-3 { margin-left: 12px; }
.me-1 { margin-right: 4px; }
.me-2 { margin-right: 8px; }
.fw-semibold { font-weight: 600; }
.fw-bold     { font-weight: 700; }
.col-span-2 { grid-column: span 2; }
.col-span-3 { grid-column: span 3; }

/* ── Скроллбар ──────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

/* ── Skeleton-загрузка ──────────────────────────────────────── */
.skeleton { background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%); background-size: 200% 100%; animation: shimmer 1.5s infinite; border-radius: 4px; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ── Спиннер ─────────────────────────────────────────────────── */
.spinner { display: inline-block; width: 16px; height: 16px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; max-width: 100vw; }
  .sidebar-toggle { display: grid; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid-3 { grid-template-columns: 1fr; }
  .order-grid { grid-template-columns: 1fr; }
  .page-content { padding: 16px 14px 40px; }
  .page-title { font-size: 17px; }
  img, video, iframe { max-width: 100%; }
}

/* ── Дерево оснасток (checkboxes) ───────────────────────────── */
.osn-tree { display: flex; flex-direction: column; }
.osn-cat-hdr {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--text-3);
  padding: 10px 0 4px; margin-top: 2px;
  border-top: 1px solid var(--border-soft);
}
.osn-cat-hdr:first-child { border-top: none; padding-top: 4px; margin-top: 0; }
.osn-tree-row {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 6px; border-radius: 6px; cursor: pointer;
  user-select: none;
}
.osn-tree-row:hover { background: var(--surface-2); }
.osn-tree-row input[type=checkbox] { width: 15px; height: 15px; flex-shrink: 0; cursor: pointer; accent-color: var(--accent); }
.osn-tree-thumb { width: 24px !important; height: 24px !important; max-width: 24px !important; max-height: 24px !important; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.osn-tree-icon { font-size: 14px; line-height: 1; flex-shrink: 0; }
.osn-tree-name { flex: 1; font-size: 13px; color: var(--text); }
.osn-tree-art  { font-size: 11px; color: var(--accent-text); font-weight: 600; margin-left: 5px; }
.osn-tree-size { font-size: 11px; color: var(--text-3); margin-left: 4px; }
.osn-tree-qty  {
  width: 60px; padding: 2px 6px; border: 1px solid var(--border);
  border-radius: 5px; font-size: 12px; text-align: center;
  background: var(--surface); color: var(--text); flex-shrink: 0;
}

/* ── Галерея оснасток (пикер 300×300) ───────────────────────── */
.osn-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.osn-cat-hdr-gallery {
  grid-column: 1 / -1;
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--text-3);
  padding: 8px 0 4px; border-top: 1px solid var(--border-soft);
}
.osn-cat-hdr-gallery:first-child { border-top: none; }
.osn-card {
  position: relative; border: 2px solid var(--border); border-radius: 8px;
  cursor: pointer; overflow: hidden; transition: border-color .15s, background .15s;
  background: var(--surface-2);
  user-select: none;
}
.osn-card:hover { border-color: var(--accent-h); }
.osn-card.selected { border-color: var(--accent); background: var(--accent-soft); }
.osn-card-img {
  width: 100%; aspect-ratio: 1 / 1;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-2); overflow: hidden;
}
.osn-card-img img {
  width: 100%; height: 100%; object-fit: contain;
  display: block;
}
.osn-card-img .osn-card-icon { font-size: 48px; opacity: .4; }
.osn-card-body { padding: 8px 10px 10px; }
.osn-card-name { font-size: 12px; font-weight: 600; color: var(--text); line-height: 1.3; margin-bottom: 2px; }
.osn-card-meta { font-size: 11px; color: var(--text-3); }
.osn-card-art  { color: var(--accent-text); font-size: 11px; font-weight: 600; }
.osn-card-qty-wrap { display: none; padding: 0 10px 10px; }
.osn-card.selected .osn-card-qty-wrap { display: block; }
.osn-card-qty { width: 100%; padding: 4px 8px; border: 1px solid var(--border); border-radius: 5px; font-size: 12px; background: var(--surface); color: var(--text); text-align: center; }
.osn-card-check {
  position: absolute; top: 6px; right: 6px;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--accent); color: #fff;
  display: none; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; box-shadow: 0 1px 4px rgba(0,0,0,.3);
}
.osn-card.selected .osn-card-check { display: flex; }

/* ── Компактный пикер оснасток (в формах заказов) ──────────── */
.osn-gallery-picker { grid-template-columns: repeat(auto-fill, minmax(100px, 120px)); gap: 8px; }
.osn-gallery-picker .osn-card-img { aspect-ratio: unset; height: 90px; }
.osn-gallery-picker .osn-card-icon { font-size: 32px; }
.osn-gallery-picker .osn-card-body { padding: 6px 8px 6px; }
.osn-gallery-picker .osn-card-name { font-size: 11px; }
.osn-gallery-picker .osn-card-meta { font-size: 10px; }
.osn-gallery-picker .osn-card-qty-wrap { padding: 0 8px 8px; }
.osn-gallery-picker .osn-card-qty { font-size: 11px; padding: 2px 4px; }

/* ── Осн-лист пикер (каталог с поиском и категориями) ───────── */
.osn-list-picker { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--surface); }
.osn-list-search-wrap { padding: 8px 10px; border-bottom: 1px solid var(--border); background: var(--surface); position: sticky; top: 0; z-index: 2; }
.osn-list-search-inner { position: relative; }
.osn-list-search-icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text-3); font-size: 13px; pointer-events: none; }
.osn-list-search { width: 100%; padding: 6px 10px 6px 32px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface-2); color: var(--text); font-size: 13px; box-sizing: border-box; }
.osn-list-search:focus { outline: none; border-color: var(--accent); }
.osn-list-cat-hdr { display: flex; align-items: center; gap: 6px; padding: 7px 12px; font-size: 11px; font-weight: 700; color: var(--text-2); text-transform: uppercase; letter-spacing: .06em; cursor: pointer; border-top: 1px solid var(--border-soft); background: var(--surface); user-select: none; transition: background .12s; }
.osn-list-cat-hdr:hover { background: var(--surface-2); }
.osn-list-cat-hdr:first-of-type { border-top: none; }
.osn-list-cat-count { font-size: 10px; color: var(--text-3); font-weight: 500; }
.osn-cat-chevron { margin-left: auto; transition: transform .18s; font-size: 11px; color: var(--text-3); }
.osn-list-cat-hdr.collapsed .osn-cat-chevron { transform: rotate(-90deg); }
.osn-list-cat-items.hidden { display: none; }
.osn-list-item { display: flex; align-items: center; gap: 10px; padding: 7px 12px; cursor: pointer; border-top: 1px solid var(--border-soft); transition: background .1s; }
.osn-list-item:hover { background: var(--surface-2); }
.osn-list-item.selected { background: var(--accent-soft); }
.osn-list-item-check { width: 16px; height: 16px; border-radius: 4px; border: 1.5px solid var(--border); flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 9px; color: transparent; background: var(--surface); transition: all .13s; }
.osn-list-item.selected .osn-list-item-check { background: var(--accent); border-color: var(--accent); color: #fff; }
.osn-list-item-label { flex: 1; font-size: 13px; color: var(--text); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.osn-list-item-art { color: var(--accent-text); font-weight: 600; }
.osn-list-item-sep { color: var(--text-3); margin: 0 2px; }
.osn-list-qty-wrap { display: none; flex-shrink: 0; }
.osn-list-item.selected .osn-list-qty-wrap { display: flex; align-items: center; gap: 4px; }
.osn-list-qty { width: 60px; padding: 3px 6px; border: 1px solid var(--border); border-radius: 5px; font-size: 12px; background: var(--surface); color: var(--text); text-align: center; }
.osn-list-empty { padding: 20px 12px; color: var(--text-3); font-size: 13px; text-align: center; }

/* ══ Модальный каталог оснасток ══════════════════════════════ */
.osn-modal-backdrop{position:fixed;inset:0;background:rgba(0,0,0,.65);z-index:9100;display:flex;align-items:center;justify-content:center;padding:16px;opacity:0;pointer-events:none;transition:opacity .18s}
.osn-modal-backdrop.open{opacity:1;pointer-events:all}
.osn-modal{background:var(--surface);border:1px solid var(--border);border-radius:14px;width:100%;max-width:860px;max-height:88vh;display:flex;flex-direction:column;overflow:hidden;box-shadow:0 24px 64px rgba(0,0,0,.45);transform:scale(.97);transition:transform .18s}
.osn-modal-backdrop.open .osn-modal{transform:scale(1)}
.osn-modal-header{display:flex;align-items:center;gap:12px;padding:14px 20px;border-bottom:1px solid var(--border);flex-shrink:0}
.osn-modal-title{font-size:15px;font-weight:700;color:var(--text);flex:1}
.osn-modal-close{background:none;border:none;color:var(--text-3);cursor:pointer;font-size:22px;line-height:1;padding:2px 8px;border-radius:6px;transition:background .1s}
.osn-modal-close:hover{background:var(--surface-2)}
.osn-modal-body{display:flex;flex:1;overflow:hidden;min-height:0}
.osn-modal-cats{width:190px;flex-shrink:0;border-right:1px solid var(--border);overflow-y:auto;padding:6px 0}
.osn-modal-cat-item{padding:8px 14px;font-size:13px;cursor:pointer;display:flex;align-items:center;justify-content:space-between;gap:4px;transition:background .1s;user-select:none}
.osn-modal-cat-item:hover{background:var(--surface-2)}
.osn-modal-cat-item.active{background:var(--accent-soft);color:var(--accent-text);font-weight:600}
.osn-modal-cat-count{font-size:11px;color:var(--text-3);flex-shrink:0}
.osn-modal-cat-item.active .osn-modal-cat-count{color:inherit;opacity:.7}
.osn-modal-main{flex:1;display:flex;flex-direction:column;overflow:hidden}
.osn-modal-search-wrap{padding:10px 12px;border-bottom:1px solid var(--border-soft);flex-shrink:0;position:relative}
.osn-modal-search-icon{position:absolute;left:22px;top:50%;transform:translateY(-50%);color:var(--text-3);font-size:13px;pointer-events:none}
.osn-modal-search{width:100%;padding:7px 10px 7px 34px;border:1px solid var(--border);border-radius:7px;background:var(--surface-2);color:var(--text);font-size:13px;box-sizing:border-box}
.osn-modal-search:focus{outline:none;border-color:var(--accent)}
.osn-table-wrap{flex:1;overflow-y:auto}
.osn-table{width:100%;border-collapse:collapse;table-layout:fixed}
.osn-table th{padding:8px 10px;font-size:11px;font-weight:600;color:var(--text-3);text-transform:uppercase;letter-spacing:.05em;border-bottom:2px solid var(--border);text-align:left;position:sticky;top:0;background:var(--surface);z-index:1;white-space:nowrap}
.osn-table td{padding:7px 10px;font-size:13px;border-bottom:1px solid var(--border-soft);vertical-align:middle;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.osn-table td:nth-child(2){width:48px;padding:4px 8px;overflow:hidden}
.osn-table tbody tr{cursor:pointer;transition:background .08s}
.osn-table tbody tr:hover td{background:var(--surface-2)}
.osn-table tbody tr.osn-row-sel td{background:var(--accent-soft)}
.osn-table-thumb{width:36px;height:36px;min-width:36px;max-width:36px;max-height:36px;object-fit:contain;border-radius:5px;border:1px solid var(--border);display:block;background:var(--surface-2);flex-shrink:0}
.osn-table-no-thumb{width:36px;height:36px;border-radius:5px;border:1px solid var(--border);background:var(--surface-2);display:flex;align-items:center;justify-content:center;color:var(--text-3);font-size:18px}
.osn-table-art{font-size:11px;font-weight:600;color:var(--accent-text)}
.osn-table-dim{font-size:11px;color:var(--text-3)}
.osn-modal-footer{padding:12px 16px;border-top:1px solid var(--border);display:flex;align-items:center;gap:10px;flex-shrink:0;background:var(--surface)}
.osn-modal-sel-count{font-size:13px;color:var(--text-2);flex:1}
.osn-empty-row td{text-align:center;padding:32px;color:var(--text-3);font-size:13px}

/* ── Выбранные: кнопка + чипы ──────────────────────────────── */
.osn-add-btn{display:flex;align-items:center;justify-content:center;gap:6px;width:100%;padding:7px 14px;font-size:12px;font-weight:500;border:1.5px dashed var(--border);border-radius:7px;background:none;color:var(--text-2);cursor:pointer;transition:all .15s;margin-top:4px}
.osn-add-btn:hover{border-color:var(--accent);color:var(--accent-text);background:var(--accent-soft)}
.osn-chips-wrap{display:flex;flex-direction:column;gap:3px;margin-top:6px}
.osn-chip{display:flex;align-items:center;gap:6px;padding:5px 8px 5px 10px;background:var(--surface-2);border:1px solid var(--border);border-radius:7px;font-size:12px;transition:border-color .1s;flex-wrap:wrap;row-gap:4px}
.osn-chip:hover{border-color:var(--accent)}
.osn-chip-name{flex:1;font-weight:500;color:var(--text);overflow:hidden;white-space:nowrap;text-overflow:ellipsis}
.osn-chip-meta{font-size:11px;color:var(--text-3);white-space:nowrap;flex-shrink:0}
.osn-chip-qty{width:52px;padding:2px 4px;border:1px solid var(--border);border-radius:5px;font-size:12px;background:var(--surface);color:var(--text);text-align:center}
.osn-chip-rm{background:none;border:none;color:var(--text-3);cursor:pointer;font-size:18px;line-height:1;padding:0 2px;flex-shrink:0;transition:color .1s}
.osn-chip-rm:hover{color:var(--red-text)}

/* ══ Лайтбокс (CSS-only открытие) ══ */
.lightbox{display:none;position:fixed;inset:0;background:rgba(0,0,0,.88);z-index:10000;align-items:center;justify-content:center;padding:20px;cursor:zoom-out}
.lightbox.open{display:flex}
.lightbox img{max-width:100%;max-height:92vh;border-radius:8px;cursor:default;box-shadow:0 8px 40px rgba(0,0,0,.6)}
.lightbox-close{position:fixed;top:16px;right:16px;background:rgba(255,255,255,.15);border:none;color:#fff;width:40px;height:40px;border-radius:50%;font-size:22px;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:background .15s;z-index:1}
.lightbox-close:hover{background:rgba(255,255,255,.3)}

/* ══ Сворачиваемые карточки макетов ══ */
.mockup-card .mockup-body{transition:none}
.mockup-card.collapsed .mockup-body{display:none}
.mockup-card .mockup-chevron-icon{transition:transform .2s;display:inline-block}
.mockup-card.collapsed .mockup-chevron-icon{transform:rotate(-180deg)}

/* ══ Контрол кол-ва ± ══ */
.qty-ctrl{display:flex;align-items:center;gap:2px;flex-shrink:0}
.qty-btn{width:26px;height:26px;border:1px solid var(--border);background:var(--surface-2);color:var(--text);border-radius:5px;cursor:pointer;font-size:15px;font-weight:600;line-height:1;display:flex;align-items:center;justify-content:center;flex-shrink:0;transition:all .1s;padding:0;-webkit-user-select:none;user-select:none}
.qty-btn:hover{background:var(--accent-soft);border-color:var(--accent);color:var(--accent-text)}
.qty-input{width:46px;padding:3px 4px;border:1px solid var(--border);border-radius:5px;font-size:12px;background:var(--surface);color:var(--text);text-align:center;-moz-appearance:textfield}
.qty-input::-webkit-inner-spin-button,.qty-input::-webkit-outer-spin-button{-webkit-appearance:none}

/* ══ Мобильная адаптация ══ */
@media (max-width:768px){
  /* Осн-модал — bottom sheet на мобиле */
  .osn-modal-backdrop{align-items:flex-end;padding:0}
  .osn-modal{max-width:100%;max-height:92vh;border-radius:16px 16px 0 0}
  .osn-modal-body{flex-direction:column}
  .osn-modal-cats{width:100%;max-height:80px;overflow-x:auto;overflow-y:hidden;display:flex;flex-direction:row;border-right:none;border-bottom:1px solid var(--border);padding:4px 8px;gap:4px;flex-shrink:0}
  .osn-modal-cat-item{white-space:nowrap;flex-shrink:0;padding:5px 10px;border-radius:20px;border:1px solid var(--border)}
  .osn-modal-cat-item.active{border-color:var(--accent)}
  /* Страница заказа — 1 колонка на мобиле */
  .order-flex{flex-direction:column}
  /* Переполнение таблиц */
  .page-content table{display:block;overflow-x:auto;-webkit-overflow-scrolling:touch}
  /* Карточки заказов */
  .order-grid{grid-template-columns:1fr}
  /* Форма — уже есть 1fr, добавим padding */
  .form-grid{gap:12px}
  /* Чипы оснасток */
  .osn-chip{flex-wrap:wrap}
  /* Topbar */
  .topbar-actions .search-wrap{display:none}
}
@media (max-width:480px){
  .osn-modal-cats{max-height:68px}
  .osn-table th:nth-child(4),.osn-table td:nth-child(4),
  .osn-table th:nth-child(5),.osn-table td:nth-child(5){display:none}
}

/* ══════════════════════════════════════════════════════════════
   UI/UX Pro Max — Design Quality Improvements
   Applied: accessibility, touch targets, animation, forms
   ══════════════════════════════════════════════════════════════ */

/* ── Skip link (accessibility: keyboard nav) ──────────────────── */
.skip-link{position:absolute;top:-100%;left:16px;background:var(--accent);color:#fff;padding:8px 16px;border-radius:0 0 8px 8px;font-size:13px;font-weight:600;z-index:9999;text-decoration:none;transition:top .15s}
.skip-link:focus{top:0}

/* ── Focus rings (WCAG 2.4.11, AA) ────────────────────────────── */
:focus{outline:none}
:focus-visible{outline:2px solid var(--accent);outline-offset:2px;border-radius:4px}
a:focus-visible,.btn:focus-visible,.nav-item:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
.input:focus-visible,.select:focus-visible,.textarea:focus-visible{outline:none;border-color:var(--accent);box-shadow:0 0 0 3px var(--accent-soft)}

/* ── Кнопки: конкретные hover вместо filter:brightness ────────── */
.btn{transition:background-color .12s ease,border-color .12s ease,box-shadow .12s ease,transform .1s ease;filter:none !important}
.btn:hover{filter:none !important}
.btn:active{transform:scale(.97);transition:transform .08s ease}
.btn:disabled,.btn[disabled]{opacity:.45;cursor:not-allowed;transform:none !important;pointer-events:none}

.btn-primary:hover{background:var(--accent-h)}
.btn-primary:active{background:var(--accent)}
.btn-secondary:hover{background:var(--surface-3);border-color:var(--text-3)}
.btn-ghost:hover{background:var(--surface-2);color:var(--text)}
.btn-danger:hover{background:rgba(248,81,73,.22);border-color:var(--red-text)}
.btn-success:hover{background:rgba(63,185,80,.22)}

/* Иконочные кнопки — min touch 36px (desktop), 44px расширенная зона */
.btn-icon{min-width:36px;min-height:36px;padding:0;justify-content:center}

/* ── Touch targets ≥44px на мобиле ────────────────────────────── */
@media(max-width:768px){
  .btn:not(.btn-icon):not(.btn-sm){min-height:44px;padding:10px 16px}
  .btn-sm{min-height:36px}
  .input,.select{min-height:44px;font-size:16px/* iOS auto-zoom prevention */}
  .textarea{min-height:88px}
  .nav-item{min-height:44px;padding:10px 12px}
  .tab-item{min-height:44px;padding:10px 14px}
}

/* ── Анимации: корректные easing функции ──────────────────────── */
.modal{transition:transform .2s cubic-bezier(0,0,.2,1),opacity .2s ease}
.modal-overlay{transition:opacity .18s ease}
.osn-modal{transition:transform .2s cubic-bezier(0,0,.2,1)}
.osn-modal-backdrop{transition:opacity .18s ease}
.sidebar{transition:transform .22s cubic-bezier(0,0,.2,1)}
.order-card{transition:border-color .15s ease,box-shadow .15s ease}

/* ── prefers-reduced-motion ─────────────────────────────────────── */
@media(prefers-reduced-motion:reduce){
  *,*::before,*::after{animation-duration:.01ms !important;animation-iteration-count:1 !important;transition-duration:.01ms !important}
  .modal,.modal-overlay,.osn-modal,.osn-modal-backdrop,.sidebar{transition:none}
  .skeleton{animation:none;background:var(--surface-3)}
  .spinner{animation:spin 1.5s linear infinite}/* спиннер остаётся для loading feedback */
}

/* ── Disabled состояние инпутов ────────────────────────────────── */
.input:disabled,.select:disabled,.textarea:disabled{opacity:.5;cursor:not-allowed;background:var(--surface-3)}

/* ── Loading button state ─────────────────────────────────────── */
.btn.loading{pointer-events:none;opacity:.75}
.btn.loading::after{content:'';display:inline-block;width:12px;height:12px;border:2px solid rgba(255,255,255,.4);border-top-color:#fff;border-radius:50%;animation:spin .6s linear infinite;margin-left:6px}
.btn-secondary.loading::after,.btn-ghost.loading::after{border-color:var(--border);border-top-color:var(--accent)}

/* ── Empty state ─────────────────────────────────────────────── */
.empty-state{display:flex;flex-direction:column;align-items:center;justify-content:center;padding:48px 24px;text-align:center;color:var(--text-3)}
.empty-state-icon{font-size:40px;opacity:.25;margin-bottom:16px;display:block}
.empty-state-title{font-size:15px;font-weight:600;color:var(--text-2);margin-bottom:8px}
.empty-state-text{font-size:13px;line-height:1.6;max-width:320px;margin:0 auto 20px}

/* ── Form helper text & error ─────────────────────────────────── */
.form-helper{font-size:12px;color:var(--text-3);margin-top:4px}
.form-error{font-size:12px;color:var(--red-text);margin-top:4px;display:flex;align-items:center;gap:4px}
.form-error::before{content:'\26A0';font-size:11px}
.input.error,.select.error,.textarea.error{border-color:var(--red);box-shadow:0 0 0 3px var(--red-bg)}
.input.success{border-color:var(--green)}

/* ── Card hover refinement ─────────────────────────────────────── */
.card{transition:box-shadow .15s ease}

/* ── Typography refinement ─────────────────────────────────────── */
p{line-height:1.6}
.form-label{line-height:1.4}
/* Tabular numbers для цифр в таблицах */
td .badge,td .order-card-id,.mono,table td:where([class*="price"],[class*="qty"],[class*="count"]){font-variant-numeric:tabular-nums}

/* ── Scrollbar gutter — prevent layout shift (desktop only) ──────── */
@media(min-width:769px){html{scrollbar-gutter:stable}}

/* ── Accessible link decoration ──────────────────────────────────── */
a:focus-visible{outline:2px solid var(--accent);outline-offset:2px;border-radius:2px;text-decoration:none}

/* ── Print styles (print-label / print-approval) ────────────────── */
@media print{
  .sidebar,.topbar,.btn,.nav-item,.modal-overlay,.lightbox,.osn-modal-backdrop{display:none !important}
  .main-content{margin-left:0}
  .page-content{padding:0}
  body{background:#fff;color:#000;font-size:12pt}
  .card,.section-card{border:1px solid #ccc;box-shadow:none}
  .card, .section-card, .mockup-card { page-break-inside: avoid; }
}

/* Print dropdown menu */
.print-menu-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; font-size: 13px; font-weight: 500;
  color: var(--text); text-decoration: none;
  transition: background .1s;
}
.print-menu-item:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.print-menu-item i { width: 16px; text-align: center; color: var(--text-3); font-size: 14px; }
.print-menu-item + .print-menu-item { border-top: 1px solid var(--border-soft); }

/* Urgency card variants */
.order-card--express { border-left: 3px solid var(--red-text, #e74c3c) !important; }
.order-card--today   { border-left: 3px solid #e67e22 !important; }
.order-card--express:hover { box-shadow: 0 0 0 1px var(--red-text,#e74c3c), var(--shadow-sm) !important; }
.order-card--today:hover   { box-shadow: 0 0 0 1px #e67e22, var(--shadow-sm) !important; }

/* Update progress */
#update-bar { background: var(--accent); transition: width .4s ease; }

/* ── Стилизованный file input ──────────────────────────────────────────────── */
.file-drop {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 20px 16px;
  border: 2px dashed var(--border);
  border-radius: var(--radius, 10px);
  background: var(--surface-2, #f8f9fa);
  cursor: pointer;
  transition: border-color .15s, background .15s;
  min-height: 80px;
  text-align: center;
}
.file-drop:hover, .file-drop.drag-over {
  border-color: var(--accent);
  background: var(--accent-soft, #eff6ff);
}
.file-drop input[type=file] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}
.file-drop-icon { font-size: 28px; opacity: .5; }
.file-drop-label { font-size: 13px; color: var(--text-2); font-weight: 500; }
.file-drop-hint  { font-size: 11px; color: var(--text-3); }
.file-drop-chosen { font-size: 13px; color: var(--accent); font-weight: 600; word-break: break-all; }
.file-drop.has-file { border-style: solid; border-color: var(--accent); }

/* ── Flatpickr overrides ───────────────────────────────────────────────────── */
.flatpickr-calendar {
  background: var(--surface, #fff) !important;
  border: 1px solid var(--border) !important;
  border-radius: 12px !important;
  box-shadow: 0 8px 32px rgba(0,0,0,.18) !important;
  font-family: inherit !important;
}
.flatpickr-day.selected, .flatpickr-day.selected:hover {
  background: var(--accent) !important;
  border-color: var(--accent) !important;
}
.flatpickr-day:hover { background: var(--accent-soft, #eff6ff) !important; }
.flatpickr-months { background: var(--surface-2) !important; border-radius: 12px 12px 0 0 !important; }
.flatpickr-current-month { color: var(--text) !important; }
.flatpickr-weekday { color: var(--text-3) !important; }
.flatpickr-day { color: var(--text) !important; border-radius: 8px !important; }
.flatpickr-day.flatpickr-disabled { color: var(--text-3) !important; opacity: .4; }
.flatpickr-time input { background: var(--surface-2) !important; color: var(--text) !important; border-radius: 8px !important; }
.flatpickr-time .flatpickr-time-separator { color: var(--text-2) !important; }
.numInputWrapper:hover { background: var(--accent-soft) !important; }
.flatpickr-monthDropdown-months { background: var(--surface) !important; color: var(--text) !important; }
.flatpickr-prev-month svg, .flatpickr-next-month svg { fill: var(--text-2) !important; }

/* ── Quill WYSIWYG ─────────────────────────────────────────────────────────── */
.ql-toolbar { background: var(--surface-2) !important; border: 1px solid var(--border) !important; border-radius: var(--radius,10px) var(--radius,10px) 0 0 !important; }
.ql-container { border: 1px solid var(--border) !important; border-top: none !important; border-radius: 0 0 var(--radius,10px) var(--radius,10px) !important; font-family: inherit !important; font-size: 14px !important; }
.ql-editor { min-height: 240px; color: var(--text) !important; background: var(--surface) !important; }
.ql-editor.ql-blank::before { color: var(--text-3) !important; font-style: normal !important; }
.ql-snow .ql-stroke { stroke: var(--text-2) !important; }
.ql-snow .ql-fill { fill: var(--text-2) !important; }
.ql-snow .ql-picker-label { color: var(--text-2) !important; }
.ql-snow .ql-picker-options { background: var(--surface) !important; border: 1px solid var(--border) !important; border-radius: 8px !important; }
.ql-snow .ql-active .ql-stroke { stroke: var(--accent) !important; }
.ql-toolbar button:hover .ql-stroke { stroke: var(--accent) !important; }

/* ── Форма редактирования заказа — 2 колонки ──────────────────────────────── */
.order-edit-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  max-width: 1200px;
}
.order-edit-form .order-edit-full { grid-column: 1 / -1; }
.order-edit-col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
@media (max-width: 900px) {
  .order-edit-form { grid-template-columns: 1fr; }
  .order-edit-col { gap: 12px; }
}

/* ── section-card collapse chevron animation ──────────────────────────────── */
.section-card .section-header .bi-chevron-down { transition: transform .2s; }
.section-card.collapsed .section-header .bi-chevron-down { transform: rotate(-90deg); }
