/* olladns dashboard — component styles (depends on tokens.css) */

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg-0); color: var(--text); font-family: var(--font); font-size: var(--fs-md); line-height: 1.45; -webkit-font-smoothing: antialiased; }
button { font-family: inherit; font-size: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 8px; border: 2px solid var(--bg-0); }
::-webkit-scrollbar-thumb:hover { background: var(--line-2); }

/* ===== Shell ===== */
.app { display: grid; grid-template-columns: 232px 1fr; height: 100vh; background: var(--bg-0); overflow: hidden; }
[x-cloak] { display: none !important; }

/* ===== Sidebar ===== */
.sidebar { background: var(--bg-1); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.sb-brand { height: 54px; display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--line); font-weight: 600; }
.sb-brand .logo { width: 24px; height: 24px; border-radius: 6px; background: linear-gradient(135deg, var(--accent), #7dd3fc); display: grid; place-items: center; color: #031; flex: none; box-shadow: 0 0 0 1px rgba(34,211,238,.4), 0 0 16px rgba(34,211,238,.25); }
.sb-brand .logo svg { width: 14px; height: 14px; }
.sb-org { padding: 10px 12px; border-bottom: 1px solid var(--line); }
.sb-org-btn { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px; border-radius: var(--r); background: var(--bg-2); border: 1px solid var(--line); cursor: pointer; }
.sb-org-btn .av { width: 24px; height: 24px; border-radius: 5px; background: linear-gradient(135deg, #7c3aed, #22d3ee); display: grid; place-items: center; color: #fff; font-weight: 700; font-size: var(--fs-sm); flex: none; }
.sb-org-btn .meta { flex: 1; text-align: left; min-width: 0; }
.sb-org-btn .l1 { font-weight: 600; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-org-btn .l2 { color: var(--muted); font-size: var(--fs-xs); }
.sb-nav { padding: 10px 8px; overflow-y: auto; flex: 1; }
.sb-group { margin: 4px 0 10px; }
.sb-group-title { padding: 8px 10px 4px; font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .12em; color: var(--dim); font-weight: 600; }
.sb-item { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: var(--r); color: var(--text-2); cursor: pointer; position: relative; font-size: var(--fs-base); }
.sb-item:hover { background: var(--bg-2); color: var(--text); }
.sb-item.active { background: var(--accent-soft); color: var(--accent); }
.sb-item.active::before { content: ""; position: absolute; left: -8px; top: 7px; bottom: 7px; width: 2px; background: var(--accent); border-radius: 2px; }
.sb-item .badge { margin-left: auto; background: var(--bg-3); color: var(--text-2); font-size: var(--fs-xs); padding: 1px 6px; border-radius: 10px; border: 1px solid var(--line); }
.sb-item.active .badge { background: rgba(34,211,238,.18); color: var(--accent); border-color: var(--accent-line); }
.sb-foot { padding: 10px 12px; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 10px; font-size: var(--fs-base); }
.sb-foot .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--good); box-shadow: 0 0 8px var(--good); flex: none; }
.sb-foot .mu { color: var(--muted); font-size: 11px; }

/* ===== Main ===== */
.main { display: flex; flex-direction: column; min-width: 0; background: var(--bg-0); }
.topbar { height: 54px; display: flex; align-items: center; gap: 14px; padding: 0 18px; border-bottom: 1px solid var(--line); background: var(--bg-1); }
.crumbs { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: var(--fs-base); }
.crumbs .sep { opacity: .5; }
.crumbs .cur { color: var(--text); font-weight: 600; }
.tb-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.tb-btn { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: var(--r); border: 1px solid var(--line); background: var(--bg-2); color: var(--text-2); font-size: 12px; }
.tb-btn:hover { border-color: var(--line-2); color: var(--text); }
.tb-icon-btn { width: 30px; height: 30px; display: grid; place-items: center; border-radius: var(--r); border: 1px solid var(--line); background: var(--bg-2); color: var(--text-2); }
.tb-icon-btn:hover { color: var(--text); border-color: var(--line-2); }
.tb-avatar { width: 30px; height: 30px; border-radius: 50%; background: linear-gradient(135deg, #22d3ee, #a78bfa); color: #031; display: grid; place-items: center; font-weight: 700; font-size: 11px; }

.content { flex: 1; overflow-y: auto; padding: 18px 22px 40px; min-height: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 14px; gap: 16px; flex-wrap: wrap; }
.page-title { font-size: var(--fs-xl); font-weight: 600; letter-spacing: -.01em; margin: 0; }
.page-sub { color: var(--muted); font-size: var(--fs-base); margin-top: 2px; }
.page-actions { display: flex; align-items: center; gap: 8px; }

/* ===== Panels ===== */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow); }
.panel-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.panel-head .ph-title { font-weight: 600; font-size: var(--fs-md); }
.panel-head .ph-sub { color: var(--muted); font-size: var(--fs-sm); margin-left: 6px; }
.panel-head .ph-tools { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.panel-body { padding: 14px; }

/* ===== Stat cards ===== */
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-md); padding: 14px; display: flex; flex-direction: column; gap: 6px; position: relative; overflow: hidden; }
.stat .lbl { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; font-weight: 600; }
.stat .val { font-family: var(--mono); font-size: 24px; font-weight: 600; letter-spacing: -.01em; color: var(--text); }
.stat .delta { font-size: var(--fs-sm); }
.stat.danger .val { color: var(--bad); }
.stat.warn .val { color: var(--warn); }
.stat.accent .val { color: var(--accent); }
.stat .spark { position: absolute; right: 10px; bottom: 8px; opacity: .85; }

/* ===== Tables ===== */
.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--fs-base); }
.tbl thead th { position: sticky; top: 0; background: var(--bg-1); color: var(--muted); font-weight: 600; text-transform: uppercase; font-size: var(--fs-xs); letter-spacing: .08em; text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--line); z-index: 1; }
.tbl tbody td { padding: 9px 12px; border-bottom: 1px solid var(--line); color: var(--text-2); vertical-align: middle; }
.tbl tbody tr:hover td { background: var(--bg-2); }
.tbl .mono { font-family: var(--mono); font-size: var(--fs-sm); color: var(--text); }
.tbl .num { text-align: right; font-family: var(--mono); }
.tbl-wrap { max-height: 520px; overflow: auto; }

