:root {
  color-scheme: light;
  --bg: #f6f9ff;
  --surface: #ffffff;
  --surface-soft: #edf4ff;
  --line: rgba(32, 82, 150, .14);
  --line-strong: rgba(32, 82, 150, .22);
  --text: #172033;
  --muted: #5b6b82;
  --subtle: #8190a5;
  --primary: #1b66d2;
  --primary-dark: #0b3f92;
  --primary-soft: #dceaff;
  --shadow: 0 20px 56px rgba(24, 65, 124, .12);
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--text);
  background: linear-gradient(135deg, #f9fbff, #eef5ff 58%, #e4efff);
}

a { color: inherit; }

.shell {
  width: min(1180px, calc(100vw - 28px));
  margin: 20px auto;
  padding: 22px;
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
  padding: 22px;
  border: 1px solid var(--line-strong);
  border-radius: 26px;
  background: rgba(255,255,255,.88);
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .12em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(30px, 5vw, 54px);
  line-height: .95;
  letter-spacing: -.055em;
}

.subtitle {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 15px;
}

.count-box {
  min-width: 132px;
  padding: 15px 18px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface-soft);
  text-align: right;
}

.count-box strong {
  display: block;
  color: var(--primary-dark);
  font-size: 42px;
  line-height: .9;
  letter-spacing: -.06em;
}

.count-box span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.toolbar {
  position: sticky;
  top: 10px;
  z-index: 5;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255,255,255,.94);
  box-shadow: 0 14px 34px rgba(24,65,124,.10);
  backdrop-filter: blur(12px);
}

.chip {
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font: 800 13px/1 var(--font);
  cursor: pointer;
}

.chip.active,
.chip:hover {
  border-color: transparent;
  background: var(--primary);
  color: #fff;
}

.dashboard-list {
  display: grid;
  gap: 8px;
}

.dashboard-row.hidden { display: none; }

.dashboard-link {
  display: grid;
  grid-template-columns: 64px minmax(220px, .7fr) minmax(260px, 1fr) 72px;
  gap: 14px;
  align-items: center;
  min-height: 66px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255,255,255,.94);
  box-shadow: 0 10px 26px rgba(24,65,124,.07);
  text-decoration: none;
  transition: transform .14s ease, border-color .14s ease, box-shadow .14s ease;
}

.dashboard-link:hover {
  transform: translateY(-1px);
  border-color: rgba(27,102,210,.36);
  box-shadow: 0 16px 34px rgba(24,65,124,.12);
}

.code {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 38px;
  border-radius: 13px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-size: 13px;
  font-weight: 950;
  letter-spacing: -.02em;
}

.name {
  font-size: 17px;
  font-weight: 900;
  letter-spacing: -.025em;
}

.desc {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
}

.open {
  justify-self: end;
  padding: 9px 12px;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-size: 13px;
  font-weight: 900;
}

.footer-note {
  margin-top: 14px;
  padding: 14px 4px;
  color: var(--subtle);
  font-size: 13px;
  text-align: center;
}

@media (max-width: 820px) {
  .shell { width: calc(100vw - 16px); margin: 8px auto; padding: 10px; }
  .topbar { align-items: start; flex-direction: column; padding: 18px; border-radius: 22px; }
  .count-box { width: 100%; text-align: left; }
  .dashboard-link {
    grid-template-columns: 50px minmax(0, 1fr) 58px;
    gap: 10px;
    min-height: 72px;
  }
  .desc {
    grid-column: 2 / -1;
    margin-top: -6px;
  }
  .open { grid-column: 3; grid-row: 1; }
}

@media (max-width: 520px) {
  .toolbar { position: static; }
  .dashboard-link { grid-template-columns: 46px minmax(0, 1fr); }
  .open { display: none; }
  .desc { grid-column: 2; }
}

.directory { margin-top: 36px; }
.directory-heading { padding: 22px 24px; background: var(--surface); border: 1px solid var(--line); border-radius: 22px; }
.directory-heading h2 { margin: 0; font-size: clamp(26px, 4vw, 38px); letter-spacing: -.04em; }
.directory-controls { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 8px 14px; padding: 18px 0 4px; }
.directory-controls label { font-weight: 800; font-size: 13px; }
.directory-controls label[for="directory-category"] { grid-column: 2; grid-row: 1; }
.directory-controls input, .directory-controls select { min-width: 0; width: 100%; padding: 12px; background: white; color: var(--text); border: 1px solid var(--line-strong); border-radius: 12px; font: inherit; }
.directory-controls input:focus-visible, .directory-controls select:focus-visible, .directory-card a:focus-visible { outline: 3px solid var(--primary); outline-offset: 3px; }
#directory-count { color: var(--muted); font-size: 14px; }
#directory-empty { background: white; padding: 24px; border-radius: 16px; }
.directory-group { margin-top: 26px; }
.directory-group h3 { font-size: 18px; margin: 0 0 12px; color: var(--primary-dark); }
.directory-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 12px; }
.directory-card a { display: flex; flex-direction: column; gap: 10px; height: 100%; padding: 18px; border: 1px solid var(--line); border-radius: 16px; background: white; box-shadow: 0 6px 16px rgba(24,65,124,.06); text-decoration: none; overflow-wrap: anywhere; }
.directory-card a:hover { border-color: var(--primary); box-shadow: 0 10px 24px rgba(24,65,124,.12); }
.directory-card-title { font-weight: 850; letter-spacing: -.02em; }
.directory-card-desc { color: var(--muted); font-size: 14px; line-height: 1.5; }
.directory-open { margin-top: auto; padding-top: 6px; color: var(--primary-dark); font-size: 13px; font-weight: 800; }
@media (max-width: 520px) {
  .directory-controls { grid-template-columns: minmax(0, 1fr); }
  .directory-controls label[for="directory-category"] { grid-column: auto; grid-row: auto; }
}
