  :root {
    --sidebar-w: 232px;
    --bg: #f3efe8;
    --surface: #fffcf7;
    --sidebar: #f7f3ec;
    --ink: #1c1915;
    --muted: #7a736a;
    --line: #e4ddd3;
    --line-strong: #d4cdc2;
    --accent: #b44a26;
    --accent-hover: #9a3d1e;
    --accent-soft: #f6e6dc;
    --ok: #3d6b4f;
    --ok-soft: #e4efe7;
    --warn: #9a6b24;
    --warn-soft: #f6edd8;
    --danger: #b42318;
    --danger-soft: #f8e4e1;
    --shadow: 0 1px 0 rgba(28, 25, 21, 0.04), 0 12px 28px rgba(28, 25, 21, 0.05);
    --radius: 8px;
    --font: "Noto Sans JP", "Hiragino Sans", sans-serif;
    --serif: "Instrument Serif", "Noto Serif JP", serif;
  }

  * { box-sizing: border-box; }
  html, body { height: 100%; }
  body {
    margin: 0;
    font-family: var(--font);
    color: var(--ink);
    background:
      radial-gradient(900px 420px at 100% -10%, #efe4d6 0%, transparent 55%),
      var(--bg);
    letter-spacing: 0.01em;
  }

  .app {
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
    min-height: 100vh;
  }

  .sidebar {
    background: var(--sidebar);
    border-right: 1px solid var(--line);
    padding: 28px 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    position: sticky;
    top: 0;
    height: 100vh;
  }
  .brand {
    padding: 0 10px 24px;
    margin-bottom: 8px;
    border-bottom: 1px solid var(--line);
  }
  .brand-kicker {
    margin: 0;
    font-size: 0.68rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--accent);
    font-weight: 500;
  }
  .brand-title {
    margin: 8px 0 0;
    font-family: var(--serif);
    font-size: 1.55rem;
    font-weight: 400;
    letter-spacing: -0.02em;
    color: var(--ink);
  }
  .nav-group-label {
    margin: 18px 10px 8px;
    font-size: 0.68rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: #a39b91;
  }
  .nav-btn {
    width: 100%;
    border: 0;
    background: transparent;
    color: #5c564e;
    text-align: left;
    padding: 9px 10px;
    border-radius: 6px;
    font: inherit;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
  }
  .nav-btn:hover { background: rgba(28, 25, 21, 0.04); color: var(--ink); }
  .nav-btn.active {
    background: var(--surface);
    color: var(--ink);
    box-shadow: inset 0 0 0 1px var(--line-strong);
  }
  .nav-btn.disabled { opacity: 0.42; cursor: not-allowed; }
  .nav-icon {
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: currentColor;
  }
  .nav-icon svg { width: 16px; height: 16px; display: block; }
  .nav-badge {
    margin-left: auto;
    font-size: 0.64rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #a39b91;
  }
  .sidebar-foot {
    margin-top: auto;
    padding: 16px 10px 4px;
    border-top: 1px solid var(--line);
    font-size: 0.75rem;
    color: var(--muted);
    line-height: 1.6;
  }

  .main { padding: 36px 40px 56px; min-width: 0; }
  .topbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 16px;
    margin-bottom: 28px;
    flex-wrap: wrap;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--line);
  }
  .page-title {
    margin: 0;
    font-family: var(--serif);
    font-size: 2rem;
    font-weight: 400;
    letter-spacing: -0.03em;
    line-height: 1.15;
  }
  .page-desc { margin: 8px 0 0; color: var(--muted); font-size: 0.92rem; }
  .status-chips { display: flex; flex-wrap: wrap; gap: 6px; }
  .chip {
    font-size: 0.72rem;
    padding: 5px 9px;
    border-radius: 4px;
    background: transparent;
    border: 1px solid var(--line-strong);
    color: var(--muted);
  }
  .chip.ok { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
  .chip.warn { background: var(--warn-soft); border-color: transparent; color: var(--warn); }

  .stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 22px;
  }
  .stat {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px 18px 14px;
  }
  .stat-label {
    font-size: 0.7rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
    margin: 0 0 10px;
  }
  .stat-value {
    font-family: var(--serif);
    font-size: 1.85rem;
    font-weight: 400;
    margin: 0;
    letter-spacing: -0.03em;
    line-height: 1;
  }
  .stat-sub { font-size: 0.75rem; color: var(--muted); margin: 8px 0 0; }

  .view { display: none; }
  .view.active { display: block; }

  .panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 22px 22px 20px;
    margin-bottom: 14px;
  }
  .panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
    flex-wrap: wrap;
  }
  .panel-head h2 {
    margin: 0;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--muted);
  }

  .form-grid {
    display: grid;
    grid-template-columns: 1fr 96px;
    gap: 12px;
    align-items: end;
  }
  .field { display: flex; flex-direction: column; gap: 6px; }
  .field.full { grid-column: 1 / -1; }
  .label { font-size: 0.78rem; font-weight: 600; color: #4a453e; }
  .hint { margin: 12px 0 0; font-size: 0.8rem; color: var(--muted); line-height: 1.6; }

  input[type="text"], input[type="number"], textarea, select {
    width: 100%;
    border: 1px solid var(--line-strong);
    border-radius: 6px;
    padding: 10px 12px;
    font: inherit;
    background: #fff;
    color: var(--ink);
  }
  input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(180, 74, 38, 0.12);
  }

  .actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
  .btn {
    border: 0;
    border-radius: 6px;
    padding: 10px 16px;
    font: inherit;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
  }
  .btn:disabled { opacity: 0.5; cursor: not-allowed; }
  .btn-primary { background: var(--ink); color: #f7f3ec; }
  .btn-primary:hover { background: #2a2622; }
  .btn-success { background: var(--accent); color: #fff; }
  .btn-success:hover { background: var(--accent-hover); }
  .btn-ghost {
    background: transparent;
    color: var(--ink);
    border: 1px solid var(--line-strong);
  }
  .btn-ghost:hover { background: rgba(28, 25, 21, 0.03); }

  .toolbar { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
  .filter-btn {
    border: 1px solid transparent;
    background: transparent;
    color: var(--muted);
    border-radius: 4px;
    padding: 6px 10px;
    font: inherit;
    font-size: 0.8rem;
    cursor: pointer;
  }
  .filter-btn.active {
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 600;
  }

  .cards { display: grid; gap: 10px; }
  .card {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px 18px;
    background: #fff;
  }
  .card:hover { border-color: var(--line-strong); }
  .card-top {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
    margin-bottom: 10px;
  }
  .card-title {
    margin: 0;
    font-size: 1.02rem;
    font-weight: 600;
    line-height: 1.4;
  }
  .card-url {
    margin: 5px 0 0;
    font-size: 0.78rem;
    color: var(--muted);
    word-break: break-all;
  }
  .badge {
    flex-shrink: 0;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    padding: 4px 8px;
    border-radius: 4px;
    white-space: nowrap;
  }
  .badge-ok { background: var(--ok-soft); color: var(--ok); }
  .badge-ng { background: var(--danger-soft); color: var(--danger); }
  .badge-warn { background: var(--warn-soft); color: var(--warn); }
  .badge-muted { background: #efeae3; color: #5c564e; }

  .meta-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 16px;
    margin: 12px 0 4px;
  }
  .meta-item-label {
    font-size: 0.68rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 3px;
  }
  .meta-item-value { font-size: 0.88rem; word-break: break-word; }

  .score-bar {
    height: 3px;
    background: #ece6dc;
    border-radius: 99px;
    overflow: hidden;
    margin-top: 6px;
  }
  .score-bar > span {
    display: block;
    height: 100%;
    background: var(--accent);
  }

  .body-pre {
    white-space: pre-wrap;
    font: inherit;
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 12px;
    margin-top: 10px;
    max-height: 220px;
    overflow: auto;
    font-size: 0.86rem;
    line-height: 1.7;
  }
  details summary {
    cursor: pointer;
    color: var(--accent);
    font-size: 0.84rem;
    font-weight: 600;
  }

  .empty {
    text-align: left;
    padding: 28px 8px 8px;
    color: var(--muted);
  }
  .empty-icon { display: none; }
  .empty-title {
    margin: 0 0 6px;
    font-family: var(--serif);
    font-size: 1.35rem;
    color: var(--ink);
    font-weight: 400;
  }

  .placeholder-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
  .placeholder-card {
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius);
    padding: 18px;
    background: transparent;
  }
  .placeholder-card h3 { margin: 0 0 6px; font-size: 0.92rem; }
  .placeholder-card p { margin: 0; font-size: 0.8rem; color: var(--muted); line-height: 1.6; }

  .toast-wrap {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
  }
  .toast {
    min-width: 240px;
    max-width: 360px;
    background: var(--ink);
    color: #f7f3ec;
    padding: 12px 14px;
    border-radius: 6px;
    font-size: 0.84rem;
    box-shadow: var(--shadow);
  }
  .toast.ok { background: #2f4a3a; }
  .toast.err { background: #7a241c; }

  .loading {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--muted);
    font-size: 0.88rem;
    padding: 8px 0;
  }
  .spinner {
    width: 14px; height: 14px;
    border: 1.5px solid var(--line-strong);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
  }
  @keyframes spin { to { transform: rotate(360deg); } }

  .error { color: var(--danger); }
  code {
    font-size: 0.82em;
    background: var(--bg);
    padding: 1px 5px;
    border-radius: 3px;
    border: 1px solid var(--line);
  }

  @media (max-width: 960px) {
    .app { grid-template-columns: 1fr; }
    .sidebar {
      position: static;
      height: auto;
      flex-direction: row;
      flex-wrap: wrap;
      padding: 14px;
    }
    .brand { width: 100%; padding-bottom: 12px; margin-bottom: 0; }
    .nav-group-label, .sidebar-foot { display: none; }
    .nav-btn { width: auto; flex: 1 1 auto; }
    .main { padding: 20px 16px 40px; }
    .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .form-grid { grid-template-columns: 1fr; }
    .meta-grid, .placeholder-grid { grid-template-columns: 1fr; }
    .page-title { font-size: 1.6rem; }
  }
