:root {
  color-scheme: light;
  --bg: #f7f8fc;
  --surface: #ffffff;
  --surface-soft: #f1f5f9;
  --ink: #171923;
  --muted: #657084;
  --subtle: #8b95a7;
  --line: #e5e9f0;
  --blue: #4f7cff;
  --cyan: #20b7d5;
  --green: #21a67a;
  --orange: #f59e3d;
  --rose: #ef6f87;
  --violet: #7c6cf0;
  --shadow-soft: 0 14px 42px rgba(31, 42, 68, 0.08);
  --shadow-card: 0 10px 28px rgba(31, 42, 68, 0.09);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  scroll-behavior: smooth;
}

body {
  min-height: 100%;
  margin: 0;
  background:
    linear-gradient(180deg, rgba(245, 247, 252, 0.72), rgba(247, 248, 252, 1) 360px),
    repeating-linear-gradient(90deg, rgba(79, 124, 255, 0.035) 0 1px, transparent 1px 96px),
    var(--bg);
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.page-shell {
  display: grid;
  grid-template-columns: 276px minmax(0, 1fr);
  min-height: 100vh;
}

.side-rail {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px 18px;
  background: rgba(255, 255, 255, 0.82);
  border-right: 1px solid rgba(229, 233, 240, 0.92);
  backdrop-filter: blur(18px);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 54px;
  color: inherit;
  text-decoration: none;
}

.brand-logo {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #171923;
  color: #fff;
  font-size: 14px;
  font-weight: 900;
  box-shadow: inset 0 -10px 22px rgba(79, 124, 255, 0.36);
}

.brand-copy strong {
  display: block;
  font-size: 18px;
  line-height: 1.2;
}

.brand-copy small {
  display: block;
  margin-top: 4px;
  color: var(--subtle);
  font-size: 12px;
}

.rail-search,
.hero-search {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: 0 8px 24px rgba(31, 42, 68, 0.05);
}

.rail-search {
  min-height: 44px;
  border-radius: 14px;
  padding: 0 12px;
}

.rail-search svg,
.hero-search svg {
  color: var(--subtle);
  flex: 0 0 auto;
}

.rail-search input,
.hero-search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
}

.rail-nav {
  display: grid;
  gap: 6px;
  overflow: auto;
  padding-right: 2px;
}

.nav-button {
  min-height: 42px;
  border: 0;
  border-radius: 12px;
  padding: 0 10px;
  background: transparent;
  color: var(--muted);
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  text-align: left;
}

.nav-button:hover,
.nav-button.active {
  background: #eef3ff;
  color: #2f56ca;
}

.nav-button.active {
  font-weight: 800;
}

.nav-icon {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 13px;
  font-weight: 900;
}

.nav-count {
  color: var(--subtle);
  font-size: 12px;
}

.rail-footer {
  margin-top: auto;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.rail-footer span:first-child {
  color: var(--blue);
  font-size: 18px;
  font-weight: 900;
}

.main-stage {
  width: min(1180px, calc(100vw - 276px));
  margin: 0 auto;
  padding: 40px 34px 64px;
}

.hero {
  padding: 28px 0 22px;
}

.hero-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  padding: 0 12px;
  border: 1px solid #cfe8df;
  border-radius: 999px;
  background: #effaf6;
  color: #16725b;
  font-size: 13px;
  font-weight: 800;
}

.account-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.top-action {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--muted);
  padding: 0 14px;
  font-weight: 800;
}

.top-action:hover {
  color: #2f56ca;
  border-color: #b7c7ff;
}

.top-action.primary {
  background: #171923;
  color: #fff;
  border-color: #171923;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--green);
  box-shadow: 0 0 0 5px rgba(33, 166, 122, 0.12);
}

.hero h1 {
  margin: 22px 0 10px;
  font-size: clamp(38px, 5vw, 72px);
  line-height: 1.02;
  letter-spacing: 0;
}

.hero p {
  margin: 0 0 24px;
  color: var(--muted);
  font-size: 18px;
}

.hero-search {
  width: min(720px, 100%);
  min-height: 58px;
  border-radius: 18px;
  padding: 0 14px 0 18px;
}

.hero-search:focus-within,
.rail-search:focus-within,
.field input:focus,
.field select:focus,
.field textarea:focus,
.client-textarea:focus {
  border-color: #b7c7ff;
  box-shadow: 0 0 0 4px rgba(79, 124, 255, 0.12);
}

.hero-search input {
  font-size: 16px;
}

