/* VGIS console + account page. Same identity as vgis.top and the VGIS brand kit (C:\Vgis\vgis-brand):
   Nhật Lệ blue as the main colour, karst green for success, contour brown for warnings and contour lines,
   cinnabar only for errors and the LTM seal, map-paper background, no gradients. Variable names are kept
   from the first design (--forest = main colour) so the rules below did not have to change. */

@font-face { font-family: "Be Vietnam Pro"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/BeVietnamPro-Regular.woff2") format("woff2"); }
@font-face { font-family: "Be Vietnam Pro"; font-style: normal; font-weight: 500; font-display: swap; src: url("fonts/BeVietnamPro-Medium.woff2") format("woff2"); }
@font-face { font-family: "Be Vietnam Pro"; font-style: normal; font-weight: 600; font-display: swap; src: url("fonts/BeVietnamPro-SemiBold.woff2") format("woff2"); }
@font-face { font-family: "Be Vietnam Pro"; font-style: normal; font-weight: 700; font-display: swap; src: url("fonts/BeVietnamPro-Bold.woff2") format("woff2"); }

:root {
    --paper: #F5F7F6;          /* giấy bản đồ */
    --panel: #FFFFFF;
    --panel-2: #EAF0EF;
    --ink: #16262E;            /* mực */
    --ink-2: #2E434C;
    --muted: #4E6169;
    --line: #C7D3D2;
    --line-2: #E1E9E8;
    --forest: #0B5E73;         /* Nhật Lệ: màu chính */
    --forest-hover: #084A5B;
    --forest-ink: #FFFFFF;
    --forest-soft: #E4F0F2;    /* water tint */
    --karst: #2E6B4C;          /* thành công, thực phủ */
    --karst-soft: #E1EFE6;
    --deep: #0B2C36;           /* mặt tối của thương hiệu (thanh bên, dải đầu trang) */
    --deep-2: #10394A;
    --side-ink: #E3ECEC;
    --side-muted: #9DB0B5;
    --side-line: rgba(227, 236, 236, .1);
    --ochre: #8A5A2B;          /* nâu bình độ: cảnh báo, chờ xử lý */
    --ochre-soft: rgba(138, 90, 43, .14);
    --hydro: #0B5E73;
    --hydro-soft: #E4F0F2;
    --bad: #B42318;            /* son: chỉ lỗi và triện */
    --bad-soft: #FBE7E4;
    --focus: #0B5E73;
    --topo: #D6A672;           /* bình độ sáng trên nền tối */
    /* tier swatches: text / tint / chart fill */
    --t-free: #59625d;    --t-free-bg: #e8ece9;    --t-free-fill: #a7b2ab;
    --t-student: #17695a; --t-student-bg: #d6eee6; --t-student-fill: #3c9a80;
    --t-basic: #1f5686;   --t-basic-bg: #dbe8f5;   --t-basic-fill: #3a78b0;
    --t-pro: #593c8c;     --t-pro-bg: #e9e1f4;     --t-pro-fill: #7c5eb4;
    --t-max: #85520a;     --t-max-bg: #f6e5c8;     --t-max-fill: #c98a2b;
    --radius: 10px;
    --radius-sm: 6px;
    --shadow: 0 1px 0 rgba(15, 42, 31, .04), 0 1px 3px rgba(15, 42, 31, .05);
    --shadow-pop: 0 10px 30px rgba(15, 42, 31, .18), 0 2px 6px rgba(15, 42, 31, .12);
    --sans: "Be Vietnam Pro", system-ui, "Segoe UI", Roboto, sans-serif;
    --mono: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, monospace;
    color-scheme: light;
}
@media (prefers-color-scheme: dark) {
    :root {
        --paper: #0D1B21; --panel: #13262E; --panel-2: #0A161B; --ink: #E3ECEC; --ink-2: #C3D2D4; --muted: #9DB0B5;
        --line: #24404A; --line-2: #1A323B; --forest: #6CC6DA; --forest-hover: #8FD6E6; --forest-ink: #0D1B21; --forest-soft: #123844;
        --karst: #7FC79A; --karst-soft: #16352A;
        --deep: #08161B; --deep-2: #0F2530; --side-ink: #E3ECEC; --side-muted: #9DB0B5; --side-line: rgba(227, 236, 236, .08);
        --ochre: #D6A672; --ochre-soft: rgba(214, 166, 114, .12); --hydro: #6CC6DA; --hydro-soft: #123844; --bad: #F08A7E; --bad-soft: #3A1E1B; --focus: #6CC6DA;
        --t-free: #b2bdb6;    --t-free-bg: #222e28;    --t-free-fill: #5e6b64;
        --t-student: #86d6bd; --t-student-bg: #15342b; --t-student-fill: #3c9a80;
        --t-basic: #9cc6ee;   --t-basic-bg: #172c40;   --t-basic-fill: #4a88c0;
        --t-pro: #c8b2ee;     --t-pro-bg: #2b2342;     --t-pro-fill: #8b6fc4;
        --t-max: #efc47a;     --t-max-bg: #382a14;     --t-max-fill: #d39a3e;
        --shadow: 0 1px 0 rgba(0, 0, 0, .25);
        --shadow-pop: 0 12px 32px rgba(0, 0, 0, .5), 0 2px 6px rgba(0, 0, 0, .4);
        color-scheme: dark;
    }
}

/* ------------------------------------------------------------------ base */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; background: var(--paper); color: var(--ink); }
body { font: 400 15px/1.55 var(--sans); font-feature-settings: "tnum" 0; -webkit-font-smoothing: antialiased; }
a { color: var(--forest); text-underline-offset: .18em; text-decoration-thickness: 1px; }
a:hover { color: var(--forest-hover); }
h1, h2, h3 { font-weight: 600; letter-spacing: -.012em; color: var(--ink); }
h1 { font-size: 1.75rem; line-height: 1.2; margin: 0; }
h2 { font-size: 1.125rem; line-height: 1.3; margin: 2rem 0 .75rem; }
h3 { font-size: 1rem; margin: 1.25rem 0 .5rem; }
p { margin: .5rem 0; }
code, .mono { font-family: var(--mono); font-size: .86em; }
code { background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 4px; padding: .05em .35em; overflow-wrap: anywhere; }
.muted { color: var(--muted); }
.small { font-size: .84rem; }
.num { font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
::selection { background: var(--forest-soft); }

.ico { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* VGIS mark */
.mark { width: 36px; height: 36px; flex: none; }

/* contour field */
.topo { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.topo path { fill: none; vector-effect: non-scaling-stroke; stroke-linecap: round; }
.topo-minor { stroke: var(--topo, #D6A672); stroke-width: .7; opacity: .2; }
.topo-major { stroke: var(--topo, #D6A672); stroke-width: 1.2; opacity: .38; }

/* ------------------------------------------------------------------ admin shell */
.shell { display: grid; grid-template-columns: 252px minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; background: var(--deep); color: var(--side-ink); overflow: hidden; isolation: isolate; }
.side .topo { top: auto; height: 260px; z-index: -1; opacity: .7; }
.side-brand { display: flex; align-items: center; gap: .7rem; padding: 1.1rem 1.1rem 1rem; color: inherit; text-decoration: none; }
.side-brand b { display: block; font-size: 1.02rem; font-weight: 700; letter-spacing: .01em; color: #fff; line-height: 1.15; }
.side-brand span { display: block; font-size: .8rem; color: var(--side-muted); }
.side-brand:hover { color: inherit; }
.side-scroll { flex: 1; overflow-y: auto; padding: .25rem .7rem 1rem; scrollbar-width: thin; scrollbar-color: var(--deep-2) transparent; }
.side nav .grp { margin: 1.1rem .55rem .35rem; font-size: .76rem; font-weight: 500; color: var(--side-muted); }
.side nav .grp:first-child { margin-top: .25rem; }
.side nav a { display: flex; align-items: center; gap: .7rem; padding: .48rem .6rem; margin: 1px 0; border-radius: 7px; color: var(--side-ink); text-decoration: none; font-size: .92rem; }
.side nav a .ico { color: var(--side-muted); }
.side nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.side nav a.on { background: rgba(108, 198, 218, .14); color: #fff; font-weight: 600; box-shadow: inset 2px 0 0 #6CC6DA; }
.side nav a.on .ico { color: #6CC6DA; }
.side nav a:focus-visible { outline-color: #6CC6DA; }
.who { display: flex; align-items: center; gap: .65rem; margin: 0 .7rem .8rem; padding: .7rem .6rem; border-top: 1px solid var(--side-line); }
.who .avatar { width: 34px; height: 34px; border-radius: 50%; flex: none; display: grid; place-items: center; background: var(--deep-2); color: #6CC6DA; font-weight: 600; font-size: .9rem; border: 1px solid var(--side-line); }
.who .meta { min-width: 0; flex: 1; line-height: 1.3; }
.who .meta b { display: block; font-weight: 500; font-size: .86rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #fff; }
.who .meta span { font-size: .78rem; color: var(--side-muted); }
.who button { background: transparent; border-color: transparent; color: var(--side-muted); padding: .4rem; }
.who button:hover { color: #fff; background: rgba(255, 255, 255, .08); border-color: transparent; }
.side-top { display: none; }

main.view { padding: 1.75rem 2.25rem 5rem; max-width: 1320px; width: 100%; min-width: 0; }
.pagehead { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem 1.5rem; margin-bottom: 1.5rem; }
.pagehead .lede { margin: .4rem 0 0; color: var(--muted); max-width: 72ch; font-size: .92rem; }
.pagehead .actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.crumb { display: inline-flex; align-items: center; gap: .25rem; font-size: .88rem; text-decoration: none; color: var(--muted); margin-bottom: .5rem; }
.crumb:hover { color: var(--forest); }
.crumb .ico { width: 16px; height: 16px; }
.loading { color: var(--muted); padding: 2rem 0; }

@media (max-width: 900px) {
    .shell { grid-template-columns: 1fr; }
    .side { position: sticky; top: 0; z-index: 20; height: auto; max-height: 100vh; }
    .side .topo { display: none; }
    .side-top { display: flex; align-items: center; justify-content: space-between; padding-right: .6rem; }
    .side-top .side-brand { padding: .7rem 1rem; }
    .side > .side-brand { display: none; }
    .navtoggle { background: transparent; border-color: var(--side-line); color: var(--side-ink); padding: .45rem .55rem; }
    .navtoggle:hover { background: rgba(255, 255, 255, .08); border-color: var(--side-line); }
    .side-scroll, .side .who { display: none; }
    .shell.nav-open .side-scroll { display: block; max-height: calc(100vh - 130px); }
    .shell.nav-open .side .who { display: flex; }
    main.view { padding: 1.25rem 16px 4rem; }
    h1 { font-size: 1.45rem; }
}

/* ------------------------------------------------------------------ blocks */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.15rem 1.25rem; margin-bottom: 1rem; box-shadow: var(--shadow); }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1rem; margin-bottom: .6rem; }
.card-head h2, .card-head h3 { margin: 0; }
.card-title { font-weight: 600; font-size: 1rem; }
.section-title { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 1rem; margin: 2.1rem 0 .75rem; }
.section-title h2 { margin: 0; }
.row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.row.between { justify-content: space-between; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .25rem 1rem; }
.grid2.gap { gap: 1rem; margin-bottom: 1rem; }
.grid2 > .card { margin-bottom: 0; }
@media (max-width: 760px) { .grid2 { grid-template-columns: minmax(0, 1fr); } }
.stack > * + * { margin-top: 1rem; }

/* KPI ledger: one surface, cells divided by hairlines */
.ledger { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); margin-bottom: 1.25rem; }
.kpi { position: relative; display: flex; flex-direction: column; gap: .15rem; padding: 1rem 1.15rem 1.05rem; background: var(--panel); color: var(--ink); text-decoration: none; min-height: 118px; }
a.kpi:hover { background: var(--panel-2); color: var(--ink); }
.kpi .kpi-label { display: flex; align-items: center; gap: .45rem; font-size: .86rem; color: var(--muted); }
.kpi .kpi-label .ico { width: 16px; height: 16px; }
.kpi .kpi-value { font-size: 2rem; font-weight: 600; line-height: 1.15; letter-spacing: -.02em; font-variant-numeric: tabular-nums; margin-top: .2rem; }
.kpi .kpi-sub { font-size: .82rem; color: var(--muted); margin-top: auto; }
.kpi.attn .kpi-value { color: var(--ochre); }
.kpi.alarm .kpi-value { color: var(--bad); }
.kpi.attn .kpi-label::after, .kpi.alarm .kpi-label::after { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; margin-left: auto; }
.kpi.attn .kpi-label { color: var(--ochre); }
.kpi.alarm .kpi-label { color: var(--bad); }
.kpi .go { position: absolute; right: .9rem; bottom: .9rem; color: var(--muted); opacity: 0; transition: opacity .15s; }
a.kpi:hover .go, a.kpi:focus-visible .go { opacity: 1; }

/* tier distribution */
.dist-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 1rem; align-items: start; }
@media (max-width: 1000px) { .dist-grid { grid-template-columns: minmax(0, 1fr); } }
.dist + .dist { margin-top: 1.4rem; padding-top: 1.2rem; border-top: 1px solid var(--line-2); }
.dist-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .25rem 1rem; margin-bottom: .55rem; }
.dist-head b { font-weight: 600; }
.dist-head span { font-size: .84rem; color: var(--muted); }
.bar { display: block; width: 100%; height: 14px; border-radius: 4px; overflow: hidden; background: var(--line-2); }
.bar rect.free { fill: var(--t-free-fill); }
.bar rect.student { fill: var(--t-student-fill); }
.bar rect.basic { fill: var(--t-basic-fill); }
.bar rect.pro { fill: var(--t-pro-fill); }
.bar rect.max { fill: var(--t-max-fill); }
.bar rect.sep { fill: var(--panel); }
.legend { display: flex; flex-wrap: wrap; gap: .35rem 1.1rem; margin: .7rem 0 0; padding: 0; list-style: none; font-size: .86rem; }
.legend li { display: inline-flex; align-items: center; gap: .4rem; color: var(--ink-2); }
.legend li b { font-weight: 600; font-variant-numeric: tabular-nums; color: var(--ink); }
.legend .sw { width: 10px; height: 10px; border-radius: 3px; }
.sw.free { background: var(--t-free-fill); } .sw.student { background: var(--t-student-fill); } .sw.basic { background: var(--t-basic-fill); }
.sw.pro { background: var(--t-pro-fill); } .sw.max { background: var(--t-max-fill); }
.quick { list-style: none; margin: 0; padding: 0; }
.quick li + li { border-top: 1px solid var(--line-2); }
.quick a { display: flex; align-items: center; gap: .75rem; padding: .65rem .15rem; text-decoration: none; color: var(--ink); }
.quick a .ico:first-child { color: var(--forest); }
.quick a .ico:last-child { margin-left: auto; color: var(--muted); width: 16px; height: 16px; }
.quick a:hover { color: var(--forest); }
.quick a span { display: block; font-size: .8rem; color: var(--muted); }

/* ------------------------------------------------------------------ tables */
.tablewrap { overflow: auto; max-height: min(72vh, 760px); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 1rem; }
table { border-collapse: separate; border-spacing: 0; width: 100%; font-size: .9rem; }
th, td { text-align: left; padding: .62rem .8rem; border-bottom: 1px solid var(--line-2); vertical-align: top; }
thead th { position: sticky; top: 0; z-index: 1; background: var(--panel-2); color: var(--muted); font-weight: 500; font-size: .8rem; white-space: nowrap; border-bottom: 1px solid var(--line); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--panel-2); }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--forest-soft); }
td.c, th.c { text-align: center; }
td .small { margin-top: .1rem; }
td .row { flex-wrap: nowrap; }
td input:not([type=checkbox]), td select { min-width: 7rem; }
tr.empty td, tr.empty:hover td { background: var(--panel); text-align: center; padding: 1.6rem 1rem; color: var(--muted); }
tr.empty .ico { width: 28px; height: 28px; display: block; margin: 0 auto .5rem; stroke-width: 1.4; color: var(--line); }
.emptybox { text-align: center; padding: 2.4rem 1rem; color: var(--muted); background: var(--panel); border: 1px dashed var(--line); border-radius: var(--radius); }
.emptybox .ico { width: 30px; height: 30px; display: block; margin: 0 auto .5rem; stroke-width: 1.4; }

/* ------------------------------------------------------------------ forms */
label { display: block; font-size: .84rem; font-weight: 500; color: var(--ink-2); margin: .75rem 0 .3rem; }
label.check { display: flex; align-items: center; gap: .5rem; font-weight: 400; color: var(--ink); margin: .6rem 0; }
input, select, textarea { font: inherit; font-size: .93rem; color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .5rem .65rem; width: 100%; min-height: 38px; transition: border-color .12s, box-shadow .12s; }
input:hover, select:hover, textarea:hover { border-color: color-mix(in srgb, var(--line) 50%, var(--muted)); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--forest); box-shadow: 0 0 0 3px color-mix(in srgb, var(--forest) 22%, transparent); }
input:disabled, select:disabled, textarea:disabled { background: var(--panel-2); color: var(--muted); }
input::placeholder { color: color-mix(in srgb, var(--muted) 75%, transparent); }
textarea { min-height: 260px; font-family: var(--mono); font-size: .84rem; line-height: 1.5; resize: vertical; }
input[type=checkbox] { width: 17px; height: 17px; min-height: 0; padding: 0; accent-color: var(--forest); flex: none; }
input[type=file] { padding: .4rem; }
.inline input, .inline select { width: auto; }
.toolbar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: .9rem; }
.toolbar input[name=q], .toolbar input[name=action] { flex: 1 1 220px; max-width: 340px; }
.toolbar .search { position: relative; flex: 1 1 220px; max-width: 340px; }
.toolbar .search input { width: 100%; max-width: none; padding-left: 2.1rem; }
.toolbar .search .ico { position: absolute; left: .65rem; top: 50%; transform: translateY(-50%); color: var(--muted); width: 16px; height: 16px; }
.form-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin: 1rem 0 0; }
.hint { font-size: .82rem; color: var(--muted); margin: .3rem 0 0; }

button, .btn { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; font: inherit; font-size: .9rem; font-weight: 500; border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: var(--radius-sm); padding: .5rem .9rem; min-height: 38px; cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .12s, border-color .12s, color .12s; }
button:hover, .btn:hover { border-color: var(--forest); color: var(--ink); }
button .ico, .btn .ico { width: 16px; height: 16px; }
button.primary, .btn.primary { background: var(--forest); color: var(--forest-ink); border-color: var(--forest); font-weight: 600; }
button.primary:hover, .btn.primary:hover { background: var(--forest-hover); border-color: var(--forest-hover); color: var(--forest-ink); }
button.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); }
button.danger:hover { background: var(--bad-soft); border-color: var(--bad); color: var(--bad); }
button.ghost { background: transparent; border-color: transparent; }
button.ghost:hover { background: var(--panel-2); border-color: var(--line); }
button.sm, td button { min-height: 32px; padding: .3rem .65rem; font-size: .84rem; }
button:disabled { opacity: .55; cursor: default; }
button.link { border: 0; background: none; color: var(--forest); padding: 0; min-height: 0; font-weight: 500; text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--forest) 40%, transparent); text-underline-offset: .18em; }
button.link:hover { color: var(--forest-hover); text-decoration-color: currentColor; }
button.link.quiet { color: var(--muted); text-decoration: none; }
button.link.quiet:hover { color: var(--bad); }
.wide { width: 100%; }

