/* language: CSS, file: assets/css/nav.css, runtime: browser
   Navbar + left drawer. Light is the default theme; dark is opt-in via html.theme-dark. */

/* ============ theme tokens ============ */
:root {
    --bg: #ffffff;
    --bg-soft: #f6fbff;
    --bg-sky: #eaf6ff;
    --surface: #ffffff;
    --line: #dceaf5;
    --line-strong: #c2dcf0;
    --ink: #16232e;
    --ink-2: #4a6072;
    --ink-3: #8497a6;
    --sky: #3aa7e8;
    --sky-d: #1f86c6;
    --sky-l: #7cc4f0;
    --ok: #17a673;
    --warn: #d98514;
    --bad: #d9534f;
    --radius: 14px;
    --radius-s: 10px;
    --radius-l: 18px;
    --nav-h: 64px;
    --shadow: 0 1px 2px rgba(22, 35, 46, .04), 0 8px 24px -12px rgba(58, 167, 232, .18);
    --shadow-lg: 0 24px 60px -28px rgba(22, 35, 46, .4);
    --ease: cubic-bezier(.2, .7, .3, 1);
}

html.theme-dark {
    --bg: #0f1720;
    --bg-soft: #131e29;
    --bg-sky: #16283a;
    --surface: #16212c;
    --line: #24384a;
    --line-strong: #2f4a61;
    --ink: #e8f2fa;
    --ink-2: #a8bccb;
    --ink-3: #7a8fa0;
    --sky: #4db4ef;
    --sky-d: #7cc4f0;
    --sky-l: #2b7ba8;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px -12px rgba(0, 0, 0, .6);
    --shadow-lg: 0 26px 60px -30px rgba(0, 0, 0, .8);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: "IBM Plex Sans Thai", "Noto Sans Thai", -apple-system, "Segoe UI", sans-serif;
    font-size: 15px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    transition: background-color .18s var(--ease), color .18s var(--ease);
}

a { color: var(--sky-d); text-decoration: none; }
a:hover { color: var(--sky); }
img { max-width: 100%; display: block; }

body.drawer-open { overflow: hidden; }

/* ============ icon primitives ============ */
/* All glyphs are inline SVG so they render identically on every DPI and theme. */
.gi {
    width: 18px;
    height: 18px;
    display: block;
    flex: 0 0 auto;
}
.ico-btn {
    width: 40px; height: 40px;
    display: inline-grid; place-items: center;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
    color: var(--ink-2);
    cursor: pointer;
}
.ico-btn:hover { background: var(--bg-sky); border-color: var(--line-strong); color: var(--sky-d); }
.ico-btn:active { transform: scale(.94); }

/* ============ navbar ============ */
.nav {
    position: sticky; top: 0; z-index: 120;
    padding: 8px 10px 0;
    background: transparent;
    transition: background-color .18s var(--ease);
}
/* The visual bar is the inner pill so the corners can round without clipping
   the sticky behaviour or the backdrop blur. */
.nav-inner { border-radius: 18px; }
.nav-inner {
    max-width: 1240px; margin: 0 auto;
    height: var(--nav-h);
    padding: 0 10px 0 10px;
    display: flex; align-items: center; gap: 12px;
    background: color-mix(in srgb, var(--surface) 93%, transparent);
    backdrop-filter: saturate(1.35) blur(12px);
    border: 1px solid var(--line);
    box-shadow: 0 1px 2px rgba(22, 35, 46, .03), 0 10px 26px -20px rgba(58, 167, 232, .5);
    transition: box-shadow .18s var(--ease), border-color .18s var(--ease);
}
.nav-inner:focus-within { border-color: var(--line-strong); }

