/* Box layout overrides loaded after the shared theme. */

html body.page-box .box-view-tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 5px;
    width: min(100%, 620px);
    margin: 0 0 18px;
    padding: 4px;
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: 8px;
    background: rgba(2, 6, 23, 0.58);
    box-sizing: border-box;
}

html body.page-box .box-view-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 0;
    min-height: 42px;
    padding: 8px 12px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: #94a3b8;
    font: inherit;
    font-size: 14px;
    font-weight: 900;
    line-height: 1.2;
    white-space: nowrap;
    cursor: pointer;
}

html body.page-box .box-view-tab .box-page-icon {
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
}

html body.page-box .box-view-tab.is-active {
    border-color: rgba(56, 189, 248, 0.42);
    background: rgba(56, 189, 248, 0.10);
    color: #7dd3fc;
}

html body.page-box .box-view-tab:focus-visible {
    outline: 2px solid #fbbf24;
    outline-offset: 2px;
}

html body.page-box #box-login-required {
    width: 100%;
    margin: 0 0 18px;
    box-sizing: border-box;
}

html body.page-box .box-view-panel,
html body.page-box .official-curriculum-list {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

html body.page-box .official-curriculum-toolbar {
    display: grid;
    gap: 12px;
    width: 100%;
    margin-bottom: 14px;
    padding: 12px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.62);
    box-sizing: border-box;
}

html body.page-box .official-curriculum-tab-row {
    display: grid;
    grid-template-columns: 76px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    min-width: 0;
}

html body.page-box .official-curriculum-tab-label {
    color: #cbd5e1;
    font-size: 12px;
    font-weight: 800;
}

html body.page-box .official-curriculum-tabs {
    display: flex;
    gap: 7px;
    width: 100%;
    min-width: 0;
    overflow-x: auto;
    padding: 1px 1px 5px;
    scrollbar-width: thin;
}

html body.page-box .official-curriculum-tab {
    flex: 0 0 auto;
    min-height: 36px;
    padding: 7px 12px;
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 6px;
    background: rgba(15, 23, 42, 0.9);
    color: #cbd5e1;
    font: inherit;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
    box-sizing: border-box;
}

html body.page-box .official-curriculum-tab:hover {
    border-color: rgba(125, 211, 252, 0.52);
    color: #f8fafc;
}

html body.page-box .official-curriculum-tab.is-active {
    border-color: #fbbf24;
    background: rgba(251, 191, 36, 0.12);
    color: #fbbf24;
}

html body.page-box .official-curriculum-tab:focus-visible {
    outline: 2px solid #fbbf24;
    outline-offset: 2px;
}

html body.page-box .official-curriculum-result-count {
    justify-self: end;
    margin: 0;
    color: #94a3b8;
    font-size: 13px;
    font-weight: 800;
    white-space: nowrap;
}

html body.page-box .official-curriculum-list {
    display: block;
}

html body.page-box .official-curriculum-group + .official-curriculum-group {
    margin-top: 24px;
}

html body.page-box .official-curriculum-group-heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin: 0 2px 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.20);
}

html body.page-box .official-curriculum-group-heading h2 {
    margin: 0;
    color: #f8fafc;
    font-size: 17px;
    line-height: 1.4;
}

html body.page-box .official-curriculum-group-heading span {
    color: #94a3b8;
    font-size: 12px;
    font-weight: 800;
}

html body.page-box .official-curriculum-group-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr));
    gap: 12px;
}

html body.page-box .official-curriculum-card {
    min-width: 0;
    padding: 20px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.78);
    box-sizing: border-box;
}

html body.page-box .official-curriculum-card-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    min-width: 0;
}

html body.page-box .official-curriculum-card h3 {
    min-width: 0;
    margin: 0;
    color: #f8fafc;
    font-size: 18px;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

html body.page-box .official-curriculum-access,
html body.page-box .official-curriculum-meta span {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 2px 9px;
    border: 1px solid rgba(125, 211, 252, 0.30);
    border-radius: 999px;
    background: rgba(14, 116, 144, 0.16);
    color: #7dd3fc;
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
    box-sizing: border-box;
}

html body.page-box .official-curriculum-lessons {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
    margin-top: 16px;
}

html body.page-box .official-curriculum-lesson-select {
    width: 100%;
    min-width: 0;
    min-height: 42px;
    padding: 8px 34px 8px 11px;
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 6px;
    background: #0f172a;
    color: #e2e8f0;
    font: inherit;
    font-size: 13px;
    line-height: 1.35;
    text-overflow: ellipsis;
}

html body.page-box .official-curriculum-lesson-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
    min-width: 0;
}

