
:root {
  --bg: #0f1117;
  --bg2: #1a1d27;
  --bg3: #22263a;
  --border: #2d3348;
  --text: #e2e8f0;
  --text-muted: #64748b;
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --orange: #f97316;
  --purple: #a855f7;
  --sidebar-w: 230px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: var(--bg); color: var(--text); display: flex; min-height: 100vh; font-size: 14px; }

/* Sidebar */
.sidebar { width: var(--sidebar-w); background: var(--bg2); border-right: 1px solid var(--border); display: flex; flex-direction: column; position: fixed; top: 0; left: 0; height: 100vh; padding: 20px 0; }
.logo { display: flex; align-items: center; gap: 10px; padding: 0 20px 24px; font-weight: 700; font-size: 15px; line-height: 1.2; border-bottom: 1px solid var(--border); }
.logo-icon { font-size: 22px; color: var(--primary); }
.logo small { font-weight: 400; color: var(--text-muted); font-size: 11px; }
.sidebar ul { list-style: none; padding: 16px 0; flex: 1; }
.sidebar ul li a { display: flex; align-items: center; gap: 10px; padding: 10px 20px; color: var(--text-muted); text-decoration: none; transition: all 0.15s; border-left: 3px solid transparent; font-size: 13px; }
.sidebar ul li a:hover, .sidebar ul li a.active { color: var(--text); background: var(--bg3); border-left-color: var(--primary); }
.sidebar-footer { padding: 16px 20px; border-top: 1px solid var(--border); }
.sidebar-footer small { color: var(--text-muted); font-size: 11px; display: block; margin-bottom: 8px; }
.orgs { display: flex; flex-wrap: wrap; gap: 4px; }

/* Content */
.content { margin-left: var(--sidebar-w); flex: 1; padding: 28px 32px; max-width: calc(100vw - var(--sidebar-w)); }

/* Page header */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.page-header h1 { font-size: 22px; font-weight: 700; }
.actions { display: flex; gap: 10px; }

/* Buttons */
.btn { padding: 8px 16px; border: none; border-radius: 6px; cursor: pointer; font-size: 13px; font-weight: 500; transition: all 0.15s; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: var(--bg3); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #059669; }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #dc2626; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* Cards */
.card { background: var(--bg2); border: 1px solid var(--border); border-radius: 10px; padding: 20px; margin-bottom: 20px; }
.card h3 { font-size: 15px; font-weight: 600; margin-bottom: 16px; color: var(--text); }
.hidden { display: none !important; }

/* Stats grid */
.stats-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--bg2); border: 1px solid var(--border); border-radius: 10px; padding: 16px; display: flex; align-items: center; gap: 14px; }
.stat-icon { font-size: 24px; width: 44px; height: 44px; border-radius: 10px; display: flex; align-items: center; justify-content: center; }
.stat-icon.blue { background: rgba(99,102,241,0.15); }
.stat-icon.green { background: rgba(16,185,129,0.15); }
.stat-icon.orange { background: rgba(249,115,22,0.15); }
.stat-icon.yellow { background: rgba(245,158,11,0.15); }
.stat-icon.purple { background: rgba(168,85,247,0.15); }
.stat-value { font-size: 26px; font-weight: 700; line-height: 1; }
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* 2-column grid */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }

/* Tables */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; padding: 10px 12px; font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; border-bottom: 1px solid var(--border); }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: var(--bg3); }

