@font-face {
  font-family: 'MioK2';
  src: url('fonts/LilitaOne-Regular.ttf') format('truetype');
  font-weight: 100 900;
  unicode-range: U+0000-024F, U+2000-206F, U+20A0-20CF;
  font-display: swap;
}
@font-face {
  font-family: 'MioK2';
  src: url('fonts/Pusia-Bold.otf') format('opentype');
  font-weight: 100 900;
  unicode-range: U+0400-052F;
  font-display: swap;
}

:root {
  --font: 'MioK2', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --md-ref-typeface-brand: var(--font);
  --md-ref-typeface-plain: var(--font);

  --md-sys-color-primary: #ff5470;
  --md-sys-color-on-primary: #fff;
  --md-sys-color-surface: #0b0c16;
  --md-sys-color-surface-container: #12131f;
  --md-sys-color-surface-container-high: #1a1b2a;
  --md-sys-color-surface-container-highest: #232436;
  --md-sys-color-on-surface: #fff;
  --md-sys-color-on-surface-variant: #a19eae;
  --md-sys-color-outline: #6f6c80;
  --md-sys-color-outline-variant: rgba(255, 255, 255, .15);
  --md-sys-color-error: #ff4d4d;
  --md-sys-color-inverse-surface: #e6e6f0;
  --md-sys-color-inverse-on-surface: #111;
  --md-sys-color-secondary-container: color-mix(in srgb, var(--md-sys-color-primary) 28%, var(--md-sys-color-surface));
  --md-sys-color-on-secondary-container: var(--md-sys-color-on-surface);

  --ok: #3ddc84;
  --warn: #ffc83d;
  --bad: #ff4d4d;

  --bar-h: 64px;
  --radius: 20px;
  color-scheme: dark;

  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
:root[data-theme="light"],
#login {
  --md-sys-color-surface: #eef0f6;
  --md-sys-color-surface-container: #fff;
  --md-sys-color-surface-container-high: #f6f7fb;
  --md-sys-color-surface-container-highest: #e8eaf2;
  --md-sys-color-on-surface: #111;
  --md-sys-color-on-surface-variant: #6a687a;
  --md-sys-color-outline: #8b899b;
  --md-sys-color-outline-variant: rgba(0, 0, 0, .14);
  --md-sys-color-inverse-surface: #2b2b36;
  --md-sys-color-inverse-on-surface: #fff;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
:where(body, h1, h2, h3, h4, p, hr, table, button, input) { margin: 0; padding: 0; }
html { height: 100%; scroll-padding-top: env(safe-area-inset-top, 0px); }
body {
  min-height: 100%;
  background: var(--md-sys-color-surface);
  color: var(--md-sys-color-on-surface);
  font-family: var(--font);
  font-size: 16px;
  letter-spacing: .02em;
  font-synthesis: none;
  overflow-x: clip;
}
body::before {
  content: "";
  position: fixed;
  inset: 0 0 auto;
  height: env(safe-area-inset-top, 0px);
  background: var(--md-sys-color-surface-container);
  z-index: 30;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--md-sys-color-primary); outline-offset: 2px; }
[hidden] { display: none !important; }
hr { border: 0; height: 1px; background: var(--md-sys-color-outline-variant); margin: 12px 8px; }

.top {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 20;
  height: var(--bar-h);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  background: var(--md-sys-color-surface-container);
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
}
.brand {
  display: flex;
  justify-content: center;
  margin-bottom: 6px;
}
.brand img {
  display: block;
  height: 100px; 
  width: auto;
  max-width: 100%;
}

.top-start, .top-end { display: flex; align-items: center; gap: 8px; min-width: 0; }
.top-end { justify-content: flex-end; }

.logo img { display: block; height: 40px; width: auto; user-select: none; -webkit-user-drag: none; }
.logo .fallback { font-size: 20px; white-space: nowrap; }

#menuBtn .tab-name {
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 13px;
  background: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-on-surface-variant);
}
#sBtn, #sClose, #menuBtnMobile { display: none; }

.search-wrap { display: flex; align-items: center; gap: 8px; flex: 1; max-width: 360px; min-width: 0; }
.search { position: relative; flex: 1; min-width: 0; }
.search md-outlined-text-field {
  width: 100%;
  --md-outlined-text-field-container-shape: 28px;
  --md-outlined-text-field-top-space: 8px;
  --md-outlined-text-field-bottom-space: 8px;
}