html body.page-box .official-curriculum-lesson,
html body.page-box .official-curriculum-add {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    padding: 8px 12px;
    font-size: 13px;
    line-height: 1.35;
    white-space: normal;
    overflow-wrap: anywhere;
}

html body.page-box .official-curriculum-add-status {
    margin: 0;
    color: #cbd5e1;
    font-size: 13px;
    line-height: 1.5;
}

html body.page-box .official-curriculum-add-status:empty {
    display: none;
}

html body.page-box .official-curriculum-details {
    margin: 9px 0 0;
    color: #cbd5e1;
    font-size: 13px;
    line-height: 1.5;
}

html body.page-box .official-curriculum-objective {
    margin: 12px 0 0;
    color: #94a3b8;
    font-size: 14px;
    line-height: 1.7;
    overflow-wrap: anywhere;
}

html body.page-box .official-curriculum-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 15px;
}

html body.page-box .official-curriculum-meta span {
    border-color: rgba(148, 163, 184, 0.22);
    background: rgba(30, 41, 59, 0.70);
    color: #cbd5e1;
}

html body.page-box .official-curriculum-empty {
    grid-column: 1 / -1;
}

html body.page-box .official-curriculum-empty strong {
    display: block;
    color: #e2e8f0;
    font-size: 16px;
}

html body.page-box .official-curriculum-empty p {
    margin: 7px 0 0;
    color: #94a3b8;
    font-size: 13px;
    line-height: 1.6;
}

html body.page-box.box-writer-select-mode .box-view-tabs {
    display: none;
}

@media (max-width: 699px) {
    html body.page-box .box-view-tabs {
        width: 100%;
        margin-bottom: 14px;
    }

    html body.page-box .box-view-tab {
        min-height: 40px;
        padding: 7px 4px;
        gap: 4px;
        font-size: 11px;
    }

    html body.page-box .box-view-tab .box-page-icon {
        display: none;
    }

    html body.page-box .official-curriculum-toolbar {
        gap: 9px;
        margin-bottom: 10px;
        padding: 10px;
    }

    html body.page-box .official-curriculum-tab-row {
        grid-template-columns: minmax(0, 1fr);
        gap: 5px;
    }

    html body.page-box .official-curriculum-tabs {
        flex-wrap: wrap;
        overflow-x: visible;
        padding-bottom: 1px;
    }

    html body.page-box .official-curriculum-tab {
        min-height: 34px;
        padding: 6px 10px;
        font-size: 12px;
    }

    html body.page-box .official-curriculum-result-count {
        justify-self: start;
        margin: 0;
    }

    html body.page-box .official-curriculum-group-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 9px;
    }

    html body.page-box .official-curriculum-card {
        padding: 16px 14px;
    }

    html body.page-box .official-curriculum-card h3 {
        font-size: 16px;
    }

    html body.page-box .official-curriculum-lessons {
        grid-template-columns: minmax(0, 1fr);
    }

}

