/* The service's pages (serviceportal / servicehelp): one stylesheet, served at
   /portal.css without a session (the sign-in pages use it too). Tokens first;
   the brand colour is the viewer's indigo (static/css/styles.css --primary), so
   the files pages and the viewer read as one site (plan_web_service.md §15 F1).
   No web font: the system's (Segoe UI / PingFang / Noto Sans TC) -- nothing
   loaded from elsewhere. */

:root {
    --bg: #f6f7fb;
    --fg: #0f172a;
    --muted: #5b6477;
    --card: #ffffff;
    --line: #e2e5ee;
    --accent: #4f46e5;
    --accent-hover: #4338ca;
    --accent-fg: #ffffff;
    --accent-soft: #eef0ff;
    --ok: #15803d;
    --bad: #b42318;
    --warn: #b45309;
    --code: #eef0f6;
    --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 1px 1px rgba(15, 23, 42, .04);

    --font: system-ui, -apple-system, "Segoe UI", "PingFang TC", "Noto Sans TC",
            "Microsoft JhengHei", sans-serif;
    --mono: ui-monospace, "Cascadia Mono", Consolas, "Noto Sans Mono", monospace;
    --text: 16px;
    --small: 14px;
    --h1: 1.6rem;
    --h2: 1.15rem;

    --s1: 4px;
    --s2: 8px;
    --s3: 12px;
    --s4: 16px;
    --s5: 24px;
    --s6: 32px;
    --s7: 48px;
    --radius: 10px;
    --radius-small: 6px;
    --page: 820px;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0f172a;
        --fg: #f1f5f9;
        --muted: #94a3b8;
        --card: #162033;
        --line: #2b3850;
        --accent: #818cf8;
        --accent-hover: #a5b4fc;
        --accent-fg: #0f172a;
        --accent-soft: #1e2546;
        --ok: #4ade80;
        --bad: #f87171;
        --warn: #fbbf24;
        --code: #1e293b;
        --shadow: none;
    }
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--fg); font: var(--text)/1.6 var(--font); }
main { max-width: var(--page); margin: 0 auto; padding: var(--s5) var(--s4) var(--s7); }

/* the shell: header and footer, the same on every page */
.site-header {
    display: flex; justify-content: space-between; align-items: center; gap: var(--s3);
    flex-wrap: wrap; border-bottom: 1px solid var(--line); padding-bottom: var(--s3); margin-bottom: var(--s5);
}
.brand { display: inline-flex; align-items: center; gap: var(--s2); font-weight: 650;
         color: var(--fg); text-decoration: none; letter-spacing: .01em; }
.brand svg { width: 26px; height: 26px; flex: none; }
.brand-mark-bg { fill: var(--accent); }
.brand-mark-fg { stroke: var(--accent-fg); }
nav { display: flex; gap: var(--s4); flex-wrap: wrap; align-items: center; }
nav form { display: inline; }
nav a, nav button.link { color: var(--muted); text-decoration: none; }
nav a:hover, nav button.link:hover { color: var(--accent); }
nav a[aria-current="page"] { color: var(--fg); font-weight: 600; }
.site-footer { margin-top: var(--s7); padding-top: var(--s4); border-top: 1px solid var(--line);
               color: var(--muted); font-size: 13px; }

a { color: var(--accent); }
a:hover { color: var(--accent-hover); }
h1 { font-size: var(--h1); line-height: 1.3; margin: 0 0 var(--s3); }
h2 { font-size: var(--h2); margin: var(--s6) 0 var(--s2); }
p { margin: var(--s2) 0 var(--s3); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
        padding: var(--s4); margin: var(--s3) 0; box-shadow: var(--shadow); }
