/* =============================================================
   FleetBook UI — bookacar.pl port
   Ekstrakcja + adaptacja z https://fleet-book.pl
   Nadpisuje AblePro layout zachowując Bootstrap dla pluginów
   ============================================================= */

/* ── Google Font Import (Inter) ───────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* ── CSS Variables ────────────────────────────────────────── */
:root {
    --bg:       #07070b;
    --bg2:      #0d0d16;
    --bg3:      #121220;
    --bg4:      #1a1a2c;
    --border:   #1e1e2e;
    --border2:  #2c2c42;
    --text:     #eeeef8;
    --muted:    #52526e;
    --muted2:   #8080a0;
    --red:      #E31E24;
    --red2:     #ff4b50;
    --t:        .18s cubic-bezier(.4,0,.2,1);
    --green:    #22c55e;
    --blue:     #3b82f6;
    --purple:   #8b5cf6;
    --orange:   #f97316;
    --sidebar-w: 240px;
}

/* ── Light Theme Variables ────────────────────────────────── */
html[data-theme="light"] {
    --bg:      #f2f2f7;
    --bg2:     #ffffff;
    --bg3:     #f5f5fa;
    --bg4:     #ebebf3;
    --border:  #e0e0ec;
    --border2: #d0d0e0;
    --text:    #0d0d1a;
    --muted:   #888899;
    --muted2:  #55556a;
    --red2:    #c8181e;
}

/* ── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { font-size: 16px; }

body {
    background:
        radial-gradient(ellipse at 15% 50%, rgba(227,30,36,.08) 0%, transparent 55%),
        radial-gradient(ellipse at 85% 15%, rgba(227,30,36,.05) 0%, transparent 45%),
        var(--bg);
    color: var(--text);
    font-family: 'Inter', system-ui, -apple-system, sans-serif !important;
    min-height: 100vh;
}

body::before {
    content: '';
    position: fixed; inset: 0; pointer-events: none; z-index: 0;
    background: linear-gradient(108deg,
        transparent 30%, rgba(227,30,36,.025) 30%, rgba(227,30,36,.025) 35%, transparent 35%,
        transparent 48%, rgba(227,30,36,.012) 48%, rgba(227,30,36,.012) 52%, transparent 52%);
}

html[data-theme="light"] body {
    background:
        radial-gradient(ellipse at 15% 50%, rgba(227,30,36,.04) 0%, transparent 55%),
        radial-gradient(ellipse at 85% 10%, rgba(227,30,36,.02) 0%, transparent 45%),
        var(--bg);
}
html[data-theme="light"] body::before { display: none; }

/* ── Scrollbar Global ─────────────────────────────────────── */
::-webkit-scrollbar              { width: 6px; height: 6px; }
::-webkit-scrollbar-track        { background: transparent; }
::-webkit-scrollbar-thumb        { background: rgba(255,255,255,.15); border-radius: 6px; }
::-webkit-scrollbar-thumb:hover  { background: rgba(255,255,255,.25); }
html[data-theme="light"] ::-webkit-scrollbar-track { background: var(--bg3); }
html[data-theme="light"] ::-webkit-scrollbar-thumb { background: var(--border2); }
html[data-theme="light"] ::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* ══════════════════════════════════════════════════════════════
   LAYOUT — Override AblePro structure entirely
   ══════════════════════════════════════════════════════════════ */

/* Kill AblePro layout remnants */
.loader-bg, .loader-track, .loader-fill { display: none !important; }
.pc-container { margin-left: 0 !important; padding: 0 !important; }
.pc-content { padding: 0 !important; }

/* New flex body layout */
body.fb-layout {
    display: flex;
    margin: 0;
    padding: 0;
}

