.lb-page {
    --bg:        #0d0d0e;
    --card:      #151516;
    --hover:     #1b1b1d;
    --line:      rgba(99,99,99,0.25);
    --line-soft: rgba(99,99,99,0.12);
    --ink:       #e0e0e0;
    --ink-dim:   rgba(224,224,224,0.8);
    --ink-faint: rgba(224,224,224,0.65);
    --accent:    #ff9900;
    background: var(--bg);
    color: var(--ink);
    padding: 1.25rem;
}

/* No overflow:hidden — it would clip the Filters dropdown menu. Children stay
   inside the rounded corners on their own (header line, inset rows, footer). */
.lb-card { background: var(--card); border-radius: 0; box-shadow: 0 4px 14px rgba(0,0,0,0.35); position: relative; }

/* ── Header ─────────────────────────────────────────────────────────── */
.lb-header {
    display: flex; align-items: center; gap: 1rem;
    padding: 0.85rem 1.25rem;
    border-bottom: 1px solid var(--line-soft);
    position: relative;
}
.lb-header-left { display: flex; align-items: center; gap: 0.6rem; min-width: 0; }
.lb-icon {
    width: 30px; height: 30px; border-radius: 0;
    background: rgba(255,153,0,0.1); border: 1px solid rgba(255,153,0,0.2);
    display: flex; align-items: center; justify-content: center;
    color: var(--accent); font-size: 0.7rem; flex-shrink: 0;
}
.lb-h-title h1 { font-size: 0.95rem; font-weight: 700; color: var(--ink); margin: 0; line-height: 1; }
.lb-h-subtitle { font-size: 0.65rem; color: rgba(224,224,224,0.65); font-weight: 400; margin-top: 0.15rem; }
.lb-loading {
    position: absolute; left: 50%; top: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.7rem; color: rgba(224,224,224,0.65);
    display: none; pointer-events: none;
}
.lb-search-wrap {
    margin-left: auto; position: relative;
    display: flex; align-items: center;
    background: var(--bg); border: 1px solid var(--line);
    border-radius: 0; padding: 0 0.55rem;
    min-width: 240px; max-width: 320px; flex: 0 1 auto;
}
.lb-search-icon { color: var(--ink-faint); font-size: 0.72rem; }
.lb-search-input {
    flex: 1; background: none; border: none; outline: none;
    color: var(--ink); font-size: 0.75rem;
    padding: 0.4rem 0.55rem;
}
.lb-search-input::placeholder { color: var(--ink-faint); }

/* ── Toolbar ────────────────────────────────────────────────────────── */
.lb-toolbar {
    display: flex; align-items: center; gap: 0.75rem;
    padding: 0.75rem 1.25rem; flex-wrap: wrap;
    border-bottom: 1px solid var(--line-soft);
}
.lb-chip-group { display: flex; align-items: center; gap: 0.25rem; flex-wrap: wrap; }
.lb-chip-label {
    font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.06em;
    color: rgba(224,224,224,0.65); margin-right: 0.2rem; white-space: nowrap;
}
.lb-chip {
    padding: 0.3rem 0.6rem; font-size: 0.72rem; font-weight: 500;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--line); border-radius: 0;
    color: rgba(224,224,224,0.65); cursor: pointer;
    transition: all 0.15s; line-height: 1;
    display: inline-flex; align-items: center; justify-content: center; gap: 0.35rem;
}
.lb-chip:hover:not(:disabled):not(.active) {
    border-color: rgba(99,99,99,0.4); color: rgba(224,224,224,0.7);
    background: rgba(255,255,255,0.05);
}
.lb-chip.active {
    color: var(--accent); background: rgba(255,153,0,0.08);
    border-color: rgba(255,153,0,0.25);
}
.lb-chip:disabled { opacity: 0.3; cursor: default; }

.lb-select {
    background: var(--bg); border: 1px solid var(--line);
    border-radius: 0; color: rgba(224,224,224,0.6);
    font-size: 0.7rem; padding: 0.25rem 0.45rem;
    cursor: pointer; outline: none;
}
.lb-select:focus { border-color: rgba(255,153,0,0.3); }

