:root {
    --bg-color: #eef3f9;
    --bg-gradient: radial-gradient(circle at top left, #f8fbff 0%, #e8eef8 45%, #dbe5f3 100%);
    --text-main: #1e293b;
    --text-muted: #64748b;

    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --secondary: #f8fafc;

    --surface: rgba(255, 255, 255, 0.82);
    --surface-strong: rgba(255, 255, 255, 0.94);
    --surface-soft: rgba(255, 255, 255, 0.62);
    --surface-muted: rgba(255, 255, 255, 0.42);

    --card-bg: #ffffff;
    --input-bg: #ffffff;
    --menu-bg: rgba(255, 255, 255, 0.96);

    --border: rgba(148, 163, 184, 0.22);
    --border-strong: rgba(100, 116, 139, 0.22);
    --hover-soft: rgba(15, 23, 42, 0.06);
    --backdrop: blur(18px);

    --shadow: 0 18px 40px -18px rgba(15, 23, 42, 0.22);
    --shadow-soft: 0 8px 24px rgba(15, 23, 42, 0.08);

    --danger: #ef4444;
    --success: #10b981;
    --warning: #f59e0b;

    --chip-success-bg: rgba(16, 185, 129, 0.12);
    --chip-success-text: #059669;
    --user-card-bg: linear-gradient(135deg, rgba(79, 70, 229, 0.1), rgba(255, 255, 255, 0.65));
}

[data-theme="dark"] {
    --bg-color: #0b1220;
    --bg-gradient: radial-gradient(circle at top left, #111827 0%, #0f172a 55%, #020617 100%);
    --text-main: #e5eefb;
    --text-muted: #94a3b8;

    --primary: #818cf8;
    --primary-hover: #6366f1;
    --secondary: #162033;

    --surface: rgba(15, 23, 42, 0.78);
    --surface-strong: rgba(15, 23, 42, 0.94);
    --surface-soft: rgba(30, 41, 59, 0.78);
    --surface-muted: rgba(30, 41, 59, 0.58);

    --card-bg: #162033;
    --input-bg: #0f172a;
    --menu-bg: rgba(15, 23, 42, 0.98);

    --border: rgba(148, 163, 184, 0.14);
    --border-strong: rgba(148, 163, 184, 0.18);
    --hover-soft: rgba(148, 163, 184, 0.12);

    --shadow: 0 18px 50px -16px rgba(0, 0, 0, 0.5);
    --shadow-soft: 0 8px 24px rgba(0, 0, 0, 0.28);

    --chip-success-bg: rgba(16, 185, 129, 0.18);
    --chip-success-text: #34d399;
    --user-card-bg: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(15, 23, 42, 0.65));
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    min-height: 100vh;
    overflow: hidden;
    color: var(--text-main);
    background: var(--bg-color);
    background-image: var(--bg-gradient);
    transition: background 0.3s ease, color 0.3s ease;
}

button,
input,
textarea,
select {
    font: inherit;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: 3px solid rgba(79, 70, 229, 0.22);
    outline-offset: 2px;
}

button {
    font-family: inherit;
}

#map {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

#sidebar {
    position: absolute;
    top: 18px;
    left: 18px;
    bottom: 18px;
    width: var(--sidebar-width, 430px);
    min-width: 340px;
    max-width: min(680px, calc(100vw - 36px));
    background: var(--surface);
    backdrop-filter: var(--backdrop);
    -webkit-backdrop-filter: var(--backdrop);
    border-radius: 24px;
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.sidebar-resize-handle {
    position: absolute;
    top: 18px;
    right: 0;
    bottom: 18px;
    width: 14px;
    cursor: ew-resize;
    z-index: 6;
    touch-action: none;
}

.sidebar-resize-handle::after {
    content: "";
    position: absolute;
    top: 50%;
    right: 4px;
    width: 3px;
    height: 56px;
    border-radius: 999px;
    background: var(--border-strong);
    transform: translateY(-50%);
    opacity: 0.72;
    transition: opacity 0.18s ease, background 0.18s ease;
}

.sidebar-resize-handle:hover::after,
.is-sidebar-resizing .sidebar-resize-handle::after {
    background: var(--primary);
    opacity: 1;
}

.is-sidebar-resizing {
    cursor: ew-resize;
    user-select: none;
}

.sidebar-header {
    padding: 20px 20px 14px;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(180deg, var(--surface-strong), transparent);
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 18px;
    scrollbar-width: thin;
    scrollbar-color: var(--border-strong) transparent;
}

.sidebar-content::-webkit-scrollbar {
    width: 8px;
}

.sidebar-content::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: 999px;
}

.sidebar-footer {
    padding: 16px 18px 18px;
    border-top: 1px solid var(--border);
    background: var(--surface-soft);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.active-trip-badge {
    display: inline-flex;
    align-items: center;
    align-self: flex-start;
    max-width: 100%;
    padding: 6px 10px;
    border-radius: 999px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.active-trip-badge.active {
    color: var(--primary);
    border-color: rgba(79, 70, 229, 0.24);
    background: rgba(79, 70, 229, 0.08);
}

.trip-save-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 8px;
}

.trip-save-actions .btn {
    min-width: 0;
}

.export-itinerary-btn {
    width: 100%;
    position: relative;
    border-color: rgba(139, 92, 246, 0.62) !important;
    color: #f8fafc !important;
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.96), rgba(139, 92, 246, 0.94), rgba(20, 184, 166, 0.84)) !important;
    box-shadow: 0 14px 32px rgba(79, 70, 229, 0.28), 0 0 0 1px rgba(255, 255, 255, 0.08) inset;
    overflow: hidden;
}

.export-itinerary-btn::after {
    content: "Explorer+";
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 8px;
    padding: 2px 7px;
    border-radius: 999px;
    color: #312e81;
    background: rgba(255, 255, 255, 0.86);
    font-size: 0.68rem;
    font-weight: 900;
}

.export-itinerary-btn.locked-feature {
    color: #92400e !important;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.16), rgba(139, 92, 246, 0.14)) !important;
    box-shadow: 0 10px 24px rgba(245, 158, 11, 0.16);
}

.btn-compact {
    width: auto;
    min-width: 78px;
    padding: 8px 12px;
    font-size: 0.8rem;
}

.btn-compact.active,
.day-tools-toggle-btn.active {
    border-color: rgba(79, 70, 229, 0.34) !important;
    background: rgba(79, 70, 229, 0.1) !important;
    color: var(--primary) !important;
}

.locked-feature {
    border-color: rgba(245, 158, 11, 0.45) !important;
    background: rgba(245, 158, 11, 0.1) !important;
    color: #92400e !important;
    cursor: pointer;
}

.brand-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 16px;
}

.brand-block {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.brand-row h2 {
    margin: 0;
    font-size: 1.55rem;
    letter-spacing: -0.04em;
    font-weight: 800;
    color: var(--text-main);
}

.brand-pill {
    display: inline-flex;
    align-items: center;
    padding: 2px 7px;
    border-radius: 999px;
    font-size: 0.58em;
    color: var(--primary);
    border: 1px solid rgba(79, 70, 229, 0.25);
    margin-left: 4px;
    vertical-align: middle;
}

.brand-subtitle {
    margin: 0;
    font-size: 0.86rem;
    color: var(--text-muted);
}

.header-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    justify-content: flex-end;
    max-width: 260px;
}

.user-card {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--user-card-bg);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 12px 14px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-soft);
}

.user-avatar {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--card-bg);
    border: 1px solid var(--border);
    font-size: 1.15rem;
    flex-shrink: 0;
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-meta {
    min-width: 0;
}

.user-label {
    font-size: 0.76rem;
    color: var(--text-muted);
    margin-bottom: 2px;
}

.user-name {
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-plan-badge {
    display: inline-flex;
    width: fit-content;
    margin-top: 4px;
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(79, 70, 229, 0.1);
    color: var(--primary);
    font-size: 0.72rem;
    font-weight: 800;
}

.planner-token-card {
    display: grid;
    gap: 10px;
    margin: -4px 0 16px;
    padding: 14px;
    border: 1px solid rgba(79, 70, 229, 0.18);
    border-radius: 18px;
    background:
        linear-gradient(135deg, rgba(79, 70, 229, 0.12), rgba(20, 184, 166, 0.08)),
        var(--card-bg);
    box-shadow: var(--shadow-soft);
    transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.planner-token-head,
.planner-token-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.planner-token-head span,
.planner-token-meta {
    color: var(--text-muted);
    font-size: 0.74rem;
    font-weight: 800;
}

.planner-token-head span {
    display: block;
    margin-bottom: 3px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.planner-token-head strong {
    display: block;
    color: var(--text-main);
    font-size: 0.9rem;
    line-height: 1.25;
}

.token-upgrade-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 32px;
    padding: 0 11px;
    border: 1px solid rgba(79, 70, 229, 0.26);
    border-radius: 999px;
    color: #ffffff;
    background: linear-gradient(135deg, #4f46e5, #8b5cf6);
    box-shadow: 0 10px 22px rgba(79, 70, 229, 0.2);
    cursor: pointer;
    font-size: 0.76rem;
    font-weight: 900;
    transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}

.token-upgrade-link:hover,
.token-upgrade-link:focus-visible {
    transform: translateY(-1px);
    filter: brightness(1.04);
    box-shadow: 0 14px 28px rgba(79, 70, 229, 0.28);
    outline: none;
}

.planner-token-track {
    position: relative;
    height: 9px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.2);
}

.planner-token-track span {
    display: block;
    width: 0%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #6366f1, #14b8a6);
    box-shadow: 0 0 16px rgba(99, 102, 241, 0.3);
    transition: width 0.28s ease, background 0.2s ease;
}

.planner-token-card.token-warning {
    border-color: rgba(245, 158, 11, 0.35);
    background:
        linear-gradient(135deg, rgba(245, 158, 11, 0.16), rgba(79, 70, 229, 0.08)),
        var(--card-bg);
}

.planner-token-card.token-warning .planner-token-track span {
    background: linear-gradient(90deg, #f59e0b, #f97316);
    box-shadow: 0 0 16px rgba(245, 158, 11, 0.28);
}

.planner-token-card.token-danger {
    border-color: rgba(239, 68, 68, 0.42);
    background:
        linear-gradient(135deg, rgba(239, 68, 68, 0.16), rgba(245, 158, 11, 0.08)),
        var(--card-bg);
}

.planner-token-card.token-danger .planner-token-track span {
    background: linear-gradient(90deg, #ef4444, #f97316);
    box-shadow: 0 0 18px rgba(239, 68, 68, 0.32);
}

.planner-search.token-disabled {
    opacity: 0.78;
}

.planner-search.token-disabled .search-input-box {
    border-color: rgba(239, 68, 68, 0.26);
    background: rgba(239, 68, 68, 0.08);
}

.planner-search.token-disabled .search-input-box input {
    cursor: not-allowed;
}

.search-wrapper {
    position: relative;
}

.search-label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.search-input-box {
    background: var(--card-bg);
    border: 1px solid transparent;
    border-radius: 16px;
    display: flex;
    align-items: center;
    padding: 0 14px;
    min-height: 54px;
    box-shadow: var(--shadow-soft);
    transition: all 0.22s ease;
}

.search-input-box:focus-within {
    border-color: var(--primary);
    transform: translateY(-1px);
    box-shadow: 0 10px 24px rgba(79, 70, 229, 0.14);
}

.search-input-box .icon {
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    opacity: 0.55;
}

.search-input-box input {
    border: none;
    padding: 12px 10px;
    width: 100%;
    outline: none;
    background: transparent;
    color: var(--text-main);
    font-size: 0.98rem;
}

#searchResults {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    right: 0;
    background: var(--surface-strong);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 16px;
    padding: 8px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.18);
    z-index: 2000;
    max-height: 320px;
    overflow-y: auto;
    border: 1px solid var(--border);
    display: none;
}

.result-item {
    padding: 12px 14px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.18s ease;
    border-left: 3px solid transparent;
    color: var(--text-main);
}

.result-item+.result-item {
    margin-top: 4px;
}

.result-item:hover {
    background: var(--hover-soft);
    border-left-color: var(--primary);
    transform: translateX(2px);
}

.result-icon {
    display: none;
}

.result-copy,
.result-title,
.result-address {
    display: block;
    min-width: 0;
}

.result-title {
    font-weight: 600;
}

.result-address {
    color: #888;
    font-size: 0.8rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.floating-tabs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(86px, 1fr));
    gap: 6px;
    margin-top: 14px;
    padding: 5px;
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: 18px;
}

.floating-tab {
    border: none;
    background: transparent;
    color: var(--text-muted);
    padding: 10px 8px;
    border-radius: 13px;
    font-weight: 700;
    min-width: 0;
    cursor: pointer;
    transition: all 0.2s ease;
}

.floating-tab:hover {
    background: var(--hover-soft);
    color: var(--text-main);
}

.floating-tab.active {
    background: var(--card-bg);
    color: var(--primary);
    box-shadow: var(--shadow-soft);
}

.sidebar-panel {
    display: none;
}

.sidebar-panel.active {
    display: block;
}

.panel-card {
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 18px;
    box-shadow: var(--shadow-soft);
    margin-bottom: 18px;
    backdrop-filter: var(--backdrop);
    -webkit-backdrop-filter: var(--backdrop);
}

.trip-panel {
    display: block;
}

.panel-topline {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 14px;
}

.panel-chip {
    padding: 5px 10px;
    border-radius: 999px;
    background: rgba(79, 70, 229, 0.1);
    color: var(--primary);
    font-size: 0.72rem;
    font-weight: 700;
    white-space: nowrap;
}

.success-chip {
    background: var(--chip-success-bg);
    color: var(--chip-success-text);
}

.section-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 0 10px;
    user-select: none;
}

.static-header {
    cursor: default;
}

.section-title {
    margin: 0;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 800;
}

.section-subtitle {
    margin-top: 4px;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 14px;
}

.panel-header h4 {
    margin: 0;
    color: var(--primary);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 800;
}

.planner-helper-text {
    margin-top: 4px;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.planner-inline-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.day-navigator {
    display: flex;
    gap: 6px;
    align-items: center;
    padding-bottom: 12px;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.day-tabs-scroll {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    max-width: 280px;
    scrollbar-width: none;
}

.day-tabs-scroll::-webkit-scrollbar {
    display: none;
}

.day-tab {
    padding: 8px 14px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 0.82rem;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
    color: var(--text-muted);
}

.day-tab:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.day-tab.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    box-shadow: 0 10px 20px rgba(79, 70, 229, 0.22);
}

.day-add-btn {
    background: var(--card-bg) !important;
    border: 1px solid var(--border) !important;
    border-radius: 12px !important;
}

.day-tools-card,
.day-tools-bar {
    margin-bottom: 12px;
    padding: 12px;
    border: 1px solid rgba(79, 70, 229, 0.18);
    border-radius: 16px;
    background:
        linear-gradient(135deg, rgba(79, 70, 229, 0.12), rgba(20, 184, 166, 0.08)),
        var(--card-bg);
    box-shadow: var(--shadow-soft);
    backdrop-filter: var(--backdrop);
    -webkit-backdrop-filter: var(--backdrop);
}

.day-tools-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.day-tools-card-head span {
    display: block;
    margin-bottom: 3px;
    color: var(--primary);
    font-size: 0.72rem;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.day-tools-card-head strong {
    display: block;
    color: var(--text-main);
    font-size: 0.95rem;
    line-height: 1.25;
}

.day-tool-control {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(150px, 0.72fr);
    align-items: end;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.46);
}

[data-theme="dark"] .day-tool-control {
    background: rgba(15, 23, 42, 0.34);
}

.day-tool-action-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
}

.day-tool-action-row select,
.day-tool-action-row .btn {
    min-height: 38px;
}

.day-swap-copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.day-swap-copy strong {
    font-size: 0.82rem;
}

.day-swap-copy span {
    color: var(--text-muted);
    font-size: 0.74rem;
    line-height: 1.25;
}

.bulk-move-bar {
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 12px;
    padding: 10px;
    border: 1px solid rgba(79, 70, 229, 0.2);
    border-radius: 12px;
    background: rgba(79, 70, 229, 0.08);
}

.day-tools-toggle-btn {
    width: auto !important;
    min-width: 56px;
    padding: 7px 10px !important;
    font-size: 0.74rem !important;
    font-weight: 800;
    letter-spacing: 0;
    background: var(--card-bg) !important;
    border: 1px solid var(--border) !important;
}

.bulk-move-bar span {
    font-size: 0.8rem;
    font-weight: 800;
    color: var(--primary);
}

.bulk-move-bar select {
    min-width: 120px;
    flex: 1;
}

.trip-actions-row {
    margin: 12px 0 14px;
}

.sortable-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.trip-item {
    background: var(--card-bg);
    padding: 14px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    gap: 14px;
    border: 1px solid var(--border);
    cursor: grab;
    box-shadow: var(--shadow-soft);
    transition: all 0.18s ease;
}

.trip-item.selected {
    border-color: rgba(79, 70, 229, 0.45);
    background: rgba(79, 70, 229, 0.06);
}

.stop-select-check {
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    cursor: pointer;
}

.stop-select-check input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.stop-select-check span {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-strong);
    border-radius: 6px;
    background: var(--card-bg);
    transition: all 0.18s ease;
}

.stop-select-check input:checked+span {
    border-color: var(--primary);
    background: var(--primary);
    box-shadow: inset 0 0 0 3px var(--card-bg);
}

.trip-item+.trip-item {
    margin-top: 10px;
}

.trip-item:hover {
    transform: translateY(-2px);
    border-color: rgba(79, 70, 229, 0.22);
}

.trip-item:active {
    cursor: grabbing;
    border-color: var(--primary);
}

.trip-stop-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    flex: 0 0 auto;
    flex-wrap: wrap;
}

.trip-stop-actions .btn-icon-small,
.trip-action-chip {
    min-width: 42px;
    min-height: 34px;
    padding: 7px 10px;
    border-radius: 11px;
    font-size: 0.72rem;
    font-weight: 900;
    line-height: 1;
}

.trip-action-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(245, 158, 11, 0.28);
    background: rgba(245, 158, 11, 0.1);
    color: #92400e;
    cursor: pointer;
    transition: all 0.18s ease;
}

.trip-action-chip:hover,
.trip-action-chip:focus-visible {
    border-color: rgba(245, 158, 11, 0.45);
    background: rgba(245, 158, 11, 0.16);
    transform: translateY(-1px);
    outline: none;
}

[data-theme="dark"] .trip-action-chip {
    color: #fbbf24;
    border-color: rgba(251, 191, 36, 0.24);
    background: rgba(251, 191, 36, 0.1);
}

.action-link {
    font-size: 0.8rem;
    color: var(--warning);
    cursor: pointer;
    font-weight: 700;
}

.action-link:hover,
.clear-link:hover {
    text-decoration: underline;
}

.clear-link {
    font-size: 0.8rem;
    color: var(--danger);
    cursor: pointer;
    font-weight: 700;
}

.context-menu {
    position: fixed;
    background: var(--menu-bg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    border-radius: 12px;
    z-index: 5000;
    padding: 6px;
    width: min(220px, calc(100vw - 20px));
    max-height: min(280px, calc(100dvh - 20px));
    overflow-y: auto;
    backdrop-filter: var(--backdrop);
    -webkit-backdrop-filter: var(--backdrop);
}

.context-item {
    padding: 9px 10px;
    font-size: 0.85rem;
    cursor: pointer;
    border-radius: 8px;
    color: var(--text-main);
}

.context-item:hover {
    background: var(--hover-soft);
    color: var(--primary);
}

.context-item.disabled,
.context-item.disabled:hover {
    color: var(--text-muted);
    background: transparent;
    cursor: default;
}

.place-card,
.saved-trip-card,
.budget-item {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow-soft);
}

.place-card {
    padding: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.18s ease;
}

.place-card+.place-card {
    margin-top: 10px;
}

.place-card:hover {
    transform: translateY(-2px);
    border-color: rgba(79, 70, 229, 0.22);
}

.saved-trip-card {
    padding: 16px;
    margin-bottom: 12px;
}

.saved-trip-card:hover {
    transform: translateY(-1px);
}

.saved-trip-title {
    font-weight: 700;
    margin-bottom: 4px;
}

.saved-trip-meta {
    font-size: 0.82rem;
    color: var(--text-muted);
}

.card-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

.budget-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.budget-hero-card {
    display: grid;
    gap: 5px;
    padding: 16px;
    margin-bottom: 14px;
    border: 1px solid rgba(79, 70, 229, 0.18);
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.12), rgba(16, 185, 129, 0.1));
}

.budget-hero-card span,
.budget-hero-card small {
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 700;
}

.budget-hero-card strong {
    color: var(--text-main);
    font-size: 1.45rem;
    line-height: 1.1;
}

.budget-controls-grid {
    display: grid;
    grid-template-columns: 1.1fr 0.8fr 0.8fr;
    gap: 10px;
    margin-bottom: 6px;
}

.budget-item {
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.budget-item.total {
    grid-column: 1 / -1;
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.08), rgba(16, 185, 129, 0.08));
}

.budget-label {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    font-weight: 800;
}

.misc-expense-box {
    border-top: 1px solid var(--border);
    padding-top: 14px;
}

.misc-expense-header {
    font-size: 0.9rem;
    font-weight: 800;
    margin-bottom: 10px;
}

.misc-form-row {
    display: grid;
    grid-template-columns: 1.4fr 0.8fr;
    gap: 10px;
    margin-bottom: 10px;
}

.budget-misc-form {
    grid-template-columns: 1.3fr 0.8fr 0.7fr;
}

.misc-form-row input,
.misc-form-row select,
.form-group input {
    width: 100%;
    padding: 12px 13px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--input-bg);
    color: var(--text-main);
    font-size: 0.96rem;
    transition: all 0.2s ease;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-muted);
}

.form-group input {
    margin-bottom: 15px;
}

.misc-form-row input:focus,
.misc-form-row select:focus,
.form-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

.misc-list {
    margin-top: 12px;
}

.budget-health-card {
    padding: 14px;
    margin-bottom: 16px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--surface-soft);
}

.budget-health-row,
.budget-breakdown-row,
.budget-category-row>div:first-child {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
}

.budget-health-row span,
.budget-breakdown-row span,
.budget-category-row span {
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 800;
}

.budget-progress-track,
.budget-mini-track {
    width: 100%;
    height: 8px;
    overflow: hidden;
    border-radius: 999px;
    background: var(--surface-muted);
    margin-top: 10px;
}

.budget-progress-fill,
.budget-mini-track span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--success);
    transition: width 0.2s ease, background 0.2s ease;
}

.budget-progress-fill[data-state="warn"] {
    background: var(--warning);
}

.budget-progress-fill[data-state="over"] {
    background: var(--danger);
}

.budget-analysis-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
    margin-bottom: 16px;
}

.budget-breakdown-list {
    display: grid;
    gap: 8px;
}

