*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0d0d0d;
  --surface: #161616;
  --surface2: #1e1e1e;
  --surface3: #252525;
  --border: #2a2a2a;
  --border2: #333;
  --text: #f0f0f0;
  --text2: #999;
  --text3: #555;
  --accent: #F5C04A;
  --accent-dim: rgba(245,192,74,.12);
  --accent-text: #140f00;
  --danger: #e05252;
  --danger-dim: rgba(224,82,82,.12);
  --success: #4caf7d;
  --success-dim: rgba(76,175,125,.1);
  --sidebar-w: 200px;
  --radius: 8px;
  --radius-lg: 12px;
  --font: 'DM Sans', system-ui, sans-serif;
  --mono: 'DM Mono', monospace;
}

body { background: var(--bg); color: var(--text); font-family: var(--font); font-size: 14px; line-height: 1.5; min-height: 100vh; }

.hidden { display: none !important; }

/* ---- LAYOUT ---- */
#app-shell { display: flex; min-height: 100vh; }
#sidebar { width: var(--sidebar-w); background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; position: fixed; top: 0; left: 0; bottom: 0; z-index: 10; }
#main-content { margin-left: var(--sidebar-w); flex: 1; min-height: 100vh; padding: 32px; max-width: 1100px; }

/* ---- SIDEBAR ---- */
.sidebar-logo { display: flex; align-items: flex-start; padding: 14px 12px 12px; border-bottom: 1px solid var(--border); }
.logo-mark { width: 28px; height: 28px; background: var(--accent); border-radius: 5px; display: flex; align-items: center; justify-content: center; font-family: var(--mono); font-size: 10px; font-weight: 500; color: var(--accent-text); flex-shrink: 0; }
.logo-text { font-size: 13px; font-weight: 600; letter-spacing: .3px; display: none; }
.sidebar-nav { flex: 1; padding: 10px 8px; display: flex; flex-direction: column; gap: 2px; }
.sidebar-bottom { padding: 10px 8px 16px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 2px; }

.nav-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 6px; color: var(--text2); text-decoration: none; font-size: 13px; font-weight: 400; transition: background .1s, color .1s; cursor: pointer; border: none; background: none; width: 100%; text-align: left; }
.nav-item:hover { background: var(--surface2); color: var(--text); }
.nav-item.active { background: var(--accent-dim); color: var(--accent); }
.nav-item.logout:hover { background: var(--danger-dim); color: var(--danger); }

/* ---- VIEWS ---- */
.view-header { margin-bottom: 24px; }
.view-header h1 { font-size: 22px; font-weight: 600; }
.view-header p { color: var(--text2); font-size: 13px; margin-top: 4px; }

/* ---- BOARD SELECTOR ---- */
.board-selector { display: flex; align-items: center; gap: 8px; margin-bottom: 24px; }
.board-selector select { background: var(--surface); border: 1px solid var(--border); color: var(--text); border-radius: var(--radius); padding: 7px 10px; font-family: var(--font); font-size: 13px; cursor: pointer; }
.board-selector select:focus { outline: none; border-color: var(--accent); }

