body[data-system-page]{--sph-safe-top:var(--safe-area-inset-top,env(safe-area-inset-top,0px));--sph-height:calc(42px + var(--sph-safe-top));--header-height:var(--sph-height)}
#systemPageHeader,#systemPageHeader *,#systemPageMenu,#systemPageMenu *{box-sizing:border-box;touch-action:manipulation}
#systemPageHeader{position:fixed;z-index:1000;inset:0 0 auto;display:flex;align-items:center;gap:6px;height:var(--sph-height);min-height:0;padding:calc(var(--sph-safe-top) + 8px) 8px 8px;color:#fff7e8;background:linear-gradient(90deg,#3f2920,#6f4634 62%,#8b5e49);border:0;border-bottom:1px solid #2f1e17;box-shadow:0 3px 12px rgba(63,41,32,.22);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Noto Sans JP",sans-serif}
#systemPageHeader .sph-back,#systemPageHeader .sph-toggle{flex:0 0 25px;display:flex;align-items:center;justify-content:center;width:25px;height:25px;min-height:25px;padding:0;border:1px solid rgba(255,247,232,.28);border-radius:4px;background:rgba(255,247,232,.1);color:#fff7e8;text-decoration:none;cursor:pointer}
#systemPageHeader .sph-back{font-size:24px;line-height:1}
#systemPageHeader .sph-title,#systemPageHeader .sph-name{font-size:14px;font-weight:900;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;line-height:1.2}
#systemPageHeader .sph-title{flex:0 1 auto}#systemPageHeader .sph-name{flex:1;text-align:right;min-width:0}#systemPageHeader .sph-month{font-size:12px;font-weight:900;white-space:nowrap}
#systemPageHeader .sph-toggle{flex-direction:column;gap:3px}#systemPageHeader .sph-toggle span{display:block;width:14px;height:2px;background:#fff7e8;border-radius:1px}
#systemPageBackdrop{position:fixed;z-index:998;inset:var(--sph-height) 0 0;width:100%;height:auto;border:0;border-radius:0;background:rgba(0,0,0,.06);padding:0}
#systemPageMenu{position:fixed;z-index:999;top:calc(var(--sph-height) + 6px);left:auto;right:max(8px,env(safe-area-inset-right,0px));width:300px;max-width:calc(100vw - 16px - env(safe-area-inset-left,0px) - env(safe-area-inset-right,0px));max-height:calc(100dvh - var(--sph-height) - 14px - env(safe-area-inset-bottom,0px));overflow:auto;min-height:48px;padding:12px;color:#2c211c;background:#fffaf3;border:1px solid rgba(111,70,52,.2);border-radius:14px;box-shadow:0 8px 28px rgba(63,41,32,.25);transform-origin:top right;animation:sph-open .15s ease-out}
#systemPageMenu[hidden],#systemPageBackdrop[hidden]{display:none!important}
@keyframes sph-open{from{opacity:0;transform:translateY(-4px) scale(.97)}to{opacity:1;transform:translateY(0) scale(1)}}
#systemPageMenu .row,#systemPageMenu .topbar-actions,#systemPageMenu .resident-toolbar,#systemPageMenu .sort-toolbar,#systemPageMenu .scope-toggle,#systemPageMenu .view-switch{display:flex;align-items:center;flex-wrap:wrap;gap:8px;margin:0 0 10px;padding:0;width:auto;background:transparent;border:0}
#systemPageMenu .view-switch{margin:0}#systemPageMenu .view-button{color:#493127;background:#fff;border:1px solid #cfb5a4;flex:0 1 auto}#systemPageMenu .view-button.is-active{background:#6f4634;color:white}
#systemPageMenu .back-link{display:inline-flex;color:#493127;background:#fff;border:1px solid #cfb5a4;padding:7px 12px;border-radius:6px;text-decoration:none}
body.system-header-ready #site-header,body.system-header-ready .review-head{display:none!important}
body[data-system-page="actual_review"].system-header-ready .actual-review{padding-top:var(--sph-height);grid-template-rows:minmax(0,1fr)}
body[data-system-page="ai_view"].system-header-ready{padding-top:var(--sph-height)}
.system-page-controls{display:flex;justify-content:space-between;align-items:center;gap:12px;padding:12px 16px;flex-wrap:wrap;background:var(--panel)}
@media(max-width:600px){#systemPageHeader .sph-title{max-width:46vw}#systemPageMenu .view-button{flex:1 1 120px}}
@media(prefers-reduced-motion:reduce){#systemPageMenu{animation:none}}
@media print{#systemPageHeader,#systemPageMenu,#systemPageBackdrop{display:none!important}body[data-system-page="ai_view"].system-header-ready{padding-top:0}}
#systemPageMenu .resident-toolbar,#systemPageMenu .sort-toolbar,#systemPageMenu .scope-toggle{justify-content:flex-start}
#systemPageMenu{font-size:14px}
#systemPageMenu button,#systemPageMenu a.btn{min-height:32px;width:auto;padding:5px 12px;font-size:14px;line-height:1.4;border:1px solid #cfb5a4;border-radius:5px;background:#fff;color:#493127;text-decoration:none;cursor:pointer}
#systemPageMenu button.active,#systemPageMenu button.is-active{background:#6f4634;color:#fff}

/* Compact menu anchored to the hamburger button. */
#systemPageMenu .row{display:grid;grid-template-columns:1fr;gap:2px}
#systemPageMenu .row>label{display:flex;align-items:center;gap:8px;min-height:36px;margin:0;padding:4px 2px}
#systemPageMenu .row>.muted{padding:0 2px 4px;font-size:12px}
#systemPageMenu .view-switch,#systemPageMenu .topbar-actions{display:grid;grid-template-columns:1fr;gap:6px}
#systemPageMenu .view-button,#systemPageMenu .back-link,#systemPageMenu .topbar-actions>*{width:100%;min-height:38px;justify-content:flex-start;text-align:left;white-space:normal}
#systemPageMenu .resident-toolbar,#systemPageMenu .sort-toolbar,#systemPageMenu .scope-toggle{flex-wrap:nowrap;gap:6px}
#systemPageMenu .resident-toolbar button,#systemPageMenu .sort-toolbar button,#systemPageMenu .scope-toggle button{flex:1;min-width:0;min-height:38px;padding:5px 8px}
#systemPageMenu>:last-child{margin-bottom:0}
body[data-system-page="line_a"] .app{padding-top:calc(var(--sph-height) + 8px)}
body[data-system-page="line_a"] .line-topbar[hidden]{display:none!important}
body[data-system-page="line_a"] .line-topbar{justify-content:center}
body[data-system-page="line_a"] .line-title-nav{flex:0 1 auto;justify-content:center}
body[data-system-page="line_a"] #systemPageMenu .mode-switch{display:flex;flex-wrap:wrap;gap:6px;margin-bottom:10px}
body[data-system-page="line_a"] #editDrawer{border:1px solid var(--line);border-radius:14px;overflow:auto;max-height:45vh;background:var(--panel);box-shadow:var(--shadow)}
body[data-system-page="line_a"] #editDrawer:not([open]){display:none}
body[data-system-page="line_a"] #editDrawer>summary{display:none}
body[data-system-page="line_a"] #editDrawer .info-content{border-top:0}
body[data-system-page="line_a"] .compact-head>.date-panel{border:0;border-top:1px solid var(--line);border-radius:0;box-shadow:none}
#systemPageMenu .sph-edit-switch{display:flex;align-items:center;gap:8px;min-height:38px;cursor:pointer}
#systemPageMenu .sph-edit-switch>span:first-child{flex:1;font-weight:700}
#systemPageMenu .sph-edit-switch input{appearance:none;width:38px;height:22px;margin:0;border:1px solid #cfb5a4;border-radius:12px;background:#d7c9bf;cursor:pointer;position:relative}
#systemPageMenu .sph-edit-switch input::before{content:"";position:absolute;left:2px;top:2px;width:16px;height:16px;border-radius:50%;background:#fff;transition:transform .15s}
#systemPageMenu .sph-edit-switch input:checked{background:#6f4634}
#systemPageMenu .sph-edit-switch input:checked::before{transform:translateX(16px)}
#systemPageMenu .sph-edit-switch input:focus-visible{outline:2px solid #6f4634;outline-offset:3px}
#systemPageMenu .sph-edit-status{width:28px;font-size:12px;font-weight:700}
@media print{body[data-system-page="line_a"] .app{padding-top:0}body[data-system-page="line_a"] #editDrawer{display:none!important}}