.budget-breakdown-row,
.budget-category-row {
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--card-bg);
}

.budget-breakdown-row[data-state="over"] {
    border-color: rgba(239, 68, 68, 0.28);
    background: rgba(239, 68, 68, 0.06);
}

.empty-state {
    text-align: center;
    padding: 18px;
    color: var(--text-muted);
    background: var(--surface-muted);
    border: 1px dashed var(--border);
    border-radius: 14px;
}

.btn {
    border: none;
    border-radius: 12px;
    padding: 12px 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.18s ease;
    font-size: 0.94rem;
    line-height: 1.15;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: var(--primary);
    color: white;
    width: 100%;
    box-shadow: 0 10px 22px rgba(79, 70, 229, 0.25);
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-main);
    width: 100%;
}

.btn-secondary:hover {
    background: var(--hover-soft);
    border-color: var(--border-strong);
}

.btn:disabled,
.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

.btn-icon,
.btn-icon-small {
    background: transparent;
    color: var(--text-main);
    transition: all 0.18s ease;
}

.btn-icon {
    border: 1px solid transparent;
    padding: 8px 10px;
    border-radius: 999px;
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 800;
    line-height: 1;
    text-decoration: none;
}

.btn-icon.nav-link-btn {
    border-color: var(--border);
    background: var(--card-bg);
}

.btn-icon:hover {
    background: var(--hover-soft);
}

.btn-icon-small {
    border: none;
    font-size: 1rem;
    cursor: pointer;
    padding: 7px;
    border-radius: 10px;
    opacity: 0.7;
}

.btn-icon-small:hover {
    opacity: 1;
    background: var(--hover-soft);
}

.delete-btn:hover {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
}

.danger-outline {
    color: var(--danger) !important;
    border-color: rgba(239, 68, 68, 0.3) !important;
}

.danger-outline:hover {
    background: rgba(239, 68, 68, 0.08) !important;
}

.stats-card {
    position: absolute;
    top: 20px;
    right: 20px;
    background: var(--surface-strong);
    backdrop-filter: var(--backdrop);
    -webkit-backdrop-filter: var(--backdrop);
    padding: 18px;
    border-radius: 18px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    display: none;
    z-index: 900;
    min-width: 220px;
}

.stats-header-row {
    margin-bottom: 12px;
}

.stats-header-row h4 {
    margin: 0 0 4px;
}

.stats-subtext {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.stats-grid {
    display: flex;
    gap: 24px;
    margin-bottom: 14px;
    font-size: 1.55rem;
    font-weight: 800;
    color: var(--text-main);
    align-items: baseline;
}

.stats-grid small {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-left: 2px;
}

.step-leg-heading {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 14px;
    align-items: center;
    margin: 20px 0 12px;
    padding: 14px 16px;
    border: 1px solid rgba(99, 102, 241, 0.18);
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.14), rgba(20, 184, 166, 0.08));
}

.step-leg-heading span,
.step-leg-heading em,
.step-dist span {
    color: var(--text-muted);
    font-size: 0.78rem;
    font-style: normal;
    font-weight: 800;
}

.step-leg-heading strong {
    display: block;
    margin-top: 4px;
    color: var(--text-main);
    font-size: 0.94rem;
    line-height: 1.35;
}

.step-card {
    background: linear-gradient(135deg, var(--surface-strong), var(--surface-soft));
    margin-bottom: 10px;
    padding: 12px;
    border-radius: 16px;
    display: grid;
    grid-template-columns: 32px minmax(0, 1fr) minmax(74px, auto);
    gap: 12px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
    transition: transform 0.18s ease, border-color 0.18s ease;
}

.step-card:hover {
    transform: translateY(-1px);
    border-color: rgba(99, 102, 241, 0.28);
}

.step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 12px;
    color: #ffffff;
    background: linear-gradient(135deg, #4f46e5, #14b8a6);
    font-size: 0.8rem;
    font-weight: 900;
}

.step-text {
    min-width: 0;
    font-size: 0.94rem;
    line-height: 1.5;
    color: var(--text-main);
}

.step-dist {
    display: grid;
    align-content: center;
    gap: 2px;
    text-align: right;
}

.step-dist strong {
    color: var(--primary);
    font-size: 0.88rem;
}

.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, 0.45);
    z-index: 5000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(6px);
}

.modal-content {
    background: var(--surface-strong);
    width: 460px;
    max-width: calc(100vw - 32px);
    padding: 28px;
    border-radius: 24px;
    box-shadow: var(--shadow);
    position: relative;
    max-height: 85vh;
    overflow-y: auto;
    border: 1px solid var(--border);
}

.modal-wide {
    width: min(700px, calc(100vw - 32px));
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 22px;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.32rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.modal-subtitle {
    margin-top: 4px;
    font-size: 0.86rem;
    color: var(--text-muted);
}

.modal-scroll {
    max-height: 60vh;
    overflow-y: auto;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.7rem;
    cursor: pointer;
    color: var(--text-muted);
    line-height: 1;
    padding: 0;
}

.modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

#toastContainer {
    position: fixed;
    bottom: 22px;
    right: 22px;
    z-index: 6000;
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: min(390px, calc(100vw - 32px));
    pointer-events: none;
}

.toast {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    gap: 12px;
    align-items: flex-start;
    padding: 14px 14px 14px 12px;
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-left: 4px solid #2563eb;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.98);
    color: #172033;
    box-shadow: 0 20px 46px rgba(15, 23, 42, 0.18);
    font-size: 0.88rem;
    backdrop-filter: blur(10px);
    pointer-events: auto;
    animation: toastIn 0.22s ease-out;
}

.toast-success {
    border-left-color: #10b981;
}

.toast-warning {
    border-left-color: #f59e0b;
}

.toast-error {
    border-left-color: #ef4444;
}

.toast-danger {
    border-left-color: #dc2626;
}

.toast-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    margin-top: 1px;
    border-radius: 10px;
    color: #ffffff;
    background: #2563eb;
    font-size: 0.68rem;
    font-weight: 900;
    letter-spacing: 0;
}

.toast-success .toast-icon {
    background: #10b981;
}

.toast-warning .toast-icon {
    background: #f59e0b;
}

.toast-error .toast-icon {
    background: #ef4444;
}

.toast-danger .toast-icon {
    background: #dc2626;
}

.toast-copy {
    min-width: 0;
}

.toast-copy strong,
.toast-copy span {
    display: block;
}

.toast-copy strong {
    margin-bottom: 2px;
    color: #111827;
    font-size: 0.9rem;
}

.toast-copy span {
    color: #475467;
    line-height: 1.35;
}

.toast a {
    color: #2563eb;
    font-weight: 900;
    text-decoration: none;
    white-space: nowrap;
    align-self: center;
}

.toast button {
    border: none;
    color: #667085;
    background: transparent;
    cursor: pointer;
    font-weight: 900;
    line-height: 1;
    padding: 4px;
    border-radius: 8px;
}

.toast button:hover,
.toast button:focus-visible {
    color: #111827;
    background: rgba(15, 23, 42, 0.06);
    outline: none;
}

.app-dialog-backdrop {
    position: fixed;
    inset: 0;
    z-index: 7000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 22px;
    background: rgba(15, 23, 42, 0.42);
    backdrop-filter: blur(6px);
    animation: dialogBackdropIn 0.16s ease-out;
}

.app-dialog {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 16px;
    width: min(460px, 100%);
    padding: 20px;
    border: 1px solid rgba(148, 163, 184, 0.26);
    border-radius: 16px;
    background: #ffffff;
    color: #172033;
    box-shadow: 0 28px 70px rgba(15, 23, 42, 0.26);
    animation: dialogIn 0.18s ease-out;
}

.app-dialog-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 14px;
    background: #2563eb;
    color: #ffffff;
    font-size: 0.74rem;
    font-weight: 900;
}

.app-dialog-success .app-dialog-icon {
    background: #10b981;
}

.app-dialog-warning .app-dialog-icon {
    background: #f59e0b;
}

.app-dialog-error .app-dialog-icon,
.app-dialog-danger .app-dialog-icon {
    background: #dc2626;
}

.app-dialog-body h3 {
    margin: 0;
    color: #111827;
    font-size: 1.08rem;
    line-height: 1.25;
}

.app-dialog-body p {
    margin: 8px 0 0;
    color: #667085;
    line-height: 1.5;
}

.app-dialog-benefits {
    display: grid;
    gap: 8px;
    margin: 14px 0 0;
    padding: 0;
    list-style: none;
}

.app-dialog-benefits li {
    position: relative;
    padding: 10px 12px 10px 36px;
    border: 1px solid rgba(79, 70, 229, 0.14);
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.08), rgba(20, 184, 166, 0.05));
    color: #263244;
    font-size: 0.86rem;
    font-weight: 800;
    line-height: 1.35;
}

.app-dialog-benefits li::before {
    content: "";
    position: absolute;
    left: 13px;
    top: 14px;
    width: 9px;
    height: 9px;
    border-radius: 999px;
    background: linear-gradient(135deg, #6366f1, #14b8a6);
    box-shadow: 0 0 12px rgba(99, 102, 241, 0.32);
}

.app-dialog-field {
    display: grid;
    gap: 8px;
    margin-top: 16px;
}

.app-dialog-field span {
    color: #344054;
    font-size: 0.84rem;
    font-weight: 800;
}

.app-dialog-field input {
    width: 100%;
    padding: 12px 13px;
    border: 1px solid rgba(148, 163, 184, 0.42);
    border-radius: 10px;
    background: #ffffff;
    color: #172033;
    font: inherit;
}

.app-dialog-field input:focus {
    border-color: #2563eb;
    outline: 3px solid rgba(37, 99, 235, 0.16);
}

.app-dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

.app-dialog-button {
    min-height: 38px;
    padding: 0 15px;
    border: 1px solid transparent;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 900;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.app-dialog-button:hover {
    transform: translateY(-1px);
}

.app-dialog-button.primary {
    background: #2563eb;
    color: #ffffff;
    box-shadow: 0 10px 20px rgba(37, 99, 235, 0.22);
}

.app-dialog-button.danger {
    background: #dc2626;
    color: #ffffff;
    box-shadow: 0 10px 20px rgba(220, 38, 38, 0.2);
}

.app-dialog-button.secondary {
    border-color: rgba(148, 163, 184, 0.35);
    background: #ffffff;
    color: #344054;
}

.app-dialog-button:focus-visible {
    outline: 3px solid rgba(37, 99, 235, 0.2);
    outline-offset: 2px;
}

[data-theme="dark"] .toast,
[data-theme="dark"] .app-dialog {
    border-color: rgba(148, 163, 184, 0.2);
    background: rgba(15, 23, 42, 0.98);
    color: #e5e7eb;
}

[data-theme="dark"] .toast-copy strong,
[data-theme="dark"] .app-dialog-body h3 {
    color: #f8fafc;
}

[data-theme="dark"] .toast-copy span,
[data-theme="dark"] .app-dialog-body p,
[data-theme="dark"] .app-dialog-field span {
    color: #cbd5e1;
}

[data-theme="dark"] .app-dialog-benefits li {
    border-color: rgba(129, 140, 248, 0.22);
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.18), rgba(20, 184, 166, 0.08));
    color: #e2e8f0;
}

[data-theme="dark"] .toast button {
    color: #cbd5e1;
}

[data-theme="dark"] .toast button:hover,
[data-theme="dark"] .toast button:focus-visible {
    color: #ffffff;
    background: rgba(148, 163, 184, 0.14);
}

[data-theme="dark"] .app-dialog-field input,
[data-theme="dark"] .app-dialog-button.secondary {
    border-color: rgba(148, 163, 184, 0.28);
    background: #111827;
    color: #f8fafc;
}

.tour-active .tour-highlight {
    position: relative;
    z-index: 5300;
    outline: 3px solid rgba(20, 184, 166, 0.85);
    outline-offset: 5px;
    box-shadow: 0 0 34px rgba(20, 184, 166, 0.5) !important;
}

.tour-spotlight {
    position: fixed;
    inset: 0;
    z-index: 5200;
    pointer-events: none;
}

.tour-spotlight span {
    position: fixed;
    display: block;
    background: rgba(2, 6, 23, 0.42);
    transition: left 0.2s ease, top 0.2s ease, width 0.2s ease, height 0.2s ease;
}

.tour-overlay {
    position: fixed;
    left: 16px;
    top: 16px;
    z-index: 5400;
    width: min(380px, calc(100vw - 32px));
    pointer-events: none;
    transition: left 0.2s ease, top 0.2s ease;
}

.tour-card {
    pointer-events: auto;
    padding: 18px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 28px 80px rgba(15, 23, 42, 0.28);
    animation: tourCardIn 0.18s ease-out;
}

.tour-kicker {
    color: #2563eb;
    font-size: 0.74rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.tour-card h3 {
    margin: 8px 0 8px;
    color: #0f172a;
    font-size: 1.15rem;
}

.tour-card p {
    margin: 0;
    color: #475569;
    line-height: 1.55;
}

.tour-progress {
    display: flex;
    gap: 6px;
    margin: 16px 0;
}

.tour-progress span {
    flex: 1;
    height: 5px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.22);
}

.tour-progress span.active {
    background: linear-gradient(90deg, #4f46e5, #14b8a6);
}

.tour-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

[data-theme="dark"] .tour-card {
    border-color: rgba(148, 163, 184, 0.2);
    background: rgba(15, 23, 42, 0.98);
}

[data-theme="dark"] .tour-card h3 {
    color: #f8fafc;
}

[data-theme="dark"] .tour-card p {
    color: #cbd5e1;
}

@keyframes tourCardIn {
    from {
        transform: translateY(8px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.slide-up {
    animation: slideUp 0.25s ease-out;
}

@keyframes toastIn {
    from {
        transform: translate(16px, 10px);
        opacity: 0;
    }

    to {
        transform: translate(0, 0);
        opacity: 1;
    }
}

@keyframes dialogBackdropIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes dialogIn {
    from {
        transform: translateY(12px) scale(0.98);
        opacity: 0;
    }

    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

@media (max-width: 640px) {
    #toastContainer {
        right: auto;
        bottom: max(20px, env(safe-area-inset-bottom));
        left: 50%;
        width: min(390px, calc(100vw - 28px));
        transform: translateX(-50%);
    }

    .toast {
        grid-template-columns: auto minmax(0, 1fr) auto;
    }

    .toast-icon {
        grid-column: 1 / 2;
        grid-row: 1 / 3;
    }

    .toast-copy {
        grid-column: 2 / 3;
        grid-row: 1 / 2;
    }

    .toast a {
        grid-column: 2 / 3;
        grid-row: 2 / 3;
        justify-self: start;
        margin-top: 4px;
    }

    .toast button {
        grid-column: 3 / 4;
        grid-row: 1 / 2;
    }

    .app-dialog {
        grid-template-columns: 1fr;
        padding: 18px;
    }

    .app-dialog-actions {
        flex-direction: column-reverse;
    }

    .app-dialog-button {
        width: 100%;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(18px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.sortable-ghost {
    opacity: 0.45;
    background: var(--surface-muted);
    border: 2px dashed var(--border-strong);
}

.sortable-drag {
    cursor: grabbing;
    opacity: 1;
    background: var(--card-bg);
    transform: scale(1.01);
    box-shadow: var(--shadow);
}

.footer-note,
.stats-subtext,
.modal-subtitle,
.brand-subtitle,
.section-subtitle,
.planner-helper-text,
.user-label,
.saved-trip-meta,
.budget-label {
    color: var(--text-muted);
}

@media (max-width: 1100px) {
    #sidebar {
        width: min(var(--sidebar-width, 400px), calc(100vw - 36px));
    }

    .stats-card {
        top: auto;
        bottom: 18px;
        right: 18px;
    }
}

@media (max-width: 900px) {
    body {
        overflow: auto;
    }

    #map {
        position: fixed;
    }

    #sidebar {
        top: 12px;
        left: 12px;
        right: 12px;
        bottom: 12px;
        width: auto;
        min-width: 0;
        max-width: none;
    }

    .sidebar-resize-handle,
    #sidebarResizeReset {
        display: none;
    }

    .stats-card {
        top: auto;
        right: 12px;
        bottom: 12px;
        left: 12px;
        min-width: auto;
    }
}

@media (max-width: 640px) {
    .brand-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .header-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .floating-tabs {
        flex-wrap: wrap;
        border-radius: 18px;
    }

    .floating-tab {
        min-width: calc(33.333% - 6px);
    }

    .budget-grid {
        grid-template-columns: 1fr;
    }

    .budget-item.total {
        grid-column: auto;
    }

    .misc-form-row {
        grid-template-columns: 1fr;
    }

    .budget-controls-grid {
        grid-template-columns: 1fr;
    }

    .panel-topline,
    .panel-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .planner-inline-actions {
        width: 100%;
    }

    .day-tabs-scroll {
        max-width: 220px;
    }

    .modal-content {
        width: min(92vw, 480px);
        padding: 24px 20px;
        border-radius: 20px;
    }
}

/* =========================
   PREMIUM PLACE PLANNER + ROUTE UI
   ========================= */

.sidebar-panel {
    display: none;
}

.sidebar-panel.active {
    display: block;
}

.floating-tabs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(86px, 1fr));
    gap: 6px;
    margin-top: 14px;
    padding: 5px;
    background: var(--surface-soft, rgba(255, 255, 255, 0.5));
    border: 1px solid var(--border);
    border-radius: 18px;
}

.floating-tab {
    border: none;
    background: transparent;
    color: var(--text-muted);
    padding: 10px 8px;
    border-radius: 13px;
    font-weight: 700;
    min-width: 0;
    cursor: pointer;
    transition: all 0.2s ease;
}

.floating-tab:hover {
    background: rgba(79, 70, 229, 0.08);
    color: var(--text-main);
}

.floating-tab.active {
    background: var(--card-bg);
    color: var(--primary);
    box-shadow: 0 8px 16px rgba(15, 23, 42, 0.08);
}

.trip-leg-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border-radius: 999px;
    background: rgba(79, 70, 229, 0.08);
    color: var(--primary);
    font-size: 0.74rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.trip-category-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
    font-size: 0.72rem;
    font-weight: 700;
}

.modal-place-planner {
    width: min(560px, calc(100vw - 32px));
}

.place-planner-top {
    margin-bottom: 12px;
}

.planner-pill-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.planner-pill {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
}

.planner-pill.primary {
    background: rgba(79, 70, 229, 0.1);
    color: var(--primary);
}

.planner-pill.success {
    background: rgba(16, 185, 129, 0.12);
    color: #059669;
}

.planner-section {
    margin: 12px 0 16px;
}

.planner-section label,
.planner-cost-card label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.86rem;
    font-weight: 700;
    color: var(--text-muted);
}

.planner-section input,
.planner-section select,
.planner-cost-card input,
.planner-cost-card select {
    width: 100%;
    padding: 12px 13px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--card-bg);
    color: var(--text-main);
    font-size: 0.96rem;
    transition: all 0.2s ease;
}

.planner-section input:focus,
.planner-section select:focus,
.planner-cost-card input:focus,
.planner-cost-card select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

.planner-quick-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.planner-tag {
    border: 1px solid var(--border);
    background: var(--card-bg);
    color: var(--text-main);
    border-radius: 999px;
    padding: 8px 12px;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.18s ease;
}

.planner-tag:hover {
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-1px);
}

.planner-cost-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 14px;
}

.planner-cost-card {
    background: var(--surface-soft, rgba(255, 255, 255, 0.4));
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 14px;
}

.planner-helper-box {
    padding: 12px 14px;
    border-radius: 14px;
    background: rgba(245, 158, 11, 0.08);
    color: var(--text-main);
    font-size: 0.88rem;
    line-height: 1.5;
    margin-bottom: 4px;
    border: 1px solid rgba(245, 158, 11, 0.12);
}

[data-theme="dark"] .trip-category-badge {
    color: #34d399;
    background: rgba(16, 185, 129, 0.16);
}

[data-theme="dark"] .planner-pill.success {
    color: #34d399;
    background: rgba(16, 185, 129, 0.18);
}

[data-theme="dark"] .planner-helper-box {
    background: rgba(245, 158, 11, 0.12);
    border-color: rgba(245, 158, 11, 0.18);
}

[data-theme="dark"] .floating-tab.active,
[data-theme="dark"] .planner-tag,
[data-theme="dark"] .planner-cost-card,
[data-theme="dark"] .trip-leg-chip {
    box-shadow: none;
}

@media (max-width: 640px) {
    .planner-cost-grid {
        grid-template-columns: 1fr;
    }

    .floating-tabs {
        flex-wrap: wrap;
        border-radius: 18px;
    }

    .floating-tab {
        min-width: calc(33.333% - 6px);
    }
}

.user-avatar {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--card-bg);
    border: 1px solid var(--border);
    flex-shrink: 0;
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.user-avatar-fallback {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1rem;
    color: var(--primary);
    background: rgba(79, 70, 229, 0.12);
}

/* =========================
   SMART ROUTE MODES + LOCKED STOPS
   ========================= */

.user-avatar-fallback {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1rem;
    color: var(--primary);
    background: rgba(79, 70, 229, 0.12);
}

.route-mode-block {
    margin-bottom: 14px;
    padding: 14px;
    border-radius: 16px;
    background: rgba(79, 70, 229, 0.06);
    border: 1px solid var(--border);
}

.route-mode-label-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}

.route-mode-title {
    font-size: 0.84rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-main);
}

.route-mode-helper {
    margin-top: 4px;
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.45;
}

.route-mode-summary {
    padding: 6px 10px;
    border-radius: 999px;
    background: var(--card-bg);
    color: var(--primary);
    font-size: 0.74rem;
    font-weight: 800;
    white-space: nowrap;
    border: 1px solid var(--border);
}

.route-mode-toggle {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 10px;
}

.route-mode-btn {
    border: 1px solid var(--border);
    background: var(--card-bg);
    color: var(--text-muted);
    border-radius: 12px;
    padding: 10px 12px;
    font-size: 0.82rem;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.18s ease;
}

.route-mode-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.route-mode-btn.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    box-shadow: 0 10px 20px rgba(79, 70, 229, 0.22);
}

.route-mode-note {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.trip-leg-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border-radius: 999px;
    background: rgba(79, 70, 229, 0.08);
    color: var(--primary);
    font-size: 0.74rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.trip-category-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
    font-size: 0.72rem;
    font-weight: 700;
}

.stop-lock-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(245, 158, 11, 0.12);
    color: #b45309;
    font-size: 0.72rem;
    font-weight: 800;
}

.stop-lock-badge.auto {
    background: rgba(79, 70, 229, 0.12);
    color: var(--primary);
}

.lock-active {
    background: rgba(245, 158, 11, 0.12) !important;
    opacity: 1 !important;
}

.route-return-summary {
    margin-top: 12px;
}

.route-return-card {
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: rgba(79, 70, 229, 0.06);
    color: var(--text-main);
    font-weight: 700;
    box-shadow: var(--shadow-soft);
}

