/* DigitalDev AI - minimal dark theme */
* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
    --bg: #0f1115; --bg2: #171a21; --bg3: #1f232c; --border: #2a2f3a;
    --text: #e6e9ef; --muted: #8b93a3; --accent: #1a73e8; --accent2: #1558b0;
    --ok: #34a853; --err: #ea4335; --warn: #fbbc04;
}
body { background: var(--bg); color: var(--text); font: 14px/1.5 -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); text-decoration: none; }
#app { min-height: 100vh; }
.app-loader { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100vh; gap: 12px; color: var(--muted); }
.app-loader i { font-size: 28px; }

/* Layout */
.layout { display: flex; min-height: 100vh; }
.sidebar { width: 220px; background: var(--bg2); border-right: 1px solid var(--border); padding: 16px 12px; position: sticky; top: 0; height: 100vh; }
.sidebar .brand { font-weight: 700; font-size: 16px; padding: 8px 10px 18px; }
.sidebar .brand span { color: var(--accent); }
.sidebar a { display: flex; gap: 10px; align-items: center; padding: 9px 10px; border-radius: 8px; color: var(--muted); margin-bottom: 2px; }
.sidebar a:hover { background: var(--bg3); color: var(--text); }
.sidebar a.active { background: var(--accent); color: #fff; }
.sidebar .spacer { flex: 1; }
.main { flex: 1; padding: 24px; max-width: 1100px; }
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.topbar h1 { font-size: 20px; }
.topbar .user { color: var(--muted); font-size: 13px; display: flex; gap: 12px; align-items: center; }

/* Cards / widgets */
.card { background: var(--bg2); border: 1px solid var(--border); border-radius: 12px; padding: 18px; margin-bottom: 16px; }
.card h3 { font-size: 14px; color: var(--muted); margin-bottom: 8px; font-weight: 600; }
.card .big { font-size: 26px; font-weight: 700; }
.grid { display: grid; gap: 16px; }
.grid.cols-4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }

/* Tables */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; }
tr:hover td { background: var(--bg3); }
.badge { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 11px; }
.badge.ok { background: rgba(52,168,83,.15); color: var(--ok); }
.badge.err { background: rgba(234,67,53,.15); color: var(--err); }
.badge.dim { background: var(--bg3); color: var(--muted); }

/* Forms */
input, select, textarea { width: 100%; background: var(--bg3); border: 1px solid var(--border); color: var(--text); border-radius: 8px; padding: 9px 12px; font: inherit; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }
label { display: block; font-size: 12px; color: var(--muted); margin: 10px 0 4px; }
button, .btn { display: inline-flex; align-items: center; gap: 8px; background: var(--accent); color: #fff; border: 0; border-radius: 8px; padding: 9px 16px; font: inherit; cursor: pointer; }
button:hover, .btn:hover { background: var(--accent2); }
button.ghost, .btn.ghost { background: var(--bg3); color: var(--text); border: 1px solid var(--border); }
button.danger { background: var(--err); }
button:disabled { opacity: .5; cursor: default; }
.btn-sm { padding: 5px 10px; font-size: 12px; }

/* Chat */
.chat-box { display: flex; flex-direction: column; height: calc(100vh - 200px); }
.chat-msgs { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; padding: 4px 2px; }
.msg { max-width: 78%; padding: 10px 14px; border-radius: 12px; white-space: pre-wrap; word-break: break-word; }
.msg.user { align-self: flex-end; background: var(--accent); color: #fff; }
.msg.assistant { align-self: flex-start; background: var(--bg3); }
.msg .meta { font-size: 11px; opacity: .7; margin-top: 6px; }
.chat-input { display: flex; gap: 10px; margin-top: 14px; }
.chat-input textarea { resize: none; height: 52px; }
.chat-controls { display: flex; gap: 10px; margin-bottom: 12px; align-items: flex-end; }
.chat-controls > * { flex: 0 0 auto; }
.chat-controls label { margin: 0 0 4px; }
.chat-controls .field { min-width: 160px; }

/* Login */
.login-wrap { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-card { background: var(--bg2); border: 1px solid var(--border); border-radius: 14px; padding: 36px; width: 380px; text-align: center; }
.login-card h1 { margin-bottom: 8px; }
.login-card p { color: var(--muted); margin-bottom: 22px; font-size: 13px; }
.login-card .btn { width: 100%; justify-content: center; }

.muted { color: var(--muted); }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
.flex { display: flex; gap: 10px; align-items: center; }
.mt { margin-top: 14px; }
.toast { position: fixed; bottom: 20px; right: 20px; background: var(--bg3); border: 1px solid var(--border); padding: 12px 18px; border-radius: 10px; z-index: 99; }
.toast.err { border-color: var(--err); }