/* ── Sidebar ──────────────────────────────────────────────── */
.fb-sidebar {
    width: var(--sidebar-w);
    height: 100vh;
    background: linear-gradient(180deg, #0e0e1a 0%, #080810 100%);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0;
    z-index: 100;
    transition: transform .3s ease;
}
html[data-theme="light"] .fb-sidebar {
    background: linear-gradient(180deg, #ffffff 0%, #f8f8fc 100%);
    border-right-color: var(--border);
}

/* Sidebar after — pulsing edge on hidden */
.fb-sidebar::after {
    content: ''; position: absolute; top: 50%; right: 0; transform: translateY(-50%);
    width: 4px; height: 60vh;
    background: linear-gradient(180deg, transparent, var(--red) 25%, var(--red) 75%, transparent);
    border-radius: 0 4px 4px 0; opacity: 0; transition: opacity .35s; pointer-events: none;
}
.fb-sidebar.sb-hidden::after { opacity: .55; animation: sb-pulse 2.5s ease-in-out 1s infinite; }
@keyframes sb-pulse { 0%,100% { opacity:.38; } 50% { opacity:.72; } }

/* Sidebar Logo */
.fb-sidebar-logo {
    padding: 1.45rem 1.25rem 1.1rem;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.fb-sidebar-logo img {
    height: 32px; width: auto; display: block;
    filter: brightness(0) invert(1); opacity: .9;
}
html[data-theme="light"] .fb-sidebar-logo img { filter: none; opacity: .85; }
html[data-theme="light"] .fb-sidebar-logo { border-bottom-color: var(--border); }

/* Sidebar Nav */
.fb-sidebar-nav {
    flex: 1;
    padding: 1rem .75rem;
    display: flex;
    flex-direction: column;
    gap: .1rem;
    overflow-y: auto;
    min-height: 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.18) transparent;
}
.fb-sidebar-nav::-webkit-scrollbar { display: block; width: 4px; }
.fb-sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.fb-sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.18); border-radius: 4px; }
.fb-sidebar-nav::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.3); }

/* Section Labels */
.fb-nav-label {
    font-size: .59rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--muted);
    padding: .85rem .65rem .38rem;
}
html[data-theme="light"] .fb-nav-label { color: var(--muted); }

/* Nav Items */
.fb-nav-item {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .63rem .78rem;
    border-radius: 9px;
    font-size: .84rem;
    font-weight: 500;
    color: var(--muted2);
    text-decoration: none !important;
    transition: all var(--t);
    position: relative;
    cursor: pointer;
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    font-family: inherit;
}
.fb-nav-item:hover {
    background: rgba(255,255,255,.05);
    color: var(--text);
    text-decoration: none;
}
.fb-nav-item.active {
    background: rgba(227,30,36,.1);
    color: var(--text);
    box-shadow: inset 0 0 0 1px rgba(227,30,36,.16);
}
.fb-nav-item.active::before {
    content: '';
    position: absolute; left: 0; top: 50%;
    transform: translateY(-50%);
    height: 55%; width: 3px;
    background: var(--red);
    border-radius: 0 3px 3px 0;
}
html[data-theme="light"] .fb-nav-item { color: var(--muted2); }
html[data-theme="light"] .fb-nav-item:hover { background: rgba(0,0,0,.04); color: var(--text); }
html[data-theme="light"] .fb-nav-item.active { background: rgba(227,30,36,.09); color: var(--text); box-shadow: inset 0 0 0 1px rgba(227,30,36,.18); }

/* Nav Icon */
.fb-nav-icon {
    width: 18px; height: 18px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; opacity: .65; transition: opacity var(--t);
    font-size: 1rem; line-height: 1;
}
.fb-nav-icon i, .fb-nav-icon svg { font-size: 16px; width: 16px; height: 16px; }
.fb-nav-icon svg { stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.fb-nav-item:hover .fb-nav-icon,
.fb-nav-item.active .fb-nav-icon { opacity: 1; }
html[data-theme="light"] .fb-nav-icon { opacity: .7; }
html[data-theme="light"] .fb-nav-item:hover .fb-nav-icon,
html[data-theme="light"] .fb-nav-item.active .fb-nav-icon { opacity: 1; }

/* Submenu (dropdown) */
.fb-submenu {
    display: none;
    flex-direction: column;
    gap: .05rem;
    padding: .2rem 0 .2rem 2.1rem;
}
.fb-submenu.open { display: flex; }
.fb-nav-arrow {
    margin-left: auto;
    font-size: .7rem;
    opacity: .5;
    transition: transform var(--t);
}
.fb-nav-item.has-sub.open .fb-nav-arrow { transform: rotate(90deg); }

/* Sidebar Bottom */
.fb-sidebar-bottom {
    padding: 1rem .75rem;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}
html[data-theme="light"] .fb-sidebar-bottom { border-top-color: var(--border); }

/* User Block */
.fb-user-block {
    display: flex;
    align-items: center;
    gap: .72rem;
    padding: .6rem .5rem;
    border-radius: 8px;
    text-decoration: none !important;
    color: inherit;
    transition: background .15s;
    cursor: pointer;
}
.fb-user-block:hover { background: rgba(255,255,255,.05); }
html[data-theme="light"] .fb-user-block:hover { background: rgba(0,0,0,.04); }
.fb-user-avatar {
    width: 32px; height: 32px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--red), #ff6b6b);
    display: flex; align-items: center; justify-content: center;
    font-size: .78rem; font-weight: 700; color: #fff;
    flex-shrink: 0;
    overflow: hidden;
}
.fb-user-avatar img { width: 100%; height: 100%; object-fit: cover; }
.fb-user-info-name  { font-size: .82rem; font-weight: 600; color: var(--text); line-height: 1.2; }
.fb-user-info-email { font-size: .7rem; color: var(--muted); }
.fb-btn-logout {
    display: flex; align-items: center; gap: .5rem;
    width: 100%; margin-top: .35rem;
    padding: .5rem .75rem;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 7px;
    color: var(--muted);
    font-size: .8rem;
    cursor: pointer;
    text-decoration: none !important;
    transition: all .15s;
    font-family: inherit;
}
.fb-btn-logout:hover { border-color: var(--border2); color: var(--text); background: rgba(255,255,255,.04); }
html[data-theme="light"] .fb-btn-logout { border-color: var(--border2); }
html[data-theme="light"] .fb-btn-logout:hover { color: var(--text); }