.modal-place-planner {
    width: min(560px, calc(100vw - 32px));
}

.place-planner-top {
    margin-bottom: 12px;
}

.planner-pill-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.planner-pill {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
}

.planner-pill.primary {
    background: rgba(79, 70, 229, 0.1);
    color: var(--primary);
}

.planner-pill.success {
    background: rgba(16, 185, 129, 0.12);
    color: #059669;
}

.planner-pill.neutral {
    background: rgba(15, 23, 42, 0.08);
    color: var(--text-main);
}

.planner-section {
    margin: 12px 0 16px;
}

.planner-section label,
.planner-cost-card label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.86rem;
    font-weight: 700;
    color: var(--text-muted);
}

.planner-section input,
.planner-section select,
.planner-cost-card input,
.planner-cost-card select {
    width: 100%;
    padding: 12px 13px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--card-bg);
    color: var(--text-main);
    font-size: 0.96rem;
    transition: all 0.2s ease;
}

.planner-section input:focus,
.planner-section select:focus,
.planner-cost-card input:focus,
.planner-cost-card select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

.planner-quick-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.planner-tag {
    border: 1px solid var(--border);
    background: var(--card-bg);
    color: var(--text-main);
    border-radius: 999px;
    padding: 8px 12px;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.18s ease;
}

.planner-tag:hover {
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-1px);
}

.planner-cost-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 14px;
}

.planner-cost-card {
    background: rgba(255, 255, 255, 0.38);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 14px;
}

.planner-helper-box {
    padding: 12px 14px;
    border-radius: 14px;
    background: rgba(245, 158, 11, 0.08);
    color: var(--text-main);
    font-size: 0.88rem;
    line-height: 1.5;
    margin-bottom: 4px;
    border: 1px solid rgba(245, 158, 11, 0.12);
}

[data-theme="dark"] .trip-category-badge {
    color: #34d399;
    background: rgba(16, 185, 129, 0.16);
}

[data-theme="dark"] .planner-pill.success {
    color: #34d399;
    background: rgba(16, 185, 129, 0.18);
}

[data-theme="dark"] .planner-pill.neutral {
    background: rgba(148, 163, 184, 0.14);
    color: var(--text-main);
}

[data-theme="dark"] .planner-helper-box {
    background: rgba(245, 158, 11, 0.12);
    border-color: rgba(245, 158, 11, 0.18);
}

@media (max-width: 640px) {
    .route-mode-toggle {
        grid-template-columns: 1fr;
    }

    .planner-cost-grid {
        grid-template-columns: 1fr;
    }
}

/* =========================
   FLOATING CONTROL CARD UI
   ========================= */

.planner-control-card {
    position: absolute;
    top: 170px;
    right: 20px;
    width: 360px;
    max-width: calc(100vw - 40px);
    background: var(--surface-strong);
    backdrop-filter: var(--backdrop);
    -webkit-backdrop-filter: var(--backdrop);
    border: 1px solid var(--border);
    border-radius: 22px;
    padding: 16px;
    box-shadow: var(--shadow);
    z-index: 920;
}

.planner-control-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}

.planner-control-header h4 {
    margin: 0 0 4px;
    font-size: 0.9rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-main);
}

.planner-control-subtext {
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.45;
}

.floating-mode-toggle {
    margin-bottom: 12px;
}

.planner-control-actions {
    display: grid;
    grid-template-columns: 1.2fr 1fr 1fr;
    gap: 8px;
    margin-bottom: 10px;
}

.planner-control-note {
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.danger-light {
    border-color: rgba(239, 68, 68, 0.22) !important;
    color: var(--danger) !important;
}

.danger-light:hover {
    background: rgba(239, 68, 68, 0.08) !important;
}

.user-avatar {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--card-bg);
    border: 1px solid var(--border);
    flex-shrink: 0;
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.user-avatar-fallback {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1rem;
    color: var(--primary);
    background: rgba(79, 70, 229, 0.12);
}

[data-theme="dark"] .planner-control-card {
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.34);
}

@media (max-width: 1100px) {
    .planner-control-card {
        top: 190px;
        right: 18px;
        width: 330px;
    }
}

@media (max-width: 900px) {
    .planner-control-card {
        top: auto;
        right: 12px;
        left: 12px;
        bottom: 94px;
        width: auto;
    }

    .planner-control-actions {
        grid-template-columns: 1fr;
    }
}

/* =========================
   UI REFINEMENT + EDIT STOP + OVERLAY DOCK
   ========================= */

.map-overlay-dock {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 360px;
    max-width: calc(100vw - 40px);
    display: flex;
    flex-direction: column;
    gap: 14px;
    z-index: 920;
}

.stats-card,
.planner-control-card {
    position: static;
    width: 100%;
    min-width: 0;
}

.stats-grid-3 {
    gap: 18px;
}

.day-nav-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

.day-delete-btn {
    background: var(--card-bg) !important;
    border: 1px solid rgba(239, 68, 68, 0.18) !important;
    color: var(--danger) !important;
    border-radius: 12px !important;
}

.day-delete-btn:hover {
    background: rgba(239, 68, 68, 0.08) !important;
}

.planner-control-actions-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.planner-cost-grid-3 {
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
}

.trip-stay-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(245, 158, 11, 0.1);
    color: #b45309;
    font-size: 0.72rem;
    font-weight: 700;
}

.trip-note-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(59, 130, 246, 0.1);
    color: #1d4ed8;
    font-size: 0.72rem;
    font-weight: 700;
}

.planner-check-row {
    margin: 12px 0 8px;
}

.planner-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.92rem;
    color: var(--text-main);
    font-weight: 600;
}

.planner-checkbox input {
    width: 16px;
    height: 16px;
}

.user-avatar {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--card-bg);
    border: 1px solid var(--border);
    flex-shrink: 0;
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.user-avatar-fallback {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1rem;
    color: var(--primary);
    background: rgba(79, 70, 229, 0.12);
}

@media (max-width: 1100px) {
    .map-overlay-dock {
        width: 330px;
        right: 18px;
        top: 18px;
    }
}

@media (max-width: 900px) {
    .map-overlay-dock {
        top: auto;
        right: 12px;
        left: 12px;
        bottom: 12px;
        width: auto;
        max-width: none;
        max-height: min(74dvh, calc(100dvh - 24px));
    }

    .planner-control-actions-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .trip-save-actions,
    .day-tools-bar,
    .day-tool-control,
    .day-tool-action-row {
        grid-template-columns: 1fr;
    }

    .day-navigator {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .day-tabs-scroll {
        flex: 1 1 100%;
        max-width: 100%;
        touch-action: pan-x;
    }

    .day-nav-actions {
        width: 100%;
        justify-content: space-between;
    }

    .day-tools-card {
        padding: 12px;
    }

    .bulk-move-bar {
        align-items: stretch;
    }

    .bulk-move-bar select,
    .bulk-move-bar .btn {
        width: 100%;
    }

    .planner-cost-grid-3 {
        grid-template-columns: 1fr;
    }
}

/* =========================
   SMART DAY ENGINE + TRIP MANAGEMENT
   ========================= */

.map-overlay-dock {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 380px;
    max-width: calc(100vw - 40px);
    max-height: calc(100dvh - 40px);
    display: flex;
    flex-direction: column;
    gap: 14px;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    padding-right: 4px;
    scrollbar-width: thin;
    z-index: 920;
}

.map-overlay-dock::-webkit-scrollbar {
    width: 7px;
}

.map-overlay-dock::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.45);
    border-radius: 999px;
}

.stats-card,
.planner-control-card {
    position: static;
    width: 100%;
    min-width: 0;
}

.stats-grid-4 {
    gap: 14px;
}

.day-nav-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

.day-delete-btn {
    background: var(--card-bg) !important;
    border: 1px solid rgba(239, 68, 68, 0.18) !important;
    color: var(--danger) !important;
    border-radius: 12px !important;
}

.day-delete-btn:hover {
    background: rgba(239, 68, 68, 0.08) !important;
}

.smart-day-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin: 12px 0;
}

.planner-scope-card,
.planner-settings-block {
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--card-bg);
    padding: 12px;
    margin: 12px 0;
    box-shadow: var(--shadow-soft);
}

.planner-collapsible {
    padding: 0;
    overflow: hidden;
}

.planner-scope-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
}

.planner-scope-toggle {
    display: inline-grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px;
    padding: 4px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface-soft);
}

.planner-scope-btn {
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.76rem;
    font-weight: 800;
    padding: 7px 10px;
    white-space: nowrap;
}

.planner-scope-btn.active {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 8px 18px rgba(79, 70, 229, 0.2);
}

.planner-block-title {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: baseline;
    margin-bottom: 10px;
}

.planner-collapsible > summary.planner-block-title {
    align-items: center;
    cursor: pointer;
    list-style: none;
    margin: 0;
    padding: 12px;
}

.planner-collapsible > summary.planner-block-title::-webkit-details-marker {
    display: none;
}

.planner-collapsible > summary.planner-block-title::after {
    content: "+";
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 999px;
    background: var(--surface-soft);
    color: var(--text-main);
    flex: 0 0 auto;
    font-size: 0.9rem;
    font-weight: 900;
}

.planner-collapsible[open] > summary.planner-block-title::after {
    content: "-";
}

.planner-block-title span,
.planner-inline-label {
    color: var(--text-main);
    font-size: 0.82rem;
    font-weight: 900;
    letter-spacing: 0.02em;
}

.planner-block-title small {
    color: var(--text-muted);
    font-size: 0.72rem;
    text-align: right;
    line-height: 1.35;
}

.planner-collapsible > summary.planner-block-title small {
    flex: 1 1 auto;
    min-width: 0;
}

.planner-section-body {
    border-top: 1px solid var(--border);
    padding: 0 12px 12px;
}

.planner-inline-label {
    margin: 10px 0 8px;
}

.planner-settings-block .route-mode-toggle,
.planner-settings-block .transport-mode-toggle,
.planner-settings-block .smart-day-grid {
    margin-bottom: 0;
}

.planner-primary-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin: 10px 0;
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--surface-strong);
    padding: 8px 0;
}

.planner-primary-actions .btn {
    min-width: 0;
    padding-inline: 10px;
}

.route-planner-summary {
    margin: 10px 0 12px;
    padding: 12px;
    border: 1px solid rgba(79, 70, 229, 0.16);
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.09), rgba(20, 184, 166, 0.08));
    color: var(--text-main);
    line-height: 1.45;
}

.route-summary-kicker {
    color: var(--primary);
    font-size: 0.72rem;
    font-weight: 900;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.route-summary-main {
    margin-top: 4px;
    color: var(--text-main);
    font-size: 0.86rem;
    font-weight: 850;
}

.route-summary-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.route-summary-meta span {
    border: 1px solid rgba(79, 70, 229, 0.16);
    border-radius: 999px;
    background: var(--surface-soft);
    color: var(--text-muted);
    font-size: 0.68rem;
    font-weight: 850;
    line-height: 1.2;
    padding: 5px 8px;
}

.route-preset-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin: 10px 0;
}

.route-preset-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-width: 0;
    min-height: 64px;
    padding: 11px 12px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--card-bg);
    color: var(--text-main);
    cursor: pointer;
    text-align: left;
    box-shadow: var(--shadow-soft);
    transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.route-preset-btn:hover {
    border-color: rgba(79, 70, 229, 0.34);
    transform: translateY(-1px);
}

.route-preset-btn.active {
    border-color: rgba(79, 70, 229, 0.52);
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.13), rgba(20, 184, 166, 0.1));
}

.route-preset-btn.locked-feature {
    border-style: dashed;
    color: var(--text-muted);
}

.route-preset-copy {
    display: block;
    min-width: 0;
}

.route-preset-copy strong,
.route-preset-copy span {
    display: block;
    min-width: 0;
    white-space: normal;
}

.route-preset-copy strong {
    font-size: 0.82rem;
    font-weight: 900;
}

.route-preset-copy span {
    margin-top: 3px;
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 750;
    line-height: 1.35;
}

.route-preset-status {
    flex: 0 0 auto;
    border: 1px solid rgba(79, 70, 229, 0.18);
    border-radius: 999px;
    background: var(--surface-soft);
    color: var(--text-muted);
    font-size: 0.65rem;
    font-weight: 900;
    padding: 5px 8px;
    white-space: nowrap;
}

.route-preset-btn.active .route-preset-status {
    border-color: rgba(79, 70, 229, 0.24);
    background: rgba(79, 70, 229, 0.14);
    color: var(--primary);
}

.route-preset-btn.locked-feature .route-preset-status {
    border-style: dashed;
}

.route-action-btn {
    position: relative;
    display: grid;
    justify-items: center;
    align-content: center;
    gap: 3px;
    min-height: 58px;
}

.route-action-btn small {
    display: block;
    max-width: 100%;
    color: currentColor;
    opacity: 0.72;
    font-size: 0.65rem;
    font-weight: 800;
    line-height: 1.2;
    white-space: normal;
}

.route-action-magic {
    border: 0;
    background: linear-gradient(135deg, #4f46e5, #14b8a6);
    color: #fff;
    box-shadow: 0 14px 26px rgba(79, 70, 229, 0.24);
}

.route-busy-spinner {
    position: absolute;
    top: 10px;
    right: 10px;
    display: none;
    width: 14px;
    height: 14px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 999px;
    opacity: 0.84;
    animation: routeSpinner 0.72s linear infinite;
}

body.route-action-busy #map {
    filter: brightness(0.78) saturate(0.9);
}

body.route-action-busy .planner-control-card {
    box-shadow: 0 22px 52px rgba(15, 23, 42, 0.32);
}

.route-action-btn.is-loading .route-busy-spinner {
    display: block;
}

.planner-control-card.route-action-busy .route-preset-btn,
.planner-control-card.route-action-busy .planner-settings-block,
.planner-control-card.route-action-busy .planner-more-actions {
    opacity: 0.58;
    pointer-events: none;
}

#advancedRoutingDetails #daySettingsSummary {
    display: none;
}

@keyframes routeSpinner {
    to {
        transform: rotate(360deg);
    }
}

.planner-more-actions {
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface-soft);
    margin-bottom: 10px;
    overflow: hidden;
}

.planner-more-actions summary {
    cursor: pointer;
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 800;
    list-style: none;
    padding: 10px 12px;
}

.planner-more-actions summary::-webkit-details-marker {
    display: none;
}

.planner-more-actions summary::after {
    content: "+";
    float: right;
    color: var(--text-main);
}

.planner-more-actions[open] summary::after {
    content: "-";
}

.planner-more-action-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    padding: 0 10px 10px;
}

.planner-more-action-grid .btn {
    min-width: 0;
    padding-inline: 10px;
}

.admin-plan-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin: 12px 0;
}

.admin-plan-card {
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface-soft);
    padding: 10px;
}

.admin-plan-card span,
.admin-user-main strong {
    display: block;
    color: var(--text-main);
    font-size: 0.86rem;
    font-weight: 900;
}

.admin-plan-card strong {
    display: block;
    margin: 4px 0;
    color: var(--primary);
    font-size: 0.82rem;
}

.admin-plan-card small,
.admin-user-main span,
.admin-user-main small {
    color: var(--text-muted);
    font-size: 0.76rem;
    line-height: 1.4;
}

.admin-users-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.account-summary-card {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin: 12px 0;
}

.account-summary-card > div,
.account-usage-card {
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--card-bg);
    padding: 13px;
}

.account-summary-card span,
.account-usage-card span {
    display: block;
    color: var(--text-muted);
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin-bottom: 5px;
}

.account-summary-card strong,
.account-usage-card strong {
    color: var(--text-main);
    font-size: 1rem;
    text-transform: capitalize;
}

.account-usage-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 12px;
}

.subscription-plans-grid {
    display: grid;
    gap: 10px;
    margin-top: 12px;
}

.subscription-plan-card {
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--card-bg);
    padding: 14px;
    display: grid;
    gap: 12px;
}

.subscription-plan-card.active {
    border-color: rgba(79, 70, 229, 0.35);
    box-shadow: 0 10px 24px rgba(79, 70, 229, 0.1);
}

.subscription-plan-card span {
    display: block;
    color: var(--text-main);
    font-weight: 900;
}

.subscription-plan-card strong {
    display: block;
    margin: 3px 0 6px;
    color: var(--primary);
}

.subscription-plan-card small,
.subscription-plan-card li {
    color: var(--text-muted);
    font-size: 0.82rem;
    line-height: 1.5;
}

.subscription-plan-card ul {
    margin: 0;
    padding-left: 18px;
}

.admin-user-card {
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--card-bg);
    padding: 12px;
}

.admin-user-main {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    margin-bottom: 10px;
}

.admin-user-avatar {
    width: 42px;
    height: 42px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(79, 70, 229, 0.1);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
}

.admin-user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.admin-user-controls {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr auto;
    gap: 8px;
}

.admin-user-controls select {
    min-width: 0;
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--card-bg);
    color: var(--text-main);
    padding: 9px 10px;
    font-size: 0.82rem;
}

.admin-request-pill {
    display: inline-flex;
    width: fit-content;
    margin-top: 5px;
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(245, 158, 11, 0.12);
    color: #b45309;
    font-size: 0.72rem;
    font-style: normal;
    font-weight: 800;
}

.smart-day-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.smart-day-field-full {
    grid-column: 1 / -1;
}

.smart-day-field label {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-muted);
}

.smart-day-field input,
.smart-day-field select {
    width: 100%;
    padding: 11px 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--card-bg);
    color: var(--text-main);
    font-size: 0.94rem;
}

.smart-day-field input:focus,
.smart-day-field select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

.planner-control-actions-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.smart-warnings {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}

.smart-warning {
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid rgba(245, 158, 11, 0.18);
    background: rgba(245, 158, 11, 0.08);
    color: var(--text-main);
    font-size: 0.84rem;
    line-height: 1.45;
}

.smart-warning.ok {
    border-color: rgba(16, 185, 129, 0.18);
    background: rgba(16, 185, 129, 0.08);
}

.trip-time-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border-radius: 999px;
    background: rgba(59, 130, 246, 0.08);
    color: #1d4ed8;
    font-size: 0.74rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.trip-stay-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(245, 158, 11, 0.1);
    color: #b45309;
    font-size: 0.72rem;
    font-weight: 700;
}

.trip-note-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(59, 130, 246, 0.1);
    color: #1d4ed8;
    font-size: 0.72rem;
    font-weight: 700;
}

.saved-trip-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 12px;
}

.planner-cost-grid-3 {
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
}

.user-avatar {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--card-bg);
    border: 1px solid var(--border);
    flex-shrink: 0;
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.user-avatar-fallback {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1rem;
    color: var(--primary);
    background: rgba(79, 70, 229, 0.12);
}

@media (max-width: 1100px) {
    .map-overlay-dock {
        width: 350px;
        right: 18px;
        top: 18px;
    }
}

@media (max-width: 900px) {
    .map-overlay-dock {
        top: auto;
        right: 12px;
        left: 12px;
        bottom: 12px;
        width: auto;
        max-width: none;
    }

    .planner-control-actions-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {

    .planner-scope-card,
    .planner-more-action-grid {
        grid-template-columns: 1fr;
    }

    .planner-scope-toggle {
        width: 100%;
    }

    .smart-day-grid,
    .account-summary-card,
    .account-usage-grid,
    .admin-plan-grid,
    .admin-user-controls,
    .planner-cost-grid-3 {
        grid-template-columns: 1fr;
    }

    .trip-item {
        align-items: flex-start;
        flex-wrap: wrap;
        gap: 10px;
    }

    .trip-stop-actions {
        width: 100%;
        justify-content: flex-end;
        padding-top: 8px;
        border-top: 1px solid var(--border);
    }
}

@media (max-width: 420px) {
    .trip-stop-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .trip-stop-actions .btn-icon-small,
    .trip-action-chip {
        width: 100%;
        min-height: 38px;
    }
}

/* =========================
   TRAVEL MODE + DESTINATION MEDIA
   ========================= */

.modal-media {
    width: min(880px, calc(100vw - 32px));
}

.media-tab-row {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.media-tab-btn {
    border: 1px solid var(--border);
    background: var(--card-bg);
    color: var(--text-muted);
    border-radius: 999px;
    padding: 9px 14px;
    font-size: 0.84rem;
    font-weight: 700;
    cursor: pointer;
    transition: 0.18s ease;
}

.media-tab-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.media-tab-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.media-tab-panel {
    display: none;
}

.media-tab-panel.active {
    display: block;
}

.media-overview-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}

.media-overview-card {
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 12px;
    background: var(--card-bg);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.media-overview-card span {
    font-size: 0.76rem;
    color: var(--text-muted);
    font-weight: 700;
}

.media-overview-card strong {
    font-size: 0.95rem;
    color: var(--text-main);
}

.media-note-box {
    min-height: 56px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--card-bg);
    padding: 12px;
    color: var(--text-main);
    line-height: 1.5;
}

.media-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.media-card {
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
    background: var(--card-bg);
    box-shadow: var(--shadow-soft);
}

.media-card img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    display: block;
}

.media-card-body {
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.media-caption {
    font-size: 0.84rem;
    color: var(--text-main);
    line-height: 1.4;
}

.media-upload-bar {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 10px;
    margin-bottom: 14px;
}

.trip-note-badge,
.trip-stay-badge,
.trip-category-badge {
    white-space: nowrap;
}

@media (max-width: 820px) {

    .media-overview-grid,
    .media-grid,
    .media-upload-bar {
        grid-template-columns: 1fr;
    }
}

.section-label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.media-pill-row {
    margin-bottom: 14px;
}

.brand-block {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.brand-subtitle {
    margin: 0;
    font-size: 0.86rem;
    color: var(--text-muted);
    line-height: 1.45;
}

.planner-search {
    margin-top: 14px;
}

.search-label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.day-nav-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.footer-note {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.45;
}

.section-label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.transport-mode-toggle {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 6px;
}

.transport-mode-btn {
    border: 1px solid var(--border);
    background: var(--card-bg);
    color: var(--text-muted);
    border-radius: 14px;
    padding: 12px 14px;
    font-size: 0;
    font-weight: 700;
    cursor: pointer;
    transition: 0.18s ease;
}

.transport-mode-btn::after {
    content: attr(aria-label);
    font-size: 0.92rem;
}

.transport-mode-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-1px);
}

.transport-mode-btn.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    box-shadow: 0 8px 16px rgba(79, 70, 229, 0.18);
}

.hidden-native-select {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* =========================
   RESIZABLE PLANNER + HOURS
   ========================= */

.planner-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 6px;
}

.planner-label-row label {
    margin-bottom: 0;
}

.inline-tool-btn {
    border: 1px solid var(--border);
    background: var(--card-bg);
    color: var(--primary);
    border-radius: 10px;
    padding: 7px 10px;
    font-size: 0.78rem;
    font-weight: 800;
    cursor: pointer;
    white-space: nowrap;
}

