* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --transition-speed: 0.3s;
}

/* Dark Theme (Default) — matches public wijty site */
[data-theme="dark"] {
    --bg-primary: #070b12;
    --bg-secondary: #0d1420;
    --bg-tertiary: #111a28;
    --text-primary: #e8edf5;
    --text-secondary: #94a3b8;
    --border-color: rgba(255, 255, 255, 0.08);
    --accent-color: #10b981;
    --accent-hover: #059669;
    --card-bg: #111a28;
    --nav-active: #10b981;
    --nav-hover: rgba(255, 255, 255, 0.04);
    --scrollbar-track: #0d1420;
    --scrollbar-thumb: rgba(255, 255, 255, 0.15);
    --scrollbar-thumb-hover: #10b981;
}

/* Light Theme — matches public wijty site */
[data-theme="light"] {
    --bg-primary: #e8ecef;
    --bg-secondary: #dfe3e7;
    --bg-tertiary: #f6f8f7;
    --text-primary: #1a2e28;
    --text-secondary: #5a6c66;
    --border-color: rgba(55, 71, 79, 0.14);
    --accent-color: #047857;
    --accent-hover: #059669;
    --card-bg: #f6f8f7;
    --nav-active: #047857;
    --nav-hover: rgba(4, 120, 87, 0.06);
    --scrollbar-track: #dfe3e7;
    --scrollbar-thumb: rgba(55, 71, 79, 0.25);
    --scrollbar-thumb-hover: #047857;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: background-color var(--transition-speed), color var(--transition-speed);
}

html {
    color-scheme: dark;
}

html[data-theme="light"] {
    color-scheme: light;
}

/* Custom scrollbars (Firefox + WebKit/Chromium/Edge/Safari) */
html {
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

* {
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

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

*::-webkit-scrollbar-track {
    background: var(--scrollbar-track);
    border-radius: 8px;
}

*::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 8px;
    border: 2px solid var(--scrollbar-track);
}

*::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-thumb-hover);
}

*::-webkit-scrollbar-corner {
    background: var(--scrollbar-track);
}

*::-webkit-scrollbar-button {
    display: none;
    width: 0;
    height: 0;
}

/* Login Page */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 1rem;
    background: var(--bg-primary);
}

.login-box {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--border-color);
    width: 100%;
    max-width: 400px;
    transition: background-color var(--transition-speed), border-color var(--transition-speed);
}

.login-box--tabbed {
    max-width: min(100%, 28rem);
}

.login-box h1 {
    text-align: center;
    margin-bottom: 2rem;
    color: var(--text-primary);
}

.login-box--tabbed h1 {
    margin-bottom: 1.25rem;
}

/* Login tabs (main login screen only; markup omitted on MFA/OTP/email flows) */
.login-tabs-nav {
    display: flex;
    gap: 0;
    margin-bottom: 1.25rem;
    padding: 0.28rem;
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.login-tab {
    flex: 1;
    padding: 0.6rem 0.75rem;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
}

.login-tab:hover {
    color: var(--text-primary);
    background: var(--nav-hover);
}

.login-tab:active {
    transform: scale(0.98);
}

.login-tab.login-tab--active {
    background: var(--nav-active);
    color: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.login-tab.login-tab--active:hover {
    background: var(--accent-hover);
    color: #ffffff;
}

.login-tabs-panels {
    display: grid;
}

.login-tab-panel {
    grid-area: 1 / 1;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.22s ease, visibility 0.22s ease;
    z-index: 0;
}

.login-tab-panel.login-tab-panel--active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    z-index: 1;
}

.login-about-intro {
    font-size: 0.925rem;
    line-height: 1.55;
    color: var(--text-secondary);
    margin-bottom: 0.85rem;
}

.login-about-features {
    list-style: none;
    margin: 1rem 0 1.25rem;
    padding: 0;
}

.login-about-features li {
    position: relative;
    padding: 0.35rem 0 0.35rem 1.35rem;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.login-about-features li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.65rem;
    width: 7px;
    height: 7px;
    border-radius: 2px;
    background: var(--accent-color);
}

.login-about-contacts {
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    font-size: 0.9rem;
    line-height: 1.65;
    color: var(--text-secondary);
}

.login-about-contacts strong {
    color: var(--text-primary);
}

.login-about-contacts a {
    color: var(--accent-color);
    text-decoration: none;
    transition: color 0.2s ease;
}

.login-about-contacts a:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

@media screen and (max-width: 400px) {
    .login-box {
        padding: 1.5rem;
    }

    .login-tab {
        font-size: 0.875rem;
        padding: 0.55rem 0.45rem;
    }
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-primary);
}

.form-group input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 1rem;
    background: var(--bg-secondary);
    color: var(--text-primary);
    transition: border-color var(--transition-speed), background-color var(--transition-speed);
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent-color);
}

.form-group input.invalid,
.form-group input:user-invalid {
    border-color: #e74c3c;
    background-color: rgba(231, 76, 60, 0.05);
}

.form-group input.invalid:focus {
    border-color: #e74c3c;
    box-shadow: 0 0 0 2px rgba(231, 76, 60, 0.2);
}

.custom-select-trigger.invalid {
    border-color: #e74c3c;
    background-color: rgba(231, 76, 60, 0.05);
}

.custom-select-trigger.invalid:focus {
    border-color: #e74c3c;
    box-shadow: 0 0 0 2px rgba(231, 76, 60, 0.2);
}

.field-error {
    color: #e74c3c;
    font-size: 0.875rem;
    margin-top: 0.25rem;
    min-height: 1.25rem;
    display: none;
}

.field-error.show {
    display: block;
}

.btn-primary {
    width: 100%;
    padding: 0.75rem;
    background: var(--accent-color);
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    transition: background var(--transition-speed);
}

.btn-primary:hover {
    background: var(--accent-hover);
}

.error-message {
    color: #e74c3c;
    margin-bottom: 1rem;
    padding: 0.5rem;
    background: rgba(231, 76, 60, 0.1);
    border-radius: 4px;
}

.otp-instruction {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    line-height: 1.5;
}

#otp_code {
    text-align: center;
    font-size: 1.5rem;
    letter-spacing: 0.5rem;
    font-weight: 600;
    padding: 1rem;
}

.back-to-login {
    display: block;
    text-align: center;
    margin-top: 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color var(--transition-speed);
}

.back-to-login:hover {
    color: var(--accent-color);
    text-align: center;
}

/* App Layout — animatable sidebar width */
@property --sidebar-width {
    syntax: "<length>";
    inherits: true;
    initial-value: 250px;
}

:root {
    --sidebar-width: 250px;
    --sidebar-duration: 1.4s;
    --sidebar-easing: cubic-bezier(0.33, 1, 0.68, 1);
    --sidebar-transition: var(--sidebar-duration) var(--sidebar-easing);
    --logo-char-last: 4;
    --logo-char-anim: 0.55s;
    --logo-char-step: calc((var(--sidebar-duration) - var(--logo-char-anim)) / var(--logo-char-last));
    --nav-char-anim: 0.55s;
}

html.sidebar-narrow {
    --sidebar-width: 72px;
}

@media (prefers-reduced-motion: no-preference) {
    html {
        transition: --sidebar-width var(--sidebar-transition);
    }
}

@media (prefers-reduced-motion: reduce) {
    :root {
        --sidebar-transition: 0.01ms;
    }
}

.app-container {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-secondary);
    color: var(--text-primary);
    padding: 1.25rem 1rem;
    border-right: 1px solid var(--border-color);
    transition:
        width var(--sidebar-transition),
        padding var(--sidebar-transition),
        background-color var(--transition-speed),
        border-color var(--transition-speed);
    overflow-x: hidden;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    z-index: 100;
}

.sidebar-header {
    position: relative;
    display: flex;
    align-items: center;
    min-height: 2.75rem;
    margin-bottom: 1.25rem;
    padding-right: calc(2.25rem + 0.35rem);
    transition:
        margin-bottom var(--sidebar-transition),
        padding var(--sidebar-transition);
}

.sidebar-brand {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
}

.sidebar-logo-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    min-height: 2.25rem;
    font-size: 1.35rem;
    margin: 0;
    color: var(--text-primary);
    line-height: 1;
    font-weight: 700;
    transition: gap var(--sidebar-transition);
}

.sidebar-logo-img {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    flex-shrink: 0;
    object-fit: contain;
    transition: width var(--sidebar-transition), height var(--sidebar-transition);
}

html.sidebar-narrow .sidebar-logo-img {
    width: 24px;
    height: 24px;
}

.logo-full {
    display: inline-block;
    line-height: 1;
    letter-spacing: 0;
    white-space: nowrap;
    overflow: hidden;
    vertical-align: middle;
}

.logo-char {
    display: inline-block;
    overflow: hidden;
    max-width: 1.15em;
    opacity: 1;
    vertical-align: top;
    transition:
        max-width var(--logo-char-anim) cubic-bezier(0.33, 1, 0.68, 1),
        opacity var(--logo-char-anim) cubic-bezier(0.33, 1, 0.68, 1);
    transition-delay: calc(var(--i) * var(--logo-char-step));
}

html.sidebar-narrow .logo-char {
    max-width: 0;
    opacity: 0;
    transition-delay: calc((var(--logo-char-last, 4) - var(--i)) * var(--logo-char-step));
}

html.sidebar-narrow .sidebar-header {
    justify-content: center;
    padding-right: calc(2.25rem + 0.2rem);
}

html.sidebar-narrow .sidebar-brand {
    flex: 0 0 auto;
}

html.sidebar-narrow .sidebar-logo {
    gap: 0;
    justify-content: center;
}

html.sidebar-narrow .sidebar {
    padding: 1rem 0.5rem;
}

.sidebar-toggle {
    position: absolute;
    right: 0;
    top: 50%;
    width: 2.25rem;
    height: 2.25rem;
    margin-top: -1.125rem;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    cursor: pointer;
    transition:
        background-color var(--transition-speed),
        color var(--transition-speed),
        border-color var(--transition-speed);
}