#clearSearch,
.drawer-close {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}

#clearSearch:hover,
.drawer-close:hover {
  background: #e8eef8;
  color: var(--ink);
}

.category-strip {
  display: flex;
  gap: 10px;
  overflow: auto;
  padding: 8px 0 24px;
}

.chip {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--muted);
  padding: 0 15px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.chip:hover,
.chip.active {
  border-color: #b7c7ff;
  background: #eef3ff;
  color: #2f56ca;
}

.chip.active {
  font-weight: 800;
}

.content-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin: 8px 0 18px;
}

.content-head h2 {
  margin: 0 0 5px;
  font-size: 26px;
}

.content-head p {
  margin: 0;
  color: var(--muted);
}

.compact-toggle {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  padding: 0 14px;
  white-space: nowrap;
}

.compact-toggle.active {
  color: #2f56ca;
  background: #eef3ff;
  border-color: #b7c7ff;
  font-weight: 800;
}

.tool-sections {
  display: grid;
  gap: 28px;
}

.tool-section {
  display: grid;
  gap: 12px;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-size: 18px;
}

.section-title .nav-icon {
  width: 34px;
  height: 34px;
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 12px;
}

.tool-card {
  min-height: 126px;
  border: 1px solid rgba(229, 233, 240, 0.92);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 1px 0 rgba(31, 42, 68, 0.04);
  padding: 15px;
  text-align: left;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 13px;
  align-items: start;
  color: inherit;
}

.tool-card:hover,
.tool-card.active {
  transform: translateY(-2px);
  box-shadow: var(--shadow-card);
  border-color: #cad6ff;
}

.tool-card.planned {
  opacity: 0.58;
}

.tool-card.compact {
  min-height: 74px;
  padding: 12px;
}

.tool-card.compact .tool-desc,
.tool-card.compact .tool-tags {
  display: none;
}

.tool-icon {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 15px;
  font-weight: 900;
  box-shadow: inset 0 -10px 20px rgba(0, 0, 0, 0.12);
}

.tool-copy {
  min-width: 0;
  display: grid;
  gap: 7px;
}

.tool-title {
  margin: 0;
  font-size: 16px;
  line-height: 1.35;
}

.tool-desc {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.tool-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.tag {
  min-height: 23px;
  border-radius: 999px;
  padding: 3px 8px;
  display: inline-flex;
  align-items: center;
  color: var(--muted);
  background: var(--surface-soft);
  font-size: 12px;
}

.tag.server {
  color: #16725b;
  background: #e8f8f1;
}

.tag.client {
  color: #a26216;
  background: #fff2dc;
}

.tag.planned {
  color: #687386;
  background: #edf0f4;
}

.empty-list {
  min-height: 220px;
  border: 1px dashed var(--line);
  border-radius: 18px;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.66);
}

.drawer-backdrop,
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(15, 23, 42, 0.26);
  backdrop-filter: blur(4px);
}

.tool-drawer {
  position: fixed;
  z-index: 21;
  top: 18px;
  right: 18px;
  bottom: 18px;
  width: min(470px, calc(100vw - 36px));
  border: 1px solid rgba(229, 233, 240, 0.98);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.24);
  padding: 22px;
  overflow: auto;
}

.modal {
  position: fixed;
  z-index: 22;
  top: 50%;
  left: 50%;
  width: min(760px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  transform: translate(-50%, -50%);
  border: 1px solid rgba(229, 233, 240, 0.98);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.24);
  padding: 22px;
  overflow: auto;
}

.drawer-close {
  position: absolute;
  top: 16px;
  right: 16px;
}

.drawer-title {
  padding-right: 44px;
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 13px;
  align-items: center;
  margin-bottom: 20px;
}

.drawer-title h2 {
  margin: 0 0 5px;
  font-size: 24px;
}

.drawer-title p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.tool-form,
.client-panel {
  display: grid;
  gap: 14px;
}

.dropzone {
  position: relative;
  min-height: 150px;
  border: 1.5px dashed #cbd5e1;
  border-radius: 20px;
  background: #f8fbff;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 7px;
  text-align: center;
  padding: 22px;
  color: var(--muted);
}

.dropzone:hover,
.dropzone.dragging {
  border-color: var(--blue);
  background: #f1f5ff;
}

.dropzone input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.dropzone svg {
  width: 32px;
  height: 32px;
  color: var(--blue);
}

.dropzone strong {
  color: var(--ink);
}

