/* ================================================================= *
 * FURA — НОВИЙ ВИГЛЯД (тема). Підключається ПІСЛЯ інших стилів і       *
 * лише перефарбовує сторінки — логіка не змінюється.                  *
 * ================================================================= */

/* Шрифт Inter підключено прямо в сторінках (швидше, ніж через @import) */

:root {
    --f-navy: #3a4244;
    --f-navy-2: #2b3133;
    --f-orange: #c9973a;
    --f-orange-2: #e9c46a;
    --f-blue: #1d5bd8;
    --f-blue-2: #1749b3;
    --f-bg: #f3f5f9;
    --f-card: #ffffff;
    --f-line: #e4e8ef;
    --f-text: #111827;
    --f-muted: #6b7280;
    --f-soft: #94a3b8;
}

* {
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

body {
    background: var(--f-bg);
    color: var(--f-text);
}

/* ---------------- Бічне меню ---------------- */

.sidebar.fura-sidebar {
    width: 250px;
    background: var(--f-navy);
    padding: 22px 16px 14px;
    display: flex;
    flex-direction: column;
}

.fura-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 6px;
    margin-bottom: 26px;
    text-decoration: none;
}

.fura-brand-icon {
    width: 40px;
    height: 40px;
    border-radius: 11px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(201, 151, 58, 0.35);
}

.fura-brand-name {
    color: #fff;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.fura-nav {
    flex: 1;
}

.fura-nav-group + .fura-nav-group {
    margin-top: 18px;
}

.fura-nav-title {
    padding: 0 8px 8px;
    color: #8392b4;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.fura-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    margin-bottom: 4px;
    border-radius: 10px;
    color: #dbe3f3;
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    transition: background 0.15s ease;
}

.fura-nav-item i {
    font-size: 20px;
    color: #c3cee6;
}

.fura-nav-item:hover {
    background: rgba(255, 255, 255, 0.07);
}

.fura-nav-item.active {
    background: var(--f-orange);
    color: #fff;
    font-weight: 600;
    box-shadow: 0 6px 16px rgba(201, 151, 58, 0.3);
}

.fura-nav-item.active i {
    color: #fff;
}

.fura-user {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 14px;
    padding: 14px 6px 4px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.fura-avatar {
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    border-radius: 50%;
    background: #2b3c66;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
}

.fura-user-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}

.fura-user-name {
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fura-user-roles {
    color: #8392b4;
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fura-logout {
    border: none;
    background: transparent;
    color: #c3cee6;
    font-size: 21px;
    cursor: pointer;
    padding: 6px;
    border-radius: 8px;
}

.fura-logout:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.sidebar-toggle-btn {
    left: 236px;
    top: 26px;
    background: var(--f-navy-2);
    border: 2px solid var(--f-bg);
}

/* ---------------- Верхня смуга і заголовки ---------------- */

.main-content {
    padding-top: 0;
    background: var(--f-bg);
}

.fura-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    height: 64px;
    flex-shrink: 0;
    margin: 0 -32px 22px;
    padding: 0 32px;
    background: #fff;
    border-bottom: 1px solid var(--f-line);
}

.fura-crumbs {
    font-size: 14px;
    color: var(--f-muted);
}

.fura-crumbs a {
    color: var(--f-muted);
    text-decoration: none;
}

.fura-crumbs a:hover {
    color: var(--f-blue);
}

.fura-crumbs b {
    color: var(--f-text);
    font-weight: 600;
}

.fura-sep {
    margin: 0 6px;
    color: #c0c7d4;
}

.fura-date {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border: 1px solid var(--f-line);
    border-radius: 10px;
    background: #fff;
    color: var(--f-muted);
    font-size: 13px;
}

.top-bar {
    margin-bottom: 18px;
}

.top-bar h1 {
    margin-right: auto;
    font-size: 30px;
    font-weight: 800;
    letter-spacing: -0.01em;
    color: var(--f-text);
}

/* Кнопка "Вийти" тепер унизу меню */
.main-content [onclick="logout()"] {
    display: none !important;
}

/* ---------------- Кнопки, поля ---------------- */

.btn {
    border-radius: 10px;
    font-weight: 600;
    padding: 11px 18px;
}

.btn-primary {
    background: var(--f-blue);
    box-shadow: 0 4px 12px rgba(120, 134, 134, 0.25);
}

.btn-primary:hover {
    background: var(--f-blue-2);
}

.btn-secondary {
    background: #fff;
    border: 1px solid var(--f-line);
    color: var(--f-text);
}

.btn-secondary:hover {
    background: #f8fafc;
}

.search-input,
.lead-select,
.form-group input,
.form-group select,
.form-group textarea {
    border-radius: 10px;
    border-color: var(--f-line);
}

.search-input {
    background: #fff;
    padding: 12px 16px;
}

.search-input:focus,
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--f-blue);
    box-shadow: 0 0 0 3px rgba(120, 134, 134, 0.12);
    outline: none;
}