.sidebar-toggle:hover {
    background: var(--nav-hover);
    color: var(--text-primary);
}

.sidebar-toggle-icon {
    position: absolute;
    width: 1.125rem;
    height: 1.125rem;
    transition:
        opacity 0.35s var(--sidebar-easing),
        transform 0.35s var(--sidebar-easing);
}

.sidebar-toggle-icon--collapse {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

.sidebar-toggle-icon--expand {
    opacity: 0;
    transform: rotate(-90deg) scale(0.82);
    pointer-events: none;
}

html.sidebar-narrow .sidebar-toggle-icon--collapse {
    opacity: 0;
    transform: rotate(90deg) scale(0.82);
    pointer-events: none;
}

html.sidebar-narrow .sidebar-toggle-icon--expand {
    opacity: 1;
    transform: rotate(0deg) scale(1);
    pointer-events: auto;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    flex: 1;
}

html.sidebar-narrow .nav-item {
    justify-content: center;
    padding: 0.65rem 0.4rem;
    position: relative;
    transition: padding var(--sidebar-transition), justify-content var(--sidebar-transition);
}

.nav-item {
    color: var(--text-secondary);
    text-decoration: none;
    padding: 0.65rem 0.65rem;
    border-radius: 8px;
    transition:
        background-color var(--transition-speed),
        color var(--transition-speed),
        padding var(--sidebar-transition),
        justify-content var(--sidebar-transition);
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.nav-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
}

.nav-icon svg {
    width: 1.25rem;
    height: 1.25rem;
    display: block;
    stroke-width: 1.75;
}

.nav-label {
    flex: 1;
    min-width: 0;
    display: inline-block;
    line-height: 1.2;
    letter-spacing: 0;
    white-space: nowrap;
    overflow: hidden;
    vertical-align: middle;
    --nav-char-step: calc(
        (var(--sidebar-duration) - var(--nav-char-anim)) / max(var(--nav-char-last, 1), 1)
    );
}

.nav-char {
    display: inline-block;
    overflow: hidden;
    max-width: 0.62em;
    opacity: 1;
    vertical-align: top;
    transition:
        max-width var(--nav-char-anim) cubic-bezier(0.33, 1, 0.68, 1),
        opacity var(--nav-char-anim) cubic-bezier(0.33, 1, 0.68, 1);
    transition-delay: calc(var(--i, 0) * var(--nav-char-step));
}

.nav-char--space {
    max-width: 0.32em;
}

html.sidebar-narrow .nav-char {
    max-width: 0;
    opacity: 0;
    transition-delay: calc((var(--nav-char-last, 0) - var(--i, 0)) * var(--nav-char-step));
}

html.sidebar-narrow .nav-char--space {
    max-width: 0;
}

.nav-item:hover {
    background: var(--nav-hover);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--nav-active);
    color: white;
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border-color);
}

.user-info {
    margin-bottom: 0.75rem;
}

.user-email {
    font-size: 0.8rem;
    color: var(--text-secondary);
    word-break: break-word;
    display: block;
}

html.sidebar-narrow .user-email {
    font-size: 0.65rem;
    line-height: 1.25;
    max-height: 2.5rem;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    text-align: center;
    word-break: break-all;
}

.logout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.65rem 0.75rem;
    background: var(--accent-color);
    color: white;
    text-align: center;
    text-decoration: none;
    border-radius: 8px;
    transition: background-color var(--transition-speed);
    font-weight: 500;
}

.logout-icon {
    display: none;
    flex-shrink: 0;
    width: 1.25rem;
    height: 1.25rem;
}

.logout-icon svg {
    width: 1.25rem;
    height: 1.25rem;
    display: block;
    stroke: white;
}

html.sidebar-narrow .logout-icon {
    display: flex;
}

html.sidebar-narrow .logout-text {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
}

html.sidebar-narrow .logout-btn {
    padding: 0.55rem;
    width: 100%;
    box-sizing: border-box;
}

.logout-btn:hover {
    background: var(--accent-hover);
}

.content-wrapper {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left var(--sidebar-transition);
    position: relative;
    background: var(--bg-primary);
}

.content-wrapper::before {
    content: "";
    position: fixed;
    top: 50%;
    left: calc(var(--sidebar-width) + (100vw - var(--sidebar-width)) / 2);
    transform: translate(-50%, -50%);
    width: min(680px, 78vmin);
    height: min(680px, 78vmin);
    background: url("/static/images/watermark2.png") center / contain no-repeat;
    opacity: 0.11;
    filter: blur(8px);
    pointer-events: none;
    z-index: 1;
    transition: left var(--sidebar-transition);
}

[data-theme="light"] .content-wrapper::before {
    opacity: 0.08;
    filter: blur(7px);
}

.top-header {
    position: sticky;
    top: 0;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 100;
    transition: background-color var(--transition-speed), border-color var(--transition-speed);
}

/* Time Display */
.time-display-container {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.time-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    transition: background-color var(--transition-speed), border-color var(--transition-speed);
}

.time-item.server-time {
    background: var(--accent-color);
    border-color: var(--accent-color);
    color: white;
}

.time-item.server-time .time-zone,
.time-item.server-time .time-value {
    color: white;
}

.time-zone {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-secondary);
    min-width: 2rem;
}

.time-item.server-time .time-zone {
    color: white;
}

.time-value {
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    color: var(--text-primary);
    white-space: nowrap;
}

.time-item.server-time .time-value {
    color: white;
}

.theme-toggle {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color var(--transition-speed), border-color var(--transition-speed);
    font-size: 1.2rem;
}

.theme-toggle:hover {
    background: var(--bg-tertiary);
}

.theme-toggle__icon--dark {
    display: none;
}

[data-theme="light"] .theme-toggle__icon--light {
    display: none;
}

[data-theme="light"] .theme-toggle__icon--dark {
    display: inline;
}

.theme-icon {
    display: block;
}

.main-content {
    flex: 1;
    padding: 2rem;
    background: transparent;
    position: relative;
    z-index: 2;
    transition: background-color var(--transition-speed);
}

/* Sidebar nav: overlay crossfade (content stays visible; no view-transition jank) */
.page-nav-overlay {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: var(--sidebar-width);
    z-index: 90;
    background: var(--bg-primary);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.28s ease, visibility 0.28s ease;
}

html.page-nav-active .page-nav-overlay,
.page-nav-overlay.is-visible {
    opacity: 1;
    visibility: visible;
}

.page-nav-overlay.is-blocking {
    pointer-events: auto;
}

@media (max-width: 1024px) {
    .page-nav-overlay {
        left: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .page-nav-overlay {
        transition: none;
    }
}

/* --- Mobile: drawer nav (full-width content; sidebar off-canvas) --- */
.mobile-nav-open-btn {
    display: none;
}

.mobile-sidebar-backdrop {
    display: none;
}

/* ≤1024px: tablets + phones; also iPhone “Request Desktop Site” (~980px CSS pixels) */
@media (max-width: 1024px) {
    .mobile-nav-open-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 2.5rem;
        height: 2.5rem;
        padding: 0;
        margin: 0 0.35rem 0 0;
        flex-shrink: 0;
        border: 1px solid var(--border-color);
        border-radius: 8px;
        background: var(--bg-secondary);
        color: var(--text-primary);
        cursor: pointer;
        transition: background-color var(--transition-speed), border-color var(--transition-speed);
        -webkit-tap-highlight-color: transparent;
    }

    .mobile-nav-open-btn:hover {
        background: var(--bg-tertiary);
    }

    .mobile-sidebar-backdrop {
        display: none;
        position: fixed;
        inset: 0;
        margin: 0;
        padding: 0;
        border: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 195;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }

    html.mobile-sidebar-open .mobile-sidebar-backdrop {
        display: block;
    }

    .content-wrapper {
        margin-left: 0 !important;
    }

    .content-wrapper::before {
        left: 50%;
    }

    .sidebar {
        width: min(280px, 88vw);
        z-index: 200;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        box-shadow: none;
    }

    html.mobile-sidebar-open .sidebar {
        transform: translateX(0);
        box-shadow: 8px 0 28px rgba(0, 0, 0, 0.4);
    }

    .sidebar-toggle {
        display: none;
    }

    /* Drawer always shows full labels (ignore desktop sidebar-narrow) */
    html.sidebar-narrow .logo-char {
        max-width: 1.15em !important;
        opacity: 1 !important;
        transition-delay: 0s !important;
    }

    html.sidebar-narrow .sidebar-header {
        justify-content: stretch;
        padding-right: calc(2.25rem + 0.5rem);
    }

    html.sidebar-narrow .nav-label {
        position: static;
        width: auto;
        height: auto;
        padding: 0;
        margin: 0;
        overflow: visible;
        clip: auto;
        border: 0;
    }

    html.sidebar-narrow .nav-char {
        max-width: 0.62em !important;
        opacity: 1 !important;
        transition-delay: 0s !important;
    }

    html.sidebar-narrow .nav-char--space {
        max-width: 0.32em !important;
    }

    html.sidebar-narrow .nav-item {
        justify-content: flex-start;
        padding: 0.65rem 0.65rem;
    }

    html.sidebar-narrow .user-email {
        font-size: 0.8rem;
        text-align: left;
        display: block;
        max-height: none;
        -webkit-line-clamp: unset;
        -webkit-box-orient: unset;
    }

    html.sidebar-narrow .logout-text {
        position: static;
        width: auto;
        height: auto;
        overflow: visible;
        clip: auto;
    }

    html.sidebar-narrow .logout-icon {
        display: none;
    }

    html.sidebar-narrow .logout-btn {
        padding: 0.65rem 0.75rem;
    }

    html.sidebar-narrow .sidebar-presence-toolbar {
        flex-direction: row;
        flex-wrap: wrap;
    }

    html.sidebar-narrow .presence-select {
        font-size: 0.78rem;
        padding: 0.45rem 0.55rem;
        flex: 1 1 120px;
        width: auto;
    }

    html.sidebar-narrow .presence-online-badge {
        width: auto;
        padding: 0.45rem 0.65rem;
    }

    .nav-icon {
        width: 1.35rem;
        height: 1.35rem;
    }

    .nav-icon svg {
        width: 1.35rem;
        height: 1.35rem;
    }

    .top-header {
        padding: 0.65rem 0.85rem;
        flex-wrap: nowrap;
        align-items: center;
        gap: 0.35rem;
    }

    .time-display-container {
        flex: 1;
        min-width: 0;
        justify-content: flex-end;
        gap: 0.4rem;
    }

    .time-item {
        padding: 0.35rem 0.5rem;
        gap: 0.35rem;
    }

    .time-zone {
        font-size: 0.75rem;
    }

    .time-value {
        font-size: 0.8rem;
    }

    .theme-toggle {
        width: 36px;
        height: 36px;
        flex-shrink: 0;
        font-size: 1rem;
    }

    .main-content {
        padding: 1rem;
    }
}

