/* BLACK BOX installer
   Concept: a flight recorder that is also a live terminal — an international-orange
   shell with stencilled markings, a memory dump scrolling inside the sealed unit,
   and one big moment when the unit seals itself. */

@font-face {
    font-family: "BB Stencil";
    src: url("fonts/big-shoulders-stencil.woff2") format("woff2");
    font-weight: 100 900;
    font-display: swap;
}

:root {
    color-scheme: dark;

    --black: #000000;
    --plate: #16171a;       /* the recorder body */
    --plate-edge: #2c2e33;
    --orange: #ff5500;      /* international orange */
    --orange-hot: #ff6e24;
    --orange-deep: #c94300;
    --orange-wash: rgba(255, 85, 0, 0.12);
    --orange-glow: rgba(255, 85, 0, 0.32);
    --bone: #ecebe6;
    --steel: #9a9ea6;
    --steel-dim: #5d6168;
    --alarm: #ff3d6e;
    --glitch-a: rgba(255, 85, 0, 0.75);
    --glitch-b: rgba(0, 229, 255, 0.6);
    --scan: rgba(255, 255, 255, 0.028);
    --grid-dot: rgba(154, 158, 166, 0.09);
    --dump-dim: rgba(154, 158, 166, 0.13);
    --dump-hot: rgba(255, 85, 0, 0.55);

    --stencil: "BB Stencil", "Impact", "Arial Narrow", sans-serif;
    --sans: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic UI", "Meiryo", system-ui, sans-serif;
    --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

    --gutter: clamp(16px, 4vw, 40px);
    --measure: 760px;
}

*,
*::before,
*::after { box-sizing: border-box; }

[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background-color: var(--black);
    background-image: radial-gradient(var(--grid-dot) 1px, transparent 1.2px);
    background-size: 22px 22px;
    color: var(--bone);
    font-family: var(--sans);
    font-size: 16px;
    line-height: 1.75;
}

.page {
    max-width: calc(var(--measure) + var(--gutter) * 2);
    margin: 0 auto;
    padding-block: 20px 48px;
    padding-inline: var(--gutter);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

a { color: var(--steel); text-underline-offset: 3px; }
a:hover { color: var(--bone); }

:focus-visible {
    outline: 3px solid var(--orange);
    outline-offset: 3px;
}

@keyframes blink { 50% { opacity: 0; } }

/* ── masthead ─────────────────────────────────────────── */
.masthead {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}
.wordmark {
    position: relative;
    margin: 0;
    font-family: var(--stencil);
    font-weight: 900;
    font-size: 34px;
    line-height: 1;
    letter-spacing: 0.02em;
    color: var(--orange);
}
.wordmark.is-glitch { animation: wordmark-glitch 280ms steps(2) 1; }
@keyframes wordmark-glitch {
    0%   { text-shadow: 3px 0 var(--glitch-b); transform: translateX(-2px); clip-path: inset(0 0 55% 0); }
    35%  { text-shadow: -3px 0 var(--glitch-b); transform: translateX(3px) skewX(-8deg); clip-path: inset(45% 0 0 0); }
    70%  { text-shadow: 2px 0 var(--glitch-b); transform: translateX(-1px); clip-path: none; }
    100% { text-shadow: none; transform: none; clip-path: none; }
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
}
.app-tag {
    padding: 2px 7px 1px;
    border: 1.5px solid var(--orange);
    border-radius: 3px;
    font-family: var(--stencil);
    font-weight: 900;
    font-size: 14px;
    line-height: 1.2;
    letter-spacing: 0.08em;
    color: var(--orange);
}

/* ── install as an app ────────────────────────────────── */
.install {
    position: relative;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
    padding: 14px 16px;
    border: 1px solid var(--plate-edge);
    border-radius: 6px;
    background: var(--plate);
    overflow: hidden;
}
.install::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: repeating-linear-gradient(-45deg, var(--orange) 0 6px, var(--black) 6px 12px);
}
.install-icon {
    display: block;
    width: 56px;
    height: 56px;
}
.install-title {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.4;
}
.install-text p {
    margin: 2px 0 0;
    font-size: 13px;
    color: var(--steel);
}

.link-state {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--steel);
}
.link-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    border: 1.5px solid var(--steel-dim);
}
.link-state[data-state="linked"] { color: var(--bone); }
.link-state[data-state="linked"] .link-dot {
    background: var(--orange);
    border-color: var(--orange);
    animation: ping 1.8s ease-out infinite;
}
.link-state[data-state="lost"] .link-dot { border-color: var(--alarm); animation: blink 0.8s steps(1) infinite; }
@keyframes ping {
    0%   { box-shadow: 0 0 0 0 var(--orange-glow); }
    80%  { box-shadow: 0 0 0 9px transparent; }
    100% { box-shadow: 0 0 0 0 transparent; }
}

/* ── the sealed unit (the one loud thing) ─────────────── */
.unit {
    position: relative;
    background: var(--plate);
    border: 1px solid var(--plate-edge);
    border-radius: 6px;
    overflow: hidden;
    transition: border-color 400ms, box-shadow 600ms;
}
/* CRT scanlines over the whole unit */
.unit::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: repeating-linear-gradient(to bottom, var(--scan) 0 1px, transparent 1px 3px);
    z-index: 3;
}
.unit[data-sealed="true"] {
    border-color: var(--orange);
    box-shadow: 0 0 0 1px var(--orange), 0 0 48px var(--orange-glow);
}

.unit-band {
    position: relative;
    height: 14px;
    overflow: hidden;
    background: var(--black);
    transition: height 300ms ease-out, background-color 300ms;
}
.band-stripes {
    position: absolute;
    inset: 0 -40px 0 0;
    background: repeating-linear-gradient(-45deg, var(--orange) 0 14px, var(--black) 14px 28px);
}
.unit[data-busy="true"] .band-stripes { animation: march 0.7s linear infinite; }
@keyframes march { to { transform: translateX(-39.598px); } }

.band-text {
    position: absolute;
    top: 50%;
    left: 0;
    display: none;
    white-space: nowrap;
    font-family: var(--stencil);
    font-weight: 900;
    font-size: 15px;
    letter-spacing: 0.08em;
    color: var(--black);
    transform: translateY(-50%);
}
.unit[data-sealed="true"] .unit-band { height: 24px; background: var(--orange); }
.unit[data-sealed="true"] .band-stripes { display: none; }
.unit[data-sealed="true"] .band-text { display: block; animation: marquee 14s linear infinite; }
@keyframes marquee {
    from { transform: translate(0, -50%); }
    to   { transform: translate(-50%, -50%); }
}

.unit-body {
    position: relative;
    isolation: isolate;
    padding: 22px clamp(18px, 4vw, 32px) 26px;
}
.unit-dump {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    -webkit-mask-image: linear-gradient(100deg, rgba(0, 0, 0, 0.35), #000 55%);
    mask-image: linear-gradient(100deg, rgba(0, 0, 0, 0.35), #000 55%);
}

.readout {
    margin: 0;
    font-family: var(--stencil);
    font-weight: 850;
    font-size: clamp(76px, 21vw, 172px);
    line-height: 0.86;
    letter-spacing: 0.01em;
    color: var(--steel-dim);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.readout[data-state="linked"],
.readout[data-state="open"],
.readout[data-state="writing"],
.readout[data-state="written"] { color: var(--bone); }
.readout[data-state="confirm"] { color: var(--orange); }
.readout[data-state="sealed"] { color: var(--orange); text-shadow: 0 0 28px var(--orange-glow); }
.readout[data-state="fault"] { color: var(--alarm); }
.readout.is-glitch { animation: readout-glitch 560ms steps(3) 1; }
@keyframes readout-glitch {
    0%   { text-shadow: 5px 0 var(--glitch-a), -5px 0 var(--glitch-b); transform: translateX(0); }
    20%  { transform: translateX(-4px) skewX(-7deg); clip-path: inset(8% 0 40% 0); }
    40%  { text-shadow: -4px 0 var(--glitch-a), 4px 0 var(--glitch-b); transform: translateX(3px); clip-path: inset(52% 0 6% 0); }
    60%  { transform: translateX(-1px); clip-path: inset(0 0 22% 0); }
    80%  { text-shadow: 2px 0 var(--glitch-a), -2px 0 var(--glitch-b); clip-path: none; }
    100% { text-shadow: none; transform: none; clip-path: none; }
}

.specs {
    margin: 22px 0 0;
    padding-top: 16px;
    border-top: 1px solid var(--plate-edge);
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}
.specs div { min-width: 0; }
.specs dt { font-size: 12px; color: var(--steel); }
.specs dd {
    margin: 2px 0 0;
    font-size: 16px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    overflow-wrap: anywhere;
}

.unit.is-shake { animation: shake 420ms steps(7) 1; }
@keyframes shake {
    0%, 100% { transform: none; }
    15% { transform: translate(-6px, 2px); }
    30% { transform: translate(5px, -2px); }
    45% { transform: translate(-4px, 1px); }
    60% { transform: translate(3px, 0); }
    75% { transform: translate(-1px, -1px); }
}

.flash-veil {
    position: fixed;
    inset: 0;
    pointer-events: none;
    background: var(--orange);
    opacity: 0;
    z-index: 40;
}
.flash-veil.is-on { animation: veil 650ms ease-out 1; }
@keyframes veil {
    0%   { opacity: 0.55; }
    100% { opacity: 0; }
}

/* ── now: what to do right now ────────────────────────── */
.now {
    position: relative;
    display: grid;
    grid-template-columns: 160px minmax(0, 1fr);
    gap: 4px 26px;
    align-items: center;
    margin-top: 16px;
    padding: 22px clamp(18px, 4vw, 28px) 22px;
    border-radius: 6px;
    background: var(--plate);
    border: 1.5px solid var(--plate-edge);
    overflow: hidden;
}
.now::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: -40px;
    height: 6px;
    background: repeating-linear-gradient(-45deg, var(--orange) 0 12px, transparent 12px 24px);
    opacity: 0;
}
.now-figure {
    align-self: start;
    width: 160px;
}
.now-figure svg { display: block; width: 100%; height: auto; }
.now-figure:empty { display: none; }
.now:has(.now-figure:empty) { grid-template-columns: minmax(0, 1fr); }
.now-body { min-width: 0; }

.now-where {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 6px;
    padding: 3px 10px 3px 8px;
    border-radius: 3px;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.04em;
    background: var(--bone);
    color: var(--black);
}
.now-where::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
}
.now-title {
    margin: 0;
    font-size: clamp(21px, 3.4vw, 27px);
    font-weight: 800;
    line-height: 1.35;
    text-wrap: balance;
}
.now-text {
    margin-top: 8px;
    font-size: 15px;
    line-height: 1.75;
    color: var(--bone);
    max-width: 38em;
}
.now-text p { margin: 0; }
.now-text p + p { margin-top: 6px; }
.now-text ol {
    margin: 4px 0 0;
    padding-left: 1.5em;
}
.now-text li { padding-left: 2px; }
.now-text li + li { margin-top: 4px; }
.now-text li::marker { color: var(--orange); font-weight: 800; }
.now-text .muted { color: var(--steel); font-size: 14px; }
.now-text b { color: var(--orange); font-weight: 800; }
.now-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 14px;
    margin-top: 16px;
}
.now-actions:not(:has(.btn:not([hidden]))) { display: none; }
.btn-primary {
    min-height: 52px;
    padding: 12px 28px;
    font-size: 17px;
}
.btn-primary:not(:disabled) { animation: nudge 1.8s ease-out infinite; }