label { display: block; margin: var(--s3) 0 var(--s1); font-weight: 550; }
input, textarea, select { width: 100%; padding: var(--s2) 10px; border: 1px solid var(--line);
                          border-radius: var(--radius-small); background: var(--bg); color: var(--fg); font: inherit; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
textarea { min-height: 110px; }

button, .button { display: inline-block; margin-top: 14px; padding: var(--s2) var(--s4); border: 0;
                  border-radius: var(--radius-small); background: var(--accent); color: var(--accent-fg);
                  font: inherit; font-weight: 550; cursor: pointer; text-decoration: none; }
button:hover, .button:hover { background: var(--accent-hover); color: var(--accent-fg); }
button.link { background: none; color: var(--accent); padding: 0; margin: 0; font-weight: inherit;
              text-decoration: underline; }
button.link:hover { background: none; }
button.quiet, .button.quiet { background: var(--code); color: var(--fg); }
button.quiet:hover, .button.quiet:hover { background: var(--line); color: var(--fg); }
button.danger { background: var(--bad); color: #fff; }

.muted { color: var(--muted); }
.ok { color: var(--ok); }
.bad { color: var(--bad); }

code, pre { background: var(--code); border-radius: 4px; font: var(--small) var(--mono); }
code { padding: 1px 5px; }
pre { padding: var(--s3); overflow-x: auto; white-space: pre-wrap; word-break: break-all; }

table { width: 100%; border-collapse: collapse; font-size: 15px; }
td, th { text-align: left; padding: var(--s2); border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: var(--small); }

.row { display: flex; gap: var(--s2); flex-wrap: wrap; align-items: center; }
.row form { display: inline; }
.hp { position: absolute; left: -10000px; }
ul.tree { list-style: none; margin: 2px 0; padding-left: 18px; font: var(--small) var(--mono); }
.card > ul.tree { padding-left: 0; }
summary { cursor: pointer; }

/* the files page (§15 F2): one card per name, its versions inside; the quotas as bars */
.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; background: var(--accent-soft);
         color: var(--accent); font-size: 12px; font-weight: 600; vertical-align: middle; }
.ws-head { display: flex; gap: var(--s2); align-items: baseline; flex-wrap: wrap; }
.ws-head strong { font-size: 1.05rem; word-break: break-word; }
ul.versions { list-style: none; margin: var(--s2) 0 0; padding: 0; }
li.version { display: flex; gap: var(--s1) var(--s3); flex-wrap: wrap; align-items: baseline;
             padding: var(--s2) 0; border-top: 1px solid var(--line); font-size: 15px; }
li.version .v { font-weight: 650; min-width: 2.2em; }
li.version .actions { margin-left: auto; display: flex; gap: var(--s3); align-items: baseline; }
.usage { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s4); margin: var(--s3) 0 var(--s4); }
.usage p { margin: var(--s1) 0 0; font-size: 13px; }
.usage-line { display: flex; justify-content: space-between; gap: var(--s2); font-size: var(--small); }
.meter { height: 8px; border-radius: 999px; background: var(--code); overflow: hidden; margin-top: var(--s1); }
.meter.thin { height: 6px; min-width: 80px; margin-top: 8px; }
.meter span { display: block; height: 100%; background: var(--accent); }
.meter.high span { background: var(--warn); }
.meter.full span { background: var(--bad); }
.older summary { color: var(--muted); font-size: var(--small); padding: var(--s2) 0 0; border-top: 1px solid var(--line); }
.empty ol { margin: var(--s2) 0 0; padding-left: 1.3em; }
@media (max-width: 560px) {
    .usage { grid-template-columns: 1fr; }
}

/* the help page (§15 F3): contents beside the text on a wide screen, above it on a phone */
.with-toc { display: grid; grid-template-columns: 1fr; gap: var(--s5); }
.toc { font-size: var(--small); }
.toc ol { margin: var(--s2) 0 0; padding-left: 1.3em; }
.toc a { color: var(--muted); text-decoration: none; }
.toc a:hover { color: var(--accent); }
@media (min-width: 980px) {
    main:has(.with-toc) { max-width: 1060px; }
    .with-toc { grid-template-columns: 190px 1fr; }
    .toc { position: sticky; top: var(--s4); align-self: start; padding-top: var(--s2); }
}
@media (max-width: 979px) {
    .toc { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--s3) var(--s4); }
}
h2[id] { scroll-margin-top: var(--s4); }

