/* Тема RepresSale поверх Unfold 0.110 по токенам amoCRM (цвета, PT Sans, радиус 4px,
   плотность списков, тёмный рабочий стол на градиенте). Всё своё — с префиксом rs-;
   остальное — точечные переопределения разметки Unfold. */
@import url('https://fonts.googleapis.com/css2?family=PT+Sans:wght@400;700&display=swap');

:root {
    --amo-bg: #f5f5f5;
    --amo-surface: #ffffff;
    --amo-text: #363b44;
    --amo-text-2: #6b6d72;
    --amo-text-3: #92989b;
    --amo-border: #e8eaeb;
    --amo-border-2: #c5c5c5;
    --amo-blue: #4c8bf7;
    --amo-blue-dark: #4077d6;
    --amo-link: #0057a9;
    --amo-green: #24bc8c;
    --amo-red: #f37575;
    --amo-red-dark: #ce3942;
    --amo-yellow: #ffd66d;
    --amo-orange: #e4b248;
    --amo-purple: #8a7cfd;
    --amo-nav: #1b3446;
    --amo-nav-2: #162b3a;
    --amo-nav-text: #c3cfd8;
    --amo-nav-border: #224357;
    --amo-badge: #ce3942;
    --dash-card: #13293f;
    --dash-muted: #9fb3c8;
    --dash-line: rgba(255, 255, 255, .12);
    --radius-default: 4px;
}

/* ---------- база ---------- */
body { font-family: "PT Sans", Arial, sans-serif; color: var(--amo-text); -webkit-font-smoothing: antialiased; }
#main { background: var(--amo-bg) !important; }
#main > div:first-child { background: #fff !important; border-bottom: 1px solid var(--amo-border) !important; }
#main > div:first-child h1 { font-size: 15px; }
html.dark #main { background: #0f172a !important; }
html.dark #main > div:first-child { background: #111827 !important; }
option { color: #222; }

/* ---------- кнопки, поля ---------- */
.bg-primary-600 { background-color: var(--amo-blue) !important; }
.hover\:bg-primary-700:hover { background-color: var(--amo-blue-dark) !important; }
button.bg-primary-600, a.bg-primary-600 { font-weight: 700; }
input[type="text"], input[type="search"], input[type="number"], input[type="email"], input[type="url"],
input[type="password"], input[type="date"], input[type="datetime-local"], select, textarea {
    border-color: var(--amo-border-2) !important; font-family: inherit;
}
input:focus, select:focus, textarea:focus { outline-color: var(--amo-blue) !important; }
.filter-open-button { height: 38px; font-weight: 700; border-color: var(--amo-border-2) !important; }
#changelist-search input { height: 38px; }

/* ---------- списки ---------- */
.result-list-wrapper > div { border-color: var(--amo-border) !important; }
#result_list thead th {
    background: #fafbfc; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--amo-text-3);
    height: 40px; border-bottom: 1px solid var(--amo-border); font-weight: 700;
}
#result_list thead th a, #result_list thead th span { color: var(--amo-text-3); }
#result_list td { font-size: 13px; height: 44px !important; line-height: 1.3; border-color: #eef0f2 !important; }
#result_list tr.data-row:hover td { background: #f5f7fc; }
#result_list td a:hover { color: var(--amo-link); }
a.rounded-default.shadow-xs:hover { box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08); }
code[style*="user-select"] { font-size: 12px; padding: 2px 6px; border-radius: 4px; background: rgba(148, 163, 184, 0.15); }