/* ── Filters dropdown button (ranking/users style) ──────────────────── */
.lb-filters { position: relative; }
.lb-filters-btn {
    display: inline-flex; align-items: center; gap: 0.4rem;
    background: var(--bg);
    border: 1px solid var(--line);
    color: var(--ink-dim);
    border-radius: 0;
    height: 32px;
    padding: 0 0.7rem;
    font-size: 0.74rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.06em;
    cursor: pointer; white-space: nowrap;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.lb-filters-btn > i:first-child { color: var(--accent); font-size: 0.78rem; }
.lb-filters-btn .lb-filters-caret {
    font-size: 0.6rem; color: var(--ink-faint);
    margin-left: 0.15rem;
    transition: transform 0.15s;
}
.lb-filters-btn:hover {
    border-color: rgba(255,153,0,0.35);
    color: var(--ink);
    background: var(--hover);
}
.lb-filters-btn[aria-expanded="true"] {
    border-color: rgba(255,153,0,0.55);
    color: var(--ink);
    background: var(--hover);
}
.lb-filters-btn[aria-expanded="true"] .lb-filters-caret { transform: rotate(180deg); }

.lb-filters-menu.dropdown-menu {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 0;
    padding: 0.55rem 0.65rem !important;
    box-shadow: 0 6px 18px rgba(0,0,0,0.5);
    min-width: 320px;
    z-index: 1100;
    /* This menu lives inside .lb-card. Bootstrap/Popper writes inline
       position/margin onto the open menu, which beats normal rules — pin it
       flush under the button and clear those inline styles with !important. */
    position: absolute;
    inset: auto !important;
    top: 100% !important;
    left: 0 !important;
    right: auto !important;
    margin-top: 6px !important;
}
.lb-filter-row {
    display: grid;
    grid-template-columns: 80px 1fr;
    align-items: center;
    gap: 0.6rem;
    padding: 0.3rem 0;
}
.lb-filter-row + .lb-filter-row { border-top: 1px dashed var(--line-soft); }
.lb-filter-row label {
    font-size: 0.66rem; font-weight: 700;
    color: var(--ink-faint);
    text-transform: uppercase; letter-spacing: 0.1em;
    margin: 0;
}
.lb-fselect {
    appearance: none; -webkit-appearance: none;
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--line);
    color: var(--ink);
    border-radius: 0;
    padding: 0.42rem 1.75rem 0.42rem 0.65rem;
    font-size: 0.78rem; font-weight: 500;
    cursor: pointer; outline: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path fill='%23a0a8b5' d='M0 0l5 6 5-6z'/></svg>");
    background-repeat: no-repeat; background-position: right 0.55rem center;
    transition: border-color 0.15s;
}
.lb-fselect:hover { border-color: rgba(255,153,0,0.35); }
.lb-fselect:focus { border-color: rgba(255,153,0,0.55); }
.lb-fselect option { background: var(--card); color: var(--ink); }
.lb-fselect optgroup {
    color: rgba(224,224,224,0.65); font-style: normal;
    font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.08em;
    background: var(--card);
}

/* ── Date switcher (ranking/users style) ────────────────────────────── */
.lb-date {
    display: inline-flex; align-items: center; gap: 2px;
    background: var(--bg); border: 1px solid var(--line);
    border-radius: 0; padding: 2px;
}
.lb-cal {
    background: transparent; border: 0; color: var(--ink-dim);
    font-size: 0.74rem; font-weight: 600;
    padding: 0 9px; height: 28px;
    border-radius: 0; cursor: pointer;
    display: inline-flex; align-items: center; gap: 0.3rem;
    transition: background 0.15s, color 0.15s;
}
.lb-cal:hover:not(:disabled) { background: var(--hover); color: var(--ink); }
.lb-cal:disabled { opacity: 0.35; cursor: not-allowed; }
.lb-cal-cur {
    font-variant-numeric: tabular-nums;
    color: var(--ink);
    min-width: 110px; justify-content: center;
}
.lb-cal-split { padding: 0 6px; color: var(--ink-faint); }
.lb-date .dropdown { position: relative; }
.lb-date .dropdown-menu {
    position: absolute; top: calc(100% + 4px); left: 0;
    background: var(--card); border: 1px solid var(--line);
    border-radius: 0; padding: 4px;
    box-shadow: 0 6px 18px rgba(0,0,0,0.5);
    min-width: 150px; z-index: 1100;
    display: none;
}
.lb-date .dropdown.is-open .dropdown-menu { display: block; }
.lb-date .dropdown-menu a {
    display: block; padding: 6px 10px;
    font-size: 0.76rem; color: var(--ink-dim);
    border-radius: 0; cursor: pointer; text-decoration: none;
}
.lb-date .dropdown-menu a:hover { background: var(--hover); color: var(--ink); }
.lb-date .dropdown-menu a.active { color: var(--accent); background: rgba(255,153,0,0.08); }