.brand { display: flex; align-items: center; gap: 9px; color: var(--ink); min-width: 0; }
.brand:focus { outline: none; }
.brand:focus-visible,
.nav-group-head:focus-visible,
.nav-group-body a:focus-visible,
.btn:focus-visible,
.ico-btn:focus-visible,
.nav-search input:focus-visible {
    outline: 2px solid var(--sky);
    outline-offset: 2px;
    border-radius: 10px;
}
.brand-logo {
    width: 40px; height: 40px; border-radius: 50%;
    object-fit: contain; background: transparent;
    border: 0;
    transition: transform .18s var(--ease);
    filter: drop-shadow(0 2px 5px rgba(58, 167, 232, .28));
}
html.theme-dark .brand-logo { filter: drop-shadow(0 2px 6px rgba(0, 0, 0, .55)); }
.brand:hover .brand-logo { transform: rotate(-4deg) scale(1.05); }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; min-width: 0; }
.brand-text b { font-size: 15px; letter-spacing: -.01em; }
.brand-text small { font-size: 9.5px; color: var(--ink-3); letter-spacing: .09em; white-space: nowrap; }

/* desktop mid links */
.nav-mid { display: flex; align-items: center; gap: 2px; margin-left: 10px; flex: 1; min-width: 0; }
.nav-mid a {
    padding: 8px 12px; border-radius: 10px;
    font-size: 13.5px; color: var(--ink-2); white-space: nowrap;
    transition: background .14s var(--ease), color .14s var(--ease);
}
.nav-mid a:hover { background: var(--bg-sky); color: var(--sky-d); }
.nav-mid a.is-active { background: var(--bg-sky); color: var(--sky-d); font-weight: 600; }

/* right cluster */
.nav-right { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.user-chip {
    display: flex; align-items: center; gap: 8px;
    padding: 4px 10px 4px 4px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    transition: border-color .14s var(--ease), background .14s var(--ease);
}
.user-chip:hover { border-color: var(--line-strong); background: var(--bg-soft); }

.avatar {
    width: 32px; height: 32px; border-radius: 50%;
    display: grid; place-items: center;
    background: linear-gradient(140deg, var(--sky-l), var(--sky));
    color: #fff; font-weight: 700; font-size: 13px;
    flex: 0 0 auto;
}
.avatar.is-guest {
    background: var(--bg-sky);
    color: var(--sky-d);
    border: 1px solid var(--line-strong);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: -.02em;
}
.balance { display: flex; flex-direction: column; line-height: 1.05; color: var(--ink); }
.balance small { font-size: 9.5px; color: var(--ink-3); letter-spacing: .03em; }
.balance b { font-size: 13px; color: var(--sky-d); }

.nav-search {
    display: flex; align-items: center;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    overflow: hidden;
    transition: border-color .14s var(--ease), box-shadow .14s var(--ease);
}
.nav-search:focus-within { border-color: var(--sky); box-shadow: 0 0 0 3px rgba(58, 167, 232, .14); }
.nav-search input {
    width: 168px; border: 0; outline: none; background: transparent;
    padding: 8px 4px; font-size: 13px; color: var(--ink); font-family: inherit;
}
.nav-search input::placeholder { color: var(--ink-3); }
.nav-search-btn {
    border: 0; background: transparent; color: var(--ink-3);
    padding: 8px 8px 8px 12px; cursor: pointer; display: grid; place-items: center;
}
.nav-search-btn .gi { width: 16px; height: 16px; }
.nav-search-btn:hover { color: var(--sky-d); }

/* ---------- responsive: phone / tablet ---------- */
@media (max-width: 1080px) {
    .nav-mid { display: none; }
    .nav-search input { width: 132px; }
}
@media (max-width: 820px) {
    .brand-text small { display: none; }
    .balance small { display: none; }
}
/* Compact bar on phones: search collapses to an icon-only pill so it still fits. */
@media (max-width: 620px) {
    .nav-search input { width: 96px; font-size: 12.5px; padding: 7px 2px; }
    .nav-search-btn { padding: 7px 9px 7px 10px; }
    .user-chip { padding: 3px 9px 3px 3px; }
    .avatar { width: 30px; height: 30px; font-size: 12px; }
    .balance b { font-size: 12.5px; }
}
@media (max-width: 520px) {
    .brand-text b { font-size: 14px; }
    .brand-text small { display: none; }
    .nav-inner { gap: 8px; padding: 0 10px; }
}
@media (max-width: 470px) {
    /* Balance stays visible on phones — only the label text drops. */
    .balance small { display: none; }
    .balance b { font-size: 12px; }
    .nav-search input { width: 76px; }
    .nav-search-btn { padding: 7px 8px; }
    .user-chip { gap: 6px; padding: 3px 8px 3px 3px; }
}
@media (max-width: 380px) {
    .nav-search { display: none; }
}

/* ============ drawer ============ */
.scrim {
    position: fixed; inset: 0; z-index: 130;
    background: rgba(14, 26, 36, .42);
    opacity: 0; visibility: hidden;
    transition: opacity .2s var(--ease), visibility .2s var(--ease);
}
.scrim.is-open { opacity: 1; visibility: visible; }

.drawer {
    position: fixed; top: 10px; left: 10px; bottom: 10px; z-index: 140;
    width: 306px; max-width: calc(88vw - 10px);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 22px;
    box-shadow: var(--shadow-lg);
    display: flex; flex-direction: column;
    overflow: hidden;
    transform: translateX(calc(-100% - 14px));
    transition: transform .28s var(--ease), box-shadow .28s var(--ease);
}
.drawer.is-open { box-shadow: 0 28px 70px -30px rgba(22, 35, 46, .55); }
.drawer.is-open { transform: translateX(0); }
.drawer:focus { outline: none; }

.drawer-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 10px; padding: 14px 14px 12px;
    border-bottom: 1px solid var(--line);
    flex: 0 0 auto;
    border-radius: 22px 22px 0 0;
}
.drawer-head .brand-logo { width: 34px; height: 34px; border-radius: 10px; }
.drawer-head .brand-text b { font-size: 14px; }
.drawer-head .brand-text small { font-size: 9px; }