details.card { padding: 0; }
details.card > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: .6rem; padding: .9rem 1.25rem; font-weight: 600; border-radius: var(--radius); }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary .ico { color: var(--forest); transition: transform .15s; }
details.card[open] > summary .ico { transform: rotate(45deg); }
details.card[open] > summary { border-bottom: 1px solid var(--line-2); border-radius: var(--radius) var(--radius) 0 0; }
details.card > form { padding: .4rem 1.25rem 1.2rem; }
details.card > summary:hover { background: var(--panel-2); }

/* ------------------------------------------------------------------ badges, notices, toasts */
.badge { display: inline-flex; align-items: center; gap: .35rem; padding: .1rem .55rem; border-radius: 999px; font-size: .78rem; font-weight: 600; line-height: 1.5; white-space: nowrap; background: var(--t-free-bg); color: var(--t-free); vertical-align: 1px; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.free, .badge.student, .badge.basic, .badge.pro, .badge.max { border-radius: 5px; }
.badge.free::before, .badge.student::before, .badge.basic::before, .badge.pro::before, .badge.max::before { display: none; }
.badge.free { background: var(--t-free-bg); color: var(--t-free); }
.badge.student { background: var(--t-student-bg); color: var(--t-student); }
.badge.basic { background: var(--t-basic-bg); color: var(--t-basic); }
.badge.pro { background: var(--t-pro-bg); color: var(--t-pro); }
.badge.max { background: var(--t-max-bg); color: var(--t-max); }
.badge.ok, .badge.active, .badge.pass, .badge.applied, .badge.approved { background: var(--forest-soft); color: var(--forest); }
.badge.bad, .badge.revoked, .badge.locked, .badge.disabled, .badge.fail, .badge.rejected, .badge.refused, .badge.failed { background: var(--bad-soft); color: var(--bad); }
.badge.warn, .badge.pending, .badge.intent, .badge.recorded, .badge.released { background: var(--ochre-soft); color: var(--ochre); }
.badge.lg { font-size: .95rem; padding: .2rem .75rem; }

.notice { display: flex; gap: .7rem; align-items: flex-start; border-radius: var(--radius); padding: .75rem 1rem; margin: 0 0 1rem; background: var(--hydro-soft); color: var(--ink); border: 1px solid color-mix(in srgb, var(--hydro) 25%, transparent); font-size: .92rem; }
.notice > .ico { color: var(--hydro); margin-top: .12rem; }
.notice b { font-weight: 600; }
.notice.ok { background: var(--forest-soft); border-color: color-mix(in srgb, var(--forest) 25%, transparent); }
.notice.ok > .ico { color: var(--forest); }
.notice.warn { background: var(--ochre-soft); border-color: color-mix(in srgb, var(--ochre) 30%, transparent); }
.notice.warn > .ico { color: var(--ochre); }
.notice.err { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 30%, transparent); }
.notice.err > .ico { color: var(--bad); }

