:root {
    --bg: #f5f7fb;
    --card: #ffffff;
    --text: #1f2937;
    --muted: #6b7280;
    --line: #e5e7eb;
    --primary: #2563eb;
    --primary-soft: #e8f0ff;
    --danger: #dc2626;
    --danger-soft: #fee2e2;
    --warning: #d97706;
    --warning-soft: #fef3c7;
    --success: #15803d;
    --success-soft: #dcfce7;
    --neutral-soft: #f3f4f6;
}

* { box-sizing: border-box; }
body { margin: 0; font-family: Arial, sans-serif; background: var(--bg); color: var(--text); }
a { color: inherit; text-decoration: none; }
.layout { display: flex; min-height: 100vh; }
.sidebar { width: 280px; background: #111827; color: #fff; padding: 22px; position: fixed; top: 0; bottom: 0; overflow-y: auto; }
.main { margin-left: 280px; padding: 28px; width: calc(100% - 280px); }
.brand { display: flex; gap: 12px; align-items: center; margin-bottom: 26px; }
.brand__mark { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 14px; background: var(--primary); font-weight: 700; }
.brand__title { font-weight: 700; font-size: 18px; }
.brand__sub { color: #9ca3af; font-size: 12px; margin-top: 3px; }
.nav { display: grid; gap: 6px; margin-bottom: 24px; }
.nav a, .project-switch { display: block; padding: 10px 12px; border-radius: 10px; color: #d1d5db; }
.nav a:hover, .project-switch:hover, .project-switch.active { background: rgba(255,255,255,.08); color: #fff; }
.sidebar__label { color: #9ca3af; font-size: 12px; text-transform: uppercase; margin: 16px 0 8px; letter-spacing: .06em; }

.header { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; margin-bottom: 22px; }
.kicker { color: var(--primary); font-weight: 700; font-size: 13px; margin-bottom: 6px; }
h1 { margin: 0; font-size: 30px; }
.subtitle { color: var(--muted); margin-top: 8px; line-height: 1.5; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 18px; box-shadow: 0 10px 30px rgba(15,23,42,.04); }
.card h2, .card h3 { margin-top: 0; }
.metric { font-size: 30px; font-weight: 800; margin-top: 8px; }
.metric-label { color: var(--muted); font-size: 13px; }
.badge { display: inline-flex; padding: 5px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.badge-danger { color: var(--danger); background: var(--danger-soft); }
.badge-warning { color: var(--warning); background: var(--warning-soft); }
.badge-success { color: var(--success); background: var(--success-soft); }
.badge-neutral { color: var(--muted); background: var(--neutral-soft); }
.table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 18px; overflow: hidden; border: 1px solid var(--line); }
.table th, .table td { padding: 13px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.table th { background: #f9fafb; color: var(--muted); font-size: 13px; }
.table tr:last-child td { border-bottom: 0; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }
.btn { display: inline-flex; padding: 10px 14px; border-radius: 10px; background: var(--primary); color: #fff; font-weight: 700; }
.btn-soft { background: var(--primary-soft); color: var(--primary); }
.progress { height: 10px; border-radius: 999px; background: #eef2f7; overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--primary); }
.funnel { display: grid; gap: 12px; }
.funnel__item { display: grid; grid-template-columns: 180px 1fr 220px; gap: 14px; align-items: center; }
.notice { border-left: 4px solid var(--primary); background: var(--primary-soft); padding: 14px 16px; border-radius: 14px; line-height: 1.55; }
.priority { font-weight: 800; color: var(--primary); }
.small { color: var(--muted); font-size: 13px; }
@media (max-width: 1000px) {
    .sidebar { position: static; width: 100%; }
    .layout { display: block; }
    .main { margin-left: 0; width: 100%; }
    .grid-2, .grid-3, .grid-4, .grid-5 { grid-template-columns: 1fr; }
    .funnel__item { grid-template-columns: 1fr; }
}
.audit-card h2 { font-size: 34px; margin: 8px 0 10px; }
.audit-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 14px 0; }
.audit-stats div { background: #f9fafb; border: 1px solid var(--line); border-radius: 12px; padding: 10px; }
.audit-stats b { display: block; font-size: 22px; }
.audit-stats span { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.btn-small { padding: 7px 10px; font-size: 12px; border-radius: 8px; }
.checklist-table td:first-child { min-width: 260px; }
.mt { margin-top: 16px; }
.link-strong { color: var(--primary); font-weight: 800; }
.link-strong:hover { text-decoration: underline; }
.score-card .score { font-size: 38px; font-weight: 900; margin: 8px 0 12px; }
.mini-table { width: 100%; border-collapse: collapse; }
.mini-table td { padding: 10px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.mini-table td:first-child { width: 170px; color: var(--muted); font-weight: 700; }
.mini-table tr:last-child td { border-bottom: 0; }
.problem-box, .hypothesis-box { border: 1px solid var(--line); background: #f9fafb; border-radius: 14px; padding: 14px; margin-bottom: 12px; }
.problem-box h3, .hypothesis-box h3 { margin: 10px 0 8px; }
.problem-box p, .hypothesis-box p { margin: 8px 0 0; line-height: 1.5; }
.clean-list { margin: 0; padding-left: 18px; line-height: 1.8; }
code { background: #f3f4f6; padding: 2px 6px; border-radius: 6px; }
ol { line-height: 1.8; }
.form-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.form-grid input, .form-grid select, textarea, .card input, .card select { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 10px; font: inherit; margin-top: 6px; background: #fff; }
.block-label { display: block; font-weight: 700; }
.block-label textarea { font-weight: 400; line-height: 1.5; }
.notice.success { border-left-color: var(--success); background: var(--success-soft); }
.notice.danger { border-left-color: var(--danger); background: var(--danger-soft); }
button.btn { border: 0; cursor: pointer; font: inherit; }
@media (max-width: 1000px) { .form-grid { grid-template-columns: 1fr; } }
.status-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.status-form select { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; font: inherit; background: #fff; min-width: 150px; }
.status-cell { min-width: 220px; }

.btn-danger { background: var(--danger); color: #fff; }
.request-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.request-card { display: grid; gap: 10px; }
.request-card__footer { display: flex; justify-content: space-between; gap: 12px; align-items: center; flex-wrap: wrap; }

.plan-suggestion { display: grid; grid-template-columns: 1fr 150px; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.plan-suggestion:last-child { border-bottom: 0; }
.plan-suggestion h3 { margin: 8px 0 6px; }
.plan-suggestion p { margin: 0 0 8px; line-height: 1.5; }
.plan-suggestion__side { display: grid; gap: 8px; align-content: start; justify-items: start; }
@media (max-width: 1000px) { .plan-suggestion { grid-template-columns: 1fr; } }
.report-copy textarea { width: 100%; border: 1px solid var(--line); border-radius: 14px; padding: 14px; font: 14px/1.55 Arial, sans-serif; background: #f9fafb; color: var(--text); }
.report-item { border-bottom: 1px solid var(--line); padding: 12px 0; }
.report-item:last-child { border-bottom: 0; }
.report-item h3 { margin: 0 0 6px; font-size: 16px; }
.report-item p { margin: 0 0 8px; line-height: 1.5; }

.agent-card p { line-height: 1.5; min-height: 46px; }
.agent-card h2 { margin-bottom: 6px; }
.form-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.code-block { background:#111827; color:#e5e7eb; border-radius:14px; padding:16px; overflow:auto; line-height:1.55; }
@media (max-width: 1000px) { .form-grid-2 { grid-template-columns: 1fr; } }
.insight-rule { border-left: 4px solid var(--primary); }
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; align-items: end; }
.form-grid label span { display:block; color: var(--muted); font-size: 13px; margin-bottom: 6px; }
.form-grid select, .form-grid input, .form-grid textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.notice.success { border-color: var(--success); background: var(--success-soft); }
.notice.danger { border-color: var(--danger); background: var(--danger-soft); }
@media (max-width: 1000px) { .form-grid { grid-template-columns: 1fr; } }

.role-chip {
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:10px;
    padding:12px 14px;
    border:1px solid #e5e7eb;
    border-radius:14px;
    background:#fff;
    color:#111827;
    text-decoration:none;
}
.role-chip:hover { border-color:#93c5fd; background:#f8fbff; }
.role-chip b {
    display:inline-flex;
    min-width:28px;
    height:28px;
    align-items:center;
    justify-content:center;
    border-radius:999px;
    background:#eef2ff;
}
.compact-form select { max-width:360px; }
.tabs { display:flex; flex-wrap:wrap; gap:8px; }
.tab { display:inline-flex; align-items:center; padding:10px 14px; border:1px solid var(--line); border-radius:999px; background:#fff; color:var(--text); text-decoration:none; font-size:14px; }
.tab.active { background:#111827; color:#fff; border-color:#111827; }