.inline-tool-btn:hover {
    border-color: var(--primary);
    background: rgba(79, 70, 229, 0.08);
}

.inline-tool-btn:disabled {
    opacity: 0.55;
    cursor: wait;
}

.planner-section textarea {
    width: 100%;
    min-height: 104px;
    max-height: 220px;
    resize: vertical;
    padding: 12px 13px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--card-bg);
    color: var(--text-main);
    font-size: 0.92rem;
    line-height: 1.45;
    transition: all 0.2s ease;
}

.planner-section textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

.field-hint {
    margin-top: 7px;
    color: var(--text-muted);
    font-size: 0.78rem;
    line-height: 1.4;
}

.trip-opening-badge {
    display: inline-flex;
    align-items: center;
    max-width: 100%;
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(20, 184, 166, 0.1);
    color: #0f766e;
    font-size: 0.72rem;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.trip-opening-badge.muted {
    background: var(--surface-muted);
    color: var(--text-muted);
}

.saved-place-hours {
    display: block;
    margin-top: 3px;
    color: #0f766e;
    font-size: 0.78rem;
    font-weight: 700;
}

[data-theme="dark"] .trip-opening-badge {
    color: #5eead4;
    background: rgba(20, 184, 166, 0.16);
}

[data-theme="dark"] .saved-place-hours {
    color: #5eead4;
}

[data-theme="dark"] .trip-opening-badge.muted {
    color: var(--text-muted);
    background: var(--surface-muted);
}

.opening-hours-list {
    display: grid;
    gap: 5px;
}

.currency-panel {
    margin: 12px 0;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface-soft);
}

.currency-grid {
    margin: 0;
}

.opening-hours-toggle {
    margin: 10px 0 14px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--card-bg);
}

.media-section-header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
    color: var(--text-main);
}

.media-section-header span,
.media-card-meta {
    display: block;
    margin-top: 3px;
    color: var(--text-muted);
    font-size: 0.78rem;
}

.media-upload-panel {
    display: grid;
    grid-template-columns: minmax(150px, 0.9fr) minmax(160px, 1fr) auto;
    gap: 10px;
    align-items: center;
    margin-bottom: 14px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--surface-soft);
}

.media-file-drop {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    min-height: 54px;
    padding: 10px 12px;
    border: 1px dashed var(--border-strong);
    border-radius: 12px;
    background: var(--card-bg);
    color: var(--text-main);
    cursor: pointer;
    font-weight: 800;
}

.media-file-drop small {
    color: var(--text-muted);
    font-weight: 600;
}

.media-upload-panel input[type="file"] {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.media-upload-panel input[type="text"] {
    width: 100%;
    min-height: 44px;
    padding: 11px 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--card-bg);
    color: var(--text-main);
}

.media-upload-panel .field-hint {
    grid-column: 1 / -1;
    margin-top: 0;
}

.media-card-button {
    width: 100%;
    padding: 0;
    text-align: left;
    cursor: pointer;
}

.media-card-interactive {
    cursor: pointer;
}

.media-card {
    position: relative;
}

.media-card-overlay {
    position: absolute;
    right: 10px;
    top: 10px;
    padding: 5px 8px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.72);
    color: #fff;
    font-size: 0.74rem;
    font-weight: 800;
    opacity: 0;
    transition: opacity 0.18s ease;
}

.media-card:hover .media-card-overlay {
    opacity: 1;
}

.media-pager {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    min-height: 34px;
    margin-top: 12px;
    color: var(--text-muted);
    font-size: 0.84rem;
    font-weight: 700;
}

.media-page-btn {
    border: 1px solid var(--border);
    background: var(--card-bg);
    color: var(--text-main);
    border-radius: 10px;
    padding: 7px 10px;
    cursor: pointer;
    font-weight: 800;
}

.media-page-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.modal-image-viewer {
    width: min(980px, calc(100vw - 28px));
}

.image-viewer-stage {
    display: grid;
    grid-template-columns: 48px 1fr 48px;
    align-items: center;
    gap: 12px;
}

.image-viewer-stage img {
    width: 100%;
    max-height: 72vh;
    object-fit: contain;
    border-radius: 16px;
    background: #020617;
}

.image-nav-btn {
    width: 44px;
    height: 44px;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: var(--card-bg);
    color: var(--text-main);
    font-size: 1.6rem;
    cursor: pointer;
}

.image-nav-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.empty-state.compact {
    padding: 10px;
    text-align: left;
}

.onboarding-empty {
    display: grid;
    gap: 10px;
    justify-items: start;
    text-align: left;
    border-style: solid;
    border-color: rgba(139, 92, 246, 0.24);
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.1), rgba(20, 184, 166, 0.08));
}

.onboarding-empty strong {
    color: var(--text-main);
    font-size: 1rem;
}

.onboarding-empty span,
.onboarding-empty small {
    color: var(--text-muted);
    line-height: 1.45;
}

.trip-item {
    align-items: flex-start;
    min-width: 0;
}

.trip-item>div:nth-child(2) {
    min-width: 0;
}

.day-tabs-scroll {
    flex: 1;
    max-width: none;
    min-width: 0;
}

.card-actions,
.saved-trip-actions {
    flex-wrap: wrap;
}

.place-card {
    gap: 12px;
    align-items: flex-start;
}

@media (max-width: 420px) {
    .planner-label-row {
        align-items: flex-start;
        flex-direction: column;
    }

    .inline-tool-btn {
        width: 100%;
    }
}

@media (max-width: 820px) {
    .media-upload-panel,
    .image-viewer-stage {
        grid-template-columns: 1fr;
    }

    .image-nav-btn {
        justify-self: center;
    }
}

/* =========================
   ACCOUNT / ADMIN PORTAL PAGES
   ========================= */

.portal-body {
    overflow: auto;
    min-height: 100vh;
    padding: 28px;
}

.portal-shell {
    width: min(1180px, 100%);
    margin: 0 auto;
}

.portal-shell.wide {
    width: min(1380px, 100%);
}

.portal-topbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-bottom: 18px;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: var(--surface-strong);
    box-shadow: var(--shadow-soft);
}

.portal-topbar a,
.portal-topbar button {
    color: var(--text-muted);
    text-decoration: none;
    padding: 10px 13px;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 800;
    border: none;
    background: transparent;
    cursor: pointer;
}

.portal-topbar a:hover,
.portal-topbar a.active,
.portal-topbar button:hover {
    color: var(--primary);
    background: rgba(79, 70, 229, 0.1);
}

.portal-hero {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: flex-end;
    margin-bottom: 18px;
    padding: 24px;
    border: 1px solid var(--border);
    border-radius: 24px;
    background: var(--surface-strong);
    box-shadow: var(--shadow);
}

.portal-hero span,
.portal-card-header span {
    display: block;
    color: var(--primary);
    font-size: 0.78rem;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 6px;
}

.portal-hero h1,
.portal-card-header h2 {
    margin: 0;
    color: var(--text-main);
}

.portal-hero h1 {
    font-size: clamp(1.7rem, 4vw, 2.8rem);
    letter-spacing: 0;
}

.portal-hero p,
.portal-card-header p,
.portal-plan-card p {
    margin: 8px 0 0;
    color: var(--text-muted);
    line-height: 1.55;
}

.portal-hero-actions,
.portal-inline-actions,
.portal-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.portal-hero-actions input,
.portal-filters input,
.portal-filters select,
.portal-card-header select,
.portal-table select {
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--card-bg);
    color: var(--text-main);
    padding: 11px 12px;
}

.portal-grid {
    display: grid;
    gap: 18px;
}

.portal-grid.two {
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
}

.portal-grid.dashboard-grid {
    grid-template-columns: minmax(260px, 0.75fr) minmax(320px, 1fr) minmax(360px, 1.15fr);
}

.portal-card {
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: 22px;
    background: var(--surface-strong);
    box-shadow: var(--shadow-soft);
}

.portal-card-header {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: flex-start;
    margin-bottom: 16px;
}

.portal-stat-grid,
.portal-metric-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}

.portal-stat-grid > div,
.portal-metric-card,
.portal-detail-header > div {
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--card-bg);
}

.portal-stat-grid span,
.portal-metric-card span,
.portal-usage-row span,
.portal-detail-header span {
    display: block;
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 5px;
}

.portal-stat-grid strong,
.portal-metric-card strong,
.portal-usage-row strong,
.portal-detail-header strong {
    color: var(--text-main);
    text-transform: capitalize;
}

.portal-usage-list,
.portal-plan-grid {
    display: grid;
    gap: 10px;
}

.portal-usage-row,
.portal-plan-card {
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--card-bg);
}

.portal-usage-row > div:first-child,
.portal-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.portal-usage-row small {
    color: var(--text-muted);
    display: block;
    margin-top: 6px;
}

.portal-progress {
    height: 8px;
    overflow: hidden;
    border-radius: 999px;
    background: var(--surface-soft);
}

.portal-progress span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--primary), var(--success));
}

.portal-plan-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.portal-plan-card {
    display: grid;
    gap: 12px;
    align-content: start;
    padding: 16px;
    border-radius: 18px;
}

.portal-plan-card.active {
    border-color: rgba(79, 70, 229, 0.4);
    box-shadow: 0 14px 28px rgba(79, 70, 229, 0.12);
}

.portal-plan-card span {
    color: var(--text-main);
    font-size: 1.05rem;
    font-weight: 900;
}

.portal-plan-card strong {
    color: var(--primary);
}

.portal-plan-card ul {
    margin: 0;
    padding-left: 18px;
    color: var(--text-muted);
    line-height: 1.7;
}

.portal-filters {
    margin-bottom: 14px;
}

.portal-filters input {
    flex: 1 1 260px;
}

.portal-table-wrap {
    overflow-x: auto;
}

.portal-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 1120px;
}

.portal-table th,
.portal-table td {
    padding: 12px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
}

.portal-table th {
    color: var(--text-muted);
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.portal-table td > span {
    display: block;
    color: var(--text-muted);
    margin-top: 3px;
}

.portal-status {
    display: inline-flex;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 800;
}

.portal-status.warn {
    background: rgba(245, 158, 11, 0.13);
    color: #b45309;
}

.portal-status.muted {
    background: var(--surface-soft);
    color: var(--text-muted);
}

.portal-detail-header {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 12px;
}

@media (max-width: 900px) {
    .portal-body {
        padding: 16px;
    }

    .portal-hero,
    .portal-card-header {
        display: block;
    }

    .portal-hero-actions {
        margin-top: 16px;
    }

    .portal-grid.two,
    .portal-grid.dashboard-grid,
    .portal-detail-header {
        grid-template-columns: 1fr;
    }
}

/* =========================
   ADMIN CONTROL CENTER
   ========================= */

.portal-body {
    background: #f6f8fb;
    background-image: none;
    color: #172033;
    padding: 0;
}

.admin-app {
    display: grid;
    grid-template-columns: 264px minmax(0, 1fr);
    min-height: 100vh;
}

.admin-rail {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 22px;
    padding: 22px;
    border-right: 1px solid #dfe5ef;
    background: #ffffff;
}

.admin-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 18px;
    border-bottom: 1px solid #edf1f7;
}

.admin-brand-mark,
.admin-user-avatar,
.account-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    color: #ffffff;
    background: #2563eb;
    font-weight: 900;
}

.admin-brand-mark {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    font-size: 0.82rem;
}

.admin-brand strong,
.admin-rail-footer strong {
    display: block;
    color: #111827;
}

.admin-brand small,
.admin-rail-footer span,
.admin-rail-footer small {
    color: #667085;
    font-size: 0.78rem;
}

.admin-nav {
    display: grid;
    gap: 6px;
}

.admin-nav a,
.admin-rail-footer button {
    display: flex;
    align-items: center;
    min-height: 42px;
    padding: 0 12px;
    border: 0;
    border-radius: 10px;
    color: #475467;
    background: transparent;
    text-decoration: none;
    font-weight: 800;
    cursor: pointer;
}

.admin-nav a:hover,
.admin-nav a.active {
    color: #1d4ed8;
    background: #eef5ff;
}

.admin-rail-footer {
    margin-top: auto;
    padding: 14px;
    border: 1px solid #e4e9f2;
    border-radius: 12px;
    background: #f8fafc;
}

.admin-rail-footer button {
    width: 100%;
    justify-content: center;
    margin-top: 12px;
    color: #b42318;
    background: #fff4f3;
}

.admin-main {
    min-width: 0;
    padding: 30px;
}

.admin-page-head,
.admin-card,
.admin-metric-card {
    border: 1px solid #e1e7f0;
    background: #ffffff;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.06);
}

.admin-page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 20px;
    padding: 24px;
    border-radius: 14px;
}

.admin-page-head h1,
.admin-card h2,
.account-profile-card h2 {
    margin: 0;
    color: #111827;
    letter-spacing: 0;
}

.admin-page-head h1 {
    font-size: 2rem;
}

.admin-page-head p,
.admin-card-head p,
.account-profile-card p,
.admin-plan-card p {
    margin: 8px 0 0;
    color: #667085;
    line-height: 1.55;
}

.admin-eyebrow {
    display: block;
    margin-bottom: 7px;
    color: #2563eb;
    font-size: 0.76rem;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.admin-page-actions,
.admin-inline-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.admin-page-actions input,
.admin-card-head select,
.admin-filter-grid input,
.admin-filter-grid select,
.admin-control {
    min-height: 40px;
    border: 1px solid #d4dbe8;
    border-radius: 10px;
    background: #ffffff;
    color: #172033;
    padding: 9px 11px;
}

.admin-grid {
    display: grid;
    gap: 18px;
    margin-bottom: 18px;
}

.account-layout {
    grid-template-columns: minmax(300px, 0.85fr) minmax(360px, 1.15fr);
}

.dashboard-primary-grid {
    grid-template-columns: minmax(360px, 1fr) minmax(320px, 0.8fr);
}

.dashboard-command-grid {
    grid-template-columns: minmax(560px, 1.35fr) minmax(320px, 0.65fr);
}

.dashboard-secondary-grid {
    grid-template-columns: minmax(360px, 0.9fr) minmax(460px, 1.1fr);
}

.dashboard-chart-grid {
    grid-template-columns: minmax(520px, 1.2fr) minmax(360px, 0.8fr);
}

.dashboard-user-detail-grid {
    grid-template-columns: minmax(0, 1fr);
}

.admin-card {
    padding: 18px;
    border-radius: 14px;
}

.admin-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.sticky-head {
    position: sticky;
    top: 0;
    z-index: 2;
    margin: -18px -18px 16px;
    padding: 18px;
    border-bottom: 1px solid #e7ecf4;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(14px);
}

.admin-metric-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

.admin-metric-grid.compact {
    grid-template-columns: repeat(4, minmax(170px, 1fr));
}

.admin-metric-card {
    min-height: 108px;
    padding: 16px;
    border-radius: 14px;
}

.admin-metric-card span,
.admin-usage-copy span,
.admin-detail-grid span,
.account-plan-strip span {
    display: block;
    color: #667085;
    font-size: 0.74rem;
    font-weight: 900;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.admin-metric-card strong {
    display: block;
    margin-top: 8px;
    color: #111827;
    font-size: 1.75rem;
    letter-spacing: 0;
}

.admin-metric-card small,
.admin-usage-row small,
.admin-action-item small,
.admin-activity span {
    color: #667085;
    font-size: 0.8rem;
}

.account-profile-card {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 16px;
}

.account-avatar {
    width: 58px;
    height: 58px;
    border-radius: 14px;
}

.account-plan-strip {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.account-plan-strip > div,
.admin-detail-grid > div {
    padding: 14px;
    border: 1px solid #e4e9f2;
    border-radius: 12px;
    background: #f8fafc;
}

.account-plan-strip strong,
.admin-detail-grid strong {
    display: block;
    margin-top: 5px;
    color: #111827;
    text-transform: capitalize;
}

.admin-usage-list,
.admin-action-list,
.admin-plan-grid {
    display: grid;
    gap: 12px;
}

.admin-usage-row {
    padding: 13px;
    border: 1px solid #e4e9f2;
    border-radius: 12px;
    background: #ffffff;
}

.admin-usage-copy {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: center;
}

.admin-usage-copy strong {
    color: #111827;
}

.admin-progress {
    height: 8px;
    margin-top: 10px;
    overflow: hidden;
    border-radius: 999px;
    background: #edf2f7;
}

.admin-progress span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #2563eb, #14b8a6);
}

.admin-action-item {
    display: grid;
    gap: 5px;
    padding: 14px;
    border: 1px solid #e4e9f2;
    border-radius: 12px;
    color: inherit;
    text-decoration: none;
    background: #f8fafc;
}

.admin-action-item:hover {
    border-color: #bfdbfe;
    background: #eff6ff;
}

.admin-action-item span {
    color: #2563eb;
    font-size: 0.76rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.admin-action-item strong {
    color: #111827;
}

.admin-plan-grid {
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}

.admin-plan-card {
    display: grid;
    gap: 14px;
    align-content: start;
    padding: 18px;
    border: 1px solid #e4e9f2;
    border-radius: 14px;
    background: #ffffff;
}

.admin-plan-card.active {
    border-color: #93c5fd;
    box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.14), 0 16px 32px rgba(37, 99, 235, 0.1);
}

.admin-plan-top {
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.admin-plan-card span {
    color: #111827;
    font-weight: 900;
}

.admin-plan-card strong {
    display: block;
    margin-top: 4px;
    color: #2563eb;
    font-size: 1.15rem;
}

.admin-plan-card em,
.admin-pill {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    min-height: 26px;
    padding: 0 9px;
    border-radius: 999px;
    font-size: 0.74rem;
    font-style: normal;
    font-weight: 900;
}

.admin-plan-card em {
    color: #065f46;
    background: #ecfdf3;
}

.admin-plan-card ul {
    margin: 0;
    padding-left: 18px;
    color: #475467;
    line-height: 1.7;
}

.admin-owner-card {
    grid-template-columns: minmax(0, 1fr);
}

.admin-filter-grid {
    display: grid;
    grid-template-columns: minmax(220px, 1.3fr) repeat(3, minmax(130px, 0.75fr)) auto;
    gap: 10px;
    width: min(760px, 100%);
}

.admin-table-wrap {
    overflow-x: auto;
}

.admin-table {
    width: 100%;
    min-width: 1180px;
    border-collapse: collapse;
}

.admin-table th,
.admin-table td {
    padding: 14px 12px;
    border-bottom: 1px solid #edf1f7;
    text-align: left;
    vertical-align: top;
}

.admin-table th {
    color: #667085;
    font-size: 0.72rem;
    font-weight: 900;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    background: #fbfcfe;
}

.admin-table tr:hover td {
    background: #fbfdff;
}

.admin-user-cell {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 230px;
}

.admin-user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    font-size: 0.78rem;
}

.admin-user-cell strong,
.admin-user-cell span {
    display: block;
}

.admin-user-cell span {
    margin-top: 3px;
    color: #667085;
    font-size: 0.84rem;
}

.admin-control {
    min-width: 126px;
}

.admin-pill.warning {
    color: #92400e;
    background: #fffbeb;
}

.admin-pill.muted {
    color: #667085;
    background: #f2f4f7;
}

.admin-pill.success {
    color: #067647;
    background: #ecfdf3;
}

.admin-request-stack {
    display: grid;
    gap: 8px;
    justify-items: start;
}

.admin-chip-group {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    min-width: 150px;
}

.admin-chip-group span {
    padding: 5px 8px;
    border-radius: 999px;
    color: #344054;
    background: #f2f4f7;
    font-size: 0.76rem;
    font-weight: 800;
}

.admin-table .admin-usage-row {
    min-width: 190px;
    padding: 0;
    border: 0;
    background: transparent;
}

.admin-activity {
    display: grid;
    gap: 5px;
    min-width: 170px;
}

.admin-pagination {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 14px;
}

.admin-pagination span {
    color: #667085;
    font-weight: 800;
}

.admin-detail-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.admin-empty,
.admin-loading {
    padding: 18px;
    border: 1px dashed #cbd5e1;
    border-radius: 12px;
    color: #667085;
    background: #f8fafc;
    text-align: center;
}

.admin-chart svg {
    display: block;
    width: 100%;
    height: auto;
    min-height: 220px;
}

.chart-grid-line {
    fill: none;
    stroke: #d8e0ec;
    stroke-width: 1;
}

.chart-area {
    fill: rgba(37, 99, 235, 0.09);
    stroke: none;
}

.chart-line {
    fill: none;
    stroke: #2563eb;
    stroke-width: 4;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.admin-chart circle {
    fill: #ffffff;
    stroke: #2563eb;
    stroke-width: 3;
}

.chart-caption {
    display: flex;
    justify-content: space-between;
    color: #667085;
    font-size: 0.78rem;
    font-weight: 800;
}

.admin-bar-chart {
    display: grid;
    gap: 12px;
}

.admin-bar-row {
    display: grid;
    grid-template-columns: minmax(120px, 0.8fr) minmax(120px, 1fr) auto;
    gap: 12px;
    align-items: center;
}

.admin-bar-row span {
    color: #475467;
    font-size: 0.82rem;
    font-weight: 800;
    text-transform: capitalize;
}

.admin-bar-row div {
    height: 10px;
    overflow: hidden;
    border-radius: 999px;
    background: #edf2f7;
}

.admin-bar-row i {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: #2563eb;
}

.admin-bar-row strong {
    color: #111827;
    font-size: 0.86rem;
}

.payment-list {
    display: grid;
    gap: 10px;
}

.payment-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 10px;
    align-items: center;
    padding: 12px;
    border: 1px solid #e4e9f2;
    border-radius: 12px;
    background: #ffffff;
}

.payment-row strong,
.payment-row span {
    display: block;
}

.payment-row span {
    margin-top: 3px;
    color: #667085;
    font-size: 0.8rem;
}

.payment-row em {
    color: #111827;
    font-style: normal;
    font-weight: 900;
}

.package-editor-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(330px, 1fr));
    gap: 18px;
}

.package-editor-card,
.checkout-card,
.gateway-card {
    padding: 18px;
    border: 1px solid #e1e7f0;
    border-radius: 14px;
    background: #ffffff;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.06);
}

.package-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.package-form-grid label,
.feature-gate-grid label,
.admin-switch {
    display: grid;
    gap: 6px;
    color: #344054;
    font-size: 0.78rem;
    font-weight: 900;
}

.package-form-grid label.wide {
    grid-column: 1 / -1;
}

.package-form-grid input,
.package-form-grid textarea {
    width: 100%;
    min-height: 40px;
    border: 1px solid #d4dbe8;
    border-radius: 10px;
    padding: 9px 11px;
    color: #172033;
    background: #ffffff;
}

.package-form-grid textarea {
    min-height: 92px;
    resize: vertical;
}

.feature-gate-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin: 16px 0;
}

.token-weight-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 10px;
}

.token-weight-grid div {
    padding: 12px;
    border: 1px solid #e4e9f2;
    border-radius: 12px;
    background: #f8fafc;
}

.token-weight-grid span,
.token-weight-grid strong {
    display: block;
}

