/* =====================================================================
     Фирменный стиль «Останкино» / АО «ОМПК»
     Бордовый  Pantone 202 C  #8A2432   ·  Жёлтый  Pantone 109 C  #FFDD00
     Шрифт TT Firs Neue (веб-подмена: Onest / Golos Text / Montserrat)
     Модуль сетки — 40 px: внешние поля равны внутренним отступам.
     ===================================================================== */
  :root{
    --bordo:#8A2432;
    --bordo-dark:#6E1B27;
    --bordo-soft:#F5EAEC;
    --yellow:#FFDD00;
    --yellow-deep:#E8C900;
    --yellow-tint:#FFFCE6;

    --ink:#191919;
    --ink-2:#3D3D3D;
    --muted:#6E6E6E;
    --muted-2:#9B9B9B;

    --bg:#F1F1F1;
    --surface:#FFFFFF;
    --surface-soft:#F7F7F7;
    --neutral:#EBEBEB;
    --line:#E6E6E6;
    --line-strong:#D4D4D4;

    --radius:22px;
    --radius-md:16px;
    --radius-sm:11px;
    --pill:999px;
    --shadow:0 1px 2px rgba(25,25,25,.04), 0 10px 28px rgba(25,25,25,.055);
    --font:'TT Firs Neue','TT Firs Neue Trial','Onest','Golos Text','Montserrat',
           -apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;
  }
  *{box-sizing:border-box; margin:0; padding:0;}
  html{scroll-behavior:smooth;}
  body{
    background:var(--bg);
    color:var(--ink);
    font-family:var(--font);
    font-size:15px;
    line-height:1.45;
    min-height:100vh;
    -webkit-font-smoothing:antialiased;
    -moz-osx-font-smoothing:grayscale;
  }

  /* Фирменный шрифт TT Firs Neue. Подхватывается автоматически, если установлен
     в системе. Чтобы он был у всех — положите .woff2 в папку fonts/ рядом с файлом. */
  @font-face{font-family:'TT Firs Neue'; font-style:normal; font-weight:400; font-display:swap;
    src:local('TT Firs Neue Regular'), local('TTFirsNeue-Regular'), url('fonts/TTFirsNeue-Regular.woff2') format('woff2');}
  @font-face{font-family:'TT Firs Neue'; font-style:normal; font-weight:500; font-display:swap;
    src:local('TT Firs Neue Medium'), local('TTFirsNeue-Medium'), url('fonts/TTFirsNeue-Medium.woff2') format('woff2');}
  @font-face{font-family:'TT Firs Neue'; font-style:normal; font-weight:600; font-display:swap;
    src:local('TT Firs Neue DemiBold'), local('TTFirsNeue-DemiBold'), url('fonts/TTFirsNeue-DemiBold.woff2') format('woff2');}
  @font-face{font-family:'TT Firs Neue'; font-style:normal; font-weight:700; font-display:swap;
    src:local('TT Firs Neue Bold'), local('TTFirsNeue-Bold'), url('fonts/TTFirsNeue-Bold.woff2') format('woff2');}

  /* Веб-подмена: Onest (вариативный, кириллица + латиница), размещён локально. */
  @font-face{font-family:'Onest';font-style:normal;font-weight:400 700;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 700;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;}

  /* ---------- Фирменный знак ---------- */
  .logo-mark{display:block; flex:0 0 auto;}
  .logo-mark .lm-d{fill:var(--bordo);}
  .logo-mark .lm-n{stroke:var(--yellow);}
  .on-bordo .logo-mark .lm-d{fill:var(--yellow);}
  .on-bordo .logo-mark .lm-n{stroke:var(--bordo);}
  .brand{display:flex; align-items:center; gap:6px;}
  .brand-word{
    font-size:19px; font-weight:700; letter-spacing:.005em;
    color:var(--bordo); line-height:1; white-space:nowrap;
  }
  .on-bordo .brand-word{color:#fff;}

  /* ---------- Тройная волна (только правый нижний угол) ---------- */
  .waves{
    position:absolute; right:0; bottom:0;
    pointer-events:none; user-select:none;
  }
  .waves path{fill:none; stroke:var(--yellow); stroke-width:30; stroke-linecap:round;}

  /* ---------- Шапка ---------- */
  .topbar{
    background:var(--surface);
    border-bottom:1px solid var(--line);
  }
  .topbar-inner{max-width:1160px; margin:0 auto; padding:22px 28px 0;}
  /* Бренд-блок: логотип в левом верхнем углу — как предписывает брендбук */
  .brand-bar{background:var(--bordo);}
  .brand-bar-inner{
    max-width:1160px; margin:0 auto; padding:11px 28px;
    display:flex; align-items:center; gap:14px; flex-wrap:wrap;
  }
  .brand-sep{width:1px; height:20px; background:rgba(255,255,255,.22);}
  .brand-unit{
    font-size:11.5px; letter-spacing:.16em; text-transform:uppercase;
    color:rgba(255,255,255,.74); font-weight:600;
  }
  .brand-bar .user-box{margin-left:auto;}
  .brand-bar .btn{background:transparent; border-color:rgba(255,255,255,.34); color:#fff;}
  .brand-bar .btn:hover{background:rgba(255,255,255,.13); border-color:#fff; color:#fff;}
  .brand-bar .user-chip{
    background:rgba(255,255,255,.1); border-color:rgba(255,255,255,.22); color:#fff;
  }
  .brand-bar .user-chip .role{color:rgba(255,255,255,.66);}
  .eyebrow{
    font-size:11.5px; letter-spacing:.16em; text-transform:uppercase;
    color:var(--muted); font-weight:600;
  }
  .title-row{
    display:flex; flex-wrap:wrap; gap:18px;
    align-items:flex-end; justify-content:space-between;
    margin-top:16px;
  }
  h1{
    font-size:clamp(25px,3.1vw,35px);
    font-weight:700; line-height:1.08; letter-spacing:-.015em;
    color:var(--ink);
  }
  /* Плашка акцента: всегда жёлтая, скругление — капсула, отбивка пробелами */
  .accent{
    display:inline-block;
    background:var(--yellow); color:var(--bordo);
    border-radius:var(--pill);
    padding:.06em .42em .12em;
    margin:0 .04em;
  }
  .subtitle{color:var(--muted); margin-top:7px; font-size:14px;}

  .global-stats{display:flex; gap:8px; align-items:center; flex-wrap:wrap;}
  .stat-chip{
    display:inline-flex; align-items:center; gap:7px;
    border-radius:var(--pill); padding:7px 14px;
    font-size:14px; font-weight:700; line-height:1;
  }
  .stat-chip .st-ic{width:15px; height:15px;}
  .stat-chip.done{background:var(--bordo); color:#fff;}
  .stat-chip.progress{background:var(--yellow); color:var(--bordo);}
  .stat-chip.plan{background:var(--neutral); color:var(--ink-2);}

  .toolbar{
    display:flex; gap:8px; flex-wrap:wrap; align-items:center;
    margin-top:18px; padding-bottom:16px;
  }
  .btn{
    font-family:var(--font);
    font-size:13.5px; font-weight:600; line-height:1;
    border:1px solid var(--line-strong); border-radius:var(--pill);
    background:var(--surface); color:var(--ink);
    padding:9px 16px; cursor:pointer;
    transition:background .15s, border-color .15s, color .15s;
  }
  .btn{display:inline-flex; align-items:center; gap:7px;}
  .b-ic{width:15px; height:15px; flex:0 0 auto;}
  .btn:hover{border-color:var(--bordo); color:var(--bordo);}
  .btn.primary{background:var(--bordo); border-color:var(--bordo); color:#fff;}
  .btn.primary:hover{background:var(--bordo-dark); border-color:var(--bordo-dark); color:#fff;}
  .btn.active-edit{background:var(--bordo); border-color:var(--bordo); color:#fff;}
  .btn.active-edit:hover{background:var(--bordo-dark); color:#fff;}

  .hidden-input{display:none;}
  .save-state{
    font-size:12.5px; font-weight:600; color:var(--muted);
    display:inline-flex; align-items:center; gap:6px; min-height:18px;
  }
  .save-state::before{content:''; width:7px; height:7px; border-radius:50%; background:currentColor;}
  .save-state:empty{display:none;}
  .save-state.pending{color:var(--muted);}
  .save-state.ok{color:var(--bordo);}
  .save-state.err{color:var(--bordo); font-weight:700;}

  .legend{margin-left:auto; display:flex; gap:16px; flex-wrap:wrap; align-items:center;}
  .legend span{
    display:inline-flex; align-items:center; gap:6px;
    white-space:nowrap; font-size:12.5px; color:var(--muted); font-weight:500;
  }
  .legend .lg-m{
    width:20px; height:20px; border-radius:7px;
    display:inline-flex; align-items:center; justify-content:center;
  }
  .legend .lg-m .st-ic{width:12px; height:12px;}
  .lg-done{background:var(--bordo); color:#fff;}
  .lg-progress{background:var(--yellow); color:var(--bordo);}
  .lg-plan{background:var(--neutral); color:var(--muted);}

  /* ---------- Закладки ---------- */
  .tabs-wrap{
    position:sticky; top:0; z-index:30;
    background:var(--surface);
    border-bottom:1px solid var(--line);
  }
  .tabs{
    max-width:1160px; margin:0 auto;
    display:flex; gap:4px; overflow-x:auto;
    padding:10px 28px; scrollbar-width:thin;
  }
  .tab{
    flex:0 0 auto;
    display:flex; align-items:center; gap:8px;
    padding:9px 15px;
    font-size:14px; font-weight:600; color:var(--ink-2);
    font-family:var(--font);
    border:none; background:none; cursor:pointer;
    border-radius:var(--pill);
    transition:background .15s, color .15s;
    white-space:nowrap;
  }
  .tab:hover{background:var(--surface-soft); color:var(--ink);}
  .tab.active{background:var(--bordo); color:#fff;}
  .tab.active:hover{background:var(--bordo);}
  .tab .t-icon{font-size:15px; line-height:1;}

  /* ---------- Контент ---------- */
  .content{max-width:1160px; margin:0 auto; padding:30px 28px 40px;}
  .tab-head{display:flex; flex-wrap:wrap; align-items:center; gap:18px;}
  .tab-title{
    font-size:26px; font-weight:700; letter-spacing:-.01em; color:var(--ink);
  }
  .tab-index{
    margin-left:auto; align-self:flex-start;
    font-size:46px; font-weight:400; line-height:1;
    color:#DCDCDC; letter-spacing:.02em;
  }
  .tab-progress{
    flex:1 1 240px; min-width:200px; max-width:360px;
    display:flex; flex-direction:column; gap:7px;
  }
  .bar{
    height:10px; border-radius:var(--pill); overflow:hidden; display:flex;
    background:var(--neutral);
  }
  .bar i{display:block; height:100%;}
  .bar .b-done{background:var(--bordo);}
  .bar .b-progress{background:var(--yellow);}
  .bar .b-plan{background:#DCDCDC;}
  .bar-caption{
    font-size:12.5px; color:var(--muted);
    display:flex; align-items:center; gap:7px; flex-wrap:wrap;
  }
  .bar-caption b{color:var(--ink-2); font-weight:700;}
  .bar-caption .st-ic{width:12px; height:12px;}
  .cap-m{
    width:19px; height:19px; border-radius:6px;
    display:inline-flex; align-items:center; justify-content:center;
  }

  /* ---------- Закладки внутри вкладки ---------- */
  .subtabs{
    display:flex; gap:6px; flex-wrap:wrap;
    margin-top:20px; padding-bottom:2px;
    border-bottom:1px solid var(--line);
  }
  .subtab{
    border:none; background:none; cursor:pointer;
    font-family:var(--font); font-size:14px; font-weight:600;
    color:var(--muted); padding:9px 14px 10px;
    border-bottom:3px solid transparent;
    margin-bottom:-1px;
    transition:color .15s, border-color .15s;
  }
  .subtab:hover{color:var(--ink);}
  .subtab.active{color:var(--bordo); border-bottom-color:var(--bordo);}
  .subtab-open{
    margin-left:auto; align-self:center;
    font-size:13px; font-weight:600; color:var(--muted);
    text-decoration:none; padding:6px 2px;
  }
  .subtab-open:hover{color:var(--bordo);}

  /* ---------- Встроенный дашборд ---------- */
  .section-embed .section-head .btn.sm{margin-left:10px; text-decoration:none;}
  .embed-frame{
    position:relative; background:var(--surface);
    min-height:260px;
  }
  .embed-frame::after{
    content:'Загружаю дашборд…';
    position:absolute; inset:0;
    display:flex; align-items:center; justify-content:center;
    color:var(--muted); font-size:14px; font-weight:600;
    background:var(--surface);
  }
  .embed-frame.ready::after{display:none;}
  /* Встроенные дашборды свёрстаны под десктоп: на узком экране не сжимаем их
     до нечитаемого, а даём прокрутить контейнер по горизонтали. */
  .embed-frame{overflow-x:auto; -webkit-overflow-scrolling:touch;}
  .embed-frame iframe{
    display:block; width:100%; min-width:600px; border:0;
    height:640px; background:var(--surface);
  }

  /* ---------- Перестановка разделов и вкладок ---------- */
  .sec-handle{
    flex:0 0 auto; color:var(--muted-2); cursor:grab;
    font-size:14px; line-height:1; user-select:none; padding:0 2px 0 0;
  }
  .sec-handle:hover{color:var(--bordo);}
  .sec-handle:active{cursor:grabbing;}
  .sec-move{flex:0 0 auto; display:flex; gap:3px; margin-left:10px;}
  .section.dragging{opacity:.45;}
  .section.sec-drop-top{box-shadow:inset 0 4px 0 var(--bordo);}
  .section.sec-drop-bottom{box-shadow:inset 0 -4px 0 var(--bordo);}
  .tab-move{display:flex; gap:4px; margin-left:12px;}
  .move-btn.wide{width:28px; height:22px; font-size:10px;}

  .view[hidden]{display:none;}

  .sections{display:flex; flex-direction:column; gap:20px; margin-top:22px;}
  .section{
    background:var(--surface);
    border:1px solid var(--line);
    border-radius:var(--radius);
    box-shadow:var(--shadow);
    overflow:hidden;
  }
  .section-head{
    display:flex; align-items:center; gap:12px;
    padding:16px 22px 15px;
    border-bottom:1px solid var(--line);
  }
  .section-head::before{
    content:""; flex:0 0 auto;
    width:5px; height:22px; border-radius:3px;
    background:var(--bordo);
  }
  .section-title{font-size:17px; font-weight:700; letter-spacing:-.005em;}
  .section-kind{
    font-size:11px; letter-spacing:.14em; text-transform:uppercase;
    color:var(--muted); font-weight:700;
    margin-left:auto;
  }

  /* ---------- Строки ---------- */
  .items{display:flex; flex-direction:column;}
  .item{
    display:flex; align-items:flex-start; gap:13px;
    padding:12px 22px;
    border-bottom:1px solid #F2F2F2;
    transition:background .12s;
  }
  .item:last-child{border-bottom:none;}
  .item:hover{background:var(--surface-soft);}

  .p-marker{
    flex:0 0 auto; margin-top:1px;
    width:30px; height:30px; border-radius:9px;
    display:flex; align-items:center; justify-content:center;
  }
  .p-marker .st-ic{width:16px; height:16px;}
  .item.s-done .p-marker{background:var(--bordo); color:#fff;}
  .item.s-progress .p-marker{background:var(--yellow); color:var(--bordo);}
  .item.s-plan .p-marker{background:var(--neutral); color:var(--muted);}

  .p-text{flex:1 1 auto; padding-top:5px; color:var(--ink-2);}
  .item.s-done .p-text{color:var(--ink);}

  .status-toggle{
    flex:0 0 auto; display:flex; gap:3px;
    background:var(--surface-soft);
    border:1px solid var(--line);
    border-radius:12px; padding:3px;
  }
  .status-btn{
    border:none; background:none; cursor:pointer;
    width:34px; height:28px; border-radius:9px;
    display:flex; align-items:center; justify-content:center; gap:7px;
    color:var(--muted-2);
    font-family:var(--font); font-size:12.5px; font-weight:600;
    transition:background .15s, color .15s;
  }
  .status-btn .st-ic{width:15px; height:15px; flex:0 0 auto;}
  .status-btn:hover{color:var(--ink-2);}
  .status-btn.on.sb-done{background:var(--bordo); color:#fff;}
  .status-btn.on.sb-progress{background:var(--yellow); color:var(--bordo);}
  .status-btn.on.sb-plan{background:var(--neutral); color:var(--ink-2);}
  .status-toggle.ro .status-btn{width:auto; padding:0 11px 0 9px;}

  /* ---------- Метрики ---------- */
  .m-marker{
    flex:0 0 auto; margin-top:4px;
    width:30px; height:30px; border-radius:9px;
    background:var(--bordo-soft);
    display:flex; align-items:center; justify-content:center;
  }
  .rhomb{
    width:10px; height:10px; border-radius:2.5px;
    background:var(--bordo); transform:rotate(45deg);
  }
  .m-name{flex:1 1 auto; padding-top:6px;}
  .m-name-text{font-weight:500;}
  .m-target{display:block; font-size:12.5px; color:var(--muted); margin-top:3px;}
  .m-field{flex:0 0 auto; display:flex; align-items:center; gap:9px;}
  .m-input{
    width:118px; text-align:right;
    font-family:var(--font); font-size:15px; font-weight:700;
    color:var(--bordo);
    background:var(--surface-soft);
    border:1px solid var(--line); border-radius:12px;
    padding:8px 12px;
    transition:background .15s, border-color .15s;
  }
  /* Заполненный показатель — жёлтая плашка (как в шаблоне «Метрики, цифры») */
  .m-input:not(:placeholder-shown){background:var(--yellow); border-color:var(--yellow);}
  .m-input:focus{outline:2px solid var(--bordo); outline-offset:1px; border-color:var(--bordo);}
  .m-input::placeholder{color:var(--muted-2); font-weight:500;}
  .m-unit{font-size:13px; color:var(--muted); min-width:50px;}

  /* ---------- Важные строки и порядок ---------- */
  .item.important{background:var(--yellow-tint); box-shadow:inset 4px 0 0 var(--yellow);}
  .item.important:hover{background:#FFF9D6;}
  .item.important .p-text,
  .item.important .m-name-text{font-weight:700; color:var(--ink);}
  .star-btn{
    flex:0 0 auto; margin-top:5px;
    width:26px; height:24px;
    border:none; background:none; cursor:pointer;
    font-size:15px; line-height:1;
    color:var(--muted-2); opacity:.55;
    transition:opacity .15s, color .15s, transform .1s;
  }
  .star-btn:hover{opacity:1; transform:scale(1.14); color:var(--yellow-deep);}
  .star-btn.on{opacity:1; color:var(--yellow-deep);}
  .ro-star{
    flex:0 0 auto; margin-top:5px; width:26px; text-align:center;
    font-size:15px; line-height:1; color:var(--yellow-deep);
  }
  .ro-star:empty{display:none;}
  .drag-handle{
    flex:0 0 auto; margin-top:7px;
    color:var(--muted-2); cursor:grab;
    font-size:13px; line-height:1; user-select:none; padding:0 1px;
  }
  .drag-handle:hover{color:var(--bordo);}
  .drag-handle:active{cursor:grabbing;}
  .item.dragging{opacity:.45;}
  .item.drag-top{box-shadow:inset 0 3px 0 var(--bordo);}
  .item.drag-bottom{box-shadow:inset 0 -3px 0 var(--bordo);}
  .item.important.drag-top{box-shadow:inset 0 3px 0 var(--bordo), inset 4px 0 0 var(--yellow);}
  .item.important.drag-bottom{box-shadow:inset 0 -3px 0 var(--bordo), inset 4px 0 0 var(--yellow);}
  .move-btns{flex:0 0 auto; display:flex; flex-direction:column; gap:3px; margin-top:3px;}
  .move-btn{
    width:23px; height:15px;
    border:1px solid var(--line-strong); background:var(--surface);
    border-radius:5px; font-size:8px; color:var(--muted); cursor:pointer;
    display:flex; align-items:center; justify-content:center; line-height:1; padding:0;
  }
  .move-btn:hover{color:var(--bordo); border-color:var(--bordo);}
  .bin-icon{display:block;}

  /* ---------- Режим правки ---------- */
  [contenteditable="true"]{
    outline:1.5px dashed var(--line-strong);
    outline-offset:3px; border-radius:4px;
    cursor:text; min-width:40px;
  }
  [contenteditable="true"]:focus{outline:1.5px solid var(--bordo);}
  .del-btn{
    flex:0 0 auto; margin-top:4px;
    width:25px; height:25px; border-radius:8px;
    border:1px solid var(--line-strong);
    background:var(--surface); color:var(--muted);
    font-size:14px; line-height:1; cursor:pointer;
  }
  .del-btn:hover{background:var(--bordo-soft); color:var(--bordo); border-color:var(--bordo);}
  .add-row{padding:12px 22px; border-top:1px dashed var(--line);}
  .add-btn{
    border:1px dashed var(--line-strong); background:none;
    color:var(--muted); font-size:13px; font-weight:600;
    padding:8px 15px; border-radius:var(--pill); cursor:pointer;
    font-family:var(--font);
  }
  .add-btn:hover{color:var(--bordo); border-color:var(--bordo); background:var(--bordo-soft);}
  .add-section-wrap{margin-top:16px;}
  .edit-hint{
    background:var(--yellow-tint);
    border:1px solid #F2E39A;
    color:#6B5A12;
    border-radius:var(--radius-md); padding:12px 18px; font-size:13px;
    margin-top:18px;
  }

  /* ---------- Авторизация ---------- */
  body:not(.authed) .topbar,
  body:not(.authed) .tabs-wrap,
  body:not(.authed) .content,
  body:not(.authed) .page-footer{display:none;}
  body.authed .auth-screen{display:none;}
  .auth-screen{
    position:fixed; inset:0; z-index:200;
    background:var(--bordo);
    overflow:hidden;
    display:flex; align-items:center; justify-content:center; padding:24px;
  }
  .auth-screen::before{
    content:""; position:absolute; inset:0;
    background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='88' height='88'%3E%3Crect x='24' y='24' width='40' height='40' rx='12' transform='rotate(45 44 44)' fill='none' stroke='%23ffffff' stroke-opacity='0.06' stroke-width='2'/%3E%3C/svg%3E");
    background-size:88px 88px;
  }
  .auth-screen .waves{width:min(58vw,560px); height:min(58vw,560px);}
  .auth-brand{
    position:absolute; top:34px; left:38px;
    display:flex; align-items:center; gap:6px; z-index:2;
  }
  .auth-copy{
    position:absolute; left:38px; bottom:32px; z-index:2;
    font-size:12.5px; color:rgba(255,255,255,.74);
  }
  .auth-card{
    position:relative; z-index:2;
    width:100%; max-width:420px;
    background:var(--surface);
    border-radius:var(--radius);
    box-shadow:0 24px 60px rgba(0,0,0,.28);
    padding:32px 30px;
  }
  .auth-card .eyebrow{margin-bottom:10px;}
  .auth-card h2{
    font-size:25px; font-weight:700; line-height:1.12;
    letter-spacing:-.015em; margin-bottom:6px;
  }
  .auth-card .auth-note{color:var(--muted); font-size:13.5px; margin-bottom:22px;}
  .auth-card .btn{width:100%; padding:12px; font-size:14.5px; margin-top:4px;}

  .field{display:block; margin-bottom:14px;}
  .field > span{
    display:block; font-size:12px; font-weight:600; letter-spacing:.04em;
    text-transform:uppercase; color:var(--muted); margin-bottom:6px;
  }
  .field input{
    width:100%; font-family:var(--font); font-size:14.5px;
    padding:11px 14px; color:var(--ink);
    background:var(--surface-soft);
    border:1px solid var(--line); border-radius:12px;
  }
  .field input:focus{outline:2px solid var(--bordo); outline-offset:1px; border-color:var(--bordo);}
  .form-error{color:var(--bordo); font-size:13px; min-height:19px; font-weight:600;}

  /* ---------- Пользователь в шапке ---------- */
  .user-box{display:flex; align-items:center; gap:8px; flex-wrap:wrap; margin-left:16px;}
  .user-chip{
    display:inline-flex; align-items:center; gap:7px;
    background:var(--surface-soft); border:1px solid var(--line);
    border-radius:var(--pill); padding:7px 14px;
    font-size:13.5px; font-weight:700; line-height:1;
  }
  .user-chip .role{color:var(--muted); font-weight:500;}

  /* ---------- Модальное окно ---------- */
  .modal-back{
    position:fixed; inset:0; z-index:150;
    background:rgba(25,25,25,.44);
    display:flex; align-items:flex-start; justify-content:center;
    padding:56px 18px 24px; overflow:auto;
  }
  .modal-back[hidden]{display:none;}
  .modal{
    width:100%; max-width:540px;
    background:var(--surface);
    border-radius:var(--radius);
    box-shadow:0 24px 60px rgba(25,25,25,.3);
    padding:26px 28px 28px;
  }
  .modal-head{display:flex; align-items:center; gap:12px; margin-bottom:16px;}
  .modal-title{font-size:21px; font-weight:700; letter-spacing:-.01em;}
  .modal-close{
    margin-left:auto; border:none; background:none; cursor:pointer;
    font-size:22px; line-height:1; color:var(--muted); padding:2px 4px;
  }
  .modal-close:hover{color:var(--bordo);}
  .modal-sub{
    font-size:11px; letter-spacing:.14em; text-transform:uppercase;
    color:var(--muted); font-weight:700; margin:22px 0 10px;
  }
  .user-row{
    display:flex; align-items:center; gap:10px; flex-wrap:wrap;
    padding:11px 0; border-bottom:1px solid var(--line);
  }
  .user-row:last-of-type{border-bottom:none;}
  .user-row .u-login{font-weight:700;}
  .user-row .u-actions{margin-left:auto; display:flex; gap:6px;}
  .role-badge{
    font-size:10.5px; letter-spacing:.1em; text-transform:uppercase; font-weight:700;
    padding:4px 10px; border-radius:var(--pill);
  }
  .role-badge.admin{background:var(--bordo); color:#fff;}
  .role-badge.viewer{background:var(--neutral); color:var(--ink-2);}
  .btn.sm{padding:6px 12px; font-size:12.5px;}
  .btn.danger:hover{background:var(--bordo-soft); border-color:var(--bordo); color:var(--bordo);}
  .inline-form{
    flex:1 1 100%; display:flex; gap:8px; align-items:center;
    padding:9px 0 2px; flex-wrap:wrap;
  }
  .inline-form input{
    flex:1 1 170px; font-family:var(--font); font-size:13.5px;
    padding:9px 12px; background:var(--surface-soft);
    border:1px solid var(--line); border-radius:11px; color:var(--ink);
  }
  .inline-form input:focus{outline:2px solid var(--bordo); outline-offset:1px;}

  /* ---------- Подвал ---------- */
  .page-footer{
    position:relative; overflow:hidden;
    background:var(--bordo); color:#fff;
    margin-top:24px;
  }
  .page-footer .waves{width:340px; height:340px;}
  .footer-inner{
    position:relative; z-index:2;
    max-width:1160px; margin:0 auto;
    padding:30px 28px 34px;
    display:flex; align-items:center; gap:18px; flex-wrap:wrap;
    min-height:132px;
  }
  .footer-copy{font-size:13px; color:rgba(255,255,255,.78);}
  .footer-brand{margin-bottom:10px;}

  /* ---------- Уведомление ---------- */
  ::selection{background:var(--yellow); color:var(--bordo);}
  .btn:focus-visible,.tab:focus-visible,.status-btn:focus-visible,.star-btn:focus-visible,
  .move-btn:focus-visible,.del-btn:focus-visible,.add-btn:focus-visible,
  .modal-close:focus-visible,.drag-handle:focus-visible{
    outline:2px solid var(--bordo); outline-offset:2px;
  }
  .brand-bar .btn:focus-visible,.tab.active:focus-visible{outline-color:var(--yellow);}

  .toast{
    position:fixed; bottom:24px; left:50%; transform:translateX(-50%) translateY(8px);
    background:var(--bordo); color:#fff;
    padding:11px 22px; border-radius:var(--pill); font-size:13.5px; font-weight:600;
    opacity:0; pointer-events:none; transition:opacity .25s, transform .25s;
    z-index:99; box-shadow:0 10px 30px rgba(138,36,50,.32);
  }
  .toast.show{opacity:1; transform:translateX(-50%) translateY(0);}

  @media (max-width:820px){
    .legend{display:none;}
    .user-box{margin-left:auto;}
  }
  @media (max-width:680px){
    .topbar-inner{padding:18px 16px 0;}
    .brand-bar-inner{padding:10px 16px;}
    .brand-sep,.brand-unit{display:none;}
    .tabs{padding:8px 12px;}
    .content{padding:22px 16px 32px;}
    .footer-inner{padding:26px 16px 30px;}
    .auth-brand{top:24px; left:22px;}
    .auth-copy{left:22px; bottom:22px;}
    .item{flex-wrap:wrap;}
    /* текст остаётся на одной строке с маркером, на вторую уходит только поле */
    .p-text,.m-name{flex:1 1 140px; min-width:0;}
    .status-toggle{margin-left:43px;}
    .m-field{margin-left:43px;}
    .tab-index{display:none;}
    .section-head{padding:14px 16px;}
    .item{padding:12px 16px;}
    .add-row{padding:12px 16px;}
  }
  @media print{
    .toolbar,.tabs-wrap,.status-toggle .status-btn:not(.on),.del-btn,.add-row,
    .add-section-wrap,.edit-hint,.auth-screen,.modal-back,.waves,.subtabs,.embed-frame,
    .drag-handle,.move-btns,.star-btn{display:none !important;}
    body{background:#fff;}
    .section{box-shadow:none; break-inside:avoid;}
    .page-footer{margin-top:16px;}
    /* Встроенный дашборд на печати обрезался бы по первому экрану —
       вместо него печатаем ссылку, где его открыть целиком. */
    .section-embed::after{
      content:'Встроенный дашборд доступен на сайте: itompk.kipon.tech';
      display:block; padding:18px 22px; color:#6E6E6E; font-size:12.5px;
    }
  }