.menu-wrap { position: relative; }
.drop {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 260px;
  padding: 14px;
  background: var(--md-sys-color-surface-container-high);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: 24px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .35);
  z-index: 40;
}
.search .drop { left: 0; right: 0; min-width: 0; padding: 8px; }
.drop h4 { font-weight: 400; font-size: 13px; margin: 2px 6px 8px; color: var(--md-sys-color-on-surface-variant); }
.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; padding: 10px 12px; border-radius: 14px; text-align: left; }
button.row:hover { background: var(--md-sys-color-surface-container-highest); }
.danger { color: #ff4747; }

.seg { display: flex; gap: 4px; padding: 4px; margin-bottom: 8px; border-radius: 999px; background: var(--md-sys-color-surface-container-highest); }
.seg button { flex: 1; height: 34px; border-radius: 999px; color: var(--md-sys-color-on-surface-variant); }
.seg button[aria-pressed="true"] { background: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-secondary-container); }

.swatches { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 2px 6px 14px; }
.swatches button { width: 28px; height: 28px; border-radius: 50%; border: 2px solid transparent; background: var(--c); box-shadow: inset 0 0 0 2px var(--md-sys-color-surface-container-high); }
.swatches button[aria-pressed="true"] { border-color: var(--md-sys-color-on-surface); }
.swatches input { width: 28px; height: 28px; padding: 0; border: 0; border-radius: 50%; background: none; cursor: pointer; }

.tag { font-size: 12px; padding: 3px 9px; border-radius: 999px; background: var(--md-sys-color-surface-container-highest); color: var(--md-sys-color-on-surface-variant); }
.who { display: flex; gap: 12px; align-items: center; padding: 6px 6px 12px; margin-bottom: 8px; border-bottom: 1px solid var(--md-sys-color-outline-variant); }
.who small { display: block; font-size: 14px; color: var(--md-sys-color-on-surface-variant); }
.avatar { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; font-size: 20px; background: var(--md-sys-color-primary); color: var(--md-sys-color-on-primary); }

.shell { display: flex; min-height: calc(100dvh - var(--bar-h)); }
.side {
  position: sticky;
  top: calc(var(--bar-h) + env(safe-area-inset-top, 0px));
  width: 260px;
  flex: none;
  height: calc(100dvh - var(--bar-h) - env(safe-area-inset-top, 0px));
  overflow-y: auto;
  padding: 18px 14px;
  background: var(--md-sys-color-surface-container);
  border-right: 1px solid var(--md-sys-color-outline-variant);
  transition: margin .2s;
}
.side.closed { margin-left: -260px; }
.group h3 { font-weight: 400; font-size: 14px; padding: 4px 12px 8px; color: var(--md-sys-color-on-surface-variant); }
.nav { display: block; width: 100%; padding: 11px 14px; border-radius: 999px; text-align: left; }
.nav:hover { background: var(--md-sys-color-surface-container-highest); }
.nav[aria-current="page"] { background: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-secondary-container); }
.scrim { display: none; position: fixed; inset: 0; top: calc(var(--bar-h) + env(safe-area-inset-top, 0px)); background: rgba(0, 0, 0, .5); z-index: 24; }

main { flex: 1; min-width: 0; padding: 28px clamp(16px, 3vw, 40px) 60px; }
.crumb { font-size: 14px; margin-bottom: 6px; color: var(--md-sys-color-on-surface-variant); }
h1 { font-weight: 400; font-size: clamp(26px, 4vw, 38px); margin-bottom: 6px; }
.desc { max-width: 70ch; margin-bottom: 24px; line-height: 1.4; color: var(--md-sys-color-on-surface-variant); }

.card {
  padding: 20px;
  background: var(--md-sys-color-surface-container);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--radius);
}
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 16px; }
.big { font-size: 34px; margin-top: 6px; }
.lbl { font-size: 14px; color: var(--md-sys-color-on-surface-variant); }
.dot { display: inline-block; width: 10px; height: 10px; margin-right: 8px; border-radius: 50%; background: var(--ok); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }
.log { font-family: ui-monospace, Menlo, monospace; font-size: 13px; line-height: 1.8; letter-spacing: 0; color: var(--md-sys-color-on-surface-variant); }
.note { margin-top: 14px; font-size: 13px; color: var(--md-sys-color-on-surface-variant); }
.empty { text-align: center; padding: 44px 16px; color: var(--md-sys-color-on-surface-variant); }
.empty b { display: block; margin-bottom: 6px; font-weight: 400; font-size: 20px; color: var(--md-sys-color-on-surface); }
.mb { margin-bottom: 16px; }