.token-weight-grid span {
    color: #667085;
    font-size: 0.76rem;
    font-weight: 900;
    text-transform: capitalize;
}

.token-weight-grid strong {
    margin-top: 5px;
    color: #111827;
}

.feature-gate-grid label,
.admin-switch {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px;
    border: 1px solid #e4e9f2;
    border-radius: 10px;
    background: #f8fafc;
}

.admin-inline-input {
    min-height: 42px;
    border: 1px solid #d4dbe8;
    border-radius: 12px;
    padding: 9px 12px;
    color: #172033;
    background: #ffffff;
    font-weight: 800;
}

.admin-inline-input.compact {
    width: 112px;
}

.package-tier-card {
    display: grid;
    gap: 16px;
}

.package-tier-head,
.package-section-title,
.package-price-strip {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
}

.package-tier-head h2,
.package-tier-head p {
    margin: 0;
}

.package-tier-head p {
    margin-top: 5px;
    color: #667085;
    line-height: 1.45;
}

.package-price-strip {
    align-items: center;
    padding: 14px;
    border: 1px solid #e4e9f2;
    border-radius: 14px;
    background: linear-gradient(135deg, #eef4ff, #ecfdf5);
}

.package-price-strip strong {
    color: #111827;
    font-size: 1.25rem;
}

.package-price-strip span,
.package-section-title small {
    color: #667085;
    font-size: 0.78rem;
    font-weight: 800;
}

.package-section-title {
    align-items: baseline;
    padding-top: 4px;
    border-top: 1px solid #edf1f7;
}

.package-section-title span {
    color: #111827;
    font-weight: 900;
}

.package-identity-grid {
    padding-bottom: 4px;
}

.package-limit-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 10px;
}

.package-limit-grid label {
    display: grid;
    gap: 6px;
    padding: 10px;
    border: 1px solid #e4e9f2;
    border-radius: 12px;
    background: #f8fafc;
    color: #344054;
    font-size: 0.76rem;
    font-weight: 900;
}

.package-limit-grid input {
    width: 100%;
    min-height: 38px;
    border: 1px solid #d4dbe8;
    border-radius: 10px;
    padding: 8px 10px;
    color: #172033;
    background: #ffffff;
}

.cost-note-list {
    display: grid;
    gap: 10px;
}

.cost-note-list div {
    padding: 12px;
    border: 1px solid #e4e9f2;
    border-radius: 12px;
    background: #f8fafc;
    color: #475467;
    font-size: 0.88rem;
    line-height: 1.5;
}

.api-cost-name strong,
.api-cost-name span {
    display: block;
}

.api-cost-name span {
    margin-top: 3px;
    color: #667085;
    font-size: 0.78rem;
}

.gateway-steps {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.gateway-steps div,
.checkout-provider-box {
    padding: 14px;
    border: 1px solid #e4e9f2;
    border-radius: 12px;
    background: #f8fafc;
}

.gateway-steps span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    margin-bottom: 10px;
    border-radius: 999px;
    color: #ffffff;
    background: #2563eb;
    font-weight: 900;
}

.gateway-steps strong,
.gateway-steps small,
.checkout-provider-box span,
.checkout-provider-box strong,
.checkout-provider-box p,
.checkout-summary strong {
    display: block;
}

.gateway-steps small,
.checkout-provider-box p {
    margin-top: 5px;
    color: #667085;
}

.checkout-main {
    max-width: 920px;
}

.checkout-card {
    display: grid;
    gap: 16px;
}

.checkout-summary h2 {
    margin: 0;
}

.checkout-summary strong {
    margin-top: 8px;
    color: #2563eb;
    font-size: 1.35rem;
}

.checkout-summary ul {
    margin: 12px 0 0;
    color: #475467;
    line-height: 1.7;
}

.legal-page {
    min-height: 100vh;
}

.legal-shell {
    width: min(920px, calc(100% - 32px));
    margin: 0 auto;
    padding: 48px 0;
}

.legal-back-link {
    display: inline-flex;
    margin-bottom: 16px;
    color: #c7d2fe;
    font-size: 0.86rem;
    font-weight: 900;
    text-decoration: none;
}

.legal-card {
    display: grid;
    gap: 24px;
    padding: 32px;
}

.legal-card h1 {
    margin: -12px 0 0;
    color: #f8fafc;
    font-size: clamp(2rem, 4vw, 3.2rem);
    line-height: 1;
}

.legal-card h2 {
    margin: 0 0 8px;
    color: #e2e8f0;
    font-size: 1rem;
}

.legal-card p {
    margin: 0;
    color: #b6c2d5;
    line-height: 1.7;
}

.legal-updated {
    color: #93c5fd !important;
    font-weight: 800;
}

.portal-body {
    background:
        radial-gradient(circle at 12% 0%, rgba(99, 102, 241, 0.2), transparent 32%),
        radial-gradient(circle at 88% 10%, rgba(20, 184, 166, 0.16), transparent 30%),
        linear-gradient(135deg, #08111f 0%, #111827 48%, #1e1b4b 100%);
    color: #e5eefb;
}

.admin-rail,
.admin-page-head,
.admin-card,
.admin-metric-card,
.package-editor-card,
.checkout-card,
.gateway-card {
    border-color: rgba(148, 163, 184, 0.16);
    background: rgba(15, 23, 42, 0.74);
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.34);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.admin-rail {
    border-right-color: rgba(148, 163, 184, 0.16);
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.92), rgba(30, 41, 59, 0.78));
}

.admin-brand {
    border-bottom-color: rgba(148, 163, 184, 0.16);
}

