:root {
    --bg-body: #f8fafc;
    --bg-card: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --primary: #000000;
    --primary-hover: #333333;
    --secondary: #0ea5e9;
    --accent: #f59e0b;
    --border: #e2e8f0;
    --text-on-primary: #ffffff;
    --radius: 12px;
    --header-h: 64px;
}
@media (prefers-color-scheme: dark) {
    :root {
       --bg-body: #0f172a;
       --bg-card: #1e293b;
       --text-main: #f8fafc;
       --text-muted: #94a3b8;
       --primary: #ffffff;
       --text-on-primary: #000000;
       --primary-hover: #cccccc;
       --border: #334155;
    }
}
[data-theme="dark"] {
    --text-on-primary: #000000;
    --bg-body: #0f172a;
    --bg-card: #1e293b;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --primary: #ffffff;
    --primary-hover: #cccccc;
    --border: #334155;
}
[data-theme="light"] {
    --text-on-primary: #ffffff;
    --bg-body: #f8fafc;
    --bg-card: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --primary: #000000;
    --primary-hover: #333333;
    --border: #e2e8f0;
}

* { margin:0; padding:0; box-sizing:border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; background: var(--bg-body); color: var(--text-main); line-height: 1.5; transition: background .3s, color .3s; padding-bottom: 40px; }
a { text-decoration: none; color: inherit; transition: .2s; }
ul { list-style: none; }
button { cursor: pointer; border: none; font-family: inherit; }

.container { max-width: 1100px; margin: 0 auto; padding: 0 20px; }

/* Header */
header { background: var(--bg-card); height: var(--header-h); border-bottom: 1px solid var(--border); position: sticky; top:0; z-index: 50; display: flex; align-items: center; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05); }
.header-inner { display: flex; justify-content: space-between; align-items: center; width: 100%; }
.brand { font-weight: 800; font-size: 1.25rem; color: var(--primary); letter-spacing: -0.5px; }
.nav { display: flex; gap: 20px; align-items: center; }
.nav a { font-weight: 500; font-size: 0.95rem; color: var(--text-muted); }
.nav a:hover { color: var(--primary); }