/* Page Content */
.page-content h1 {
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.page-content p {
    color: var(--text-secondary);
}

/* Dashboard */
.dashboard h1 {
    margin-bottom: 2rem;
    color: var(--text-primary);
}

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.card {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--border-color);
    transition: background-color var(--transition-speed), border-color var(--transition-speed);
}

.card h3 {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
}

.card-value {
    font-size: 2rem;
    font-weight: bold;
    color: var(--text-primary);
}

/* Settings Page */
.settings-section {
    margin-top: 2rem;
}

.settings-section h2 {
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.settings-section h3 {
    margin-bottom: 1rem;
    color: var(--text-primary);
    font-size: 1.2rem;
}

.user-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.user-form .form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.user-form label {
    font-weight: 500;
    color: var(--text-primary);
}

.user-form input,
.user-form select {
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 1rem;
    transition: border-color var(--transition-speed);
}

.user-form input:focus,
.user-form select:focus {
    outline: none;
    border-color: var(--accent-color);
}

.user-form select {
    cursor: pointer;
}

.btn-small {
    padding: 0.5rem 1rem;
    background: var(--accent-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background var(--transition-speed);
    appearance: none;
    -webkit-appearance: none;
}

.btn-small:hover:not(.btn-danger):not(:disabled) {
    background: var(--accent-hover);
}

.btn-small:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: var(--bg-tertiary);
}

.btn-danger {
    background: #dc2626;
    color: #fff;
    border: none;
    box-shadow: none;
    margin-left: 0.5rem;
    appearance: none;
    -webkit-appearance: none;
}

.btn-danger:hover:not(:disabled) {
    background: #b91c1c;
}

.btn-small.btn-danger {
    background: #dc2626;
    color: #fff;
    border: none;
    box-shadow: none;
}

.btn-small.btn-danger:hover:not(:disabled) {
    background: #b91c1c;
}

.table-container {
    overflow-x: auto;
    margin-top: 1rem;
}

.users-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card-bg);
}

.users-table th,
.users-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.users-table th {
    background: var(--bg-secondary);
    font-weight: 600;
    color: var(--text-primary);
}

.users-table td {
    color: var(--text-secondary);
}

.users-table tr:hover {
    background: var(--bg-secondary);
}

.users-table select {
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    cursor: pointer;
}

.users-table select:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-switch .slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--bg-tertiary);
    transition: var(--transition-speed);
    border-radius: 24px;
}

.toggle-switch .slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: var(--transition-speed);
    border-radius: 50%;
}

.toggle-switch input:checked + .slider {
    background-color: var(--accent-color);
}

.toggle-switch input:checked + .slider:before {
    transform: translateX(26px);
}

.toggle-switch input:disabled + .slider {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background-color: var(--card-bg);
    margin: 10% auto;
    padding: 2rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    position: relative;
}

.close {
    color: var(--text-secondary);
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    position: absolute;
    right: 1rem;
    top: 1rem;
}

.close:hover {
    color: var(--text-primary);
}

.message {
    margin-top: 1rem;
    padding: 0.75rem;
    border-radius: 4px;
    text-align: center;
}

.message.success {
    background: rgba(46, 204, 113, 0.1);
    color: #2ecc71;
}

.message.error {
    background: rgba(231, 76, 60, 0.1);
    color: #e74c3c;
}

/* Validation messages */
.validation-message {
    margin-top: 0.5rem;
    font-size: 0.875rem;
    min-height: 1.25rem;
}

.validation-message.checking {
    color: var(--text-secondary);
}

.validation-message.success {
    color: #10b981;
}

.validation-message.error {
    color: #ef4444;
}

/* Autocomplete wrapper - relative container for positioning */
.autocomplete-wrapper {
    position: relative !important;
    width: 100%;
    display: block;
}

.autocomplete-wrapper input {
    width: 100%;
    box-sizing: border-box;
}

/* Autocomplete dropdown */
.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    width: 100%;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    margin-top: 0.25rem;
    max-height: 200px;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 1000;
    display: none;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    list-style: none;
    padding: 0;
    margin: 0.25rem 0 0 0;
}

/* When dropdown is visible (via inline style) */
.autocomplete-dropdown[style*="display: block"],
.autocomplete-dropdown[style*="display:block"] {
    display: block !important;
}

.autocomplete-item {
    padding: 0.75rem;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
    transition: background-color var(--transition-speed);
    color: var(--text-primary);
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item:hover,
.autocomplete-item.selected {
    background-color: var(--bg-tertiary);
}

.autocomplete-item:active {
    background-color: var(--accent-color);
    color: #ffffff;
}

/* Custom Select Dropdown */
.custom-select-wrapper {
    position: relative;
    width: 100%;
}

.custom-select-trigger {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: border-color var(--transition-speed), background-color var(--transition-speed);
    text-align: left;
}

.custom-select-trigger:hover {
    border-color: var(--accent-color);
    background: var(--bg-tertiary);
}

.custom-select-trigger:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(var(--accent-color-rgb, 66, 153, 225), 0.2);
}

.custom-select-trigger[aria-expanded="true"] {
    border-color: var(--accent-color);
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

.custom-select-value {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.custom-select-value .option-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.custom-select-arrow {
    transition: transform var(--transition-speed);
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.custom-select-trigger[aria-expanded="true"] .custom-select-arrow {
    transform: rotate(180deg);
}

.custom-select-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 4px 4px;
    max-height: 250px;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 1000;
    display: none;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    margin-top: -1px;
}

.custom-select-dropdown.show {
    display: block;
}

.custom-select-option {
    padding: 0.75rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: background-color var(--transition-speed);
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
}

.custom-select-option:last-child {
    border-bottom: none;
}

.custom-select-option:hover,
.custom-select-option:focus {
    background-color: var(--bg-tertiary);
    outline: none;
}

.custom-select-option.selected {
    background-color: var(--bg-tertiary);
    color: var(--accent-color);
}

.custom-select-option .option-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.custom-select-option .option-text {
    flex: 1;
}

/* Loads Page */
.load-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.btn-secondary {
    padding: 0.75rem 1.5rem;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color var(--transition-speed);
}

.btn-secondary:hover {
    background: var(--bg-secondary);
}

.loads-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card-bg);
}

.loads-table th,
.loads-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.loads-table th {
    background: var(--bg-secondary);
    font-weight: 600;
    color: var(--text-primary);
}

.loads-table td {
    color: var(--text-secondary);
}

.loads-table tr:hover {
    background: var(--bg-secondary);
}