/* ===== Pills ===== */
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 999px; font-size: var(--fs-xs); font-weight: 600; letter-spacing: .02em; border: 1px solid var(--line); background: var(--bg-2); color: var(--text-2); text-transform: uppercase; }
.pill.allow { color: var(--good); background: rgba(34,197,94,.10); border-color: rgba(34,197,94,.28); }
.pill.block { color: var(--bad); background: rgba(239,68,68,.10); border-color: rgba(239,68,68,.28); }
.pill.warn { color: var(--warn); background: rgba(245,158,11,.10); border-color: rgba(245,158,11,.28); }
.pill.info { color: var(--accent); background: var(--accent-soft); border-color: var(--accent-line); }

/* ===== Buttons ===== */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: var(--r); background: var(--bg-2); border: 1px solid var(--line); color: var(--text-2); font-size: 12px; font-weight: 500; }
.btn:hover { border-color: var(--line-2); color: var(--text); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #031320; font-weight: 600; }
.btn.primary:hover { background: #67e8f9; }
.btn.danger { color: var(--bad); border-color: rgba(239,68,68,.28); background: rgba(239,68,68,.06); }
.btn.sm { padding: 4px 8px; font-size: var(--fs-sm); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ===== Switch ===== */
.switch { position: relative; display: inline-block; width: 34px; height: 18px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider { position: absolute; inset: 0; background: var(--bg-3); border: 1px solid var(--line); border-radius: 999px; cursor: pointer; transition: var(--dur); }
.switch .slider::before { content: ""; position: absolute; left: 2px; top: 1px; width: 13px; height: 13px; border-radius: 50%; background: var(--muted); transition: var(--dur); }
.switch input:checked + .slider { background: var(--accent-soft); border-color: var(--accent-line); }
.switch input:checked + .slider::before { transform: translateX(16px); background: var(--accent); box-shadow: 0 0 8px var(--accent); }

/* ===== Form ===== */
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.field label { font-size: var(--fs-sm); color: var(--muted); text-transform: uppercase; letter-spacing: .08em; font-weight: 600; }
.field input, .field select { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r); padding: 8px 10px; color: var(--text); outline: none; }
.field input:focus, .field select:focus { border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft); }
.field .hint { color: var(--muted); font-size: 11px; }

/* ===== Grid helpers ===== */
.row { display: grid; gap: 14px; }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.row-3-2 { grid-template-columns: 3fr 2fr; }

/* ===== Login ===== */
.login-page { min-height: 100vh; display: grid; place-items: center; background: var(--bg-0); padding: 20px; }
.login-card { width: 100%; max-width: 380px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 32px; box-shadow: var(--shadow); }
.login-card .logo { width: 40px; height: 40px; border-radius: 8px; background: linear-gradient(135deg, var(--accent), #7dd3fc); display: grid; place-items: center; margin: 0 auto 20px; box-shadow: 0 0 0 1px rgba(34,211,238,.4), 0 0 24px rgba(34,211,238,.25); }
.login-card h1 { text-align: center; font-size: var(--fs-xl); font-weight: 600; margin: 0 0 4px; }
.login-card .sub { text-align: center; color: var(--muted); font-size: var(--fs-base); margin: 0 0 24px; }
.login-card .err { background: rgba(239,68,68,.10); border: 1px solid rgba(239,68,68,.28); border-radius: var(--r); padding: 8px 10px; color: var(--bad); font-size: var(--fs-sm); margin-bottom: 12px; }
.login-card .btn.primary { width: 100%; justify-content: center; padding: 10px; font-size: var(--fs-md); }
.login-card .foot { text-align: center; margin-top: 16px; color: var(--muted); font-size: var(--fs-sm); }

/* ===== Misc ===== */
.live-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--good); box-shadow: 0 0 8px var(--good); display: inline-block; animation: pulse 1.5s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .4; } }
.muted { color: var(--muted); }
.empty { padding: 32px; text-align: center; color: var(--muted); font-size: var(--fs-base); }
.loading { padding: 32px; text-align: center; color: var(--muted); font-size: var(--fs-sm); }