/* where the action happens: PC (white), phone (orange), waiting, done, error */
.now[data-kind="phone"] {
    background: var(--orange);
    border-color: var(--orange);
    color: var(--black);
    animation: call-pulse 1.4s ease-in-out infinite;
}
.now[data-kind="phone"]::before {
    opacity: 1;
    background: repeating-linear-gradient(-45deg, var(--black) 0 12px, transparent 12px 24px);
    animation: march 0.7s linear infinite;
}
.now[data-kind="phone"] .now-where { background: var(--black); color: var(--orange); }
.now[data-kind="phone"] .now-where::before { animation: blink 0.8s steps(1) infinite; }
.now[data-kind="phone"] .now-text,
.now[data-kind="phone"] .now-text .muted { color: var(--black); }
.now[data-kind="phone"] .now-text b { color: var(--black); text-decoration: underline; text-underline-offset: 3px; }
.now[data-kind="phone"] .now-text li::marker { color: var(--black); }
.now[data-kind="phone"] .btn-ghost { color: var(--black); box-shadow: inset 0 0 0 1.5px var(--black); }
.now[data-kind="phone"] .btn-ghost:hover:not(:disabled) { background: var(--orange-hot); }
.now[data-kind="phone"] :focus-visible { outline-color: var(--black); }

.now[data-kind="wait"] .now-where { background: transparent; color: var(--orange); box-shadow: inset 0 0 0 1.5px var(--orange); }
.now[data-kind="wait"] .now-where::before { animation: blink 0.6s steps(1) infinite; }
.now[data-kind="wait"]::before { opacity: 1; animation: march 0.7s linear infinite; }

.now[data-kind="done"] { border-color: var(--orange); }
.now[data-kind="done"] .now-where { background: var(--orange); color: var(--black); }

.now[data-kind="error"] { border-color: var(--alarm); }
.now[data-kind="error"] .now-where { background: var(--alarm); color: var(--black); }
.now[data-kind="error"] .now-title { color: var(--alarm); }

@keyframes call-pulse {
    0%, 100% { box-shadow: 0 0 0 0 var(--orange-glow); }
    50% { box-shadow: 0 0 0 8px transparent; }
}

/* phone illustration */
.ph-body { fill: var(--plate-edge); stroke: var(--steel-dim); stroke-width: 1.5; }
.ph-screen { fill: var(--black); }
.ph-key { fill: var(--steel-dim); }
.ph-key.on { fill: var(--orange); }
.ph-label { font: 700 11px var(--sans); fill: var(--bone); }
.ph-label.on { fill: var(--orange); }
.ph-text { font: 600 7px var(--mono); fill: var(--steel); }
.ph-text.big { font-size: 8.5px; fill: var(--bone); }
.ph-text.red { fill: var(--alarm); }
.ph-opt { fill: none; stroke: var(--steel-dim); stroke-width: 1; }
.ph-opt.on { fill: var(--orange); stroke: var(--orange); }
.ph-text.on { fill: var(--black); }
.ph-warn { fill: var(--alarm); }
.ph-arrow { fill: none; stroke: var(--orange); stroke-width: 2; stroke-linecap: round; }
.ph-sel { animation: blink 1s steps(1) infinite; }
.ph-tick { stroke-width: 1.2; }
.now[data-kind="phone"] .ph-body { fill: var(--black); stroke: var(--black); }
.now[data-kind="phone"] .ph-key { fill: var(--plate-edge); }
.now[data-kind="phone"] .ph-key.on { fill: var(--bone); }
.now[data-kind="phone"] .ph-label { fill: var(--black); }
.now[data-kind="phone"] .ph-label.on { fill: var(--black); }
.now[data-kind="phone"] .ph-arrow { stroke: var(--black); }

.notice {
    margin: 16px 0 0;
    padding: 14px 18px;
    border: 1px solid var(--alarm);
    border-radius: 6px;
    color: var(--bone);
}

/* ── steps: overview tracker ─────────────────────────── */
.steps {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0;
    margin: 16px 0 0;
    padding: 0;
    border: 1px solid var(--plate-edge);
    border-radius: 6px;
    overflow: hidden;
}
.step {
    position: relative;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 2px 10px;
    align-items: start;
    padding: 12px 14px 13px;
    border-left: 1px solid var(--plate-edge);
    border-top: 3px solid transparent;
}
.step:first-child { border-left: 0; }
.step[data-state="current"] {
    border-top-color: var(--orange);
    background: linear-gradient(180deg, var(--orange-wash), transparent 80%);
}
.step[data-state="done"] { border-top-color: var(--orange-deep); }
.step[data-state="todo"] .step-title,
.step[data-state="todo"] .step-no { color: var(--steel-dim); }
.step[data-state="done"] .step-no { color: var(--orange); }

.step-no {
    font-family: var(--stencil);
    font-weight: 900;
    font-size: 34px;
    line-height: 0.95;
    color: var(--bone);
}
.step-main { min-width: 0; }
.step-title {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.4;
}
.step[data-state="done"] .step-title::after {
    content: " ✓";
    color: var(--orange);
}
.step-status {
    margin: 2px 0 0;
    font-size: 12px;
    line-height: 1.5;
    color: var(--steel);
}
.step[data-state="current"] .step-status { color: var(--bone); }
.step-status:empty { display: none; }

.meter {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 14px;
    margin-top: 14px;
}
.meter-blocks {
    display: grid;
    grid-template-columns: repeat(32, minmax(0, 1fr));
    gap: 2px;
}
.meter-blocks span {
    height: 12px;
    background: var(--plate-edge);
}
.meter-blocks span.on { background: var(--orange); }
.meter-blocks span.head { background: var(--orange); animation: blink 0.45s steps(1) infinite; }
.meter-pct {
    min-width: 3.6ch;
    text-align: right;
    font-family: var(--stencil);
    font-weight: 900;
    font-size: 30px;
    line-height: 1;
    color: var(--orange);
    font-variant-numeric: tabular-nums;
}

/* ── buttons ──────────────────────────────────────────── */
.btn {
    position: relative;
    appearance: none;
    min-height: 44px;
    padding: 10px 20px;
    border: 0;
    border-radius: 4px;
    background: var(--orange);
    color: var(--black);
    font: inherit;
    font-size: 15px;
    font-weight: 700;
    white-space: nowrap;
    cursor: pointer;
    transition: transform 80ms, background-color 120ms;
}
.btn:hover:not(:disabled) { background: var(--orange-hot); }
.btn:active:not(:disabled) { background: var(--orange-deep); transform: scale(0.97); }
.btn:disabled {
    background: transparent;
    color: var(--steel-dim);
    box-shadow: inset 0 0 0 1px var(--plate-edge);
    cursor: not-allowed;
}
@keyframes nudge {
    0%   { box-shadow: 0 0 0 0 var(--orange-glow); }
    70%  { box-shadow: 0 0 0 10px transparent; }
    100% { box-shadow: 0 0 0 0 transparent; }
}
.btn-ghost {
    background: transparent;
    color: var(--orange);
    box-shadow: inset 0 0 0 1.5px var(--orange);
}
.btn-ghost:hover:not(:disabled) { background: var(--orange-wash); }

/* ── terminal ─────────────────────────────────────────── */
.term {
    margin-top: 28px;
    border: 1px solid var(--plate-edge);
    border-radius: 6px;
    overflow: hidden;
    background: var(--plate);
}
.term-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 9px 14px;
    border-bottom: 1px solid var(--plate-edge);
    font-size: 13px;
}
.term-title { font-weight: 700; }
.term-live {
    display: flex;
    align-items: center;
    gap: 7px;
    color: var(--steel);
}
.term-live::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--steel-dim);
}
.term-live[data-state="busy"] { color: var(--orange); }
.term-live[data-state="busy"]::before { background: var(--orange); animation: blink 0.6s steps(1) infinite; }
.term-live[data-state="done"] { color: var(--orange); }
.term-live[data-state="done"]::before { background: var(--orange); }

.log {
    margin: 0;
    padding: 12px 14px 14px;
    height: 220px;
    overflow: auto;
    font-family: var(--mono);
    font-size: 12.5px;
    line-height: 1.65;
    color: var(--steel);
    white-space: pre-wrap;
    word-break: break-all;
}
.log::after {
    content: "▌";
    color: var(--orange);
    animation: blink 1s steps(1) infinite;
}
.log-line { display: block; }
.log-line.is-ok { color: var(--bone); }
.log-line.is-hot { color: var(--orange); }
.log-line.is-error { color: var(--alarm); }
.log-line.is-stream { color: var(--steel-dim); }

/* ── panels ───────────────────────────────────────────── */
.panel {
    margin-top: 28px;
    border-top: 1px solid var(--plate-edge);
}
.panel summary {
    padding: 14px 0;
    font-weight: 700;
    cursor: pointer;
}
.prep-list {
    margin: 0 0 8px;
    padding-left: 1.6em;
    color: var(--bone);
}
.prep-list li { margin-bottom: 6px; padding-left: 4px; }
.prep-list li::marker { color: var(--orange); font-weight: 700; }

.foot {
    margin-top: 40px;
    font-size: 12px;
    color: var(--steel-dim);
}
.foot p { margin: 0 0 4px; }

/* ── small screens ────────────────────────────────────── */
@media (max-width: 600px) {
    .wordmark { font-size: 28px; }
    .install { grid-template-columns: auto minmax(0, 1fr); }
    .install-icon { width: 44px; height: 44px; }
    .install > .btn { grid-column: 1 / -1; }
    .specs { grid-template-columns: 1fr 1fr; }
    .specs div:first-child { grid-column: 1 / -1; }
    .now { grid-template-columns: 76px minmax(0, 1fr); gap: 0 14px; align-items: start; }
    .now:has(.now-figure:empty) { grid-template-columns: minmax(0, 1fr); }
    .now-body { display: contents; }
    .now-figure { width: 76px; grid-row: 1 / span 2; }
    .now-where { justify-self: start; }
    .now-title { font-size: 20px; }
    .now-text,
    .meter,
    .now-actions { grid-column: 1 / -1; }
    .now-actions .btn { flex: 1 1 100%; white-space: normal; }
    .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .step:nth-child(odd) { border-left: 0; }
    .step:nth-child(n + 3) { box-shadow: inset 0 1px 0 var(--plate-edge); }
    .step:last-child { grid-column: 1 / -1; }
    .meter-blocks { grid-template-columns: repeat(20, minmax(0, 1fr)); }
    .meter-blocks span:nth-child(n + 21) { display: none; }
    .log { height: 180px; font-size: 11.5px; }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important;
    }
}