/* the landing page (§15 F3; design pass 2026-10-14): text and the sample diagram side
   by side on a wide screen, stacked on a phone. The picture is never drawn larger than
   it was saved (548 px), so it does not blur. */
main:has(.hero), main:has(.files-layout) { max-width: 1120px; }
.hero { display: grid; grid-template-columns: 1fr; gap: var(--s6); align-items: center;
        padding: var(--s4) 0 var(--s5); }
.hero h1 { font-size: clamp(1.75rem, 1.2rem + 2.4vw, 2.6rem); line-height: 1.2; letter-spacing: -.01em;
           text-wrap: balance; margin-bottom: var(--s4); }
/* CJK headings break at the spaces around the Latin words, not inside a word,
   and no line starts or ends on a lone punctuation mark */
:lang(zh) .hero h1, :lang(ja) .hero h1 { word-break: keep-all; line-break: strict; }
.lead { font-size: 1.1rem; }
.fine { color: var(--muted); font-size: 13px; }
.cta { display: flex; gap: var(--s2); flex-wrap: wrap; margin: var(--s4) 0 var(--s2); }
.cta .button { margin-top: 0; padding: 10px 20px; }
.shot { margin: 0; justify-self: center; width: 100%; max-width: 580px; }
.shot-bar { display: flex; align-items: center; gap: 6px; padding: var(--s2) var(--s3);
            background: #1e293b; color: #cbd5e1; border-radius: var(--radius) var(--radius) 0 0;
            font: 12px var(--mono); }
.shot-bar i { width: 8px; height: 8px; border-radius: 999px; background: #475569; }
.shot-bar span { margin-left: var(--s2); }
.shot img { display: block; width: 100%; max-width: 548px; height: auto; margin: 0 auto; }
.shot-bar + img { padding: var(--s4); max-width: 100%; box-sizing: border-box; background: #fff;
                  border: 1px solid var(--line); border-top: 0; border-radius: 0 0 var(--radius) var(--radius);
                  box-shadow: var(--shadow); object-fit: contain; }
.shot figcaption { color: var(--muted); font-size: 13px; margin-top: var(--s2); }
.section-title { margin-top: var(--s6); }
.steps { list-style: none; counter-reset: step; padding: 0; display: grid; gap: var(--s3);
         grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); margin: var(--s3) 0 var(--s4); }
.steps li { counter-increment: step; background: var(--card); border: 1px solid var(--line);
            border-radius: var(--radius); padding: var(--s4); box-shadow: var(--shadow);
            display: grid; grid-template-columns: 26px 1fr; column-gap: var(--s3); align-items: start;
            align-content: start; }
.steps li::before { content: counter(step); display: inline-grid; place-items: center; width: 26px; height: 26px;
                    border-radius: 999px; background: var(--accent); color: var(--accent-fg); font-weight: 700;
                    grid-row: span 2; }
.steps strong { display: block; }
@media (min-width: 900px) {
    .hero { grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); padding-top: var(--s6); }
}

