

  :root {

    --accent: #ce4f08;

    --accent-strong: #b04005;

    --accent-soft: #f9743a;

    --accent-tint: rgba(206,79,8,0.10);

    --accent-ring: rgba(206,79,8,0.22);



    /* Типографика */

    --font-ui: 'Manrope', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

    --font-mono: 'Manrope', 'SF Mono', 'Menlo', 'Consolas', monospace;



    --bg-light: #f3f4f6;

    --bg-dark: #020617;



    --card-light: #ffffff;

    --card-dark: #020617;



    --border-light: #e5e7eb;

    --border-dark: #1f2937;



    --text-light: #0f172a;

    --text-dark: #e5e7eb;



    --muted-light: #6b7280;

    --muted-dark: #9ca3af;



    --shadow-soft: 0 18px 45px rgba(15,23,42,.14);

    --shadow-strong: 0 24px 60px rgba(15,23,42,.40);



    --radius-lg: 18px;

    --radius-md: 12px;

    --radius-sm: 8px;



    --sidebar-width: 260px;



    --sch-header-bg-light: #f9fafb;

    --sch-header-bg-dark: #020617;

    --sch-weekend-bg-light: #fee2e2;

    --sch-weekend-bg-dark: #4b1d1d;



    --sch-cell-bg-light: #ffffff;

    --sch-cell-bg-alt-light: #f9fafb;

    --sch-cell-bg-dark: #020617;

    --sch-cell-bg-alt-dark: #020617;

  }



  * {

    box-sizing: border-box;

  }



  html, body {

    margin: 0;

    padding: 0;

    height: 100%;

  }



  body {

    font-family: var(--font-ui);

    font-size: 13px;

    line-height: 1.45;

    -webkit-font-smoothing: antialiased;

    -moz-osx-font-smoothing: grayscale;

    text-rendering: optimizeLegibility;

    font-feature-settings: 'ss01' 1, 'cv11' 1;

  }



  body.theme-light {

    --bg-main: #e5e7eb;

    --bg-card: var(--card-light);

    --border-soft: var(--border-light);

    --text-main: var(--text-light);

    --text-muted: var(--muted-light);

    --table-header: #f9fafb;

    --table-row-alt: #f9fafb;

    --input-bg: #ffffff;

    --sch-header-bg: var(--sch-header-bg-light);

    --sch-weekend-bg: var(--sch-weekend-bg-light);

    --sch-cell-bg: var(--sch-cell-bg-light);

    --sch-cell-bg-alt: var(--sch-cell-bg-alt-light);

  }



  body.theme-dark {

    --bg-main: #020617;

    --bg-card: #020617;

    --border-soft: var(--border-dark);

    --text-main: var(--text-dark);

    --text-muted: var(--muted-dark);

    --table-header: #020617;

    --table-row-alt: #020617;

    --input-bg: #020617;

    --sch-header-bg: var(--sch-header-bg-dark);

    --sch-weekend-bg: var(--sch-weekend-bg-dark);

    --sch-cell-bg: var(--sch-cell-bg-dark);

    --sch-cell-bg-alt: var(--sch-cell-bg-alt-dark);

  }



  body.theme-light,

  body.theme-dark {

    background:

      radial-gradient(circle at top left, rgba(148,163,184,0.18), transparent 55%),

      radial-gradient(circle at bottom right, rgba(30,64,175,0.18), transparent 50%),

      var(--bg-main);

    color: var(--text-main);

  }



  .hidden {

    display: none !important;

  }



  /* TOAST */



  .toast {

    position: fixed;

    left: 50%;

    bottom: 20px;

    transform: translateX(-50%);

    padding: 8px 16px;

    border-radius: 999px;

    background: rgba(15,23,42,0.96);

    color: #f9fafb;

    font-size: 12px;

    box-shadow: 0 12px 40px rgba(15,23,42,0.7);

    z-index: 1000;

    max-width: 90vw;

    text-align: center;

    pointer-events: none;

  }



  body.theme-dark .toast {

    background: rgba(15,23,42,0.98);

  }



  /* LOADER */



  .loader {

    position: fixed;

    inset: 0;

    display: flex;

    align-items: center;

    justify-content: center;

    z-index: 900;

    transition: opacity .16s ease;

  }



  body.theme-light .loader {

    background: rgba(248,250,252,0.55);

  }



  body.theme-dark .loader {

    background: rgba(15,23,42,0.45);

  }



  .loader.hidden {

    opacity: 0;

    pointer-events: none;

  }



  .loader-inner {

    width: 48px;

    height: 48px;

    border-radius: 999px;

    border: 4px solid rgba(206,79,8,0.24);

    border-top-color: var(--accent);

    background: transparent;

    animation: spin 0.8s linear infinite;

    box-shadow:

      0 0 0 1px rgba(206,79,8,0.3),

      0 16px 34px rgba(206,79,8,0.5);

  }



  @keyframes spin {

    to { transform: rotate(360deg); }

  }



  /* PAGE WRAPPERS */



  .page {

    min-height: 100vh;

  }



  /* LOGIN */



  #loginScreen {

    display: flex;

    align-items: center;

    justify-content: center;

    padding: 32px 16px;

  }



  .login-card {

    position: relative;

    width: 100%;

    max-width: 380px;

    padding: 26px 24px 24px;

    border-radius: var(--radius-lg);

    border: 1px solid rgba(148,163,184,0.30);

    box-shadow: var(--shadow-soft);

  }



  body.theme-light .login-card {

    background:

      radial-gradient(circle at top, rgba(148,163,184,0.12), transparent 55%),

      #ffffff;

  }



  body.theme-dark .login-card {

    background:

      radial-gradient(circle at top, rgba(148,163,184,0.16), transparent 55%),

      #020617;

    border-color: rgba(15,23,42,0.85);

    box-shadow: var(--shadow-strong);

  }



  .login-logo-wrap {

    display: flex;

    justify-content: center;

    margin-bottom: 12px;

  }



  .logo-img {

    display: block;

    max-width: 190px;

    max-height: 60px;

  }



  .logo-img.small {

    max-width: 140px;

    max-height: 38px;

  }



  .app-title {

    margin: 0 0 4px;

    text-align: center;

    font-size: 19px;

    letter-spacing: 0.05em;

    text-transform: uppercase;

  }



  .muted {

    margin: 0 0 12px;

    text-align: center;

    font-size: 12px;

    color: var(--text-muted);

  }



  .login-card .field-label {

    text-align: left;

  }



  .login-input {

    margin-top: 4px;

  }



  .login-btn-spacer {

    height: 6px;

  }



  .login-card .btn.primary {

    width: 100%;

    display: block;

    margin-top: 10px;

    justify-content: center;

  }



  .theme-toggle-login {

    position: absolute;

    top: 10px;

    right: 10px;

  }



  /* MAIN LAYOUT */



  #mainScreen {

    display: flex;

    flex-direction: column;

    min-height: 100vh;

  }



  .topbar {

    position: sticky;

    top: 0;

    z-index: 50;

    display: flex;

    align-items: center;

    justify-content: space-between;

    padding: 8px 22px;

    backdrop-filter: blur(12px);

  }



  body.theme-light .topbar {

    background: linear-gradient(to right,

      rgba(255,255,255,0.98),

      rgba(248,250,252,0.98)

    );

    color: #0f172a;

    box-shadow: 0 10px 28px rgba(148,163,184,0.45);

  }



  body.theme-dark .topbar {

    background:

      radial-gradient(circle at top left, rgba(236,72,153,0.16), transparent 55%),

      linear-gradient(to right, rgba(15,23,42,0.92), rgba(15,23,42,0.96));

    color: #f9fafb;

    box-shadow: 0 14px 45px rgba(15,23,42,0.5);

  }



  .topbar-left {

    display: flex;

    align-items: center;

    gap: 10px;

    flex-shrink: 0;

  }



  .topbar-title {

    font-weight: 600;

    letter-spacing: 0.08em;

    text-transform: uppercase;

    font-size: 13px;

  }



  .topbar-subtitle {

    font-size: 11px;

    opacity: 0.8;

  }



  .topbar-right {

    display: flex;

    align-items: center;

    gap: 10px;

    flex-shrink: 0;

  }



  .user-info {

    font-size: 12px;

    padding: 4px 9px;

    border-radius: 999px;

    border: 1px solid rgba(148,163,184,0.55);

  }



  body.theme-light .user-info {

    background: rgba(255,255,255,0.9);

    color: #0f172a;

  }



  body.theme-dark .user-info {

    background: rgba(15,23,42,0.24);

    color: #e5e7eb;

  }



  .app-layout {

    display: flex;

    align-items: stretch;

    gap: 16px;

    padding: 18px 18px 22px;

  }



  .sidebar {

    width: var(--sidebar-width);

    flex-shrink: 0;

    padding: 14px 12px 16px;

    border-radius: var(--radius-lg);

    box-shadow: var(--shadow-soft);

  }



  body.theme-light .sidebar {

    background: linear-gradient(135deg, #ffffff, #f9fafb);

    border: 1px solid rgba(148,163,184,0.44);

    color: #0f172a;

  }



  body.theme-dark .sidebar {

    background: linear-gradient(135deg, rgba(15,23,42,0.98), rgba(15,23,42,0.94));

    border: 1px solid rgba(30,64,175,0.34);

    color: #e5e7eb;

  }



  .views {

    flex: 1;

    min-width: 0;

  }



  .view {

    margin-bottom: 18px;

  }



  /* SIDEBAR GROUPS */



  .sidebar-group + .sidebar-group {

    margin-top: 14px;

    padding-top: 10px;

    border-top: 1px dashed rgba(148,163,184,0.38);

  }



  .sidebar-group-title {

    font-size: 13px;

    font-weight: 600;

    text-transform: none; /* Убрали капс */

    letter-spacing: normal; /* Убрали широкие пробелы между буквами */

    margin-bottom: 8px;

    display: flex;

    align-items: center;

    gap: 6px;

  }



  body.theme-light .sidebar-group-title {

    color: rgba(15,23,42,0.8); /* Сделали цвет чуть контрастнее */

  }



  body.theme-dark .sidebar-group-title {

    color: rgba(226,232,240,0.9);

  }



  .nav-btn {

    width: 100%;

    display: flex;

    align-items: center;

    justify-content: flex-start;

    gap: 7px;

    border-radius: 999px;

    padding: 6px 10px;

    border: 1px solid transparent;

    background: transparent;

    font-size: 13px;

    cursor: pointer;

    margin-bottom: 4px;

    transition:

      background .14s ease,

      border-color .14s ease,

      transform .08s ease,

      color .14s ease;

    text-align: left;

  }



  body.theme-light .nav-btn {

    color: #0f172a;

  }



  body.theme-dark .nav-btn {

    color: #e5e7eb;

  }



  .nav-btn:hover {

    transform: translateY(-1px);

  }



  body.theme-light .nav-btn:hover {

    background: rgba(148,163,184,0.16);

    border-color: rgba(148,163,184,0.55);

  }



  body.theme-dark .nav-btn:hover {

    background: rgba(15,23,42,0.86);

    border-color: rgba(148,163,184,0.45);

  }



  .nav-btn.active {

    background: var(--accent);

    border-color: rgba(0,0,0,0.04);

    color: #f9fafb !important;

    box-shadow: 0 6px 18px rgba(206,79,8,0.32);

  }



  .nav-btn.hidden {

    display: none !important;

  }



  /* CARDS & SECTIONS */



  .card {

    border-radius: var(--radius-lg);

    box-shadow: var(--shadow-soft);

    border: 1px solid rgba(148,163,184,0.35);

    padding: 18px 20px 20px;

  }



  body.theme-light .card {

    background:

      radial-gradient(circle at top left, rgba(15,23,42,0.03), transparent 55%),

      #ffffff;

  }



  body.theme-dark .card {

    background:

      radial-gradient(circle at top left, rgba(15,23,42,0.08), transparent 55%),

      #020617;

    border-color: rgba(15,23,42,0.85);

    box-shadow: var(--shadow-strong);

  }



  .card.subcard {

    border-radius: var(--radius-md);

    padding: 14px 16px 16px;

  }



  .section-header {

    display: flex;

    align-items: center;

    justify-content: space-between;

    gap: 12px;

    margin-bottom: 14px;

  }



  .section-header h2,

  .section-header h3 {

    margin: 0;

  }



  .section-actions {

    display: flex;

    flex-wrap: wrap;

    align-items: center;

    justify-content: flex-end;

    gap: 8px;

  }



  h2 {

    font-size: 17px;

    margin: 0 0 4px;

  }



  h3 {

    font-size: 15px;

    margin: 0 0 4px;

  }



  h4 {

    font-size: 13px;

    margin: 10px 0 4px;

  }



  .small-text {

    font-size: 12px;

    color: var(--text-muted);

  }



  /* GRID UTILS */



  .grid {

    display: grid;

  }



  .grid-2 {

    grid-template-columns: repeat(2, minmax(0, 1fr));

  }



  .grid-3 {

    grid-template-columns: repeat(3, minmax(0, 1fr));

  }



  .grid-4 {

    grid-template-columns: repeat(4, minmax(0, 1fr));

  }



  .grid-5 {

    grid-template-columns: repeat(5, minmax(0, 1fr));

  }



  .gap-8 {

    gap: 8px;

  }



  .gap-12 {

    gap: 12px;

  }



  @media (max-width: 1100px) {

    .grid-4 {

      grid-template-columns: repeat(2, minmax(0, 1fr));

    }

    .grid-5 {

      grid-template-columns: repeat(3, minmax(0, 1fr));

    }

  }



  @media (max-width: 900px) {

    .app-layout {

      flex-direction: column;

    }

    .sidebar {

      width: 100%;

      order: -1;

    }

  }



  @media (max-width: 720px) {

    .grid-3 {

      grid-template-columns: repeat(2, minmax(0, 1fr));

    }

    .grid-2 {

      grid-template-columns: repeat(1, minmax(0, 1fr));

    }

  }



  @media (max-width: 580px) {

    .grid-3,

    .grid-4,

    .grid-5 {

      grid-template-columns: 1fr;

    }

  }



  /* INPUTS & LABELS */



  .field {

    display: block;

    width: 100%;

    margin-bottom: 8px;

  }



  .field-label {

    display: block;

    font-size: 11px;

    font-weight: 500;

    text-transform: uppercase;

    letter-spacing: 0.06em;

    color: var(--text-muted);

    margin-bottom: 2px;

  }



  .field-label.small {

    font-size: 10px;

  }



  .input,

  input[type="text"],

  input[type="number"],

  input[type="date"],

  input[type="month"],

  input[type="email"],

  select,

  textarea {

    width: 100%;

    padding: 6px 9px;

    border-radius: var(--radius-sm);

    border: 1px solid rgba(148,163,184,0.65);

    background: var(--input-bg);

    color: var(--text-main);

    font-size: 12px;

    outline: none;

    transition:

      border-color .12s ease,

      box-shadow .12s ease,

      background .12s ease;

  }



  .input.small,

  .filters-row .input,

  .filters-row input,

  .filters-row select {

    padding: 4px 8px;

    font-size: 11px;

  }



  textarea {

    min-height: 60px;

    resize: vertical;

  }



  .input:focus,

  input:focus,

  select:focus,

  textarea:focus {

    border-color: var(--accent);

    box-shadow: 0 0 0 1px rgba(206,79,8,0.18);

  }



  .input-error {

    border-color: #dc2626 !important;

  }



  /* BUTTONS */



  .btn,

  .icon-btn {

    border-radius: 999px;

    border: none;

    font-size: 12px;

    display: inline-flex;

    align-items: center;

    justify-content: center;

    gap: 4px;

    cursor: pointer;

    white-space: nowrap;

    transition:

      background .14s ease,

      color .14s ease,

      box-shadow .14s ease,

      transform .08s ease,

      border-color .14s ease;

  }



  .btn {

    padding: 6px 12px;

    border: 1px solid transparent;

  }



  .btn.small {

    padding: 4px 10px;

    font-size: 11px;

  }



  .btn.primary {

    background: var(--accent);

    color: #f9fafb;

    box-shadow: 0 8px 18px rgba(206,79,8,0.35);

  }



  .btn.primary:hover {

    box-shadow: 0 10px 24px rgba(206,79,8,0.5);

    transform: translateY(-1px);

  }



  .btn.ghost {

    background: transparent;

    border-color: rgba(148,163,184,0.55);

  }



  body.theme-light .btn.ghost {

    color: #0f172a;

  }



  body.theme-dark .btn.ghost {

    color: #e5e7eb;

  }



  .btn.ghost:hover {

    background: rgba(148,163,184,0.16);

  }



  .icon-btn {

    padding: 4px 7px;

    background: transparent;

    border-radius: 999px;

    border: 1px solid transparent;

  }



  body.theme-light .icon-btn {

    color: #0f172a;

  }



  body.theme-dark .icon-btn {

    color: #e5e7eb;

  }



  .icon-btn:hover {

    background: rgba(148,163,184,0.18);

    border-color: rgba(148,163,184,0.4);

  }



  /* TABLES */



  .table-wrap,

  .table-wrapper {

    margin-top: 8px;

    border-radius: var(--radius-md);

    border: 1px solid rgba(148,163,184,0.35);

    overflow: auto;

    background: var(--bg-card);

  }



  table {

    width: 100%;

    border-collapse: collapse;

    min-width: 100%;

  }



  .table-list th,

  .table-list td,

  .data-table th,

  .data-table td {

    padding: 5px 7px;

    font-size: 12px;

    border-bottom: 1px solid rgba(148,163,184,0.28);

  }



  .table-list th,

  .data-table th {

    position: sticky;

    top: 0;

    z-index: 2;

    text-align: left;

    font-weight: 500;

    text-transform: uppercase;

    letter-spacing: 0.05em;

    font-size: 11px;

    background: var(--table-header);

  }



  .table-list tbody tr:nth-child(2n+1),

  .data-table tbody tr:nth-child(2n+1) {

    background: rgba(148,163,184,0.03);

  }



  .table-list tbody tr:hover,

  .data-table tbody tr:hover {

    background: rgba(148,163,184,0.12);

  }



  .wrap-cell {

    word-wrap: break-word;

    word-break: break-word;

  }



  .list {

    margin: 0;

    padding-left: 16px;

    font-size: 12px;

  }



  .list li {

    margin-bottom: 3px;

    cursor: pointer;

  }



  .list li:hover {

    text-decoration: underline;

  }



  /* KPI CARDS */



  .kpi-card {

    display: grid;

    grid-template-columns: minmax(0,1.5fr) minmax(0,1fr);

    grid-template-rows: auto auto;

    row-gap: 2px;

    column-gap: 8px;

    align-items: baseline;

  }



  .kpi-title {

    font-size: 11px;

    text-transform: uppercase;

    letter-spacing: 0.06em;

    color: var(--text-muted);

  }



  .kpi-main {

    font-size: 18px;

    font-weight: 600;

    justify-self: end;

  }



  .kpi-sub {

    font-size: 11px;

    color: var(--text-muted);

  }



  .kpi-eff {

    font-size: 11px;

    justify-self: end;

  }



  .kpi-ok {

    border-color: rgba(22,163,74,0.5);

    box-shadow: 0 0 0 1px rgba(22,163,74,0.15);

  }



  .kpi-warn {

    border-color: rgba(234,179,8,0.5);

    box-shadow: 0 0 0 1px rgba(234,179,8,0.15);

  }



  .eff-ok {

    color: #16a34a;

    font-weight: 600;

  }



  .eff-warn {

    color: #eab308;

    font-weight: 600;

  }



  /* SIDE FORMS */



  .side-form {

    position: fixed;

    top: 70px;

    right: 18px;

    bottom: 18px;

    width: 360px;

    max-width: calc(100% - 36px);

    border-radius: var(--radius-lg);

    box-shadow: var(--shadow-strong);

    border: 1px solid rgba(148,163,184,0.55);

    background: var(--bg-card);

    display: flex;

    flex-direction: column;

    z-index: 80;

  }



  body.theme-dark .side-form {

    border-color: rgba(15,23,42,0.9);

  }



  .side-form-body {

    flex: 1;

    padding: 16px 18px 12px;

    overflow: auto;

  }



  /* В сайдбар-формах поля идут строго одной колонкой,

     одно поле в строке, ровно по вертикали */

  .side-form-body .field {

    width: 100%;

    margin-bottom: 10px;

  }



  .side-form-body .field:last-child {

    margin-bottom: 0;

  }



  .side-form-body .grid-2,

  .side-form-body .grid-3,

  .side-form-body .grid-4,

  .side-form-body .grid-5 {

    grid-template-columns: 1fr;

  }



  .side-form-body .field-label {

    margin-bottom: 3px;

  }



  .side-form-footer {

    padding: 10px 18px 14px;

    border-top: 1px solid rgba(148,163,184,0.35);

    display: flex;

    justify-content: flex-end;

    gap: 8px;

  }



  /* DASHBOARD DETAIL CARD */



  #dashDetailCard {

    margin-top: 14px;

  }



  /* VIEW HEADER (ГРАФИК) */



  .view-header {

    display: flex;

    align-items: center;

    justify-content: space-between;

    gap: 10px;

    margin-bottom: 10px;

  }



  .view-header h2 {

    margin: 0;

    display: flex;

    align-items: center;

    gap: 6px;

  }



  .view-actions {

    display: flex;

    align-items: center;

    gap: 8px;

  }



  /* FILTERS ROW (ГРАФИК) */



  .filters-row {

    display: flex;

    flex-wrap: wrap;

    align-items: flex-end;

    gap: 10px;

    margin-bottom: 10px;

  }



  .filters-row .field {

    min-width: 130px;

    max-width: 180px;

    margin-bottom: 0;

  }



  .filters-row label {

    font-size: 10px;

    font-weight: 500;

    text-transform: uppercase;

    letter-spacing: 0.06em;

    color: var(--text-muted);

    margin-bottom: 2px;

    display: block;

  }



  .filters-row input,

  .filters-row select {

    padding: 4px 8px;

    font-size: 11px;

    height: 28px;

  }



  /* ГРАФИК / ТАБЕЛЬ */



  .schedule-table {

    table-layout: fixed;

    font-size: 11px;

  }



  .schedule-table th,

  .schedule-table td {

    padding: 4px 5px;

    border-bottom: 1px solid rgba(148,163,184,0.32);

  }



  .schedule-table th {

    background: var(--sch-header-bg);

  }



  /* ФИО – фиксированная ширина, первый липкий столбец */

  .sch-col-fio {

    width: 190px;

    min-width: 190px;

    max-width: 190px;

  }



  /* Руководитель – фиксированная ширина, второй липкий столбец */

  .sch-col-leader {

    width: 140px;

    min-width: 140px;

    max-width: 140px;

  }



  .schedule-table th.sch-col-fio,

  .schedule-table td.sch-cell-fio {

    position: sticky;

    left: 0;

    z-index: 3;

    background: var(--sch-cell-bg);

  }



  .schedule-table th.sch-col-leader,

  .schedule-table td.sch-cell-leader {

    position: sticky;

    left: 190px; /* ровно ширина ФИО */

    z-index: 3;

    background: var(--sch-cell-bg);

  }



  .sch-col-days {

    text-align: center;

    font-size: 11px;

  }



  .sch-col-total,

  .sch-cell-total,

  .sch-total-grand {

    min-width: 90px;

    max-width: 110px;

    text-align: right;

  }



  .sch-day-head {

    text-align: center;

    font-size: 10px;

    border-left: 1px solid rgba(148,163,184,0.25);

    border-right: 1px solid rgba(148,163,184,0.25);

  }



  .sch-day-head .sch-day-num {

    font-weight: 600;

    font-size: 11px;

  }



  .sch-day-head .sch-day-dow {

    font-size: 10px;

    color: var(--text-muted);

  }



  .sch-day-weekend {

    background: var(--sch-weekend-bg) !important;

  }



  .sch-cell-fio {

    font-size: 11px;

    white-space: nowrap;

    overflow: hidden;

    text-overflow: ellipsis;

  }



  /* Для руководителей разрешаем перенос, чтобы не лезли на дни */

  .sch-cell-leader,

  .sch-col-leader {

    font-size: 11px;

    white-space: normal;

    word-break: break-word;

  }



  .sch-cell-day {

    text-align: right;

    font-variant-numeric: tabular-nums;

    white-space: nowrap;

  }



  .sch-cell-has-val {

    font-weight: 500;

  }



  .sch-row-total {

    background: rgba(148,163,184,0.18);

    font-weight: 600;

  }



  .sch-total-label {

    text-align: right;

    padding-right: 6px;

  }



  .sch-total-day,

  .sch-total-grand {

    text-align: right;

    font-variant-numeric: tabular-nums;

  }



  .schedule-table tbody tr:nth-child(2n+1) {

    background: var(--sch-cell-bg-alt);

  }



  .schedule-table tbody tr:hover {

    background: rgba(148,163,184,0.20);

  }



  /* DASHBOARD LEADERS TABLE SMALLER INPUT FEEL */



  .table-leaders td,

  .table-leaders th {

    padding: 4px 6px;

    font-size: 11.5px;

  }



  /* LIST LINKS IN DASHBOARD */



  .dash-emp-link {

    font-size: 12px;

  }



  .dash-emp-link:hover {

    text-decoration: underline;

  }



  /* MISC */



  .wrap-text {

    word-wrap: break-word;

    word-break: break-word;

  }



  .admin-only.hidden {

    display: none !important;

  }



  @media (max-width: 900px) {

    .side-form {

      top: 64px;

      right: 10px;

      left: 10px;

      width: auto;

      max-width: none;

    }

  }

  /* --- ИСПРАВЛЕНИЕ ПОДЛОЖКИ (Task 5) --- */

  /* Делаем так, чтобы app-layout растягивался на всю высоту */

  .app-layout {

    display: flex;

    align-items: stretch; /* Растягиваем детей по высоте */

    gap: 16px;

    padding: 18px 18px 22px;

    min-height: calc(100vh - 60px); /* Вычет высоты шапки */

  }



  /* Сайдбар тоже должен быть высоким */

  .sidebar {

    width: var(--sidebar-width);

    flex-shrink: 0;

    padding: 14px 12px 16px;

    border-radius: var(--radius-lg);

    box-shadow: var(--shadow-soft);

    display: flex;

    flex-direction: column; 

    height: auto; /* Позволяем растягиваться */

  }



  /* --- ИСПРАВЛЕНИЕ ТАБЛИЦЫ ГРАФИКА (Task 4) --- */

  .schedule-table {

    table-layout: fixed; /* Фиксированная ширина ячеек */

    font-size: 11px;

    border-collapse: separate; /* Нужно для sticky заголовков */

    border-spacing: 0;

  }



  .table-wrapper {

    /* Включаем скролл */

    overflow: auto;

    max-height: 75vh; /* Ограничение высоты для верт. скролла */

    max-width: 100%;

    position: relative;

    border: 1px solid rgba(148,163,184,0.35);

  }



  /* СЕТКА (Task 4) */

  .schedule-table th,

  .schedule-table td {

    padding: 4px 5px;

    border-bottom: 1px solid rgba(148,163,184,0.32);

    /* Вертикальная линия */

    border-right: 1px solid rgba(148,163,184,0.32); 

  }



  /* ФИКСАЦИЯ ЗАГОЛОВКОВ (Task 4) */

  .schedule-table thead {

    position: sticky;

    top: 0;

    z-index: 30; /* Самый верхний слой */

  }



  /* Первая строка заголовка (Агент, Руководитель, Дни...) */

  .schedule-table thead tr:first-child th {

    position: sticky;

    top: 0;

    background: var(--sch-header-bg);

    border-bottom: 1px solid rgba(148,163,184,0.32);

    z-index: 30;

  }



  /* Вторая строка заголовка (1, 2, 3...) */

  .schedule-table thead tr:nth-child(2) th {

    position: sticky;

    top: 25px; /* Высота первой строки (подбирается экспериментально, ~25-30px) */

    background: var(--sch-header-bg);

    border-bottom: 1px solid rgba(148,163,184,0.32);

    z-index: 30;

  }



  /* ФИКСАЦИЯ КОЛОНОК СЛЕВА (Task 4) */

  /* Колонка Агент */

  .sch-col-fio,

  .sch-cell-fio {

    position: sticky;

    left: 0;

    width: 190px;

    min-width: 190px;

    background: var(--sch-cell-bg);

    z-index: 20; /* Выше контента, но ниже заголовка */

    border-right: 2px solid rgba(148,163,184,0.5); /* Жирная линия разделитель */

  }



  /* Пересечение заголовка и фиксированной колонки (левый верхний угол) */

  .schedule-table thead tr:first-child th.sch-col-fio {

    z-index: 40; /* Самый высокий приоритет */

    background: var(--sch-header-bg);

  }



  /* Колонка Руководитель (убираем фиксацию второй колонки для экономии места на зуме, 

    или фиксируем её тоже, но нужно считать left offset) */

  /* Если нужно фиксировать и вторую: */

  .sch-col-leader,

  .sch-cell-leader {

    /* position: sticky; left: 190px; z-index: 20; background: ... */

    /* Но часто лучше фиксировать только ФИО, иначе на мобильном не останется места для данных */

  }

  /* --- РАСТЯГИВАНИЕ НА ВСЮ ВЫСОТУ (ФИНАЛЬНОЕ) --- */



  /* Контейнер для всех разделов */

  .views {

    flex: 1;             /* Занимаем всё место справа от меню */

    display: flex;       /* Включаем Flexbox */

    flex-direction: column;

    min-width: 0;        /* Исправление для скролла таблиц */

  }



  /* Сам раздел (view) */

  .view {

    flex: 1;             /* Растягиваемся на всю высоту .views */

    display: flex;

    flex-direction: column;

    height: 100%;        /* Гарантия высоты */

  }



  /* Карточка внутри раздела */

  .view .card {

    flex: 1;             /* Карточка растягивается до низа */

    display: flex;       /* Чтобы контент внутри тоже можно было структурировать */

    flex-direction: column;

    margin-bottom: 0;    /* Убираем отступ снизу, так как мы теперь тянемся до конца */

  }



  /* --- СПЕЦИАЛЬНО ДЛЯ ГРАФИКА (чтобы скролл был внутри карты) --- */

  #view-schedule .card {

    padding: 0;          /* Убираем отступы у самой карты, чтобы шапка была от края до края */

    overflow: hidden;    /* Чтобы ничего не вылезало */

  }



  /* Заголовок внутри карты графика */

  .schedule-header {

    padding: 18px 20px;

    border-bottom: 1px solid rgba(148,163,184,0.35);

    display: flex;

    align-items: center;

    justify-content: space-between;

    flex-shrink: 0;      /* Не сжимать шапку */

    background: var(--bg-card);

  }



  /* Фильтры графика */

  .schedule-filters {

    padding: 12px 20px;

    background: var(--bg-card);

    border-bottom: 1px solid rgba(148,163,184,0.2);

    flex-shrink: 0;      /* Не сжимать фильтры */

  }



  /* Обертка таблицы графика */

  /* Обертка таблицы графика */

  #view-schedule .table-wrapper {
    flex: 1;
    min-height: 0;
    margin: 0 20px 20px 20px;
    border: 1px solid rgba(148,163,184,0.35);
    border-radius: 8px;
    overflow: auto;
  }

  @media (max-width: 600px) {
    #view-schedule .table-wrapper { margin: 0 8px 8px 8px; }
  }



  .schedule-table {

    /* Важно: auto позволяет таблице растягиваться за пределы экрана */

    table-layout: auto; 

    font-size: 11px;

    border-collapse: separate;

    border-spacing: 0;

    min-width: 100%; /* Чтобы не сжималась */

  }



  .table-wrapper {

    overflow: auto; /* Скролл, если таблица шире экрана */

    flex: 1;

    min-height: 0;

    border: none;

    /* Убираем лишние границы контейнера, они есть у таблицы */

  }



  /* СЕТКА */

  .schedule-table th,

  .schedule-table td {

    padding: 4px 4px; /* Чуть меньше отступы */

    border-bottom: 1px solid rgba(148,163,184,0.32);

    border-right: 1px solid rgba(148,163,184,0.32);

  }



  /* ФИКСАЦИЯ ЗАГОЛОВКОВ (Sticky Header) */

  .schedule-table thead {

    position: sticky;

    top: 0;

    z-index: 30;

  }



  .schedule-table thead tr:first-child th {

    position: sticky;

    top: 0;

    background: var(--sch-header-bg);

    border-bottom: 1px solid rgba(148,163,184,0.32);

    z-index: 30;

    height: 28px;

  }



  .schedule-table thead tr:nth-child(2) th {

    position: sticky;

    top: 28px; /* Высота первой строки */

    background: var(--sch-header-bg);

    border-bottom: 1px solid rgba(148,163,184,0.32);

    z-index: 30;

  }



  /* --- НАСТРОЙКИ ШИРИНЫ КОЛОНОК (Решение проблемы наложения) --- */



  /* 1. Имена агентов (Левая колонка) */

  .sch-col-fio,

  .sch-cell-fio {

    position: sticky;

    left: 0;

    width: 180px;

    min-width: 180px; /* Жесткая фиксация */

    max-width: 180px;

    background: var(--sch-cell-bg);

    z-index: 20;

    border-right: 2px solid rgba(148,163,184,0.5); /* Жирный разделитель */



    white-space: nowrap;

    overflow: hidden;

    text-overflow: ellipsis;

  }



  /* Перекрытие в левом верхнем углу */

  .schedule-table thead tr:first-child th.sch-col-fio {

    z-index: 40;

    background: var(--sch-header-bg);

  }



  /* 2. Руководитель (Вторая колонка) */

  /* Она скроллится вместе с данными, чтобы экономить место на экране */

  .sch-col-leader,

  .sch-cell-leader {

    width: 130px;

    min-width: 130px;

    max-width: 130px;

    white-space: nowrap;

    overflow: hidden;

    text-overflow: ellipsis;

    font-size: 10.5px;

    color: var(--text-muted);

  }



  /* 3. Дни (Самое важное!) */

  .sch-day-head,

  .sch-cell-day,

  .sch-total-day {

    min-width: 70px;  /* Достаточно широко для 10 000 000 */

    width: 70px;

    text-align: right;

    font-size: 10.5px; /* Чуть уменьшенный шрифт цифр */

    font-family: 'Menlo', 'Consolas', monospace; /* Моноширинный шрифт для ровных цифр */

    white-space: nowrap; /* Запрет переноса строк */

    overflow: hidden;    /* Если все же не влезет - обрежет */

  }



  /* 4. Итого (Правая колонка) */

  .sch-col-total,

  .sch-cell-total,

  .sch-total-grand {

    min-width: 90px;

    width: 90px;

    text-align: right;

    font-weight: 600;

    font-size: 10.5px;

    white-space: nowrap;

  }



  /* Цвета строк */

  .sch-row-total {

    background: rgba(148,163,184,0.18);

    font-weight: 600;

    position: sticky;

    bottom: 0; /* Приклеить итоги к низу (опционально) */

    z-index: 25;

  }



  .schedule-table tbody tr:nth-child(2n+1) {

    background: var(--sch-cell-bg-alt);

  }

  .schedule-table tbody tr:hover {

    background: rgba(148,163,184,0.20);

  }



  /* Фикс фона для липкой первой колонки при ховере и полосатости */

  .schedule-table tbody tr:nth-child(2n+1) .sch-cell-fio {

    background: var(--sch-cell-bg-alt);

  }

  .schedule-table tbody tr:hover .sch-cell-fio {

    background: #e2e8f0; /* Цвет ховера вручную для липкой колонки */

  }



  /* Стили для иконок Google */

  .material-symbols-outlined {

    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;

    vertical-align: middle;

  }



  /* Подгоняем размеры иконок в разных местах */

  .icon-btn .material-symbols-outlined { font-size: 18px; }

  .nav-btn .material-symbols-outlined { font-size: 20px; margin-right: 6px; }



  /* Чтобы заголовки в меню с иконками стояли ровно */

  .sidebar-group-title { display: flex; align-items: center; gap: 6px; }

  .sidebar-group-title .material-symbols-outlined { font-size: 18px; color: inherit; }



  /* Ограничение ширины для колонок с примечаниями */

  .col-note {

    max-width: 200px; /* Можешь задать 250px, если экран позволяет */

    white-space: nowrap;

    overflow: hidden;

    text-overflow: ellipsis;

    cursor: help; /* Меняем курсор, чтобы подсказать, что есть тултип */

  }



  /* Фиксируем ширину колонки действий, чтобы кнопки не сплющивались */

  .col-actions {

    white-space: nowrap;

    min-width: 90px;

  }



  /* Стили для плашек уровней */

  .lvl-badge {

    display: inline-block;

    padding: 2px 6px;

    border-radius: 6px;

    font-size: 10px;

    font-weight: 700;

    margin-left: 6px;

    vertical-align: middle;

    text-transform: uppercase;

  }

  .lvl-new { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }

  .lvl-beg { background: #fef08a; color: #854d0e; border: 1px solid #fde047; }

  .lvl-mid { background: #dcfce7; color: #166534; border: 1px solid #86efac; }

  .lvl-pro { background: #e0e7ff; color: #1e40af; border: 1px solid #93c5fd; }



  /* --- ИСПРАВЛЕНИЕ МЕНЮ (чтобы не скроллилось с таблицей) --- */

  .sidebar {

    width: var(--sidebar-width);

    flex-shrink: 0;

    padding: 14px 12px 16px;

    border-radius: var(--radius-lg);

    box-shadow: var(--shadow-soft);

    display: flex;

    flex-direction: column; 



    /* Фиксируем позицию */

    position: sticky;

    top: 66px; /* Отступ от верхней панели */

    height: calc(100vh - 88px); /* Высота на весь экран минус шапка */

    overflow-y: auto; /* Внутренний скролл, если пунктов меню станет много */

  }



  /* --- ИСПРАВЛЕНИЕ ТАБЛИЦ (растягивание до низа) --- */

  .views {

    flex: 1;

    display: flex;

    flex-direction: column;

    min-width: 0;

  }



  .view {

    flex: 1;

    display: flex;

    flex-direction: column;

  }



  .view > .card {

    flex: 1;

    display: flex;

    flex-direction: column;

    margin-bottom: 0; /* Убираем отступ снизу, карточка упирается в край */

  }



  /* Заставляем контейнер с таблицей занимать всё оставшееся место */

  .table-wrap {

    flex: 1;

    min-height: 0; /* Обязательно для скролла во Flexbox */

    overflow: auto;

    max-height: none !important; /* Убиваем старый ограничитель 720px */

    border: 1px solid rgba(148,163,184,0.35);

    border-radius: 8px;

    background: var(--bg-card);

  }



  /* Скрываем внутренний скролл у дашборда, так как он собирается из блоков */

  #view-dashboard > .card {

    overflow-y: auto;

  }

  #view-dashboard .table-wrap {

    flex: none; /* Таблица в дашборде подстраивается под контент */

    max-height: 500px !important;

  }

  /* Сетка для верхнего блока дашборда (Топ-3 и Новички) */

  .dash-top-grid {

    display: grid;

    grid-template-columns: 1fr 1.4fr; /* Новички займут больше места в ширину */

    gap: 12px;

    margin-bottom: 16px;

  }

  @media (max-width: 800px) {

    .dash-top-grid {

      grid-template-columns: 1fr;

    }

  }





  /* --- МОБИЛЬНАЯ ВЕРСТКА ДЛЯ WEB APP --- */

  html,

  body {

    max-width: 100%;

    overflow-x: hidden;

  }



  @supports (height: 100dvh) {

    .page {

      min-height: 100dvh;

    }

  }



  input,

  select,

  textarea,

  button {

    max-width: 100%;

  }



  .side-form {

    background: var(--bg-card);

  }



  @media (max-width: 760px) {

    body {

      font-size: 12px;

    }



    .topbar {

      padding: 8px 10px;

      gap: 8px;

      align-items: flex-start;

      flex-wrap: wrap;

    }



    .topbar-left {

      min-width: 0;

      flex: 1 1 auto;

    }



    .topbar-title {

      font-size: 12px;

    }



    .topbar-subtitle {

      display: none;

    }



    .logo-img.small {

      max-width: 112px;

      max-height: 30px;

    }



    .topbar-right {

      width: 100%;

      justify-content: space-between;

      gap: 6px;

      overflow-x: auto;

      padding-bottom: 2px;

      -webkit-overflow-scrolling: touch;

    }



    .user-info {

      max-width: 52vw;

      overflow: hidden;

      text-overflow: ellipsis;

      white-space: nowrap;

    }



    .app-layout {

      display: block;

      padding: 10px;

      min-height: 0;

    }



    .sidebar {

      position: sticky;

      top: 76px;

      z-index: 45;

      width: auto;

      height: auto;

      max-height: none;

      overflow-x: auto;

      overflow-y: hidden;

      display: flex;

      flex-direction: row;

      gap: 8px;

      padding: 8px;

      margin-bottom: 10px;

      border-radius: 14px;

      -webkit-overflow-scrolling: touch;

    }



    .sidebar-group {

      display: flex;

      align-items: center;

      gap: 6px;

      flex: 0 0 auto;

      margin: 0 !important;

      padding: 0 !important;

      border-top: 0 !important;

    }



    .sidebar-group-title {

      display: none;

    }



    .nav-btn {

      width: auto;

      min-width: 104px;

      margin: 0;

      justify-content: center;

      padding: 8px 10px;

      white-space: nowrap;

      font-size: 12px;

    }



    .views,

    .view,

    .view > .card,

    .view .card {

      display: block;

      height: auto;

      min-height: 0;

    }



    .card {

      padding: 12px;

      border-radius: 14px;

    }



    .card.subcard {

      padding: 12px;

    }



    .section-header,

    .view-header {

      flex-direction: column;

      align-items: stretch;

      gap: 10px;

    }



    .section-actions,

    .view-actions,

    .filters-row {

      width: 100%;

      display: grid;

      grid-template-columns: 1fr;

      gap: 8px;

    }



    .grid,

    .grid-2,

    .grid-3,

    .grid-4,

    .grid-5,

    .filters {

      display: grid !important;

      grid-template-columns: 1fr !important;

    }



    .dash-top-grid {

      grid-template-columns: 1fr !important;

    }



    .table-wrap,

    .table-wrapper {

      max-height: calc(100dvh - 250px) !important;

      overflow: auto;

      -webkit-overflow-scrolling: touch;

    }



    .table {

      min-width: 760px;

    }



    .table-leaders,

    .table-dash-detail {

      min-width: 620px;

    }



    .schedule-table {

      min-width: 980px;

    }



    .side-form {

      position: fixed;

      inset: auto 0 0 0;

      top: auto;

      right: 0;

      left: 0;

      width: 100%;

      max-width: none;

      height: min(86dvh, 720px);

      border-radius: 18px 18px 0 0;

      z-index: 200;

      box-shadow: 0 -18px 50px rgba(15, 23, 42, 0.35);

    }



    .side-form-body {

      padding: 14px;

      overflow: auto;

      -webkit-overflow-scrolling: touch;

    }



    .side-form-footer {

      position: sticky;

      bottom: 0;

      background: var(--bg-card);

      display: grid;

      grid-template-columns: 1fr 1fr;

      gap: 8px;

      padding: 10px 14px calc(12px + env(safe-area-inset-bottom));

    }



    .side-form-footer .btn {

      width: 100%;

      justify-content: center;

    }



    input,

    select,

    textarea {

      font-size: 16px !important;

    }

  }



  /* ===== ДОРАБОТКИ: нумерация, неосвоенные задатки, баланс плана, рейтинг ===== */



  /* Узкая колонка нумерации */

  .col-num {

    width: 38px;

    min-width: 38px;

    max-width: 44px;

    text-align: center;

    color: var(--text-muted);

    font-variant-numeric: tabular-nums;

    font-size: 11px;

  }

  .table-list th.col-num { text-align: center; }



  /* Бейджи возраста неосвоенных задатков */

  .age-badge {

    display: inline-block;

    padding: 1px 7px;

    border-radius: 999px;

    font-size: 10px;

    font-weight: 700;

    white-space: nowrap;

  }

  .age-new { background: #fef9c3; color: #854d0e; border: 1px solid #fde047; }

  .age-mid { background: #ffedd5; color: #9a3412; border: 1px solid #fdba74; }

  .age-old { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }



  /* Панель "Распределено / Остаток" в распределении плана */

  .plan-balance-bar {

    display: flex;

    flex-wrap: wrap;

    gap: 10px;

    margin-top: 12px;

  }

  .plan-balance-item {

    flex: 1 1 150px;

    display: flex;

    flex-direction: column;

    gap: 2px;

    padding: 10px 14px;

    border-radius: var(--radius-md);

    border: 1px solid rgba(148,163,184,0.4);

    background: rgba(148,163,184,0.06);

  }

  .plan-balance-label {

    font-size: 10px;

    text-transform: uppercase;

    letter-spacing: 0.06em;

    color: var(--text-muted);

  }

  .plan-balance-val {

    font-size: 18px;

    font-weight: 700;

    font-variant-numeric: tabular-nums;

  }

  .plan-balance-remain.balance-ok    { color: #16a34a; }

  .plan-balance-remain.balance-over  { color: #dc2626; }

  .plan-balance-remain.balance-under { color: #d97706; }

  .plan-balance-item:has(.balance-ok)   { border-color: rgba(22,163,74,0.5);  background: rgba(22,163,74,0.07); }

  .plan-balance-item:has(.balance-over) { border-color: rgba(220,38,38,0.5);  background: rgba(220,38,38,0.07); }



  /* Таблица рейтинга агентов */

  .table-rating th,

  .table-rating td { white-space: nowrap; }

  .table-rating .rating-fio {

    position: sticky;

    left: 0;

    background: var(--bg-card);

    z-index: 2;

    min-width: 180px;

  }

  .rating-month {

    text-align: right;

    font-variant-numeric: tabular-nums;

    min-width: 78px;

  }

  .rating-cell {

    text-align: right;

    font-variant-numeric: tabular-nums;

    font-family: 'Menlo','Consolas',monospace;

    font-size: 11px;

  }

  .rating-total {

    text-align: right;

    font-variant-numeric: tabular-nums;

    min-width: 110px;

    background: rgba(148,163,184,0.08);

  }

  .rating-gold   td { background: rgba(245,158,11,0.12) !important; }

  .rating-silver td { background: rgba(148,163,184,0.16) !important; }

  .rating-bronze td { background: rgba(180,83,9,0.10)  !important; }



  /* =====================================================================

     ДИЗАЙН-РЕФРЕШ · Manrope + полировка (этот блок идёт последним и

     намеренно переопределяет базовые правила выше)

     ===================================================================== */



  /* Заголовки и фирменные надписи — Manrope с выразительными насыщенностями */

  h1, h2, h3, h4,

  .app-title, .topbar-title,

  .kpi-main, .kpi-title,

  .plan-balance-val, .plan-balance-label,

  .sidebar-group-title, .nav-btn, .btn, .field-label, .table-list th, .data-table th {

    font-family: var(--font-ui);

  }

  h1 { font-weight: 800; letter-spacing: -0.02em; }

  h2 { font-weight: 700; letter-spacing: -0.01em; }

  h3 { font-weight: 700; letter-spacing: -0.01em; }

  h4 { font-weight: 600; }

  .app-title    { font-weight: 800; letter-spacing: 0.12em; }

  .topbar-title { font-weight: 700; letter-spacing: 0.10em; }



  /* Ровные цифровые колонки во всех данных */

  .table-list, .data-table,

  .kpi-main, .kpi-eff,

  .plan-balance-val,

  .sch-cell-day, .sch-total-day, .sch-cell-total, .sch-total-grand,

  .rating-cell, .rating-total, .rating-month, .col-num {

    font-variant-numeric: tabular-nums;

    font-feature-settings: 'tnum' 1;

  }



  /* ---------- Кнопки ---------- */

  .btn { font-weight: 600; letter-spacing: 0.005em; border-radius: 12px; }

  .btn.small { border-radius: 10px; }

  .btn.primary {

    background: linear-gradient(135deg, var(--accent-soft), var(--accent));

    box-shadow: 0 6px 16px -5px rgba(206,79,8,0.55), inset 0 1px 0 rgba(255,255,255,0.18);

  }

  .btn.primary:hover {

    background: linear-gradient(135deg, var(--accent), var(--accent-strong));

    box-shadow: 0 12px 26px -8px rgba(206,79,8,0.6);

    transform: translateY(-1px);

  }

  .btn.primary:active { transform: translateY(0); box-shadow: 0 4px 12px -6px rgba(206,79,8,0.6); }

  .icon-btn { border-radius: 10px; }



  /* Видимый фокус для клавиатуры (доступность) */

  :focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

  .btn:focus-visible, .icon-btn:focus-visible, .nav-btn:focus-visible { outline-offset: 3px; }



  /* ---------- Поля ввода ---------- */

  .input, input[type="text"], input[type="number"], input[type="date"],

  input[type="month"], input[type="email"], input[type="password"], select, textarea {

    border-radius: 10px;

  }

  .input:focus, input:focus, select:focus, textarea:focus {

    border-color: var(--accent);

    box-shadow: 0 0 0 3px var(--accent-ring);

  }



  /* ---------- Навигация ---------- */

  .nav-btn { font-weight: 600; border-radius: 12px; }

  .nav-btn.active {

    background: linear-gradient(135deg, var(--accent-soft), var(--accent));

    box-shadow: 0 8px 20px -7px rgba(206,79,8,0.55);

  }



  /* ---------- Карточки ---------- */

  .card { border-radius: 16px; }

  .card.subcard { border-radius: 13px; }



  /* ---------- Таблицы ---------- */

  .table-list th, .data-table th {

    font-weight: 700;

    letter-spacing: 0.05em;

    color: var(--text-muted);

  }

  .table-list tbody tr, .data-table tbody tr { transition: background .12s ease; }

  .table-list tbody tr:hover, .data-table tbody tr:hover { background: var(--accent-tint); }

  .row-clickable:hover { background: var(--accent-tint) !important; }



  /* ---------- KPI ---------- */

  .kpi-main { font-weight: 800; letter-spacing: -0.02em; }

  .kpi-title { font-weight: 600; }



  /* ---------- Бейджи в виде «пилюль» ---------- */

  .lvl-badge { border-radius: 999px; font-weight: 700; }



  /* ---------- Тост ---------- */

  .toast { border-radius: 12px; font-weight: 600; }



  /* ---------- Логин: чуть премиальнее ---------- */

  .login-card { border-radius: 22px; }

  body.theme-light .login-card { box-shadow: 0 24px 60px -24px rgba(15,23,42,0.35); }



  /* =====================================================================

     ТЁМНАЯ ТЕМА · добавляем глубину (раньше всё было #020617 — плоско)

     ===================================================================== */

  body.theme-dark {

    --bg-card: #0b1220;

    --border-soft: #1e293b;

    --table-header: #0e1729;

    --table-row-alt: #0c1526;

    --input-bg: #0e1729;

  }

  body.theme-dark .card {

    background: linear-gradient(180deg, #0e1729, #0b1220);

    border-color: #1e293b;

    box-shadow: 0 20px 50px -18px rgba(0,0,0,0.65);

  }

  body.theme-dark .card.subcard { background: #0e1729; border-color: #1c293f; }

  body.theme-dark .sidebar {

    background: linear-gradient(180deg, #0e1729, #0b1220);

    border-color: #1e293b;

  }

  body.theme-dark .topbar {

    background: linear-gradient(to right, rgba(11,18,32,0.96), rgba(14,23,41,0.96));

    box-shadow: 0 14px 40px rgba(0,0,0,0.5);

  }

  body.theme-dark .side-form { background: #0b1220; border-color: #1e293b; }

  body.theme-dark .login-card {

    background: linear-gradient(180deg, #0e1729, #0b1220);

    border-color: #1e293b;

  }

  body.theme-dark .input,

  body.theme-dark input,

  body.theme-dark select,

  body.theme-dark textarea {

    background: #0e1729;

    border-color: #243044;

  }

  body.theme-dark .user-info { background: rgba(255,255,255,0.05); border-color: #243044; }

  body.theme-dark .schedule-table th.sch-col-fio,

  body.theme-dark .schedule-table td.sch-cell-fio,

  body.theme-dark .table-rating .rating-fio { background: #0b1220; }

  body.theme-dark .table-list tbody tr:hover .sch-cell-fio { background: #16223b; }



  /* ---------- Аккуратный скроллбар ---------- */

  * { scrollbar-width: thin; scrollbar-color: rgba(148,163,184,0.5) transparent; }

  ::-webkit-scrollbar { width: 10px; height: 10px; }

  ::-webkit-scrollbar-thumb {

    background: rgba(148,163,184,0.45);

    border-radius: 999px;

    border: 2px solid transparent;

    background-clip: padding-box;

  }

  ::-webkit-scrollbar-thumb:hover { background: rgba(148,163,184,0.7); background-clip: padding-box; }



  /* ---------- Уважение к настройке «меньше движения» ---------- */

  @media (prefers-reduced-motion: reduce) {

    *, *::before, *::after {

      animation-duration: 0.001ms !important;

      animation-iteration-count: 1 !important;

      transition-duration: 0.001ms !important;

      scroll-behavior: auto !important;

    }

  }



  /* === ГРАФИК: колонки (# | Агент), обе прилипают === */

  .schedule-table th.sch-col-num,

  .schedule-table td.sch-cell-num {

    position: sticky; left: 0;

    width: 34px; min-width: 34px; max-width: 34px;

    text-align: center; z-index: 20;

    background: var(--sch-cell-bg);

    color: var(--text-muted); font-size: 10.5px; font-variant-numeric: tabular-nums;

  }

  .schedule-table thead tr:first-child th.sch-col-num { z-index: 40; background: var(--sch-header-bg); }

  .schedule-table th.sch-col-fio,

  .schedule-table td.sch-cell-fio {

    position: sticky; left: 34px; /* = ширина # */

    width: 180px; min-width: 180px; max-width: 180px;

    z-index: 20; background: var(--sch-cell-bg);

    border-right: 2px solid rgba(148,163,184,0.5);

    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;

  }

  .schedule-table thead tr:first-child th.sch-col-fio { z-index: 40; background: var(--sch-header-bg); }

  body.theme-dark .schedule-table th.sch-col-num,

  body.theme-dark .schedule-table td.sch-cell-num,

  body.theme-dark .schedule-table th.sch-col-fio,

  body.theme-dark .schedule-table td.sch-cell-fio { background: #0b1220; }



  /* === СТАТИСТИКА === */

  .stat-charts-2 {

    display: grid;

    grid-template-columns: 1fr 1fr;

    gap: 12px;

  }

  @media (max-width: 980px) {

    .stat-charts-2 { grid-template-columns: 1fr; }

  }

  .stat-chart-box {

    position: relative;

    height: 320px;

    width: 100%;

  }

  .stat-chart-box canvas { max-height: 100%; }



  /* === РЕЙТИНГ: фиксируем # + Руководитель + Агент (узкие, ровный скролл) === */

  .table-rating .col-num {

    position: sticky; left: 0;

    width: 30px; min-width: 30px; max-width: 30px;

    background: var(--bg-card); z-index: 3; text-align: center;

  }

  .table-rating .rating-leader {

    position: sticky; left: 30px;

    width: 108px; min-width: 108px; max-width: 108px;

    background: var(--bg-card); z-index: 3;

    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;

  }

  .table-rating .rating-fio {

    position: sticky; left: 138px;

    width: 140px; min-width: 140px; max-width: 140px;

    background: var(--bg-card); z-index: 3;

    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;

    border-right: 2px solid rgba(148,163,184,0.4);

  }

  body.theme-dark .table-rating .col-num,

  body.theme-dark .table-rating .rating-leader,

  body.theme-dark .table-rating .rating-fio { background: #0b1220; }



  /* === Легенда кольцевых диаграмм статистики (вмещает всех, со скроллом) === */

  .stat-legend {

    margin-top: 10px;

    max-height: 168px;

    overflow-y: auto;

    display: grid;

    grid-template-columns: 1fr;

    gap: 2px;

    padding-right: 4px;

  }

  @media (min-width: 560px) {

    .stat-legend { grid-template-columns: 1fr 1fr; gap: 2px 14px; }

  }

  .stat-legend-item {

    display: flex;

    align-items: center;

    gap: 7px;

    font-size: 11.5px;

    padding: 3px 4px;

    border-radius: 6px;

    min-width: 0;

  }

  .stat-legend-item:hover { background: var(--accent-tint); }

  .stat-legend-dot {

    flex: 0 0 auto;

    width: 11px; height: 11px;

    border-radius: 50%;

  }

  .stat-legend-name {

    flex: 1 1 auto;

    min-width: 0;

    overflow: hidden;

    text-overflow: ellipsis;

    white-space: nowrap;

    color: var(--text-main);

    font-weight: 600;

  }

  .stat-legend-val {

    flex: 0 0 auto;

    color: var(--text-muted);

    font-variant-numeric: tabular-nums;

    font-size: 10.5px;

  }



  /* Итоговая строка рейтинга */

  .rating-total-row td {

    border-top: 2px solid var(--accent);

    background: rgba(206,79,8,0.06);

    font-weight: 800;

  }

  .rating-total-row .rating-leader,

  .rating-total-row .rating-fio {

    background: #fdece3;

  }

  body.theme-dark .rating-total-row .rating-leader,

  body.theme-dark .rating-total-row .rating-fio {

    background: #241a12;

  }

  body.theme-dark .rating-total-row td {

    background: rgba(206,79,8,0.12);

  }





  /* === ТАРГЕТ: списки «# | Руководитель | Агент | значение» === */

  .dash-top-item,

  .dash-inactive-item {

    display: grid;

    grid-template-columns: 22px minmax(0, 0.85fr) minmax(0, 1.15fr) auto;

    align-items: center;   /* значения строго напротив имён по вертикали */

    gap: 8px;

    padding: 5px 2px;

    border-bottom: 1px dashed rgba(148,163,184,0.28);

    line-height: 1.25;

  }

  .dash-inactive-item { border-bottom-color: rgba(234,88,12,0.25); }

  .dash-top-num {

    color: var(--text-muted);

    font-size: 10.5px;

    text-align: center;

    font-variant-numeric: tabular-nums;

  }

  .dash-top-leader {

    color: var(--text-muted);

    font-size: 11px;

    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;

  }

  .dash-top-fio {

    font-size: 12px;

    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;

    color: inherit;

  }

  .dash-top-val {

    font-size: 11px;

    text-align: right;

    white-space: nowrap;

    font-variant-numeric: tabular-nums;

    color: var(--text-muted);

  }

  @media (max-width: 520px) {

    .dash-top-item, .dash-inactive-item { grid-template-columns: 20px minmax(0,1fr) auto; }

    .dash-top-leader { grid-column: 2; font-size: 10px; }

    .dash-top-fio { grid-column: 2; grid-row: 2; }

    .dash-top-val { grid-column: 3; grid-row: 1 / span 2; }

  }



  /* Вертикальное выравнивание значений напротив имён в таблицах Таргета */

  .table-leaders td, .table-leaders th,

  .table-dash-detail td, .table-dash-detail th,

  #oldDepsTable td, #oldDepsTable th,

  .table-rating td, .table-rating th,

  #statTopTable td, #statTopTable th {

    vertical-align: middle;

  }





  /* === ИТОГОВЫЕ СТРОКИ ТАБЛИЦ (Таргет, Детализация, Статистика, Задатки) === */

  .table-total-row td {

    border-top: 2px solid var(--accent);

    background: rgba(206,79,8,0.06);

    font-weight: 800;

    position: sticky;

    bottom: 0;              /* итог виден даже при прокрутке длинной таблицы */

    z-index: 5;

  }

  .table-total-row:hover td { background: rgba(206,79,8,0.09); }

  .table-total-row { cursor: default !important; pointer-events: none; }

  body.theme-dark .table-total-row td { background: #241a12; }





  /* === Сортировка: индикаторы в заголовках === */

  .th-sortable { cursor: pointer; user-select: none; -webkit-user-select: none; }

  .th-sortable:hover { color: var(--accent); }

  .th-sortable.sort-asc::after  { content: " \25B2"; font-size: 9px; opacity: 0.8; }

  .th-sortable.sort-desc::after { content: " \25BC"; font-size: 9px; opacity: 0.8; }



  /* === Фикс "двойного касания": убираем ожидание второго тапа (300мс) в моб. браузерах === */

  a, button, select, input, textarea, label,

  .btn, .icon-btn, .nav-btn, th, .th-sortable,

  .row-clickable, .dash-leader-row, .dash-emp-link,

  .dash-top-item, .dash-inactive-item, .kpi-card {

    touch-action: manipulation;

  }

  html { -webkit-text-size-adjust: 100%; }





  /* ==================== МОБИЛЬНАЯ ВЁРСТКА ==================== */

  .mobile-menu-btn { display: none; }

  .sidebar-overlay { display: none; }



  @media (max-width: 900px) {

    .mobile-menu-btn { display: inline-flex; }



    .app-layout { flex-direction: column; padding: 10px; gap: 10px; }



    /* Сайдбар — выдвижная панель слева */

    .sidebar {

      position: fixed; top: 0; left: 0; bottom: 0;

      width: 268px; max-width: 84vw;

      z-index: 1000; border-radius: 0;

      transform: translateX(-105%);

      transition: transform .25s ease;

      overflow-y: auto;

      box-shadow: 0 0 40px rgba(0,0,0,0.45);

    }

    .sidebar.sidebar-open { transform: translateX(0); }

    .sidebar-overlay {

      display: block; position: fixed; inset: 0;

      background: rgba(0,0,0,0.45); z-index: 999;

      opacity: 0; pointer-events: none; transition: opacity .25s ease;

    }

    .sidebar-overlay.show { opacity: 1; pointer-events: auto; }



    .views { width: 100%; }



    /* Топбар компактнее */

    .topbar { padding: 8px 10px; gap: 8px; }

    .topbar-subtitle { display: none; }

    .topbar-title { font-size: 15px; }

    .user-info { font-size: 11px; max-width: 34vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

    .logo-img.small { height: 28px; }



    /* Карточки/секции */

    .card { padding: 12px; border-radius: 12px; }

    .section-header { flex-wrap: wrap; gap: 8px; align-items: flex-start; }

    .section-actions { flex-wrap: wrap; gap: 6px; }



    /* Формы — на весь экран */

    .side-form {

      position: fixed; inset: 0; width: 100%; max-width: none;

      border-radius: 0; z-index: 1100; overflow-y: auto;

    }



    /* Кнопки удобные для пальца */

    .btn { min-height: 40px; }

    .icon-btn { min-width: 38px; min-height: 38px; }

    input, select, textarea, .input { font-size: 16px; }  /* без авто-зума на iOS */



    /* Таблицы */

    .table-list { font-size: 12px; }

    .table-wrap { -webkit-overflow-scrolling: touch; max-height: 66vh !important; }

    .kpi-main { font-size: 20px; }

  }



  @media (max-width: 560px) {

    h2 { font-size: 17px; }

    .app-title { font-size: 18px; }

    .topbar-right .btn.ghost { padding: 6px 10px; }

    .card { padding: 10px; }

    .stat-chart-box { height: 260px; }

  }





  /* === Настройки видимости === */

  .vis-leaders { max-height: 130px; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; min-width: 190px; padding-right: 4px; }

  .vis-leader-row { font-size: 11.5px; display: flex; gap: 6px; align-items: center; cursor: pointer; }

  .vis-leader-row input[disabled] + span { opacity: 0.45; }





  /* =====================================================================
     PANORAMA CRM · UI REFRESH 24.09.2026
     Финальный слой: единая иерархия, формы, карточка клиента, mobile.
     ===================================================================== */

  :root {
    --surface-0: #f6f7f9;
    --surface-1: #ffffff;
    --surface-2: #fafafa;
    --shadow-card: 0 10px 30px -18px rgba(15,23,42,.28);
    --shadow-float: 0 28px 80px -24px rgba(15,23,42,.42);
    --control-h: 38px;
  }

  body.theme-light { --bg-main: var(--surface-0); }
  body.theme-light, body.theme-dark { background: var(--bg-main); }

  .topbar {
    min-height: 58px;
    padding: 8px 18px;
    border-bottom: 1px solid var(--border-soft);
    box-shadow: 0 5px 20px -16px rgba(15,23,42,.45) !important;
  }
  .topbar-title { letter-spacing: .03em; text-transform: none; font-size: 14px; }
  .topbar-subtitle { opacity: .68; }
  .topbar-right { gap: 6px; }
  .logout-btn .material-symbols-outlined { font-size: 18px; }

  .app-layout { gap: 12px; padding: 12px; min-height: calc(100vh - 58px); }
  .sidebar {
    --sidebar-width: 244px;
    padding: 10px;
    border-radius: 14px;
    box-shadow: var(--shadow-card);
    top: 70px;
    height: calc(100vh - 82px);
  }
  .sidebar-group + .sidebar-group { margin-top: 10px; padding-top: 9px; }
  .sidebar-group-title { padding: 0 6px; font-size: 11px; color: var(--text-muted) !important; }
  .nav-btn { min-height: 38px; padding: 7px 9px; border-radius: 10px; }
  .nav-btn .material-symbols-outlined { font-size: 19px; margin-right: 2px; }

  .card {
    border-radius: 14px;
    padding: 16px;
    box-shadow: var(--shadow-card);
  }
  .card.subcard { border-radius: 12px; }
  .section-header { margin-bottom: 12px; }
  .section-hint { margin: 3px 0 0; color: var(--text-muted); font-size: 11px; }

  .btn { min-height: 36px; border-radius: 10px; padding: 7px 12px; }
  .btn.small { min-height: 32px; }
  .icon-btn { min-width: 34px; min-height: 34px; border-radius: 9px; }
  .btn.primary { box-shadow: 0 8px 18px -10px rgba(206,79,8,.75); }

  .input, input[type="text"], input[type="search"], input[type="tel"], input[type="number"],
  input[type="date"], input[type="month"], input[type="email"], input[type="password"], select, textarea {
    min-height: var(--control-h);
    padding: 8px 10px;
    border-radius: 10px;
    font-size: 12px;
  }
  textarea.input, textarea { line-height: 1.45; }
  .field-label { font-size: 10px; letter-spacing: .035em; }
  .required-mark { color: #dc2626; }

  .filters {
    margin-bottom: 10px;
    padding: 10px;
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    background: rgba(148,163,184,.045);
  }
  .deal-filters { grid-template-columns: repeat(6, minmax(120px,1fr)); align-items: end; }
  .deal-search-field { grid-column: span 2; }
  .filter-action-cell { display:flex; align-items:flex-end; }

  .table-wrap, .table-wrapper { border-radius: 11px; }
  .table-list th, .data-table th { height: 34px; font-size: 10px; letter-spacing: .035em; }
  .table-list td, .data-table td { padding: 7px 8px; }
  .table-list tbody tr:hover, .data-table tbody tr:hover { background: rgba(206,79,8,.055); }
  #dealsTable { min-width: 1120px; }
  #dealsTable td { vertical-align: middle; }
  .deal-client-col { min-width: 250px; }

  .deal-type-cell { min-width: 126px; }
  .deal-badge, .deal-side {
    display: inline-flex; align-items: center; width: max-content;
    border-radius: 999px; padding: 2px 7px; font-size: 10px; font-weight: 700;
    border: 1px solid var(--border-soft); white-space: nowrap;
  }
  .deal-type-cell { display: table-cell; }
  .deal-type-cell .deal-badge, .deal-type-cell .deal-side { margin: 1px 4px 1px 0; }
  .deal-badge.is-residential { background: rgba(22,163,74,.09); border-color: rgba(22,163,74,.25); color:#15803d; }
  .deal-badge.is-commercial { background: rgba(37,99,235,.08); border-color: rgba(37,99,235,.22); color:#1d4ed8; }
  .deal-badge.is-legacy { color: var(--text-muted); font-weight: 600; background: rgba(148,163,184,.08); }
  .deal-side { color: var(--text-muted); font-weight: 600; }

  .deal-client-cell { min-width: 250px; max-width: 360px; }
  .client-summary { min-width: 0; }
  .client-summary-name { font-weight: 700; font-size: 12px; color: var(--text-main); }
  .client-summary-meta { margin-top: 2px; font-size: 10.5px; color: var(--text-muted); }
  .client-summary-object { margin-top: 2px; font-size: 10.5px; color: var(--text-muted); white-space: nowrap; overflow:hidden; text-overflow:ellipsis; }
  .client-card-empty { display:inline-flex;align-items:center;gap:5px;color:var(--text-muted);font-size:11px; }
  .client-card-empty .material-symbols-outlined { font-size:16px; }

  .empty-state-cell { text-align:center; padding:28px 12px !important; color:var(--text-muted); }
  .empty-state-cell > * { display:block; margin:3px auto; }
  .empty-state-cell .material-symbols-outlined { font-size:28px; opacity:.6; }

  /* Лейеры: topbar 50 < backdrop 70 < side-form 80; mobile overrides below. */
  .form-backdrop {
    position: fixed; inset: 0; z-index: 70;
    background: rgba(15,23,42,.28);
    backdrop-filter: blur(2px);
    animation: backdropIn .16s ease-out;
  }
  @keyframes backdropIn { from { opacity:0; } to { opacity:1; } }
  body.side-form-open { overflow: hidden; }
  .side-form { z-index: 80; width: min(560px, calc(100vw - 36px)); top: 70px; right: 18px; bottom: 18px; box-shadow: var(--shadow-float); }
  .side-form-wide { width: min(620px, calc(100vw - 36px)); }
  .side-form-body { padding: 16px 18px 14px; }
  .side-form-title-row { display:flex;align-items:flex-start;justify-content:space-between;gap:10px;margin-bottom:12px; }
  .side-form-title-row h3 { font-size: 18px; margin:0; }
  .form-subtitle { text-align:left; margin:3px 0 0; }
  .side-form-close { flex:0 0 auto; }
  .side-form-footer { align-items:center; padding:10px 18px 12px; background:var(--bg-card); }
  .side-form-save-note { margin-right:auto; display:flex;align-items:center;gap:5px;color:var(--text-muted);font-size:10.5px; }
  .side-form-save-note .material-symbols-outlined { font-size:16px;color:#16a34a; }

  .form-tabs { display:flex; gap:5px; padding:4px; margin:0 0 14px; border:1px solid var(--border-soft); border-radius:12px; background:rgba(148,163,184,.07); }
  .form-tab { flex:1; min-height:38px; border:0; border-radius:9px; background:transparent; color:var(--text-muted); font:600 11px var(--font-ui); cursor:pointer; display:flex;align-items:center;justify-content:center;gap:5px; }
  .form-tab .material-symbols-outlined { font-size:17px; }
  .form-tab.active { background:var(--bg-card); color:var(--text-main); box-shadow:0 3px 12px -8px rgba(15,23,42,.5); }
  .tab-state { margin-left:3px;padding:1px 5px;border-radius:999px;background:rgba(148,163,184,.14);font-size:9px;font-weight:700;color:var(--text-muted); }
  .tab-state.is-filled { background:rgba(22,163,74,.12);color:#15803d; }

  .form-panel { animation: panelIn .14s ease-out; }
  @keyframes panelIn { from { opacity:.45; transform:translateY(2px); } to { opacity:1;transform:none; } }
  .form-section-label { margin:14px 0 8px; font-size:10px; font-weight:800; text-transform:uppercase; letter-spacing:.08em; color:var(--text-muted); }
  .form-section-label:first-child { margin-top:0; }
  .field-emphasis .input { border-color:rgba(206,79,8,.55); box-shadow:0 0 0 3px rgba(206,79,8,.07); }
  .deal-main-grid .field, #dealTabClient .field { margin-bottom:0; }
  .side-form-wide .grid-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .deposit-field-card { margin:12px 0; padding:11px; border:1px solid rgba(206,79,8,.18); border-radius:11px; background:rgba(206,79,8,.035); }
  .input-with-suffix { display:grid; grid-template-columns:1fr auto; gap:8px; align-items:center; }
  .input-with-suffix > span { font-size:11px;color:var(--text-muted);white-space:nowrap; }
  .client-card-intro { display:flex;gap:9px;align-items:flex-start;padding:10px 11px;margin-bottom:14px;border-radius:11px;background:rgba(37,99,235,.06);border:1px solid rgba(37,99,235,.14);font-size:11px;color:var(--text-muted); }
  .client-card-intro b { color:var(--text-main); }
  .client-card-intro .material-symbols-outlined { font-size:18px;color:#2563eb; }

  .toast { z-index: 2200; }
  .loader { z-index: 2100; }
  #pwdModal { z-index: 1500 !important; }

  /* Статистика: первые KPI визуально приоритетные. */
  #statKpis { grid-template-columns: repeat(4, minmax(0,1fr)); }
  #statKpis .kpi-card:nth-child(1), #statKpis .kpi-card:nth-child(2) { border-color:rgba(22,163,74,.28); background:linear-gradient(180deg,rgba(22,163,74,.045),transparent); }

  /* Final mobile rules — заменяют накопившиеся ранние mobile overrides. */
  @media (max-width: 1100px) {
    .deal-filters { grid-template-columns: repeat(3, minmax(0,1fr)); }
    .deal-search-field { grid-column: span 2; }
    #statKpis { grid-template-columns: repeat(2, minmax(0,1fr)); }
  }

  @media (max-width: 900px) {
    .mobile-menu-btn { display:inline-flex; }
    .topbar { min-height:56px; flex-wrap:nowrap; align-items:center; padding:7px 9px; }
    .topbar-left { min-width:0; flex:1 1 auto; }
    .topbar-right { width:auto; flex:0 0 auto; margin-left:auto; padding:0; overflow:visible; justify-content:flex-end; }
    .topbar-title { font-size:13px; }
    .topbar-subtitle { display:none; }
    .logo-img.small { max-width:92px; max-height:28px; }
    .user-info { max-width:24vw; font-size:10px; }
    .logout-btn { min-width:38px; padding:0 8px; }

    .app-layout { display:block; padding:8px; min-height:0; }
    .sidebar {
      position:fixed; top:0; left:0; bottom:0; height:100dvh;
      width:280px; max-width:86vw; z-index:1000; border-radius:0;
      transform:translateX(-105%); transition:transform .22s ease;
      overflow-y:auto; overflow-x:hidden; display:flex; flex-direction:column;
      padding:14px 10px calc(14px + env(safe-area-inset-bottom)); margin:0;
    }
    .sidebar.sidebar-open { transform:translateX(0); }
    .sidebar-overlay { display:block;position:fixed;inset:0;background:rgba(15,23,42,.48);z-index:999;opacity:0;pointer-events:none;transition:opacity .2s ease; }
    .sidebar-overlay.show { opacity:1;pointer-events:auto; }
    .sidebar-group { display:block; width:100%; }
    .sidebar-group-title { display:flex; }
    .nav-btn { width:100%;justify-content:flex-start;min-width:0;margin-bottom:3px; }

    .views,.view,.view>.card,.view .card { height:auto; min-height:0; }
    .card { padding:12px; }
    .section-header { flex-direction:row; align-items:flex-start; }
    .section-actions { width:100%; display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:7px; }
    .section-actions > * { min-width:0; }

    .form-backdrop { z-index:1090; }
    .side-form, .side-form-wide {
      position:fixed; inset:0; z-index:1100; width:100%; max-width:none; height:100dvh;
      border-radius:0; border:0; box-shadow:none; overflow:hidden;
    }
    .side-form-body { padding:14px 14px 10px; overflow:auto; overscroll-behavior:contain; }
    .side-form-footer { position:sticky; bottom:0; z-index:2; padding:9px 12px calc(9px + env(safe-area-inset-bottom)); box-shadow:0 -8px 22px -18px rgba(15,23,42,.6); }
    .side-form-save-note { display:none; }
    .side-form-footer .btn { flex:1; min-height:44px; }
    .form-tabs { position:sticky; top:-14px; z-index:3; margin-left:-2px;margin-right:-2px; background:var(--bg-card); }

    input, select, textarea, .input { font-size:16px !important; min-height:44px; }
    .btn { min-height:42px; }
    .icon-btn { min-width:40px;min-height:40px; }
    .table-wrap,.table-wrapper { max-height:68dvh !important; overflow:auto; -webkit-overflow-scrolling:touch; }
    .table-list th,.table-list td { padding:8px; }
  }

  @media (max-width: 680px) {
    .topbar .user-info { display:none; }
    .logout-text { display:none; }
    .topbar-right { gap:2px; }
    .logo-img.small { max-width:74px; }
    .app-layout { padding:6px; }
    .card { padding:10px; border-radius:11px; }
    .section-header { flex-direction:column;align-items:stretch; }
    .section-header > .btn { width:100%; justify-content:center; }
    .section-actions { grid-template-columns:1fr; }

    .deal-filters { grid-template-columns:repeat(2,minmax(0,1fr)) !important; gap:7px; padding:8px; }
    .deal-search-field { grid-column:1 / -1; }
    .filter-action-cell { grid-column:1 / -1; }
    .filter-action-cell .btn { width:100%; }
    .grid-2, .grid-3, .grid-4, .grid-5 { grid-template-columns:1fr !important; }
    .side-form-wide .grid-2 { grid-template-columns:1fr !important; }
    #statKpis { grid-template-columns:1fr 1fr !important; gap:8px; }
    .kpi-card { min-height:88px; }
    .kpi-main { font-size:18px; }

    .side-form-title-row h3 { font-size:17px; }
    .form-tab { font-size:10px; min-height:42px; }
    .tab-state { display:none; }
    .input-with-suffix { grid-template-columns:1fr; }
    .input-with-suffix > span { padding-left:2px; }
    #dealsTable { min-width:1040px; }
  }

  @media (max-width: 420px) {
    #statKpis { grid-template-columns:1fr !important; }
    .deal-filters { grid-template-columns:1fr !important; }
    .deal-search-field,.filter-action-cell { grid-column:auto; }
    .form-tabs { gap:3px;padding:3px; }
    .form-tab { padding:6px; }
  }


  /* HOTFIX 24.09.2026: normalized CSS whitespace; narrow-screen dialog guards. */
  input, select, textarea, button { font-family: var(--font-ui); }
  #pwdModal { padding: 12px; }
  #pwdModal > .login-card {
    width: min(340px, calc(100vw - 24px)) !important;
    max-width: 100%;
    max-height: calc(100vh - 24px);
    max-height: calc(100dvh - 24px);
    min-height: 0;
    overflow: auto;
    flex: 0 1 auto;
  }
  @media (max-width: 900px) {
    :root { --control-h: 44px; }
    .btn, .btn.small { min-height: 42px; }
  }

  /* 2026.09.24.2: active state must win against themed :hover rules. */
  body.theme-light .sidebar .nav-btn.active,
  body.theme-dark .sidebar .nav-btn.active,
  body.theme-light .sidebar .nav-btn.active:hover,
  body.theme-dark .sidebar .nav-btn.active:hover,
  body.theme-light .sidebar .nav-btn.active:focus,
  body.theme-dark .sidebar .nav-btn.active:focus,
  body.theme-light .sidebar .nav-btn.active:active,
  body.theme-dark .sidebar .nav-btn.active:active {
    background: linear-gradient(135deg, #ca4a08, #b84105) !important;
    color: #fff !important;
    border-color: transparent;
    transform: none;
  }
  body .sidebar .nav-btn.active .material-symbols-outlined { color: #fff !important; }
  body .sidebar .nav-btn.active:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
  .form-validation-error { padding:10px 12px; margin:0 0 10px; border:1px solid #f2a7a7; border-radius:10px; background:#fff0f0; color:#9f2020; font-size:12px; }
  .optional-label { text-transform:none; letter-spacing:0; font-weight:400; }
  .tab-state.is-required { background:rgba(206,79,8,.10); color:var(--accent-strong); }
  .stat-fraction { white-space:nowrap; }
  .fraction-separator { color:var(--text-muted); font-weight:500; }
  .stat-method-note { margin:0 0 14px; padding:10px 12px; border:1px solid var(--border-soft); border-radius:10px; color:var(--text-muted); font-size:12px; }
  .stat-method-note summary { cursor:pointer; font-weight:600; color:var(--text-main); }
  .stat-method-note p { margin:8px 0 0; line-height:1.5; }
  .stat-teams-card { margin-bottom:16px !important; }
  #statTeamsTable { min-width:820px; }
  #statTeamsTable th { text-transform:none; font-size:11px; letter-spacing:0; }
  #statTeamsTable td { vertical-align:middle; }
  .stat-number { font-variant-numeric:tabular-nums; white-space:nowrap; text-align:right; }
  .stat-team-name { min-width:180px; font-weight:650; }
  .stat-execution { font-weight:800; }
  .stat-positive { color:#15803d; }
  .stat-pending { color:#a34c03; }
  #statKpis .kpi-sub { overflow-wrap:anywhere; }
  .identity-upload-card { padding:12px; border:1px solid var(--border-soft); border-radius:11px; background:var(--accent-tint); }
  .identity-file-state { margin-top:9px; }
  .col-identity { min-width:125px; white-space:nowrap; }
  .doc-status { display:inline-flex; align-items:center; padding:5px 9px; min-height:30px; border:1px solid transparent; border-radius:8px; font:600 11px var(--font-ui); }
  button.doc-status { cursor:pointer; }
  .doc-present { background:#e8f5ee; color:#126638; border-color:#b5dec5; }
  button.doc-present:hover { background:#d5eddf; border-color:#5eac81; }
  .doc-missing { background:#f4f5f7; color:#647083; border-color:#e1e5ec; }
  .identity-modal { position:fixed; inset:0; z-index:1600; display:flex; align-items:center; justify-content:center; padding:20px; background:rgba(15,23,42,.52); }
  .identity-dialog { display:flex; flex-direction:column; width:min(920px,100%); height:min(820px,calc(100dvh - 40px)); min-height:0; background:var(--bg-card); color:var(--text-main); border:1px solid var(--border-soft); border-radius:15px; overflow:hidden; box-shadow:var(--shadow-float); }
  .identity-dialog-header { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:12px 16px; border-bottom:1px solid var(--border-soft); }
  .identity-dialog-header h3 { margin:0; }
  .identity-preview-content { flex:1; min-height:0; padding:12px; overflow:auto; background:var(--bg-main); }
  .identity-preview-content img { display:block; max-width:100%; max-height:100%; object-fit:contain; margin:auto; }
  .identity-preview-content object { display:block; width:100%; height:100%; min-height:250px; border:0; }
  .identity-dialog-footer { display:flex; gap:8px; justify-content:flex-end; align-items:center; padding:12px 16px; border-top:1px solid var(--border-soft); }
  .identity-dialog-footer > span { flex:1; }
  .identity-dialog-footer a { text-decoration:none; }
  body.theme-dark .form-validation-error { background:#331d25; border-color:#793943; color:#ffb9be; }
  body.theme-dark .doc-present { color:#a4e7bc; background:#183a2a; border-color:#306948; }
  body.theme-dark button.doc-present:hover { background:#235038; }
  body.theme-dark .doc-missing { color:#b7c0ce; background:#182132; border-color:#334156; }
  body.theme-dark .stat-positive { color:#86dfaa; }
  body.theme-dark .stat-pending { color:#ffc786; }
  body.theme-dark .tab-state.is-required { color:#ffb38b; }
  @media (max-width:900px) {
    .identity-modal { padding:0; }
    .identity-dialog { width:100%; height:100dvh; border-radius:0; border:0; }
    .identity-dialog-footer { padding:10px 12px calc(10px + env(safe-area-inset-bottom)); flex-wrap:wrap; }
    .identity-dialog-footer > span { flex-basis:100%; }
    .identity-dialog-footer .btn { flex:1; }
    .identity-dialog-header { padding-top:calc(12px + env(safe-area-inset-top)); }
    .doc-status { min-height:40px; font-size:12px; }
  }
  @media (max-width:680px) {
    #view-statistics .stat-teams-wrap { overflow:visible; max-height:none !important; border:0; margin-top:12px; }
    #statTeamsTable { display:block; min-width:0 !important; width:100%; }
    #statTeamsTable thead { display:none; }
    #statTeamsTable tbody { display:grid; gap:10px; }
    #statTeamsTable tr { display:grid; grid-template-columns:1fr 1fr; gap:6px 12px; border:1px solid var(--border-soft); padding:12px; border-radius:10px; background:var(--bg-card); }
    #statTeamsTable td { display:flex; flex-direction:column; gap:3px; text-align:left; border:0; padding:0; min-width:0; white-space:normal; position:static; overflow-wrap:anywhere; }
    #statTeamsTable td:first-child { display:none; }
    #statTeamsTable td.stat-team-name { grid-column:1 / -1; padding-bottom:8px; border-bottom:1px solid var(--border-soft); font-size:13px; }
    #statTeamsTable td::before { content:attr(data-label); font-size:10px; font-weight:500; color:var(--text-muted); }
    #statTeamsTable td.stat-team-name::before { display:none; }
    #statTeamsTable td.empty-state-cell { grid-column:1 / -1; display:block; }
    #statTeamsTable tr.stat-team-total { background:var(--accent-tint); border-color:var(--accent-ring); }
    #statTeamsTable tr.stat-team-total td { background:transparent; }
    .employee-filters { grid-template-columns:1fr 1fr !important; }
    .employee-filters > div:last-child { grid-column:1 / -1; }
  }
  @media (max-width:360px) {
    .employee-filters { grid-template-columns:1fr !important; }
  }

/* Icon geometry remains stable while the webfont is loading. */
.material-symbols-outlined {
  display: inline-block;
  font-family: 'Material Symbols Outlined', sans-serif;
  font-feature-settings: 'liga';
  width: 1em;
  height: 1em;
  line-height: 1;
  flex: 0 0 auto;
  white-space: nowrap;
  overflow: hidden;
}
/* Compact period controls: labels remain attached to their fields. */
#view-statistics > .card > .section-header {flex-wrap: wrap; align-items: flex-end;}
#view-statistics .stat-filter-controls {display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; max-width: 100%; margin-left: auto;}
.stat-filter-field {width: 138px; min-width: 0;}
.stat-filter-field label {text-align: left;}
.stat-filter-field.stat-filter-team {width: 190px;}
@media (max-width: 760px) {
  #view-statistics .stat-filter-controls {display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); width: 100%; margin: 0;}
  .stat-filter-field, .stat-filter-field.stat-filter-team {width: auto; min-width: 0;}
}
@media (max-width: 380px) {
  #view-statistics .stat-filter-controls {grid-template-columns: minmax(0,1fr);}
}

/* 2026.09.29.3: доля агентов рядом с исходной дробью, без изменения денежного KPI. */
#statKpis .stat-agent-fact { display:flex; flex-wrap:wrap; align-items:center; gap:6px 10px; max-width:100%; }
#statKpis .stat-agent-percent { display:inline-flex; align-items:center; font-size:13px; font-weight:750; line-height:1.4; padding:3px 8px; border-radius:7px; color:var(--text-main); background:var(--accent-tint); border:1px solid var(--accent-ring); white-space:nowrap; }
#statTeamsTable td[data-label="Агенты с закрытиями"] { font-variant-numeric:tabular-nums; }
@media (max-width:680px) {
  #statKpis .stat-agent-percent { font-size:13px; }
}
/* v6: периоды работы; только обычные пробелы в CSS. */
.employment-editor { grid-column:1 / -1; min-width:0; border:1px solid var(--border-soft); border-radius:12px; padding:14px; background:var(--bg-card); }
.employment-editor h4 { display:flex; align-items:center; gap:7px; margin:0 0 8px; }
.work-periods { display:flex; flex-direction:column; gap:12px; }
.work-period-row { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px 10px; padding:12px; border:1px solid var(--border-soft); border-radius:10px; min-width:0; }
.work-period-title { grid-column:1 / -1; font-size:12px; font-weight:700; color:var(--text-muted); }
.work-period-field { min-width:0; }
.work-period-row .field-label { font-size:11px; letter-spacing:0; text-transform:none; }
.work-period-actions { display:flex; flex-wrap:wrap; gap:8px; margin-top:12px; }
.work-remove { grid-column:1 / -1; justify-self:start; }
.work-error, .work-warning { color:var(--accent-strong); }
body.theme-dark .work-error, body.theme-dark .work-warning { color:#fdba74; }
.work-error { padding:10px; border:1px solid currentColor; border-radius:9px; font-size:12px; }
.work-period-cell { min-width:165px; max-width:240px; }
.work-status { display:inline-block; font-size:10px; padding:3px 7px; border-radius:6px; font-weight:700; margin-bottom:4px; }
.work-status.work-working { background:#e8f5ee; color:#166534; }
.work-status.work-ended { background:#eef0f3; color:#475569; }
.work-status.work-future { background:#eaf1fe; color:#1e40af; }
.work-status.work-unknown { background:#fff1dc; color:#92400e; }
body.theme-dark .work-status { background:#263344; color:#e2e8f0; }
body.theme-dark .work-status.work-unknown { background:#422b13; color:#fed7aa; }
.work-dates { font-size:11px; line-height:1.5; }
.work-filter-row { display:flex; flex-wrap:wrap; gap:8px; align-items:center; margin:6px 0; }
.work-filter-row select { width:230px; max-width:100%; }
.employment-cohort-note { font-size:11px; margin:4px 0 12px; color:var(--text-muted); line-height:1.5; }
.employment-audit-wrap { min-width:0; margin:0 0 10px; }
.employment-audit { border:1px solid var(--border-soft); border-left:3px solid var(--accent); border-radius:10px; padding:10px 12px; background:var(--bg-card); }
.employment-audit summary { cursor:pointer; font-weight:700; font-size:12px; line-height:1.5; }
.employment-audit p { font-size:12px; line-height:1.6; margin:8px 0; overflow-wrap:anywhere; }
.employment-reconciliation { display:grid; grid-template-columns:1fr; gap:2px; padding:8px 12px; background:var(--accent-tint); border-radius:8px; }
.employment-unknown-list { display:grid; gap:6px; max-height:220px; overflow:auto; margin:10px 0; }
.employment-unknown-row { display:flex; gap:8px; justify-content:space-between; align-items:center; font-size:12px; border-bottom:1px solid var(--border-soft); padding:6px 0; }
.employment-unknown-row > span { min-width:0; overflow-wrap:anywhere; }
.employment-unknown-row > .btn { flex-shrink:0; }
.employment-audit .employment-audit-table { max-height:330px !important; margin-top:10px; flex:none; }
.employment-audit-table table { min-width:680px; }
.work-outside { color:var(--text-muted); background:var(--table-row-alt); font-style:italic; text-align:right; }
.work-plan-note { font-size:12px; padding:10px 12px; border:1px solid var(--border-soft); border-left:3px solid var(--accent); border-radius:9px; line-height:1.6; margin:10px 0; }
#view-schedule .employment-audit-wrap { margin:10px 20px; }
.schedule-legend { margin:0 20px 10px; }
@media(max-width:560px) {
  .employment-editor { padding:10px; }
  .work-period-row { grid-template-columns:1fr; padding:10px; }
  .work-period-row .input { min-height:44px; font-size:16px; }
  .work-period-actions .btn { width:100%; }
  .employment-unknown-row { align-items:flex-start; }
  #view-schedule .employment-audit-wrap { margin:8px 10px; }
  .schedule-legend { margin:0 10px 8px; }
}