.drawer-head {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--surface);
}
.drawer-body {
    flex: 1 1 auto;
    min-height: 0;
    -webkit-overflow-scrolling: touch;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 12px 10px 18px;
    scrollbar-width: thin;
}
.drawer-body::after {
    content: "";
    display: block;
    height: 6px;
}
.drawer-foot {
    flex: 0 0 auto;
    padding: 12px 12px 14px;
    border-top: 1px solid var(--line);
    display: grid;
    gap: 8px;
    background: var(--surface);
    border-radius: 0 0 22px 22px;
}
.drawer-foot-form { margin: 0; }

/* ---------- groups ---------- */
.nav-group { border-radius: var(--radius); margin-bottom: 6px; overflow: hidden; }
.nav-group-head {
    width: 100%;
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    padding: 11px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--bg-soft);
    color: var(--ink);
    font-family: inherit; font-size: 13.5px; font-weight: 600;
    cursor: pointer; text-align: left;
    transition: background .15s var(--ease), border-color .15s var(--ease);
}
.nav-group-head:hover { background: var(--bg-sky); border-color: var(--line-strong); }
.nav-group-head span { display: flex; align-items: center; gap: 8px; }
.nav-group-head .gi { color: var(--sky-d); width: 17px; height: 17px; }
.nav-group-head:hover .gi { color: var(--sky); }

.chev {
    width: 8px; height: 8px; flex: 0 0 auto;
    border-right: 2px solid var(--ink-3);
    border-bottom: 2px solid var(--ink-3);
    transform: rotate(45deg);
    transition: transform .2s var(--ease);
}
.nav-group.is-collapsed .chev { transform: rotate(-45deg); }