md-linear-progress {
  width: 100%;
  margin-top: 12px;
  --md-linear-progress-track-height: 8px;
  --md-linear-progress-active-indicator-height: 8px;
  --md-linear-progress-track-shape: 4px;
  --md-linear-progress-active-indicator-shape: 4px;
}
.tools { margin-bottom: 16px; }
.tools md-outlined-text-field { min-width: 260px; --md-outlined-text-field-container-shape: 28px; }

.table-scroll { overflow-x: auto; border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; background: var(--md-sys-color-surface-container); border: 1px solid var(--md-sys-color-outline-variant); }
th, td { padding: 13px 16px; text-align: left; white-space: nowrap; }
th { font-weight: 400; font-size: 14px; color: var(--md-sys-color-on-surface-variant); border-bottom: 1px solid var(--md-sys-color-outline-variant); }
td { border-bottom: 1px solid var(--md-sys-color-outline-variant); }
tr:last-child td { border: 0; }
tbody tr:hover { background: var(--md-sys-color-surface-container-high); }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 80;
  padding: 12px 20px; border-radius: 12px;
  background: var(--md-sys-color-inverse-surface); color: var(--md-sys-color-inverse-on-surface);
}

#login {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center; padding: 16px;
  background: var(--md-sys-color-surface);
  color: var(--md-sys-color-on-surface);
  --md-sys-color-primary: #111;
  --md-sys-color-on-primary: #fff;
}
#login .card { width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 12px; padding: 28px; }
.brand { font-size: 28px; margin-bottom: 6px; }
.brand i { font-style: normal; color: var(--md-sys-color-primary); }
.err { min-height: 18px; font-size: 14px; color: var(--md-sys-color-error); }

@media (max-width: 1100px) {
  #menuBtn .tab-name { display: none; }
}

@media (max-width: 900px) {
  :root { --bar-h: 56px; --radius: 16px; }
  body { font-size: 14px; }
  h1 { font-size: 24px; }
  main { padding: 18px 14px 48px; }
  .card { padding: 14px; }
  .grid { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 10px; }
  .big { font-size: 24px; }
  .nav { padding: 9px 14px; }
  th, td { padding: 10px 12px; }

  md-filled-button, md-outlined-button, md-text-button {
    --md-filled-button-container-height: 34px;
    --md-outlined-button-container-height: 34px;
    --md-text-button-container-height: 34px;
    --md-filled-button-label-text-size: 14px;
    --md-outlined-button-label-text-size: 14px;
    --md-text-button-label-text-size: 14px;
    --md-filled-button-leading-space: 16px;
    --md-filled-button-trailing-space: 16px;
    --md-outlined-button-leading-space: 14px;
    --md-outlined-button-trailing-space: 14px;
  }
  md-icon-button {
    --md-icon-button-state-layer-height: 44px;
    --md-icon-button-state-layer-width: 44px;
    --md-icon-button-icon-size: 26px;
  }
  md-filled-tonal-icon-button {
    --md-filled-tonal-icon-button-container-height: 44px;
    --md-filled-tonal-icon-button-container-width: 44px;
    --md-filled-tonal-icon-button-icon-size: 26px;
  }
  md-outlined-text-field { --md-outlined-text-field-input-text-size: 14px; }
  #menuBtn { display: none; }
  #menuBtnMobile { display: inline-flex; }

  .side { position: fixed; left: 0; z-index: 25; width: min(280px, 86vw); }
  .side.closed { margin-left: calc(-1 * min(280px, 86vw) - 2px); }
  body.nav-open .scrim { display: block; }

  .top { padding: 0 10px; gap: 6px; }
  .top-start { gap: 4px; }
  .top-end { gap: 4px; }
  #menuBtn .label { display: none; }
  .top #sBtn { display: inline-flex; }
  .search-wrap { display: none; }
  .top.search-open .search-wrap {
    display: flex; position: absolute; inset: 0; max-width: none; padding: 0 8px; z-index: 6;
    background: var(--md-sys-color-surface-container);
  }
  .top.search-open #sClose { display: inline-flex; }
  .logo img { height: 34px; }
  .menu-wrap .drop { position: fixed; top: calc(var(--bar-h) + env(safe-area-inset-top, 0px) + 4px); right: 8px; width: min(300px, calc(100vw - 16px)); }
}
@media (max-width: 380px) {
  .top { padding: 0 6px; gap: 2px; }
  .logo img { height: 26px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
