:root {
    --bg: #0f172a;
    --panel: #111c33;
    --card: #17213a;
    --border: #24314f;
    --text: #e5e7eb;
    --muted: #94a3b8;
    --accent: #38bdf8;
    --danger: #ef4444;
    --success: #22c55e;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
    padding: 30px;
}

.container {
    max-width: 1400px;
    margin: auto;
}

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}

h1,
h2,
h3 {
    margin-bottom: 15px;
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.navbar {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 15px 20px;
    margin-bottom: 20px;

    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-links {
    display: flex;
    gap: 15px;
}

input,
select {
    width: 100%;
    background: var(--panel);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 10px;
}

button {
    background: var(--accent);
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 8px;
    cursor: pointer;
}

button:hover {
    opacity: 0.9;
}

.btn-danger {
    background: var(--danger);
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

th {
    background: var(--panel);
}

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

tr:nth-child(even) {
    background: rgba(255,255,255,0.02);
}

.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}

.badge-success {
    background: rgba(34,197,94,.15);
    color: #4ade80;
}

.badge-danger {
    background: rgba(239,68,68,.15);
    color: #f87171;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
}

.stat-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
}

.stat-number {
    font-size: 28px;
    font-weight: bold;
    margin-top: 5px;
}

@media (max-width: 1000px) {
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 700px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}
.muted-text {
    color: var(--muted);
    margin-bottom: 15px;
    line-height: 1.5;
}

.badge-rank {
    background: rgba(56,189,248,.15);
    color: #7dd3fc;
}

.badge-special {
    background: rgba(168,85,247,.15);
    color: #c084fc;
}

.danger-link {
    color: #f87171;
}

input:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.table-wrapper {
    width: 100%;
    overflow-x: auto;
}

.cell-title {
    font-weight: 700;
    color: var(--text);
    margin-bottom: 3px;
}

.cell-muted {
    font-size: 12px;
    color: var(--muted);
    word-break: break-all;
}

.badge-main {
    background: rgba(56, 189, 248, .15);
    color: #7dd3fc;
}

.badge-department {
    background: rgba(168, 85, 247, .15);
    color: #c084fc;
}

.badge-muted {
    background: rgba(148, 163, 184, .15);
    color: var(--muted);
}

.badge-type-rank {
    background: rgba(56, 189, 248, .15);
    color: #7dd3fc;
}

.badge-type-department {
    background: rgba(168, 85, 247, .15);
    color: #c084fc;
}

.badge-type-special {
    background: rgba(139, 92, 246, .18);
    color: #c4b5fd;
}

label {
    display: block;
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
    margin: 10px 0 6px;
}

.mapping-form {
    display: grid;
    gap: 6px;
}

.check-row {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    width: fit-content;
    margin: 8px 0 14px;
    color: var(--text);
}

.check-row input {
    width: auto;
    margin: 0;
}

.button-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
}

.button-link {
    display: inline-block;
    background: var(--accent);
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 8px;
    cursor: pointer;
}

.button-link:hover {
    text-decoration: none;
    opacity: 0.9;
}

.button-link.secondary {
    background: var(--panel);
    border: 1px solid var(--border);
    color: var(--text);
}

.mapping-group {
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    margin-top: 18px;
    background: rgba(15, 23, 42, 0.35);
}

.mapping-group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--panel);
    border-bottom: 1px solid var(--border);
}

.mapping-group table {
    margin-top: 0;
}

.action-links {
    white-space: nowrap;
}

.action-links a {
    margin-right: 10px;
}

.table-wrapper table tr:hover {
    background: rgba(56,189,248,.05);
}

@media (max-width: 700px) {
    body {
        padding: 15px;
    }

    .navbar,
    .mapping-group-header,
    .button-row {
        align-items: flex-start;
        flex-direction: column;
    }

    .nav-links {
        flex-wrap: wrap;
    }
}

.cache-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.alert {
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 16px;
    border: 1px solid var(--border);
}

.alert-success {
    background: rgba(34, 197, 94, 0.12);
    color: #86efac;
}

.alert-danger {
    background: rgba(239, 68, 68, 0.12);
    color: #fca5a5;
}

@media (max-width: 800px) {
    .cache-card {
        align-items: stretch;
        flex-direction: column;
    }
}

.page-actions {
    margin-bottom: 20px;
}

.button-link {
    display: inline-block;
    background: var(--accent);
    color: white;
    padding: 10px 16px;
    border-radius: 8px;
    text-decoration: none;
}

.button-link:hover {
    opacity: 0.9;
    text-decoration: none;
}

.refresh-form {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 20px;
}

.refresh-form input {
    flex: 1;
    margin-bottom: 0;
}

.log-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.log-row {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px;
}

.log-top {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 6px;
}

.log-level {
    font-weight: 700;
    font-size: 12px;
}

.log-time {
    color: var(--muted);
    font-size: 12px;
}

.log-message {
    font-weight: 600;
}

.log-meta {
    margin-top: 8px;
    padding: 10px;
    background: rgba(0,0,0,0.25);
    border-radius: 8px;
    overflow-x: auto;
    font-size: 12px;
}

.log-error {
    border-color: rgba(239,68,68,.6);
}

.log-warn {
    border-color: rgba(245,158,11,.6);
}

.log-info {
    border-color: rgba(56,189,248,.35);
}

.text-danger {
    color: #f87171;
}