:root {
    color-scheme: light;
    --background: #f3f6f7;
    --surface: #fff;
    --ink: #122321;
    --muted: #506660;
    --line: #dce6e2;
    --accent: #126450;
    --accent-dark: #0c4d3e;
    --tint: #e6f5ee;
    --sidebar: #102b28;
    --sidebar-text: #d0e3dc;
    --shadow: 0 9px 30px #102b2808;
    --radius: 16px;
    font: 16px/1.55 Aptos, system-ui, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--background); color: var(--ink); }
a { color: var(--accent-dark); text-underline-offset: .18em; }
a:hover { color: var(--accent); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { line-height: 1.15; letter-spacing: -.035em; }
h1 { font-size: clamp(1.9rem, 4vw, 2.85rem); font-weight: 740; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }
p { margin-block: .65rem 1rem; color: var(--muted); }
:focus-visible { outline: 3px solid #00a57b; outline-offset: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip-link { position: absolute; top: 8px; left: 8px; background: white; z-index: 4; padding: .5rem 1rem; transform: translateY(-150%); }
.skip-link:focus { transform: none; }
.workspace { min-height: 100vh; display: grid; grid-template-columns: 218px minmax(0, 1fr); }
.sidebar { background: var(--sidebar); color: white; padding: 1.4rem .9rem; display: flex; flex-direction: column; gap: 1.4rem; position: sticky; top: 0; height: 100vh; overflow: auto; }
.brand { display: inline-flex; align-items: center; gap: .65rem; padding: .35rem .6rem; color: inherit; text-decoration: none; font-size: 1.16rem; font-weight: 760; white-space: nowrap; }
.brand:hover { color: inherit; }
.brand > span > span { font-weight: 480; }
.brand-mark { width: 24px; height: 24px; border-radius: 7px; background: #abe9cc; position: relative; display: grid; place-items: center; flex: none; }
.brand-mark::after { content: ""; width: 11px; height: 11px; border: 2px solid var(--sidebar); border-bottom: 0; border-right: 0; transform: translateY(2px) rotate(45deg); }
.nav, .sidebar-bottom { display: grid; gap: .3rem; }
.nav a, .sidebar-bottom a, .sidebar-bottom button { display: block; color: var(--sidebar-text); border: 0; border-radius: 8px; text-decoration: none; background: none; padding: .55rem .7rem; text-align: left; font-size: .93rem; white-space: nowrap; }
.nav a:hover, .sidebar-bottom a:hover, .sidebar-bottom button:hover { background: #ffffff0e; color: white; }
.nav a[aria-current] { color: #e8fff6; background: #ffffff20; font-weight: 670; }
.sidebar-bottom { margin-top: auto; border-top: 1px solid #ffffff2b; padding-top: .7rem; }
.main { min-width: 0; }
.topbar { min-height: 64px; border-bottom: 1px solid var(--line); background: var(--surface); display: flex; justify-content: space-between; align-items: center; padding: .85rem clamp(1rem, 4vw, 3.4rem); gap: 1rem; font-size: .88rem; color: var(--muted); }
.account-link, .label-pair { display: inline-flex; align-items: center; gap: .5rem; text-decoration: none; }
.avatar { width: 32px; height: 32px; display: inline-grid; place-items: center; border-radius: 50%; color: var(--accent-dark); background: var(--tint); font-weight: 700; text-transform: uppercase; flex: none; }
.content { padding: clamp(1rem, 4vw, 3.4rem); max-width: 1400px; margin: auto; }
.page-heading { margin-bottom: 1.65rem; }
.page-heading p { margin: .45rem 0 0; }
.panel { min-width: 0; padding: clamp(1rem, 2.6vw, 1.65rem); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel + .panel { margin-top: 1rem; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); align-items: stretch; gap: 1rem; }
.dashboard-grid > .panel { margin-top: 0; }
.hero { background: linear-gradient(145deg, #113a32, #185644); border-color: #185644; color: white; }
.hero h2 { font-size: clamp(1.55rem, 3vw, 2.18rem); margin-top: .85rem; }
.hero p { color: #d9eee6; }
.hero .button { background: #b9f1d8; color: #102e26; }
.hero .button:hover { background: #daffed; }
.status-pill, .tag { display: inline-block; padding: .19rem .56rem; border-radius: 100px; color: var(--accent-dark); background: var(--tint); font-size: .8rem; font-weight: 700; }
.metric { font-size: 2.6rem; letter-spacing: -.065em; line-height: 1.05; margin-top: .7rem; font-weight: 750; }
.button, .button-secondary { border-radius: 8px; padding: .56rem .88rem; display: inline-flex; gap: .45rem; align-items: center; justify-content: center; border: 1px solid transparent; text-decoration: none; font-weight: 650; font-size: .92rem; line-height: 1.5; }
.button { background: var(--accent); color: #fff; }
.button:hover { background: var(--accent-dark); color: white; }
.button-secondary { color: var(--accent-dark); background: white; border-color: #aecbc0; }
.button-secondary:hover { color: var(--accent-dark); background: var(--tint); }
button:disabled { cursor: default; opacity: .55; }
.form-stack { display: grid; gap: .85rem; max-width: 570px; }
.form-stack > button { justify-self: start; }
label:not(.check) { display: grid; gap: .35rem; font-weight: 600; font-size: .92rem; }
input:not([type=checkbox], [type=radio]), select, textarea { min-width: 0; width: 100%; background: #fff; border: 1px solid #b5c9c3; border-radius: 8px; padding: .59rem .68rem; color: var(--ink); }
.check { display: inline-flex; align-items: center; gap: .4rem; font-size: .93rem; }
.actions, .input-row, .list-row { display: flex; gap: .65rem; flex-wrap: wrap; align-items: center; }
.grow { flex: 1; min-width: 10rem; }
.list-row { justify-content: space-between; padding-block: .78rem; border-bottom: 1px solid var(--line); }
.list-row:last-child { border-bottom: 0; }
.notice { background: var(--tint); color: var(--accent-dark); border: 1px solid #c4ded4; border-radius: 9px; padding: .65rem .9rem; margin-bottom: 1rem; }
.notice-error { color: #852c29; border-color: #ebc3ba; background: #fff0ed; }
.notice ul { margin: 0; padding-left: 1.1rem; }
.placement-context { display: flex; gap: .5rem 1rem; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.empty { border-radius: 8px; background: var(--background); padding: .72rem; }
.muted, small, time { color: var(--muted); }
.narrow { max-width: 620px; }
.tree-panel { min-height: 335px; }
.breadcrumbs { display: flex; gap: .48rem; flex-wrap: wrap; color: var(--muted); font-size: .9rem; }
.tree-diagram { max-width: 630px; margin: 1.75rem auto .5rem; }
.tree-node { text-align: center; background: white; border: 1px solid var(--line); padding: .9rem; border-radius: 12px; min-width: 0; overflow-wrap: anywhere; }
.tree-node .avatar { margin-bottom: .45rem; }
.tree-node .button-secondary, .tree-node form { margin-top: .65rem; }
.parent-node { max-width: 260px; margin: auto; border-color: #afd1c1; position: relative; }
.parent-node::after { content: ""; position: absolute; top: 100%; height: 21px; border-left: 2px solid #b9d0c7; left: 50%; }
.tree-legs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .9rem; position: relative; padding-top: 37px; }
.tree-legs::before { content: ""; position: absolute; width: 50%; left: 25%; top: 21px; height: 16px; border: 2px solid #b9d0c7; border-bottom: 0; }
.open-node { background: #f8fcfa; border: 1px dashed #96b8aa; }
.leg-label { display: block; color: var(--muted); font-size: .85rem; font-weight: 760; margin-bottom: .55rem; }
.guest { min-height: 100vh; background: radial-gradient(ellipse at 70% 0%, #d4eadf, var(--background) 56%); }
.guest-brand { color: var(--sidebar); padding: 1rem clamp(1rem, 4vw, 3rem); }
.auth-main { padding: clamp(1rem, 6vw, 3rem) 1rem; }
.auth-content { max-width: 460px; margin: auto; }
.auth-card { padding: clamp(1.2rem, 4vw, 2rem); }
.auth-card h1 { font-size: 1.9rem; }
.small-link { display: inline-block; margin-top: 1rem; font-size: .93rem; }
.auth-qr svg { max-width: 170px; height: auto; background: white; }
.recovery-codes { columns: 2; max-width: 420px; }
.pagination ul { display: flex; flex-wrap: wrap; list-style: none; gap: 1rem; padding: 0; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: .65rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
summary { cursor: pointer; }
@media (max-width: 820px) {
    .workspace { display: block; }
    .sidebar { position: relative; height: auto; padding: .65rem .85rem; gap: .42rem; }
    .nav, .sidebar-bottom { display: flex; flex-wrap: wrap; }
    .sidebar-bottom { padding: .2rem 0 0; }
    .nav a, .sidebar-bottom a, .sidebar-bottom button { padding: .42rem .52rem; }
    .topbar { min-height: 47px; padding-block: .48rem; }
}
@media (max-width: 580px) {
    .dashboard-grid { grid-template-columns: minmax(0, 1fr); }
    .tree-diagram { margin-top: 1rem; }
    .tree-legs { grid-template-columns: minmax(0, 1fr); padding-top: .9rem; gap: .65rem; }
    .tree-legs::before, .parent-node::after { display: none; }
    .tree-node { padding: .7rem; }
    .topbar { font-size: .78rem; }
}