.admin-brand-mark,
.admin-user-avatar,
.account-avatar,
.gateway-steps span {
    background: linear-gradient(135deg, #6366f1, #8b5cf6 58%, #14b8a6);
    box-shadow: 0 10px 22px rgba(99, 102, 241, 0.28);
}

.admin-brand strong,
.admin-rail-footer strong,
.admin-page-head h1,
.admin-card h2,
.account-profile-card h2,
.admin-metric-card strong,
.account-plan-strip strong,
.admin-detail-grid strong,
.admin-usage-copy strong,
.admin-action-item strong,
.admin-plan-card span,
.admin-user-cell strong,
.admin-bar-row strong,
.payment-row em,
.token-weight-grid strong,
.checkout-summary h2 {
    color: #f8fafc;
}

.admin-brand small,
.admin-rail-footer span,
.admin-rail-footer small,
.admin-page-head p,
.admin-card-head p,
.account-profile-card p,
.admin-plan-card p,
.admin-metric-card span,
.admin-metric-card small,
.admin-usage-copy span,
.admin-usage-row small,
.admin-detail-grid span,
.account-plan-strip span,
.admin-action-item small,
.admin-activity span,
.admin-user-cell span,
.admin-table th,
.admin-pagination span,
.admin-bar-row span,
.payment-row span,
.gateway-steps small,
.checkout-provider-box p,
.checkout-summary ul,
.token-weight-grid span {
    color: #94a3b8;
}

.admin-eyebrow,
.admin-action-item span,
.checkout-summary strong,
.admin-plan-card strong {
    color: #a5b4fc;
}

.admin-nav a,
.admin-rail-footer button {
    color: #cbd5e1;
}

.admin-nav a:hover,
.admin-nav a.active {
    color: #ffffff;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.22), rgba(20, 184, 166, 0.12));
}

.admin-rail-footer,
.account-plan-strip > div,
.admin-detail-grid > div,
.admin-usage-row,
.admin-action-item,
.admin-plan-card,
.admin-empty,
.admin-loading,
.gateway-steps div,
.checkout-provider-box,
.token-weight-grid div {
    border-color: rgba(148, 163, 184, 0.16);
    background: rgba(15, 23, 42, 0.52);
}

.admin-rail-footer button {
    color: #fecaca;
    background: rgba(239, 68, 68, 0.1);
}

.admin-page-actions input,
.admin-card-head select,
.admin-filter-grid input,
.admin-filter-grid select,
.admin-control,
.package-form-grid input,
.package-form-grid textarea {
    border-color: rgba(148, 163, 184, 0.2);
    background: rgba(15, 23, 42, 0.8);
    color: #f8fafc;
}

.admin-page-actions input::placeholder,
.admin-filter-grid input::placeholder,
.package-form-grid input::placeholder,
.package-form-grid textarea::placeholder {
    color: #64748b;
}

.sticky-head {
    border-bottom-color: rgba(148, 163, 184, 0.16);
    background: rgba(15, 23, 42, 0.9);
}

.admin-filter-grid {
    grid-template-columns: minmax(220px, 1.4fr) repeat(4, minmax(125px, 0.78fr)) auto;
    width: min(980px, 100%);
}

.admin-table th {
    background: rgba(15, 23, 42, 0.72);
}

.admin-table td,
.admin-table th {
    border-bottom-color: rgba(148, 163, 184, 0.12);
}

.admin-table tr:hover td {
    background: rgba(99, 102, 241, 0.08);
}

.admin-chip-group span,
.admin-pill.muted {
    color: #cbd5e1;
    background: rgba(148, 163, 184, 0.12);
}

.admin-pill.warning {
    color: #fbbf24;
    background: rgba(245, 158, 11, 0.14);
}

.admin-pill.success,
.admin-plan-card em {
    color: #5eead4;
    background: rgba(20, 184, 166, 0.14);
}

.admin-progress,
.admin-bar-row div {
    background: rgba(148, 163, 184, 0.16);
}

.admin-progress span,
.admin-bar-row i {
    background: linear-gradient(90deg, #22c55e, #14b8a6);
}

.admin-progress.progress-warning span {
    background: linear-gradient(90deg, #f59e0b, #facc15);
}

.admin-progress.progress-danger span {
    background: linear-gradient(90deg, #ef4444, #f97316);
}

.usage-warning {
    border-color: rgba(245, 158, 11, 0.26);
}

.usage-danger {
    border-color: rgba(239, 68, 68, 0.3);
}

.chart-grid-line {
    stroke: rgba(148, 163, 184, 0.2);
}

.chart-area {
    fill: rgba(139, 92, 246, 0.15);
}

.chart-line {
    stroke: #a78bfa;
}

.admin-chart circle {
    fill: #111827;
    stroke: #a78bfa;
}

.payment-row {
    border-color: rgba(148, 163, 184, 0.16);
    background: rgba(15, 23, 42, 0.52);
}

.feature-gate-grid label,
.admin-switch {
    border-color: rgba(148, 163, 184, 0.16);
    background: rgba(15, 23, 42, 0.45);
    color: #cbd5e1;
}

.admin-inline-input,
.package-limit-grid input {
    color: #e2e8f0;
    background: rgba(15, 23, 42, 0.72);
    border-color: rgba(148, 163, 184, 0.2);
}

.package-tier-head p,
.package-price-strip span,
.package-section-title small,
.api-cost-name span {
    color: #94a3b8;
}

.package-price-strip,
.package-limit-grid label,
.cost-note-list div {
    border-color: rgba(148, 163, 184, 0.16);
    background: rgba(15, 23, 42, 0.45);
    color: #cbd5e1;
}

.package-price-strip strong,
.package-section-title span,
.api-cost-name strong {
    color: #f8fafc;
}

.package-section-title {
    border-top-color: rgba(148, 163, 184, 0.14);
}

.admin-theme-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.55);
    color: #e2e8f0;
    font-weight: 800;
    cursor: pointer;
}

.admin-theme-toggle span {
    width: 28px;
    height: 16px;
    border-radius: 999px;
    background: linear-gradient(135deg, #6366f1, #14b8a6);
    box-shadow: 0 0 18px rgba(99, 102, 241, 0.35);
}

.admin-theme-toggle strong {
    font-size: 0.78rem;
}

.portal-body.portal-light {
    color: #172033;
    background:
        radial-gradient(circle at top left, rgba(59, 130, 246, 0.16), transparent 36%),
        radial-gradient(circle at 85% 5%, rgba(20, 184, 166, 0.14), transparent 30%),
        linear-gradient(135deg, #f8fbff 0%, #eef4ff 47%, #f6fbff 100%);
}

.portal-body.portal-light .admin-rail,
.portal-body.portal-light .admin-page-head,
.portal-body.portal-light .admin-card,
.portal-body.portal-light .admin-metric-card,
.portal-body.portal-light .package-editor-card,
.portal-body.portal-light .checkout-card,
.portal-body.portal-light .gateway-card {
    background: rgba(255, 255, 255, 0.82);
    border-color: rgba(148, 163, 184, 0.28);
    color: #172033;
    box-shadow: 0 22px 55px rgba(15, 23, 42, 0.12);
}

.portal-body.portal-light .admin-brand strong,
.portal-body.portal-light .admin-page-head h1,
.portal-body.portal-light .admin-card h2,
.portal-body.portal-light .admin-metric-card strong,
.portal-body.portal-light .admin-plan-card strong,
.portal-body.portal-light .checkout-card h2,
.portal-body.portal-light .admin-table strong,
.portal-body.portal-light .admin-detail-grid strong,
.portal-body.portal-light .package-editor-card h2 {
    color: #0f172a;
}

.portal-body.portal-light .admin-brand small,
.portal-body.portal-light .admin-page-head p,
.portal-body.portal-light .admin-card p,
.portal-body.portal-light .admin-metric-card span,
.portal-body.portal-light .admin-metric-card small,
.portal-body.portal-light .admin-plan-card p,
.portal-body.portal-light .admin-plan-card li,
.portal-body.portal-light .admin-table td,
.portal-body.portal-light .admin-activity,
.portal-body.portal-light .admin-rail-footer,
.portal-body.portal-light .admin-usage-row small,
.portal-body.portal-light .payment-row span {
    color: #475569;
}

.portal-body.portal-light .admin-nav a,
.portal-body.portal-light .admin-rail-footer button,
.portal-body.portal-light .admin-theme-toggle {
    color: #334155;
    background: rgba(255, 255, 255, 0.68);
    border-color: rgba(148, 163, 184, 0.28);
}

.portal-body.portal-light .admin-nav a:hover,
.portal-body.portal-light .admin-nav a.active {
    color: #1d4ed8;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.16), rgba(20, 184, 166, 0.1));
    border-color: rgba(59, 130, 246, 0.22);
}

.portal-body.portal-light .admin-table th,
.portal-body.portal-light .admin-eyebrow {
    color: #2563eb;
}

.portal-body.portal-light .admin-table td,
.portal-body.portal-light .admin-table th {
    border-bottom-color: rgba(148, 163, 184, 0.22);
}

.portal-body.portal-light .admin-table tr:hover td {
    background: rgba(59, 130, 246, 0.07);
}

.portal-body.portal-light .admin-filter-grid input,
.portal-body.portal-light .admin-filter-grid select,
.portal-body.portal-light .admin-control,
.portal-body.portal-light .package-form-grid input,
.portal-body.portal-light .package-form-grid textarea,
.portal-body.portal-light .package-limit-grid input,
.portal-body.portal-light .admin-inline-input,
.portal-body.portal-light .checkout-card input,
.portal-body.portal-light .checkout-card select {
    color: #0f172a;
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(148, 163, 184, 0.36);
}

.portal-body.portal-light .admin-filter-grid input::placeholder {
    color: #94a3b8;
}

.portal-body.portal-light .admin-chip-group span,
.portal-body.portal-light .admin-pill.muted,
.portal-body.portal-light .feature-gate-grid label,
.portal-body.portal-light .admin-switch,
.portal-body.portal-light .package-limit-grid label,
.portal-body.portal-light .package-price-strip,
.portal-body.portal-light .cost-note-list div,
.portal-body.portal-light .payment-row {
    color: #334155;
    background: rgba(241, 245, 249, 0.86);
    border-color: rgba(148, 163, 184, 0.24);
}

.portal-body.portal-light .admin-progress,
.portal-body.portal-light .admin-bar-row div {
    background: rgba(148, 163, 184, 0.2);
}

.portal-body.portal-light .admin-chart circle {
    fill: #ffffff;
}

.portal-body.portal-light .package-price-strip strong,
.portal-body.portal-light .package-section-title span,
.portal-body.portal-light .api-cost-name strong {
    color: #0f172a;
}

.portal-body.portal-light .package-tier-head p,
.portal-body.portal-light .package-price-strip span,
.portal-body.portal-light .package-section-title small,
.portal-body.portal-light .api-cost-name span {
    color: #64748b;
}

.portal-body[data-portal-page="packages"] .admin-app {
    grid-template-columns: 240px minmax(0, 1fr);
}

.portal-body[data-portal-page="packages"] .admin-main {
    padding: 36px 40px;
}

.portal-body[data-portal-page="packages"] .admin-page-head {
    margin-bottom: 28px;
}

.portal-body[data-portal-page="packages"] .package-editor-grid {
    grid-template-columns: repeat(3, minmax(300px, 1fr));
    gap: 28px;
    align-items: start;
}

.portal-body[data-portal-page="packages"] .package-tier-card {
    gap: 20px;
    padding: 26px;
    border-radius: 24px;
}

.package-section {
    display: grid;
    gap: 13px;
    padding: 16px;
    border: 1px solid #e5ebf4;
    border-radius: 18px;
    background: rgba(248, 250, 252, 0.82);
}

.package-section-title {
    align-items: center;
    padding-top: 0;
    border-top: 0;
}

.package-section-title span {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.94rem;
    letter-spacing: 0.01em;
}

.package-section-title i {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 999px;
    color: #2563eb;
    background: rgba(37, 99, 235, 0.1);
    font-size: 0.72rem;
    font-style: normal;
    font-weight: 900;
    cursor: help;
}

.package-section-title i::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 50%;
    bottom: calc(100% + 9px);
    z-index: 20;
    width: 220px;
    padding: 9px 10px;
    border-radius: 10px;
    color: #f8fafc;
    background: #0f172a;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.24);
    font-size: 0.72rem;
    line-height: 1.35;
    text-align: left;
    transform: translateX(-50%) translateY(4px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.16s ease, transform 0.16s ease;
}

.package-section-title i:hover::after,
.package-section-title i:focus-visible::after {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.package-form-grid,
.package-limit-grid {
    gap: 12px;
}

.package-form-grid label,
.package-limit-grid label {
    color: #334155;
    line-height: 1.3;
}

.package-form-grid input,
.package-form-grid textarea,
.package-limit-grid input {
    min-height: 46px;
    border-radius: 14px;
    border-color: rgba(148, 163, 184, 0.34);
    background: rgba(255, 255, 255, 0.86);
    transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.package-form-grid input:focus,
.package-form-grid textarea:focus,
.package-limit-grid input:focus {
    border-color: rgba(99, 102, 241, 0.72);
    outline: 0;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.16);
    background: #ffffff;
}

.package-limit-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.package-limit-grid label:last-child {
    grid-column: 1 / -1;
}

.feature-gate-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.feature-gate-grid .feature-toggle {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    min-height: 56px;
    padding: 11px 12px;
    border-radius: 14px;
}

.feature-toggle input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.feature-toggle-control {
    position: relative;
    flex: 0 0 auto;
    width: 42px;
    height: 24px;
    margin-top: 1px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.32);
    box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.28);
    transition: background 0.18s ease, box-shadow 0.18s ease;
}

.feature-toggle-control::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 999px;
    background: #ffffff;
    box-shadow: 0 3px 8px rgba(15, 23, 42, 0.22);
    transition: transform 0.18s ease;
}

.feature-toggle input:checked + .feature-toggle-control {
    background: linear-gradient(135deg, #6366f1, #14b8a6);
    box-shadow: 0 0 18px rgba(99, 102, 241, 0.24);
}

.feature-toggle input:checked + .feature-toggle-control::after {
    transform: translateX(18px);
}

.feature-toggle input:focus-visible + .feature-toggle-control {
    outline: 4px solid rgba(99, 102, 241, 0.18);
    outline-offset: 2px;
}

.feature-toggle-copy {
    display: grid;
    gap: 2px;
    min-width: 0;
    line-height: 1.35;
}

.feature-toggle-copy strong {
    color: #172033;
    font-size: 0.82rem;
}

.feature-toggle-copy small {
    color: #64748b;
    font-size: 0.72rem;
    font-weight: 800;
}

.portal-body:not(.portal-light) .package-section {
    border-color: rgba(148, 163, 184, 0.14);
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.64), rgba(30, 41, 59, 0.36));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

.portal-body:not(.portal-light) .package-form-grid input,
.portal-body:not(.portal-light) .package-form-grid textarea,
.portal-body:not(.portal-light) .package-limit-grid input {
    color: #e2e8f0;
    background: rgba(2, 6, 23, 0.28);
    border-color: rgba(148, 163, 184, 0.2);
}

.portal-body:not(.portal-light) .package-form-grid input:focus,
.portal-body:not(.portal-light) .package-form-grid textarea:focus,
.portal-body:not(.portal-light) .package-limit-grid input:focus {
    border-color: rgba(129, 140, 248, 0.72);
    background: rgba(15, 23, 42, 0.74);
    box-shadow: 0 0 0 4px rgba(129, 140, 248, 0.14), 0 0 26px rgba(20, 184, 166, 0.08);
}

.portal-body:not(.portal-light) .feature-toggle-copy strong,
.portal-body:not(.portal-light) .package-form-grid label,
.portal-body:not(.portal-light) .package-limit-grid label {
    color: #e2e8f0;
}

.portal-body:not(.portal-light) .feature-toggle-copy small {
    color: #94a3b8;
}

.portal-body.portal-light .package-section {
    border-color: rgba(148, 163, 184, 0.24);
    background: rgba(248, 250, 252, 0.84);
}

.portal-body.portal-light .feature-toggle-copy strong {
    color: #172033;
}

.portal-body.portal-light .admin-rail-footer,
.portal-body.portal-light .account-plan-strip > div,
.portal-body.portal-light .admin-detail-grid > div,
.portal-body.portal-light .admin-usage-row,
.portal-body.portal-light .admin-action-item,
.portal-body.portal-light .admin-plan-card,
.portal-body.portal-light .admin-empty,
.portal-body.portal-light .admin-loading,
.portal-body.portal-light .gateway-steps div,
.portal-body.portal-light .checkout-provider-box,
.portal-body.portal-light .token-weight-grid div,
.portal-body.portal-light .feature-gate-grid label,
.portal-body.portal-light .admin-switch,
.portal-body.portal-light .package-limit-grid label,
.portal-body.portal-light .package-price-strip,
.portal-body.portal-light .package-section,
.portal-body.portal-light .cost-note-list div,
.portal-body.portal-light .payment-row {
    color: #172033;
    background: rgba(255, 255, 255, 0.94);
    border-color: rgba(37, 99, 235, 0.14);
}

.portal-body.portal-light .admin-rail-footer span,
.portal-body.portal-light .admin-rail-footer small,
.portal-body.portal-light .admin-detail-grid span,
.portal-body.portal-light .admin-usage-row small,
.portal-body.portal-light .admin-action-item small,
.portal-body.portal-light .gateway-steps small,
.portal-body.portal-light .checkout-provider-box p,
.portal-body.portal-light .token-weight-grid span,
.portal-body.portal-light .feature-toggle-copy small,
.portal-body.portal-light .package-limit-grid label,
.portal-body.portal-light .package-price-strip span,
.portal-body.portal-light .package-section-title small,
.portal-body.portal-light .cost-note-list div,
.portal-body.portal-light .payment-row span {
    color: #334155;
}

.portal-body.portal-light .admin-action-item span,
.portal-body.portal-light .token-weight-grid strong,
.portal-body.portal-light .feature-toggle-copy strong,
.portal-body.portal-light .package-section-title span,
.portal-body.portal-light .package-price-strip strong,
.portal-body.portal-light .admin-detail-grid strong,
.portal-body.portal-light .admin-usage-copy strong,
.portal-body.portal-light .payment-row em {
    color: #0f172a;
}

@media (min-width: 1680px) {
    .portal-body[data-portal-page="packages"] .feature-gate-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

/* =========================
   ADMIN DESIGN SYSTEM
   Shared standards for current and future Control Center views.
   ========================= */

.portal-body {
    --admin-space-1: 8px;
    --admin-space-2: 16px;
    --admin-space-3: 24px;
    --admin-space-4: 32px;
    --admin-space-6: 48px;
    --admin-control-height: 44px;
    --admin-radius-sm: 12px;
    --admin-radius-md: 16px;
    --admin-radius-lg: 24px;
    --admin-accent: #818cf8;
    --admin-accent-strong: #6366f1;
    --admin-accent-soft: rgba(129, 140, 248, 0.18);
    --admin-danger: #ef4444;
    --admin-danger-soft: rgba(239, 68, 68, 0.14);
    --admin-focus: 0 0 0 4px rgba(129, 140, 248, 0.18);
    --admin-border: rgba(148, 163, 184, 0.18);
    --admin-surface: rgba(15, 23, 42, 0.54);
    --admin-surface-strong: rgba(15, 23, 42, 0.78);
    --admin-surface-muted: rgba(15, 23, 42, 0.38);
    --admin-text: #f8fafc;
    --admin-muted: #94a3b8;
    --admin-shadow: 0 24px 70px rgba(0, 0, 0, 0.34);
    --admin-shadow-soft: 0 16px 38px rgba(0, 0, 0, 0.22);
    --admin-transition: 180ms ease;
}

.portal-body.portal-light {
    --admin-accent: #4f46e5;
    --admin-accent-strong: #2563eb;
    --admin-accent-soft: rgba(79, 70, 229, 0.13);
    --admin-focus: 0 0 0 4px rgba(79, 70, 229, 0.16);
    --admin-border: rgba(148, 163, 184, 0.28);
    --admin-surface: rgba(255, 255, 255, 0.82);
    --admin-surface-strong: rgba(255, 255, 255, 0.94);
    --admin-surface-muted: rgba(241, 245, 249, 0.86);
    --admin-text: #0f172a;
    --admin-muted: #64748b;
    --admin-shadow: 0 22px 55px rgba(15, 23, 42, 0.12);
    --admin-shadow-soft: 0 14px 30px rgba(15, 23, 42, 0.1);
}

.portal-body :where(input, select, textarea, button, a):focus {
    outline: none;
}

.portal-body .admin-main {
    display: grid;
    align-content: start;
    gap: var(--admin-space-4);
}

.portal-body .admin-main > :where(.admin-page-head, .admin-card, .admin-grid, .admin-metric-grid, .package-editor-grid) {
    margin-top: 0;
    margin-bottom: 0;
}

.portal-body .admin-page-head {
    position: sticky;
    top: 0;
    z-index: 30;
    align-items: center;
    padding: var(--admin-space-3);
    border-radius: var(--admin-radius-lg);
    background: var(--admin-surface-strong);
    border-color: var(--admin-border);
    box-shadow: var(--admin-shadow-soft);
    backdrop-filter: blur(22px);
    -webkit-backdrop-filter: blur(22px);
    transition: border-color var(--admin-transition), box-shadow var(--admin-transition), background var(--admin-transition);
}

.portal-body .admin-page-head h1 {
    line-height: 1.08;
}

.portal-body .admin-card,
.portal-body .admin-metric-card,
.portal-body .package-editor-card,
.portal-body .checkout-card,
.portal-body .gateway-card,
.portal-body .admin-plan-card,
.portal-body .admin-action-item,
.portal-body .admin-usage-row,
.portal-body .payment-row {
    transition: border-color var(--admin-transition), box-shadow var(--admin-transition), background var(--admin-transition), transform var(--admin-transition);
}

.portal-body :where(.admin-card, .admin-metric-card, .package-editor-card, .checkout-card, .gateway-card):hover {
    border-color: rgba(129, 140, 248, 0.34);
    box-shadow: var(--admin-shadow);
}

.portal-body .admin-action-item:hover,
.portal-body .admin-plan-card:hover,
.portal-body .payment-row:hover {
    transform: translateY(-1px);
}

.portal-body .sticky-head {
    top: 0;
    z-index: 20;
    padding: var(--admin-space-2);
    background: var(--admin-surface-strong);
    border-bottom-color: var(--admin-border);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

.portal-body .admin-page-actions,
.portal-body .admin-inline-actions {
    gap: var(--admin-space-1);
    justify-content: flex-end;
}

.portal-body .btn {
    width: auto;
    min-height: var(--admin-control-height);
    padding: 0 var(--admin-space-2);
    border: 1px solid transparent;
    border-radius: var(--admin-radius-sm);
    transition: color var(--admin-transition), border-color var(--admin-transition), background var(--admin-transition), box-shadow var(--admin-transition), transform var(--admin-transition);
}

.portal-body .btn-primary {
    width: auto;
    background: linear-gradient(135deg, var(--admin-accent-strong), #14b8a6);
    color: #ffffff;
    box-shadow: 0 14px 30px rgba(79, 70, 229, 0.24);
}

.portal-body .btn-primary:hover {
    background: linear-gradient(135deg, #7c83ff, #22c6b7);
    box-shadow: 0 18px 38px rgba(79, 70, 229, 0.3);
    transform: translateY(-1px);
}

.portal-body .btn-secondary {
    width: auto;
    color: var(--admin-text);
    border-color: var(--admin-border);
    background: var(--admin-surface-muted);
}

.portal-body .btn-secondary:hover {
    color: var(--admin-text);
    border-color: rgba(129, 140, 248, 0.42);
    background: var(--admin-accent-soft);
}

.portal-body .btn-tertiary {
    width: auto;
    min-height: 36px;
    padding: 0 10px;
    color: var(--admin-muted);
    background: transparent;
    border-color: transparent;
    box-shadow: none;
}

.portal-body .btn-danger,
.portal-body .btn-destructive {
    width: auto;
    color: #ffffff;
    background: linear-gradient(135deg, #dc2626, #ef4444);
    box-shadow: 0 14px 28px rgba(239, 68, 68, 0.22);
}

.portal-body .btn-danger:hover,
.portal-body .btn-destructive:hover {
    background: linear-gradient(135deg, #b91c1c, #ef4444);
}

.portal-body .btn:focus-visible,
.portal-body .admin-nav a:focus-visible,
.portal-body .admin-rail-footer button:focus-visible {
    box-shadow: var(--admin-focus);
}

.portal-body :where(
    .admin-page-actions input,
    .admin-card-head select,
    .admin-filter-grid input,
    .admin-filter-grid select,
    .admin-control,
    .admin-inline-input,
    .package-form-grid input,
    .package-form-grid select,
    .package-limit-grid input,
    .checkout-card input,
    .checkout-card select
) {
    box-sizing: border-box;
    min-height: var(--admin-control-height);
    border-radius: var(--admin-radius-sm);
    border-color: var(--admin-border);
    transition: border-color var(--admin-transition), background var(--admin-transition), box-shadow var(--admin-transition);
}

.portal-body :where(
    .package-form-grid textarea,
    .admin-control textarea
) {
    min-height: 104px;
}

.portal-body :where(
    .admin-page-actions input,
    .admin-card-head select,
    .admin-filter-grid input,
    .admin-filter-grid select,
    .admin-control,
    .admin-inline-input,
    .package-form-grid input,
    .package-form-grid select,
    .package-form-grid textarea,
    .package-limit-grid input,
    .checkout-card input,
    .checkout-card select
):focus,
.portal-body :where(
    .admin-page-actions input,
    .admin-card-head select,
    .admin-filter-grid input,
    .admin-filter-grid select,
    .admin-control,
    .admin-inline-input,
    .package-form-grid input,
    .package-form-grid select,
    .package-form-grid textarea,
    .package-limit-grid input,
    .checkout-card input,
    .checkout-card select
):focus-visible {
    border-color: var(--admin-accent);
    box-shadow: var(--admin-focus);
}

.portal-body .admin-form-grid-2,
.portal-body .admin-form-grid-3 {
    display: grid;
    gap: var(--admin-space-2);
}

.portal-body .admin-form-grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.portal-body .admin-form-grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.portal-body .admin-section-block {
    display: grid;
    gap: var(--admin-space-2);
    padding: var(--admin-space-2);
    border: 1px solid var(--admin-border);
    border-radius: var(--admin-radius-md);
    background: var(--admin-surface-muted);
}

.portal-body .admin-tabs {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-height: var(--admin-control-height);
    padding: 4px;
    border: 1px solid var(--admin-border);
    border-radius: var(--admin-radius-md);
    background: var(--admin-surface-muted);
}

.portal-body .admin-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 0 14px;
    border: 0;
    border-radius: 12px;
    color: var(--admin-muted);
    background: transparent;
    font-weight: 900;
    cursor: pointer;
    transition: color var(--admin-transition), background var(--admin-transition), box-shadow var(--admin-transition);
}

.portal-body .admin-tab:hover,
.portal-body .admin-tab.active,
.portal-body .admin-tab[aria-selected="true"] {
    color: var(--admin-text);
    background: var(--admin-accent-soft);
}

.portal-body .admin-tab:focus-visible {
    box-shadow: var(--admin-focus);
}

.portal-body .admin-accordion {
    border: 1px solid var(--admin-border);
    border-radius: var(--admin-radius-md);
    background: var(--admin-surface-muted);
    overflow: hidden;
}

.portal-body .admin-accordion + .admin-accordion {
    margin-top: var(--admin-space-2);
}

.portal-body .admin-accordion summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--admin-space-2);
    min-height: 52px;
    padding: 0 var(--admin-space-2);
    color: var(--admin-text);
    font-weight: 900;
    cursor: pointer;
    transition: background var(--admin-transition);
}

.portal-body .admin-accordion summary:hover {
    background: var(--admin-accent-soft);
}

.portal-body .admin-accordion summary::-webkit-details-marker {
    display: none;
}

.portal-body .admin-accordion-panel {
    padding: 0 var(--admin-space-2) var(--admin-space-2);
    color: var(--admin-muted);
}

.portal-body .admin-sticky-actions {
    position: sticky;
    bottom: var(--admin-space-2);
    z-index: 25;
    display: flex;
    justify-content: flex-end;
    gap: var(--admin-space-1);
    padding: var(--admin-space-2);
    border: 1px solid var(--admin-border);
    border-radius: var(--admin-radius-lg);
    background: var(--admin-surface-strong);
    box-shadow: var(--admin-shadow-soft);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.portal-body .admin-table th,
.portal-body .admin-table td {
    transition: background var(--admin-transition), color var(--admin-transition), border-color var(--admin-transition);
}

.portal-body .admin-empty,
.portal-body .admin-loading,
.portal-body .empty-state.compact {
    border-radius: var(--admin-radius-md);
}

/* Final admin readability and density pass. */
.portal-body .admin-page-head p,
.portal-body .admin-card-head p,
.portal-body .admin-metric-card small,
.portal-body .admin-usage-row small,
.portal-body .admin-action-item small,
.portal-body .admin-activity span,
.portal-body .admin-user-cell span,
.portal-body .admin-pagination span,
.portal-body .admin-bar-row span,
.portal-body .payment-row span,
.portal-body .package-tier-head p,
.portal-body .package-price-strip span,
.portal-body .package-section-title small,
.portal-body .feature-toggle-copy small,
.portal-body .api-cost-name span {
    color: #b6c2d5;
    font-weight: 750;
}

.portal-body.portal-light .admin-page-head p,
.portal-body.portal-light .admin-card-head p,
.portal-body.portal-light .admin-metric-card small,
.portal-body.portal-light .admin-usage-row small,
.portal-body.portal-light .admin-action-item small,
.portal-body.portal-light .admin-activity span,
.portal-body.portal-light .admin-user-cell span,
.portal-body.portal-light .admin-pagination span,
.portal-body.portal-light .admin-bar-row span,
.portal-body.portal-light .payment-row span,
.portal-body.portal-light .package-tier-head p,
.portal-body.portal-light .package-price-strip span,
.portal-body.portal-light .package-section-title small,
.portal-body.portal-light .feature-toggle-copy small,
.portal-body.portal-light .api-cost-name span {
    color: #334155;
}

.portal-body .admin-usage-row small {
    display: block;
    margin-top: 8px;
    font-size: 0.86rem;
    font-weight: 850;
    letter-spacing: 0;
}

.portal-body .admin-table th,
.portal-body.portal-light .admin-table th {
    color: #f8fafc;
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.98), rgba(30, 41, 59, 0.95));
    font-size: 0.74rem;
    font-weight: 900;
}

.portal-body .admin-table th:first-child {
    border-top-left-radius: 12px;
}

.portal-body .admin-table th:last-child {
    border-top-right-radius: 12px;
}

.portal-body .admin-row-save {
    min-width: 74px;
    color: var(--admin-muted);
    border-color: var(--admin-border);
    background: var(--admin-surface-muted);
    box-shadow: none;
}

.portal-body .admin-row-save:disabled {
    opacity: 0.68;
    cursor: default;
    transform: none;
}

.portal-body .admin-row-save.is-dirty,
.portal-body .admin-row-save.is-saving {
    color: #ffffff;
    border-color: transparent;
    background: linear-gradient(135deg, var(--admin-accent-strong), #14b8a6);
    box-shadow: 0 10px 22px rgba(79, 70, 229, 0.22);
}

.chart-axis-label {
    fill: #94a3b8;
    font-size: 0.68rem;
    font-weight: 800;
}

.portal-body.portal-light .chart-axis-label {
    fill: #475569;
}

.admin-chart circle {
    cursor: help;
    transition: r 0.16s ease, stroke-width 0.16s ease, filter 0.16s ease;
}

.admin-chart circle:hover,
.admin-chart circle:focus {
    r: 7;
    stroke-width: 4;
    filter: drop-shadow(0 0 8px rgba(129, 140, 248, 0.55));
    outline: none;
}

.admin-metric-delta {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    margin-top: 10px;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-style: normal;
    font-weight: 900;
}

.admin-metric-delta.delta-success {
    color: #5eead4;
    background: rgba(20, 184, 166, 0.14);
}

.admin-metric-delta.delta-warning,
.admin-metric-delta.delta-neutral {
    color: #fbbf24;
    background: rgba(245, 158, 11, 0.14);
}

.admin-metric-delta.delta-danger {
    color: #fecaca;
    background: rgba(239, 68, 68, 0.16);
}

.profit-chart-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.profit-chart-summary div {
    padding: 12px;
    border: 1px solid var(--admin-border);
    border-radius: 14px;
    background: var(--admin-surface-muted);
}

.profit-chart-summary span,
.stacked-period small,
.stacked-legend span,
.donut-legend span,
.admin-donut span {
    color: var(--admin-muted);
    font-size: 0.75rem;
    font-weight: 900;
}

.profit-chart-summary span,
.admin-donut span {
    display: block;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.profit-chart-summary strong {
    display: block;
    margin-top: 6px;
    color: var(--admin-text);
    font-size: 1.05rem;
}

.profitability-chart .revenue-area {
    fill: rgba(20, 184, 166, 0.14);
}

.profitability-chart .cost-area {
    fill: rgba(245, 158, 11, 0.13);
}

.profitability-chart .revenue-line {
    stroke: #14b8a6;
}

.profitability-chart .cost-line {
    stroke: #f59e0b;
}

.profitability-chart .revenue-point {
    fill: #0f172a;
    stroke: #14b8a6;
}

.profitability-chart .cost-point {
    fill: #0f172a;
    stroke: #f59e0b;
}

.chart-axis-cost {
    fill: #f59e0b;
}

.chart-legend {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.chart-legend i,
.stacked-legend i,
.donut-legend i {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 999px;
}

.chart-legend .legend-revenue {
    background: #14b8a6;
}

.chart-legend .legend-cost {
    background: #f59e0b;
}

.admin-stacked-chart {
    display: grid;
    gap: 18px;
    min-height: 260px;
}

.stacked-bars {
    display: grid;
    grid-template-columns: repeat(var(--stacked-count), minmax(42px, 1fr));
    align-items: end;
    gap: 12px;
    min-height: 190px;
    padding: 14px;
    border: 1px solid var(--admin-border);
    border-radius: 16px;
    background: var(--admin-surface-muted);
}

.stacked-period {
    display: grid;
    align-items: end;
    justify-items: center;
    gap: 8px;
    min-width: 0;
}

.stacked-bar {
    display: flex;
    flex-direction: column-reverse;
    width: min(48px, 100%);
    min-height: 2px;
    overflow: hidden;
    border-radius: 999px 999px 8px 8px;
    background: rgba(148, 163, 184, 0.18);
    box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.12);
}

.stacked-bar span {
    display: block;
    width: 100%;
}

.stacked-legend,
.donut-legend {
    display: grid;
    gap: 9px;
}

.stacked-legend {
    grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
}

.stacked-legend span,
.donut-legend span {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.donut-layout {
    display: grid;
    grid-template-columns: minmax(150px, 0.75fr) minmax(0, 1fr);
    gap: 18px;
    align-items: center;
}

.admin-donut {
    position: relative;
    display: grid;
    place-items: center;
    align-content: center;
    width: min(190px, 100%);
    aspect-ratio: 1;
    margin: 0 auto;
    border-radius: 999px;
    background: var(--donut-gradient);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.18);
}

.admin-donut::after {
    content: "";
    position: absolute;
    inset: 22%;
    border-radius: inherit;
    background: var(--admin-surface-strong);
    box-shadow: inset 0 0 0 1px var(--admin-border);
}

.admin-donut strong,
.admin-donut span {
    position: relative;
    z-index: 1;
}

.admin-donut strong {
    color: var(--admin-text);
    font-size: 1.35rem;
    line-height: 1;
}

.donut-legend div {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--admin-border);
}

.donut-legend strong {
    color: var(--admin-text);
    font-size: 0.86rem;
}

.portal-body.portal-light .admin-metric-delta.delta-success {
    color: #047857;
    background: rgba(16, 185, 129, 0.14);
}

.portal-body.portal-light .admin-metric-delta.delta-warning,
.portal-body.portal-light .admin-metric-delta.delta-neutral {
    color: #92400e;
    background: rgba(245, 158, 11, 0.16);
}

.portal-body.portal-light .admin-metric-delta.delta-danger {
    color: #b91c1c;
    background: rgba(239, 68, 68, 0.14);
}

.portal-body.portal-light .profitability-chart .revenue-point,
.portal-body.portal-light .profitability-chart .cost-point {
    fill: #ffffff;
}

.portal-body[data-portal-page="packages"] .feature-gate-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.portal-body[data-portal-page="packages"] .feature-gate-grid .feature-toggle {
    min-height: 48px;
    gap: 9px;
    padding: 9px 10px;
    border-radius: 12px;
}

.portal-body[data-portal-page="packages"] .feature-toggle-control {
    width: 34px;
    height: 20px;
}

.portal-body[data-portal-page="packages"] .feature-toggle-control::after {
    top: 3px;
    left: 3px;
    width: 14px;
    height: 14px;
}

.portal-body[data-portal-page="packages"] .feature-toggle input:checked + .feature-toggle-control::after {
    transform: translateX(14px);
}

.portal-body[data-portal-page="packages"] .feature-toggle-copy strong {
    font-size: 0.78rem;
    line-height: 1.25;
}

.portal-body[data-portal-page="packages"] .feature-toggle-copy small {
    font-size: 0.68rem;
    line-height: 1.25;
}

.portal-body[data-portal-page="packages"] .package-tier-card .admin-page-actions .btn-secondary {
    color: var(--admin-text);
    border-color: rgba(148, 163, 184, 0.32);
    background: transparent;
    box-shadow: none;
}

.portal-body[data-portal-page="packages"] .package-tier-card .admin-page-actions .btn-secondary:hover {
    border-color: rgba(129, 140, 248, 0.48);
    background: var(--admin-accent-soft);
}

.portal-body.portal-light[data-portal-page="packages"] .package-tier-card .admin-page-actions .btn-secondary {
    color: #1e293b;
    border-color: rgba(71, 85, 105, 0.28);
    background: rgba(255, 255, 255, 0.34);
}

.admin-health-grid,
.notifications-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.admin-health-list {
    display: grid;
    gap: 10px;
}

.admin-health-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-width: 0;
    padding: 14px;
    border: 1px solid var(--admin-border);
    border-radius: var(--admin-radius-md);
    background: var(--admin-surface-muted);
    transition: border-color var(--admin-transition), background var(--admin-transition), transform var(--admin-transition);
}

.admin-health-row:hover {
    border-color: rgba(129, 140, 248, 0.38);
    transform: translateY(-1px);
}

.admin-health-row.stacked {
    align-items: flex-start;
}

.admin-health-row > div {
    display: grid;
    gap: 5px;
    min-width: 0;
}

.admin-health-row strong {
    color: var(--admin-text);
    font-size: 0.9rem;
    line-height: 1.3;
}

.admin-health-row small {
    color: var(--admin-muted);
    line-height: 1.4;
}

.admin-health-actions {
    justify-items: end;
    text-align: right;
}

.admin-status-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    padding: 0 10px;
    border-radius: 999px;
    border: 1px solid var(--admin-border);
    color: var(--admin-text);
    background: var(--admin-surface);
    font-size: 0.72rem;
    font-weight: 900;
    text-transform: uppercase;
    white-space: nowrap;
}

.admin-status-pill.success {
    color: #34d399;
    border-color: rgba(16, 185, 129, 0.34);
    background: rgba(16, 185, 129, 0.13);
}

.admin-status-pill.warning {
    color: #fbbf24;
    border-color: rgba(245, 158, 11, 0.34);
    background: rgba(245, 158, 11, 0.13);
}

.admin-status-pill.danger {
    color: #fca5a5;
    border-color: rgba(239, 68, 68, 0.34);
    background: rgba(239, 68, 68, 0.13);
}

.admin-status-pill.neutral {
    color: #c4b5fd;
    border-color: rgba(129, 140, 248, 0.28);
    background: rgba(129, 140, 248, 0.12);
}

.danger-text {
    color: #fca5a5 !important;
}

.portal-body.portal-light .admin-health-row {
    background: rgba(248, 250, 252, 0.92);
    border-color: rgba(100, 116, 139, 0.2);
}

.portal-body.portal-light .admin-health-row small {
    color: #475569;
}

.portal-body.portal-light .admin-status-pill.success {
    color: #047857;
    background: rgba(16, 185, 129, 0.14);
}

.portal-body.portal-light .admin-status-pill.warning {
    color: #92400e;
    background: rgba(245, 158, 11, 0.16);
}

.portal-body.portal-light .admin-status-pill.danger {
    color: #b91c1c;
    background: rgba(239, 68, 68, 0.14);
}

.portal-body.portal-light .admin-status-pill.neutral {
    color: #3730a3;
    background: rgba(79, 70, 229, 0.12);
}

.portal-body.portal-light .danger-text {
    color: #b91c1c !important;
}

@media (max-width: 1180px) {
    .admin-metric-grid,
    .admin-metric-grid.compact {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dashboard-primary-grid,
    .dashboard-secondary-grid,
    .dashboard-chart-grid,
    .dashboard-command-grid,
    .dashboard-user-detail-grid,
    .account-layout {
        grid-template-columns: 1fr;
    }

    .admin-filter-grid {
        width: 100%;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .package-limit-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .portal-body[data-portal-page="packages"] .admin-app {
        grid-template-columns: 220px minmax(0, 1fr);
    }

    .portal-body[data-portal-page="packages"] .admin-main {
        padding: 28px;
    }

    .portal-body[data-portal-page="packages"] .package-editor-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    .admin-app {
        grid-template-columns: 1fr;
    }

    .portal-body[data-portal-page="packages"] .admin-app,
    .portal-body[data-portal-page="packages"] .package-editor-grid {
        grid-template-columns: 1fr;
    }

    .admin-rail {
        position: static;
        height: auto;
    }

    .admin-main {
        padding: 16px;
    }

    .admin-page-head,
    .admin-card-head {
        display: block;
    }

    .admin-page-actions,
    .admin-filter-grid {
        margin-top: 14px;
        grid-template-columns: 1fr;
    }

    .admin-metric-grid,
    .admin-metric-grid.compact,
    .admin-detail-grid,
    .account-plan-strip,
    .gateway-steps,
    .feature-gate-grid,
    .package-form-grid,
    .package-limit-grid,
    .portal-body .admin-form-grid-2,
    .portal-body .admin-form-grid-3 {
        grid-template-columns: 1fr;
    }

    .payment-row,
    .admin-bar-row,
    .admin-health-grid,
    .notifications-grid,
    .donut-layout {
        grid-template-columns: 1fr;
    }

    .profit-chart-summary {
        grid-template-columns: 1fr;
    }

    .portal-body .admin-page-head,
    .portal-body .admin-sticky-actions {
        border-radius: var(--admin-radius-md);
    }
}

/* =========================
   MOBILE MAP-FIRST PLANNER
   ========================= */

.mobile-top-bar,
.mobile-account-drawer,
.mobile-drawer-backdrop,
.mobile-sheet-handle,
.mobile-search-menu-btn,
.mobile-feature-note,
.mobile-smart-quick-actions,
.mobile-smart-settings-btn,
.mobile-smart-close-btn,
.mobile-search-close-btn,
.mobile-save-primary,
.mobile-danger-tool,
.mobile-restriction-notice {
    display: none;
}

.planner-control-header-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex: 0 0 auto;
}

@media (min-width: 769px) and (max-width: 900px) and (hover: hover) {
    body {
        overflow: hidden;
    }

    #sidebar {
        top: 18px;
        right: auto;
        bottom: 18px;
        left: 18px;
        width: min(var(--sidebar-width, 430px), calc(100vw - 36px));
        max-width: min(680px, calc(100vw - 36px));
    }

    .map-overlay-dock {
        top: 18px;
        right: 18px;
        bottom: auto;
        left: auto;
        width: min(350px, calc(100vw - 470px));
        min-width: 300px;
        max-height: calc(100dvh - 36px);
    }
}

@media (max-width: 900px), (max-width: 940px) and (max-height: 520px) and (pointer: coarse) {
    html,
    body {
        width: 100%;
        min-height: 100%;
        overflow: hidden;
    }

    body.is-mobile-planner {
        min-height: var(--app-height, 100dvh);
    }

    body.portal-mobile-restricted {
        min-height: var(--app-height, 100dvh);
        overflow: hidden;
        padding: 0;
    }

    body.portal-mobile-restricted .admin-app {
        display: none;
    }

    body.portal-mobile-restricted .mobile-restriction-notice {
        position: fixed;
        inset: 0;
        z-index: 2000;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: max(18px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
        background: var(--bg-gradient);
    }

    .mobile-restriction-card {
        width: min(420px, 100%);
        padding: 24px;
        border: 1px solid var(--border);
        border-radius: 22px;
        background: var(--surface-strong);
        box-shadow: var(--shadow);
        text-align: left;
    }

    .mobile-restriction-kicker {
        display: block;
        margin-bottom: 8px;
        color: var(--primary);
        font-size: 0.76rem;
        font-weight: 900;
        letter-spacing: 0.08em;
        text-transform: uppercase;
    }

    .mobile-restriction-card h1 {
        margin: 0;
        color: var(--text-main);
        font-size: 1.65rem;
        line-height: 1.15;
    }

    .mobile-restriction-card p {
        margin: 12px 0 18px;
        color: var(--text-muted);
        line-height: 1.55;
    }

    #map {
        position: fixed;
        inset: 0;
        width: 100%;
        height: var(--app-height, 100dvh);
    }

    .mobile-top-bar {
        display: none;
    }

    .mobile-menu-toggle,
    .mobile-brand {
        pointer-events: auto;
        border: 1px solid var(--border);
        background: var(--surface-strong);
        color: var(--text-main);
        backdrop-filter: var(--backdrop);
        -webkit-backdrop-filter: var(--backdrop);
        box-shadow: var(--shadow-soft);
    }

    .mobile-menu-toggle {
        width: 44px;
        height: 44px;
        border-radius: 14px;
        cursor: pointer;
        font-size: 1.2rem;
        font-weight: 900;
    }

    .mobile-brand {
        display: inline-flex;
        align-items: center;
        min-height: 44px;
        max-width: calc(100vw - 84px);
        padding: 0 13px;
        border-radius: 999px;
        font-weight: 900;
    }

    .mobile-brand span {
        margin-left: 6px;
        padding: 2px 7px;
        border-radius: 999px;
        color: var(--primary);
        background: rgba(79, 70, 229, 0.1);
        font-size: 0.72rem;
    }

    body.mobile-planner-hidden .map-overlay-dock,
    body.mobile-search-active .map-overlay-dock {
        opacity: 0;
        pointer-events: none;
    }

    .mobile-drawer-backdrop {
        position: fixed;
        inset: 0;
        z-index: 1290;
        border: 0;
        background: rgba(15, 23, 42, 0.34);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.2s ease;
    }

    .mobile-account-drawer {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        z-index: 1300;
        display: flex;
        flex-direction: column;
        gap: 14px;
        width: min(360px, calc(100vw - 36px));
        padding: calc(18px + env(safe-area-inset-top)) 16px calc(18px + env(safe-area-inset-bottom));
        border-right: 1px solid var(--border);
        background: var(--surface-strong);
        backdrop-filter: var(--backdrop);
        -webkit-backdrop-filter: var(--backdrop);
        box-shadow: var(--shadow);
        transform: translateX(-106%);
        transition: transform 0.22s ease;
        overflow-y: auto;
    }

    body.mobile-menu-open .mobile-drawer-backdrop {
        display: block;
        opacity: 1;
        pointer-events: auto;
    }

    body.mobile-menu-open .mobile-account-drawer {
        transform: translateX(0);
    }

    .mobile-drawer-head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
    }

    .mobile-drawer-head strong {
        font-size: 1rem;
        font-weight: 900;
    }

    .mobile-drawer-user,
    .mobile-token-card {
        margin: 0;
    }

    .mobile-drawer-actions {
        display: grid;
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .mobile-drawer-actions .btn,
    .mobile-drawer-actions .nav-link-btn {
        width: 100%;
        min-height: 42px;
        justify-content: center;
        text-decoration: none;
    }

    #sidebar {
        position: fixed;
        top: auto;
        left: max(10px, env(safe-area-inset-left));
        right: max(10px, env(safe-area-inset-right));
        bottom: max(10px, env(safe-area-inset-bottom));
        width: auto;
        min-width: 0;
        max-width: none;
        height: var(--mobile-sheet-height, calc(var(--app-height, 100dvh) - 186px - env(safe-area-inset-top) - env(safe-area-inset-bottom)));
        max-height: none;
        z-index: 1080;
        border-radius: 22px;
        overflow: visible;
        pointer-events: none;
        background: transparent;
        border: 0;
        box-shadow: none;
        --mobile-sheet-translate: 0px;
        --mobile-sheet-drag-offset: 0px;
        --mobile-sheet-transform: translate3d(0, calc(var(--mobile-sheet-translate) + var(--mobile-sheet-drag-offset)), 0);
    }

    #sidebar::before {
        content: "";
        position: absolute;
        inset: 0;
        z-index: 0;
        border: 1px solid var(--border);
        border-radius: 22px;
        background: var(--surface-strong);
        box-shadow: var(--shadow);
        transform: var(--mobile-sheet-transform);
        transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1), border-radius 0.2s ease;
        pointer-events: none;
    }

    #sidebar[data-sheet-state="bubble"]::before {
        border-radius: 999px;
    }

    body.mobile-sheet-bubble #sidebar {
        left: max(12px, env(safe-area-inset-left));
        right: auto;
        width: min(310px, calc(100vw - 24px - env(safe-area-inset-left) - env(safe-area-inset-right)));
    }

    body.mobile-sheet-bubble .mobile-sheet-handle {
        min-height: 64px;
        padding: 10px 18px;
        border: 0;
        border-radius: 999px;
        background: transparent;
        grid-template-columns: minmax(0, 1fr) auto;
    }

    body.mobile-sheet-bubble .mobile-sheet-handle span {
        display: none;
    }

    body.mobile-sheet-bubble .mobile-sheet-handle strong,
    body.mobile-sheet-bubble .mobile-sheet-handle small {
        align-self: center;
    }

    #sidebar[data-sheet-state="search"]::before {
        pointer-events: none;
    }

    #mobileSheetHandle,
    .sidebar-header .floating-tabs,
    .sidebar-content,
    .sidebar-footer {
        position: relative;
        z-index: 1;
        transform: var(--mobile-sheet-transform);
        transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
        pointer-events: auto;
    }

    .mobile-sheet-handle {
        display: grid;
        grid-template-columns: 1fr auto;
        align-items: center;
        gap: 8px;
        width: 100%;
        min-height: 36px;
        padding: 6px 14px 7px;
        border: 0;
        border-bottom: 1px solid var(--border);
        background: linear-gradient(180deg, var(--surface-strong), var(--surface-soft));
        color: var(--text-main);
        cursor: grab;
        flex: 0 0 auto;
        touch-action: none;
    }

    .mobile-sheet-handle span {
        grid-column: 1 / -1;
        justify-self: center;
        width: 42px;
        height: 4px;
        border-radius: 999px;
        background: var(--border-strong);
    }

    .mobile-sheet-handle strong {
        font-size: 0.82rem;
        font-weight: 900;
        text-align: left;
    }

    .mobile-sheet-handle small {
        justify-self: end;
        color: var(--primary);
        font-size: 0.66rem;
        font-weight: 900;
        text-transform: uppercase;
        letter-spacing: 0.04em;
    }

    .sidebar-header {
        padding: 6px 10px 8px;
        border-bottom: 0;
        background: transparent;
        pointer-events: none;
    }

    .sidebar-header .brand-row,
    .sidebar-header .user-card,
    .sidebar-header #plannerTokenTracker {
        display: none;
    }

    .planner-search {
        position: fixed;
        top: max(10px, env(safe-area-inset-top));
        bottom: auto;
        left: max(16px, env(safe-area-inset-left));
        right: max(16px, env(safe-area-inset-right));
        z-index: 1360;
        margin: 0;
        pointer-events: auto;
        transition: top 0.3s ease, left 0.3s ease, right 0.3s ease, transform 0.3s ease;
    }

    body.mobile-search-active .planner-search {
        left: max(10px, env(safe-area-inset-left));
        right: max(10px, env(safe-area-inset-right));
    }

    .planner-search .search-label {
        display: none;
    }

    .planner-search .search-input-box {
        min-height: 54px;
        border-radius: 24px;
        border-color: rgba(148, 163, 184, 0.28);
        background: var(--surface-strong);
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
        transition: border-radius 0.3s ease, box-shadow 0.3s ease, min-height 0.3s ease, background-color 0.3s ease;
    }

    body.mobile-search-active .planner-search .search-input-box {
        min-height: 56px;
        border-radius: 24px 24px 0 0;
        border-bottom-color: transparent;
        box-shadow: 0 16px 34px rgba(0, 0, 0, 0.28);
    }

    .mobile-search-menu-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex: 0 0 38px;
        width: 38px;
        height: 38px;
        border: 1px solid var(--border);
        border-radius: 12px;
        background: var(--card-bg);
        color: var(--text-main);
        cursor: pointer;
        font-size: 0;
        font-weight: 900;
    }

    .mobile-search-menu-btn::before {
        content: "";
        width: 16px;
        height: 11px;
        border-top: 2px solid currentColor;
        border-bottom: 2px solid currentColor;
        box-shadow: 0 4.5px 0 currentColor;
    }

    body.mobile-search-active .mobile-search-menu-btn {
        display: none;
    }

    .mobile-search-close-btn {
        display: none;
        align-items: center;
        justify-content: center;
        min-height: 32px;
        padding: 0 10px;
        border: 1px solid var(--border);
        border-radius: 999px;
        background: var(--card-bg);
        color: var(--text-main);
        cursor: pointer;
        font-size: 0.72rem;
        font-weight: 900;
    }

    body.mobile-search-active .mobile-search-close-btn {
        display: inline-flex;
    }

    #searchResults {
        top: 100%;
        max-height: min(calc(var(--app-height, 100dvh) - 86px - env(safe-area-inset-top)), 430px);
        padding: 0;
        border-radius: 0 0 24px 24px;
        background: var(--surface-strong);
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        box-shadow: 0 22px 42px rgba(0, 0, 0, 0.32);
        border-color: rgba(148, 163, 184, 0.28);
        overflow-y: auto;
        overscroll-behavior: contain;
    }

    .result-item {
        display: flex;
        align-items: center;
        gap: 0;
        min-height: 72px;
        padding: 16px;
        border-radius: 0;
        border-left: 0;
        border-bottom: 1px solid rgba(148, 163, 184, 0.14);
        color: var(--text-main);
        transform: none;
    }

    .result-item+.result-item {
        margin-top: 0;
    }

    .result-item:hover {
        background: var(--hover-soft);
        border-left-color: transparent;
        transform: none;
    }

    .result-icon {
        flex: 0 0 40px;
        width: 40px;
        height: 40px;
        margin-right: 16px;
        border-radius: 50%;
        background: rgba(148, 163, 184, 0.14);
        display: flex;
        align-items: center;
        justify-content: center;
        color: var(--primary);
    }

    .result-icon::before {
        content: "";
        width: 13px;
        height: 13px;
        border: 2px solid currentColor;
        border-radius: 50% 50% 50% 0;
        transform: rotate(-45deg);
    }

    .result-copy {
        display: flex;
        flex: 1 1 auto;
        min-width: 0;
        flex-direction: column;
        overflow: hidden;
    }

    .result-title,
    .result-address {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .result-title {
        color: var(--text-main);
        font-size: 0.94rem;
        font-weight: 800;
        line-height: 1.35;
    }

    .result-address {
        margin-top: 3px;
        color: var(--text-muted);
        font-size: 0.82rem;
        line-height: 1.35;
    }

    .result-item.result-status {
        min-height: 56px;
        cursor: default;
    }

    .result-item.result-status .result-icon::before {
        width: 12px;
        height: 12px;
        border-radius: 50%;
        transform: none;
    }

    .floating-tabs {
        display: none;
    }

    .floating-tab[data-tab="budget"],
    .floating-tab[data-tab="saved"] {
        display: none;
    }

    .floating-tab {
        min-width: 0;
        padding: 8px 6px;
        font-size: 0.76rem;
    }

    .sidebar-content {
        display: flex;
        flex-direction: column;
        min-height: 0;
        padding: 8px 10px 10px;
        overflow: hidden;
    }

    #sidebarPanelBuilder.sidebar-panel.active,
    #sidebarPanelBudget.sidebar-panel.active,
    #sidebarPanelSaved.sidebar-panel.active {
        min-height: 0;
        height: 100%;
    }

    .sidebar-panel.active {
        min-height: 0;
    }

    #sidebarPanelBudget.sidebar-panel.active,
    #sidebarPanelSaved.sidebar-panel.active {
        overflow-y: auto;
        overscroll-behavior: contain;
    }

    #sidebarPanelBuilder.sidebar-panel.active {
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }

    #sidebarPanelBuilder > .panel-card {
        display: flex;
        flex-direction: column;
        min-height: 0;
        height: 100%;
    }

    .sidebar-footer {
        display: none;
    }

    .footer-note {
        display: none;
    }

    body.mobile-sheet-bubble .sidebar-header .floating-tabs,
    body.mobile-sheet-bubble .sidebar-content,
    body.mobile-sheet-bubble .sidebar-footer,
    body.mobile-planner-hidden #mobileSheetHandle,
    body.mobile-planner-hidden .sidebar-header .floating-tabs,
    body.mobile-planner-hidden .sidebar-content,
    body.mobile-planner-hidden .sidebar-footer,
    body.mobile-planner-hidden #sidebar::before,
    body.mobile-search-active #mobileSheetHandle,
    body.mobile-search-active .sidebar-header .floating-tabs,
    body.mobile-search-active .sidebar-content,
    body.mobile-search-active .sidebar-footer,
    body.mobile-search-active #sidebar::before {
        display: none;
    }

    .panel-card {
        padding: 9px;
        border-radius: 16px;
        margin-bottom: 9px;
    }

    .panel-topline {
        display: none;
    }

    .panel-header {
        display: none;
    }

    .planner-helper-text {
        display: none;
    }

    .mobile-feature-note {
        display: block;
        margin: 0 0 8px;
        padding: 9px 11px;
        border: 1px solid rgba(129, 140, 248, 0.22);
        border-radius: 12px;
        background: rgba(129, 140, 248, 0.1);
        color: var(--text-muted);
        font-size: 0.74rem;
        font-weight: 800;
        line-height: 1.35;
    }

    .day-navigator {
        flex: 0 0 auto;
        gap: 7px;
        flex-wrap: wrap;
        padding-bottom: 8px;
        margin-bottom: 8px;
    }

    .mobile-smart-quick-actions {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 8px;
        margin: 0 0 10px;
        padding: 10px;
        border: 1px solid var(--border);
        border-radius: 18px;
        background: rgba(15, 23, 42, 0.06);
        overflow: visible;
    }

    .mobile-smart-quick-actions::-webkit-scrollbar {
        display: none;
    }

    .mobile-smart-chip {
        min-width: 0;
        max-width: none;
        min-height: 44px;
        padding: 0 8px;
        border: 1px solid var(--border);
        border-radius: 14px;
        background: var(--card-bg);
        color: var(--text-main);
        box-shadow: var(--shadow-soft);
        cursor: pointer;
        font-size: 0.72rem;
        font-weight: 900;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .mobile-smart-chip.primary {
        border-color: rgba(79, 70, 229, 0.3);
        background: var(--primary);
        color: #fff;
    }

    .mobile-smart-chip.active {
        border-color: rgba(20, 184, 166, 0.35);
        background: rgba(20, 184, 166, 0.12);
        color: #0f766e;
    }

    [data-theme="dark"] .mobile-smart-chip.active {
        color: #5eead4;
    }

    .mobile-smart-chip.locked-feature {
        border-style: dashed;
        color: var(--text-muted);
    }

    .mobile-smart-chip:disabled {
        opacity: 0.48;
        cursor: not-allowed;
        box-shadow: none;
    }

    .mobile-route-mode-strip {
        grid-column: 1 / -1;
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 6px;
        padding: 5px;
        border: 1px solid var(--border);
        border-radius: 999px;
        background: var(--surface-soft);
    }

    .mobile-route-mode-btn {
        min-width: 0;
        min-height: 34px;
        padding: 0 8px;
        border: 0;
        border-radius: 999px;
        background: transparent;
        color: var(--text-muted);
        cursor: pointer;
        font-size: 0.7rem;
        font-weight: 900;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .mobile-route-mode-btn.active {
        background: var(--primary);
        color: #fff;
        box-shadow: 0 8px 18px rgba(79, 70, 229, 0.2);
    }

    .mobile-route-mode-btn.locked-feature {
        color: var(--text-muted);
        opacity: 0.55;
    }

    .day-tabs-scroll {
        flex: 1 1 100%;
        max-width: 100%;
        touch-action: pan-x;
    }

    .day-nav-actions {
        width: 100%;
        display: none;
    }

    .day-tools-card,
    .bulk-move-bar {
        display: none !important;
    }

    #tripList {
        flex: 1 1 auto;
        min-height: 132px;
        overflow-y: auto;
        padding-right: 2px;
        overscroll-behavior: contain;
        touch-action: pan-y;
    }

    .mobile-smart-settings-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-height: 36px;
        padding: 0 10px;
        border: 1px solid rgba(129, 140, 248, 0.42);
        border-radius: 12px;
        background: linear-gradient(135deg, rgba(79, 70, 229, 0.94), rgba(20, 184, 166, 0.72));
        color: #f8fafc;
        box-shadow: 0 10px 24px rgba(79, 70, 229, 0.25);
        cursor: pointer;
        font-size: 0.72rem;
        font-weight: 900;
    }

    .day-tab,
    .day-tools-toggle-btn,
    .day-add-btn,
    .day-delete-btn,
    .btn-compact {
        min-height: 36px;
    }

    .day-delete-btn {
        display: none !important;
    }

    .mobile-danger-tool {
        display: grid;
    }

    .day-tool-action-row.single {
        grid-template-columns: 1fr;
    }

    .empty-state.onboarding-empty {
        gap: 7px;
        padding: 12px;
        border-radius: 14px;
    }

    .empty-state.onboarding-empty span,
    .empty-state.onboarding-empty small {
        display: none;
    }

    .trip-item {
        position: relative;
        padding: 9px 10px;
        border-radius: 14px;
        align-items: center;
        gap: 8px;
        touch-action: pan-y;
    }

    .trip-stop-index {
        flex: 0 0 22px;
        width: 22px !important;
        margin-right: 0 !important;
    }

    .trip-stop-content {
        min-width: 0;
    }

    .trip-stop-main-row {
        min-width: 0;
        flex-wrap: nowrap !important;
    }

    .trip-stop-main-row > div:first-child {
        flex: 1 1 auto;
        min-width: 0;
        max-width: 100%;
    }

    .trip-item .trip-leg-chip,
    .trip-item .trip-time-chip,
    .trip-item .trip-category-badge,
    .trip-item .trip-stay-badge,
    .trip-item .trip-note-badge,
    .trip-item .trip-opening-badge,
    .trip-item .stop-lock-badge,
    .trip-item .trip-cost-row,
    .trip-item .trip-stop-actions {
        display: none;
    }

    .trip-item.mobile-expanded {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .trip-item.mobile-expanded .trip-stop-main-row {
        flex-wrap: wrap !important;
    }

    .trip-item.mobile-expanded .trip-leg-chip,
    .trip-item.mobile-expanded .trip-time-chip,
    .trip-item.mobile-expanded .trip-category-badge,
    .trip-item.mobile-expanded .trip-stay-badge,
    .trip-item.mobile-expanded .trip-note-badge,
    .trip-item.mobile-expanded .trip-opening-badge,
    .trip-item.mobile-expanded .stop-lock-badge,
    .trip-item.mobile-expanded .trip-cost-row {
        display: inline-flex;
    }

    .trip-item.mobile-expanded .trip-cost-row {
        display: flex;
        width: 100%;
    }

    .trip-item.mobile-expanded .trip-stop-actions {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr;
        gap: 8px;
        padding-top: 8px;
        border-top: 1px solid var(--border);
    }

    .trip-item.mobile-expanded .trip-action-chip,
    .trip-item.mobile-expanded .trip-stop-actions .btn-icon-small:not(.delete-btn) {
        display: none;
    }

    .trip-item.mobile-just-added {
        border-color: rgba(20, 184, 166, 0.5);
        box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.14), var(--shadow-soft);
    }

    .trip-stop-actions .btn-icon-small,
    .trip-action-chip {
        width: 100%;
        min-height: 38px;
    }

    .active-trip-badge {
        position: relative;
        grid-column: 1;
        align-self: center;
        padding: 0 0 0 14px;
        border: 0;
        background: transparent;
        color: var(--text-muted);
        font-size: 0.68rem;
        line-height: 1.2;
        max-width: 100%;
    }

    .active-trip-badge::before {
        content: "";
        position: absolute;
        left: 0;
        top: 50%;
        width: 8px;
        height: 8px;
        border-radius: 999px;
        background: #f59e0b;
        transform: translateY(-50%);
        box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.14);
    }

    .active-trip-badge.active::before {
        background: #22c55e;
        box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.14);
    }

    .trip-save-actions {
        grid-column: 2;
        display: grid;
        grid-template-columns: minmax(76px, 1fr) 42px;
        gap: 6px;
        align-items: center;
        min-width: 126px;
    }

    .mobile-save-primary {
        display: inline-flex;
        min-height: 36px;
        padding: 0 14px;
    }

    .trip-save-actions #updateRouteBtn {
        display: none;
    }

    .trip-save-actions #saveRouteBtn {
        min-width: 42px;
        width: 42px;
        min-height: 36px;
        padding: 0;
        font-size: 0;
    }

    .trip-save-actions #saveRouteBtn::before {
        content: "New";
        font-size: 0.72rem;
        font-weight: 900;
    }

    #exportItineraryBtn {
        display: none;
    }

    .map-overlay-dock {
        display: none;
    }

    .stats-card {
        display: block !important;
        pointer-events: auto;
        width: 100%;
        min-width: 0;
        padding: 9px 10px;
        border-radius: 999px;
    }

    .stats-header-row {
        display: none;
    }

    .stats-grid,
    .stats-grid-4 {
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 5px;
        margin: 0;
        font-size: 0.92rem;
        text-align: center;
    }

    .stats-grid small {
        display: block;
        margin: 1px 0 0;
        font-size: 0.62rem;
    }

    .stats-card .btn {
        display: none;
    }

    #toastContainer {
        top: calc(max(10px, env(safe-area-inset-top)) + 72px);
        right: auto;
        bottom: auto;
        left: 50%;
        width: min(390px, calc(100vw - 28px));
        transform: translateX(-50%);
        z-index: 1500;
    }

    body.mobile-search-active #toastContainer {
        top: auto;
        bottom: max(18px, env(safe-area-inset-bottom));
    }

    .planner-control-card {
        display: none;
    }

    body.mobile-smart-settings-open #plannerControlOverlay {
        position: fixed;
        inset: max(12px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
        z-index: 1451;
        display: block;
        width: auto;
        max-width: none;
        max-height: none;
        overflow-y: auto;
        padding: 16px;
        border-radius: 24px;
        pointer-events: auto;
    }

    body.mobile-smart-settings-open .map-overlay-dock {
        z-index: 1450;
        pointer-events: auto;
    }

    body.mobile-smart-settings-open #statsOverlay {
        display: none !important;
    }

    body.mobile-smart-settings-open::after {
        content: "";
        position: fixed;
        inset: 0;
        z-index: 1400;
        background: rgba(15, 23, 42, 0.42);
        backdrop-filter: blur(2px);
    }

    .mobile-smart-close-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 34px;
        height: 34px;
        border: 1px solid var(--border);
        border-radius: 999px;
        background: var(--card-bg);
        color: var(--text-main);
        cursor: pointer;
        font-size: 1.2rem;
        font-weight: 900;
    }

    .planner-primary-actions {
        position: sticky;
        top: 0;
        grid-template-columns: 1fr;
    }

    .planner-scope-card,
    .smart-day-grid,
    .planner-more-action-grid,
    .budget-controls-grid,
    .misc-form-row {
        grid-template-columns: 1fr;
    }

    .modal {
        align-items: flex-end;
        padding: 10px;
    }

    .modal-content,
    .modal-place-planner,
    .modal-wide,
    .modal-media {
        width: 100%;
        max-width: none;
        max-height: calc(var(--app-height, 100dvh) - 20px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
        overflow-y: auto;
        border-radius: 22px 22px 18px 18px;
        padding: 18px;
    }

    body.mobile-place-card-open .modal-place-planner {
        max-height: min(calc(var(--app-height, 100dvh) - 20px - env(safe-area-inset-top) - env(safe-area-inset-bottom)), 86dvh);
        overflow-y: auto;
        overscroll-behavior: contain;
    }

    body.mobile-place-card-open .modal-place-planner .modal-header {
        position: sticky;
        top: -18px;
        z-index: 2;
        margin: -18px -18px 12px;
        padding: 18px 18px 12px;
        background: var(--surface-strong);
        border-bottom: 1px solid var(--border);
    }

    body.mobile-place-card-open .modal-place-planner .modal-actions {
        position: sticky;
        bottom: -18px;
        z-index: 2;
        margin: 12px -18px -18px;
        padding: 12px 18px calc(14px + env(safe-area-inset-bottom));
        background: var(--surface-strong);
        border-top: 1px solid var(--border);
    }

    body.mobile-place-card-open .modal-place-planner .planner-helper-box {
        display: none;
    }
}