/* ═══════════════════════════════════════════════════════════════════
   Side menu + management views (製造記録・正規品チェック・出荷証明の鍵)
   ═══════════════════════════════════════════════════════════════════ */
.shell { min-height: 100vh; }
.side {
    position: sticky; top: 0; z-index: 40;
    display: flex; align-items: center; gap: 4px;
    padding: 8px var(--gutter);
    overflow-x: auto; scrollbar-width: none;
    background: rgba(0, 0, 0, 0.92);
    -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--plate-edge);
}
.side::-webkit-scrollbar { display: none; }
.side-brand, .side-foot { display: none; }
.side-link {
    position: relative; flex: none;
    display: flex; align-items: center; gap: 8px;
    min-height: 40px; padding: 6px 12px; border-radius: 4px;
    color: var(--steel); text-decoration: none; font-weight: 700; font-size: 14px; line-height: 1.3;
}
.side-link svg { flex: none; width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.side-link small { display: none; }
.side-link:hover { color: var(--bone); background: rgba(255, 255, 255, 0.04); }
.side-link[aria-current="page"] { color: var(--black); background: var(--orange); }
.side-count { min-width: 20px; padding: 0 6px; border-radius: 10px; background: var(--plate-edge); color: var(--bone); font: 700 11px/18px var(--mono); text-align: center; }
.side-count:empty { display: none; }
.side-link[aria-current="page"] .side-count { background: rgba(0, 0, 0, 0.25); color: var(--black); }
.side-key { width: 8px; height: 8px; border-radius: 50%; background: var(--steel-dim); }
.side-key[data-state="locked"] { background: #f5b942; }
.side-key[data-state="ready"] { background: #3ddc84; box-shadow: 0 0 0 3px rgba(61, 220, 132, 0.2); }

@media (min-width: 1100px) {
    .shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); }
    .side {
        position: sticky; top: 0; height: 100vh;
        flex-direction: column; align-items: stretch; gap: 2px;
        padding: 22px 14px; overflow-y: auto;
        border-bottom: 0; border-right: 1px solid var(--plate-edge);
        background: rgba(10, 10, 12, 0.94);
    }
    .side-brand {
        display: flex; align-items: baseline; gap: 8px; margin: 0 6px 22px;
        font: 400 26px/1 var(--stencil); letter-spacing: 0.04em; color: var(--orange);
    }
    .side-brand small { font: 700 10px/1 var(--mono); letter-spacing: 0.2em; color: var(--steel); }
    .role-tag { margin-left: 8px; padding: 2px 8px; border-radius: 999px; font: 700 10.5px/1.5 var(--sans); letter-spacing: 0.04em; background: var(--plate-edge); color: var(--bone); }
    .role-tag[data-role="main"] { background: var(--orange); color: var(--black); }
    .side-mark { width: 14px; height: 14px; border: 2px solid var(--orange); position: relative; align-self: center; }
    .side-mark::after { content: ""; position: absolute; left: 2px; top: 2px; width: 4px; height: 4px; background: var(--bone); }
    .side-link { min-height: 54px; padding: 8px 12px; font-size: 15px; }
    .side-link span { flex: 1; min-width: 0; }
    .side-link small { display: block; margin-top: 1px; color: var(--steel-dim); font-weight: 500; font-size: 11.5px; }
    .side-link[aria-current="page"] small { color: rgba(0, 0, 0, 0.6); }
    .side-foot { display: block; margin: auto 6px 0; padding-top: 18px; color: var(--steel-dim); font-size: 11.5px; line-height: 1.6; }
}

.page-wide { max-width: 1180px; }

.v-head { margin: 8px 0 24px; }
.v-eyebrow { margin: 0; color: var(--orange); font: 700 11px/1.4 var(--mono); letter-spacing: 0.18em; }
.v-title { margin: 4px 0 0; font: 400 clamp(40px, 6vw, 56px)/1 var(--stencil); letter-spacing: 0.02em; color: var(--bone); }
.v-lead { margin: 12px 0 0; max-width: 62ch; color: var(--steel); font-size: 14.5px; line-height: 1.8; }
.v-lead code, .empty-state code { font-family: var(--mono); font-size: 0.92em; color: var(--bone); }

.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 1px; background: var(--plate-edge); border: 1px solid var(--plate-edge); border-radius: 6px; overflow: hidden; }
.kpi { display: grid; gap: 2px; padding: 14px 16px; background: var(--plate); }
.kpi span { color: var(--steel); font-size: 12px; font-weight: 700; }
.kpi b { font: 400 34px/1 var(--stencil); color: var(--bone); font-variant-numeric: tabular-nums; }
.kpi:first-child b { color: var(--orange); }

