* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: #0f172a; color: #e2e8f0; }
.container { max-width: 1400px; margin: 0 auto; padding: 20px; }
h1 { font-size: 1.5rem; margin-bottom: 4px; color: #38bdf8; }
.subtitle { font-size: 0.85rem; color: #94a3b8; margin-bottom: 20px; }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: #1e293b; border-radius: 12px; padding: 18px; border: 1px solid #334155; }
.stat-card .label { font-size: 0.72rem; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.05em; }
.stat-card .value { font-size: 1.7rem; font-weight: 700; color: #f1f5f9; margin-top: 4px; }
.stat-card .sub { font-size: 0.72rem; color: #64748b; margin-top: 2px; }
.stat-card.ok .value { color: #4ade80; }
.stat-card.warn .value { color: #fbbf24; }
.stat-card.err .value { color: #f87171; }
.stat-card.info .value { color: #38bdf8; }

.tabs { display: flex; gap: 4px; margin-bottom: 20px; border-bottom: 1px solid #334155; }
.tab-button { background: transparent; color: #94a3b8; border: none; padding: 10px 18px; font-size: 0.9rem; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab-button:hover { color: #e2e8f0; }
.tab-button.active { color: #38bdf8; border-bottom-color: #38bdf8; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.section-title { font-size: 0.85rem; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.05em; margin: 18px 0 10px; }

table { width: 100%; border-collapse: collapse; background: #1e293b; border-radius: 12px; overflow: hidden; }
th { background: #334155; color: #94a3b8; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; padding: 12px; text-align: left; }
td { padding: 10px 12px; border-top: 1px solid #334155; font-size: 0.85rem; vertical-align: middle; }
tr:hover { background: #334155; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 0.7rem; font-weight: 600; }
.badge-ok        { background: #1a3a2a; color: #4ade80; }
.badge-warn      { background: #3b2f1e; color: #fbbf24; }
.badge-err       { background: #5f1e1e; color: #f87171; }
.badge-info      { background: #1e3a5f; color: #38bdf8; }
.badge-muted     { background: #334155; color: #94a3b8; }
.badge-purple    { background: #3b1f5e; color: #c084fc; }

.filters { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; align-items: center; }
.filters select, .filters input { background: #1e293b; color: #e2e8f0; border: 1px solid #334155; border-radius: 8px; padding: 8px 12px; font-size: 0.85rem; }
.filters button { background: #2563eb; color: white; border: none; border-radius: 8px; padding: 8px 16px; cursor: pointer; font-size: 0.85rem; }
.filters button:hover { background: #1d4ed8; }
.filters button.ghost { background: #475569; }
.filters button.ghost:hover { background: #64748b; }

.card { background: #1e293b; border: 1px solid #334155; border-radius: 12px; padding: 18px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } }

.env-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 14px; }
.env-card { background: #1e293b; border: 1px solid #334155; border-radius: 12px; padding: 16px; cursor: pointer; transition: border-color .15s, transform .15s; }
.env-card:hover { border-color: #38bdf8; transform: translateY(-1px); }
.env-card .env-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 10px; }
.env-card .env-name { font-weight: 600; color: #f1f5f9; }
.env-card .env-sub { font-size: 0.75rem; color: #94a3b8; margin-top: 2px; }
.env-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 12px; }
.metric { background: #0f172a; border: 1px solid #334155; border-radius: 8px; padding: 8px 10px; }
.metric .m-label { font-size: 0.65rem; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.05em; }
.metric .m-bar { height: 6px; background: #334155; border-radius: 3px; margin-top: 6px; overflow: hidden; }
.metric .m-bar span { display: block; height: 100%; background: linear-gradient(90deg, #38bdf8, #22d3ee); }
.metric .m-bar.high span { background: linear-gradient(90deg, #fbbf24, #f87171); }
.metric .m-val { font-size: 0.85rem; color: #f1f5f9; margin-top: 4px; font-weight: 600; }

.env-footer { display: flex; justify-content: space-between; margin-top: 12px; font-size: 0.72rem; color: #94a3b8; }

.roles-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.role-card { background: #0f172a; border: 1px solid #334155; border-radius: 10px; padding: 12px; }
.role-card .r-name { color: #38bdf8; font-weight: 600; text-transform: capitalize; margin-bottom: 6px; }
.perm-chip { display: inline-block; background: #1e293b; color: #cbd5e1; border: 1px solid #334155; padding: 2px 7px; border-radius: 10px; font-size: 0.68rem; margin: 2px 3px 2px 0; }

.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.7); z-index: 100; justify-content: center; align-items: center; }
.modal-overlay.active { display: flex; }
.modal { background: #1e293b; border-radius: 12px; padding: 24px; max-width: 860px; width: 92%; max-height: 85vh; overflow-y: auto; border: 1px solid #334155; }
.modal h3 { color: #38bdf8; margin-bottom: 14px; }
.modal .close { float: right; background: none; border: none; color: #94a3b8; font-size: 1.2rem; cursor: pointer; }
.form-row { display: grid; grid-template-columns: 160px 1fr; gap: 10px; align-items: center; margin-bottom: 10px; }
.form-row label { color: #94a3b8; font-size: 0.8rem; }
.form-row input, .form-row select { background: #0f172a; color: #e2e8f0; border: 1px solid #334155; border-radius: 8px; padding: 8px 10px; font-size: 0.85rem; width: 100%; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }

.progress { background: #334155; height: 8px; border-radius: 4px; overflow: hidden; width: 140px; display: inline-block; vertical-align: middle; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, #38bdf8, #22d3ee); }
.progress.err > span { background: linear-gradient(90deg, #f87171, #ef4444); }
.progress.ok > span  { background: linear-gradient(90deg, #4ade80, #22c55e); }

.muted { color: #64748b; }
code { background: #0f172a; padding: 2px 6px; border-radius: 4px; font-size: 0.8rem; }

.pagination { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; flex-wrap: wrap; gap: 10px; }
.pagination .page-info { font-size: 0.8rem; color: #94a3b8; }
.pagination .page-controls { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.pagination label { font-size: 0.8rem; color: #94a3b8; display: inline-flex; gap: 6px; align-items: center; }
.pagination select { background: #1e293b; color: #e2e8f0; border: 1px solid #334155; border-radius: 8px; padding: 6px 8px; font-size: 0.8rem; }
.pagination button { background: #475569; color: white; border: none; border-radius: 8px; padding: 6px 12px; cursor: pointer; font-size: 0.8rem; }
.pagination button:hover:not(:disabled) { background: #64748b; }
.pagination button:disabled { opacity: 0.4; cursor: not-allowed; }
.pagination .page-num { font-size: 0.85rem; color: #e2e8f0; min-width: 70px; text-align: center; }