/* ---------------- Вкладки (етапи, статуси) — у білій картці з підкресленням ---------------- */

.lead-tabs {
    gap: 0;
    padding: 0 14px;
    background: #fff;
    border: 1px solid var(--f-line);
    border-radius: 14px;
    margin-bottom: 16px;
}

.lead-tab {
    padding: 16px 14px 14px;
    border: none;
    border-bottom: 3px solid transparent;
    border-radius: 0;
    background: transparent;
    color: var(--f-muted);
    font-size: 15px;
    font-weight: 600;
}

.lead-tab:hover {
    color: var(--f-blue);
    border-color: transparent;
    border-bottom-color: #c7d6f7;
}

.lead-tab.active {
    background: transparent;
    color: var(--f-blue);
    border-bottom-color: var(--f-blue);
}

.lead-tab-count {
    background: #eef2f8;
    color: var(--f-muted);
}

.lead-tab.active .lead-tab-count {
    background: #e3ebfc;
    color: var(--f-blue);
}

/* Рейси — ті ж вкладки */
.trip-chips {
    gap: 0;
    padding: 0 14px;
    background: #fff;
    border: 1px solid var(--f-line);
    border-radius: 14px;
}

.trip-chip {
    padding: 15px 14px 13px;
    border: none;
    border-bottom: 3px solid transparent;
    border-radius: 0;
    background: transparent;
    color: var(--f-muted);
    font-size: 15px;
}

.trip-chip[aria-pressed="true"] {
    background: transparent;
    color: var(--f-blue);
    border-bottom-color: var(--f-blue);
}

.trip-chip .n {
    display: inline-block;
    min-width: 22px;
    padding: 1px 7px;
    border-radius: 999px;
    background: #eef2f8;
    color: var(--f-muted);
    font-size: 12px;
    opacity: 1;
}

.trip-chip[aria-pressed="true"] .n {
    background: #e3ebfc;
    color: var(--f-blue);
}

/* ---------------- Таблиці і картки ---------------- */

.table-card,
.trip-detail,
.trip-card,
.home-section,
.quick-card,
.kpi,
.rep-card {
    border-color: var(--f-line);
    border-radius: 14px;
    box-shadow: 0 1px 2px rgba(17, 24, 39, 0.03);
}

.table-card {
    background: #fff;
}

thead {
    background: #f8fafc;
    border-bottom: 1px solid var(--f-line);
}

th {
    color: #6b7280;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.04em;
}

td,
th {
    border-right: none;
}

td {
    border-bottom: 1px solid #f0f2f6;
}

tbody tr:nth-child(even) {
    background: #fff;
}

tbody tr:hover {
    background: #f6f9ff;
}

.carriers-count-bar {
    color: var(--f-muted);
}

/* Головна: привітання без кнопки виходу */
.home-hero {
    border-radius: 16px;
    border-color: var(--f-line);
}

/* Модальні вікна */
.modal {
    border-radius: 16px;
}

/* Мобільний: меню згортається як і раніше */
@media (max-width: 900px) {
    .fura-topbar {
        margin: 0 -16px 16px;
        padding: 0 16px;
        height: 56px;
    }
    .fura-date {
        display: none;
    }
    .top-bar h1 {
        font-size: 24px;
    }
}

/* Сторінка всередині угоди (вкладка «Трекінг») — без меню */
html.fura-embed .sidebar,
html.fura-embed .sidebar-toggle-btn,
html.fura-embed .top-bar,
html.fura-embed .trips-filters,
html.fura-embed .trips-list {
    display: none !important;
}

html.fura-embed .main-content {
    padding: 0;
}

html.fura-embed .trip-detail {
    max-width: none;
    flex-basis: 100%;
    border: none;
    border-radius: 0;
}