.loads-table .load-number-rc-link {
    color: var(--accent-color);
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.loads-table .load-number-rc-link:hover {
    filter: brightness(1.12);
}

/* Loads: stacked Edit / Delete — global .btn-danger has margin-left for horizontal toolbars */
.loads-actions-cell {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.35rem;
}

.loads-actions-cell .btn-small.btn-danger {
    margin-left: 0;
}

.loads-docs-cell {
    display: inline-flex;
    gap: 6px;
    flex-wrap: wrap;
}

.doc-icon {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 600;
    text-decoration: none;
    letter-spacing: 0.02em;
}

.doc-rc {
    background: color-mix(in srgb, var(--accent-color, #10b981) 20%, #3498db);
    color: #1e3a5f;
}

.doc-pod {
    background: color-mix(in srgb, var(--accent-color, #10b981) 35%, transparent);
    color: var(--text-primary, #111);
}

.doc-inv {
    background: var(--bg-secondary, #eee);
    color: var(--text-primary, #111);
    border: 1px solid var(--border-color, #ddd);
}

/* Status Badges */
.status-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 500;
    text-transform: capitalize;
}

.status-booked {
    background: #3498db;
    color: white;
}

.status-picked {
    background: #e67e22;
    color: white;
}

.status-completed {
    background: #2ecc71;
    color: white;
}

/* Legacy class names (alias) — prefer booked/picked/completed */
.status-active {
    background: #3498db;
    color: white;
}

.status-issue {
    background: #e67e22;
    color: white;
}

.status-badge-clickable {
    cursor: pointer;
    user-select: none;
    transition: filter 0.15s ease;
}

.status-badge-clickable:hover {
    filter: brightness(1.08);
}

.status-badge-clickable[aria-busy="true"] {
    opacity: 0.65;
    pointer-events: none;
    cursor: wait;
}

.readonly-field {
    padding: 0.75rem;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 1rem;
}

/* Error Pages */
.error-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: var(--bg-primary);
}

.error-box {
    text-align: center;
    padding: 2rem;
}

.error-box h1 {
    font-size: 4rem;
    color: var(--accent-color);
    margin-bottom: 1rem;
}

.error-box h2 {
    font-size: 2rem;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.error-box p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

/* Time Settings */
.toggle-switch-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    cursor: pointer;
}

.toggle-switch-label span:first-child {
    color: var(--text-primary);
    font-weight: 500;
}

.timezone-checkboxes {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    color: var(--text-primary);
}

.checkbox-label input[type="checkbox"] {
    width: auto;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"]:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.server-time-label {
    font-style: italic;
    color: var(--accent-color);
    font-size: 0.85rem;
    margin-left: 0.25rem;
}

.settings-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.settings-form .form-group {
    margin-bottom: 0;
}

.settings-form small {
    display: block;
    margin-top: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* Fleet Status Styles */
.fleet-status-rp {
    background-color: rgba(255, 193, 7, 0.2);
    border: 1px solid rgba(255, 193, 7, 0.4);
}

.fleet-status-rd {
    background-color: rgba(33, 150, 243, 0.2);
    border: 1px solid rgba(33, 150, 243, 0.4);
}

.fleet-status-ready {
    background-color: rgba(76, 175, 80, 0.2);
    border: 1px solid rgba(76, 175, 80, 0.4);
}

.fleet-status-empty {
    background-color: rgba(156, 39, 176, 0.1);
    border: 1px solid rgba(156, 39, 176, 0.2);
}

.fleet-status-off {
    background-color: rgba(97, 97, 97, 0.2);
    border: 1px solid rgba(97, 97, 97, 0.4);
}

/* Fleet table - use CSS Grid for column alignment */
#fleet-table {
    display: grid;
    grid-template-columns: 160px repeat(7, 1fr);
}

/* Flatten table structure for CSS Grid */
#fleet-table thead,
#fleet-table tbody,
#fleet-table thead tr,
#fleet-table tbody tr {
    display: contents;
}

/* Fleet header cells - stable layout with flexbox */
#fleet-table thead th {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    position: relative;
    text-align: center;
    background: var(--bg-secondary);
    font-weight: 600;
    color: var(--text-primary);
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

/* Fleet body cells - align with grid */
#fleet-table tbody td {
    padding: 0.75rem;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
}

/* Today's date header highlighting in Fleet grid */
.fleet-today-header {
    color: var(--accent-color);
    font-weight: 600;
}

.fleet-today-header::after {
    content: "";
    position: absolute;
    bottom: 6px;
    left: 20%;
    right: 20%;
    height: 2px;
    background-color: var(--accent-color, #6f8cff);
    border-radius: 2px;
}

/* Message styles for fleet modal */
.message {
    padding: 10px;
    border-radius: 4px;
    margin-top: 10px;
    display: none;
}

.message.success {
    background-color: rgba(76, 175, 80, 0.2);
    color: #4CAF50;
    border: 1px solid rgba(76, 175, 80, 0.4);
    display: block;
}

.message.error {
    background-color: rgba(244, 67, 54, 0.2);
    color: #f44336;
    border: 1px solid rgba(244, 67, 54, 0.4);
    display: block;
}

/* Fleet Assignments Modal Overlay */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.modal-overlay.hidden {
    display: none;
}

.assign-modal {
    background: var(--card-bg, #1f1f1f);
    border-radius: 10px;
    width: 420px;
    max-width: 90%;
    padding: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

/* Fleet Summary Panel */
.summary-stat {
    text-align: center;
    padding: 10px;
    background: var(--card-bg, #fff);
    border: 1px solid var(--border-color, #ddd);
    border-radius: 6px;
}

.summary-label {
    font-size: 12px;
    color: var(--text-secondary, #666);
    margin-bottom: 5px;
    font-weight: 500;
}

.summary-value {
    font-size: 24px;
    font-weight: bold;
    color: var(--text-primary, #000);
}

/* Global themed confirm (showConfirm) — replaces window.confirm */
.app-confirm-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10050;
    background: rgba(0, 0, 0, 0.55);
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

.app-confirm-overlay.is-open {
    display: flex;
}

.app-confirm-dialog {
    background: var(--card-bg);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 22px 24px;
    max-width: 440px;
    width: 100%;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
}

.app-confirm-title {
    margin: 0 0 12px;
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-primary);
}

.app-confirm-message {
    margin: 0 0 20px;
    font-size: 0.95rem;
    line-height: 1.45;
    color: var(--text-secondary);
    white-space: pre-wrap;
    word-break: break-word;
}

.app-confirm-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

.app-confirm-actions .btn-secondary,
.app-confirm-actions .btn-primary,
.app-confirm-actions .btn-danger {
    min-width: 88px;
}

/* Sidebar user presence / profile hub */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.sidebar-user-presence-stack {
    margin-bottom: 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.sidebar-user-chip {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    width: 100%;
    padding: 0.5rem 0.45rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-primary);
    cursor: pointer;
    text-align: left;
    font-size: inherit;
    font-family: inherit;
    transition: filter 0.15s ease, border-color 0.15s ease;
}

.sidebar-user-chip:hover {
    filter: brightness(1.06);
    border-color: var(--accent-color);
}

.sidebar-user-chip-name {
    flex: 1;
    font-size: 0.82rem;
    font-weight: 600;
    line-height: 1.35;
    word-break: break-word;
}

.presence-dot {
    flex-shrink: 0;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-top: 3px;
    background: #43a047;
    box-shadow: 0 0 0 2px rgba(67, 160, 71, 0.25);
}

.presence-dot--away {
    background: #fdd835;
    box-shadow: 0 0 0 2px rgba(253, 216, 53, 0.35);
}

.presence-dot--dnd {
    background: #e53935;
    box-shadow: 0 0 0 2px rgba(229, 57, 53, 0.3);
}

.sidebar-presence-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.presence-select {
    flex: 1 1 120px;
    min-width: 0;
    padding: 0.45rem 0.55rem;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.78rem;
    cursor: pointer;
    transition: border-color var(--sidebar-transition), box-shadow var(--sidebar-transition);
}

.presence-select.presence-select--active {
    border-color: rgba(67, 160, 71, 0.55);
    box-shadow: inset 3px 0 0 #43a047;
}

.presence-select.presence-select--away {
    border-color: rgba(253, 216, 53, 0.45);
    box-shadow: inset 3px 0 0 #fdd835;
}

.presence-select.presence-select--dnd {
    border-color: rgba(229, 57, 53, 0.5);
    box-shadow: inset 3px 0 0 #e53935;
}

.presence-online-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 0.45rem 0.65rem;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: rgba(102, 126, 234, 0.12);
    font-size: 0.74rem;
    color: var(--text-secondary);
    cursor: pointer;
    font-family: inherit;
    flex: 0 0 auto;
    transition: filter 0.15s ease;
}

.presence-online-badge:hover {
    filter: brightness(1.06);
}

.presence-online-led {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #43a047;
    flex-shrink: 0;
}

.presence-online-count {
    font-weight: 700;
    color: var(--text-primary);
}

html.sidebar-narrow .presence-online-label {
    display: none;
}

html.sidebar-narrow .sidebar-user-presence-stack {
    width: 100%;
    align-items: stretch;
    margin-bottom: 0.5rem;
    gap: 0.35rem;
}

html.sidebar-narrow .sidebar-user-chip {
    justify-content: center;
    align-items: center;
    padding: 0.55rem;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

html.sidebar-narrow .sidebar-user-chip-name {
    display: none;
}

html.sidebar-narrow .presence-dot {
    margin-top: 0;
}

html.sidebar-narrow .sidebar-presence-toolbar {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    gap: 0.35rem;
    flex-wrap: nowrap;
}

html.sidebar-narrow .presence-select {
    width: 100%;
    flex: none;
    font-size: 0.58rem;
    padding: 0.38rem 0.15rem;
    text-align: center;
    text-align-last: center;
    line-height: 1.2;
}

html.sidebar-narrow .presence-online-badge {
    width: 100%;
    justify-content: center;
    padding: 0.45rem 0.25rem;
    box-sizing: border-box;
}

html.sidebar-narrow .sidebar-footer {
    padding-top: 1rem;
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

.profile-hub-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1200;
    background: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
    padding: 18px;
    box-sizing: border-box;
}

.profile-hub-overlay.is-open {
    display: flex;
}

.profile-hub-dialog {
    background: var(--card-bg);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    max-width: min(96vw, 960px);
    width: 100%;
    max-height: min(94vh, 900px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.5);
}

.profile-hub-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border-color);
    padding: 0 12px;
    flex-shrink: 0;
}

.profile-hub-tab {
    flex: 1;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.88rem;
    font-weight: 600;
    padding: 12px 14px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    font-family: inherit;
}

.profile-hub-tab:hover {
    color: var(--text-primary);
}

.profile-hub-tab--active {
    color: var(--accent-color);
    border-bottom-color: var(--accent-color);
}

.profile-hub-pane {
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.profile-hub-pane--hidden {
    display: none !important;
}

.hub-inbox-root {
    display: grid;
    grid-template-columns: minmax(120px, 34%) 1fr;
    gap: 0;
    min-height: min(520px, 62vh);
    border-top: 1px solid var(--border-color);
}

.hub-thread-sidebar {
    border-right: 1px solid var(--border-color);
    background: var(--bg-secondary);
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.hub-thread-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    text-align: left;
    padding: 10px 12px;
    border: none;
    border-bottom: 1px solid var(--border-color);
    background: transparent;
    color: inherit;
    font-size: 0.86rem;
    cursor: pointer;
    font-family: inherit;
}

.hub-thread-item:hover {
    background: var(--bg-tertiary);
}

.hub-thread-item.is-selected {
    background: rgba(102, 126, 234, 0.12);
}

.hub-thread-item-label {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hub-thread-unread {
    flex-shrink: 0;
    min-width: 1.35rem;
    height: 1.35rem;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--accent-color);
    color: #fff;
    font-size: 0.68rem;
    font-weight: 700;
    line-height: 1.35rem;
    text-align: center;
}

.hub-thread-item--team .hub-thread-unread:not([hidden]) {
    display: inline-block;
}

.hub-thread-item .hub-thread-unread[hidden] {
    display: none !important;
}

.hub-dm-thread-list {
    list-style: none;
    margin: 0;
    padding: 0;
    overflow-y: auto;
    flex: 1;
    max-height: 300px;
}

.hub-dm-thread-list button {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    padding: 8px 12px;
    border: none;
    border-bottom: 1px solid var(--border-color);
    background: transparent;
    color: inherit;
    cursor: pointer;
    text-align: left;
    font-family: inherit;
    font-size: 0.84rem;
}

.hub-dm-thread-list button:hover {
    background: var(--bg-tertiary);
}

.hub-dm-thread-list button.is-selected {
    background: rgba(102, 126, 234, 0.12);
}

.hub-dm-snippet {
    display: block;
    font-size: 0.72rem;
    color: var(--text-secondary);
    margin-top: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.hub-start-dm {
    padding: 10px 12px;
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
}

.hub-start-dm-label {
    display: block;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
    margin-bottom: 6px;
    font-weight: 600;
}

.hub-dm-peer-select {
    width: 100%;
    padding: 8px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.84rem;
    font-family: inherit;
}

.hub-conversation-pane {
    padding: 12px 16px 16px;
    display: flex;
    flex-direction: column;
    min-height: 0;
    min-width: 0;
    overflow: visible;
}

.hub-conversation-heading {
    font-size: 0.92rem;
    font-weight: 700;
    margin: 0 0 4px;
}

.hub-conversation-sub {
    margin: 0 0 10px !important;
    font-size: 0.82rem !important;
    min-height: 2.75em;
    line-height: 1.35;
}

.hub-conversation-heading-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 4px;
}

.hub-conversation-heading-main {
    min-width: 0;
    flex: 1;
}

.hub-conversation-heading-main .hub-conversation-heading {
    margin-bottom: 2px;
}

.hub-delete-thread-btn {
    flex-shrink: 0;
    align-self: flex-start;
    padding: 4px 10px;
    font-size: 0.78rem;
    font-weight: 600;
    font-family: inherit;
    border-radius: 8px;
    border: 1px solid rgba(229, 57, 53, 0.45);
    background: transparent;
    color: #e53935;
    cursor: pointer;
    line-height: 1.35;
}

.hub-delete-thread-btn:hover {
    background: rgba(229, 57, 53, 0.12);
}

[data-theme="light"] .hub-delete-thread-btn {
    border-color: rgba(229, 57, 53, 0.5);
}

.hub-clear-team-btn {
    flex-shrink: 0;
    align-self: flex-start;
    padding: 4px 10px;
    font-size: 0.78rem;
    font-weight: 600;
    font-family: inherit;
    border-radius: 8px;
    border: 1px solid rgba(229, 57, 53, 0.45);
    background: transparent;
    color: #e53935;
    cursor: pointer;
    line-height: 1.35;
}

.hub-clear-team-btn:hover {
    background: rgba(229, 57, 53, 0.12);
}

[data-theme="light"] .hub-clear-team-btn {
    border-color: rgba(229, 57, 53, 0.5);
}

.hub-msg-ctx-menu {
    position: fixed;
    z-index: 13000;
    min-width: 148px;
    padding: 4px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}

.hub-msg-ctx-menu[hidden] {
    display: none !important;
}

.hub-msg-ctx-menu__btn {
    display: block;
    width: 100%;
    margin: 0;
    padding: 8px 12px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.86rem;
    text-align: left;
    cursor: pointer;
}

.hub-msg-ctx-menu__btn:hover {
    background: var(--bg-tertiary);
}

.hub-msg-ctx-menu__btn--del {
    color: #e57373;
}

.hub-msg-ctx-menu__btn--del:hover {
    background: rgba(229, 57, 53, 0.12);
    color: #e53935;
}

.team-chat-msg[data-msg-context] .team-chat-bubble {
    cursor: context-menu;
}

.team-chat-msg--mine:not([data-msg-context]) .team-chat-bubble {
    cursor: default;
}

.team-chat-msg--deleted .team-chat-bubble {
    opacity: 0.72;
    font-style: italic;
}

.msg-inline-edit-bar {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
    margin-top: 8px;
    width: 100%;
}

.team-chat-msg-editor {
    margin-top: 4px;
    min-height: 4.5rem;
}

.hub-conversation-pane .team-chat-feed {
    /* Fixed viewport height so switching Team ↔ DM threads does not resize the pane */
    --hub-chat-feed-h: min(440px, 52vh);
    flex: 0 0 var(--hub-chat-feed-h);
    height: var(--hub-chat-feed-h);
    min-height: var(--hub-chat-feed-h);
    max-height: var(--hub-chat-feed-h);
    margin-bottom: 10px !important;
    scroll-behavior: auto;
}

.hub-feed-hidden {
    display: none !important;
}

.messaging-unread-fab {
    position: fixed;
    right: max(14px, env(safe-area-inset-right));
    bottom: max(14px, env(safe-area-inset-bottom));
    z-index: 1100;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border-radius: 999px;
    border: none;
    cursor: pointer;
    font-size: 0.88rem;
    font-weight: 600;
    font-family: inherit;
    color: #fff;
    background: linear-gradient(135deg, #10b981 0%, #059669 48%, #64748b 100%);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}

.messaging-unread-fab:hover {
    filter: brightness(1.06);
}

.messaging-unread-fab-badge {
    min-width: 1.35rem;
    height: 1.35rem;
    padding: 0 6px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.25);
    font-size: 0.75rem;
    line-height: 1.35rem;
}

.messaging-unread-fab-badge:not([hidden]) {
    display: inline-block;
}

@keyframes messaging-unread-soft-pulse {
    0%,
    100% {
        opacity: 1;
        filter: brightness(1);
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
    }
    50% {
        opacity: 0.88;
        filter: brightness(1.08);
        box-shadow: 0 10px 38px rgba(102, 126, 234, 0.5);
    }
}

.messaging-unread-fab.messaging-unread-fab--attention {
    animation: messaging-unread-soft-pulse 1.85s ease-in-out infinite;
}

.messaging-unread-fab.messaging-unread-fab--attention:hover {
    animation-play-state: paused;
}

@keyframes messaging-unread-tab-pulse {
    0%,
    100% {
        opacity: 1;
    }
    50% {
        opacity: 0.55;
    }
}

.profile-hub-tab.messaging-unread-tab-pulse {
    animation: messaging-unread-tab-pulse 1.85s ease-in-out infinite;
    box-shadow: inset 0 -2px 0 0 var(--accent-color);
}

@media (prefers-reduced-motion: reduce) {
    .messaging-unread-fab.messaging-unread-fab--attention,
    .profile-hub-tab.messaging-unread-tab-pulse {
        animation: none !important;
    }

    .profile-hub-tab.messaging-unread-tab-pulse {
        box-shadow: none;
    }
}

@media screen and (max-width: 520px) {
    .hub-inbox-root {
        grid-template-columns: 1fr;
        min-height: 360px;
    }

    .hub-conversation-pane .team-chat-feed {
        --hub-chat-feed-h: min(320px, 46vh);
    }

    .hub-thread-sidebar {
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        max-height: 200px;
    }

    .profile-hub-dialog {
        max-height: min(96vh, 920px);
    }
}

.profile-hub-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border-color);
}

.profile-hub-title {
    margin: 0;
    font-size: 1.12rem;
    font-weight: 700;
    line-height: 1.3;
    word-break: break-word;
}

.profile-hub-close {
    flex-shrink: 0;
    min-width: 40px;
    padding: 0.25rem 0.65rem !important;
    font-size: 1.35rem !important;
    line-height: 1 !important;
}

.profile-hub-section {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.profile-hub-section:last-child {
    border-bottom: none;
}

.profile-hub-h3 {
    margin: 0 0 10px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
}

.profile-hub-status-readout {
    margin: 0 0 8px;
    font-size: 1rem;
    font-weight: 600;
}

.profile-hub-meta {
    margin: 0;
    font-size: 0.88rem;
}

.profile-hub-online-list {
    margin: 0;
    padding: 0;
    list-style: none;
    max-height: 220px;
    overflow: auto;
}

.profile-hub-online-list li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.92rem;
}

.profile-hub-online-list li:last-child {
    border-bottom: none;
}

.profile-hub-bullet {
    margin: 0;
    padding-left: 18px;
    color: var(--text-secondary);
    font-size: 0.92rem;
    line-height: 1.55;
}

.profile-hub-coming .profile-hub-bullet strong {
    color: var(--text-primary);
}

.profile-hub-h4 {
    margin: 14px 0 8px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.profile-hub-settings-link {
    color: var(--accent-color);
    text-decoration: none;
}

.profile-hub-settings-link:hover {
    text-decoration: underline;
}

.time-off-cal-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.time-off-month-label {
    font-weight: 600;
    font-size: 0.95rem;
}

.time-off-nav-btn {
    padding: 6px 12px !important;
    font-size: 0.85rem !important;
}

.time-off-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    margin-bottom: 4px;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-secondary);
    text-align: center;
}

.time-off-cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    margin-bottom: 12px;
}

.time-off-cell {
    position: relative;
    min-height: 40px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    cursor: pointer;
    font: inherit;
    padding: 4px 2px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
}

.time-off-cell--empty {
    border-color: transparent;
    background: transparent;
    pointer-events: none;
    cursor: default;
}

.time-off-cell--busy {
    background: rgba(102, 126, 234, 0.12);
}

.time-off-cell--mine {
    box-shadow: inset 0 0 0 2px rgba(102, 126, 234, 0.55);
}

.time-off-cell--pending {
    box-shadow: inset 0 0 0 2px rgba(253, 216, 53, 0.85);
}

.time-off-cell--birthday {
    background: rgba(236, 72, 153, 0.08);
}

.time-off-cell-marks {
    display: flex;
    align-items: center;
    gap: 2px;
    margin-top: 2px;
    line-height: 1;
}

.time-off-cell-cake {
    font-size: 0.65rem;
    line-height: 1;
}

.time-off-admin-pending {
    margin-bottom: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
}

.time-off-admin-pending-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.time-off-admin-pending-li {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.84rem;
}

.time-off-admin-pending-li:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.time-off-admin-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.time-off-approve-btn,
.time-off-reject-btn {
    padding: 4px 10px;
    font-size: 0.72rem;
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
}

.time-off-approve-btn {
    border: 1px solid rgba(67, 160, 71, 0.55);
    background: rgba(67, 160, 71, 0.12);
    color: #2e7d32;
}

.time-off-reject-btn {
    border: 1px solid rgba(229, 57, 53, 0.45);
    background: transparent;
    color: #e53935;
}

.time-off-entry-status {
    font-style: italic;
    color: var(--text-secondary);
    font-size: 0.92em;
}

.time-off-cell-num {
    font-size: 0.8rem;
    font-weight: 600;
}

.time-off-cell-dots {
    font-size: 0.55rem;
    line-height: 1;
    color: var(--accent-color);
}

.time-off-legend-hint {
    font-size: 0.82rem;
    min-height: 2.5em;
    margin: 0 0 12px;
}

.time-off-book-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 8px;
}

.time-off-book-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.time-off-book-label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.time-off-book-label input[type="date"],
.time-off-book-label input[type="text"] {
    font: inherit;
    padding: 8px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    color: var(--text-primary);
}

.time-off-book-note input {
    width: 100%;
    max-width: 320px;
    box-sizing: border-box;
}

.time-off-book-submit {
    align-self: flex-start;
}

.time-off-entry-list {
    margin: 0;
    padding: 0;
    list-style: none;
    max-height: 200px;
    overflow-y: auto;
    font-size: 0.86rem;
}

.time-off-entry-list li {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
}

.time-off-entry-list li:last-child {
    border-bottom: none;
}

.time-off-del-btn {
    flex-shrink: 0;
    padding: 4px 8px;
    font-size: 0.72rem;
    border-radius: 6px;
    border: 1px solid rgba(229, 57, 53, 0.45);
    background: transparent;
    color: #e53935;
    cursor: pointer;
    font-family: inherit;
}

.time-off-del-btn:hover {
    background: rgba(229, 57, 53, 0.1);
}

.presence-dot-mini {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    flex-shrink: 0;
    background: #43a047;
}

.presence-dot-mini--away {
    background: #fdd835;
}

.presence-dot-mini--dnd {
    background: #e53935;
}

.profile-hub-chat-hint {
    margin: -4px 0 12px;
    font-size: 0.88rem;
    line-height: 1.4;
}

.team-chat-feed {
    max-height: min(280px, 36vh);
    overflow-x: hidden;
    overflow-y: auto;
    padding: 10px;
    margin: 0 0 12px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-secondary);
    scroll-behavior: smooth;
}

.team-chat-msg {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    margin-bottom: 14px;
    max-width: 100%;
}

.team-chat-msg:last-child {
    margin-bottom: 2px;
}

.team-chat-msg--mine .team-chat-meta {
    align-self: flex-end;
    text-align: right;
}

.team-chat-meta {
    font-size: 0.72rem;
    color: var(--text-secondary);
    padding: 0 4px;
    line-height: 1.2;
    align-self: flex-start;
}

.team-chat-msg-body-slot {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    display: flex;
    justify-content: flex-start;
}

.team-chat-msg--mine .team-chat-msg-body-slot {
    justify-content: flex-end;
}

.team-chat-bubble {
    box-sizing: border-box;
    max-width: min(92%, 100%);
    padding: 8px 12px;
    border-radius: 12px;
    font-size: 0.93rem;
    line-height: 1.45;
    white-space: pre-wrap;
    word-break: normal;
    overflow-wrap: break-word;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
}

.team-chat-msg--mine .team-chat-bubble {
    background: rgba(102, 126, 234, 0.18);
    border-color: rgba(102, 126, 234, 0.45);
}

.team-chat-msg-text + .team-chat-msg-images,
.team-chat-msg-text + .team-chat-msg-files {
    margin-top: 8px;
}

.team-chat-msg-images + .team-chat-msg-files {
    margin-top: 8px;
}

.team-chat-msg-files {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.team-chat-msg-file {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.86rem;
    line-height: 1.3;
    max-width: 100%;
}

.team-chat-msg-file:hover {
    border-color: var(--accent-color);
    background: var(--bg-primary);
}

.team-chat-msg-file--missing {
    color: var(--text-secondary);
    font-style: italic;
    border-style: dashed;
}

.team-chat-msg-file__icon {
    flex-shrink: 0;
    font-size: 1.1rem;
    line-height: 1;
}

.team-chat-msg-file__body {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.team-chat-msg-file__name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
}

.team-chat-msg-file__size {
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.hub-attach-preview__item--file {
    width: auto;
    min-width: 72px;
    max-width: 140px;
    height: 72px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 6px;
    background: var(--bg-secondary);
}

.hub-attach-preview__icon {
    font-size: 1.25rem;
    line-height: 1;
}

.hub-attach-preview__name {
    font-size: 0.68rem;
    line-height: 1.2;
    text-align: center;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    word-break: break-all;
    color: var(--text-secondary);
}

.team-chat-msg-images {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
    gap: 6px;
}

.team-chat-msg-image-btn {
    display: block;
    width: 100%;
    padding: 0;
    margin: 0;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    overflow: hidden;
    background: var(--bg-secondary);
    cursor: zoom-in;
    line-height: 0;
}

.team-chat-msg-image-btn img {
    display: block;
    width: 100%;
    max-height: 180px;
    object-fit: cover;
}

.team-chat-msg-image-btn--missing {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 72px;
    padding: 8px;
    cursor: default;
    color: var(--text-secondary);
    font-size: 0.78rem;
    line-height: 1.25;
    text-align: center;
    background: var(--bg-secondary);
}

.team-chat-composer-stack--dragover {
    outline: 2px dashed var(--accent-color);
    outline-offset: 4px;
    border-radius: 12px;
}

.hub-attach-btn {
    flex-shrink: 0;
    width: 44px;
    min-height: 44px;
    align-self: stretch;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 1.15rem;
    line-height: 1;
    cursor: pointer;
    font-family: inherit;
}

.hub-attach-btn:hover {
    border-color: var(--accent-color);
    background: var(--bg-primary);
}

.hub-attach-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.hub-attach-preview[hidden] {
    display: none !important;
}

.hub-attach-preview__item {
    position: relative;
    width: 72px;
    height: 72px;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.hub-attach-preview__item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.hub-attach-preview__remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    border: none;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.65);
    color: #fff;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    padding: 0;
}

.hub-image-lightbox {
    position: fixed;
    inset: 0;
    z-index: 1400;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.hub-image-lightbox[hidden] {
    display: none !important;
}

.hub-image-lightbox__backdrop {
    position: absolute;
    inset: 0;
    border: 0;
    padding: 0;
    background: rgba(0, 0, 0, 0.82);
    cursor: zoom-out;
}

.hub-image-lightbox__panel {
    position: relative;
    z-index: 1;
    max-width: min(96vw, 1200px);
    max-height: 92vh;
}

.hub-image-lightbox__img {
    display: block;
    max-width: min(96vw, 1200px);
    max-height: 92vh;
    width: auto;
    height: auto;
    border-radius: 10px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

.hub-image-lightbox__img[hidden] {
    display: none !important;
}

.hub-image-lightbox__missing {
    margin: 0;
    padding: 2rem 2.5rem;
    border-radius: 10px;
    background: var(--bg-primary);
    color: var(--text-secondary);
    font-size: 1rem;
    text-align: center;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

.hub-image-lightbox__missing[hidden] {
    display: none !important;
}

.hub-image-lightbox__close {
    position: absolute;
    top: -12px;
    right: -12px;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.75);
    color: #fff;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    z-index: 2;
}

.team-chat-error {
    margin: 0 0 8px;
    font-size: 0.86rem;
    color: #e53935;
}

.team-chat-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.team-chat-composer-stack {
    position: relative;
    z-index: 5;
    display: flex;
    flex-direction: column;
    gap: 0;
    width: 100%;
}

.team-chat-input-row {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    width: 100%;
}

.team-chat-input--grow {
    flex: 1;
    min-width: 0;
    width: auto;
}

.hub-emoji-btn {
    flex-shrink: 0;
    width: 44px;
    height: auto;
    min-height: 44px;
    align-self: stretch;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
    font-family: inherit;
}

.hub-emoji-btn:hover {
    border-color: var(--accent-color);
    background: var(--bg-primary);
}

.hub-emoji-picker {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 100%;
    margin-bottom: 8px;
    z-index: 25;
    display: grid;
    grid-template-columns: repeat(8, minmax(0, 1fr));
    gap: 4px;
    padding: 10px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    max-height: min(200px, 38vh);
    overflow-y: auto;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.12);
}

.hub-emoji-picker[hidden] {
    display: none !important;
}

.hub-emoji-picker__choice {
    margin: 0;
    padding: 6px 4px;
    border: none;
    border-radius: 6px;
    background: transparent;
    font-size: 1.35rem;
    line-height: 1.2;
    cursor: pointer;
    font-family: inherit;
}

.hub-emoji-picker__choice:hover {
    background: rgba(102, 126, 234, 0.15);
}

.team-chat-input {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.92rem;
    resize: vertical;
    min-height: 44px;
}

.team-chat-input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}

.team-chat-send {
    align-self: flex-end;
}

.team-chat-hint-keys {
    margin: 8px 0 0;
    font-size: 0.78rem;
}

/* Carrier / broker management: segmented tabs (shared across pages) */
.carrier-page-tabs {
    display: flex;
    gap: 0;
    flex-wrap: wrap;
    padding: 0.28rem;
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    max-width: 28rem;
}

.carrier-page-tab {
    flex: 1;
    min-width: 140px;
    padding: 0.55rem 0.85rem;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.93rem;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.2s ease, color 0.2s ease;
}

.carrier-page-tab:hover {
    color: var(--text-primary);
    background: var(--nav-hover);
}

.carrier-page-tab.carrier-page-tab--active {
    background: var(--nav-active);
    color: #ffffff;
}

.carrier-page-tab.carrier-page-tab--active:hover {
    background: var(--accent-hover);
    color: #ffffff;
}

/* Carriers list: row actions (global .btn-primary is width: 100%) */
#carriers-table .carrier-table-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
}

#carriers-table .carrier-table-actions .btn-small {
    width: auto;
    flex: 0 0 auto;
    white-space: nowrap;
    padding: 0.35rem 0.7rem;
    font-size: 0.8rem;
    line-height: 1.2;
}

#carriers-table .carrier-table-actions .btn-small.btn-danger,
#carriers-table .carrier-table-actions .btn-small.btn-secondary {
    margin-left: 0;
}

#carriers-table .carrier-packet-upload-label.btn-small {
    width: auto;
    display: inline-block;
    margin: 0;
}

/* Modal shell used by carriers + brokers forms */
.carrier-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.4);
}