/* online storage bar */
.cloud { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: start; gap: 12px 14px; margin: 0 0 16px; padding: 14px 16px; border: 1px solid var(--plate-edge); border-radius: 6px; background: var(--plate); }
.cloud-dot { flex: none; width: 10px; height: 10px; margin-top: 6px; border-radius: 50%; background: var(--steel-dim); }
.cloud[data-state="online"] .cloud-dot { background: #3ddc84; box-shadow: 0 0 0 3px rgba(61, 220, 132, 0.2); }
.cloud[data-state="pending"] .cloud-dot, .cloud[data-state="signed_out"] .cloud-dot { background: #f5b942; }
.cloud[data-state="error"] .cloud-dot { background: var(--alarm); }
.cloud[data-state="checking"] .cloud-dot { animation: cloudPulse 1.2s ease-in-out infinite; }
@keyframes cloudPulse { 50% { opacity: 0.3; } }
.cloud-body { min-width: 0; }
.cloud-title { margin: 0; color: var(--bone); font-weight: 700; font-size: 14.5px; }
.cloud-text { margin: 3px 0 0; color: var(--steel); font-size: 13px; line-height: 1.7; white-space: pre-line; }
.cloud[data-warn="true"] .cloud-dot { background: #f5b942; box-shadow: none; }
.cloud-text:empty { display: none; }
.cloud-login { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.cloud-login[hidden] { display: none; }
.cloud-login input[type="password"] { flex: 1 1 220px; max-width: 320px; min-height: 40px; padding: 8px 12px; border-radius: 4px; background: var(--black); border: 1px solid var(--plate-edge); color: var(--bone); font: 500 14.5px/1.5 var(--sans); outline: 0; }
.cloud-login input[type="password"]:focus { border-color: var(--orange); }
.cloud-msg { color: #f5b942; font-size: 12.5px; }
.cloud-msg:empty { display: none; }
.cloud-acts { display: flex; flex-wrap: wrap; gap: 8px; }
@media (max-width: 640px) { .cloud-acts { grid-column: 2 / -1; } }
.cloud-acts:not(:has(button:not([hidden]))) { display: none; }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 18px; }
.toolbar-gap { flex: 1; }
.search-box { position: relative; display: flex; align-items: center; flex: 1 1 240px; min-width: 0; }
.search-box svg { position: absolute; left: 12px; width: 18px; height: 18px; fill: none; stroke: var(--steel-dim); stroke-width: 1.8; stroke-linecap: round; }
.search-box input, .toolbar select, .field input, .field select, .field textarea {
    width: 100%; min-height: 42px; padding: 8px 12px; border-radius: 4px;
    background: var(--plate); border: 1px solid var(--plate-edge); color: var(--bone);
    font: 500 14.5px/1.5 var(--sans); outline: 0;
}
.search-box input { padding-left: 38px; }
.toolbar select { width: auto; }
.search-box input:focus, .toolbar select:focus, .field input:focus, .field select:focus, .field textarea:focus { border-color: var(--orange); }
.btn-sm { min-height: 40px; padding: 8px 14px; font-size: 13.5px; }
.file-btn { display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.file-btn input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.file-btn:focus-within { outline: 2px solid var(--orange); outline-offset: 2px; }
.find-btn { display: inline-flex; align-items: center; gap: 6px; }
.find-btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.plugged { display: grid; gap: 8px; margin-top: 12px; }
.plug-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px 14px; padding: 12px 16px; border: 1px solid var(--plate-edge); border-left: 3px solid var(--orange); border-radius: 6px; background: var(--plate); }
.plug-row[data-hit="no"] { border-left-color: #f5b942; }
.plug-row[data-hit="help"] { grid-template-columns: minmax(0, 1fr) auto; align-items: start; border-left-color: var(--steel-dim); }
.plug-dot { width: 10px; height: 10px; border-radius: 50%; background: #3ddc84; box-shadow: 0 0 0 3px rgba(61, 220, 132, 0.2); }
.plug-row[data-hit="no"] .plug-dot { background: #f5b942; box-shadow: 0 0 0 3px rgba(245, 185, 66, 0.18); }
.plug-body { min-width: 0; }
.plug-title { margin: 0; color: var(--bone); font-size: 14.5px; font-weight: 700; }
.plug-title b { color: var(--orange-hot); font-size: 16px; }
.plug-text { margin: 3px 0 0; color: var(--steel); font-size: 13px; line-height: 1.7; overflow-wrap: anywhere; }
.plug-steps { margin: 6px 0 0; padding-left: 1.3em; color: var(--steel); font-size: 13px; line-height: 1.75; }
.plug-steps li + li { margin-top: 4px; }
.plug-tag { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 999px; background: rgba(61, 220, 132, 0.14); color: #3ddc84; font: 700 11px/1.6 var(--sans); letter-spacing: 0; vertical-align: 1px; }
.units tbody tr.is-plugged td:first-child { box-shadow: inset 3px 0 0 #3ddc84; }
@keyframes rowFlash { 0%, 30% { background: rgba(255, 85, 0, 0.22); } 100% { background: transparent; } }
.units tbody tr.flash td { animation: rowFlash 1.6s ease-out; }
@media (max-width: 560px) {
    .plug-row { grid-template-columns: auto minmax(0, 1fr); }
    .plug-row .btn { grid-column: 1 / -1; width: 100%; }
}
.backup-note { margin: 10px 0 0; color: var(--steel); font-size: 12.5px; }
.backup-note[data-warn="true"] { color: #f5b942; }

.table-wrap { margin-top: 14px; overflow-x: auto; border: 1px solid var(--plate-edge); border-radius: 6px; background: var(--plate); }
.table-wrap:has(table[hidden]) { display: none; }
.units { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.units th { position: sticky; top: 0; padding: 10px 14px; text-align: left; white-space: nowrap; color: var(--steel-dim); font: 700 11px/1.4 var(--mono); letter-spacing: 0.1em; background: #111215; border-bottom: 1px solid var(--plate-edge); }
.units td { padding: 12px 14px; border-bottom: 1px solid var(--plate-edge); white-space: nowrap; }
.units tr:last-child td { border-bottom: 0; }
.units tbody tr { cursor: pointer; }
.units tbody tr:hover td, .units tbody tr:focus td { background: rgba(255, 85, 0, 0.06); }
.units tbody tr:focus { outline: 0; }
.units tbody tr:focus td:first-child { box-shadow: inset 3px 0 0 var(--orange); }
.mono { font-family: var(--mono); letter-spacing: 0.02em; }
.strong { font-weight: 700; color: var(--bone); }
.dim { color: var(--steel-dim); }
.cert-col { text-align: center; }
.ok-mark { color: #3ddc84; }
.st { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; line-height: 1.6; background: var(--plate-edge); color: var(--bone); }
.st-stock { background: rgba(61, 220, 132, 0.14); color: #3ddc84; }
.st-shipped { background: rgba(255, 85, 0, 0.16); color: var(--orange-hot); }
.st-making { background: rgba(245, 185, 66, 0.14); color: #f5b942; }
.st-repair { background: rgba(0, 229, 255, 0.12); color: #6be6ff; }
.st-returned { background: rgba(255, 61, 110, 0.14); color: var(--alarm); }
.units-count { margin: 8px 2px 0; color: var(--steel-dim); font: 600 12px/1.4 var(--mono); }
.empty-state { margin-top: 14px; padding: 28px 22px; border: 1px dashed var(--plate-edge); border-radius: 6px; color: var(--steel); }
.empty-state b { display: block; color: var(--bone); font-size: 16px; }
.empty-state p { margin: 6px 0 0; font-size: 14px; }
.empty-state.slim { padding: 16px 18px; font-size: 14px; }

/* drawer */
.drawer { position: fixed; inset: 0; z-index: 60; }
.drawer-scrim { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.55); opacity: 0; transition: opacity 0.2s; }
.drawer-panel {
    position: absolute; top: 0; right: 0; bottom: 0; width: min(480px, 100%);
    display: flex; flex-direction: column; gap: 18px;
    padding: 22px 22px 28px; overflow-y: auto;
    background: #0d0e10; border-left: 1px solid var(--plate-edge);
    transform: translateX(24px); opacity: 0; transition: transform 0.22s ease, opacity 0.22s ease;
}
.drawer.on .drawer-scrim { opacity: 1; }
.drawer.on .drawer-panel { transform: none; opacity: 1; }
.drawer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.drawer-title { margin: 4px 0 0; font-size: 24px; line-height: 1.25; color: var(--bone); }
.drawer-sub { margin: 4px 0 0; color: var(--steel); font-size: 14px; }
.icon-btn { flex: none; width: 40px; height: 40px; display: grid; place-items: center; border: 1px solid var(--plate-edge); border-radius: 4px; background: none; color: var(--bone); cursor: pointer; }
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.icon-btn:hover { border-color: var(--orange); }
.facts { margin: 0; border: 1px solid var(--plate-edge); border-radius: 6px; background: var(--plate); }
.facts div { display: flex; justify-content: space-between; gap: 16px; padding: 9px 14px; border-bottom: 1px solid var(--plate-edge); font-size: 13.5px; }
.facts div:last-child { border-bottom: 0; }
.facts dt { color: var(--steel); }
.facts dd { margin: 0; text-align: right; color: var(--bone); font-weight: 700; word-break: break-all; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field { display: grid; gap: 6px; }
.field > span { color: var(--steel); font-size: 12.5px; font-weight: 700; }
.field.wide, .form-grid.wide { grid-column: 1 / -1; }
.buyer-label { display: inline-flex; align-items: center; gap: 6px; color: var(--steel); font-size: 12.5px; font-weight: 700; }
.lock-ic svg { display: block; width: 13px; height: 13px; fill: none; stroke: #3ddc84; stroke-width: 2; stroke-linecap: round; }
.buyer-field textarea { min-height: 64px; }
.buyer-field textarea:disabled { opacity: 0.75; cursor: not-allowed; }
.buyer-field .hint .text-btn { padding: 0 2px; font-size: 12.5px; color: var(--orange); }
.form-grid.wide[hidden] { display: none; }
.field textarea { resize: vertical; min-height: 84px; }
.hint { margin: 0; color: var(--steel-dim); font-size: 12px; line-height: 1.6; }
.cert-box { padding: 14px; border: 1px solid rgba(61, 220, 132, 0.3); border-radius: 6px; background: rgba(61, 220, 132, 0.04); }
.cert-code { margin: 8px 0 10px; padding: 10px; border-radius: 4px; background: #000; border: 1px solid var(--plate-edge); color: var(--steel); font: 500 11px/1.6 var(--mono); white-space: pre-wrap; word-break: break-all; }
.row-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.cert-check { margin: 8px 0 0; min-height: 1.4em; font-size: 13px; font-weight: 700; }
.cert-check[data-ok="true"] { color: #3ddc84; }
.cert-check[data-ok="false"] { color: var(--alarm); }
.drawer-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: auto; padding-top: 6px; }
.drawer-foot .btn { min-width: 140px; }
.text-btn { appearance: none; padding: 8px 4px; border: 0; background: none; color: var(--steel); font: inherit; font-size: 13.5px; font-weight: 700; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.text-btn.danger { color: var(--alarm); }

/* verify */
.verdict { margin-top: 16px; padding: 16px 18px; border-radius: 6px; border: 1px solid var(--plate-edge); background: var(--plate); }
.verdict b { display: block; font-size: 17px; line-height: 1.4; }
.verdict p { margin: 6px 0 0; color: var(--steel); font-size: 13.5px; line-height: 1.75; }
.verdict.ok { border-color: rgba(61, 220, 132, 0.5); }
.verdict.ok b { color: #3ddc84; }
.verdict.ng { border-color: rgba(255, 61, 110, 0.5); }
.verdict.ng b { color: var(--alarm); }
.verdict.warn { border-color: rgba(245, 185, 66, 0.45); }
.verdict.warn b { color: #f5b942; }
.verdict.slim b { font-size: 15px; }
.verdict .btn { margin-top: 10px; }
#vf-out .facts { margin-top: 12px; }

/* key */
.key-card { display: grid; gap: 14px; padding: 20px; border: 1px solid var(--plate-edge); border-radius: 6px; background: var(--plate); }
.key-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.key-badge { padding: 4px 12px; border-radius: 999px; font-weight: 700; font-size: 13px; background: var(--plate-edge); color: var(--bone); }
.key-badge[data-state="ready"] { background: rgba(61, 220, 132, 0.16); color: #3ddc84; }
.key-badge[data-state="locked"] { background: rgba(245, 185, 66, 0.16); color: #f5b942; }
.key-fp { color: var(--steel); font-size: 12.5px; }
.key-fp b { color: var(--bone); margin-left: 6px; }
.key-text { margin: 0; color: var(--steel); font-size: 14px; line-height: 1.8; }
.key-unlock { display: grid; grid-template-columns: minmax(0, 1fr) 210px auto; align-items: end; gap: 10px; }
.key-unlock .key-msg { grid-column: 1 / -1; }
.key-until { margin: 0 0 10px; color: #3ddc84; font-weight: 700; font-size: 14px; }
.key-msg { grid-column: 1 / -1; margin: 0; min-height: 1.4em; color: var(--alarm); font-size: 13px; font-weight: 700; }
.key-notes { margin: 18px 0 0; padding-left: 1.2em; color: var(--steel); font-size: 13px; line-height: 1.8; }
.key-notes li + li { margin-top: 4px; }

/* toast */
.m-toast {
    position: fixed; z-index: 80; left: 50%; bottom: 24px; transform: translate(-50%, 12px);
    max-width: calc(100% - 32px); padding: 10px 18px; border-radius: 4px;
    background: var(--orange); color: var(--black); font-weight: 700; font-size: 14px; text-align: center;
    opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s;
}
.m-toast.on { opacity: 1; transform: translate(-50%, 0); }

/* finishing: certificate line in the panel */
.cert-line { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 13.5px; font-weight: 700; }
.cert-line i { width: 8px; height: 8px; border-radius: 50%; background: var(--steel-dim); flex: none; }
.cert-line[data-state="ready"] { color: #3ddc84; }
.cert-line[data-state="ready"] i { background: #3ddc84; }
.cert-line[data-state="locked"], .cert-line[data-state="missing"] { color: #f5b942; }
.cert-line[data-state="locked"] i, .cert-line[data-state="missing"] i { background: #f5b942; }
.cert-line a { color: inherit; }
.outlet-pick { display: grid; gap: 6px; margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--plate-edge); font-size: 13px; }
.outlet-pick > span { font-weight: 700; color: var(--bone); }
.outlet-pick select { padding: 8px 10px; border-radius: 4px; border: 1px solid var(--plate-edge); background: #0b0b0d; color: var(--bone); font: inherit; max-width: 360px; }
.outlet-pick select:focus { border-color: var(--orange); outline: none; }
.outlet-pick small { color: var(--steel); line-height: 1.5; }
.unit-no { display: inline-block; margin-top: 6px; padding: 6px 12px; border: 1.5px dashed var(--orange); border-radius: 4px; font: 700 22px/1.2 var(--mono); letter-spacing: 0.04em; color: var(--orange); }

@media (max-width: 760px) {
    .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .kpi:first-child { grid-column: 1 / -1; }
    .form-grid { grid-template-columns: 1fr; }
    .key-unlock { grid-template-columns: 1fr; }
    .toolbar-gap { display: none; }
    .toolbar > .btn, .toolbar > .file-btn { flex: 1 1 auto; }
}

/* ═══ 在庫・注文 ═══════════════════════════════════════════ */
.side-count[data-alert="true"] { background: var(--orange); color: var(--black); }
.side-link[aria-current="page"] .side-count[data-alert="true"] { background: var(--black); color: var(--orange); }

.stk-cloud { margin-bottom: 16px; }
.stk-cloud .btn { margin-top: 12px; }

/* what needs doing — the four cards at the top */
.todos { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 900px) { .todos { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.todo {
    display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; gap: 2px 12px; align-items: baseline;
    padding: 14px 16px; text-align: left; cursor: pointer; font: inherit; color: var(--bone);
    background: var(--plate); border: 1px solid var(--plate-edge); border-radius: 6px;
    transition: border-color 0.15s, transform 0.08s;
}
.todo:hover { border-color: var(--steel-dim); }
.todo:active { transform: scale(0.99); }
.todo-n { grid-row: span 2; min-width: 1.2ch; font: 700 34px/1 var(--mono); color: var(--steel-dim); font-variant-numeric: tabular-nums; }
.todo-t { font-weight: 800; font-size: 15px; }
.todo-s { color: var(--steel); font-size: 12px; line-height: 1.55; }
.todo[data-n="0"] .todo-t { color: var(--steel); }
.todo[data-tone="hot"] { border-color: var(--orange); background: linear-gradient(180deg, rgba(255, 85, 0, 0.12), var(--plate) 70%); }
.todo[data-tone="hot"] .todo-n { color: var(--orange); }
.todo[data-tone="warn"] { border-color: rgba(245, 185, 66, 0.7); }
.todo[data-tone="warn"] .todo-n { color: #f5b942; }
.todo:not([data-n="0"]):not([data-tone="hot"]):not([data-tone="warn"]) .todo-n { color: var(--bone); }

/* tabs */
.stk-tabs { position: sticky; top: 0; z-index: 5; display: flex; gap: 4px; margin: 22px 0 16px; padding: 6px 0; background: var(--black); border-bottom: 1px solid var(--plate-edge); overflow-x: auto; scrollbar-width: none; }
.stk-tabs::-webkit-scrollbar { display: none; }
.stk-tabs button { flex: none; display: inline-flex; align-items: center; gap: 8px; min-height: 42px; padding: 0 16px; border: 0; border-radius: 4px; background: none; color: var(--steel); font: inherit; font-size: 14.5px; font-weight: 800; cursor: pointer; }
.stk-tabs button:hover { color: var(--bone); }
.stk-tabs button[aria-selected="true"] { color: var(--black); background: var(--bone); }
.stk-tabs button b { min-width: 20px; padding: 0 6px; border-radius: 10px; background: var(--plate-edge); color: var(--bone); font: 700 11px/18px var(--mono); }
.stk-tabs button b:empty { display: none; }
.stk-tabs button[aria-selected="true"] b { background: var(--black); color: var(--bone); }
@media (max-width: 1099px) { .stk-tabs { top: 56px; } }

.chips-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.chip { min-height: 34px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--plate-edge); background: none; color: var(--steel); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.chip[aria-pressed="true"] { border-color: var(--orange); color: var(--orange); background: var(--orange-wash); }

/* orders */
.orders { display: grid; gap: 12px; }
.order { padding: 16px 18px; background: var(--plate); border: 1px solid var(--plate-edge); border-radius: 6px; display: grid; gap: 12px; }
.order[data-status="paid"] { border-left: 3px solid var(--orange); }
.order[data-status="paid"][data-missing="0"] { border-left-color: var(--orange); }
.order:not([data-missing="0"]) { border-left: 3px solid #f5b942; }
.order[data-status="canceled"], .order[data-status="shipped"] { opacity: 0.78; }
.order-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; flex-wrap: wrap; }
.order-no { margin: 0; font-size: 17px; font-weight: 700; color: var(--bone); }
.order-sub { margin: 2px 0 0; color: var(--steel); font-size: 12.5px; }
.order-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.order-amt { font-size: 16px; font-weight: 700; color: var(--bone); }
.ost { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 800; line-height: 1.6; background: var(--plate-edge); color: var(--bone); white-space: nowrap; }
.ost-paid { background: var(--orange); color: var(--black); }
.ost-awaiting { background: rgba(0, 229, 255, 0.12); color: #6be6ff; }
.ost-open { background: var(--plate-edge); color: var(--steel); }
.ost-shipped { background: rgba(61, 220, 132, 0.14); color: #3ddc84; }
.ost-canceled { background: rgba(255, 61, 110, 0.12); color: var(--alarm); }
.ost-need { background: rgba(245, 185, 66, 0.16); color: #f5b942; }
.order-lines { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.ol { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; align-items: baseline; padding: 10px 12px; border-radius: 4px; background: rgba(255, 255, 255, 0.02); border: 1px solid var(--plate-edge); }
.ol-name { font-weight: 700; color: var(--bone); font-size: 14.5px; }
.ol-kind { color: var(--steel); font-size: 12px; font-weight: 700; }
.ol-units { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ol-units:empty { display: none; }
.unit-chip { display: inline-flex; align-items: center; gap: 8px; padding: 4px 6px 4px 10px; border-radius: 4px; background: rgba(61, 220, 132, 0.08); border: 1px solid rgba(61, 220, 132, 0.35); font-size: 13px; }
.unit-chip b { color: #3ddc84; font-weight: 700; white-space: nowrap; }
.unit-chip em { font-style: normal; color: var(--steel); font-size: 12px; }
.unit-chip .x { width: 26px; height: 26px; border: 0; border-radius: 3px; background: none; color: var(--steel); font-size: 16px; cursor: pointer; }
.unit-chip .x:hover { color: var(--alarm); background: rgba(255, 61, 110, 0.1); }
.picker { flex-basis: 100%; display: grid; gap: 6px; margin-top: 4px; }
.pick { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 8px 10px; border-radius: 4px; background: #0b0c0e; border: 1px solid var(--plate-edge); font-size: 13.5px; }
.pick .btn { margin-left: auto; }
.order-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.order-foot .grow { flex: 1; }
.ship-date { display: inline-flex; align-items: center; gap: 8px; color: var(--steel); font-size: 12.5px; font-weight: 700; }
.ship-date input { min-height: 40px; padding: 6px 10px; border-radius: 4px; background: #0b0c0e; border: 1px solid var(--plate-edge); color: var(--bone); font: 500 14px var(--mono); color-scheme: dark; }
.hint.warn { color: #f5b942; }
.hint.mb { margin-bottom: 12px; }

/* stock on the shop */
.stk-sum { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 22px; margin-bottom: 14px; color: var(--steel); font-size: 13px; font-weight: 700; }
.stk-sum b { margin-right: 6px; font: 700 22px/1 var(--mono); color: var(--bone); vertical-align: -2px; }
.stk-sum span:first-child b { color: #3ddc84; }
.stk-sum .text-btn { margin-left: auto; }
.models { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.orders, .ul-list { grid-template-columns: minmax(0, 1fr); }
.model, .order, .ul-row { min-width: 0; }
.stk-panel { min-width: 0; }
.model { padding: 16px 18px; background: var(--plate); border: 1px solid var(--plate-edge); border-radius: 6px; }
.model-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.model-head h3 { margin: 0; font-size: 19px; color: var(--bone); }
.model-n { color: var(--steel); font-size: 13px; font-weight: 700; }
.model-n b { font: 700 18px/1 var(--mono); color: #3ddc84; margin-right: 4px; }
.mx { display: grid; gap: 8px; margin: 12px 0 4px; }
.mx-row { display: grid; grid-template-columns: 72px 1fr; gap: 10px; align-items: center; }
.mx-cap { color: var(--steel); font-size: 13px; font-weight: 700; }
.mx-colors { display: flex; flex-wrap: wrap; gap: 6px; }
.sw-chip { display: inline-flex; align-items: center; gap: 8px; padding: 5px 10px 5px 8px; border-radius: 999px; border: 1px solid var(--plate-edge); background: #0b0c0e; font-size: 13px; color: var(--bone); }
.sw-chip i, .color-mini i { width: 14px; height: 14px; border-radius: 50%; background: var(--c, #888); box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.28); flex: none; }
.sw-chip b { font: 700 13px var(--mono); color: #3ddc84; }
.sw-chip em { font-style: normal; font-size: 11.5px; color: var(--steel-dim); }
.sw-chip.off b { color: var(--steel-dim); }
.units.slim td { padding: 9px 12px; font-size: 13.5px; }
.units.slim tbody tr { cursor: default; }
.units .acts { text-align: right; }
.units .acts .text-btn { padding: 4px 6px; font-size: 12.5px; }
.mini { display: inline-block; margin-left: 4px; padding: 1px 7px; border-radius: 999px; font-size: 11px; font-weight: 800; background: rgba(61, 220, 132, 0.14); color: #3ddc84; }
.mini[data-k="reserved"] { background: rgba(245, 185, 66, 0.14); color: #f5b942; }
.mini[data-k="sold"] { background: rgba(255, 85, 0, 0.16); color: var(--orange-hot); }

/* finished, not on the shop */
.ul-list { display: grid; gap: 10px; }
.ul-row { display: grid; grid-template-columns: minmax(150px, 0.8fr) minmax(0, 2.2fr) auto; gap: 12px 18px; align-items: center; padding: 14px 16px; background: var(--plate); border: 1px solid var(--plate-edge); border-radius: 6px; }
@media (max-width: 900px) { .ul-row { grid-template-columns: 1fr; } }
.ul-id { display: grid; gap: 2px; }
.ul-id b { color: var(--bone); font-size: 15.5px; }
.ul-id span { font-size: 12.5px; }
.ul-pick { display: grid; gap: 8px; }
.ul-act { display: flex; align-items: center; gap: 8px; }
.seg-mini, .color-mini { display: flex; flex-wrap: wrap; gap: 6px; }
.seg-mini label, .color-mini label { position: relative; cursor: pointer; }
.seg-mini input, .color-mini input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.seg-mini span { display: inline-grid; place-items: center; min-width: 74px; min-height: 38px; padding: 0 12px; border-radius: 4px; border: 1px solid var(--plate-edge); background: #0b0c0e; font: 700 13.5px var(--mono); color: var(--bone); }
.color-mini span { display: inline-flex; align-items: center; gap: 8px; min-height: 38px; padding: 0 12px 0 10px; border-radius: 999px; border: 1px solid var(--plate-edge); background: #0b0c0e; font-size: 13px; font-weight: 700; color: var(--bone); }
.color-mini.big span { min-height: 44px; font-size: 14px; }
.color-mini.big i { width: 18px; height: 18px; }
.seg-mini input:checked + span, .color-mini input:checked + span { border-color: var(--orange); box-shadow: inset 0 0 0 1px var(--orange); background: var(--orange-wash); }
.seg-mini input:focus-visible + span, .color-mini input:focus-visible + span { outline: 2px solid var(--orange); outline-offset: 2px; }

/* the finish screen's choice */
.fc { margin-top: 16px; padding: 16px; border-radius: 6px; border: 1px solid var(--plate-edge); background: #0b0c0e; display: grid; gap: 12px; max-width: 46em; }
.fc-title { margin: 0; font-size: 17px; font-weight: 800; color: var(--bone); }
.fc-id { margin: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; color: var(--steel); font-size: 13.5px; }
.now-text .fc-id b, .fc-id b { color: var(--bone); font-size: 15px; }
.fc-auto { color: #3ddc84; font-size: 12.5px; font-weight: 700; }
.fc-row { display: grid; grid-template-columns: 44px 1fr; gap: 10px; align-items: start; }
.fc-lab { padding-top: 9px; color: var(--steel); font-size: 12.5px; font-weight: 800; }
.fc-wait { display: grid; gap: 8px; padding: 12px; border-radius: 6px; border: 1px solid rgba(245, 185, 66, 0.55); background: rgba(245, 185, 66, 0.06); }
.fc-wait p { margin: 0; font-size: 13.5px; }
.now-text .fc-wait b { color: #f5b942; }
.fc-order { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; font-size: 13.5px; }
.fc-order .btn { margin-left: auto; }
.fc-btns { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.fc-done { margin: 0; font-weight: 700; color: var(--bone); }
.fc-done.ok { color: #3ddc84; }
.now-text .fc-done b { color: var(--bone); }

/* record drawer: shop */
.dr-shop { padding: 14px; border: 1px solid var(--plate-edge); border-radius: 6px; display: grid; gap: 10px; }
#dr-shop-fields { display: grid; gap: 10px; }
#dr-shop-fields[hidden] { display: none; }
.switch { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 700; color: var(--bone); cursor: pointer; }
.switch input { width: 20px; height: 20px; accent-color: var(--orange); }
.dr-sale { margin: 0; font-size: 13px; font-weight: 700; color: var(--steel); }
.dr-sale:empty { display: none; }
.dr-sale[data-state="listed"] { color: #3ddc84; }
.dr-sale[data-state="reserved"] { color: #f5b942; }
.dr-sale[data-state="sold"] { color: var(--orange-hot); }
.alert { padding: 12px 14px; border-radius: 6px; border: 1px solid rgba(255, 61, 110, 0.55); background: rgba(255, 61, 110, 0.07); display: grid; gap: 8px; }
.alert b { color: var(--alarm); }
.alert p { margin: 0; color: var(--bone); font-size: 13.5px; line-height: 1.7; }
.order[data-status="canceled"]:has(.alert) { opacity: 1; border-left: 3px solid var(--alarm); }

/* large orders (大口) */
.chips-link { margin-left: auto; font-size: 12.5px; }
.ost-bulk { background: rgba(255, 85, 0, 0.14); color: var(--orange-hot); vertical-align: 2px; font-size: 11px; }
.bq-new { background: var(--orange); color: var(--black); }
.bq-quoted { background: rgba(0, 229, 255, 0.12); color: #6be6ff; }
.bq-won { background: rgba(61, 220, 132, 0.14); color: #3ddc84; }
.bq-declined { background: var(--plate-edge); color: var(--steel); }
.order.bq[data-bq="new"] { border-left: 3px solid var(--orange); }
.order.bq[data-bq="quoted"] { border-left: 3px solid #6be6ff; }
.order.bq[data-bq="declined"] { opacity: 0.78; }
.order-sub b { color: var(--bone); }
.order-amt.dim { color: var(--steel); font-size: 13.5px; }
.bq-who { display: grid; gap: 8px; padding: 12px 14px; border-radius: 4px; background: #0b0c0e; border: 1px solid var(--plate-edge); }
.bq-who p { margin: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.bq-who p b { color: var(--bone); font-size: 16px; }
.bq-who p span { color: var(--bone); font-size: 14px; }
.bq-contact { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; }
.bq-contact li { display: flex; align-items: baseline; gap: 8px; font-size: 14px; min-width: 0; }
.bq-contact li span { color: var(--steel); font-size: 12px; font-weight: 700; display: inline-flex; gap: 6px; align-items: baseline; }
.bq-contact li span em { font-style: normal; font-size: 10.5px; padding: 0 6px; border-radius: 999px; background: var(--orange); color: var(--black); }
.bq-contact a, .bq-contact b { color: var(--bone); font-weight: 700; overflow-wrap: anywhere; }
.bq-contact li.pref a, .bq-contact li.pref b { color: var(--orange-hot); }
.ol-sub { grid-column: 1 / -1; color: var(--steel-dim); font-size: 12px; font-family: var(--mono); }
.ol-kind .ok { color: #3ddc84; }
.bq-wish { margin: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
@media (max-width: 760px) { .bq-wish { grid-template-columns: 1fr 1fr; } }
.bq-wish div { padding: 8px 10px; border-radius: 4px; border: 1px solid var(--plate-edge); }
.bq-wish dt { color: var(--steel); font-size: 11.5px; font-weight: 700; }
.bq-wish dd { margin: 2px 0 0; color: var(--bone); font-size: 13.5px; font-weight: 700; }
.bq-note { margin: 0; padding: 10px 12px; border-left: 2px solid var(--steel-dim); background: rgba(255, 255, 255, 0.02); color: var(--bone); font-size: 13.5px; line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; }
.bq-note span { display: block; color: var(--steel); font-size: 11.5px; font-weight: 700; margin-bottom: 2px; }
.bq-staff { display: grid; grid-template-columns: minmax(150px, 220px) minmax(0, 1fr) auto; gap: 10px 12px; align-items: end; padding-top: 4px; border-top: 1px dashed var(--plate-edge); }
@media (max-width: 760px) { .bq-staff { grid-template-columns: 1fr; } }
.bq-staff label { display: grid; gap: 4px; }
.bq-staff label > span:first-child { color: var(--steel); font-size: 12px; font-weight: 700; }
.yen-in { display: flex; align-items: center; gap: 6px; padding: 0 10px; border-radius: 4px; background: #0b0c0e; border: 1px solid var(--plate-edge); }
.yen-in i { font-style: normal; color: var(--steel); font-family: var(--mono); }
.yen-in input { width: 100%; min-height: 40px; border: 0; background: none; color: var(--bone); font: 700 15px var(--mono); outline: none; }
.yen-in:focus-within { border-color: var(--orange); }
.bq-staff textarea { min-height: 40px; padding: 8px 10px; border-radius: 4px; background: #0b0c0e; border: 1px solid var(--plate-edge); color: var(--bone); font: inherit; font-size: 13.5px; resize: vertical; }
.bq-staff textarea:focus { border-color: var(--orange); outline: none; }
.bq-state { margin: 0; color: var(--steel); font-size: 13.5px; font-weight: 700; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.bq-state b { color: var(--bone); }
.bq-pay { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 10px 12px; border-radius: 4px; border: 1px solid rgba(0, 229, 255, 0.35); background: rgba(0, 229, 255, 0.05); }
.bq-pay .hint { flex: 1 1 260px; color: var(--bone); }
.bq-edit { display: grid; gap: 8px; padding: 12px; border-radius: 4px; border: 1px solid var(--orange); background: var(--orange-wash); }
.bq-edit-t { margin: 0; font-weight: 800; color: var(--bone); font-size: 14px; }
.bq-edit-t .dim { font-weight: 500; font-size: 12px; margin-left: 8px; }
.ed-row { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 0.9fr) minmax(0, 1.1fr) 76px 92px 32px; gap: 6px; align-items: center; }
.ed-row:has(select[data-ed="model"]) { grid-template-columns: minmax(0, 1.4fr) minmax(0, 2fr) 76px 92px 32px; }
@media (max-width: 760px) { .ed-row, .ed-row:has(select[data-ed="model"]) { grid-template-columns: 1fr 1fr; } .ed-row select[data-ed="slug"] { grid-column: 1 / -1; } }
.ed-row select, .ed-row input { min-height: 40px; min-width: 0; padding: 0 8px; border-radius: 4px; background: #0b0c0e; border: 1px solid var(--plate-edge); color: var(--bone); font: inherit; font-size: 13.5px; }
.ed-row input { font-family: var(--mono); text-align: center; }
.ed-row .x { width: 32px; height: 32px; border: 0; border-radius: 3px; background: none; color: var(--steel); font-size: 18px; cursor: pointer; }
.ed-row .x:hover:not(:disabled) { color: var(--alarm); background: rgba(255, 61, 110, 0.1); }
.ed-row .x:disabled { opacity: 0.3; cursor: default; }
.bq-edit .row-btns { align-items: center; }
.bq-edit .grow { flex: 1; }
.dim { color: var(--steel); }

/* orders without Stripe (Signal) */
.ost-sig { background: rgba(58, 118, 240, 0.16); color: #8fb3ff; vertical-align: 2px; font-size: 11px; }
.ost-sigwait { background: rgba(245, 185, 66, 0.16); color: #f5b942; }
.bq-pay.sig-wait { border-color: rgba(245, 185, 66, 0.5); background: rgba(245, 185, 66, 0.06); }
.bq-pay .hint b { color: var(--bone); }
.code-search { display: grid; gap: 4px; max-width: 360px; margin-bottom: 12px; }
.code-search span { color: var(--steel); font-size: 12px; font-weight: 700; }
.code-search input { min-height: 44px; padding: 0 12px; border-radius: 4px; background: #0b0c0e; border: 1px solid var(--plate-edge); color: var(--bone); font: 700 15px var(--mono); letter-spacing: 0.04em; }
.code-search input:focus { border-color: var(--orange); outline: none; }
.chips-row[hidden] { display: none; }
.stk-notify { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin: 0 0 14px; font-size: 12.5px; }
.stk-notify[hidden] { display: none; }
.stk-notify .nt-on { color: #3ddc84; font-weight: 800; }

/* apps put on the phone while finishing */
.apps-sum { margin-left: 10px; font: 700 12px var(--mono); color: var(--steel); }
.apps-body { padding: 0 0 16px; display: grid; gap: 10px; }
.ap-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.ap-row { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 0.9fr) minmax(0, 1.4fr); gap: 4px 12px; align-items: center; padding: 8px 10px; border-radius: 4px; border: 1px solid var(--plate-edge); background: #0b0c0e; font-size: 13.5px; }
@media (max-width: 700px) { .ap-row { grid-template-columns: 1fr auto; } .ap-row .ap-st { grid-column: 1 / -1; } }
.ap-pick { display: flex; align-items: center; gap: 10px; cursor: pointer; min-width: 0; }
.ap-pick input { width: 18px; height: 18px; accent-color: var(--orange); flex: none; }
.ap-pick b { color: var(--bone); font-weight: 700; overflow-wrap: anywhere; }
.ap-ver { color: var(--steel); font-size: 12px; overflow-wrap: anywhere; }
.ap-st { color: var(--steel); font-size: 12.5px; font-weight: 700; overflow-wrap: anywhere; }
.ap-st.ok { color: #3ddc84; }
.ap-st.busy { color: #f5b942; }
.ap-st.err { color: var(--alarm); font-weight: 500; }
.ap-st.off { color: var(--steel-dim); }
.ap-acts { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.ap-note { margin: 0; color: var(--steel); font-size: 12.5px; line-height: 1.7; }
.ap-pick.must { cursor: default; }
.ap-pick.must input { opacity: .55; }
.ap-must { flex: none; padding: 1px 7px; border-radius: 3px; border: 1px solid rgba(255, 85, 0, .5); color: var(--orange-hot); font-size: 11px; font-weight: 700; letter-spacing: .04em; line-height: 1.6; }
.ap-note b { color: var(--bone); }

/* SIM ordered in the customer's name: the application, shown only while opened */
.sim-box { display: grid; gap: 8px; padding: 10px 12px; border-radius: 4px; border: 1px solid rgba(0, 229, 255, 0.35); background: rgba(0, 229, 255, 0.05); }
.sim-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.sim-head b { color: var(--bone); }
.sim-grid { display: grid; gap: 4px; }
.sim-row { display: grid; grid-template-columns: 130px 1fr auto; gap: 10px; align-items: baseline; font-size: 13px; }
.sim-row > span { color: var(--steel-dim); }
.sim-row > b { color: var(--bone); word-break: break-all; font-weight: 600; }
.sim-row > b.dim { color: var(--steel-dim); font-weight: 400; }
.sim-box .row-btns { align-items: center; }
.sim-box .sim-sub { margin-top: 8px; }

/* eSIM stock: registration form, rows, and the QR dialog */
.esim-add { display: grid; gap: 10px; padding: 14px 16px; border-radius: 4px; border: 1px solid var(--plate-edge); background: rgba(255, 255, 255, 0.02); margin-bottom: 18px; }
.esim-add h3, .esim-h { margin: 0; font-size: 14px; color: var(--bone); }
.esim-h { margin: 18px 0 8px; }
.esim-form { display: grid; gap: 10px; }
.esim-form label { display: grid; gap: 4px; font-size: 12px; color: var(--steel-dim); }
.esim-form textarea, .esim-form input, .esim-form select { width: 100%; box-sizing: border-box; padding: 8px 10px; border-radius: 4px; border: 1px solid var(--plate-edge); background: #0b0b0d; color: var(--bone); font: inherit; font-family: var(--mono, ui-monospace, monospace); }
.esim-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.esim-row .ul-main { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 10px; }
.unit-chip.done { opacity: .75; }
#esim-qr-host .qr-back { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.7); z-index: 90; }
#esim-qr-host .qr-box { position: fixed; z-index: 91; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(420px, 92vw); display: grid; gap: 10px; justify-items: center; padding: 18px; border-radius: 6px; background: #141416; border: 1px solid var(--plate-edge); }
#esim-qr-host .qr-h { margin: 0; color: var(--bone); font-weight: 600; }
#esim-qr-host .qr { border-radius: 4px; }
#esim-qr-host .qr-code { width: 100%; box-sizing: border-box; margin: 0; padding: 8px 10px; border-radius: 4px; background: #0b0b0d; border: 1px solid var(--plate-edge); color: var(--bone); font-size: 11px; white-space: pre-wrap; word-break: break-all; }

/* ledger (経理) */
/* ── 経理 (ledger) ── */
.lg-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0 0 16px; }
.lg-bar-gap { flex: 1; }
.lg-year select { min-height: 40px; padding: 0 34px 0 14px; border-radius: 4px; border: 1px solid var(--plate-edge); background: var(--plate); color: var(--bone); font: 700 15px/1 var(--mono); cursor: pointer; }
.lg-year select:focus { outline: none; border-color: var(--orange); }
.lg-kpis { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.lg-kpis .kpi { gap: 6px; padding: 16px 18px 14px; align-content: start; }
.lg-kpis .kpi b { font-size: 30px; color: var(--bone); }
.lg-kpis .kpi:first-child b { color: var(--bone); }
.lg-kpis .kpi small { color: var(--steel-dim); font-size: 12px; line-height: 1.5; }
.lg-kpis .kpi.is-profit { background: linear-gradient(0deg, rgba(255, 85, 0, 0.10), rgba(255, 85, 0, 0.10)), var(--plate); }
.lg-kpis .kpi.is-profit b { color: var(--orange); }
.lg-kpis .kpi.is-minus b { color: var(--alarm); }
.lg-stock { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin: 10px 2px 0; color: var(--steel); font-size: 13px; }
.lg-stock b { color: var(--bone); font: 700 14px/1 var(--mono); }
.lg-stock span { color: var(--steel-dim); font-size: 12.5px; }
.lg-alert { margin-top: 16px; padding: 14px 16px; border: 1px solid rgba(245, 185, 66, 0.45); border-left: 3px solid #f5b942; border-radius: 6px; background: rgba(245, 185, 66, 0.06); }
.lg-alert h2 { margin: 0; font-size: 14.5px; line-height: 1.5; color: #f5b942; }
.lg-alert > p { margin: 4px 0 0; color: var(--steel); font-size: 13px; }
.lg-fix { display: grid; gap: 8px; margin-top: 12px; }
.lg-fix-row { display: grid; grid-template-columns: minmax(180px, 1.2fr) 150px 170px auto; gap: 10px; align-items: end; padding-top: 10px; border-top: 1px solid rgba(245, 185, 66, 0.18); }
.lg-fix-id { display: grid; gap: 2px; align-self: center; }
.lg-fix-id b { color: var(--bone); font-size: 14px; }
.lg-fix-id small { color: var(--steel); font-size: 12px; }
.lg-tabs { margin-top: 24px; }
.lg-card { overflow-x: auto; border: 1px solid var(--plate-edge); border-radius: 6px; background: var(--plate); }
.lg-panel[hidden] { display: none; }
.lg-table { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.lg-table th { padding: 10px 14px; text-align: left; white-space: nowrap; color: var(--steel-dim); font: 700 11px/1.4 var(--mono); letter-spacing: 0.1em; background: #111215; border-bottom: 1px solid var(--plate-edge); }
.lg-table td { padding: 11px 14px; border-bottom: 1px solid var(--plate-edge); white-space: nowrap; vertical-align: middle; }
.lg-table tbody tr:last-child td { border-bottom: 0; }
.lg-table tbody tr:hover td { background: rgba(255, 255, 255, 0.025); }
.lg-table .num { text-align: right; font-family: var(--mono); }
.lg-table td.wrap { white-space: normal; min-width: 200px; color: var(--steel); }
.lg-table td.strong { color: var(--bone); font-weight: 700; }
.lg-table td.minus { color: var(--alarm); }
.lg-table tfoot td { border-top: 1px solid var(--plate-edge); border-bottom: 0; background: #111215; color: var(--bone); font-weight: 700; }
.lg-edit td { padding: 8px 10px; }
.lg-edit input, .lg-edit select, .lg-fix input, .lg-entry input, .lg-entry select { width: 100%; height: 40px; min-height: 40px; box-sizing: border-box; padding: 8px 10px; border-radius: 4px; border: 1px solid var(--plate-edge); background: #0b0b0d; color: var(--bone); font: inherit; font-size: 14px; }
.lg-edit input:focus, .lg-edit select:focus, .lg-fix input:focus, .lg-entry input:focus, .lg-entry select:focus { outline: none; border-color: var(--orange); }
.lg-acts { text-align: right; }
.lg-acts .text-btn + .text-btn, .lg-acts .btn + .text-btn { margin-left: 12px; }
.lg-entry { display: grid; grid-template-columns: 150px 170px 130px minmax(200px, 1fr) 160px auto; gap: 10px; align-items: end; padding: 14px; border-bottom: 1px solid var(--plate-edge); background: #111215; }
.lg-entry .btn { min-height: 40px; }
.lg-empty { margin: 0; padding: 26px 18px; color: var(--steel); font-size: 14px; text-align: center; }
.lg-foot { margin: 8px 2px 0; color: var(--steel-dim); font-size: 12px; line-height: 1.6; }
.lg-ch { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--plate-edge); color: var(--bone); }
.lg-ch-shop { background: rgba(61, 220, 132, 0.14); color: #3ddc84; }
.lg-ch-direct { background: rgba(107, 230, 255, 0.12); color: #6be6ff; }
.lg-ch-pr { background: rgba(245, 185, 66, 0.14); color: #f5b942; }
.lg-missing-tag { color: #f5b942; font-family: var(--sans); font-size: 12.5px; font-weight: 700; }
/* 原価表 */
.lg-cost-sum { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 10px; margin-bottom: 18px; }
.lg-cost-sum > div { display: grid; gap: 4px; padding: 14px 16px; border: 1px solid var(--plate-edge); border-radius: 6px; background: var(--plate); }
.lg-cost-sum span { color: var(--steel); font-size: 12.5px; font-weight: 700; }
.lg-cost-sum b { color: var(--bone); font: 400 30px/1.1 var(--stencil); letter-spacing: 0.02em; }
.lg-cost-sum small { color: var(--steel-dim); font-size: 12px; line-height: 1.6; }
.lg-h3 { margin: 22px 2px 8px; color: var(--steel); font: 700 12px/1.4 var(--mono); letter-spacing: 0.12em; }
.lg-cost-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 8px; }
.lg-cost-bar select { min-height: 40px; padding: 6px 10px; border-radius: 4px; background: var(--plate); border: 1px solid var(--plate-edge); color: var(--bone); font: 500 14px/1.4 var(--sans); }
.lg-table .lg-guess, .lg-foot .lg-guess { color: var(--steel-dim); }
.lg-table .lg-guess small { font-family: var(--sans); font-size: 11px; }
.lg-open { padding: 0; color: var(--bone); font-family: var(--mono); font-size: 13.5px; text-decoration-color: var(--plate-edge); }
.lg-open:hover { color: var(--orange-hot); }
.lg-fill { appearance: none; padding: 0; border: 0; background: none; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.lg-ch-gift { background: rgba(193, 160, 255, 0.14); color: #c9a8ff; }
.lg-ch-own { background: rgba(154, 158, 166, 0.16); color: var(--steel); }
.lg-cost td, .lg-cost th { padding-left: 10px; padding-right: 10px; }
.lg-cost td.wrap { min-width: 120px; }
.lg-ship small { display: block; color: var(--steel-dim); font-size: 11.5px; }
/* 仕入（レシート） */
.buy { margin-bottom: 18px; padding: 16px; border: 1px solid var(--plate-edge); border-left: 3px solid var(--orange); border-radius: 6px; background: var(--plate); }
.buy-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; }
.buy-title { flex: 1 1 280px; display: grid; gap: 3px; }
.buy-title b { color: var(--bone); font-size: 15px; }
.buy-title small { color: var(--steel); font-size: 12.5px; line-height: 1.6; }
.buy-acts { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.buy-acts .file-btn.is-busy { opacity: 0.75; cursor: progress; }
.buy-note { margin: 10px 0 0; color: var(--steel); font-size: 12.5px; line-height: 1.7; }
.buy-note code { padding: 1px 5px; border-radius: 3px; background: #111215; color: var(--bone); }
.buy-err { margin: 10px 0 0; color: #f5b942; font-size: 13px; line-height: 1.7; }
.buy-form { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--plate-edge); }
.buy-meta { display: grid; grid-template-columns: 170px minmax(0, 1fr) auto; gap: 10px 12px; align-items: end; }
.buy-thumb { width: 64px; height: 64px; padding: 0; overflow: hidden; border: 1px solid var(--plate-edge); border-radius: 4px; background: #111215; color: var(--steel); font: 700 12px var(--mono); cursor: zoom-in; }
.buy-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.buy-sub { margin: 16px 0 8px; color: var(--steel); font: 700 12px/1.4 var(--sans); }
.buy-line { position: relative; display: grid; grid-template-columns: minmax(150px, 1.4fr) minmax(100px, 0.8fr) minmax(100px, 0.9fr) 80px minmax(130px, 1fr) auto; gap: 8px 10px; align-items: end; padding: 10px 0; border-bottom: 1px dashed var(--plate-edge); }
.buy-line .field input, .buy-line .field select, .buy-meta .field input { min-height: 40px; }
.buy-read { grid-column: 1 / -1; margin: 0; color: var(--steel-dim); font-size: 12px; }
.buy-x { align-self: center; padding: 6px 2px; font-size: 12.5px; }
.buy-other { display: grid; grid-template-columns: auto minmax(0, 1fr) 130px; gap: 10px; align-items: center; padding: 6px 0; color: var(--bone); font-size: 14px; }
.buy-other input[type="number"] { min-height: 38px; padding: 6px 10px; border-radius: 4px; background: #111215; border: 1px solid var(--plate-edge); color: var(--bone); font: 500 14px var(--mono); }
.buy-sum { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; margin: 14px 0 0; color: var(--steel); font-size: 13px; }
.buy-sum b { color: var(--bone); font: 700 16px var(--mono); }
.buy-sum .buy-diff { color: #f5b942; }
.buy-btns { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-top: 14px; }
.buy-fill { margin-top: 14px; padding-top: 4px; border-top: 1px solid var(--plate-edge); }
.buy-fill-lot { padding: 10px 0; }
.buy-fill-lot p { margin: 0 0 8px; color: var(--bone); font-size: 14px; }
.buy-fill-lot p span { margin-left: 8px; color: var(--steel); font-size: 12.5px; }
.buy-cands { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.buy-cands label { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border: 1px solid var(--plate-edge); border-radius: 4px; background: #111215; cursor: pointer; font-size: 13px; }
.buy-cands label small { color: var(--steel-dim); font-size: 11.5px; }
.buy-table .lg-acts { white-space: nowrap; }
.buy-edit td { white-space: normal; }
@media (max-width: 760px) {
    .buy-meta { grid-template-columns: minmax(0, 1fr) auto; }
    .buy-meta .field:first-child { grid-column: 1 / -1; }
    .buy-line { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .buy-line .field:first-of-type { grid-column: 1 / -1; }
    .buy-x { grid-column: 1 / -1; justify-self: start; }
    .buy-other { grid-template-columns: auto minmax(0, 1fr) 110px; }
    .buy-acts { width: 100%; }
    .buy-acts .file-btn { flex: 1 1 auto; }
    .buy-table td.lg-acts { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 4px 14px; }
}
/* Meta広告 */
.lg-pad { overflow: visible; }
.lg-entry.ad-entry { grid-template-columns: repeat(5, minmax(0, 1fr)); border-bottom: 0; background: transparent; }
.ad-entry .ad-wide { grid-column: span 3; }
.ad-plan-check { display: flex; align-items: center; gap: 8px; grid-column: span 2; color: var(--steel); font-size: 13px; cursor: pointer; }
.ad-plan-check input { width: 18px !important; height: 18px !important; min-height: 0 !important; accent-color: var(--orange); }
.ad-entry .btn { grid-column: span 1; }
.ad-entry .lg-acts { grid-column: 1 / -1; display: flex; gap: 12px; align-items: center; }
.ad-sum { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.ad-sum b { font-size: 26px; }
.ad-plan { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; margin: -6px 0 18px; padding: 12px 14px; border: 1px dashed rgba(245, 185, 66, 0.45); border-radius: 6px; background: rgba(245, 185, 66, 0.06); }
.ad-plan p { flex: 1 1 320px; margin: 0; color: var(--steel); font-size: 13px; line-height: 1.7; }
.ad-plan b { color: #f5b942; }
.ad-rows-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; }
.ad-rows-head .ad-del-plan { padding: 4px 2px; font-size: 12.5px; }
.ad-table td small { display: block; color: var(--steel-dim); font-size: 11.5px; font-family: var(--sans); }
.ad-table .ad-camp { white-space: normal; min-width: 150px; }
@media (min-width: 641px) {
    .ad-table td, .ad-table th { padding-left: 8px; padding-right: 8px; }
    .ad-table td { font-size: 13px; }
    .ad-table .ad-camp { max-width: 190px; }
    .ad-camp-name { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--bone); }
    .ad-table .lg-acts { white-space: nowrap; }
}
.ad-is-plan td { color: var(--steel); }
.ad-tag { display: inline-block; margin-left: 4px; padding: 0 6px; border-radius: 999px; background: rgba(245, 185, 66, 0.14); color: #f5b942; font: 700 10.5px/1.7 var(--sans); vertical-align: 1px; }
.lg-inline { font: 700 13px var(--mono) !important; color: var(--bone) !important; }
.lg-inline.minus { color: var(--alarm) !important; }
.lg-plan-note { margin-top: 4px; }
.lg-plan-note b { color: #f5b942; }
@media (max-width: 760px) {
    .lg-entry.ad-entry { grid-template-columns: 1fr 1fr; }
    .ad-entry .ad-wide, .ad-plan-check, .ad-entry .btn { grid-column: 1 / -1; }
}
.lg-table .m-only { display: none; }
/* 原価表 on a phone: one card per row, each value under its label */
@media (max-width: 640px) {
    .lg-stack thead, .lg-cost thead { display: none; }
    .lg-stack, .lg-stack tbody, .lg-cost, .lg-cost tbody { display: block; width: 100%; }
    .lg-stack tr, .lg-cost tr { display: grid; gap: 10px 12px; padding: 14px; border-bottom: 1px solid var(--plate-edge); }
    .lg-stack tr:last-child, .lg-cost tr:last-child { border-bottom: 0; }
    .lg-stack td, .lg-cost td, .lg-cost td.wrap { min-width: 0; padding: 0; border: 0; white-space: normal; text-align: left; background: none !important; }
    .lg-stack td[data-label]::before, .lg-cost td[data-label]::before {
        content: attr(data-label); display: block; margin-bottom: 2px; color: var(--steel-dim); font: 700 10.5px/1.4 var(--sans); letter-spacing: 0.02em; }
    .lg-table .m-only { display: inline; }
    .lg-table .m-hide { display: none; }
    .lg-stack tr { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .lg-stack td.c-head { grid-column: 1 / -1; color: var(--bone); font-size: 15px; font-weight: 700; }
    .lg-stack td.lg-acts, .lg-stack tr.lg-edit > td { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 4px 14px; }
    .lg-stack tr.lg-edit > td { display: block; }
    .lg-stack td.num, .lg-cost td.num { font-size: 14px; text-align: left; }
    .lg-tabs { gap: 2px; }
    .lg-tabs button { flex: 1 0 auto; justify-content: center; gap: 4px; padding: 0 8px; font-size: 13.5px; }
    .lg-tabs button b { min-width: 16px; padding: 0 4px; font-size: 10px; }
    .lg-cost tr { grid-template-columns: repeat(3, minmax(0, 1fr));
        grid-template-areas: "id id st" "name name name" "cost ad price" "gross bought ship"; }
    .lg-cost .c-ad { grid-area: ad; }
    .lg-cost .c-id { grid-area: id; }
    .lg-cost .c-st { grid-area: st; justify-self: end; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px; }
    .lg-cost .c-name { grid-area: name; margin-top: -4px; color: var(--steel); font-size: 13.5px; }
    .lg-cost .c-cost { grid-area: cost; }
    .lg-cost .c-price { grid-area: price; }
    .lg-cost .c-gross { grid-area: gross; }
    .lg-cost .c-rate { display: none; }
    .lg-cost .c-bought { grid-area: bought; font-size: 12.5px; color: var(--steel); }
    .lg-cost .c-ship { grid-area: ship; font-size: 12.5px; color: var(--steel); }
    .lg-cost .lg-open { font-size: 15px; }
    .lg-cost-bar select { flex: 1 1 auto; }
    .lg-cost-bar .btn { flex: 1 1 auto; }
}
.lg-cats { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.lg-cats span { display: grid; gap: 1px; padding: 8px 12px; border: 1px solid var(--plate-edge); border-radius: 4px; background: var(--plate); }
.lg-cats small { color: var(--steel-dim); font-size: 11.5px; }
.lg-cats b { color: var(--bone); font: 700 14px/1.3 var(--mono); }
@media (max-width: 1099px) {
    .lg-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .lg-kpis .kpi.is-profit { grid-column: 1 / -1; }
    .lg-entry { grid-template-columns: 1fr 1fr; }
    .lg-entry-memo { grid-column: 1 / -1; }
    .lg-fix-row { grid-template-columns: 1fr 1fr; }
    .lg-fix-id { grid-column: 1 / -1; }
}

/* OS vault */
.vault { padding: 4px 0 2px; }
.vault-table { width: 100%; border-collapse: collapse; margin: 10px 0; font-size: 13px; }
.vault-table th, .vault-table td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--plate-edge); }
.vault-table th { color: var(--steel); font-weight: 600; font-size: 12px; }
.vault-table .acts { text-align: right; white-space: nowrap; }
.vault-table .acts .text-btn { margin-left: 12px; }
.vault-form { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 10px 0 6px; }
.vault-form select { min-height: 40px; padding: 0 12px; border-radius: 4px; border: 1px solid var(--plate-edge); background: #0b0b0d; color: var(--bone); font: inherit; }

.cert-only { margin-top: 10px; }
.cert-only .text-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.dr-nocert { display: grid; gap: 8px; justify-items: start; margin-top: 12px; }
.dr-nocert[hidden] { display: none; }

.esim-plancount { display: flex; flex-wrap: wrap; gap: 6px; margin: -4px 0 12px; }
.esim-plancount span { padding: 3px 10px; border: 1px solid var(--plate-edge); border-radius: 999px; font-size: 12.5px; color: var(--steel); }
.esim-plancount b { color: var(--bone); margin-left: 4px; font-family: var(--mono); }