@media (max-width: 940px) and (max-height: 520px) and (pointer: coarse) {
    .mobile-top-bar {
        right: auto;
        width: min(330px, 44vw);
    }

    .mobile-brand {
        display: none;
    }

    .planner-search {
        top: max(10px, env(safe-area-inset-top));
        bottom: auto;
        left: max(12px, env(safe-area-inset-left));
        right: auto;
        width: min(360px, 44vw);
    }

    body.mobile-search-active .planner-search {
        top: max(10px, env(safe-area-inset-top));
        bottom: auto;
    }

    #sidebar {
        top: max(68px, calc(env(safe-area-inset-top) + 64px));
        right: auto;
        bottom: max(10px, env(safe-area-inset-bottom));
        left: max(10px, env(safe-area-inset-left));
        width: min(390px, 45vw);
        height: min(var(--mobile-sheet-height, calc(var(--app-height, 100dvh) - 78px)), calc(var(--app-height, 100dvh) - 78px - env(safe-area-inset-top) - env(safe-area-inset-bottom)));
        max-height: none;
    }

    .map-overlay-dock {
        top: max(10px, env(safe-area-inset-top));
        left: auto;
        right: max(10px, env(safe-area-inset-right));
        width: min(350px, 42vw);
    }

    .stats-grid,
    .stats-grid-4 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* =========================
   FLOATING CORE MOBILE UI
   ========================= */

