@layer reset, theme, layout, elements;
@layer reset {
  *, *::before, *::after { box-sizing: border-box; }
  html { font-family: Inter, "Segoe UI", system-ui, sans-serif; }
  body { margin: 0; min-width: 300px; }
  a { color: inherit; text-decoration: none; }
  button, input, select, textarea { font: inherit; }
  button { cursor: pointer; }
  h1, h2, h3, p { margin: 0; }
  [hidden] { display: none !important; }
  img { display: block; max-width: 100%; }
}
@layer theme {
  :root { color-scheme: dark; --bg: #0b101a; --rail: #0f1522; --panel: #111a29; --panel2: #151f31;
    --line: #23324a; --text: #edf2fc; --muted: #a2b0c8; --blue: #91b5ff; --focus: #94b8ff; --danger: #ffadb5; --green: #81dab3; }
  body { background: var(--bg); color: var(--text); font-size: .92rem; line-height: 1.55; }
  :focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
  ::selection { background: #34599d; color: #fff; }
  .muted { color: var(--muted); }
  .eyebrow { color: var(--blue); font-size: .7rem; letter-spacing: .13em; font-weight: 750; text-transform: uppercase; }
  h1 { font-size: clamp(1.9rem, 4vw, 2.8rem); letter-spacing: -.055em; line-height: 1.13; }
  h2 { font-size: 1.14rem; letter-spacing: -.02em; line-height: 1.3; }
  h3 { font-size: 1rem; }
}
@layer layout {
  .skip { position: fixed; top: .5rem; left: .5rem; z-index: 12; padding: .55rem 1rem; transform: translateY(-160%); background: #20375f; border-radius: .5rem; }
  .skip:focus { transform: none; }
  .shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
  .rail { position: sticky; top: 0; height: 100dvh; background: var(--rail); border-right: 1px solid var(--line);
    overflow-y: auto; display: flex; flex-direction: column; padding: 1.2rem .85rem; }
  .brand { display: flex; gap: .7rem; align-items: center; margin: .15rem .45rem 1.55rem; }
  .brand img { width: 37px; height: 37px; }
  .brand strong, .brand small { display: block; line-height: 1.35; }
  .brand small { color: var(--muted); margin-top: .18rem; }
  .nav-group { margin-bottom: .95rem; }
  .nav-group .eyebrow { color: var(--muted); margin: 0 .62rem .4rem; font-size: .63rem; }
  .nav-link { display: flex; gap: .65rem; align-items: center; border: 1px solid transparent; border-radius: .55rem; padding: .42rem .6rem; color: var(--muted); font-size: .84rem; }
  .nav-link:hover, .nav-link[aria-current="page"] { color: var(--text); background: #1a2842; border-color: #2b4167; }
  .nav-link[aria-current="page"] .icon { color: var(--blue); }
  .icon { width: 17px; height: 17px; flex-shrink: 0; display: inline-block; vertical-align: middle; }
  .rail-footer { margin-top: auto; padding: .8rem .6rem 0; color: var(--muted); font-size: .73rem; border-top: 1px solid var(--line); }
  .top { height: 65px; display: flex; gap: .8rem; align-items: center; justify-content: space-between; padding: 0 2rem;
    border-bottom: 1px solid var(--line); background: #0e1522; }
  .top-where { color: var(--muted); font-size: .82rem; }
  .top-where strong { color: var(--text); }
  .identity { display: flex; align-items: center; gap: .65rem; font-size: .82rem; }
  .identity img { width: 30px; height: 30px; border-radius: 50%; }
  .identity .button { padding: .27rem .55rem; margin-left: .2rem; }
  .mobile-menu { display: none !important; }
  .content { width: min(100%, 1350px); margin-inline: auto; padding: 1.9rem 2rem 4rem; }
  .heading { display: grid; gap: .5rem; margin-bottom: 1.45rem; }
  .grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr)); gap: 1rem; }
  .workspace { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); gap: 1rem; align-items: start; }
  .stack { display: grid; gap: 1rem; min-width: 0; }
  .row, .actions { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; }
  .row.split { justify-content: space-between; }
  .card { padding: 1.15rem; border: 1px solid var(--line); border-radius: .85rem; background: var(--panel); min-width: 0; }
  .card h2 { margin-bottom: .4rem; }
  .hero { position: relative; isolation: isolate; display: grid; gap: .75rem; border: 1px solid #304773; padding: 1.8rem;
    border-radius: 1rem; background: radial-gradient(ellipse at 88% 3%, #294779, transparent 64%), linear-gradient(120deg, #182641, #101a2c); overflow: hidden; }
  .hero::after { position: absolute; z-index: -1; inset: 0; content: ''; background: repeating-linear-gradient(135deg, transparent 0 36px, #a4beff0b 36px 37px); mask-image: linear-gradient(90deg, transparent 50%, black); }
  .hero p { max-width: 64ch; }
  .metric { display: grid; gap: .35rem; }
  .metric .value { font-size: 1.85rem; letter-spacing: -.05em; font-weight: 750; line-height: 1.2; }
  .metric .label { color: var(--muted); font-size: .8rem; }
  .shortcut { display: grid; gap: .48rem; transition: background .16s ease, border-color .16s ease; }
  .shortcut:hover { border-color: #466597; background: var(--panel2); }
  .shortcut .icon { width: 22px; height: 22px; color: var(--blue); }
  .login { min-height: 100dvh; display: grid; place-items: center; padding: 1rem; background: radial-gradient(ellipse at 60% 8%, #21385f 0, transparent 63%), var(--bg); }
  .signin-card { width: min(100%, 465px); padding: clamp(1.5rem, 6vw, 2.6rem); display: grid; justify-items: start; gap: 1rem; background: var(--rail); border: 1px solid #31486a; border-radius: 1.2rem; box-shadow: 0 20px 65px #0006; }
  @media (max-width: 920px) { .workspace { grid-template-columns: 1fr; } .content { padding-inline: 1.25rem; } .top { padding-inline: 1.25rem; } }
  @media (max-width: 720px) {
    .shell { display: block; }
    .rail { display: none; position: fixed; inset: 57px auto 0 0; width: min(84vw, 270px); height: auto; z-index: 6; box-shadow: 10px 0 40px #0008; }
    .shell[data-menu="true"] .rail { display: flex; }
    .top { position: sticky; top: 0; z-index: 7; height: 57px; }
    .mobile-menu { display: inline-flex !important; }
    .top-where { flex: 1; }
    .identity .name, .crumb-root { display: none; }
    .content { padding: 1.2rem .85rem 3rem; }
    .hero { padding: 1.2rem; }
  }
}
@layer elements {
  .button { display: inline-flex; gap: .42rem; align-items: center; justify-content: center; border: 1px solid #35496b; border-radius: .55rem;
    padding: .47rem .77rem; background: #1a273c; color: var(--text); font-size: .82rem; font-weight: 650; min-height: 32px; }
  .button:hover { background: #263a58; }
  .button.primary { background: #89acfa; border-color: #a4c0ff; color: #0c1a35; }
  .button.primary:hover { background: #aac4ff; }
  .button.danger { border-color: #754656; color: var(--danger); background: #3b2331; }
  button:disabled { cursor: default; opacity: .58; }
  label.field { display: grid; gap: .35rem; font-size: .81rem; font-weight: 650; min-width: 0; }
  .field input:not([type=checkbox]), .field select, .field textarea, input.search {
    background: #0c1422; border: 1px solid #32425e; color: var(--text); border-radius: .52rem; width: 100%; min-width: 0; padding: .55rem .67rem; }
  .field textarea { resize: vertical; }
  .field .code { font: .77rem/1.5 ui-monospace, Consolas, monospace; }
  .form { display: grid; gap: .75rem; }
  .tag { display: inline-flex; align-items: center; gap: .25rem; padding: .19rem .48rem; border: 1px solid #344e77; background: #192b47; color: #b5ccff; border-radius: 20px; font-size: .71rem; white-space: nowrap; }
  .tag.good { border-color: #305848; background: #182d29; color: var(--green); }
  .tag.warn { border-color: #725643; background: #30251f; color: #f5caa1; }
  .section-note { color: var(--muted); font-size: .83rem; }
  .record { display: grid; gap: .55rem; padding-block: .78rem; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
  .record:last-child { padding-bottom: 0; }
  details.record > summary { cursor: pointer; color: #dbe8ff; }
  details.record[open] > summary { margin-bottom: .5rem; }
  .table-scroll { overflow: auto; }
  table { width: 100%; border-collapse: collapse; text-align: left; font-size: .83rem; }
  th, td { padding: .6rem .5rem; border-bottom: 1px solid var(--line); vertical-align: top; overflow-wrap: anywhere; }
  th { color: var(--muted); font-size: .73rem; font-weight: 650; }
  code { color: #c0d5ff; overflow-wrap: anywhere; }
  .preview { border: 1px solid #303849; border-left: 4px solid #3275c7; border-radius: .65rem; padding: .85rem; background: #20222b; overflow: hidden; }
  .preview img { border-radius: .4rem; width: 100%; }
  .preview .thumbnail { width: 52px; height: 52px; object-fit: cover; margin-left: auto; }
  .preview .copy { white-space: pre-wrap; overflow-wrap: anywhere; }
  .preview .blocks { display: grid; gap: .65rem; }
  .preview hr { border: 0; border-top: 1px solid #434959; width: 100%; margin: .1rem 0; }
  .tabs { display: flex; flex-wrap: wrap; gap: .45rem; }
  .tabs button[aria-pressed="true"] { border-color: #789ded; color: #c8dcff; }
  .error { color: var(--danger); background: #33202b; border: 1px solid #71414e; border-radius: .6rem; padding: .65rem .8rem; }
  #notice { position: fixed; z-index: 10; right: 1rem; bottom: 1rem; max-width: min(440px, calc(100vw - 2rem)); background: #1e3251; border: 1px solid #4669a0; border-radius: .65rem; padding: .65rem .9rem; box-shadow: 0 8px 28px #0006; }
  dialog { color: var(--text); background: var(--panel); border: 1px solid #42577e; border-radius: .85rem; width: min(calc(100% - 2rem), 465px); padding: 1.2rem; }
  dialog::backdrop { background: #050910bb; }
  @media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; } }
}