.carrier-modal-content {
    background-color: var(--card-bg, #fff);
    margin: 5% auto;
    padding: 20px;
    border: 1px solid var(--border-color, #ddd);
    border-radius: 8px;
    width: 90%;
    max-width: 800px;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
}

.carrier-modal-close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    position: absolute;
    right: 15px;
    top: 15px;
}

.carrier-modal-close:hover,
.carrier-modal-close:focus {
    color: var(--text-primary, #000);
}

.carrier-modal-content h3 {
    margin-top: 0;
    margin-bottom: 20px;
}

.top-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

/* AI Assistant panel */
.assistant-root {
    position: relative;
    display: inline-flex;
}

/* No flash on full page navigation while assistant.js boots */
.assistant-root--boot .assistant-toggle,
.assistant-root--boot .assistant-panel {
    transition: none !important;
}

.assistant-root--unavailable .assistant-send {
    opacity: 0.55;
}

.assistant-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid var(--border-color);
    border-radius: 50%;
    background: var(--bg-secondary);
    color: var(--accent-color, #10b981);
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.assistant-toggle:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent-color);
}

.assistant-toggle[aria-expanded="true"] {
    background: color-mix(in srgb, var(--accent-color, #10b981) 18%, var(--bg-secondary));
    border-color: var(--accent-color);
}

.assistant-panel {
    position: fixed;
    top: 72px;
    right: max(16px, env(safe-area-inset-right));
    width: min(380px, calc(100vw - 32px));
    max-height: min(520px, calc(100vh - 96px));
    display: none;
    flex-direction: column;
    background: var(--card-bg, var(--bg-primary));
    border: 1px solid var(--border-color);
    border-radius: 14px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
    overflow: hidden;
    z-index: 1200;
}

.assistant-panel.assistant-panel--open {
    display: flex;
}

.assistant-panel[hidden] {
    display: none !important;
}

.assistant-panel-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.assistant-panel-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.assistant-clear {
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.72rem;
    padding: 4px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
}

.assistant-clear:hover {
    color: var(--accent-color);
    border-color: var(--accent-color);
}

.assistant-panel-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.assistant-panel-sub {
    margin: 4px 0 0;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.assistant-close {
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
}

.assistant-close:hover {
    color: var(--text-primary);
}

.assistant-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-color);
}

.assistant-suggestion {
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 0.72rem;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
}

.assistant-suggestion:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
}

.assistant-feed {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 160px;
}

.assistant-msg {
    display: flex;
}

.assistant-msg--user {
    justify-content: flex-end;
}

.assistant-msg--assistant {
    justify-content: flex-start;
}

.assistant-msg-bubble {
    max-width: 92%;
    padding: 10px 12px;
    border-radius: 12px;
    line-height: 1.45;
    white-space: pre-wrap;
    word-break: break-word;
}

.assistant-msg--user .assistant-msg-bubble {
    background: var(--accent-color, #10b981);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.assistant-msg--assistant .assistant-msg-bubble {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-bottom-left-radius: 4px;
}

.assistant-link {
    color: var(--accent-color, #10b981);
    text-decoration: underline;
    word-break: break-all;
}

.assistant-link:hover {
    opacity: 0.85;
}

.assistant-typing {
    display: none;
    gap: 4px;
    padding: 0 16px 8px;
}

.assistant-typing.assistant-typing--visible {
    display: flex;
}

.assistant-typing[hidden] {
    display: none !important;
}

.assistant-typing-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-secondary);
    animation: assistantTyping 1.2s infinite ease-in-out;
}

.assistant-typing-dot:nth-child(2) { animation-delay: 0.15s; }
.assistant-typing-dot:nth-child(3) { animation-delay: 0.3s; }

@keyframes assistantTyping {
    0%, 80%, 100% { opacity: 0.3; transform: scale(0.85); }
    40% { opacity: 1; transform: scale(1); }
}

.assistant-composer {
    display: flex;
    gap: 8px;
    padding: 10px 12px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
    align-items: flex-end;
}

.assistant-input {
    flex: 1;
    resize: none;
    padding: 8px 10px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.875rem;
}

.assistant-input:focus {
    outline: none;
    border-color: var(--accent-color);
}

.assistant-input:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.assistant-send:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.assistant-send {
    flex-shrink: 0;
    padding: 8px 14px !important;
    font-size: 0.875rem !important;
    min-height: auto !important;
    width: auto !important;
}

@media (max-width: 480px) {
    .assistant-panel {
        top: 64px;
        right: 8px;
        width: calc(100vw - 16px);
    }
}

/* Toast notifications (global showToast) */
#toast-container {
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 30000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.app-toast {
    min-width: 220px;
    max-width: 360px;
    padding: 10px 14px;
    border-radius: 8px;
    background: var(--bg-primary, #fff);
    color: var(--text-primary, #111);
    border: 1px solid var(--border-color, #ddd);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.25s ease, transform 0.25s ease;
    pointer-events: auto;
}

.app-toast--visible {
    opacity: 1;
    transform: translateY(0);
}

.app-toast--error {
    border-color: #ef4444;
    background: color-mix(in srgb, #ef4444 12%, var(--bg-primary, #fff));
}

.app-toast--success {
    border-color: var(--accent-color, #10b981);
}

/* ======================================================================
   UI polish (2026-11-18)
   ====================================================================== */

/* Mobile: never let a wide table stretch the whole page.
   Flex children default to min-width:auto, so the content column grew to the
   table's width (up to 1200px on a 390px phone). Tables scroll inside their card instead. */
.content-wrapper,
.main-content,
.page-content {
    min-width: 0;
}
.main-content .card {
    max-width: 100%;
}
/* Same issue inside CSS grids (1fr = minmax(auto, 1fr) grows to the widest table) */
.cp-layout > *,
.dp-layout > *,
.cards-grid > * {
    min-width: 0;
}

/* Page header: title on the left, main action on the right */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}
.btn-primary.btn-header {
    width: auto;
    padding: 10px 18px;
    font-size: 15px;
    font-weight: 600;
    border-radius: 8px;
    white-space: nowrap;
}

/* Row actions inside tables: quiet outline buttons instead of solid green/red blocks.
   Delete stays clearly red, but only fills on hover. */
.main-content td :is(.btn-small, .btn-primary, .btn-secondary, .btn-danger, .btn) {
    width: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-height: 28px;
    padding: 3px 10px !important;
    margin: 2px 4px 2px 0 !important;
    font-size: 12.5px !important;
    font-weight: 600;
    line-height: 1.3;
    border-radius: 6px;
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    box-shadow: none;
    white-space: nowrap;
    transition: background-color .15s, border-color .15s, color .15s;
}
.main-content td :is(.btn-small, .btn-primary, .btn-secondary, .btn):hover:not(:disabled):not(.btn-danger) {
    background: color-mix(in srgb, var(--accent-color) 12%, transparent);
    border-color: var(--accent-color);
    color: var(--accent-color);
}
.main-content td .btn-danger {
    color: #f87171;
    border-color: rgba(239, 68, 68, 0.35);
}
.main-content td .btn-danger:hover:not(:disabled) {
    background: #dc2626;
    border-color: #dc2626;
    color: #fff;
}
[data-theme="light"] .main-content td .btn-danger {
    color: #b91c1c;
    border-color: rgba(185, 28, 28, 0.35);
}
[data-theme="light"] .main-content td .btn-danger:hover:not(:disabled) {
    color: #fff;
}
.main-content td :is(.btn-small, .btn-primary, .btn-secondary, .btn-danger, .btn):disabled {
    opacity: .45;
    background: transparent;
}

/* Tables: steadier rows, readable header, subtle hover */
.main-content table tbody tr {
    transition: background-color .12s;
}
.main-content table tbody tr:hover {
    background: color-mix(in srgb, var(--text-primary) 3.5%, transparent);
}

/* Header clocks on phones: keep only the ET (server) clock so the top bar stays one line */
@media (max-width: 600px) {
    .time-display-container { gap: 0.5rem; flex-wrap: nowrap; }
    .time-display-container .time-item:not(.server-time) { display: none; }
}

/* Denser data tables: smaller header labels, tighter cells */
.main-content .loads-table th {
    font-size: 0.8rem;
    letter-spacing: 0.01em;
    padding: 0.6rem 0.55rem;
    vertical-align: bottom;
}
.main-content .loads-table td {
    padding: 0.6rem 0.55rem;
}
/* Loads: keep the Actions column visible while the table scrolls sideways */
#loads-table th:last-child,
#loads-table td:last-child {
    position: sticky;
    right: 0;
    z-index: 1;
    background: var(--card-bg);
    box-shadow: -8px 0 8px -8px rgba(0, 0, 0, 0.45);
}
#loads-table th:last-child {
    background: var(--bg-secondary);
}

/* Loads rows: compact driver cell + actions in one row */
.load-driver-name { display: block; color: var(--text-primary); }
.load-driver-phone { display: block; font-size: 12px; white-space: nowrap; color: var(--text-secondary); }
.main-content .loads-actions-cell {
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 4px;
}
.main-content .loads-actions-cell :is(.btn-small, .btn-danger) { margin: 0 !important; }

/* ---------- Rate confirmation → AI prefill (Create Load) ---------- */
.rc-panel { margin: 4px 0 18px; }
.rc-panel[hidden] { display: none; }
.rc-drop {
    display: flex; align-items: center; gap: 12px; cursor: pointer;
    padding: 14px 16px; border-radius: 10px;
    border: 1.5px dashed color-mix(in srgb, var(--accent-color) 55%, var(--border-color));
    background: color-mix(in srgb, var(--accent-color) 6%, transparent);
    color: var(--text-primary); line-height: 1.35;
    transition: background-color .15s, border-color .15s;
}
.rc-drop:hover, .rc-drop:focus-visible, .rc-panel.is-drag .rc-drop {
    border-color: var(--accent-color);
    background: color-mix(in srgb, var(--accent-color) 13%, transparent);
    outline: none;
}
.rc-drop-icon {
    flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px;
    background: color-mix(in srgb, var(--accent-color) 18%, transparent); color: var(--accent-color);
}
.rc-sub { display: block; font-size: 12px; color: var(--text-secondary); font-weight: 400; margin-top: 2px; }
.rc-panel[data-view="busy"] .rc-drop,
.rc-panel[data-view="done"] .rc-drop { display: none; }
.rc-body:empty { display: none; }
.rc-body {
    margin-top: 10px; padding: 12px 14px; border-radius: 10px; font-size: 13.5px;
    border: 1px solid var(--border-color); background: var(--bg-secondary); color: var(--text-primary);
}
.rc-panel[data-view="error"] .rc-body {
    border-color: rgba(239, 68, 68, .45); background: rgba(239, 68, 68, .08);
}
.rc-busy { display: flex; align-items: center; gap: 12px; }
.rc-spinner {
    flex: none; width: 22px; height: 22px; border-radius: 50%;
    border: 2.5px solid color-mix(in srgb, var(--accent-color) 25%, transparent);
    border-top-color: var(--accent-color); animation: rc-spin .8s linear infinite;
}
@keyframes rc-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .rc-spinner { animation-duration: 2.4s; } }
.rc-head { display: flex; align-items: flex-start; gap: 10px; }
.rc-badge {
    flex: none; font-size: 11px; font-weight: 800; letter-spacing: .05em; padding: 3px 7px; border-radius: 6px;
    background: var(--accent-color); color: #fff;
}
.rc-right { margin-left: auto; white-space: nowrap; }
.rc-link {
    background: none; border: 0; padding: 0; font: inherit; font-weight: 600; cursor: pointer;
    color: var(--accent-color); text-decoration: underline; text-underline-offset: 2px;
}
.rc-note { margin-top: 10px; padding: 8px 10px; border-radius: 8px; border-left: 3px solid; }
.rc-note--warn { border-color: #f59e0b; background: rgba(245, 158, 11, .10); }
.rc-note--info { border-color: #3b82f6; background: rgba(59, 130, 246, .10); }
.rc-missing { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.rc-missing > span:first-child { font-weight: 700; margin-right: 2px; }
.rc-chip {
    font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 999px;
    border: 1px solid rgba(239, 68, 68, .45); color: #f87171; background: rgba(239, 68, 68, .08);
}
[data-theme="light"] .rc-chip { color: #b91c1c; }
.rc-ready { margin-top: 10px; color: var(--accent-color); }
.rc-stops { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; }
.rc-stops li { display: flex; gap: 8px; align-items: flex-start; }
.rc-stop-type {
    flex: none; font-size: 10.5px; font-weight: 800; padding: 2px 6px; border-radius: 5px; margin-top: 1px;
}
.rc-pickup { background: rgba(245, 158, 11, .18); color: #f59e0b; }
.rc-delivery { background: rgba(167, 139, 250, .2); color: #a78bfa; }
[data-theme="light"] .rc-pickup { color: #b45309; }
[data-theme="light"] .rc-delivery { color: #7c3aed; }
.rc-facts {
    margin: 10px 0 0; display: grid; grid-template-columns: max-content 1fr; gap: 3px 12px; font-size: 12.5px;
}
.rc-facts dt { color: var(--text-secondary); }
.rc-facts dd { margin: 0; overflow-wrap: anywhere; }
.rc-attach { margin-top: 12px; font-size: 13px; color: var(--text-secondary); }
.rc-attach b { color: var(--text-primary); }
/* Loads → Docs column: attach a rate confirmation by hand */
.doc-add-rc {
    font: inherit; font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 6px; cursor: pointer;
    background: transparent; color: var(--accent-color);
    border: 1px dashed color-mix(in srgb, var(--accent-color) 55%, transparent);
}
.doc-add-rc:hover { background: color-mix(in srgb, var(--accent-color) 12%, transparent); border-style: solid; }
.doc-add-rc:disabled { opacity: .6; cursor: progress; }

/* Fields filled by AI: subtle accent ring until the user edits them */
#loadForm .ai-filled input:not([type="hidden"]),
#loadForm .ai-filled .custom-select-trigger,
#loadForm .ai-filled .route-stop-city {
    border-color: var(--accent-color) !important;
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent-color) 22%, transparent);
}
#loadForm .ai-filled > label::after {
    content: "AI"; margin-left: 6px; font-size: 10px; font-weight: 800; letter-spacing: .05em;
    padding: 1px 5px; border-radius: 4px; vertical-align: 1px;
    background: color-mix(in srgb, var(--accent-color) 20%, transparent); color: var(--accent-color);
}

/* Secondary destructive action (e.g. "Delete logs…"): outlined, fills on hover */
.btn-outline-danger {
    width: auto; padding: 8px 14px; border-radius: 8px; font: inherit; font-size: 14px; font-weight: 600;
    background: transparent; color: #f87171; border: 1px solid rgba(239, 68, 68, .45); cursor: pointer;
    transition: background-color .15s, color .15s, border-color .15s;
}
.btn-outline-danger:hover { background: #dc2626; border-color: #dc2626; color: #fff; }
[data-theme="light"] .btn-outline-danger { color: #b91c1c; border-color: rgba(185, 28, 28, .4); }
[data-theme="light"] .btn-outline-danger:hover { color: #fff; }

/* Activity logs: day separators */
.main-content .log-day-row td {
    padding: 14px 12px 6px !important;
    font-size: 12px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
    color: var(--accent-color); background: transparent; border-bottom: 1px solid var(--border-color);
}
.main-content table tbody tr.log-day-row:hover { background: transparent; }

/* Brokers: one compact contact column */
.broker-contact { display: flex; flex-direction: column; gap: 1px; font-size: 13px; }
.broker-contact-name { color: var(--text-primary); }
.broker-contact-link { color: var(--text-secondary); text-decoration: none; }
.broker-contact-link:hover { color: var(--accent-color); text-decoration: underline; }
.broker-contact-empty { color: var(--text-secondary); opacity: .45; }

/* Loads on phones: each load becomes a card ("label: value") instead of a 15-column table */
@media (max-width: 700px) {
    #loads-table thead { display: none; }
    #loads-table, #loads-table tbody { display: block; width: 100%; }
    #loads-table tbody tr {
        display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px;
        padding: 12px; margin-bottom: 10px; border-radius: 10px;
        border: 1px solid var(--border-color); background: var(--bg-secondary);
    }
    #loads-table tbody tr:hover { background: var(--bg-secondary); }
    #loads-table tbody td {
        display: block; padding: 0 !important; border: 0 !important; min-width: 0;
        position: static !important; box-shadow: none !important; background: transparent !important;
        font-size: 13.5px; color: var(--text-primary); overflow-wrap: anywhere;
    }
    #loads-table tbody td[data-label]:not([data-label=""])::before {
        content: attr(data-label); display: block;
        font-size: 10.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
        color: var(--text-secondary); margin-bottom: 1px;
    }
    /* card header: load # + status on the first line, route full width */
    #loads-table tbody td.lc-load { order: -3; font-size: 16px; font-weight: 700; }
    #loads-table tbody td.lc-status { order: -2; justify-self: end; align-self: center; }
    #loads-table tbody td.lc-status::before { display: none !important; }
    #loads-table tbody td.lc-route { order: -1; }
    #loads-table tbody td.lc-rate { font-weight: 700; }
    #loads-table tbody td.lc-actions { grid-column: 1 / -1; padding-top: 6px !important; border-top: 1px solid var(--border-color) !important; }
    #loads-table tbody td[colspan] { grid-column: 1 / -1; }
}

/* Files: files of one load sit together; a divider separates loads */
.main-content tr.file-group-start td { border-top: 1px solid color-mix(in srgb, var(--text-primary) 18%, transparent); }
.file-group-load { font-weight: 700; color: var(--text-primary); }
.file-doc {
    display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 5px;
    margin-right: 6px; white-space: nowrap; border: 1px solid var(--border-color); color: var(--text-secondary);
}
.file-doc--rate { color: var(--accent-color); border-color: color-mix(in srgb, var(--accent-color) 45%, transparent); }
.file-doc--pod { color: #60a5fa; border-color: rgba(96, 165, 250, .45); }
[data-theme="light"] .file-doc--pod { color: #1d4ed8; border-color: rgba(29, 78, 216, .35); }
.file-base { color: var(--text-secondary); font-size: 13px; overflow-wrap: anywhere; }
