@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap');

:root {
    --bg: #eef3f8;
    --panel: #ffffff;
    --ink: #1f2937;
    --muted: #6b7280;
    --accent: #2563eb;
    --accent-strong: #1d4ed8;
    --line: #d6dee8;
    --danger: #b91c1c;
    --success: #166534;
    --shadow: 0 24px 60px rgba(37, 99, 235, 0.10);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Poppins", "Segoe UI", sans-serif;
    color: var(--ink);
    background:
        radial-gradient(circle at top left, rgba(37, 99, 235, 0.18), transparent 30%),
        linear-gradient(180deg, #f8fbff 0%, var(--bg) 100%);
}

img,
svg,
iframe,
table,
pre {
    max-width: 100%;
}

.shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 280px 1fr;
}

.sidebar {
    padding: 32px 24px;
    background: linear-gradient(180deg, #1e3a8a 0%, #334155 100%);
    color: #f8fafc;
}

.sidebar h1 {
    margin-top: 0;
    font-size: 1.8rem;
}

.sidebar nav {
    display: grid;
    gap: 10px;
    margin-top: 28px;
}

.sidebar a {
    color: #dbeafe;
    text-decoration: none;
    padding: 10px 12px;
    border-radius: 10px;
}

.sidebar a.active,
.sidebar a:hover {
    background: rgba(255, 255, 255, 0.16);
}

.content {
    padding: 32px;
}

.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 24px;
    padding: 28px;
    box-shadow: var(--shadow);
}

.panel-nested {
    padding: 18px;
    border-radius: 18px;
    box-shadow: none;
    background: #f8fbff;
}

.split {
    display: grid;
    grid-template-columns: minmax(280px, 420px) 1fr;
    gap: 24px;
}

.master-detail {
    display: grid;
    grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
    gap: 24px;
    align-items: start;
}

.list-pane,
.detail-pane {
    min-width: 0;
}

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

.action-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.section-head h2,
.section-head h3 {
    margin: 0;
}

.item-list {
    display: grid;
    gap: 12px;
}

.item-card {
    display: grid;
    gap: 4px;
    padding: 16px 18px;
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 18px;
    color: var(--ink);
    text-decoration: none;
    box-shadow: 0 8px 24px rgba(37, 99, 235, 0.06);
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.item-card:hover,
.item-card.active {
    border-color: var(--accent);
    box-shadow: 0 12px 28px rgba(37, 99, 235, 0.12);
}

.item-card span {
    color: var(--muted);
    font-size: 0.92rem;
}

.static-card {
    cursor: default;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 18px;
}

.detail-card {
    padding: 20px;
    background: #f8fbff;
    border: 1px solid var(--line);
    border-radius: 20px;
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.detail-card h3 {
    margin-top: 0;
}

.detail-empty {
    padding: 32px;
    border: 1px dashed var(--line);
    border-radius: 20px;
    color: var(--muted);
    background: #f8fbff;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.meta-list {
    display: grid;
    gap: 14px;
    margin: 0;
}

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

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

.meta-list dd {
    margin: 0;
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
}

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

.metric-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-top: 22px;
}

.metric-card {
    display: grid;
    gap: 6px;
    padding: 16px 18px;
    background: linear-gradient(180deg, #ffffff, #eff6ff);
    border: 1px solid var(--line);
    border-radius: 18px;
}

.stat {
    padding: 18px;
    background: linear-gradient(180deg, #ffffff, #f1f5f9);
    border: 1px solid var(--line);
    border-radius: 18px;
}

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

.stat strong {
    display: block;
    margin-top: 8px;
    font-size: 1.8rem;
}

.stack {
    display: grid;
    gap: 14px;
}

label {
    display: grid;
    gap: 6px;
    font-size: 0.95rem;
    min-width: 0;
}

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

input,
textarea,
select {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    background: #ffffff;
}

textarea {
    min-height: 90px;
    resize: vertical;
}

p,
span,
strong,
a,
button,
td,
th,
dt,
dd,
label,
h1,
h2,
h3 {
    overflow-wrap: anywhere;
    word-break: break-word;
}

.inline-form {
    display: inline;
}

.status-inline {
    display: inline-flex;
    gap: 8px;
    align-items: center;
}

.status-inline select {
    min-width: 110px;
}

button {
    border: 0;
    border-radius: 999px;
    padding: 12px 20px;
    background: linear-gradient(135deg, var(--accent), var(--accent-strong));
    color: white;
    cursor: pointer;
}

.danger-button {
    background: linear-gradient(135deg, #c2410c, #9a3412);
}

.button-link {
    display: inline-block;
    padding: 12px 20px;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--accent), var(--accent-strong));
    color: white;
    text-decoration: none;
    max-width: 100%;
}

.button-link.secondary {
    background: #e2e8f0;
    color: var(--ink);
}

.check {
    grid-auto-flow: column;
    justify-content: start;
    align-items: center;
}

.check input {
    width: auto;
}

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

.kb-group + .kb-group {
    margin-top: 28px;
}

.kb-group h3 {
    margin-bottom: 10px;
}

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

.notice {
    margin-bottom: 18px;
    padding: 14px 16px;
    border-radius: 14px;
}

.notice.success {
    background: #eff6ff;
    color: var(--success);
}

.notice.error {
    background: #fef2f2;
    color: var(--danger);
}

.notice.info {
    background: #eff6ff;
    color: #1d4ed8;
}

.notice pre {
    margin: 10px 0 0;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
    font-size: 0.88rem;
}

.login-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.login-card {
    width: min(480px, 100%);
    padding: 32px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 28px;
    box-shadow: var(--shadow);
}

.compact-form {
    margin-top: 12px;
}

.compact-form textarea {
    min-height: 70px;
}

.top-gap {
    margin-top: 12px;
}

code {
    font-family: "SFMono-Regular", Consolas, monospace;
    background: rgba(37, 99, 235, 0.08);
    padding: 2px 6px;
    border-radius: 8px;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
}

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

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

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

    .section-head {
        flex-direction: column;
    }
}
