:root {
    --bg: #f4f6fb;
    --panel: #ffffff;
    --text: #172033;
    --muted: #6b7280;
    --border: #e5e7eb;
    --primary: #2344a5;
    --primary-dark: #1a327b;
    --success: #0f8a5f;
    --warning: #b7791f;
    --danger: #c53030;
    --shadow: 0 14px 45px rgba(22, 34, 51, .08);
    --radius: 18px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
small, .muted { color: var(--muted); }

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

.sidebar {
    background: #111827;
    color: white;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 22px;
    position: sticky;
    top: 0;
    height: 100vh;
}

.brand { display: flex; align-items: center; gap: 12px; }

.brand-logo {
    width: 42px;
    height: 42px;
    border-radius: 13px;
    background: linear-gradient(135deg, #4f7cff, #20c997);
    display: grid;
    place-items: center;
    font-weight: 800;
}

.brand span { display: block; color: #9ca3af; font-size: 13px; }

.sidebar-search input {
    background: rgba(255,255,255,.08);
    border-color: rgba(255,255,255,.10);
    color: white;
}

.sidebar-search input::placeholder { color: #9ca3af; }

.sidebar nav { display: grid; gap: 6px; }

.sidebar nav a {
    color: #d1d5db;
    padding: 11px 12px;
    border-radius: 12px;
}

.sidebar nav a:hover,
.sidebar nav a.active {
    background: rgba(255,255,255,.08);
    color: white;
    text-decoration: none;
}

.sidebar-footer { margin-top: auto; color: #d1d5db; font-size: 14px; }
.sidebar-footer a { color: #93c5fd; }

.main { padding: 28px; min-width: 0; }

.topbar {
    margin-bottom: 24px;
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
}

.topbar h1 {
    margin: 0;
    font-size: 30px;
    letter-spacing: -0.03em;
}

.topbar p { margin: 6px 0 0; color: var(--muted); }

.grid { display: grid; gap: 18px; }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

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

.card h2, .card h3 { margin-top: 0; }
.card h2 { font-size: 21px; letter-spacing: -.02em; }

.kpi { display: grid; gap: 8px; }
.kpi-label { color: var(--muted); font-size: 13px; }
.kpi-value { font-size: 30px; font-weight: 800; letter-spacing: -0.04em; }

.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }

th, td {
    padding: 12px 10px;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}

th {
    text-align: left;
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 4px 9px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.badge-success { background: #dcfce7; color: #166534; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-neutral { background: #eef2ff; color: #3730a3; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 9px 14px;
    border-radius: 12px;
    border: 1px solid transparent;
    background: var(--primary);
    color: white;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    font-size: 14px;
}

.btn:hover { background: var(--primary-dark); text-decoration: none; }

.btn-secondary { background: white; color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: #f9fafb; }
.btn-danger { background: #b91c1c; }
.btn-danger:hover { background: #991b1b; }
.btn-small { min-height: 30px; padding: 6px 10px; border-radius: 10px; font-size: 12px; }

.actions-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 16px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.form-group { display: grid; gap: 7px; }

label { font-size: 13px; font-weight: 700; color: #374151; }

input, select, textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px 11px;
    font: inherit;
    background: white;
}

textarea { min-height: 110px; }
.form-full { grid-column: 1 / -1; }

.alert {
    padding: 12px 14px;
    border-radius: 14px;
    margin-bottom: 16px;
}

.alert-success { background: #dcfce7; color: #166534; }
.alert-danger { background: #fee2e2; color: #991b1b; }
.alert-warning { background: #fef3c7; color: #92400e; }

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        radial-gradient(circle at top left, rgba(79,124,255,.20), transparent 30%),
        radial-gradient(circle at bottom right, rgba(32,201,151,.18), transparent 30%),
        var(--bg);
}

.login-card { width: min(440px, 100%); }

.prompt-box {
    background: #0f172a;
    color: #e5e7eb;
    border-radius: 16px;
    padding: 16px;
    white-space: pre-wrap;
    line-height: 1.5;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.detail-header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
    margin-bottom: 18px;
}

.detail-title h2 { margin: 0 0 6px; font-size: 26px; letter-spacing: -.03em; }

.meta-list {
    display: grid;
    gap: 9px;
}

.meta-list div {
    display: grid;
    grid-template-columns: 150px 1fr;
    gap: 10px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 8px;
}

.meta-list span:first-child {
    color: var(--muted);
    font-size: 13px;
}

.pipeline-board {
    display: grid;
    grid-template-columns: repeat(4, minmax(260px, 1fr));
    gap: 16px;
    overflow-x: auto;
    padding-bottom: 10px;
}

.pipeline-column {
    background: #eef2f7;
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 12px;
    min-height: 300px;
}

.pipeline-column h3 {
    margin: 3px 5px 12px;
    font-size: 15px;
}

.pipeline-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: 15px;
    padding: 13px;
    margin-bottom: 10px;
    box-shadow: 0 6px 18px rgba(22,34,51,.06);
}

.pipeline-card strong { display: block; margin-bottom: 6px; }

.empty-state {
    border: 1px dashed var(--border);
    border-radius: 16px;
    padding: 20px;
    color: var(--muted);
    background: #fafafa;
}

.search-result {
    display: grid;
    gap: 5px;
    padding: 13px 0;
    border-bottom: 1px solid var(--border);
}

.search-result strong { font-size: 16px; }

@media (max-width: 1080px) {
    .app-shell { grid-template-columns: 1fr; }
    .sidebar { position: static; height: auto; }
    .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: 1fr; }
    .pipeline-board { grid-template-columns: repeat(1, minmax(260px, 1fr)); }
}


.priority-list { display: grid; gap: 12px; }
.priority-card {
    display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 14px; align-items: center;
    padding: 13px; border: 1px solid var(--border); border-radius: 16px; background: #fff;
}
.score-circle { width: 54px; height: 54px; border-radius: 999px; display: grid; place-items: center; font-weight: 900; background: #eef2ff; color: #3730a3; }
.score-circle.high { background: #dcfce7; color: #166534; }
.score-circle.medium { background: #fef3c7; color: #92400e; }
.score-circle.low { background: #fee2e2; color: #991b1b; }
.quick-section { border: 1px solid var(--border); border-radius: 18px; padding: 16px; background: #fafafa; margin-bottom: 16px; }
.template-card { border: 1px solid var(--border); border-radius: 16px; padding: 16px; background: white; display: grid; gap: 10px; }
.template-text { background: #f8fafc; border: 1px solid var(--border); border-radius: 13px; padding: 13px; white-space: pre-wrap; line-height: 1.5; }
.warning-line { border-left: 4px solid #f59e0b; padding: 10px 12px; background: #fffbeb; border-radius: 0 12px 12px 0; margin-bottom: 12px; }
@media (max-width: 1080px) { .priority-card { grid-template-columns: 54px minmax(0, 1fr); } .priority-card .actions-row { grid-column: 1 / -1; } }


.code-inline {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    background: #f1f5f9;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 2px 6px;
}

.progress-shell {
    height: 10px;
    background: #e5e7eb;
    border-radius: 999px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: #2344a5;
}

ul {
    line-height: 1.7;
}