@media (orientation: portrait) and (min-width: 700px) and (max-width: 1180px) {
    html body.page-box {
        overflow-x: hidden !important;
    }

    html body.page-box .app-shell > .box-page-main {
        position: relative !important;
        width: 100% !important;
        height: var(--box-content-height, auto) !important;
        min-height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: visible !important;
        box-sizing: border-box !important;
    }

    html body.page-box .box-content-layer {
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        min-width: 0 !important;
        max-width: none !important;
        margin: 0 !important;
        padding: 16px 18px 36px !important;
        box-sizing: border-box !important;
        transform: none !important;
        transform-origin: top left !important;
    }

    html body.page-box .box-page-content,
    html body.page-box .box-view-panel,
    html body.page-box .official-curriculum-toolbar,
    html body.page-box .official-curriculum-list,
    html body.page-box .box-page-list {
        width: 100% !important;
        min-width: 0 !important;
        max-width: none !important;
        box-sizing: border-box !important;
    }

    html body.page-box .box-view-tabs {
        width: 100% !important;
        margin-bottom: 12px !important;
    }

    html body.page-box .box-subtabs {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
        gap: 6px !important;
        width: 100% !important;
        margin: 0 0 12px !important;
        padding: 4px !important;
        box-sizing: border-box !important;
    }

    html body.page-box .box-subtab {
        width: 100% !important;
        min-width: 0 !important;
        min-height: 40px !important;
        height: 40px !important;
        padding: 0 10px !important;
        gap: 7px !important;
        border-radius: 6px !important;
        font-size: 13px !important;
        line-height: 1 !important;
        white-space: nowrap !important;
        overflow: hidden !important;
    }

    html body.page-box .box-subtab .box-page-icon {
        width: 17px !important;
        height: 17px !important;
        flex: 0 0 17px !important;
    }

    html body.page-box .box-action-row {
        display: grid !important;
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
        gap: 8px !important;
        width: 100% !important;
        margin: 0 0 12px !important;
        padding: 0 !important;
        overflow: visible !important;
        box-sizing: border-box !important;
    }

    html body.page-box .box-action-row > .btn:not(#box-writer-cancel-btn) {
        width: 100% !important;
        min-width: 0 !important;
        min-height: 38px !important;
        height: 38px !important;
        margin: 0 !important;
        padding: 0 10px !important;
        gap: 7px !important;
        border-radius: 7px !important;
        font-size: 13px !important;
        line-height: 1 !important;
        white-space: nowrap !important;
    }

    html body.page-box .box-action-row > .btn:not(#box-writer-cancel-btn) .box-page-icon {
        width: 16px !important;
        height: 16px !important;
        flex: 0 0 16px !important;
    }

    html body.page-box .box-page-list {
        gap: 7px !important;
        padding: 0 !important;
    }

    html body.page-box .box-page-card {
        width: 100% !important;
        min-width: 0 !important;
        height: 56px !important;
        min-height: 56px !important;
        max-height: 56px !important;
        padding: 6px 9px !important;
        gap: 7px !important;
        border-radius: 8px !important;
        box-sizing: border-box !important;
    }

    html body.page-box .box-page-card.in-folder {
        width: calc(100% - 28px) !important;
        margin-left: 28px !important;
    }

    html body.page-box .box-card-main,
    html body.page-box .box-card-text {
        min-width: 0 !important;
    }

    html body.page-box .box-card-icon {
        width: 32px !important;
        height: 32px !important;
        flex: 0 0 32px !important;
        border-radius: 7px !important;
    }

    html body.page-box .box-card-icon .box-page-icon {
        width: 17px !important;
        height: 17px !important;
    }

    html body.page-box .box-card-text {
        gap: 7px !important;
    }

    html body.page-box .box-card-title {
        font-size: 14px !important;
        line-height: 1.25 !important;
    }

    html body.page-box .box-card-badge {
        min-height: 18px !important;
        padding: 1px 7px !important;
        font-size: 9px !important;
    }

    html body.page-box .box-icon-action {
        width: 38px !important;
        height: 38px !important;
        flex: 0 0 38px !important;
        border-radius: 6px !important;
    }

    html body.page-box .box-icon-action .box-page-icon {
        width: 20px !important;
        height: 20px !important;
    }

    html body.page-box .box-folder-row {
        min-height: 56px !important;
        padding: 0 12px !important;
        gap: 10px !important;
        border-radius: 8px !important;
    }

    html body.page-box .box-folder-row strong {
        min-width: 0 !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
        font-size: 16px !important;
    }

    html body.page-box .box-folder-row em {
        font-size: 12px !important;
    }

    html body.page-box .box-empty {
        padding: 30px 20px !important;
        border-radius: 8px !important;
        font-size: 15px !important;
    }

    html body.page-box .box-page-msg {
        margin-bottom: 10px !important;
        font-size: 13px !important;
    }
}

/* 2026-09-25 mobile legibility and deep-navy hierarchy. */
html,
html body.page-box {
    background: #030712 !important;
}