/* ---- VESTABOARD PREVIEW ---- */
.vb-wrap { background: #111; border-radius: var(--radius-lg); padding: 14px 16px 10px; display: inline-block; border: 1px solid #1e1e1e; }
.vb-grid { display: flex; flex-direction: column; gap: 3px; }
.vb-row { display: flex; gap: 2px; }
.vb-tile { width: 22px; height: 30px; background: #0a0a0a; border-radius: 2px; display: flex; align-items: center; justify-content: center; position: relative; border: 1px solid #181818; flex-shrink: 0; }
.vb-tile::after { content: ''; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: rgba(255,255,255,.04); }
.vb-tile span { font-family: var(--mono); font-size: 11px; font-weight: 500; color: #F5C04A; z-index: 1; line-height: 1; }
.vb-tile.color-red { background: #c0392b; }
.vb-tile.color-orange { background: #e67e22; }
.vb-tile.color-yellow { background: #f1c40f; }
.vb-tile.color-green { background: #27ae60; }
.vb-tile.color-blue { background: #2980b9; }
.vb-tile.color-violet { background: #8e44ad; }
.vb-tile.color-white { background: #ecf0f1; }
.vb-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; }
.vb-label { font-family: var(--mono); font-size: 8px; color: #2a2a2a; letter-spacing: 3px; }
.vb-rows { font-family: var(--mono); font-size: 9px; color: #333; }

/* ---- FORMS ---- */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 12px; color: var(--text2); font-weight: 500; }
input[type=text], input[type=email], input[type=password], input[type=datetime-local], textarea, select.full {
  background: var(--surface); border: 1px solid var(--border); color: var(--text); border-radius: var(--radius);
  padding: 9px 12px; font-family: var(--font); font-size: 13px; transition: border-color .15s, box-shadow .15s; width: 100%;
}
input:focus, textarea:focus, select.full:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }
textarea { resize: vertical; min-height: 90px; line-height: 1.55; }
input[type=password] { font-family: var(--mono); letter-spacing: 2px; }
input[type=password]::placeholder { font-family: var(--font); letter-spacing: normal; }

/* ---- BUTTONS ---- */
.btn { display: inline-flex; align-items: center; gap: 7px; padding: 9px 18px; border-radius: var(--radius); font-family: var(--font); font-size: 13px; font-weight: 500; cursor: pointer; transition: opacity .15s, transform .1s, background .15s; border: none; }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: var(--accent-text); }
.btn-primary:hover:not(:disabled) { opacity: .88; }
.btn-ghost { background: transparent; color: var(--text2); border: 1px solid var(--border); }
.btn-ghost:hover:not(:disabled) { background: var(--surface2); color: var(--text); }
.btn-danger { background: var(--danger-dim); color: var(--danger); border: 1px solid transparent; }
.btn-danger:hover:not(:disabled) { background: var(--danger); color: #fff; }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-icon { padding: 7px; background: var(--surface2); color: var(--text2); border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer; display: inline-flex; align-items: center; transition: background .15s, color .15s; }
.btn-icon:hover { background: var(--surface3); color: var(--text); }

/* ---- CARDS ---- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; }
.card-sm { padding: 14px 16px; }

/* ---- STAT CARDS ---- */
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 24px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.stat-label { font-size: 11px; color: var(--text3); font-weight: 500; text-transform: uppercase; letter-spacing: 1px; }
.stat-value { font-size: 26px; font-weight: 600; font-family: var(--mono); margin-top: 4px; color: var(--text); }
.stat-sub { font-size: 11px; color: var(--text3); margin-top: 2px; }

/* ---- TABLE ---- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font-size: 11px; color: var(--text3); text-transform: uppercase; letter-spacing: 1px; font-weight: 500; padding: 10px 12px; border-bottom: 1px solid var(--border); }
td { padding: 12px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--surface2); }
.cell-mono { font-family: var(--mono); font-size: 12px; color: var(--text2); }
.cell-actions { display: flex; gap: 6px; justify-content: flex-end; }

/* ---- BADGES ---- */
.badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 500; font-family: var(--mono); }
.badge-sent { background: var(--success-dim); color: var(--success); }
.badge-scheduled { background: var(--accent-dim); color: var(--accent); }
.badge-pending { background: rgba(153,153,153,.1); color: var(--text3); }
.badge-failed { background: var(--danger-dim); color: var(--danger); }
.badge-default { background: var(--accent-dim); color: var(--accent); font-size: 10px; padding: 2px 6px; }

/* ---- FAVORITES GRID ---- */
.fav-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.fav-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 14px; display: flex; flex-direction: column; gap: 10px; transition: border-color .15s; }
.fav-card:hover { border-color: var(--border2); }
.fav-name { font-weight: 500; font-size: 13px; }
.fav-preview { font-family: var(--mono); font-size: 11px; color: var(--text2); line-height: 1.4; white-space: pre-wrap; word-break: break-all; max-height: 48px; overflow: hidden; }
.fav-actions { display: flex; gap: 6px; margin-top: auto; }

/* ---- AUTH SCREEN ---- */
#auth-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg); }
.auth-box { width: 380px; }
.auth-logo { display: flex; align-items: center; gap: 10px; margin-bottom: 32px; }
.auth-logo-mark { width: 36px; height: 36px; background: var(--accent); border-radius: 7px; display: flex; align-items: center; justify-content: center; font-family: var(--mono); font-size: 12px; font-weight: 500; color: var(--accent-text); }
.auth-logo-text { font-size: 18px; font-weight: 600; }
.auth-tabs { display: flex; gap: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 3px; margin-bottom: 20px; }
.auth-tab { flex: 1; text-align: center; padding: 7px; font-size: 13px; font-weight: 500; border-radius: 6px; cursor: pointer; color: var(--text2); transition: background .15s, color .15s; border: none; background: none; }
.auth-tab.active { background: var(--surface3); color: var(--text); }
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-error { color: var(--danger); font-size: 12px; text-align: center; min-height: 18px; }

/* ---- ONBOARDING ---- */
#onboarding-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg); }
.onboard-box { width: 480px; }
.onboard-step-label { font-family: var(--mono); font-size: 11px; color: var(--accent); letter-spacing: 2px; text-transform: uppercase; margin-bottom: 8px; }
.onboard-title { font-size: 22px; font-weight: 600; margin-bottom: 8px; }
.onboard-sub { color: var(--text2); font-size: 13px; margin-bottom: 28px; line-height: 1.6; }
.token-hint { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; font-size: 12px; color: var(--text2); line-height: 1.6; margin-top: 4px; }
.token-hint a { color: var(--accent); text-decoration: none; }

/* ---- COMPOSE ---- */
.compose-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }
@media (max-width: 800px) { .compose-layout { grid-template-columns: 1fr; } }
.compose-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.overflow-warn { font-size: 11px; color: var(--danger); }

/* ---- SCHEDULE ---- */
.schedule-list { display: flex; flex-direction: column; gap: 10px; }
.schedule-item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; display: flex; align-items: center; gap: 14px; }
.schedule-time { font-family: var(--mono); font-size: 12px; color: var(--accent); min-width: 130px; }
.schedule-content { flex: 1; font-size: 13px; color: var(--text2); white-space: pre-line; }
.schedule-sent { opacity: .5; }

/* ---- TOAST ---- */
#toast-container { position: fixed; bottom: 24px; right: 24px; display: flex; flex-direction: column; gap: 8px; z-index: 100; pointer-events: none; }
.toast { background: var(--surface2); border: 1px solid var(--border2); color: var(--text); border-radius: var(--radius); padding: 10px 16px; font-size: 13px; animation: slideIn .2s ease; pointer-events: auto; max-width: 320px; }
.toast.success { border-color: var(--success); color: var(--success); }
.toast.error { border-color: var(--danger); color: var(--danger); }
@keyframes slideIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ---- SETTINGS ---- */
.settings-section { margin-bottom: 32px; }
.settings-section h2 { font-size: 15px; font-weight: 600; margin-bottom: 16px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.board-list { display: flex; flex-direction: column; gap: 10px; }
.board-item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; display: flex; align-items: center; gap: 12px; }
.board-item-info { flex: 1; }
.board-item-name { font-weight: 500; font-size: 13px; }
.board-item-meta { font-size: 11px; color: var(--text3); margin-top: 2px; font-family: var(--mono); }

/* ---- EMPTY STATES ---- */
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 48px; text-align: center; color: var(--text3); gap: 10px; }
.empty-state svg { opacity: .3; }
.empty-state p { font-size: 13px; }

/* ---- PAGINATION ---- */
.pagination { display: flex; align-items: center; gap: 8px; margin-top: 16px; justify-content: flex-end; }
.page-btn { background: var(--surface); border: 1px solid var(--border); color: var(--text2); border-radius: var(--radius); padding: 5px 12px; cursor: pointer; font-size: 12px; font-family: var(--font); transition: background .1s; }
.page-btn:hover:not(:disabled) { background: var(--surface2); }
.page-btn:disabled { opacity: .4; cursor: not-allowed; }
.page-info { font-size: 12px; color: var(--text3); font-family: var(--mono); }

/* ---- MISC ---- */
.row { display: flex; align-items: center; gap: 10px; }
.gap-4 { gap: 4px; }
.gap-8 { gap: 8px; }
.flex-1 { flex: 1; }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
hr.divider { border: none; border-top: 1px solid var(--border); margin: 20px 0; }
.text-sm { font-size: 12px; }
.text-muted { color: var(--text2); }
.text-mono { font-family: var(--mono); }
.spinner { width: 16px; height: 16px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- MODAL ---- */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.7); display: flex; align-items: center; justify-content: center; z-index: 50; }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 24px; width: 460px; max-width: 95vw; }
.modal-title { font-size: 16px; font-weight: 600; margin-bottom: 16px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; }

/* Pixel art editor */
.px { transition: none !important; }
.btn.active { background: var(--surface3); border-color: var(--accent); color: var(--text); }
