:root {
    color-scheme: light;
    --nav-width: 238px;
    --nav-collapsed-width: 48px;
    --topbar-height: 56px;
    --navy-950: #061633;
    --navy-800: #18365f;
    --blue-700: #2358a5;
    --blue-100: #e9f0fb;
    --blue-050: #f4f7fc;
    --surface: #ffffff;
    --canvas: #f2f5fa;
    --line: #d5deeb;
    --line-soft: #e6ebf3;
    --muted: #64748b;
    --success: #18754a;
    --danger: #bb432e;
    --shadow: 0 12px 32px rgba(22, 43, 77, 0.08);
    font-family: "Noto Sans JP", "Yu Gothic UI", Meiryo, sans-serif;
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
    margin: 0;
}

body {
    min-width: 320px;
    background: var(--canvas);
    color: var(--navy-950);
    font-size: 14px;
}

button,
input,
select {
    font: inherit;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

.appShell {
    min-height: 100vh;
}

.topbar {
    position: fixed;
    z-index: 40;
    top: 0;
    right: 0;
    left: 0;
    display: grid;
    grid-template-columns: var(--nav-width) minmax(0, 1fr);
    height: var(--topbar-height);
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    transition: grid-template-columns 160ms ease;
}

.brandArea {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 14px;
    border-right: 1px solid var(--line);
}

.brandName {
    color: var(--navy-950);
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.02em;
    text-decoration: none;
}

.brandName span {
    color: var(--blue-700);
}

.menuToggle {
    display: block;
    width: 34px;
    height: 34px;
    margin-left: auto;
    padding: 0;
    color: var(--navy-800);
    background: transparent;
    border: 0;
    border-radius: 6px;
    cursor: pointer;
}

.menuToggle::before {
    display: block;
    width: 8px;
    height: 8px;
    margin: auto;
    content: "";
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(135deg);
}

.menuToggle:hover {
    background: var(--blue-050);
}

.topbarMain {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 22px;
}

.globalSearch {
    position: relative;
    width: min(100%, 370px);
}

.globalSearch::before {
    position: absolute;
    top: 50%;
    left: 13px;
    content: "⌕";
    color: var(--muted);
    font-size: 18px;
    transform: translateY(-52%);
    pointer-events: none;
}

.globalSearch input {
    width: 100%;
    height: 36px;
    padding: 0 12px 0 39px;
    color: var(--navy-950);
    background: #f9fbfe;
    border: 1px solid var(--line);
    border-radius: 6px;
    outline: none;
}

.globalSearch input:focus {
    background: var(--surface);
    border-color: #7e9dca;
    box-shadow: 0 0 0 3px rgba(35, 88, 165, 0.12);
}

.sidebar {
    position: fixed;
    z-index: 30;
    top: var(--topbar-height);
    bottom: 0;
    left: 0;
    display: flex;
    width: var(--nav-width);
    flex-direction: column;
    background: var(--surface);
    border-right: 1px solid var(--line);
    transition: width 160ms ease, transform 180ms ease;
}

.primaryNav {
    flex: 1;
    padding: 14px 10px;
    overflow-y: auto;
}

.navGroup {
    margin: 0 0 14px;
}

.navItem {
    position: relative;
    display: flex;
    min-height: 34px;
    align-items: center;
    gap: 10px;
    padding: 7px 10px;
    color: #344764;
    border-radius: 5px;
    font-weight: 500;
    text-decoration: none;
}

.navItem:hover {
    color: var(--blue-700);
    background: var(--blue-050);
}

.navItem.is-active {
    color: var(--navy-800);
    background: #e9eef6;
    font-weight: 700;
}

.navItem.is-active::before {
    position: absolute;
    top: 5px;
    bottom: 5px;
    left: -10px;
    width: 3px;
    content: "";
    background: var(--blue-700);
    border-radius: 0 2px 2px 0;
}

.navIcon {
    width: 16px;
    color: #58708e;
    font-size: 15px;
    text-align: center;
}

.navChildren {
    display: grid;
    gap: 2px;
    margin: 3px 0 0 30px;
}

.navChild {
    padding: 6px 8px;
    color: #52657f;
    border-radius: 4px;
    font-size: 13px;
    text-decoration: none;
}

.navChild:hover,
.navChild.is-active {
    color: var(--blue-700);
    background: var(--blue-050);
}

.mainArea {
    min-height: 100vh;
    margin-left: var(--nav-width);
    padding-top: var(--topbar-height);
    transition: margin-left 160ms ease;
}

.contentFrame {
    width: calc(100% - 34px);
    margin: 0 auto;
}

.pageHeading {
    display: flex;
    min-height: 72px;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.pageTitleLine {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.pageTitle {
    margin: 0;
    font-size: 22px;
    letter-spacing: 0.01em;
}

.headingMeta {
    color: var(--muted);
    font-size: 12px;
    white-space: nowrap;
}

.pageTabs {
    display: flex;
    min-height: 49px;
    align-items: center;
    gap: 2px;
    padding: 0 12px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-right: 0;
    border-left: 0;
    overflow-x: auto;
}

.pageTab {
    flex: 0 0 auto;
    padding: 7px 14px;
    color: #4d627f;
    background: transparent;
    border: 0;
    border-radius: 18px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
}

.pageTab:hover {
    color: var(--blue-700);
}

.pageTab.is-active {
    color: var(--blue-700);
    background: var(--blue-100);
    font-weight: 700;
}

.sidebarOverlay {
    display: none;
}

@media (min-width: 901px) {
    .appShell.is-nav-collapsed {
        --nav-width: var(--nav-collapsed-width);
    }

    .is-nav-collapsed .brandArea {
        padding: 0 7px;
    }

    .is-nav-collapsed .brandName,
    .is-nav-collapsed .primaryNav {
        display: none;
    }

    .is-nav-collapsed .menuToggle {
        margin-left: 0;
    }

    .is-nav-collapsed .menuToggle::before {
        transform: rotate(-45deg);
    }
}

@media (max-width: 900px) {
    :root {
        --nav-width: 220px;
    }

    .topbar {
        grid-template-columns: 190px minmax(0, 1fr);
    }

    .brandArea {
        border-right: 0;
    }

    .menuToggle {
        display: block;
    }

    .menuToggle::before {
        width: auto;
        height: auto;
        content: "☰";
        border: 0;
        font-size: 20px;
        transform: none;
    }

    .is-menu-open .menuToggle::before {
        content: "×";
    }

    .sidebar {
        box-shadow: var(--shadow);
        transform: translateX(-105%);
        transition: transform 180ms ease;
    }

    .is-menu-open .sidebar {
        transform: translateX(0);
    }

    .sidebarOverlay {
        position: fixed;
        z-index: 20;
        inset: var(--topbar-height) 0 0;
        display: block;
        visibility: hidden;
        background: rgba(6, 22, 51, 0.25);
        opacity: 0;
        transition: opacity 180ms ease, visibility 180ms ease;
    }

    .is-menu-open .sidebarOverlay {
        visibility: visible;
        opacity: 1;
    }

    .mainArea {
        margin-left: 0;
    }
}

@media (max-width: 620px) {
    :root {
        --topbar-height: 52px;
    }

    .topbar {
        grid-template-columns: 52px minmax(0, 1fr);
    }

    .brandName {
        display: none;
    }

    .brandArea {
        padding: 0 9px;
    }

    .topbarMain {
        padding: 0 10px 0 4px;
    }

    .contentFrame {
        width: calc(100% - 20px);
    }

    .pageHeading {
        min-height: 82px;
        align-items: flex-start;
        flex-direction: column;
        justify-content: center;
        gap: 5px;
    }

    .headingMeta {
        white-space: normal;
    }
}
