  :root {}
  * { box-sizing:border-box; }
  body {
    margin:0; font-family:var(--font); background:var(--bg);
    color:var(--ink); font-size:14px;
  }
  .mono { font-variant-numeric:tabular-nums; }
  a { color:inherit; }
  .app { display:flex; min-height:100vh; }

  /* Safety net: icons.py SVGs carry no width/height attribute of their own, so without a
     sizing rule for the spot they're dropped into, browsers render them at a huge default
     size (or collapse to 0 in flex contexts). Anything with an explicit width= is left alone. */
  svg:not([width]) { width:16px; height:16px; vertical-align:middle; flex-shrink:0; }

  /* Sane default motion for every interactive control — hover/press feedback everywhere */
  a, button, .btn, .qa-btn, .page-link, .edit-link, .side-card h3 a,
  .quick-import, .import-card button, input, select, textarea {
    transition: background .15s ease-out, border-color .15s ease-out, color .15s ease-out,
                transform .12s ease-out, box-shadow .15s ease-out, opacity .15s ease-out;
  }
  button:active, .btn:active, .qa-btn:active, .page-link:active, .quick-import:active,
  .import-card button:active { transform: scale(.97); }

  /* Боковое меню — целиком в static/sidebar.css. Прежние правила меню (тёмное, до оформления в стиле Apple) отсюда убраны 13.10.2026:
     на страницах они уже не действовали, но успевали мелькнуть при загрузке. */
  .quick-import {
    display:flex; align-items:center; gap:.65rem; text-decoration:none; margin-top:.8rem;
    padding:.7rem .75rem; border-radius:12px; background:var(--brand); color:#fff;
  }
  .quick-import:hover { background:var(--brand-dark); box-shadow: none; }
  .quick-import-icn {
    width:32px; height:32px; border-radius:9px; background:rgba(255,255,255,.2);
    display:flex; align-items:center; justify-content:center; flex-shrink:0;
  }
  .quick-import-icn svg { width:16px; height:16px; }
  .quick-import-title { display:block; font-size:.82rem; font-weight:700; }
  .quick-import-sub { display:block; font-size:.72rem; color:rgba(255,255,255,.85); margin-top:.05rem; line-height:1.3; }

  .main { flex:1; min-width:0; display:flex; flex-direction:column; }
  .topbar {
    display:flex; align-items:center; gap:1rem; padding:1rem 1.6rem;
    border-bottom:1px solid var(--border); background:var(--card);
  }
  .topbar form { flex:1; max-width:420px; }
  .topbar .search {
    display:flex; align-items:center; gap:.5rem; background:var(--bg);
    border:1px solid var(--border); border-radius:10px; padding:.5rem .8rem;
  }
  .topbar .search input {
    border:none; background:none; outline:none; font-size:.88rem; flex:1;
    font-family:inherit; color:var(--ink);
  }
  .topbar .search svg { width:15px; height:15px; color:var(--muted); flex-shrink:0; }
  .topbar .user { margin-left:auto; font-size:.85rem; color:var(--ink-soft); font-weight:500; }

  .content { padding:1.3rem 1.5rem; max-width:none; }

  h1.page-title { font-size:1.3rem; margin:0 0 .2rem; font-weight:700; }
  .order-count-badge {
    background:var(--brand-soft); color:var(--brand); font-size:.82rem; font-weight:700;
    padding:.15rem .6rem; border-radius:99px;
  }
  p.page-sub { color:var(--muted); margin:0 0 1.4rem; font-size:.9rem; }

  .flash {
    padding:.6rem .9rem; border-radius:10px; margin-bottom:1.1rem; font-size:.87rem;
    font-weight:500; white-space:pre-line;
  }
  .flash.ok { background:var(--ok-soft); color:var(--ok); }
  .flash.err { background:var(--bad-soft); color:var(--bad); }

  .stats { display:grid; grid-template-columns:repeat(4,1fr); gap:1rem; margin-bottom:1.6rem; }
  .stat-card {
    background:var(--card); border:1px solid var(--form-card-border); border-radius:var(--form-card-radius); box-shadow:var(--form-card-shadow);
    padding:1.1rem 1.2rem;
  }
  .stat-card .icn {
    width:32px; height:32px; border-radius:10px; display:flex; align-items:center;
    justify-content:center; margin-bottom:.7rem;
  }
  .stat-card .icn svg { width:16px; height:16px; }
  .stat-card .num { font-size:1.6rem; font-weight:700; line-height:1; margin-bottom:.25rem; }
  .stat-card .lbl { font-size:.82rem; color:var(--muted); font-weight:500; }

  /* карточки, подписи, поля и кнопки — общие настройки оформления из theme.css (--form-card-*, --label-*, --field-*, --btn-*, --action-*) */
  .card {
    background:var(--card); border:1px solid var(--form-card-border); border-radius:var(--form-card-radius); box-shadow:var(--form-card-shadow);
    padding:1.3rem 1.4rem;
  }
  .card + .card { margin-top:1.2rem; }
  .card h2 {
    font-size:.98rem; margin:0 0 1rem; font-weight:600; display:flex;
    align-items:center; justify-content:space-between; gap:1rem;
  }
  .card h2 a { font-size:.82rem; color:var(--brand); text-decoration:none; font-weight:500; }
  .card .toolbar { display:flex; gap:.6rem; align-items:center; }

  table { width:100%; border-collapse:collapse; }
  th { text-align:left; font-size:.76rem; text-transform:none; letter-spacing:.03em;
       color:var(--muted); font-weight:600; padding:.5rem .6rem; border-bottom:1px solid var(--border); }
  td { padding:.7rem .6rem; border-bottom:1px solid var(--border); font-size:.88rem; }
  tr:last-child td { border-bottom:none; }
  tr.rowlink:hover td { background:#fafafb; }

  .badge {
    display:inline-block; padding:.22rem .6rem; border-radius:99px; font-size:.78rem;
    font-weight:600;
  }
  .badge.status-active, .badge.status-done { background:var(--green); color:#FFFFFF; }
  .badge.status-inactive { background:var(--gray); color:#FFFFFF; }
  .badge.status-other, .badge.status-wait { background:var(--warn); color:#FFFFFF; }
  .badge.status-progress { background:var(--blue); color:#FFFFFF; }
  .badge.status-problem { background:var(--red); color:#FFFFFF; }
  .badge.src-native { background:var(--info-soft); color:var(--info); }
  .badge.src-sheets { background:var(--brand-soft); color:var(--brand); }

  .edit-link { color:var(--brand); text-decoration:none; font-weight:600; font-size:.85rem; }
  .name-link { color:var(--info); text-decoration:none; font-weight:600; }
  .name-link:hover { color:var(--brand); text-decoration:underline; }
  .edit-link:hover { text-decoration:underline; }

  form.stack label {
    display:block; margin:.9rem 0 .3rem; font-size:12px; font-weight:var(--label-fw); color:var(--muted);
  }
  form.stack input, form.stack select, form.stack textarea {
    width:100%; padding:var(--field-pad); border:1px solid var(--border-field); border-radius:var(--field-radius); box-shadow:var(--field-shadow);
    font-family:inherit; font-size:13px; line-height:1.4; outline:none; color:var(--ink); background:var(--card);
  }
  form.stack input[type="checkbox"], form.stack input[type="radio"] { width:auto; padding:0; box-shadow:none; accent-color:var(--accent); }
  form.stack input::placeholder, form.stack textarea::placeholder { color:var(--muted-3); }
  form.stack textarea { resize:vertical; min-height:70px; }
  form.stack input:hover, form.stack select:hover, form.stack textarea:hover { border-color:var(--muted-3); }
  form.stack input:focus, form.stack select:focus, form.stack textarea:focus { border-color:var(--accent); box-shadow:var(--field-focus-ring); }
  form.stack input:disabled, form.stack select:disabled { background:var(--surface-2); color:var(--muted); }

  .form-section { padding-top:1.4rem; margin-top:1.4rem; border-top:1px solid var(--border); }
  .form-section:first-of-type { padding-top:0; margin-top:0; border-top:none; }
  .form-section-title {
    display:flex; align-items:center; gap:.5rem; font-size:.95rem; font-weight:700;
    color:var(--ink); margin-bottom:.2rem;
  }
  .form-section-title .icn-badge {
    width:26px; height:26px; border-radius:10px; background:var(--brand-soft); color:var(--brand);
    display:flex; align-items:center; justify-content:center; flex-shrink:0;
  }
  .form-section-title .icn-badge svg { width:14px; height:14px; }
  .form-section-sub { font-size:.8rem; color:var(--muted); margin:.15rem 0 0 2.2rem; }
  .form-grid-2 { display:grid; grid-template-columns:1fr 1fr; gap:0 1rem; }
  .form-grid-2 > div { min-width:0; }
  .btn {
    margin-top:1.3rem; display:inline-flex; align-items:center; justify-content:center; gap:6px; box-sizing:border-box; height:calc(var(--btn-h) + 8px); padding:0 16px;
    border:1px solid var(--accent); border-radius:calc(var(--btn-radius) + 2px);
    background:var(--accent); color:#fff; font-size:13px; font-weight:600; line-height:1; cursor:pointer;
    font-family:inherit; text-decoration:none; white-space:nowrap;
  }
  .btn:hover { background:var(--accent-dark); border-color:var(--accent-dark); }
  .btn.secondary { background:var(--action-bg); color:var(--action-text); border:1px solid var(--action-border); box-shadow:var(--action-shadow); font-weight:var(--btn-fw); }
  .btn.secondary:hover { background:var(--action-hover-bg); border-color:var(--action-border); color:var(--action-hover-text); }
  .btn.small { margin-top:0; height:calc(var(--btn-h) + 4px); padding:0 12px; font-size:var(--btn-fs); }
  .btn:disabled { opacity:.45; cursor:default; }

  .empty { color:var(--muted); font-size:.88rem; padding:1rem 0; }
  .note { color:var(--muted); font-size:.82rem; margin-top:.4rem; }

  .login-wrap { min-height:100vh; display:flex; align-items:center; justify-content:center; background:var(--bg); }
  .login-card {
    background:var(--card); border:1px solid var(--form-card-border); border-radius:16px; box-shadow:0 10px 40px rgba(0,0,0,.08);
    padding:2.2rem 2rem; width:100%; max-width:360px;
  }
  .login-card .logo { display:flex; align-items:center; gap:.6rem; margin-bottom:1.6rem; }
  .login-card .logo .flame {
    width:34px; height:34px; border-radius:6px; background:var(--brand);
    display:flex; align-items:center; justify-content:center; font-size:17px;
  }
  .login-card .logo span { font-weight:700; font-size:1.15rem; }
  .login-card h1 { font-size:1.05rem; margin:0 0 1.2rem; font-weight:600; color:var(--ink-soft); }
  .login-card a { color:var(--accent); text-decoration:none; }
  .login-card a:hover { text-decoration:underline; }

  .role-pill {
    display:inline-block; padding:2px 9px; border-radius:999px; font-size:11.5px;
    font-weight:600; white-space:nowrap;
  }
  .role-pill.admin { background:var(--bad-soft); color:#b91c1c; }
  .role-pill.manager { background:var(--info-soft); color:var(--info); }
  .role-pill.client { background:var(--surface-3); color:var(--muted); }
  .role-pill.delivery { background:var(--warn-soft); color:#c77700; }

  .dash-grid { display:grid; grid-template-columns:2fr 1fr; gap:1.2rem; align-items:start; }
  .dash-two { display:grid; grid-template-columns:1fr 1fr; gap:1.2rem; margin-top:1.2rem; }
  .side-card { background:var(--card); border:1px solid var(--form-card-border); border-radius:var(--form-card-radius); box-shadow:var(--form-card-shadow);
               padding:1.2rem 1.3rem; }
  .side-card + .side-card { margin-top:1.2rem; }
  .side-card h3 { font-size:.9rem; margin:0 0 .9rem; font-weight:600; display:flex;
                  align-items:center; justify-content:space-between; }
  .side-card h3 a { font-size:.78rem; color:var(--brand); text-decoration:none; font-weight:500; }
  .attn-item { display:flex; gap:.6rem; padding:.55rem 0; border-bottom:1px solid var(--border); }
  .attn-item:last-child { border-bottom:none; }
  .attn-dot { width:8px; height:8px; border-radius:50%; margin-top:.35rem; flex-shrink:0; }
  .attn-dot.bad { background:var(--bad); }
  .attn-dot.warn { background:var(--warn); }
  .attn-title { font-size:.86rem; font-weight:500; }
  .attn-sub { font-size:.78rem; color:var(--muted); margin-top:.1rem; }
  .act-item { padding:.5rem 0; border-bottom:1px solid var(--border); font-size:.83rem; }
  .act-item:last-child { border-bottom:none; }
  .act-item b { font-weight:600; }
  .act-time { font-size:.74rem; color:var(--muted); margin-top:.1rem; }
  .qa-btn { display:flex; align-items:center; gap:.5rem; width:100%; padding:.55rem .8rem;
            border-radius:10px; border:1px solid var(--border); background:var(--card); color:var(--ink);
            font-size:.85rem; font-weight:500; text-decoration:none; margin-bottom:.5rem; }
  .qa-btn:hover { background:var(--bg); border-color:var(--brand); }
  .qa-btn svg { width:15px; height:15px; }
  .import-card { background:var(--brand); color:#fff; }
  .import-card h3 { color:#fff; gap:.5rem; justify-content:flex-start; }
  .import-card h3 svg { width:16px; height:16px; }
  .import-card p { font-size:.8rem; line-height:1.4; margin:0 0 .9rem; color:rgba(255,255,255,.9); }
  .import-card form { display:flex; flex-direction:column; gap:.5rem; }
  .import-card input { padding:.55rem .7rem; border-radius:8px; border:1px solid transparent;
                        font-size:.83rem; background:rgba(255,255,255,.95); color:var(--ink); }
  .import-card input:focus { outline:2px solid rgba(255,255,255,.6); }
  .import-card button { display:flex; align-items:center; justify-content:center; gap:.5rem;
                         padding:.55rem .8rem; border-radius:8px; border:none; background:var(--card);
                         color:var(--brand); font-size:.85rem; font-weight:700; cursor:pointer; }
  .import-card button:hover { background:var(--brand-soft); }
  .import-card button svg { width:15px; height:15px; }
  .avatar { width:30px; height:30px; border-radius:50%; background:var(--brand-soft); color:var(--brand);
            display:flex; align-items:center; justify-content:center; font-size:.8rem; font-weight:700; }
  .user-block { display:flex; align-items:center; gap:.6rem; }
  .topbar .user-block { margin-left:auto; }   /* справа и там, где поиска в полосе нет (иначе «Войти» прилипала к кнопке меню) */
  @media (max-width: 900px) { .dash-grid, .dash-two { grid-template-columns:1fr; } }

  table.admin-grid { font-size:.8rem; white-space:nowrap; }
  table.admin-grid th { white-space:nowrap; padding:.4rem .3rem; }
  table.admin-grid td { padding:.25rem .3rem; }
  input.mini {
    width:100px; padding:.3rem .4rem; border:1px solid var(--border-field); border-radius:var(--field-radius);
    font-family:inherit; font-size:.78rem; color:var(--ink); background:var(--card);
  }
  input.mini:focus { border-color:var(--accent); box-shadow:var(--field-focus-ring); outline:none; }
  input.mini[type="date"] { width:120px; }
  input.mini[type="number"] { }

  .order-tabs { display:flex; gap:.5rem; padding-bottom:1.2rem; flex-wrap:wrap; }
  .order-tab {
    display:inline-flex; align-items:center; gap:.4rem; padding:.5rem 1rem; border-radius:99px;
    background:var(--bg); color:var(--ink-soft); font-size:.85rem; font-weight:600; text-decoration:none;
  }
  .order-tab b { font-weight:700; }
  .order-tab.active { background:var(--brand); color:#fff; }
  .order-tab:not(.active):hover { background:#ececef; }

  table.orders-table { width:100%; border-collapse:collapse; }
  table.orders-table th {
    text-align:left; font-size:.74rem; text-transform:none; letter-spacing:.03em;
    color:var(--muted); font-weight:600; padding:.6rem .8rem; border-bottom:1px solid var(--border);
  }
  table.orders-table td { padding:.8rem .8rem; border-bottom:1px solid var(--border); font-size:.87rem; }
  table.orders-table tr:last-child td { border-bottom:none; }
  table.orders-table tr.rowlink { border-left:3px solid transparent; }
  table.orders-table tr.rowlink:hover td { background:#fafafb; }
  table.orders-table tr.status-progress { box-shadow: inset 3px 0 0 var(--warn); }
  table.orders-table tr.status-done { box-shadow: inset 3px 0 0 var(--ok); }
  table.orders-table tr.status-problem { box-shadow: inset 3px 0 0 var(--bad); }

  .status-select {
    padding:.3rem .6rem; border-radius:99px; border:none; font-family:inherit; font-size:.78rem;
    font-weight:600; cursor:pointer;
  }
  .status-select-progress { background:var(--warn-soft); color:var(--warn); }
  .status-select-done { background:var(--ok-soft); color:var(--ok); }
  .status-select-problem { background:var(--bad-soft); color:var(--bad); }
  .status-select-other { background:var(--surface-3); color:var(--muted); }

  .pager { display:flex; align-items:center; justify-content:space-between; padding-top:.8rem; flex-wrap:wrap; gap:.6rem; }
  .pager-info { font-size:.82rem; color:var(--muted); }
  .pager-pages { display:flex; gap:.3rem; align-items:center; }
  .page-link {
    display:inline-flex; align-items:center; justify-content:center; min-width:28px; height:28px;
    padding:0 .4rem; border-radius:8px; text-decoration:none; color:var(--ink-soft); font-size:.82rem;
  }
  .page-link:hover { background:var(--bg); }
  .page-link.active { background:var(--brand); color:#fff; font-weight:600; }

  /* ===== Мобильная версия общей оболочки (телефоны) ===== */
  .hamburger { display:none; align-items:center; justify-content:center; width:36px; height:36px; flex:0 0 36px; border:1px solid var(--border); border-radius:9px; background:var(--card); color:var(--muted); cursor:pointer; padding:0; }
  .sidebar-overlay { display:none; position:fixed; inset:0; background:rgba(0,0,0,.4); z-index:40; }
  .sidebar-overlay.open { display:block; }
  .clients-cards { display:none; }
  @media (max-width: 640px) {
    .hamburger { display:flex; }
    .sidebar { position:fixed; top:0; left:0; height:100vh; height:100dvh; z-index:50; width:250px; transform:translateX(-100%); transition:transform .2s ease; overflow-y:auto; }
    .sidebar.open { transform:translateX(0); }
    .topbar { padding:.6rem .8rem; gap:.6rem; position:sticky; top:0; z-index:30; }
    .topbar form { max-width:none; min-width:0; }
    .topbar .search { padding:.4rem .6rem; }
    .topbar .user-block .user { display:none; }
    .topbar .user { display:none; }
    .content { padding:.9rem .8rem 2rem; }
    .page-title { font-size:1.25rem; }
    .card { padding:1rem .9rem; }
    /* список клиентов: вместо широкой таблицы — компактные строки, нажатие открывает карточку */
    .cc-row { display:flex; align-items:center; gap:.7rem; padding:.75rem .1rem; border-bottom:1px solid var(--border); text-decoration:none; color:inherit; }
    .cc-row:last-child { border-bottom:none; }
    .cc-main { flex:1; min-width:0; }
    .cc-name { font-weight:700; font-size:.95rem; color:var(--ink); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
    .cc-sub { font-size:.78rem; color:var(--muted); margin-top:.15rem; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
    .cc-side { display:flex; flex-direction:column; align-items:flex-end; gap:.3rem; flex:0 0 auto; }
    .cc-arrow { color:#B7BCC6; font-size:1.1rem; }
    .card form.stack input, .card form.stack select { font-size:16px; }   /* iOS не приближает страницу при вводе */
  }

  /* Мобильные таблицы-списки остаются таблицами (table-mobile.css), здесь только шапки карточек */
  @media (max-width: 640px) {
    .card h2 { flex-wrap:wrap; }
    .card .toolbar { flex-wrap:wrap; }
  }
  .card h2 a.btn, .card h2 a.btn:hover { color:#fff; }
  .card h2 a.btn.secondary { color:var(--ink); }

  /* Планшет: широкие таблицы прокручиваются внутри карточки, а не растягивают страницу */
  @media (max-width: 1024px) { .card { overflow-x:auto; } }
