  :root {
    --bg: #1c1c1c;
    --bg-elevated: #222222;
    --card: #262626;
    --card-2: #2c2c2c;
    --ink: #f3f4f6;
    --muted: #9ca3af;
    --line: #333333;
    --accent: #55d6a3;
    --accent-ink: #0b1f17;
    --orange: #fb923c;
    --blue: #60a5fa;
    --radius: 14px;
    --radius-sm: 10px;
    --shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
  }

  * {
    box-sizing: border-box;
  }

  body {
    margin: 0;
    min-height: 100vh;
    font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    background: var(--bg);
    color: var(--ink);
  }

  a {
    color: var(--accent);
    text-decoration: none;
  }

  a:hover {
    text-decoration: underline;
  }

  .topnav {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem 1.5rem;
    background: rgba(28, 28, 28, 0.92);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(10px);
  }

  .brand {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    color: var(--ink);
    font-weight: 700;
    font-size: 1.15rem;
    text-decoration: none;
  }

  .brand:hover {
    text-decoration: none;
    color: var(--ink);
  }

  .brand-mark {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    background: linear-gradient(145deg, var(--accent), #2f9f78);
    color: var(--accent-ink);
    font-weight: 800;
    font-size: 0.85rem;
  }

  .nav-links {
    display: flex;
    gap: 1.25rem;
    align-items: center;
    color: var(--muted);
    font-size: 0.95rem;
  }

  .nav-links a {
    color: var(--muted);
    font-weight: 600;
  }

  .nav-links a.active,
  .nav-links a:hover {
    color: var(--ink);
    text-decoration: none;
  }

  .shell {
    max-width: 1280px;
    margin: 0 auto;
    padding: 1.25rem 1.25rem 3rem;
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 1.1rem;
    align-items: start;
  }

  .shell.detail {
    grid-template-columns: 260px minmax(0, 1fr);
  }

  .card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
  }

  .panel {
    padding: 1rem;
  }

  .profile {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 1rem;
  }

  .avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: #1a3d31;
    color: var(--accent);
    font-weight: 700;
    border: 2px solid #2a5a48;
  }

  .profile h2 {
    margin: 0;
    font-size: 1rem;
  }

  .profile p {
    margin: 0.15rem 0 0;
    color: var(--muted);
    font-size: 0.85rem;
  }

  .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    width: 100%;
    border-radius: 999px;
    padding: 0.7rem 1rem;
    font-weight: 700;
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
  }

  .btn:hover {
    text-decoration: none;
  }

  .btn-primary {
    background: var(--accent);
    color: var(--accent-ink);
  }

  .btn-primary:hover {
    filter: brightness(1.05);
    color: var(--accent-ink);
  }

  .btn-secondary {
    background: transparent;
    color: var(--ink);
    border-color: #3a3a3a;
    margin-top: 0.6rem;
  }

  .btn-secondary:hover {
    background: var(--card-2);
    color: var(--ink);
  }

  .btn-row {
    margin: 0.25rem 0 1rem;
  }

  .section-title {
    margin: 0 0 0.75rem;
    font-size: 0.95rem;
    font-weight: 700;
  }

  .stat-tabs {
    display: flex;
    gap: 0.35rem;
    margin-bottom: 0.85rem;
  }

  .stat-tab {
    flex: 1;
    text-align: center;
    padding: 0.45rem 0.35rem;
    border-radius: 999px;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 700;
    background: transparent;
  }

  .stat-tab.active {
    background: #1f1f1f;
    color: var(--ink);
    border: 1px solid var(--line);
  }

  .stat-list {
    display: grid;
    gap: 0.55rem;
  }

  .stat-row {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    font-size: 0.9rem;
  }

  .stat-row span {
    color: var(--muted);
  }

  .stat-row strong {
    font-variant-numeric: tabular-nums;
  }

  .stat-row strong.accent {
    color: var(--accent);
  }

  .stat-row strong.orange {
    color: var(--orange);
  }

  .stat-row strong.blue {
    color: var(--blue);
  }

  .feed-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.9rem;
  }

  .toggle {
    display: inline-flex;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 0.2rem;
  }

  .toggle span {
    padding: 0.45rem 0.95rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--muted);
  }

  .toggle span.active {
    background: #323232;
    color: var(--ink);
  }

  .feed {
    display: grid;
    gap: 1rem;
  }

  .activity {
    padding: 1.05rem 1.15rem 1.15rem;
  }

  .activity-top {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.7rem;
  }

  .activity-user {
    display: flex;
    gap: 0.7rem;
    align-items: center;
    margin-bottom: 10px;
  }

  .activity-user .meta {
    color: var(--muted);
    font-size: 0.82rem;
  }

  .badges {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
  }

  .badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    border-radius: 999px;
    padding: 0.22rem 0.55rem;
    font-size: 0.72rem;
    font-weight: 700;
    background: #1f1f1f;
    border: 1px solid var(--line);
    color: var(--muted);
  }

  .badge.mint {
    color: var(--accent);
    border-color: #2f5b4a;
    background: #1a2d26;
  }

  .badge.blue {
    color: var(--blue);
    border-color: #2a4a6d;
    background: #1a2635;
  }

  .activity h3 {
    margin: 0 0 0.85rem;
    font-size: 1.35rem;
    letter-spacing: -0.02em;
  }

  .metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
  }

  .metric span {
    display: block;
    color: var(--muted);
    font-size: 0.75rem;
    margin-bottom: 0.2rem;
  }

  .metric strong {
    font-size: 1.05rem;
    font-variant-numeric: tabular-nums;
  }

  .metric strong.orange {
    color: var(--orange);
  }

  .metric strong.blue {
    color: var(--blue);
  }

  .metric strong.mint {
    color: var(--accent);
  }

  .activity .actions {
    display: flex;
    gap: 0.55rem;
    flex-wrap: wrap;
    align-items: center;
    margin-top: 40px;
  }

  .activity .actions .copy-json {
    margin-left: auto;
  }

  .chip-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    margin: 0;
    border-radius: 999px;
    padding: 0.45rem 0.85rem;
    min-height: 2.15rem;
    font-size: 0.82rem;
    font-weight: 700;
    line-height: 1.2;
    border: 1px solid var(--line);
    background: #1d1d1d;
    color: var(--ink);
    text-decoration: none;
    cursor: pointer;
    font-family: inherit;
    appearance: none;
    -webkit-appearance: none;
  }

  .chip-btn:hover {
    background: #2a2a2a;
    text-decoration: none;
    color: var(--ink);
  }

  .chip-btn.primary {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--accent-ink);
  }

  .chip-btn.primary:hover {
    filter: brightness(1.05);
    color: var(--accent-ink);
  }

  .chip-btn:disabled,
  .chip-btn.primary:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    filter: none;
  }

  .chip-btn:disabled:hover,
  .chip-btn.primary:disabled:hover {
    background: #1d1d1d;
    color: var(--ink);
    filter: none;
  }

  .chip-btn.primary:disabled:hover {
    background: var(--accent);
    color: var(--accent-ink);
  }

  .empty {
    padding: 2.5rem 1.25rem;
    text-align: center;
    color: var(--muted);
  }

  .empty-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 0.85rem;
    border-radius: 50%;
    display: grid;
    place-items: center;
    border: 2px solid var(--line);
    color: var(--muted);
    font-size: 1.4rem;
  }

  .help p {
    margin: 0.35rem 0 0;
    color: var(--muted);
    font-size: 0.9rem;
    line-height: 1.45;
  }

  .detail-hero {
    padding: 1.2rem;
    margin-bottom: 1rem;
  }

  .detail-hero h1 {
    margin: 0.35rem 0 0.85rem;
    font-size: clamp(1.5rem, 3vw, 2rem);
    letter-spacing: -0.02em;
  }

  .scoreboard {
    display: inline-flex;
    align-items: baseline;
    gap: 0.55rem;
    background: #1f1f1f;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 0.45rem 0.9rem;
    margin-bottom: 1rem;
  }

  .scoreboard strong {
    font-size: 1.25rem;
    color: var(--accent);
  }

  .meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.75rem;
  }

  .meta-item span {
    display: block;
    color: var(--muted);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.2rem;
  }

  table {
    width: 100%;
    border-collapse: collapse;
  }

  th,
  td {
    text-align: left;
    padding: 0.8rem 0.95rem;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
  }

  th {
    color: var(--muted);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: #222;
  }

  tr:last-child td {
    border-bottom: 0;
  }

  tr:hover td {
    background: rgba(85, 214, 163, 0.04);
  }

  .block-title {
    margin: 0 0 0.75rem;
    font-size: 0.95rem;
  }

  .table-wrap {
    overflow: auto;
  }

  .edit-form {
    display: grid;
    gap: 0.75rem;
    margin-top: 0.85rem;
  }

  .edit-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
  }

  .field label {
    display: block;
    color: var(--muted);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.3rem;
  }

  .field input {
    width: 100%;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: #1a1a1a;
    color: var(--ink);
    padding: 0.55rem 0.7rem;
    font: inherit;
  }

  .field input:focus {
    outline: 1px solid var(--accent);
    border-color: var(--accent);
  }

  input.digits-only {
    -moz-appearance: textfield;
    appearance: textfield;
  }

  input.digits-only::-webkit-outer-spin-button,
  input.digits-only::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
  }

  .field.full {
    grid-column: 1 / -1;
  }

  .form-actions {
    display: flex;
    gap: 0.55rem;
    flex-wrap: wrap;
    align-items: center;
  }

  .status-msg {
    color: var(--muted);
    font-size: 0.85rem;
    min-height: 1.2em;
  }

  .status-msg.error {
    color: #f87171;
  }

  .status-msg.ok {
    color: var(--accent);
  }

  .note-edit {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 110px auto auto;
    gap: 0.5rem;
    align-items: center;
  }

  .note-edit input {
    width: 100%;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: #1a1a1a;
    color: var(--ink);
    padding: 0.45rem 0.6rem;
    font: inherit;
  }

  .btn-danger {
    background: transparent;
    color: #f87171;
    border: 1px solid #5a2a2a;
  }

  .btn-danger:hover {
    background: #2a1515;
    color: #fca5a5;
  }

  .api-key-hint {
    margin: 0.35rem 0 0;
    color: var(--muted);
    font-size: 0.8rem;
    line-height: 1.4;
  }

  @media (max-width: 700px) {

    .edit-grid,
    .note-edit {
      grid-template-columns: 1fr;
    }
  }

  @media (max-width: 1100px) {

    .shell,
    .shell.detail {
      grid-template-columns: 1fr;
    }
  }

  @media (max-width: 700px) {
    .topnav {
      padding: 0.75rem 1rem;
    }

    .nav-links {
      display: none;
    }

    .metrics {
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    table.responsive,
    table.responsive thead,
    table.responsive tbody,
    table.responsive th,
    table.responsive td,
    table.responsive tr {
      display: block;
    }

    table.responsive thead {
      display: none;
    }

    table.responsive tr {
      border-bottom: 1px solid var(--line);
      padding: 0.65rem 0;
    }

    table.responsive td {
      border: 0;
      padding: 0.2rem 0.95rem;
    }

    table.responsive td::before {
      content: attr(data-label);
      display: block;
      color: var(--muted);
      font-size: 0.7rem;
      text-transform: uppercase;
      letter-spacing: 0.05em;
      margin-bottom: 0.1rem;
    }
  }