/* ── Member select (standalone, right of the date switcher) ──────────── */
.lb-member-select {
    appearance: none; -webkit-appearance: none;
    height: 32px;
    min-width: 170px; max-width: 220px;
    background: var(--bg);
    border: 1px solid var(--line);
    color: var(--ink-dim);
    border-radius: 0;
    padding: 0 1.75rem 0 0.65rem;
    font-size: 0.74rem; font-weight: 500;
    cursor: pointer; outline: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path fill='%23a0a8b5' d='M0 0l5 6 5-6z'/></svg>");
    background-repeat: no-repeat; background-position: right 0.55rem center;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.lb-member-select:hover { border-color: rgba(255,153,0,0.35); color: var(--ink); }
.lb-member-select:focus { border-color: rgba(255,153,0,0.55); color: var(--ink); }
.lb-member-select option { background: var(--card); color: var(--ink); }
.lb-member-select optgroup {
    color: rgba(224,224,224,0.65); font-style: normal;
    font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.08em;
    background: var(--card);
}

/* ── List ───────────────────────────────────────────────────────────── */
.lb-list {
    padding: 0.75rem 1.25rem;
    display: flex; flex-direction: column; gap: 0.3rem;
}
.lb-row {
    display: grid; align-items: center; gap: 0.6rem;
    padding: 0.55rem 0.85rem;
    background: var(--bg); border-radius: 0;
    border: 1px solid var(--line-soft);
    transition: border-color 0.15s, background 0.1s;
    font-size: 0.78rem; cursor: pointer;
    grid-template-columns:
        24px              /* status */
        28px              /* game icon */
        62px              /* date */
        minmax(0, 1.2fr)  /* member */
        minmax(0, 2fr)    /* route */
        minmax(0, 1.1fr)  /* cargo */
        92px              /* damage */
        90px              /* fuel */
        90px              /* profit */
        80px              /* distance */
        24px;             /* board */
}
.lb-row:hover { border-color: var(--line); background: var(--hover); }
.lb-row .lb-c { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-row .lb-c-status,
.lb-row .lb-c-game,
.lb-row .lb-c-board { text-align: center; color: var(--ink-faint); }
.lb-row .lb-c-game img.logbook-game-icon { width: 20px; height: 20px; vertical-align: middle; }
.lb-row .lb-c-date { color: var(--ink-faint); font-size: 0.72rem; letter-spacing: 0.02em; }
.lb-row .lb-c-member { color: rgba(224,224,224,0.85); }
.lb-row .lb-c-member .username-span { display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; }
.lb-row .lb-c-route { color: rgba(224,224,224,0.85); }
.lb-row .lb-c-route .row {
    --bs-gutter-x: 0; margin: 0; flex-wrap: nowrap;
}
.lb-row .lb-c-route .row > [class^="col-"] {
    padding: 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.lb-row .lb-c-route .row .col-2 {
    color: var(--ink-faint); text-align: center; flex: 0 0 auto; padding: 0 0.4rem;
}
.lb-row .lb-c-route .row .col-2 i { font-size: 0.62rem; }
.lb-row .lb-c-cargo { color: rgba(224,224,224,0.7); }
.lb-row .lb-c-damage { display: flex; gap: 0.35rem; align-items: center; }
.lb-row .lb-c-damage .me-2 { margin-right: 0 !important; }
.lb-row .lb-c-fuel,
.lb-row .lb-c-profit,
.lb-row .lb-c-distance { text-align: right; font-variant-numeric: tabular-nums; color: rgba(224,224,224,0.85); }
.lb-row .logbook-icon { font-size: 0.85rem; }

.lb-empty {
    text-align: center; padding: 2rem; color: rgba(224,224,224,0.65);
    font-size: 0.8rem;
}
.lb-empty i { font-size: 1.5rem; opacity: 0.3; display: block; margin-bottom: 0.5rem; }

/* ── Month group header ──────────────────────────────────────────────── */
.lb-month-header {
    display: flex; align-items: baseline; justify-content: space-between;
    gap: 0.6rem; padding: 0.45rem 0.85rem 0.3rem;
    margin-top: 0.45rem; border-bottom: 1px solid var(--line-soft);
}
.lb-month-header:first-child { margin-top: 0; }
.lb-month-header-label {
    font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.08em;
    color: rgba(224,224,224,0.65); font-weight: 600;
}
.lb-month-header-total {
    font-size: 0.72rem; color: rgba(224,224,224,0.7);
    font-variant-numeric: tabular-nums;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.lb-month-header-total .lb-month-breakdown {
    color: rgba(224,224,224,0.65); margin-left: 0.5rem; font-size: 0.65rem;
}
@media (max-width: 600px) {
    .lb-month-header-total .lb-month-breakdown { display: none; }
}

/* ── Footer ─────────────────────────────────────────────────────────── */
.lb-footer {
    padding: 0.75rem 1.25rem; border-top: 1px solid var(--line-soft);
    display: flex; align-items: center; justify-content: space-between;
    gap: 0.5rem; flex-wrap: wrap;
}
.lb-total { font-size: 0.72rem; color: rgba(224,224,224,0.65); }
.lb-pages { display: flex; align-items: center; gap: 3px; }
.lb-pages .pages {
    padding: 0.25rem 0.55rem; font-size: 0.7rem; border-radius: 0;
    min-width: 26px; text-align: center;
    background: rgba(255,255,255,0.03); border: 1px solid var(--line);
    color: rgba(224,224,224,0.65); cursor: pointer; transition: all 0.15s;
    display: inline-flex; align-items: center; justify-content: center;
}
.lb-pages .pages:hover:not([disabled]):not(.active) {
    background: rgba(255,255,255,0.06);
    border-color: rgba(99,99,99,0.35);
    color: rgba(224,224,224,0.7);
}
.lb-pages .pages.active {
    background: rgba(255,153,0,0.12);
    border-color: rgba(255,153,0,0.3);
    color: var(--accent); font-weight: 600;
}
.lb-pages .pages[disabled] { opacity: 0.25; cursor: default; }
.lb-pages .pages.hidden { display: none; }
.lb-pages .pages i { font-size: 0.6rem; }

/* ── Export dropdown ────────────────────────────────────────────────── */
.lb-export { position: relative; }
.lb-export-btn-toggle {
    display: inline-flex; align-items: center; gap: 0.4rem;
    background: var(--bg);
    border: 1px solid var(--line);
    color: var(--ink-dim);
    border-radius: 0;
    height: 32px;
    padding: 0 0.7rem;
    font-size: 0.74rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.06em;
    cursor: pointer; white-space: nowrap;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.lb-export-btn-toggle > i:first-child { color: var(--accent); font-size: 0.78rem; }
.lb-export-btn-toggle .lb-export-caret {
    font-size: 0.6rem; color: var(--ink-faint);
    margin-left: 0.15rem;
    transition: transform 0.15s;
}
.lb-export-btn-toggle:hover {
    border-color: rgba(255,153,0,0.35);
    color: var(--ink);
    background: var(--hover);
}
.lb-export-btn-toggle[aria-expanded="true"] {
    border-color: rgba(255,153,0,0.55);
    color: var(--ink);
    background: var(--hover);
}
.lb-export-btn-toggle[aria-expanded="true"] .lb-export-caret { transform: rotate(180deg); }

.lb-export-menu.dropdown-menu {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 0;
    padding: 0.35rem !important;
    box-shadow: 0 6px 18px rgba(0,0,0,0.5);
    min-width: 180px;
    z-index: 1100;
    /* Same pinning trick as .lb-filters-menu: this menu lives inside .lb-card,
       so clear Popper's inline styles and anchor it flush under the button. */
    position: absolute;
    inset: auto !important;
    top: 100% !important;
    left: auto !important;
    right: 0 !important;
    margin-top: 6px !important;
}
.lb-export-item {
    display: flex; align-items: center; gap: 0.5rem;
    padding: 0.5rem 0.6rem; font-size: 0.78rem; font-weight: 500;
    border-radius: 0;
    color: var(--ink-dim); cursor: pointer;
    transition: background 0.15s, color 0.15s; line-height: 1;
    text-decoration: none; white-space: nowrap;
}
.lb-export-item:hover {
    color: var(--accent);
    background: var(--hover); text-decoration: none;
}
.lb-export-item i { font-size: 0.82rem; width: 1rem; text-align: center; }

/* ── Responsive collapses ───────────────────────────────────────────── */
@media (max-width: 1200px) {
    .lb-row { grid-template-columns: 24px 28px 62px minmax(0,1fr) minmax(0,1.6fr) minmax(0,1fr) 90px 80px 24px; }
    .lb-row .lb-c-fuel,
    .lb-row .lb-c-cargo { display: none; }
    .lb-search-wrap { min-width: 180px; }
}
@media (max-width: 900px) {
    .lb-row { grid-template-columns: 24px 28px minmax(0,1fr) minmax(0,1.4fr) 80px 24px; gap: 0.5rem; }
    .lb-row .lb-c-date,
    .lb-row .lb-c-cargo,
    .lb-row .lb-c-damage,
    .lb-row .lb-c-fuel,
    .lb-row .lb-c-distance { display: none; }
    .lb-header { flex-wrap: wrap; }
    .lb-search-wrap { margin-left: 0; width: 100%; max-width: none; }
}
@media (max-width: 600px) {
    .lb-row { grid-template-columns: 24px 28px minmax(0,1fr) 24px; }
    .lb-row .lb-c-member { display: none; }
}
