:root {
    --bg: #f4f7fb;
    --card: #ffffff;
    --text: #1a2740;
    --muted: #6c778c;
    --border: #dde5f0;
    --accent: #2759c7;
    --accent-soft: #e8efff;
    --success: #197c43;
    --success-soft: #e7f6ed;
    --warn: #b96a00;
    --warn-soft: #fff1dc;
    --danger: #bb2233;
    --danger-soft: #fde9ec;
    --gray-soft: #eef2f7;
    --shadow: 0 10px 30px rgba(16, 34, 74, 0.08);
    --radius: 18px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans", "Yu Gothic UI", sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { background: #edf2fb; border-radius: 8px; padding: 0.15rem 0.4rem; }

.layout {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    min-height: 100vh;
}
.sidebar {
    background: #0f1d35;
    color: #fff;
    padding: 24px 18px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}
.brand { font-size: 1.25rem; font-weight: 800; line-height: 1.4; }
.org { color: #b7c6e1; font-size: 0.95rem; }
.nav { display: grid; gap: 8px; }
.nav a {
    color: #d9e5fb;
    padding: 12px 14px;
    border-radius: 12px;
    display: block;
}
.nav a.active, .nav a:hover {
    background: rgba(255,255,255,0.1);
    text-decoration: none;
}
.sidebar-footer {
    margin-top: auto;
    font-size: 0.9rem;
    color: #b7c6e1;
    display: grid;
    gap: 8px;
}
.content {
    padding: 28px;
    display: grid;
    gap: 20px;
}
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
}
.page-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
}
.page-head h1 { margin: 0 0 8px; font-size: 1.9rem; }
.page-head p { margin: 0; color: var(--muted); }
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
}
.stat-card { text-align: center; }
.stat-label { color: var(--muted); margin-bottom: 8px; }
.stat-value { font-size: 2rem; font-weight: 800; }
.two-col { display: grid; grid-template-columns: 400px minmax(0, 1fr); gap: 20px; }
.layout-top { align-items: start; }
.align-start { align-items: start; }
.sticky-card { position: sticky; top: 20px; }
.section-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}
.section-title-row h2, .card h2 { margin: 0 0 14px; font-size: 1.2rem; }
.stack-list { display: grid; gap: 10px; }
.list-item {
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 14px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    background: #fff;
}
.no-link:hover { text-decoration: none; }
.list-item:hover { background: #fbfdff; text-decoration: none; }
.list-title { font-weight: 700; margin-bottom: 4px; }
.list-meta { color: var(--muted); font-size: 0.92rem; }
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}
.form-grid.single-col { grid-template-columns: 1fr; }
.form-grid.slim { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.compact-form { gap: 12px; }
label { display: grid; gap: 8px; font-weight: 600; font-size: 0.95rem; }
label span { color: var(--text); }
input, select, textarea, button {
    font: inherit;
}
input, select, textarea {
    width: 100%;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text);
}
textarea { resize: vertical; }
.full { grid-column: 1 / -1; }
.form-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}
.form-actions.align-end { align-items: end; }
.form-actions.split { justify-content: space-between; }
.btn {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    padding: 11px 16px;
    border-radius: 12px;
    border: 1px solid transparent;
    background: var(--accent);
    color: #fff;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
}
.btn:hover { filter: brightness(0.97); text-decoration: none; }
.btn-ghost {
    background: #fff;
    border-color: var(--border);
    color: var(--text);
}
.btn-danger { background: var(--danger); }
.btn-small { padding: 8px 12px; font-size: 0.9rem; }
.flash {
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--border);
    font-weight: 600;
}
.flash.success { background: var(--success-soft); border-color: #bfe3cc; color: var(--success); }
.flash.error { background: var(--danger-soft); border-color: #efbbc2; color: var(--danger); }
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 72px;
    padding: 7px 10px;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 700;
}
.badge.blue { background: var(--accent-soft); color: var(--accent); }
.badge.green { background: var(--success-soft); color: var(--success); }
.badge.orange { background: var(--warn-soft); color: var(--warn); }
.badge.red { background: var(--danger-soft); color: var(--danger); }
.badge.gray { background: var(--gray-soft); color: #556070; }
.table {
    width: 100%;
    border-collapse: collapse;
}
.table th, .table td {
    text-align: left;
    padding: 12px 10px;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}
.table th { color: var(--muted); font-size: 0.92rem; }
.muted { color: var(--muted); }
.plain-list { margin: 0; padding-left: 1.2rem; display: grid; gap: 10px; }
.detail-box {
    border: 1px solid var(--border);
    border-radius: 14px;
    margin-bottom: 12px;
    background: #fff;
    overflow: hidden;
}
.detail-box > summary {
    list-style: none;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    padding: 14px 16px;
    cursor: pointer;
    background: #fbfdff;
}
.detail-box[open] > summary { border-bottom: 1px solid var(--border); }
.detail-box > summary::-webkit-details-marker { display: none; }
.detail-box form { padding: 16px; }
.summary-badges { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.progress-bar-wrap { padding-top: 2px; }
.progress-bar {
    width: 100%;
    height: 10px;
    background: var(--gray-soft);
    border-radius: 999px;
    overflow: hidden;
}
.progress-bar span {
    display: block;
    height: 100%;
    background: var(--accent);
    border-radius: 999px;
}
.login-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}
.login-card {
    width: min(520px, 100%);
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 24px;
    box-shadow: var(--shadow);
    padding: 28px;
}
.login-card h1 { margin: 0 0 10px; }
.hint-box {
    margin-top: 18px;
    padding: 14px;
    border: 1px dashed var(--border);
    border-radius: 12px;
    background: #fafcff;
    color: var(--muted);
}

@media (max-width: 1100px) {
    .layout { grid-template-columns: 1fr; }
    .sidebar { position: static; }
    .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .two-col, .form-grid.slim { grid-template-columns: 1fr; }
    .sticky-card { position: static; }
}

@media (max-width: 700px) {
    .content { padding: 18px; }
    .page-head { flex-direction: column; }
    .stats-grid { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: 1fr; }
    .table { display: block; overflow-x: auto; white-space: nowrap; }
}