/* выбор периода над списком (date_hierarchy) — круглые кнопки */
ul.toplinks { gap: 6px; margin: 0 !important; }
ul.toplinks li { padding: 0 !important; }
ul.toplinks li a { display: inline-flex; align-items: center; height: 30px; padding: 0 12px; border-radius: 15px; background: #fff; border: 1px solid var(--amo-border); color: var(--amo-text-2); font-size: 13px; text-decoration: none; white-space: nowrap; }
ul.toplinks li a:hover { border-color: var(--amo-blue); color: var(--amo-text); }
ul.toplinks li.date-back a { background: transparent; border-color: transparent; padding-left: 4px; }
ul.toplinks li.date-back a .material-symbols-outlined { margin-right: 4px !important; }

/* пагинация под списком */
div[class*="scrollable-top"] { border-color: var(--amo-border) !important; }
div[class*="scrollable-top"] a[href*="p="] { display: inline-flex; min-width: 28px; height: 28px; align-items: center; justify-content: center; border-radius: 4px; padding: 0 8px; color: var(--amo-text-2); text-decoration: none; font-size: 13px; }
div[class*="scrollable-top"] a[href*="p="]:hover { background: #eef2f7; color: var(--amo-text); }
div[class*="scrollable-top"] div[class^="pe-"] > span { display: inline-flex; min-width: 28px; height: 28px; align-items: center; justify-content: center; border-radius: 4px; padding: 0 8px; background: var(--amo-blue); color: #fff; font-weight: 700; font-size: 13px; }
div[class*="scrollable-top"] .py-4 { color: var(--amo-text-3); font-size: 13px; }

/* метки статусов (шаблон unfold/helpers/label.html переопределён) */
.rs-label {
    display: inline-flex; align-items: center; gap: 3px; height: 22px; padding: 0 8px; border-radius: 3px;
    font-size: 10px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; white-space: nowrap; line-height: 1;
}
.rs-label--md { height: 18px; padding: 0 6px; font-size: 9px; }
.rs-label__icon { font-size: 13px; }
.rs-label--info { background: #e5eeff; color: #2a5fb8; }
.rs-label--primary { background: #e9f1ff; color: #0057a9; }
.rs-label--success { background: #e0fbed; color: #1f8f5a; }
.rs-label--warning { background: #fdf0c3; color: #8a6400; }
.rs-label--danger { background: #fde1e1; color: #b83b3b; }
.rs-label--default { background: #eef0f2; color: #6b6d72; }

/* ---------- формы ---------- */
fieldset.module { margin-bottom: 18px; }
fieldset.module > h2 {
    margin: 0 0 8px !important; padding: 0 !important; font-size: 11px; text-transform: uppercase; letter-spacing: .08em;
    color: var(--amo-text-3) !important; font-weight: 700;
}
.form-rows { border-color: var(--amo-border) !important; box-shadow: none !important; background: #fff; }
.form-row { background: #fff !important; }
.form-row + .form-row { border-top: 1px solid #eef0f2 !important; }
.form-row label { font-weight: 700 !important; color: var(--amo-text) !important; font-size: 13px !important; }
.form-row .readonly { font-size: 13px; color: var(--amo-text); }
.form-row .help, .form-row .text-xs { color: var(--amo-text-3); }
.inline-related { border-color: var(--amo-border) !important; }
.inline-related > h3 { background: #fafbfc; font-size: 13px; }
#submit-row > div { border-color: var(--amo-border) !important; }

/* ---------- компактный аудиоплеер ---------- */
.rs-audio { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; vertical-align: middle; }
.rs-audio-btn { width: 30px; height: 30px; border-radius: 50%; background: var(--amo-blue); color: #fff; border: 0; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; flex: 0 0 30px; }
.rs-audio-btn:hover { background: var(--amo-blue-dark); }
.rs-audio-btn .material-symbols-outlined { font-size: 20px; }
.rs-audio .pause { display: none; }
.rs-audio.playing .play { display: none; }
.rs-audio.playing .pause { display: inline; }
.rs-audio-bar { width: 110px; height: 6px; border-radius: 999px; background: rgba(148, 163, 184, .3); overflow: hidden; cursor: pointer; }
.rs-audio-bar i { display: block; height: 100%; width: 0; background: var(--amo-blue); transition: width .25s linear; }
.rs-audio-time { font-variant-numeric: tabular-nums; font-size: 12px; opacity: .75; min-width: 80px; }
.rs-audio-dl { opacity: .55; display: inline-flex; }
.rs-audio-dl:hover { opacity: 1; }
.rs-audio-dl .material-symbols-outlined { font-size: 18px; }

/* ---------- карточка задачи / клиента в админке ---------- */
.rs-sheet { font-size: 13px; line-height: 1.45; max-width: 900px; }
.rs-sheet-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.rs-sheet-head h2 { margin: 0; font-size: 18px; font-weight: 700; }
.rs-sheet dl { display: grid; grid-template-columns: 170px 1fr; gap: 6px 14px; margin: 0 0 12px; }
.rs-sheet dt { color: var(--amo-text-3); }
.rs-sheet dd { margin: 0; }
.rs-sheet p { margin: 0 0 12px; white-space: pre-line; }
.rs-sheet h4 { margin: 14px 0 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--amo-text-3); }
.rs-sheet ul { margin: 0; padding: 0; list-style: none; }
.rs-sheet li { padding: 8px 10px; border: 1px solid var(--amo-border); border-radius: 4px; margin-bottom: 6px; background: #fafbfc; }
.rs-sheet li small { color: var(--amo-text-3); display: block; margin-bottom: 2px; }
.rs-sheet-empty { color: var(--amo-text-3); }
/* карточка занимает всю ширину строки формы: пустая колонка подписи не нужна */
.form-row:has(.rs-sheet) > div { display: block !important; }
.form-row:has(.rs-sheet) label { display: none !important; }
.form-row:has(.rs-sheet) .readonly { max-width: none !important; }
/* разделители строк формы — сплошные, а не пунктир */
.form-row .border-dashed, .form-row > div { border-style: solid !important; border-color: #eef0f2 !important; }

/* ---------- переключатель организации в шапке ---------- */
.rs-org-switch { position: relative; display: inline-flex; align-items: center; height: 36px; border: 1px solid var(--amo-border-2); border-radius: 4px; background: #fff; padding: 0 6px 0 10px; color: var(--amo-nav); }
.rs-org-switch:hover { border-color: var(--amo-blue); }
.rs-org-switch__icon { font-size: 18px; color: #6b7a86; margin-right: 6px; }
.rs-org-switch select { appearance: none; -webkit-appearance: none; border: 0 !important; background: transparent; font: inherit; font-weight: 700; font-size: 13px; color: inherit; padding: 0 22px 0 0; cursor: pointer; outline: none !important; max-width: 260px; }
.rs-org-switch__chevron { position: absolute; right: 4px; font-size: 18px; color: #6b7a86; pointer-events: none; }

/* ======================================================================
   Рабочий стол: градиент на всю страницу и тёмные карточки, как в amoCRM.
   ====================================================================== */
#main:has(.rs-dash) { background: linear-gradient(165deg, #1b4a86 0%, #1f5c9c 30%, #2787b0 65%, #30adbb 100%) !important; }
#main:has(.rs-dash) > div:first-child { background: transparent !important; border-bottom-color: rgba(255, 255, 255, .18) !important; }
#main:has(.rs-dash) > div:first-child h1, #main:has(.rs-dash) > div:first-child h1 a,
#main:has(.rs-dash) > div:first-child .material-symbols-outlined { color: #fff !important; }
#main:has(.rs-dash) .rs-org-switch { background: rgba(255, 255, 255, .14); border-color: rgba(255, 255, 255, .3); color: #fff; }
#main:has(.rs-dash) .rs-org-switch__icon, #main:has(.rs-dash) .rs-org-switch__chevron { color: #fff; }
#main:has(.rs-dash) .rs-org-switch select { color: #fff; }

.rs-dash { color: #fff; padding-bottom: 28px; }
.rs-dash-head { text-align: center; padding: 6px 0 22px; }
.rs-dash-title { font-size: 34px; font-weight: 700; letter-spacing: -.5px; text-shadow: 0 1px 2px rgba(0, 0, 0, .18); }
.rs-dash-sub { font-size: 13px; opacity: .85; margin-top: 4px; }
.rs-period { display: inline-flex; background: rgba(255, 255, 255, .96); border-radius: 22px; padding: 4px; margin-top: 16px; box-shadow: 0 2px 10px rgba(0, 0, 0, .14); }
.rs-period a { color: #4b5560; padding: 7px 18px; border-radius: 18px; font-size: 13px; font-weight: 700; text-decoration: none; white-space: nowrap; }
.rs-period a:hover { color: #1b3446; }
.rs-period a.active { background: #e5eeff; color: #1b3446; }

.rs-dash-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 14px; }
.rs-dcard {
    background: var(--dash-card); border-radius: 8px; padding: 16px 18px 14px; box-shadow: 0 4px 14px rgba(0, 0, 0, .16);
    min-width: 0; grid-column: span 3; color: #fff; text-decoration: none; display: block;
}
.rs-dcard--6 { grid-column: span 6; }
.rs-dcard--12 { grid-column: span 12; }
a.rs-dcard:hover { background: #17304a; }
@media (max-width: 1180px) { .rs-dcard, .rs-dcard--6 { grid-column: span 6; } .rs-dcard--12 { grid-column: span 12; } }
@media (max-width: 720px) { .rs-dcard, .rs-dcard--6, .rs-dcard--12 { grid-column: span 12; } .rs-dash-title { font-size: 26px; } }
.rs-dcard h3 { margin: 0 0 8px; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; font-weight: 700; color: #fff; display: flex; justify-content: space-between; gap: 8px; }
.rs-dcard h3 span { text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--dash-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rs-dcard-num { font-size: 44px; font-weight: 700; line-height: 1; color: var(--c, var(--amo-purple)); margin: 8px 0 4px; letter-spacing: -1px; }
.rs-dcard .rs-dcard-num--empty { color: var(--dash-muted); font-size: 20px; font-weight: 400; padding: 14px 0 10px; letter-spacing: 0; }
.rs-dcard-cap { font-size: 12px; color: var(--dash-muted); }
.rs-dcard-delta { font-size: 12px; margin-top: 2px; }
.rs-up { color: #3fd5a0; }
.rs-down { color: #ff8f8f; }
.rs-flat { color: var(--dash-muted); }
.rs-dcard-line { height: 1px; background: var(--dash-line); margin: 14px 0 10px; }

.rs-funnel { display: flex; flex-direction: column; gap: 9px; }
.rs-funnel-row2 { display: grid; grid-template-columns: 150px 1fr 44px; align-items: center; gap: 10px; font-size: 12px; color: #d4e0ec; text-decoration: none; }
.rs-funnel-row2:hover { color: #fff; }
.rs-funnel-row2 span:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rs-funnel-bar { height: 10px; background: rgba(255, 255, 255, .08); border-radius: 5px; overflow: hidden; }
.rs-funnel-bar i { display: block; height: 100%; background: var(--c, #4c8bf7); border-radius: 5px; min-width: 2px; }
.rs-funnel-row2 b { text-align: right; font-size: 13px; color: #fff; }

.rs-dtable { width: 100%; border-collapse: collapse; font-size: 13px; }
.rs-dtable th { text-align: left; font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--dash-muted); padding: 4px 8px 8px; border-bottom: 1px solid var(--dash-line); font-weight: 700; }
.rs-dtable td { padding: 9px 8px; border-bottom: 1px solid rgba(255, 255, 255, .07); color: #e6eef6; vertical-align: top; }
.rs-dtable tr:last-child td { border-bottom: 0; }
.rs-dtable a { color: #9cd0ff; text-decoration: none; }
.rs-dtable a:hover { text-decoration: underline; }
.rs-dempty { color: var(--dash-muted); font-size: 13px; padding: 22px 0; text-align: center; }
.rs-chart { height: 220px; position: relative; }
.rs-quick { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.rs-quick a { display: inline-flex; align-items: center; gap: 6px; background: rgba(255, 255, 255, .14); color: #fff; border-radius: 4px; padding: 7px 12px; font-size: 13px; font-weight: 700; text-decoration: none; }
.rs-quick a:hover { background: rgba(255, 255, 255, .24); }
.rs-quick .material-symbols-outlined { font-size: 18px; }

/* ======================================================================
   Боковая панель как в amoCRM: 72px, тёмная, иконка в круге + подпись.
   Только на широких экранах (xl у Unfold = 1280px); на планшете/телефоне
   остаётся обычная выезжающая панель Unfold.
   ====================================================================== */
@media (min-width: 1280px) {
    [x-show="sidebarOpen"], #nav-sidebar, #nav-sidebar-inner { width: 72px !important; min-width: 72px !important; }
    #nav-sidebar .cursor-col-resize { display: none; }
    #nav-sidebar, #nav-sidebar-inner, #nav-sidebar > div { background: var(--amo-nav) !important; border-color: transparent !important; color: var(--amo-nav-text); }
    #nav-sidebar-apps { scrollbar-width: none; }
    #nav-sidebar-apps::-webkit-scrollbar { display: none; }

    /* верхний блок с логотипом */
    #nav-sidebar-inner > div:first-child { background: var(--amo-nav-2) !important; height: 65px !important; padding: 0 !important; margin-bottom: 2px !important; justify-content: center; border-bottom: 0 !important; }
    #nav-sidebar-inner > div:first-child > div { padding: 0 !important; margin: 0 !important; justify-content: center; background: transparent !important; }
    #nav-sidebar-inner > div:first-child img { content: url("/static/brand/icon.svg"); height: 34px; width: 34px; margin: 0 !important; }
    #nav-sidebar-inner > div:first-child .material-symbols-outlined { display: none; }
    #nav-sidebar-inner > div:first-child [x-show="siteDropdownOpen"] { left: 6px; right: auto; width: 280px; }

    /* группы и пункты */
    #nav-sidebar-apps h2 { display: none; }
    #nav-sidebar-apps > div { margin-bottom: 0 !important; }
    #nav-sidebar-apps ol { padding: 4px 2px !important; gap: 0; }
    #nav-sidebar-apps > div + div ol { border-top: 1px solid rgba(255, 255, 255, .08); margin-top: 2px; padding-top: 8px !important; }
    #nav-sidebar-apps ol > li > a {
        flex-direction: column; justify-content: flex-start; align-items: center; gap: 4px;
        height: auto !important; min-height: 54px; margin: 0 0 4px !important; padding: 3px 2px !important;
        border-radius: 0; color: var(--amo-nav-text); text-align: center; position: relative; background: transparent !important;
        transition: color .12s ease;
    }
    #nav-sidebar-apps ol > li > a:hover { color: #fff; }
    #nav-sidebar-apps ol > li > a.active { color: #fff; font-weight: 700; }
    #nav-sidebar-apps ol > li > a .material-symbols-outlined {
        margin: 0 !important; width: 32px !important; height: 32px; border-radius: 50%; font-size: 20px; line-height: 1;
        display: inline-flex; align-items: center; justify-content: center; border: 1.2px solid transparent;
        transition: background .12s ease, border-color .12s ease;
    }
    #nav-sidebar-apps ol > li > a:hover .material-symbols-outlined { background: rgba(161, 213, 246, .15); }
    #nav-sidebar-apps ol > li > a.active .material-symbols-outlined { background: rgba(161, 213, 246, .3); border-color: rgba(255, 255, 255, .25); }
    #nav-sidebar-apps ol > li > a > span:nth-child(2) { font-size: 10.5px; line-height: 12px; max-width: 66px; white-space: normal; }
    #nav-sidebar-apps ol > li > a > *:nth-child(3) {
        position: absolute; top: 0; right: 8px; margin: 0 !important; min-width: 16px; height: 16px; padding: 0 4px;
        border-radius: 20px; background: var(--amo-badge) !important; color: #fff !important; font-size: 10px; font-weight: 700;
        display: inline-flex; align-items: center; justify-content: center;
    }

    /* нижний блок пользователя */
    #nav-sidebar-inner > div:last-child { background: var(--amo-nav-2) !important; padding: 0 !important; border-top: 1px solid var(--amo-nav-border) !important; }
    #nav-sidebar-inner > div:last-child > div.cursor-pointer { margin: 0 !important; padding: 0 !important; justify-content: center; height: 65px !important; min-height: 65px !important; border-radius: 0; }
    #nav-sidebar-inner > div:last-child > div.cursor-pointer:hover { background: rgba(255, 255, 255, .06) !important; }
    #nav-sidebar-inner > div:last-child > div.cursor-pointer > div.flex-col,
    #nav-sidebar-inner > div:last-child > div.cursor-pointer > span.material-symbols-outlined { display: none; }
    #nav-sidebar-inner > div:last-child > div.cursor-pointer > div:first-child { background: var(--amo-blue) !important; color: #fff !important; border-radius: 50% !important; }
    #nav-sidebar-inner > div:last-child nav[x-show="openUserLinks"] { left: 6px; right: auto; width: 250px; }
}