#toast { position: fixed; right: 16px; bottom: 16px; left: auto; z-index: 50; display: flex; flex-direction: column; gap: .5rem; align-items: flex-end; max-width: min(440px, calc(100vw - 32px)); }
.toast { display: flex; align-items: flex-start; gap: .6rem; padding: .7rem .6rem .7rem .9rem; border-radius: 8px; background: var(--ink); color: var(--paper); box-shadow: var(--shadow-pop); font-size: .9rem; animation: toast-in .18s ease-out; }
.toast > .ico { color: #6CC6DA; margin-top: .1rem; }
.toast.err > .ico { color: #F08A7E; }
@media (prefers-color-scheme: dark) { .toast > .ico { color: var(--forest-ink); } .toast { background: #E3ECEC; color: #0D1B21; } .toast > .ico { color: #0B5E73; } .toast.err > .ico { color: #B42318; } }
.toast span { flex: 1; }
.toast-x { background: transparent; border: 0; color: inherit; opacity: .6; padding: .15rem; min-height: 0; }
.toast-x:hover { opacity: 1; border: 0; color: inherit; }
.toast-x .ico { width: 15px; height: 15px; }
@keyframes toast-in { from { transform: translateY(6px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .toast { animation: none; } * { transition: none !important; } }

/* ------------------------------------------------------------------ misc */
.qr { display: inline-block; }
.qr img { display: block; width: 220px; height: 220px; background: #fff; border-radius: 8px; padding: 8px; border: 1px solid var(--line); }
.codes { font-family: var(--mono); font-size: .95rem; display: grid; grid-template-columns: repeat(2, minmax(0, max-content)); gap: .45rem 2rem; padding: 1rem 1.2rem; border: 1px dashed var(--line); border-radius: 8px; background: var(--panel-2); counter-reset: code; }
.codes span { counter-increment: code; letter-spacing: .04em; }
.codes span::before { content: counter(code) "."; display: inline-block; width: 1.8em; color: var(--muted); font-size: .8em; }
.matrix td.c input { width: 18px; height: 18px; }
.prose p { margin: .4rem 0 .8rem; max-width: 72ch; }
.tabs { display: inline-flex; gap: 2px; padding: 3px; border-radius: 8px; background: var(--line-2); border: 1px solid var(--line); margin-bottom: 1.25rem; flex-wrap: wrap; }
.tabs button { border: 0; background: transparent; min-height: 32px; padding: .3rem .95rem; border-radius: 6px; color: var(--muted); }
.tabs button:hover { color: var(--ink); border: 0; }
.tabs button.on { background: var(--panel); color: var(--ink); font-weight: 600; box-shadow: var(--shadow); }
.kv { display: flex; flex-wrap: wrap; gap: .4rem 1.5rem; margin: .2rem 0 0; padding: 0; list-style: none; font-size: .86rem; color: var(--muted); }
.kv b { color: var(--ink); font-weight: 500; }
.meter { height: 6px; border-radius: 3px; background: var(--line-2); overflow: hidden; margin-top: .35rem; }
.meter > i { display: block; height: 100%; background: var(--forest); border-radius: 3px; }
.pill-list { display: flex; flex-wrap: wrap; gap: .35rem; margin: 0; padding: 0; list-style: none; }
.pill-list li { font-size: .82rem; padding: .15rem .55rem; border-radius: 5px; background: var(--panel-2); border: 1px solid var(--line-2); color: var(--ink-2); }
.keyline { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.keyline code { font-size: .95rem; padding: .25rem .5rem; letter-spacing: .06em; }
.steps { display: flex; gap: .4rem; margin: 0 0 1.6rem; padding: 0; list-style: none; counter-reset: step; }
.steps li { counter-increment: step; flex: 1; font-size: .78rem; color: var(--muted); padding-top: .55rem; border-top: 3px solid var(--line); }
.steps li::before { content: counter(step) ". "; }
.steps li.on { color: var(--ink); font-weight: 600; border-top-color: var(--forest); }
.steps li.done { color: var(--forest); border-top-color: color-mix(in srgb, var(--forest) 45%, var(--line)); }

/* ------------------------------------------------------------------ admin sign-in */
.auth { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); min-height: 100vh; }
.auth-art { position: relative; overflow: hidden; isolation: isolate; background: var(--deep); color: var(--side-ink); display: flex; flex-direction: column; justify-content: space-between; padding: 2rem 2.4rem; }
.auth-art .topo { z-index: -1; }
.auth-art .side-brand { padding: 0; }
.auth-art .tagline { max-width: 30ch; }
.auth-art .tagline h1 { color: #fff; font-size: 2.4rem; font-weight: 600; letter-spacing: -.025em; line-height: 1.1; }
.auth-art .tagline p { color: var(--side-muted); font-size: 1rem; margin-top: .8rem; }
.auth-art .coords { font-size: .76rem; color: var(--side-muted); font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.auth-pane { display: flex; align-items: center; justify-content: center; padding: 2.5rem 1.5rem; background: var(--panel); }
.auth-box { width: 100%; max-width: 400px; }
.auth-box h2 { font-size: 1.5rem; margin: 0 0 .35rem; }
.auth-box .lede { color: var(--muted); margin: 0 0 1.25rem; font-size: .93rem; }
.auth-box form .primary { width: 100%; margin-top: 1.25rem; min-height: 42px; }
.auth-box .otp { font-family: var(--mono); font-size: 1.35rem; letter-spacing: .35em; text-align: center; padding: .55rem; }
.auth-box .enrol { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 1rem; align-items: start; margin-bottom: .5rem; }
.auth-box .enrol .qr img { width: 168px; height: 168px; }
.auth-box .enrol ol { margin: 0; padding-left: 1.1rem; font-size: .88rem; color: var(--ink-2); }
.auth-box .enrol ol li + li { margin-top: .35rem; }
.auth-foot { margin-top: 2rem; font-size: .8rem; color: var(--muted); }
@media (max-width: 860px) {
    .auth { grid-template-columns: 1fr; }
    .auth-art { min-height: 190px; padding: 1.25rem 16px; }
    .auth-art .tagline h1 { font-size: 1.6rem; }
    .auth-art .tagline p, .auth-art .coords { display: none; }
    .auth-pane { align-items: flex-start; padding: 1.75rem 16px 3rem; }
    .auth-box .enrol { grid-template-columns: 1fr; }
}

/* ------------------------------------------------------------------ account page */
.acct-top { position: relative; overflow: hidden; isolation: isolate; background: var(--deep); color: var(--side-ink); }
.acct-top .topo { z-index: -1; }
.acct-top-inner { max-width: 980px; margin: 0 auto; padding: 1rem 16px; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.acct-top a.site { color: var(--side-ink); font-size: .88rem; display: inline-flex; align-items: center; gap: .35rem; text-decoration: none; padding: .35rem .6rem; border-radius: 6px; border: 1px solid var(--side-line); }
.acct-top a.site:hover { color: #fff; background: rgba(255, 255, 255, .07); }
.acct-top a.site .ico { width: 15px; height: 15px; }
.acct-hero { max-width: 980px; margin: 0 auto; padding: 1.4rem 16px 4.6rem; }
.acct-hero h1 { color: #fff; font-size: 2rem; letter-spacing: -.02em; }
.acct-hero p { color: var(--side-muted); max-width: 60ch; margin-top: .5rem; }
.acct-top.compact .acct-hero { padding-bottom: 4rem; }
.acct-top.compact .acct-hero h1 { font-size: 1.5rem; }
.page { max-width: 980px; margin: -3.2rem auto 0; padding: 0 16px 4rem; position: relative; }
.page > .notice { box-shadow: var(--shadow); }
.auth-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1rem; align-items: start; }
.auth-grid .card { padding: 1.4rem 1.5rem; }
@media (max-width: 760px) { .auth-grid { grid-template-columns: minmax(0, 1fr); } .acct-hero h1 { font-size: 1.55rem; } }
.idcard { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; }
.idcard .who-l { display: flex; align-items: center; gap: .9rem; min-width: 0; }
.idcard .avatar { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--forest-soft); color: var(--forest); font-weight: 600; font-size: 1.1rem; flex: none; }
.idcard b { display: block; font-weight: 600; overflow-wrap: anywhere; }
.product { padding: 0; overflow: hidden; }
.product-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1rem; padding: 1.1rem 1.4rem; border-bottom: 1px solid var(--line-2); }
.product-head h2 { margin: 0; font-size: 1.2rem; }
.product-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); }
.product-body > div { padding: 1.1rem 1.4rem 1.3rem; }
.product-body > div + div { border-left: 1px solid var(--line-2); background: var(--panel-2); }
@media (max-width: 760px) { .product-body { grid-template-columns: minmax(0, 1fr); } .product-body > div + div { border-left: 0; border-top: 1px solid var(--line-2); } }
.product .label { font-size: .8rem; color: var(--muted); margin: .9rem 0 .35rem; }
.product .label:first-child { margin-top: 0; }
.plans { display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: .5rem; }
.plan { flex-direction: column; align-items: flex-start; gap: .1rem; text-align: left; padding: .7rem .85rem; min-height: 0; white-space: normal; background: var(--panel); }
.plan .badge { margin-bottom: .25rem; }
.plan b { font-weight: 600; font-variant-numeric: tabular-nums; }
.plan span { font-size: .8rem; color: var(--muted); font-weight: 400; }
.plan.on { border-color: var(--forest); box-shadow: 0 0 0 1px var(--forest); }
.qrpanel { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 1.25rem; margin: 0; padding: 1.2rem 1.4rem 1.4rem; border-top: 1px solid var(--line-2); }
.qrpanel dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: .45rem 1rem; margin: 0 0 .75rem; font-size: .92rem; }
.qrpanel dt { color: var(--muted); }
.qrpanel dd { margin: 0; overflow-wrap: anywhere; }
.qrpanel dd code { font-size: 1rem; }
@media (max-width: 600px) { .qrpanel { grid-template-columns: minmax(0, 1fr); } .qrpanel dl { grid-template-columns: minmax(0, 1fr); gap: .1rem; } .qrpanel dd { margin-bottom: .45rem; } }
.foot-links { display: flex; gap: 1.25rem; justify-content: center; margin-top: 2rem; font-size: .86rem; }

/* ------------------------------------------------------------------ print: recovery codes only */
@media print {
    body * { visibility: hidden; }
    .print-area, .print-area * { visibility: visible; }
    .print-area { position: absolute; left: 0; top: 0; width: 100%; }
    .print-area button { display: none; }
}
.grow { flex: 1 1 240px; min-width: 0; }
@media (max-width: 700px) {
    .ledger { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .kpi { min-height: 0; padding: .85rem .9rem; }
    .kpi .kpi-value { font-size: 1.6rem; }
    .kpi .kpi-sub { display: none; }
}
tr:has(input:not([type=checkbox]), select) > td { vertical-align: middle; }
.toolbar.inline input[name=key], .toolbar.inline input[name=label], .toolbar.inline input[name=amount_vnd] { flex: 1 1 170px; max-width: 280px; }
.card.toolbar { padding: .9rem 1.1rem; }

/* ------------------------------------------------------------------ author line + LTM seal (brand kit rule) */
.signature { display: inline-flex; align-items: center; gap: .45rem; font-size: .8rem; color: var(--muted); margin: 1rem 0 0; }
.signature .seal { width: 1.3em; height: 1.3em; }
.signature.on-dark { color: var(--side-muted); }

/* ------------------------------------------------------------------ account sign-in / sign-up switch */
.auth-card { max-width: 440px; margin: 0 auto 1rem; padding: 1.5rem 1.6rem 1.2rem; animation: rise .6s cubic-bezier(.2, .7, .2, 1) .12s both; }
.auth-card-head { display: flex; align-items: center; gap: .7rem; }
.auth-card-head b { display: block; font-size: 1.05rem; letter-spacing: .01em; }
.auth-card-head span { display: block; font-size: .82rem; color: var(--muted); }
.auth-tabs { position: relative; display: grid; grid-template-columns: 1fr 1fr; padding: 4px; margin: 1.1rem 0 1.25rem; background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 999px; }
.auth-tab { position: relative; z-index: 1; border: 0 !important; background: none !important; box-shadow: none !important; border-radius: 999px; padding: .5rem .75rem; min-height: 38px; font-weight: 600; color: var(--muted); cursor: pointer; transition: color .35s ease; }
.auth-tab[aria-selected="true"] { color: var(--forest-ink); }
.auth-tab:hover:not([aria-selected="true"]) { color: var(--ink); }
.auth-tabs-ind { position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc(50% - 4px); border-radius: 999px; background: var(--forest); box-shadow: 0 2px 8px rgba(11, 94, 115, .28); transition: transform .5s cubic-bezier(.65, 0, .35, 1); }
.auth-card[data-mode="signup"] .auth-tabs-ind { transform: translateX(100%); }
.auth-viewport { overflow: hidden; transition: height .5s cubic-bezier(.65, 0, .35, 1); }
.auth-track { display: flex; align-items: flex-start; width: 200%; transition: transform .5s cubic-bezier(.65, 0, .35, 1); }
.auth-track > .auth-pane-x { width: 50%; flex: none; padding: 2px; transition: opacity .4s ease, transform .5s cubic-bezier(.65, 0, .35, 1); }
.auth-card[data-mode="signup"] .auth-track { transform: translateX(-50%); }
.auth-card[data-mode="login"] [data-pane="signup"], .auth-card[data-mode="signup"] [data-pane="login"] { opacity: 0; transform: scale(.97); }
.auth-alt { margin: 1rem 0 0; font-size: .86rem; color: var(--muted); text-align: center; }
.auth-card .signature { display: flex; justify-content: center; border-top: 1px solid var(--line-2); padding-top: .9rem; }
.turnstile:not(:empty) { margin-top: .8rem; }

/* ------------------------------------------------------------------ motion: contours draw in and drift, content rises */
@keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes topo-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes topo-drift { from { transform: scale(1.06) translate3d(0, 0, 0); } to { transform: scale(1.1) translate3d(-1.8%, -1.2%, 0); } }
.topo path { stroke-dasharray: 1; animation: topo-draw 2.6s cubic-bezier(.45, .05, .25, 1) both; }
.topo .topo-major { animation-duration: 3.2s; animation-delay: .25s; }
.acct-top .topo, .auth-art .topo { transform-origin: 60% 40%; animation: topo-drift 48s ease-in-out infinite alternate; }
.acct-top-inner, .acct-hero h1, .acct-hero p, .auth-art .side-brand, .auth-art .tagline > * { animation: rise .7s cubic-bezier(.2, .7, .2, 1) both; }
.acct-hero h1, .auth-art .tagline > :nth-child(1) { animation-delay: .08s; }
.acct-hero p, .auth-art .tagline > :nth-child(2) { animation-delay: .16s; }
.auth-art .tagline > :nth-child(3) { animation-delay: .24s; }
.page > *:not(.auth-card) { animation: rise .6s cubic-bezier(.2, .7, .2, 1) both; }
.page > :nth-child(2) { animation-delay: .06s; } .page > :nth-child(3) { animation-delay: .12s; } .page > :nth-child(4) { animation-delay: .18s; }
.page > :nth-child(5) { animation-delay: .24s; } .page > :nth-child(n+6) { animation-delay: .3s; }
.auth-box > * { animation: rise .55s cubic-bezier(.2, .7, .2, 1) both; }
.auth-box > :nth-child(2) { animation-delay: .07s; } .auth-box > :nth-child(3) { animation-delay: .14s; } .auth-box > :nth-child(n+4) { animation-delay: .2s; }
@media (prefers-reduced-motion: reduce) {
    .topo path, .acct-top .topo, .auth-art .topo, .acct-top-inner, .acct-hero h1, .acct-hero p, .auth-art .side-brand, .auth-art .tagline > *,
    .page > *, .auth-box > *, .auth-card { animation: none !important; }
    .topo path { stroke-dasharray: none; }
    .auth-viewport, .auth-track, .auth-track > .auth-pane-x, .auth-tabs-ind, .auth-tab { transition: none !important; }
}
.signature { white-space: nowrap; }
.auth-art .tagline .signature { max-width: none; }

/* Admin: key-value list of an application, section heading on the content page */
.kv-list { display: grid; grid-template-columns: minmax(9rem, max-content) minmax(0, 1fr); gap: .35rem 1.25rem; margin: .5rem 0 1rem; }
.kv-list dt { color: var(--muted); font-size: .86rem; }
.kv-list dd { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.section-h { margin: 2rem 0 .75rem; font-size: 1.15rem; }
.bad-text { color: var(--bad); font-weight: 600; }