.nav-group-body {
    display: grid; gap: 1px;
    padding: 6px 0 2px;
    overflow: hidden;
    max-height: 460px;
    transition: max-height .24s var(--ease), opacity .2s var(--ease), padding .24s var(--ease);
}
.nav-group.is-collapsed .nav-group-body { max-height: 0; opacity: 0; padding: 0; }

.nav-group-body a {
    display: block;
    padding: 9px 12px 9px 34px;
    border-radius: 9px;
    font-size: 13.5px;
    color: var(--ink-2);
    position: relative;
    transition: background .13s var(--ease), color .13s var(--ease), padding-left .16s var(--ease);
}
.nav-group-body a::before {
    content: ""; position: absolute; left: 18px; top: 50%;
    width: 5px; height: 5px; margin-top: -2.5px;
    border-radius: 50%; background: var(--line-strong);
    transition: background .13s var(--ease), transform .16s var(--ease);
}
.nav-group-body a:hover { background: var(--bg-sky); color: var(--sky-d); padding-left: 38px; }
.nav-group-body a:hover::before { background: var(--sky); transform: scale(1.4); }
.nav-group-body a.is-active { background: var(--bg-sky); color: var(--sky-d); font-weight: 600; }

.nav-group-body .is-disabled {
    display: block; padding: 9px 12px 9px 34px;
    font-size: 12.5px; color: var(--ink-3); cursor: not-allowed;
}

.tag-soon {
    font-style: normal; font-size: 9.5px; font-weight: 700;
    padding: 2px 6px; border-radius: 999px; margin-left: 6px;
    background: #fff8ea; color: #96610e; border: 1px solid #f3dfb8;
}
html.theme-dark .tag-soon { background: #3a2c12; color: #e8bd70; border-color: #5a451f; }

/* ---- nested sub-categories inside "หมวดหมู่สินค้า" ----
   A main category that has children renders its own expander. The child rows are
   indented one more level than a plain drawer link so the hierarchy reads. */
.nav-sub { display: block; }
.nav-sub-head {
    display: flex; align-items: center; justify-content: space-between;
    width: 100%; text-align: left; cursor: pointer;
    padding: 9px 12px 9px 30px; border: 0; background: none;
    border-radius: 9px; font: inherit;
    font-size: 13.5px; color: var(--ink-2);
    transition: background .13s var(--ease), color .13s var(--ease);
}
.nav-sub-head:hover { background: var(--bg-sky); color: var(--sky-d); }
.nav-sub-head .chev { width: 7px; height: 7px; }
.nav-sub.is-collapsed .nav-sub-head .chev { transform: rotate(-45deg); }

.nav-sub-body {
    display: grid; gap: 1px;
    overflow: hidden;
    max-height: 420px;
    transition: max-height .22s var(--ease), opacity .18s var(--ease);
}
.nav-sub.is-collapsed .nav-sub-body { max-height: 0; opacity: 0; }

/* One more indent step than .nav-group-body a (34px), so depth is visible. */
.nav-group-body .nav-sub-body a { padding-left: 50px; font-size: 13px; }
.nav-group-body .nav-sub-body a::before { left: 34px; }
.nav-group-body .nav-sub-body a:hover { padding-left: 54px; }
.nav-group-body .nav-sub-body .nav-sub-all { color: var(--sky-d); font-weight: 600; }

.nav-group-plain { margin-top: 4px; }
.theme-pill {
    font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
    padding: 3px 9px; border-radius: 999px;
    background: var(--bg-sky); color: var(--sky-d); border: 1px solid var(--line-strong);
}
[data-theme-toggle].is-pinged { transform: scale(.97); }

/* ============ press feedback ============ */
.btn, .ico-btn, .nav-group-head, .nav-mid a, .nav-group-body a, .avatar, .user-chip,
.tile, .prod, .card-pad {
    -webkit-tap-highlight-color: transparent;
    transition: transform .12s var(--ease), background-color .15s var(--ease),
                border-color .15s var(--ease), color .15s var(--ease), box-shadow .15s var(--ease);
}
.btn:active, .nav-group-head:active, .nav-mid a:active,
.nav-group-body a:active, .tile:active, .prod:active { transform: scale(.975); }
.user-chip:active, .avatar:active { transform: scale(.94); }

/* ============ generic layout pieces used by pages ============ */
.wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 16px; }
.stack > * + * { margin-top: 16px; }
.row { display: flex; align-items: center; gap: 10px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 900px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) {
    /* Tiles stay two-up on phones: a full-width card per category pushed the
       whole catalogue into a very long scroll. */
    .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
    .grid-4 .tile { padding: 14px; }
    .grid-4 .tile h3 { font-size: 13.5px; }
    .grid-4 .tile p { font-size: 11.5px; }
}
@media (max-width: 360px) {
    .grid-4 { grid-template-columns: minmax(0, 1fr); }
}