#mobile-ui-layer {
    display: none;
}

@media (max-width: 900px), (max-width: 940px) and (max-height: 520px) and (pointer: coarse) {
    #sidebar {
        display: none !important;
    }

    #map {
        position: fixed;
        inset: 0;
        width: 100%;
        height: var(--app-height, 100dvh);
    }

    .map-overlay-dock,
    .planner-control-card {
        display: none !important;
    }

    #mobile-ui-layer {
        position: fixed;
        inset: 0;
        z-index: 1200;
        display: block;
        pointer-events: none;
    }

    #mobile-ui-layer button,
    #mobile-ui-layer a,
    #mobile-ui-layer input,
    #mobile-ui-layer section,
    #mobile-ui-layer aside,
    #mobile-ui-layer nav,
    #mobile-ui-layer div {
        pointer-events: auto;
    }

    .mobile-search-pill {
        position: fixed;
        top: calc(env(safe-area-inset-top) + 12px);
        left: calc(env(safe-area-inset-left) + 14px);
        right: calc(env(safe-area-inset-right) + 14px);
        z-index: 1240;
        display: flex;
        align-items: center;
        gap: 10px;
        min-height: 56px;
        padding: 7px;
        border: 1px solid rgba(148, 163, 184, 0.22);
        border-radius: 999px;
        background: rgba(16, 24, 39, 0.96);
        box-shadow: 0 18px 38px rgba(0, 0, 0, 0.34);
        color: #f8fafc;
    }

    .mobile-icon-button {
        flex: 0 0 auto;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 42px;
        height: 42px;
        border: 0;
        border-radius: 999px;
        background: rgba(255, 255, 255, 0.1);
        color: inherit;
        cursor: pointer;
        font-size: 1.2rem;
        font-weight: 900;
        line-height: 1;
    }

    .mobile-icon-button.light {
        border: 1px solid rgba(15, 23, 42, 0.08);
        background: #f8fafc;
        color: #0f172a;
        box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
    }

    .mobile-search-trigger {
        flex: 1 1 auto;
        display: flex;
        align-items: center;
        gap: 10px;
        min-width: 0;
        min-height: 42px;
        padding: 0 14px;
        border: 0;
        border-radius: 999px;
        background: transparent;
        color: #cbd5e1;
        cursor: pointer;
        text-align: left;
        font-size: 0.98rem;
        font-weight: 800;
    }

    .mobile-search-trigger span:last-child {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .mobile-search-glyph {
        position: relative;
        flex: 0 0 18px;
        width: 18px;
        height: 18px;
        border: 2px solid currentColor;
        border-radius: 50%;
        opacity: 0.9;
    }

    .mobile-search-glyph::after {
        content: "";
        position: absolute;
        right: -5px;
        bottom: -4px;
        width: 8px;
        height: 2px;
        border-radius: 999px;
        background: currentColor;
        transform: rotate(45deg);
    }

    .mobile-search-overlay {
        position: fixed;
        inset: 0;
        z-index: 1700;
        display: flex;
        flex-direction: column;
        gap: 14px;
        padding: calc(env(safe-area-inset-top) + 14px) calc(env(safe-area-inset-right) + 14px) calc(env(safe-area-inset-bottom) + 14px) calc(env(safe-area-inset-left) + 14px);
        background: #ffffff;
        color: #0f172a;
        opacity: 0;
        visibility: hidden;
        transform: translateY(10px);
        transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s ease;
        pointer-events: none;
    }

    body.mobile-search-open .mobile-search-overlay {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
        pointer-events: auto;
    }

    .mobile-search-overlay-head,
    .mobile-panel-head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        min-width: 0;
    }

    .mobile-search-overlay-head {
        justify-content: flex-start;
    }

    .mobile-search-overlay-head > div,
    .mobile-panel-head > div {
        display: grid;
        gap: 2px;
        min-width: 0;
    }

    .mobile-search-overlay-head strong,
    .mobile-panel-head strong {
        color: inherit;
        font-size: 1rem;
        font-weight: 900;
        line-height: 1.2;
    }

    .mobile-search-overlay-head span,
    .mobile-panel-head span {
        min-width: 0;
        overflow: hidden;
        color: #64748b;
        font-size: 0.78rem;
        font-weight: 800;
        line-height: 1.3;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .mobile-feature-badge {
        display: inline-flex;
        align-items: center;
        width: fit-content;
        max-width: 100%;
        min-height: 32px;
        padding: 7px 12px;
        border: 1px solid #c7d2fe;
        border-radius: 999px;
        background: #eef2ff;
        color: #475569;
        font-size: 0.76rem;
        font-weight: 850;
        line-height: 1.25;
    }

    .mobile-search-input-wrap {
        display: flex;
        align-items: center;
        gap: 12px;
        min-height: 56px;
        padding: 0 16px;
        border: 1px solid rgba(15, 23, 42, 0.08);
        border-radius: 999px;
        background: #f1f5f9;
        color: #475569;
        box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.56);
    }

    .mobile-search-input-wrap input {
        width: 100%;
        min-width: 0;
        border: 0;
        outline: 0;
        background: transparent;
        color: #0f172a;
        font-size: 1rem;
        font-weight: 700;
    }

    .mobile-search-input-wrap input::placeholder {
        color: #94a3b8;
    }

    .mobile-search-results {
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto;
        overscroll-behavior: contain;
        padding: 4px 0 18px;
    }

    .mobile-result-item {
        display: flex;
        align-items: center;
        gap: 0;
        width: 100%;
        min-height: 76px;
        padding: 14px 2px;
        border: 0;
        border-bottom: 1px solid rgba(15, 23, 42, 0.08);
        background: transparent;
        color: #0f172a;
        cursor: pointer;
        text-align: left;
    }

    .mobile-result-icon {
        flex: 0 0 42px;
        display: flex;
        align-items: center;
        justify-content: center;
        width: 42px;
        height: 42px;
        margin-right: 16px;
        border-radius: 999px;
        background: #e2e8f0;
        color: #475569;
    }

    .mobile-result-icon::before {
        content: "";
        width: 13px;
        height: 13px;
        border: 2px solid currentColor;
        border-radius: 50% 50% 50% 0;
        transform: rotate(-45deg);
    }

    .mobile-result-copy {
        display: flex;
        flex: 1 1 auto;
        min-width: 0;
        flex-direction: column;
        overflow: hidden;
    }

    .mobile-result-title,
    .mobile-result-address {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .mobile-result-title {
        color: #0f172a;
        font-size: 0.96rem;
        font-weight: 900;
        line-height: 1.35;
    }

    .mobile-result-address {
        margin-top: 3px;
        color: #64748b;
        font-size: 0.82rem;
        font-weight: 700;
        line-height: 1.35;
    }

    .mobile-result-add {
        flex: 0 0 auto;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 54px;
        height: 34px;
        margin-left: 12px;
        padding: 0 12px;
        border: 1px solid #c7d2fe;
        border-radius: 999px;
        background: #eef2ff;
        color: #4338ca;
        box-shadow: none;
        font-size: 0.72rem;
        font-weight: 900;
        line-height: 1;
    }

    .mobile-result-status {
        cursor: default;
    }

    .mobile-day-carousel {
        position: fixed;
        right: 0;
        bottom: calc(env(safe-area-inset-bottom) + 12px);
        left: 0;
        z-index: 1230;
        display: flex;
        gap: 10px;
        min-height: 58px;
        padding: 0 calc(env(safe-area-inset-right) + 14px) 0 calc(env(safe-area-inset-left) + 14px);
        overflow-x: auto;
        overscroll-behavior-x: contain;
        scrollbar-width: none;
    }

    .mobile-day-carousel::-webkit-scrollbar {
        display: none;
    }

    .mobile-day-pill {
        flex: 0 0 auto;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 86px;
        min-height: 48px;
        padding: 0 16px;
        border: 1px solid rgba(148, 163, 184, 0.24);
        border-radius: 999px;
        background: rgba(16, 24, 39, 0.94);
        color: #cbd5e1;
        box-shadow: 0 14px 28px rgba(0, 0, 0, 0.28);
        cursor: pointer;
        font-size: 0.86rem;
        font-weight: 900;
        white-space: nowrap;
    }

    .mobile-day-pill.active {
        border-color: rgba(129, 140, 248, 0.78);
        background: #4f46e5;
        color: #ffffff;
    }

    .mobile-day-pill.add {
        min-width: 76px;
        background: rgba(255, 255, 255, 0.96);
        color: #0f172a;
    }

    .mobile-optimize-fab {
        position: fixed;
        right: calc(env(safe-area-inset-right) + 16px);
        bottom: calc(env(safe-area-inset-bottom) + 82px);
        z-index: 1240;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 60px;
        height: 60px;
        border: 0;
        border-radius: 999px;
        background: linear-gradient(135deg, #4f46e5, #14b8a6);
        color: #ffffff;
        box-shadow: 0 18px 36px rgba(15, 23, 42, 0.36);
        cursor: pointer;
        font-size: 0.78rem;
        font-weight: 900;
    }

    .mobile-optimize-fab:disabled {
        opacity: 0.48;
        cursor: not-allowed;
        filter: grayscale(0.25);
    }

    .mobile-backdrop {
        position: fixed;
        inset: 0;
        z-index: 1250;
        display: none;
        border: 0;
        background: rgba(15, 23, 42, 0.32);
        pointer-events: none;
    }

    body.mobile-menu-open #mobileGlobalMenuBackdrop,
    body.mobile-day-panel-open #mobileDayPanelBackdrop,
    body.mobile-optimize-open #mobileOptimizeBackdrop {
        display: block;
        pointer-events: auto;
    }

    .mobile-global-menu,
    .mobile-day-panel,
    .mobile-optimize-sheet {
        position: fixed;
        z-index: 1260;
        border: 1px solid rgba(148, 163, 184, 0.22);
        background: #ffffff;
        color: #0f172a;
        box-shadow: 0 28px 60px rgba(15, 23, 42, 0.34);
        pointer-events: auto;
        transition: transform 0.22s ease, opacity 0.22s ease, visibility 0.22s ease;
    }

    .mobile-global-menu {
        top: 0;
        bottom: 0;
        left: 0;
        display: flex;
        flex-direction: column;
        gap: 14px;
        width: min(360px, calc(100vw - 42px));
        padding: calc(env(safe-area-inset-top) + 18px) 16px calc(env(safe-area-inset-bottom) + 18px);
        overflow-y: auto;
        transform: translateX(-104%);
        visibility: hidden;
    }

    body.mobile-menu-open .mobile-global-menu {
        transform: translateX(0);
        visibility: visible;
    }

    .mobile-menu-user,
    .mobile-token-card {
        margin: 0;
    }

    .mobile-menu-actions {
        display: grid;
        gap: 9px;
    }

    .mobile-menu-actions .btn,
    .mobile-menu-actions .nav-link-btn {
        width: 100%;
        min-height: 44px;
        justify-content: center;
        text-decoration: none;
    }

    .mobile-day-panel {
        right: calc(env(safe-area-inset-right) + 10px);
        bottom: 0;
        left: calc(env(safe-area-inset-left) + 10px);
        display: flex;
        flex-direction: column;
        max-height: min(60vh, calc(var(--app-height, 100dvh) - 96px));
        padding: 16px 14px calc(env(safe-area-inset-bottom) + 16px);
        border-radius: 24px 24px 0 0;
        transform: translateY(108%);
        visibility: hidden;
    }

    body.mobile-day-panel-open .mobile-day-panel {
        transform: translateY(0);
        visibility: visible;
    }

    .mobile-day-stop-list {
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto;
        overscroll-behavior: contain;
        padding-top: 12px;
    }

    .mobile-stop-card {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr);
        gap: 10px 12px;
        padding: 13px 0;
        border-bottom: 1px solid rgba(15, 23, 42, 0.08);
    }

    .mobile-stop-card.mobile-just-added {
        border-radius: 18px;
        background: rgba(20, 184, 166, 0.1);
        box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.14);
    }

    .mobile-stop-index {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 32px;
        height: 32px;
        border-radius: 999px;
        background: #eef2ff;
        color: #4f46e5;
        font-size: 0.82rem;
        font-weight: 900;
    }

    .mobile-stop-copy {
        min-width: 0;
    }

    .mobile-stop-copy strong,
    .mobile-stop-copy span {
        display: block;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .mobile-stop-copy strong {
        color: #0f172a;
        font-size: 0.94rem;
        line-height: 1.35;
    }

    .mobile-stop-copy span {
        margin-top: 2px;
        color: #64748b;
        font-size: 0.78rem;
        font-weight: 700;
    }

    .mobile-stop-actions {
        grid-column: 1 / -1;
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 8px;
    }

    .mobile-stop-actions button {
        min-height: 40px;
        border: 1px solid rgba(15, 23, 42, 0.1);
        border-radius: 12px;
        background: #f8fafc;
        color: #334155;
        cursor: pointer;
        font-size: 0.76rem;
        font-weight: 900;
    }

    .mobile-stop-actions button:disabled {
        opacity: 0.42;
        cursor: not-allowed;
    }

    .mobile-stop-actions .danger {
        color: #b91c1c;
        background: #fff1f2;
    }

    .mobile-empty-panel {
        display: grid;
        place-items: center;
        min-height: 160px;
        padding: 22px;
        border: 1px dashed rgba(15, 23, 42, 0.16);
        border-radius: 18px;
        color: #64748b;
        text-align: center;
        font-weight: 800;
    }

    .mobile-optimize-sheet {
        right: calc(env(safe-area-inset-right) + 12px);
        bottom: calc(env(safe-area-inset-bottom) + 82px);
        width: min(330px, calc(100vw - 24px - env(safe-area-inset-left) - env(safe-area-inset-right)));
        display: grid;
        gap: 14px;
        padding: 16px;
        border-radius: 24px;
        opacity: 0;
        transform: translateY(16px) scale(0.96);
        visibility: hidden;
        transform-origin: right bottom;
    }

    body.mobile-optimize-open .mobile-optimize-sheet {
        opacity: 1;
        transform: translateY(0) scale(1);
        visibility: visible;
    }

    .mobile-route-toggle-row {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .mobile-route-toggle {
        min-height: 44px;
        border: 1px solid rgba(15, 23, 42, 0.12);
        border-radius: 14px;
        background: #f8fafc;
        color: #334155;
        cursor: pointer;
        font-size: 0.78rem;
        font-weight: 900;
    }

    .mobile-route-toggle.active {
        border-color: #4f46e5;
        background: #4f46e5;
        color: #ffffff;
    }

    .mobile-route-toggle.locked-feature {
        border-style: dashed;
        color: #64748b;
    }

    .mobile-calculate-btn {
        width: 100%;
        min-height: 46px;
    }

    #toastContainer {
        z-index: 1900;
    }
}
