* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, "Segoe UI", Roboto, sans-serif; background: #f5f6f8; color: #1a1a2e; }

.layout { display: flex; min-height: 100vh; }
.sidebar { width: 220px; background: #14162b; color: #fff; display: flex; flex-direction: column; padding: 24px 16px; }
.brand { font-weight: 700; font-size: 18px; margin-bottom: 24px; }
.sidebar nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.sidebar a, .sidebar .disabled { padding: 10px 12px; border-radius: 8px; color: #cfd2e8; text-decoration: none; font-size: 14px; }
.sidebar a:hover { background: #23264a; color: #fff; }
.sidebar a.active { background: #4f5df7; color: #fff; }
.sidebar .disabled { color: #6b6f92; cursor: default; }
.sidebar .disabled em { font-style: normal; font-size: 11px; margin-left: 4px; }
.logout { color: #cfd2e8; text-decoration: none; font-size: 13px; opacity: 0.7; }

.content { flex: 1; padding: 32px 40px; max-width: 1100px; }
h1 { margin-top: 0; }
.hint { color: #666; font-size: 14px; }

.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: #14162b; }
.login-box { background: #fff; padding: 32px; border-radius: 12px; width: 300px; display: flex; flex-direction: column; gap: 12px; }
.login-box h1 { margin: 0 0 8px; font-size: 20px; }
.login-box input { padding: 10px; border: 1px solid #ddd; border-radius: 6px; }
.login-box button, button, .btn-secondary { background: #4f5df7; color: #fff; border: none; padding: 10px 16px; border-radius: 6px; cursor: pointer; font-size: 14px; text-decoration: none; display: inline-block; }
.btn-secondary { background: #23264a; }

.inline-form { display: flex; gap: 8px; margin-bottom: 20px; }
.inline-form input { padding: 8px; border: 1px solid #ddd; border-radius: 6px; flex: 1; }

.stacked-form { display: flex; flex-direction: column; gap: 12px; max-width: 500px; margin-bottom: 24px; }
.stacked-form label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: #444; }
.stacked-form input, .stacked-form select, .stacked-form textarea { padding: 10px; border: 1px solid #ddd; border-radius: 6px; font-family: inherit; }

.data-table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 8px; overflow: hidden; margin-bottom: 16px; }
.data-table th, .data-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid #eee; font-size: 14px; }
.data-table th { background: #f0f1f6; font-weight: 600; }
.data-table .empty { text-align: center; color: #999; }

.error { background: #ffe3e3; color: #a10000; padding: 10px 14px; border-radius: 6px; margin-bottom: 12px; font-size: 14px; }

.past-runs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; font-size: 13px; }
.past-runs a { padding: 4px 10px; background: #fff; border-radius: 12px; text-decoration: none; color: #444; border: 1px solid #ddd; }
.past-runs a.active { background: #4f5df7; color: #fff; border-color: #4f5df7; }

.results-header { display: flex; justify-content: space-between; align-items: center; }
.cluster-card { background: #fff; padding: 16px; border-radius: 10px; margin-bottom: 16px; }
.cluster-card h3 { margin: 0 0 4px; }
.cluster-meta { color: #777; font-size: 13px; margin-top: 0; }

.tag { padding: 2px 8px; border-radius: 10px; font-size: 12px; }
.tag-low { background: #ffe9e9; color: #b40000; }
.tag-medium { background: #fff6d9; color: #8a6d00; }
.tag-high { background: #e2ffe6; color: #007a1f; }

.loading-overlay { flex-direction: column; align-items: center; gap: 16px; padding: 40px 20px; background: #fff; border-radius: 10px; margin-bottom: 24px; text-align: center; color: #444; font-size: 14px; }
.spinner { width: 36px; height: 36px; border: 4px solid #e0e2f0; border-top-color: #4f5df7; border-radius: 50%; animation: kw-spin 0.8s linear infinite; }
@keyframes kw-spin { to { transform: rotate(360deg); } }
button:disabled { opacity: 0.6; cursor: not-allowed; }