.theme-toggle { background: transparent; color: var(--text-muted); padding: 8px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.theme-toggle:hover { background: var(--bg-body); color: var(--text-main); }

/* Hero */
.hero { text-align: center; padding: 60px 20px; background: linear-gradient(180deg, var(--bg-card) 0%, var(--bg-body) 100%); border-bottom: 1px solid var(--border); }
.hero h1 { font-size: clamp(2rem, 5vw, 3rem); font-weight: 800; margin-bottom: 16px; background: linear-gradient(135deg, var(--text-main) 0%, var(--primary) 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.hero p { font-size: 1.1rem; color: var(--text-muted); margin-bottom: 32px; max-width: 600px; margin-left: auto; margin-right: auto; }
.hero-stats { display: inline-flex; align-items: center; gap: 8px; background: var(--bg-card); padding: 6px 16px; border-radius: 20px; border: 1px solid var(--border); font-size: 0.9rem; margin-bottom: 24px; box-shadow: 0 2px 4px rgba(0,0,0,0.05); }
.live-dot { width: 8px; height: 8px; background: #22c55e; border-radius: 50%; box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.2); }

.btn-group { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }
.btn { padding: 10px 24px; border-radius: 8px; font-weight: 600; font-size: 1rem; transition: transform .1s, box-shadow .1s; display: inline-flex; align-items: center; gap: 8px; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: var(--text-on-primary); box-shadow: 0 4px 6px -1px rgba(79, 70, 229, 0.3); }
.btn-primary:hover { background: var(--primary-hover); transform: translateY(-1px); }
.btn-secondary { background: var(--bg-card); border: 1px solid var(--border); color: var(--text-main); }
.btn-secondary:hover { background: var(--bg-body); border-color: var(--text-muted); }

/* Grid Layout */
.main-grid { display: grid; grid-template-columns: 1fr; gap: 24px; margin-top: 40px; }
@media (min-width: 800px) { .main-grid { grid-template-columns: 2fr 1fr; } }

.card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,0.05); display: flex; flex-direction: column; }
.card-header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.card-title { font-weight: 700; font-size: 1.1rem; display: flex; align-items: center; gap: 8px; }
.card-body { padding: 0; flex: 1; }
.card-footer { padding: 12px 20px; border-top: 1px solid var(--border); text-align: center; }
.card-body.p-20 { padding: 20px; }

/* Lists */
.list-item { padding: 12px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; transition: background .1s; }
.list-item:hover { background: var(--bg-body); }
.list-item:last-child { border-bottom: none; }
.list-dot { width: 6px; height: 6px; background: var(--secondary); border-radius: 50%; flex-shrink: 0; }
.list-content { flex: 1; min-width: 0; }
.list-title { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.list-meta { font-size: 0.8rem; color: var(--text-muted); margin-top: 2px; }

/* Chat */
.chat-box { height: 300px; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; font-size: 0.9rem; background: var(--bg-body); }
.chat-msg { display: flex; gap: 8px; align-items: baseline; }
.chat-user { font-weight: 700; color: var(--primary); white-space: nowrap; font-size: 0.85rem; }
.chat-text { color: var(--text-main); word-break: break-all; }
.chat-time { font-size: 0.75rem; color: var(--text-muted); margin-left: auto; }

/* Auth Card */
.auth-status { padding: 20px; text-align: center; }
.auth-welcome { font-weight: 600; margin-bottom: 4px; }
.auth-email { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 16px; word-break: break-all; }

/* Footer */
footer { margin-top: 60px; text-align: center; color: var(--text-muted); font-size: 0.9rem; padding: 20px; border-top: 1px solid var(--border); }

/* Loading */
.loading { color: var(--text-muted); padding: 20px; text-align: center; font-size: 0.9rem; }

/* Forms */
.form-group { margin-bottom: 16px; text-align: left; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 500; font-size: 0.95rem; }
.input { width: 100%; padding: 10px; border: 1px solid var(--border); background: var(--bg-body); color: var(--text-main); border-radius: 6px; font-family: inherit; font-size: 1rem; }
.input:focus { outline: 2px solid var(--primary); border-color: transparent; }

/* Mobile Menu */
.mobile-menu-btn { display: none; background: none; font-size: 1.5rem; color: var(--text-main); }
@media (max-width: 600px) {
    .nav { display: none; } /* Could add mobile menu later if needed, keeps concise for now */
    /* .mobile-menu-btn { display: block; } */
}

/* Modals */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.5); display: none; align-items: center; justify-content: center; z-index: 100; backdrop-filter: blur(2px); }
.modal { background: var(--bg-card); padding: 24px; border-radius: var(--radius); width: 90%; max-width: 500px; border: 1px solid var(--border); box-shadow: 0 10px 25px -5px rgba(0,0,0,0.1); max-height: 90vh; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; }
.modal h3 { font-size: 1.25rem; font-weight: 700; margin-bottom: 8px; }
.modal-actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 16px; }

/* Accounts Grid */
.accounts-wrap { margin-top: 24px; }
.accounts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.acc-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; transition: transform .2s, box-shadow .2s; cursor: move; }
.acc-card:hover { transform: translateY(-2px); box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05); }
.acc-card.drag-ghost { opacity: 0.5; border: 1px dashed var(--text-muted); }
.acc-add { display: flex; align-items: center; justify-content: center; font-size: 2rem; color: var(--text-muted); cursor: pointer; border: 2px dashed var(--border); background: transparent; min-height: 150px; }
.acc-add:hover { border-color: var(--primary); color: var(--primary); background: var(--bg-body); }
.acc-header { margin-bottom: 12px; }
.acc-title { font-weight: 700; font-size: 1.05rem; display: flex; justify-content: space-between; align-items: center; }
.acc-meta { font-size: 0.85rem; color: var(--text-muted); }
.acc-footer { margin-top: 12px; display: flex; gap: 8px; }
.acc-toggle { background: transparent; border: 1px solid var(--border); border-radius: 6px; padding: 4px 10px; font-size: 0.85rem; color: var(--text-main); transition: .2s; }
.acc-toggle:hover { background: var(--bg-body); border-color: var(--text-muted); }
.acc-details { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); font-size: 0.9rem; display: none; }
.acc-card.open .acc-details { display: block; }
.acc-badge-lock { display: inline-block; background: #ef4444; color: white; font-size: 0.75rem; padding: 2px 6px; border-radius: 4px; margin-top: 4px; }

/* Utility / Misc */
.row { display: flex; align-items: center; gap: 12px; }
.btn-sm { padding: 4px 10px; font-size: 0.85rem; }
.alert { padding: 12px; border-radius: 8px; background: rgba(245, 158, 11, 0.1); color: var(--accent); border: 1px solid rgba(245, 158, 11, 0.2); font-size: 0.9rem; }
.badge { background: #ef4444; color: white; padding: 2px 6px; border-radius: 10px; font-size: 0.7rem; }
hr { border: 0; border-top: 1px solid var(--border); margin: 16px 0; }