/* ============ loader ============ */
#app-loader {
    position: fixed; inset: 0; z-index: 9999;
    background: var(--bg);
    display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 14px;
    transition: opacity .18s var(--ease);
}
#app-loader.is-done { opacity: 0; pointer-events: none; }
.loader-ring {
    width: 38px; height: 38px; border-radius: 50%;
    border: 3px solid var(--bg-sky); border-top-color: var(--sky);
    animation: spin .7s linear infinite;
}
.loader-text { font-size: 12px; color: var(--ink-3); letter-spacing: .08em; font-weight: 600; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============ buttons ============ */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    padding: 9px 16px; border-radius: 11px;
    border: 1px solid var(--line-strong);
    background: var(--surface); color: var(--ink);
    font-size: 13.5px; font-weight: 600; font-family: inherit; cursor: pointer;
}
.btn:hover { background: var(--bg-soft); border-color: var(--sky-l); }
.btn-primary { background: var(--sky); border-color: var(--sky); color: #fff; }
.btn-primary:hover { background: var(--sky-d); border-color: var(--sky-d); color: #fff; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--bg-sky); }
.btn-sm { padding: 6px 12px; font-size: 12.5px; border-radius: 9px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ============ cards / tiles / products ============ */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 18px; }
.card-head { padding: 15px 18px; border-bottom: 1px solid var(--line); font-weight: 700; font-size: 14.5px; }
.card-body { padding: 18px; }

.hero { background: linear-gradient(180deg, var(--bg-sky) 0%, var(--bg) 100%); border-bottom: 1px solid var(--line); padding: 46px 0 40px; }
.hero h1 { margin: 0 0 10px; font-size: 30px; line-height: 1.25; letter-spacing: -.01em; }
.hero p { margin: 0; color: var(--ink-2); max-width: 620px; font-size: 14.5px; }
.hero-actions { margin-top: 20px; display: flex; gap: 10px; flex-wrap: wrap; }

.section { padding: 34px 0; }
.section-head { margin-bottom: 18px; }
.section-head h2 { margin: 0 0 4px; font-size: 20px; letter-spacing: -.01em; }
.section-head p { margin: 0; color: var(--ink-3); font-size: 13px; }

.tile { display: block; padding: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.tile:hover { border-color: var(--sky-l); box-shadow: 0 10px 28px -18px rgba(58, 167, 232, .55); transform: translateY(-1px); }
.tile h3 { margin: 0 0 6px; font-size: 15px; color: var(--ink); }
.tile p { margin: 0; font-size: 12.5px; color: var(--ink-3); }
/* Category art is square with its own background; contain keeps it whole and
   the padding stops the artwork from touching the rounded corners. */
.tile-ico {
    width: 56px; height: 56px; border-radius: 14px;
    background: var(--bg-sky); color: var(--sky-d);
    display: grid; place-items: center;
    font-size: 18px; font-weight: 700;
    margin-bottom: 12px;
    overflow: hidden;
    border: 1px solid var(--line);
}
.tile-ico img {
    width: 100%; height: 100%;
    object-fit: contain;
    border-radius: 13px;
}

.prod { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.prod:hover { border-color: var(--sky-l); box-shadow: 0 12px 30px -20px rgba(58, 167, 232, .6); }
.prod-img { aspect-ratio: 16 / 10; background: var(--bg-sky) center/cover no-repeat; display: grid; place-items: center; color: var(--sky); font-size: 22px; font-weight: 800; }
.prod-body { padding: 13px 14px 15px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.prod-name { font-size: 14px; font-weight: 600; line-height: 1.35; margin: 0; }
.prod-desc { font-size: 12px; color: var(--ink-3); margin: 0; flex: 1; }
.prod-price { font-size: 17px; font-weight: 700; color: var(--sky-d); }
.prod-price small { font-size: 11px; color: var(--ink-3); font-weight: 500; }

/* ============ forms ============ */
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.input, select.input, textarea.input {
    width: 100%; padding: 10px 12px;
    border: 1px solid var(--line-strong); border-radius: var(--radius-s);
    font-size: 14px; font-family: inherit; color: var(--ink); background: var(--surface);
}
.input:focus { outline: none; border-color: var(--sky); box-shadow: 0 0 0 3px rgba(58, 167, 232, .14); }
textarea.input { min-height: 110px; resize: vertical; }
.hint { font-size: 12px; color: var(--ink-3); margin-top: 5px; }

/* ============ alerts ============ */
.alert { padding: 11px 14px; border-radius: var(--radius-s); font-size: 13px; border: 1px solid transparent; }
.alert.ok { background: #eefbf5; border-color: #c4ecd9; color: #0f7a55; }
.alert.bad { background: #fdf0f0; border-color: #f3cccc; color: #b03b38; }
.alert.warn { background: #fff8ea; border-color: #f3dfb8; color: #96610e; }
.alert.info { background: var(--bg-sky); border-color: var(--line-strong); color: #135e8c; }
html.theme-dark .alert.ok { background: #10322a; border-color: #1d5a48; color: #6fdcb2; }
html.theme-dark .alert.bad { background: #361d1d; border-color: #6b3230; color: #f0a3a1; }
html.theme-dark .alert.warn { background: #362b14; border-color: #6b5426; color: #e8bd70; }
html.theme-dark .alert.info { background: #16283a; border-color: #2f4a61; color: #8ecdf0; }

/* ============ table ============ */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th, table.tbl td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.tbl th { background: var(--bg-soft); font-weight: 600; font-size: 12px; color: var(--ink-2); }
table.tbl tr:last-child td { border-bottom: 0; }
table.tbl tbody tr:hover { background: var(--bg-soft); }

.pill { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; border: 1px solid transparent; }
.pill.is-ok { background: #eefbf5; color: #0f7a55; border-color: #c4ecd9; }
.pill.is-info { background: var(--bg-sky); color: #135e8c; border-color: var(--line-strong); }
.pill.is-warn { background: #fff8ea; color: #96610e; border-color: #f3dfb8; }
.pill.is-bad { background: #fdf0f0; color: #b03b38; border-color: #f3cccc; }
.pill.is-mute { background: #f2f5f8; color: var(--ink-3); border-color: var(--line); }

/* ============ footer ============ */
.footer { border-top: 1px solid var(--line); background: var(--bg-soft); padding: 30px 0 22px; margin-top: 40px; font-size: 12.5px; color: var(--ink-3); }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 24px; }
.footer h4 { margin: 0 0 10px; font-size: 12.5px; color: var(--ink); }
.footer a { display: block; padding: 3px 0; color: var(--ink-3); }
.footer a:hover { color: var(--sky-d); }
.footer-bottom { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); text-align: center; font-size: 12px; color: var(--ink-3); }
@media (max-width: 700px) { .footer-grid { grid-template-columns: 1fr; gap: 18px; } }

/* ============ misc ============ */
.muted { color: var(--ink-3); }
.center { text-align: center; }
.pad-y { padding: 28px 0; }
.mt-0 { margin-top: 0; }
.crumb { font-size: 12.5px; color: var(--ink-3); margin-bottom: 12px; }
.crumb a { color: var(--ink-3); }
.crumb a:hover { color: var(--sky-d); }


/* ============ press feedback: ripple + scale ============ */
.rip-host { position: relative; overflow: hidden; }
.rip-host-static { position: relative; }

.rip {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    background: currentColor;
    opacity: 0;
    transform: scale(0);
    transition: transform .52s cubic-bezier(.22, .61, .36, 1), opacity .5s ease-out;
    will-change: transform, opacity;
    z-index: 0;
}
.rip.is-on {
    transform: scale(1);
    opacity: .16;
}
/* keep labels above the ripple */
.rip-host > :not(.rip) { position: relative; z-index: 1; }

/* primary buttons read better with a light ripple */
.btn-primary .rip,
.btn-primary.rip-host > .rip { background: #fff; }
.btn-primary .rip.is-on { opacity: .3; }

/* tactile scale on press, springing back on release */
.btn, .ico-btn, .nav-group-head, .nav-mid a, .nav-group-body a,
.tile, .prod, .qchip, .nav-search-btn {
    transition: transform .13s var(--ease), background-color .15s var(--ease),
                border-color .15s var(--ease), color .15s var(--ease),
                box-shadow .15s var(--ease);
    will-change: transform;
}
.btn:active, .ico-btn:active, .nav-group-head:active, .nav-mid a:active,
.nav-group-body a:active, .tile:active, .prod:active,
.qchip:active, .nav-search-btn:active {
    transform: scale(.965);
}
.avatar:active, .user-chip:active { transform: scale(.94); }

/* respect reduced-motion */
@media (prefers-reduced-motion: reduce) {
    .rip { display: none; }
    .btn:active, .ico-btn:active, .nav-group-head:active, .nav-mid a:active,
    .nav-group-body a:active, .tile:active, .prod:active { transform: none; }
    .drawer { transition: none; }
}

/* ============================================================
   SCROLL PROGRESS — pinned to the very top edge, above the navbar
   ============================================================ */
/* Sits on top of the navbar's own top edge, not in a band of its own: the navbar is
   sticky at top:0, so the bar is pinned to the same edge and painted above it. */
#read-progress {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    z-index: 200;              /* above .nav (120) and .drawer (140) */
    pointer-events: none;
    opacity: 0;
    transition: opacity .22s var(--ease);
}
@media (min-width: 1081px) {
    /* the bar overlays the pill's rounded top, so inset it to match the pill */
    #read-progress { left: 10px; right: 10px; border-radius: 999px; }
}
#read-progress.is-active { opacity: 1; }
#read-progress i {
    display: block;
    height: 100%;
    width: 100%;
    transform: scaleX(0);
    transform-origin: 0 50%;
    background: linear-gradient(90deg, var(--sky-l) 0%, var(--sky) 42%, var(--sky-d) 100%);
    box-shadow: 0 0 10px rgba(58, 167, 232, .6);
    will-change: transform;
}
html.theme-dark #read-progress i {
    background: linear-gradient(90deg, #2b7ba8 0%, var(--sky) 50%, #8ed4ff 100%);
    box-shadow: 0 0 12px rgba(77, 180, 239, .55);
}

/* ============================================================
   MOTION — entrance only.
   .mo-watch = waiting (hidden, sits slightly low)
   .mo-in    = reached (shown, and it stays shown)
   There is no exit class: hiding on scroll-up produced a blank page on fast
   scrolls, when the hide and the reveal landed in the same frame.
   Grid children animate through .mo-inner so the grid item box is never
   transformed — a transform on a grid child collapses track sizing.
   ============================================================ */
/* The revealed state must be `transform: none` + `will-change: auto`. Keeping an
   identity matrix (translateY(0) scale(1)) plus will-change left the element on its own
   compositing layer, and large Thai headings were painted clipped at the layer edge —
   the top half of the glyphs vanished. Plain `none` drops the layer and text renders
   normally. */
.mo-watch {
    opacity: 0;
    transform: translateY(20px);
    will-change: opacity, transform;
}
.mo-watch,
.mo-in {
    transition:
        opacity .5s cubic-bezier(.22, .61, .36, 1),
        transform .56s cubic-bezier(.22, .61, .36, 1);
}
.mo-in {
    opacity: 1;
    transform: none;
    will-change: auto;
}
.mo-watch > .mo-inner {
    opacity: 0;
    transform: translateY(20px);
    will-change: opacity, transform;
}
.mo-in > .mo-inner {
    opacity: 1;
    transform: none;
    will-change: auto;
}

.mo-inner {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    height: 100%;
}
.mo-inner > .tile,
.mo-inner > .prod,
.mo-inner > .card {
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* Cards arrive one after another inside a grid. */
.grid > *:nth-child(1) { transition-delay: 0ms; }
.grid > *:nth-child(2) { transition-delay: 55ms; }
.grid > *:nth-child(3) { transition-delay: 110ms; }
.grid > *:nth-child(4) { transition-delay: 165ms; }
.grid > *:nth-child(5) { transition-delay: 220ms; }
.grid > *:nth-child(6) { transition-delay: 275ms; }
.grid > *:nth-child(7) { transition-delay: 330ms; }
.grid > *:nth-child(8) { transition-delay: 385ms; }

/* ============================================================
   DRAWER — rows fade+slide in one by one when the panel opens
   ============================================================ */
/* Rows start visible; the script opts them into the hidden state. That way a script
   failure leaves the menu usable instead of blank. */
html.js-motion .drawer:not(.is-open) .drawer-rows > * {
    opacity: 0;
    transform: translateX(-14px);
}
html.js-motion .drawer:not(.is-open) .drawer-foot {
    opacity: 0;
    transform: translateY(12px);
}
html.js-motion .drawer.is-open .drawer-rows > *,
html.js-motion .drawer.is-open .drawer-foot {
    opacity: 0;
    transition: opacity .36s cubic-bezier(.22, .61, .36, 1),
                transform .4s cubic-bezier(.22, .61, .36, 1);
}
html.js-motion .drawer.is-open .drawer-rows > * { transform: translateX(-14px); }
html.js-motion .drawer.is-open .drawer-foot { transform: translateY(12px); }
html.js-motion .drawer.is-open .drawer-rows > *.is-in {
    opacity: 1;
    transform: translateX(0);
}
/* The footer slides vertically, not horizontally; it needs its own rule or the
   shared translateX above wins and leaves it at the X offset. */
html.js-motion .drawer.is-open .drawer-foot.is-in {
    opacity: 1;
    transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
    .mo-watch, .mo-in, .mo-watch > .mo-inner, .mo-in > .mo-inner,
    .drawer-rows > *, .drawer-foot {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }
    #read-progress { display: none; }
}

/* ---------- drawer user row + role tags ---------- */
.drawer-user {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 10px; margin-bottom: 4px;
    border-radius: 11px;
    background: var(--bg-sky);
    font-size: 12.5px; font-weight: 600; color: var(--ink);
}
.tag-ceo {
    font-style: normal; font-size: 9.5px; font-weight: 800; letter-spacing: .06em;
    padding: 2px 6px; border-radius: 999px; margin-left: 6px;
    background: #fff3d6; color: #a06f00; border: 1px solid #f0dba8;
}
html.theme-dark .tag-ceo { background: #3a2c12; color: #e8bd70; border-color: #5a451f; }
.avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