.file-hint {
  max-width: 100%;
  display: block;
  color: var(--muted);
  font-size: 13px;
  word-break: break-word;
}

.field-grid {
  display: grid;
  gap: 12px;
}

.field {
  display: grid;
  gap: 7px;
}

.field label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.field input,
.field select,
.field textarea,
.client-textarea,
.client-output {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

.field input,
.field select {
  min-height: 42px;
  padding: 0 12px;
}

.field textarea,
.client-textarea {
  min-height: 150px;
  padding: 12px;
  resize: vertical;
}

.primary-button,
.secondary-button {
  min-height: 44px;
  border-radius: 14px;
  border: 1px solid transparent;
  padding: 0 15px;
  font-weight: 900;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.primary-button {
  width: 100%;
  background: #171923;
  color: #fff;
}

.primary-button:hover {
  background: #26304a;
}

.primary-button:disabled,
.secondary-button:disabled,
.mini-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.secondary-button {
  background: #fff;
  border-color: var(--line);
  color: var(--ink);
}

.secondary-button:hover {
  border-color: #b7c7ff;
  color: #2f56ca;
}

.button-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.result-box {
  margin-top: 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  padding: 13px;
  color: var(--muted);
  background: #f8fafc;
  word-break: break-word;
}

.result-box.good {
  color: #16725b;
  background: #effaf6;
  border-color: #cfe8df;
}

.result-box.bad {
  color: #b23f3c;
  background: #fff1f1;
  border-color: #f3c5c2;
}

.download-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  margin-top: 10px;
  padding: 0 12px;
  border-radius: 12px;
  background: var(--green);
  color: #fff;
  text-decoration: none;
  font-weight: 900;
}

.client-output {
  min-height: 170px;
  padding: 12px;
  background: #f8fafc;
  white-space: pre-wrap;
  overflow: auto;
}

.auth-grid,
.plans-grid,
.admin-grid {
  display: grid;
  gap: 14px;
}

.auth-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.auth-tabs button,
.mini-button {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--muted);
  padding: 0 12px;
  font-weight: 800;
}

.auth-tabs button.active,
.mini-button.active {
  background: #eef3ff;
  border-color: #b7c7ff;
  color: #2f56ca;
}

.account-card,
.plan-card,
.admin-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  padding: 16px;
  overflow-x: auto;
}

.account-card h3,
.plan-card h3,
.admin-card h3 {
  margin: 0 0 8px;
}

.plan-price {
  font-size: 28px;
  font-weight: 900;
  margin: 10px 0;
}

.plan-card ul {
  margin: 10px 0 14px;
  padding-left: 18px;
  color: var(--muted);
}

.form-row {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.form-row label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.form-row input,
.form-row select,
.form-row textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 9px 12px;
  outline: none;
}

.form-row textarea {
  min-height: 86px;
  resize: vertical;
}

.admin-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}

.stat-tile {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #f8fafc;
  padding: 12px;
}

.stat-tile strong {
  display: block;
  font-size: 24px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 720px;
}

.data-table th,
.data-table td {
  border-bottom: 1px solid var(--line);
  padding: 9px 6px;
  text-align: left;
  vertical-align: top;
}

.data-table th {
  color: var(--muted);
  font-weight: 900;
}

.data-table input,
.data-table select {
  width: 100%;
  min-width: 96px;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0 8px;
  background: #fff;
  color: var(--ink);
}

.check-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.check-row input {
  width: auto;
  min-width: 0;
}

.admin-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 14px 0;
}

.notice {
  border: 1px solid #d8e3ff;
  border-radius: 14px;
  background: #f1f5ff;
  color: #405386;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.5;
}

@media (max-width: 1080px) {
  .page-shell {
    grid-template-columns: 1fr;
  }

  .side-rail {
    position: relative;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .rail-nav {
    display: flex;
    overflow: auto;
  }

  .nav-button {
    grid-template-columns: 30px auto auto;
    white-space: nowrap;
  }

  .main-stage {
    width: min(1180px, 100%);
    padding: 30px 22px 56px;
  }
}

@media (max-width: 680px) {
  .side-rail {
    padding: 16px;
  }

  .brand-copy small {
    display: none;
  }

  .main-stage {
    padding: 22px 16px 44px;
  }

  .hero {
    padding-top: 12px;
  }

  .hero p {
    font-size: 16px;
  }

  .content-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .tool-grid {
    grid-template-columns: 1fr;
  }

  .tool-drawer {
    inset: 0;
    width: auto;
    border-radius: 0;
  }
}