/* ── Main Content Area ────────────────────────────────────── */
.fb-main {
    margin-left: var(--sidebar-w);
    flex: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow-x: hidden;
    position: relative;
    z-index: 1;
    transition: margin-left .3s ease;
}
.fb-main.sb-hidden { margin-left: 4px; }

/* ── Topbar ───────────────────────────────────────────────── */
.fb-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .9rem 1.6rem;
    background: rgba(13,13,22,.92);
    backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
    gap: 1rem;
    flex-wrap: wrap;
}
html[data-theme="light"] .fb-topbar {
    background: rgba(242,242,247,.95);
    border-bottom-color: var(--border);
}
.fb-topbar-left  { display: flex; align-items: center; gap: .75rem; flex: 1; min-width: 0; }
.fb-topbar-right { display: flex; align-items: center; gap: .6rem; flex-shrink: 0; }
.fb-topbar-title { font-size: 1rem; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fb-topbar-date  { font-size: .8rem; color: var(--muted); }
html[data-theme="light"] .fb-topbar-date { color: var(--muted2); }

/* Menu Toggle (mobile) */
.fb-menu-toggle {
    display: none;
    align-items: center; justify-content: center;
    width: 36px; height: 36px;
    background: var(--bg3); border: 1px solid var(--border);
    border-radius: 7px; cursor: pointer; font-size: 1.1rem; color: var(--text);
    flex-shrink: 0; -webkit-appearance: none; appearance: none;
    font-family: inherit;
}
html[data-theme="light"] .fb-menu-toggle { background: var(--bg3); border-color: var(--border2); color: var(--text); }

/* Theme Toggle */
.fb-theme-btn {
    display: flex; align-items: center; gap: 6px;
    height: 32px; padding: 0 10px;
    background: var(--bg3); border: 1px solid var(--border2);
    border-radius: 8px; color: var(--muted2);
    cursor: pointer; font-family: inherit; font-size: .72rem; font-weight: 600;
    transition: all var(--t); flex-shrink: 0; white-space: nowrap;
}
.fb-theme-btn:hover { border-color: #888; color: var(--text); }
html[data-theme="light"] .fb-theme-btn:hover { border-color: var(--border2); background: var(--bg4); }

/* Primary CTA Button (topbar) */
.fb-btn-add {
    display: inline-flex; align-items: center; gap: .45rem;
    padding: .5rem 1.1rem;
    background: var(--red); color: #fff;
    border: none; border-radius: 8px;
    font-size: .86rem; font-weight: 600;
    cursor: pointer; font-family: inherit;
    text-decoration: none !important;
    transition: background var(--t), box-shadow var(--t);
    box-shadow: 0 2px 12px rgba(227,30,36,.25);
    white-space: nowrap;
}
.fb-btn-add:hover { background: #c41920; box-shadow: 0 4px 18px rgba(227,30,36,.4); color: #fff; }
.fb-btn-add:active { transform: scale(.97); }

/* User Avatar in topbar */
.fb-topbar-avatar {
    width: 32px; height: 32px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--red), #ff6b6b);
    overflow: hidden; cursor: pointer;
    border: 1px solid var(--border2);
}
.fb-topbar-avatar img { width: 100%; height: 100%; object-fit: cover; }

/* Topbar Dropdown */
.fb-topbar-dropdown { position: relative; }
.fb-topbar-dropdown-menu {
    position: absolute; top: calc(100% + 8px); right: 0;
    background: var(--bg2); border: 1px solid var(--border2);
    border-radius: 12px; padding: .5rem;
    min-width: 200px; z-index: 200;
    box-shadow: 0 12px 40px rgba(0,0,0,.5);
    display: none;
}
.fb-topbar-dropdown-menu.open { display: block; }
.fb-topbar-dd-header { padding: .6rem .75rem .4rem; border-bottom: 1px solid var(--border); margin-bottom: .3rem; }
.fb-topbar-dd-name  { font-size: .85rem; font-weight: 600; color: var(--text); }
.fb-topbar-dd-role  { font-size: .72rem; color: var(--muted); margin-top: .1rem; }
.fb-topbar-dd-item {
    display: flex; align-items: center; gap: .6rem;
    padding: .5rem .75rem;
    border-radius: 8px;
    font-size: .84rem; color: var(--muted2);
    text-decoration: none !important;
    cursor: pointer; transition: all .12s;
    background: none; border: none; width: 100%; font-family: inherit; text-align: left;
}
.fb-topbar-dd-item:hover { background: rgba(255,255,255,.06); color: var(--text); }
.fb-topbar-dd-item.danger:hover { color: #f87171; background: rgba(239,68,68,.08); }
html[data-theme="light"] .fb-topbar-dropdown-menu { background: var(--bg2); border-color: var(--border); box-shadow: 0 12px 40px rgba(0,0,0,.14); }
html[data-theme="light"] .fb-topbar-dd-item:hover { background: rgba(0,0,0,.04); }

/* Sidebar overlay (mobile) */
.fb-sidebar-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,.65); z-index: 99;
}
.fb-sidebar-overlay.open { display: block; }

/* ── Content Wrapper ──────────────────────────────────────── */
.fb-content {
    flex: 1;
    padding: 1.6rem 2rem;
    width: 100%;
    margin: 0;
}

/* ── Animations ───────────────────────────────────────────── */
@keyframes fadeSlideUp {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}
.fb-ani   { animation: fadeSlideUp .4s ease both; }
.fb-ani-1 { animation-delay: .06s; }
.fb-ani-2 { animation-delay: .12s; }
.fb-ani-3 { animation-delay: .18s; }

/* ══════════════════════════════════════════════════════════════
   PAGE COMPONENTS
   ══════════════════════════════════════════════════════════════ */

/* ── Greeting Card ────────────────────────────────────────── */
.fb-greeting {
    background: linear-gradient(135deg, var(--bg3) 0%, #150a0b 100%);
    border: 1px solid var(--border); border-radius: 16px;
    padding: 1.75rem 2rem; margin-bottom: 1.5rem;
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    position: relative; overflow: hidden;
}
.fb-greeting::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
    background: linear-gradient(90deg, var(--red), #ff7070, transparent);
}
.fb-greeting::after {
    content: ''; position: absolute; top: -60px; right: -60px;
    width: 220px; height: 220px;
    background: radial-gradient(circle, rgba(227,30,36,.06) 0%, transparent 70%);
    pointer-events: none;
}
.fb-greeting-text {
    font-size: 1.45rem; font-weight: 800; color: var(--text); letter-spacing: -.5px;
}
.fb-greeting-text span {
    color: transparent;
    background: linear-gradient(135deg, #ff5555, #ff9090);
    -webkit-background-clip: text; background-clip: text;
}
.fb-greeting-sub { font-size: .87rem; color: var(--muted2); margin-top: .38rem; }
html[data-theme="light"] .fb-greeting {
    background: linear-gradient(135deg, rgba(227,30,36,.06) 0%, rgba(227,30,36,.02) 100%);
}

/* ── Stat Cards ───────────────────────────────────────────── */
.fb-stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.fb-stat-card {
    background: var(--bg3); border: 1px solid var(--border);
    border-radius: 13px; padding: 1.25rem 1.4rem;
    position: relative; overflow: hidden;
    transition: border-color var(--t), transform var(--t);
    text-decoration: none !important;
    display: block;
    color: inherit;
}
.fb-stat-card:hover { border-color: var(--border2); transform: translateY(-2px); color: inherit; }
.fb-stat-card::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
}
.fb-stat-card.c-blue::before   { background: linear-gradient(90deg, #3b82f6, #60a5fa); }
.fb-stat-card.c-green::before  { background: linear-gradient(90deg, var(--green), #4ade80); }
.fb-stat-card.c-red::before    { background: linear-gradient(90deg, var(--red), var(--red2)); }
.fb-stat-card.c-orange::before { background: linear-gradient(90deg, var(--orange), #fbbf24); }
.fb-stat-card.c-purple::before { background: linear-gradient(90deg, var(--purple), #a78bfa); }
html[data-theme="light"] .fb-stat-card { box-shadow: 0 1px 6px rgba(0,0,0,.07); }

.fb-stat-icon {
    margin-bottom: .65rem;
    width: 36px; height: 36px; border-radius: 9px;
    background: rgba(255,255,255,.05);
    display: flex; align-items: center; justify-content: center;
    font-size: 1rem; color: var(--muted2);
}
.fb-stat-label {
    font-size: .68rem; font-weight: 600; text-transform: uppercase;
    letter-spacing: .6px; color: var(--muted); margin-bottom: .35rem;
}
.fb-stat-val {
    font-size: 1.75rem; font-weight: 800; color: var(--text);
    line-height: 1; letter-spacing: -.4px;
}
.fb-stat-sub { font-size: .72rem; color: var(--muted); margin-top: .3rem; }

/* ── Generic Panel / Card ─────────────────────────────────── */
.fb-panel {
    background: var(--bg3); border: 1px solid var(--border);
    border-radius: 13px; overflow: hidden; margin-bottom: 1.3rem;
}
html[data-theme="light"] .fb-panel { box-shadow: 0 1px 6px rgba(0,0,0,.07); }
.fb-panel-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 1rem 1.3rem; border-bottom: 1px solid var(--border);
}
.fb-panel-title { font-size: .87rem; font-weight: 700; color: var(--text); }
.fb-panel-link  {
    font-size: .77rem; color: var(--muted);
    text-decoration: none !important; transition: color var(--t);
}
.fb-panel-link:hover { color: var(--text); }
.fb-panel-body { padding: 1rem 1.3rem; }

/* ── Table ────────────────────────────────────────────────── */
.fb-tbl-wrap {
    background: var(--bg3); border: 1px solid var(--border);
    border-radius: 14px; overflow: hidden; overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
html[data-theme="light"] .fb-tbl-wrap { box-shadow: 0 1px 6px rgba(0,0,0,.07); }
.fb-tbl { width: 100%; border-collapse: collapse; }
.fb-tbl th {
    padding: .7rem 1rem;
    background: var(--bg2);
    font-size: .7rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: .5px; color: var(--muted); text-align: left;
    border-bottom: 1px solid var(--border); white-space: nowrap;
}
.fb-tbl td {
    padding: .72rem 1rem; font-size: .86rem;
    border-bottom: 1px solid var(--border); vertical-align: middle;
}
.fb-tbl tr:last-child td { border-bottom: none; }
.fb-tbl tr:hover td { background: rgba(255,255,255,.025); }
html[data-theme="light"] .fb-tbl th { background: var(--bg3); color: var(--muted); }
html[data-theme="light"] .fb-tbl tbody tr:hover td { background: rgba(0,0,0,.025); }

/* ── Badges / Pills ───────────────────────────────────────── */
.fb-badge {
    display: inline-flex; align-items: center; gap: .3rem;
    padding: 2px 9px; border-radius: 20px;
    font-size: .72rem; font-weight: 600;
}
.fb-badge.success  { background: rgba(34,197,94,.1);  color: #4ade80; border: 1px solid rgba(34,197,94,.2); }
.fb-badge.danger   { background: rgba(239,68,68,.12); color: #f87171; border: 1px solid rgba(239,68,68,.22); }
.fb-badge.warning  { background: rgba(249,115,22,.12); color: #fdba74; border: 1px solid rgba(249,115,22,.22); }
.fb-badge.blue     { background: rgba(59,130,246,.1); color: #93c5fd; border: 1px solid rgba(59,130,246,.2); }
.fb-badge.muted    { background: var(--bg4); color: var(--muted2); border: 1px solid var(--border2); }
.fb-badge.confirmed { background: rgba(34,197,94,.1);   color: #4ade80; }
.fb-badge.option    { background: rgba(249,115,22,.15); color: #fdba74; }
.fb-badge.cancelled { background: rgba(255,107,107,.1); color: #ff6b6b; }

/* ── Action Buttons (in tables) ───────────────────────────── */
.fb-btn-tbl {
    padding: .34rem .72rem; border-radius: 7px;
    border: 1px solid var(--border); background: var(--bg4);
    color: var(--muted2); font-size: .78rem;
    cursor: pointer; font-family: inherit;
    transition: all var(--t); white-space: nowrap;
    text-decoration: none !important; display: inline-flex; align-items: center; gap: .35rem;
}
.fb-btn-tbl:hover { border-color: var(--border2); color: var(--text); }
.fb-btn-tbl.danger:hover { border-color: rgba(239,68,68,.4); color: #f87171; background: rgba(239,68,68,.07); }
.fb-btn-tbl.success { border-color: rgba(34,197,94,.25); color: #4ade80; background: rgba(34,197,94,.06); }
.fb-btn-tbl.success:hover { background: rgba(34,197,94,.12); }
.fb-btn-tbl.warning { border-color: rgba(234,179,8,.25); color: #fbbf24; background: rgba(234,179,8,.06); }

/* ── General Buttons ──────────────────────────────────────── */
.fb-btn-primary {
    display: inline-flex; align-items: center; gap: .4rem;
    padding: .55rem 1.25rem;
    background: var(--red); color: #fff !important;
    border: none; border-radius: 8px;
    font-size: .88rem; font-weight: 600;
    cursor: pointer; font-family: inherit;
    text-decoration: none !important;
    transition: background var(--t), box-shadow var(--t), transform .1s;
    box-shadow: 0 2px 14px rgba(227,30,36,.3);
}
.fb-btn-primary:hover { background: #c41920; box-shadow: 0 4px 22px rgba(227,30,36,.45); }
.fb-btn-primary:active { transform: scale(.97); }

.fb-btn-secondary {
    display: inline-flex; align-items: center; gap: .4rem;
    padding: .55rem 1.1rem;
    background: var(--bg4); color: var(--muted2) !important;
    border: 1px solid var(--border2); border-radius: 8px;
    font-size: .88rem; font-weight: 500;
    cursor: pointer; font-family: inherit;
    text-decoration: none !important;
    transition: all var(--t);
}
.fb-btn-secondary:hover { color: var(--text) !important; border-color: #888; }

/* ── Forms ────────────────────────────────────────────────── */
.fb-form-group { margin-bottom: .9rem; }
.fb-form-group label {
    display: block; font-size: .7rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: .6px;
    color: var(--muted); margin-bottom: .38rem;
}
.fb-form-group input:not([type=checkbox]):not([type=radio]),
.fb-form-group select,
.fb-form-group textarea {
    width: 100%;
    background: var(--bg2) !important;
    border: 1px solid var(--border) !important;
    border-radius: 8px;
    padding: .58rem .85rem;
    color: var(--text) !important;
    font-size: .9rem; font-family: inherit;
    transition: border-color var(--t), box-shadow var(--t);
}
.fb-form-group input:focus,
.fb-form-group select:focus,
.fb-form-group textarea:focus {
    outline: none;
    border-color: var(--red) !important;
    box-shadow: 0 0 0 3px rgba(227,30,36,.1) !important;
}
.fb-form-group textarea { resize: vertical; min-height: 70px; }
html[data-theme="light"] .fb-form-group input:not([type=checkbox]):not([type=radio]),
html[data-theme="light"] .fb-form-group select,
html[data-theme="light"] .fb-form-group textarea {
    color-scheme: light;
    background: var(--bg2) !important;
    border-color: var(--border2) !important;
    color: var(--text) !important;
}

/* ── Modal ────────────────────────────────────────────────── */
.fb-modal-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,.82); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
    z-index: 1000; align-items: center; justify-content: center; padding: 1rem;
}
.fb-modal-overlay.open { display: flex; }
.fb-modal {
    background: var(--bg3); border: 1px solid var(--border2); border-radius: 16px;
    padding: 1.75rem; width: 100%; max-width: 720px;
    max-height: 90vh; overflow-y: auto;
    box-shadow: 0 25px 60px rgba(0,0,0,.5);
    animation: fbModalIn .18s ease;
}
@keyframes fbModalIn { from { opacity: 0; transform: scale(.96) translateY(8px); } to { opacity: 1; transform: none; } }
.fb-modal-title {
    font-size: 1rem; font-weight: 700; color: var(--text);
    margin-bottom: 1.5rem;
    display: flex; justify-content: space-between; align-items: center;
}
.fb-modal-close {
    background: none; border: none; color: var(--muted);
    font-size: 1.3rem; cursor: pointer; line-height: 1;
    padding: .2rem; border-radius: 4px; transition: color var(--t);
}
.fb-modal-close:hover { color: var(--text); }
html[data-theme="light"] .fb-modal { background: var(--bg2); border-color: var(--border); box-shadow: 0 20px 60px rgba(0,0,0,.18); }

/* ── Alert / Notice Bars ──────────────────────────────────── */
.fb-alert {
    display: flex; align-items: center; gap: .75rem;
    padding: .75rem 1.1rem; border-radius: 10px;
    font-size: .85rem; margin-bottom: 1rem;
}
.fb-alert.danger  { background: rgba(227,30,36,.1);  border: 1px solid rgba(227,30,36,.2);  color: #ff8888; }
.fb-alert.warning { background: rgba(249,115,22,.1); border: 1px solid rgba(249,115,22,.2); color: #fdba74; }
.fb-alert.success { background: rgba(34,197,94,.1);  border: 1px solid rgba(34,197,94,.2);  color: #4ade80; }

/* ── Search Box ───────────────────────────────────────────── */
.fb-search-box {
    display: flex; align-items: center; gap: .5rem;
    background: var(--bg3); border: 1px solid var(--border);
    border-radius: 9px; padding: .45rem .85rem;
    min-width: 220px;
}
.fb-search-box input {
    background: none !important; border: none !important; outline: none !important;
    color: var(--text); font-size: .86rem; font-family: inherit;
    flex: 1; padding: 0 !important; box-shadow: none !important;
}
.fb-search-box input::placeholder { color: var(--muted); }
html[data-theme="light"] .fb-search-box { background: var(--bg2); border-color: var(--border2); }

/* ── Tabs ─────────────────────────────────────────────────── */
.fb-tabs { display: flex; gap: .3rem; margin-bottom: 1.4rem; border-bottom: 1px solid var(--border); }
.fb-tab {
    padding: .6rem 1.1rem; background: none; border: none;
    border-bottom: 2px solid transparent; color: var(--muted2);
    font-size: .86rem; font-weight: 500;
    cursor: pointer; font-family: inherit;
    transition: all var(--t); margin-bottom: -1px;
    text-decoration: none !important;
}
.fb-tab:hover { color: var(--text); }
.fb-tab.active { color: var(--text); border-bottom-color: var(--red); }

/* ── Toolbar ──────────────────────────────────────────────── */
.fb-toolbar {
    display: flex; align-items: center; gap: .7rem;
    margin-bottom: 1.2rem; flex-wrap: wrap;
}

/* ── Bootstrap Overrides for plugin compatibility ─────────── */
/* Keep Bootstrap classes working but theme them to FleetBook */
.card {
    background: var(--bg3) !important;
    border: 1px solid var(--border) !important;
    border-radius: 13px !important;
    color: var(--text) !important;
}
.card-body { padding: 1.25rem 1.4rem !important; }
html[data-theme="light"] .card { box-shadow: 0 1px 6px rgba(0,0,0,.07) !important; }

.table > thead > tr > th {
    background: var(--bg2) !important;
    color: var(--muted) !important;
    border-color: var(--border) !important;
    font-size: .7rem !important; text-transform: uppercase;
    letter-spacing: .5px;
}
.table > tbody > tr > td {
    background: transparent !important;
    color: var(--text) !important;
    border-color: var(--border) !important;
}
.table > tbody > tr:hover > td { background: rgba(255,255,255,.025) !important; }
html[data-theme="light"] .table > tbody > tr:hover > td { background: rgba(0,0,0,.025) !important; }

/* DataTables theming */
.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
    background: var(--bg2) !important;
    border: 1px solid var(--border) !important;
    color: var(--text) !important;
    border-radius: 8px !important;
    padding: .35rem .7rem !important;
}
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_filter label,
.dataTables_wrapper .dataTables_length label { color: var(--muted) !important; }
.dataTables_wrapper .dataTables_paginate .paginate_button {
    border-radius: 7px !important; color: var(--muted2) !important;
    border: 1px solid transparent !important; background: transparent !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
    background: var(--red) !important;
    border-color: var(--red) !important;
    color: #fff !important;
    border-radius: 7px !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: rgba(255,255,255,.07) !important;
    color: var(--text) !important;
    border-color: var(--border2) !important;
}

/* Select2 theming */
.select2-container--default .select2-selection--single,
.select2-container--default .select2-selection--multiple {
    background: var(--bg2) !important;
    border-color: var(--border) !important;
    border-radius: 8px !important;
    color: var(--text) !important;
    min-height: 40px;
}
.select2-container--default .select2-selection--single .select2-selection__rendered { color: var(--text) !important; }
.select2-container--default .select2-selection--single .select2-selection__arrow b { border-color: var(--muted) transparent transparent transparent !important; }
.select2-dropdown { background: var(--bg2) !important; border-color: var(--border2) !important; border-radius: 10px !important; }
.select2-container--default .select2-results__option { color: var(--muted2) !important; }
.select2-container--default .select2-results__option--highlighted { background: rgba(227,30,36,.12) !important; color: var(--text) !important; }

/* Bootstrap form controls override */
.form-control, .form-select {
    background: var(--bg2) !important;
    border-color: var(--border) !important;
    color: var(--text) !important;
    border-radius: 8px !important;
}
.form-control:focus, .form-select:focus {
    background: var(--bg2) !important;
    border-color: var(--red) !important;
    color: var(--text) !important;
    box-shadow: 0 0 0 3px rgba(227,30,36,.1) !important;
}
.form-control::placeholder { color: var(--muted) !important; }

/* Bootstrap modal override */
.modal-content {
    background: var(--bg3) !important;
    border-color: var(--border2) !important;
    border-radius: 16px !important;
    color: var(--text) !important;
}
.modal-header { border-bottom-color: var(--border) !important; }
.modal-footer { border-top-color: var(--border) !important; }
.modal-title { color: var(--text) !important; font-weight: 700 !important; }
.btn-close { filter: invert(1) opacity(.6); }
.btn-close:hover { filter: invert(1) opacity(1); }

/* Bootstrap btn overrides */
.btn-primary { background: var(--red) !important; border-color: var(--red) !important; }
.btn-primary:hover { background: #c41920 !important; border-color: #c41920 !important; }
.btn-danger  { background: rgba(239,68,68,.15) !important; border-color: rgba(239,68,68,.35) !important; color: #f87171 !important; }
.btn-danger:hover  { background: rgba(239,68,68,.28) !important; }
.btn-secondary { background: var(--bg4) !important; border-color: var(--border2) !important; color: var(--muted2) !important; }
.btn-secondary:hover { color: var(--text) !important; }
.btn-success { background: rgba(34,197,94,.15) !important; border-color: rgba(34,197,94,.35) !important; color: #4ade80 !important; }
.btn-warning { background: rgba(249,115,22,.15) !important; border-color: rgba(249,115,22,.35) !important; color: #fdba74 !important; }

/* Dropdown */
.dropdown-menu {
    background: var(--bg2) !important;
    border-color: var(--border2) !important;
    border-radius: 12px !important;
    color: var(--text) !important;
    box-shadow: 0 12px 40px rgba(0,0,0,.5) !important;
}
.dropdown-item { color: var(--muted2) !important; }
.dropdown-item:hover { background: rgba(255,255,255,.06) !important; color: var(--text) !important; }
.dropdown-divider { border-color: var(--border) !important; }

/* Alert */
.alert { border-radius: 10px !important; }
.alert-danger  { background: rgba(227,30,36,.1) !important; border-color: rgba(227,30,36,.2) !important; color: #ff8888 !important; }
.alert-warning { background: rgba(249,115,22,.1) !important; border-color: rgba(249,115,22,.2) !important; color: #fdba74 !important; }
.alert-success { background: rgba(34,197,94,.1) !important; border-color: rgba(34,197,94,.2) !important; color: #4ade80 !important; }

/* Light mode table overrides */
html[data-theme="light"] .table > thead > tr > th { background: var(--bg3) !important; }
html[data-theme="light"] .form-control,
html[data-theme="light"] .form-select { color-scheme: light; }
html[data-theme="light"] .modal-content { background: var(--bg2) !important; box-shadow: 0 20px 60px rgba(0,0,0,.18) !important; }
html[data-theme="light"] .dropdown-menu { background: var(--bg2) !important; box-shadow: 0 8px 30px rgba(0,0,0,.12) !important; }
html[data-theme="light"] .dropdown-item:hover { background: rgba(0,0,0,.04) !important; }

/* ── Footer ───────────────────────────────────────────────── */
.fb-footer {
    padding: .8rem 1.6rem;
    border-top: 1px solid var(--border);
    font-size: .75rem;
    color: var(--muted);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    background: var(--bg2);
}
.fb-footer a { color: var(--muted); text-decoration: none; }
.fb-footer a:hover { color: var(--text); }
.pc-footer { display: none !important; }

/* ══════════════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════════════ */
@media (min-width: 681px) {
    .fb-sidebar { transition: transform .3s ease; }
    .fb-sidebar.sb-hidden { transform: translateX(calc(-1 * var(--sidebar-w) + 4px)); }
    .fb-main { transition: margin-left .3s ease; }
    .fb-main.sb-hidden { margin-left: 4px; }
}

@media (max-width: 900px) {
    .fb-stats-row { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 720px) {
    .fb-sidebar { transform: translateX(-100%); transition: transform .25s; }
    .fb-sidebar.open { transform: translateX(0); box-shadow: 4px 0 32px rgba(0,0,0,.7); }
    .fb-main { margin-left: 0 !important; }
    .fb-menu-toggle { display: flex; }
    .fb-content { padding: 1rem; }
    .fb-theme-btn span { display: none; }
    .fb-theme-btn { padding: 0 8px; }
}

@media (max-width: 480px) {
    .fb-stats-row { grid-template-columns: 1fr 1fr; gap: .6rem; }
    .fb-content { padding: .75rem; }
}

@media (max-width: 720px) {
    .fb-greeting { flex-direction: column; align-items: flex-start; padding: 1.25rem; }
}