/* Форми всередині угоди — зверху вкладки, а не посередині високого вікна */
html.fura-embed .modal-overlay {
    position: absolute;
    align-items: flex-start;
    padding-top: 12px;
    background: rgba(15, 23, 42, 0.25);
    backdrop-filter: none;
}
html.fura-embed .modal {
    max-height: none;
}

/* Рейс усередині угоди: сторінка росте у висоту (прокрутка — у самій угоді) */
html.fura-embed,
html.fura-embed body {
    height: auto !important;
    min-height: 0;
    overflow: visible !important;
}
html.fura-embed .main-content {
    height: auto !important;
    overflow: visible !important;
}
html.fura-embed .trips-layout {
    display: block;
}
html.fura-embed .trip-detail {
    max-height: none;
    overflow: visible;
}
html.fura-embed .modal-overlay {
    position: static;
    padding: 0;
    background: none;
}
html.fura-embed .modal-overlay.active ~ * .trip-detail,
html.fura-embed body:has(#tripModalOverlay.active) .main-content,
html.fura-embed body:has(#inviteModalOverlay.active) .main-content {
    display: none;
}
html.fura-embed .modal {
    max-width: none !important;
    box-shadow: none;
    border-radius: 0;
}

/* Стрілки «назад / вперед» у верхній смузі */
.fura-nav-arrows { display: inline-flex; gap: 2px; margin-right: 6px; flex-shrink: 0; }
.fura-nav-arrows button { width: 32px; height: 32px; display: inline-grid; place-items: center; border: 1px solid var(--f-line, #e4e8ef); border-radius: 8px; background: #fff; color: #334155; font-size: 17px; font-weight: 600; line-height: 1; cursor: pointer; transition: background .12s, color .12s; }
.fura-nav-arrows button:hover:not(:disabled) { background: #eff6ff; color: var(--f-blue, #1d5bd8); border-color: #bfdbfe; }
.fura-nav-arrows button:disabled { color: #cbd5e1; cursor: default; }
.fura-left { display: flex; align-items: center; gap: 8px; min-width: 0; }

/* Своя іконка пункту меню (svg замість boxicons), напр. «Черга» */
.fura-nav-item .fura-nav-svg {
    flex-shrink: 0;
    color: #c3cee6;
}
.fura-nav-item.active .fura-nav-svg {
    color: #fff;
}

/* Картка перевізника у вікні поверх іншої сторінки (carrier-popup.js): тільки саме вікно */
html.fura-cpop,
html.fura-cpop body {
    background: transparent !important;
    height: 100% !important;
    overflow: hidden !important;
}
html.fura-cpop .main-content,
html.fura-cpop .scroll-top-btn {
    display: none !important;
}
html.fura-embed.fura-cpop .modal-overlay {
    position: fixed;
    align-items: center;
    padding: 24px;
    background: transparent;
    backdrop-filter: none;
}
html.fura-embed.fura-cpop .modal {
    max-height: 90vh;
}
@media (max-width: 768px) {
    html.fura-embed.fura-cpop .modal-overlay { padding: 8px; }
    html.fura-embed.fura-cpop .modal { max-height: 95vh; }
}

/* Пункти меню лише для певних ролей (shell.js → data-only) */
.fura-nav-item[hidden] {
    display: none !important;
}

/* Пункт меню з підпунктами («Ларді» → «Вантажі», «Авто») */
.fura-nav-parent .fura-nav-caret { margin-left: auto; font-size: 18px; transition: transform 0.15s ease; }
.fura-nav-branch.open .fura-nav-caret { transform: rotate(180deg); }
.fura-nav-branch.has-active > .fura-nav-parent { color: #fff; }
.fura-nav-branch.has-active > .fura-nav-parent i { color: #ffb366; }
.fura-nav-sub { display: none; margin: 0 0 4px 18px; padding-left: 10px; border-left: 1px solid rgba(255, 255, 255, 0.14); }
.fura-nav-branch.open .fura-nav-sub { display: block; }
.fura-nav-subitem { padding: 8px 12px; font-size: 14px; }
.fura-nav-subitem i { font-size: 18px; }
body.sidebar-collapsed .fura-nav-sub { margin-left: 0; padding-left: 0; border-left: 0; }
body.sidebar-collapsed .fura-nav-caret { display: none; }
