.strategy-planner-body,
.sheet-embed-body {
    margin: 0;
    height: 100vh;
    overflow: hidden;
    font-family: Inter, system-ui, sans-serif;
    font-size: 11px;
}

#backToMenuBtn {
    position: fixed;
    top: 5px;
    left: 5px;
    z-index: 60;
    padding: 3px 8px;
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 4px;
    color: #e2e8f0;
    text-decoration: none;
    font-weight: 700;
    font-size: 10px;
    line-height: 1.2;
}

.sp-panel {
    display: flex;
    flex-direction: column;
    height: 100vh;
    min-height: 0;
    overflow: hidden;
}

.sp-chrome {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 32px;
    padding: 4px 8px 4px 58px;
    flex: 0 0 auto;
    border-bottom: 1px solid rgba(148, 163, 184, 0.18);
    background: rgba(9, 13, 24, 0.94);
    z-index: 10;
}

.sp-chrome-title {
    margin: 0;
    flex: 1 1 auto;
    min-width: 0;
    font-size: 12px;
    font-weight: 800;
    color: #e2e8f0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-left: 6px;
    border-left: 2px solid rgba(59, 130, 246, 0.85);
}

.bop-sheet-body .sp-chrome-title {
    border-left-color: #f59e0b;
}

.calendar-sheet-body .sp-chrome-title,
.iracing-schedule-body .sp-chrome-title {
    border-left-color: #a855f7;
}

.ibt-viewer-kutu-body .sp-chrome-title {
    border-left-color: #0ea5e9;
}

.tower-control-body .sp-chrome-title {
    border-left-color: #22c55e;
}

.sp-chrome-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 0 0 auto;
}

.sp-chip,
.sp-chip-select {
    height: 24px;
    box-sizing: border-box;
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 4px;
    background: rgba(15, 23, 42, 0.92);
    color: #cbd5e1;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
}

.sp-chip {
    padding: 0 8px;
}

.sp-chip:hover,
.sp-chip-select:hover {
    border-color: rgba(59, 130, 246, 0.55);
    color: #f8fafc;
}

.sp-chip.is-active {
    border-color: rgba(59, 130, 246, 0.75);
    background: rgba(37, 99, 235, 0.25);
    color: #eff6ff;
}

.sp-chip--apply {
    border-color: rgba(59, 130, 246, 0.55);
    color: #dbeafe;
}

.sp-chip--external {
    border-color: rgba(245, 158, 11, 0.45);
    color: #fde68a;
}

.sp-chip--external:hover {
    border-color: rgba(251, 191, 36, 0.75);
    background: rgba(120, 53, 15, 0.3);
}

.sp-chip-select {
    max-width: 110px;
    padding: 0 6px;
    appearance: auto;
}

.sp-advanced {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px 6px 58px;
    flex: 0 0 auto;
    border-bottom: 1px solid rgba(148, 163, 184, 0.12);
    background: rgba(15, 23, 42, 0.82);
}

.sp-advanced[hidden] {
    display: none !important;
}

.sp-advanced-url {
    flex: 1 1 auto;
    min-width: 0;
}

.sp-advanced-url input,
.sp-advanced-gid input {
    width: 100%;
    height: 24px;
    box-sizing: border-box;
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: 4px;
    background: rgba(2, 6, 23, 0.65);
    color: #f1f5f9;
    padding: 0 8px;
    font-size: 10px;
}

.sp-advanced-gid {
    flex: 0 0 88px;
}

.sp-advanced-gid[hidden] {
    display: none !important;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.sp-status {
    position: absolute;
    top: 36px;
    left: 58px;
    right: 8px;
    z-index: 20;
    margin: 0;
    padding: 4px 8px;
    font-size: 10px;
    line-height: 1.3;
    border-radius: 4px;
    background: rgba(15, 23, 42, 0.92);
    border: 1px solid rgba(148, 163, 184, 0.22);
    color: #94a3b8;
    pointer-events: none;
}

.sp-status[hidden] {
    display: none !important;
}

.sp-status.is-error {
    color: #fecaca;
    border-color: rgba(248, 113, 113, 0.4);
    background: rgba(127, 29, 29, 0.85);
}

.sp-panel-notice {
    flex: 0 0 auto;
    margin: 0;
    padding: 4px 8px 4px 58px;
    font-size: 10px;
    line-height: 1.35;
    color: #fecaca;
    background: rgba(127, 29, 29, 0.45);
    border-bottom: 1px solid rgba(248, 113, 113, 0.3);
}

.sp-panel-notice.is-hidden {
    display: none !important;
}

.sp-panel-notice-text {
    color: inherit;
}

.sp-sheet-frame-wrap {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    background: #fff;
}

.sp-sheet-frame {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

.sp-sheet-webview[hidden],
.sp-sheet-iframe[hidden] {
    display: none !important;
}

/* Legacy markup (if any page not yet migrated) */
.sp-topbar,
.sp-tabs,
.sp-sheet-toolbar,
.sp-panel-notice-label {
    display: none !important;
}

@media (max-width: 640px) {
    .sp-chrome {
        padding-left: 8px;
        flex-wrap: wrap;
    }

    .sp-advanced {
        padding-left: 8px;
        flex-wrap: wrap;
    }

    #backToMenuBtn {
        position: static;
        margin: 4px 4px 0;
        display: inline-block;
    }

    .sp-status {
        left: 8px;
    }
}