/* Org badges */
.org-badge { padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 700; display: inline-block; }
.org-badge.rahvai, .org-badge.RAHVAI { background: rgba(239,68,68,0.2); color: #fca5a5; }
.org-badge.hpc, .org-badge.HPC { background: rgba(245,158,11,0.2); color: #fde68a; }
.org-badge.seeal, .org-badge.SEEAL { background: rgba(16,185,129,0.2); color: #6ee7b7; }
.org-badge.bhn, .org-badge.BHN { background: rgba(99,102,241,0.2); color: #c7d2fe; }

/* Status badges */
.status-badge { padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; display: inline-block; }
.status-badge.pending { background: rgba(245,158,11,0.2); color: #fde68a; }
.status-badge.approved, .status-badge.active { background: rgba(16,185,129,0.2); color: #6ee7b7; }
.status-badge.rejected, .status-badge.inactive { background: rgba(239,68,68,0.2); color: #fca5a5; }
.status-badge.prospect, .status-badge.draft { background: rgba(99,102,241,0.2); color: #c7d2fe; }
.status-badge.contacted { background: rgba(168,85,247,0.2); color: #d8b4fe; }

/* General badge */
.badge { padding: 2px 8px; border-radius: 4px; font-size: 11px; background: var(--bg3); color: var(--text-muted); display: inline-block; }
.badge.green { background: rgba(16,185,129,0.2); color: #6ee7b7; }
.badge.red { background: rgba(239,68,68,0.2); color: #fca5a5; }

/* Score */
.score { padding: 2px 8px; border-radius: 4px; font-size: 12px; font-weight: 700; }
.score-9, .score-10 { background: rgba(16,185,129,0.2); color: #6ee7b7; }
.score-7, .score-8 { background: rgba(245,158,11,0.2); color: #fde68a; }
.score-5, .score-6 { background: rgba(249,115,22,0.2); color: #fdba74; }
.score-1, .score-2, .score-3, .score-4 { background: rgba(239,68,68,0.15); color: #fca5a5; }

/* Filter bar */
.filter-bar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.filter-form { display: flex; gap: 10px; }
.filter-form select { background: var(--bg3); border: 1px solid var(--border); color: var(--text); padding: 6px 12px; border-radius: 6px; font-size: 13px; cursor: pointer; }
.count { color: var(--text-muted); font-size: 13px; }

/* Forms */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full { grid-column: 1 / -1; }
.form-group label { font-size: 12px; font-weight: 600; color: var(--text-muted); }
.form-group input, .form-group select, .form-group textarea { background: var(--bg3); border: 1px solid var(--border); color: var(--text); padding: 8px 12px; border-radius: 6px; font-size: 13px; font-family: inherit; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { outline: none; border-color: var(--primary); }

/* Tabs */
.tab-bar { display: flex; gap: 4px; margin-bottom: 20px; border-bottom: 1px solid var(--border); }
.tab { padding: 10px 16px; color: var(--text-muted); text-decoration: none; font-size: 13px; font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; display: flex; align-items: center; gap: 8px; }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab:hover { color: var(--text); }

/* Queue cards */
.queue-card { background: var(--bg2); border: 1px solid var(--border); border-radius: 10px; padding: 20px; margin-bottom: 16px; }
.queue-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; gap: 10px; }
.queue-subject { font-size: 15px; font-weight: 600; margin-bottom: 12px; }
.queue-body pre { background: var(--bg3); padding: 14px; border-radius: 8px; font-size: 12px; line-height: 1.6; white-space: pre-wrap; word-break: break-word; color: var(--text); font-family: inherit; max-height: 250px; overflow-y: auto; border: 1px solid var(--border); }
.queue-actions { display: flex; gap: 10px; margin-top: 14px; }

/* Grant cards */
.grant-card { background: var(--bg3); border: 1px solid var(--border); border-radius: 8px; padding: 16px; margin-bottom: 14px; }
.grant-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.grant-title { font-size: 14px; font-weight: 600; margin-bottom: 10px; color: var(--primary); }
.grant-preview pre { font-size: 12px; line-height: 1.6; white-space: pre-wrap; word-break: break-word; color: var(--text-muted); font-family: inherit; }

/* Schedule card */
.schedule-card { }
.schedule-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.schedule-item { background: var(--bg3); border: 1px solid var(--border); border-radius: 8px; padding: 12px 16px; display: flex; flex-direction: column; gap: 4px; }
.schedule-item .time { font-size: 12px; font-weight: 700; color: var(--primary); }
.schedule-item .desc { font-size: 12px; color: var(--text-muted); }

/* Settings */
.setting-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--border); }
.setting-row:last-child { border-bottom: none; }
.setting-row label { font-size: 13px; font-weight: 500; color: var(--text-muted); }
.setting-value { font-size: 13px; display: flex; align-items: center; gap: 8px; }
.alert-info { background: rgba(99,102,241,0.1); border: 1px solid rgba(99,102,241,0.3); border-radius: 8px; padding: 14px 16px; margin-top: 14px; font-size: 13px; line-height: 1.7; color: var(--text-muted); }
.alert-info strong { color: var(--text); }
.alert-info code { background: var(--bg3); padding: 1px 6px; border-radius: 4px; font-size: 12px; color: #a5b4fc; }

/* Text utilities */
.text-muted { color: var(--text-muted); }
.small { font-size: 12px; }
.empty { text-align: center; padding: 40px; color: var(--text-muted); font-size: 14px; }

/* Responsive */
@media (max-width: 1200px) { .stats-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } .stats-grid { grid-template-columns: repeat(2, 1fr); } }