/* the files page, second pass (2026-10-14): the list first, upload folded, usage aside */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
label.check { font-weight: normal; display: flex; gap: var(--s2); align-items: baseline; }
label.check input { width: auto; }
.files-layout { display: grid; grid-template-columns: 1fr; gap: var(--s5); align-items: start; }
.files-main, .files-side { min-width: 0; }
.files-side .card { margin-top: 0; margin-bottom: var(--s3); }
.files-side h2 { margin: 0 0 var(--s2); font-size: 1rem; }
.files-side .usage { grid-template-columns: 1fr; margin: 0; }
.files-side .card p { margin-top: 0; }
.files-side button { margin-top: var(--s1); }
details.upload > summary { font-weight: 600; color: var(--accent); list-style: none; }
details.upload > summary::before { content: "+"; display: inline-block; width: 1.2em; font-weight: 700; }
details.upload[open] > summary::before { content: "−"; }
details.upload > summary::-webkit-details-marker { display: none; }
details.upload[open] > summary { margin-bottom: var(--s2); }
.ws-head .open { margin: 0 0 0 auto; }
.button.small { padding: 4px 14px; font-size: var(--small); }
li.version { display: grid; grid-template-columns: auto 1fr auto; gap: var(--s1) var(--s3); align-items: center; }
li.version .v-id { display: flex; gap: var(--s1); align-items: center; min-width: 5.5em; }
li.version .meta { color: var(--muted); font-size: var(--small); }
li.version .actions { margin-left: 0; align-items: center; }
details.more { position: relative; }
details.more > summary { list-style: none; padding: 0 var(--s2); border-radius: var(--radius-small);
                         color: var(--muted); font-weight: 700; }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary:hover { background: var(--code); }
details.more > form { position: absolute; right: 0; top: 100%; z-index: 1; background: var(--card);
                      border: 1px solid var(--line); border-radius: var(--radius-small); padding: var(--s2) var(--s3);
                      box-shadow: 0 4px 12px rgba(15, 23, 42, .12); white-space: nowrap; }
details.more button.link { color: var(--bad); }
@media (min-width: 900px) {
    .files-layout { grid-template-columns: minmax(0, 1fr) 280px; }
    .files-side { position: sticky; top: var(--s4); }
}

/* header's language dropdown: clean pill with globe, expands downward to menu */
details.lang-menu { position: relative; display: inline-block; flex-shrink: 0; }
details.lang-menu > summary {
    list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
    border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; font-size: var(--small);
    color: var(--muted); user-select: none;
}
details.lang-menu > summary::-webkit-details-marker { display: none; }
details.lang-menu > summary:hover,
details.lang-menu[open] > summary { color: var(--fg); border-color: var(--accent); }
details.lang-menu .lang-caret { font-size: 10px; opacity: 0.7; transition: transform .15s; }
details.lang-menu[open] .lang-caret { transform: rotate(180deg); }
details.lang-menu:not([open]) .lang-dropdown { display: none !important; }
details.lang-menu[open] .lang-dropdown {
    position: absolute; right: 0; top: calc(100% + 6px); z-index: 100;
    background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 6px 0; box-shadow: 0 4px 16px rgba(15, 23, 42, .15);
    min-width: 140px; max-height: 280px; overflow-y: auto; display: flex !important; flex-direction: column;
}
details.lang-menu .lang-dropdown a {
    display: block; width: 100%; box-sizing: border-box; padding: 8px 16px; color: var(--muted); text-decoration: none;
    font-size: var(--small); white-space: nowrap; text-align: left;
}
details.lang-menu .lang-dropdown a:hover { background: var(--code); color: var(--accent); }
details.lang-menu .lang-dropdown a.active { font-weight: 600; color: var(--accent); }

/* phones: tighter margins, smaller headings, version rows in two lines */
@media (max-width: 560px) {
    main { padding: var(--s3) var(--s4) var(--s6); }
    h1 { font-size: 1.4rem; }
    .site-header { margin-bottom: var(--s4); }
    nav { gap: var(--s3); font-size: 15px; }
    .card { padding: var(--s3); }
    .hero { gap: var(--s5); padding: 0; }
    .lead { font-size: 1rem; }
    .cta .button { flex: 1; text-align: center; }
    .steps { gap: var(--s3); }
    .steps li { padding: 0; background: none; border: 0; box-shadow: none; }
    li.version { grid-template-columns: auto 1fr; }
    li.version .meta { grid-column: 1 / -1; grid-row: 2; }
    li.version .actions { grid-column: 2; grid-row: 1; justify-self: end; width: auto; }
}