html body.page-box .box-view-tabs,
html body.page-box .official-curriculum-toolbar,
html body.page-box .official-curriculum-card {
    border-color: var(--km-line-soft, #3b4a5f);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.16);
}

html body.page-box .box-view-tabs,
html body.page-box .official-curriculum-toolbar {
    background: #08101f;
}

html body.page-box .official-curriculum-card {
    background: #0b1426;
}

html body.page-box .box-view-tab,
html body.page-box .official-curriculum-tab,
html body.page-box .official-curriculum-result-count,
html body.page-box .official-curriculum-group-heading span {
    color: var(--km-muted, #c7d0de);
}

html body.page-box .box-view-tab.is-active {
    border-color: rgba(251, 191, 36, 0.72);
    background: rgba(251, 191, 36, 0.12);
    color: #fbbf24;
}

html body.page-box .official-curriculum-tab {
    border-color: #355174;
    background: #101d34;
}

html body.page-box .official-curriculum-meta span {
    border-color: #263b59;
    background: #101d34;
}

html body.page-box .official-curriculum-group-heading {
    border-color: var(--km-line-soft, #3b4a5f);
}

@media (max-width: 699px) {
    html body.page-box .box-content-layer {
        padding: 18px 14px 40px !important;
    }

    html body.page-box .box-view-tabs {
        margin-bottom: 12px;
        padding: 4px;
        gap: 4px;
    }

    html body.page-box .box-view-tab {
        min-height: 48px;
        padding: 7px 4px;
        font-size: 13px;
        line-height: 1.2;
        white-space: nowrap;
        overflow: hidden;
    }

    html body.page-box .box-view-tab > span {
        min-width: 0;
        text-overflow: clip;
    }

    html body.page-box .official-curriculum-toolbar {
        padding: 12px;
    }

    html body.page-box .official-curriculum-tab {
        min-height: 44px;
        padding: 8px 12px;
        font-size: 14px;
    }

    html body.page-box .official-curriculum-result-count,
    html body.page-box .official-curriculum-group-heading span {
        font-size: 14px;
    }

    html body.page-box .official-curriculum-card {
        padding: 16px;
        box-shadow: none;
    }
}

/* Final ownership: Box subtabs mirror Writer's compact text tabs; filters mirror Writer chips. */
html body.page-box .box-view-tabs {
    width: 100%;
    max-width: none;
    gap: 8px;
    padding: 5px;
    border-color: rgba(148, 163, 184, 0.20);
    border-radius: 8px;
    background: rgba(2, 6, 23, 0.52);
}

html body.page-box .box-view-tab {
    min-height: 42px;
    padding: 8px 12px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: #94a3b8;
    font-size: 14px;
    font-weight: 800;
}

html body.page-box .box-view-tab:hover {
    color: #f8fafc;
}

html body.page-box .box-view-tab.is-active,
html body.page-box .box-view-tab.is-active:hover {
    border-color: rgba(251, 191, 36, 0.42);
    background: rgba(251, 191, 36, 0.10);
    color: #fbbf24;
    box-shadow: none;
}

html body.page-box .official-curriculum-tabs {
    flex-wrap: wrap;
    gap: 7px;
    overflow-x: visible;
}

html body.page-box .official-curriculum-tab {
    min-height: 0;
    height: auto;
    padding: 5px 10px;
    border: 1px solid rgba(148, 163, 184, 0.26);
    border-radius: 999px;
    background: rgba(30, 41, 59, 0.86);
    color: #cbd5e1;
    font-size: 0.74rem;
    font-weight: 700;
}

html body.page-box .official-curriculum-tab:hover {
    border-color: rgba(251, 191, 36, 0.52);
    color: #f8fafc;
}

html body.page-box .official-curriculum-tab.is-active {
    border-color: rgba(251, 191, 36, 0.78);
    background: rgba(251, 191, 36, 0.16);
    color: #facc15;
    box-shadow: none;
}

@media (max-width: 699px) {
    html body.page-box .box-view-tab {
        min-height: 44px;
        height: 44px;
        font-size: 14px;
    }

    html body.page-box .official-curriculum-tab {
        min-height: 44px;
        padding: 8px 12px;
        font-size: 14px;
    }
}
