:root {
  --bg: #f3f6fb;
  --surface: #ffffff;
  --surface-hover: #f8fafc;
  --border: #e2e8f0;
  --text: #0f172a;
  --text-muted: #64748b;
  --primary: #2563eb;
  --primary-soft: #eff6ff;
  --accent: #ea580c;
  --accent-soft: #fff7ed;
  --green: #16a34a;
  --green-soft: #f0fdf4;
  --purple: #7c3aed;
  --purple-soft: #f5f3ff;
  --teal: #0d9488;
  --teal-soft: #f0fdfa;
  --amber: #d97706;
  --amber-soft: #fffbeb;
  --shadow: 0 2px 10px rgba(15, 23, 42, 0.04);
  --shadow-hover: 0 10px 25px rgba(15, 23, 42, 0.08);
  --radius: 12px;
}

body.dark {
  --bg: #0e131d;
  --surface: #161d2c;
  --surface-hover: #1d263a;
  --border: #263147;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --primary: #3b82f6;
  --primary-soft: rgba(59, 130, 246, 0.15);
  --accent: #f97316;
  --accent-soft: rgba(249, 115, 22, 0.15);
  --green: #22c55e;
  --green-soft: rgba(34, 197, 94, 0.14);
  --purple: #a78bfa;
  --purple-soft: rgba(167, 139, 250, 0.15);
  --teal: #2dd4bf;
  --teal-soft: rgba(45, 212, 191, 0.14);
  --amber: #fbbf24;
  --amber-soft: rgba(251, 191, 36, 0.15);
  --shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
  --shadow-hover: 0 10px 25px rgba(0, 0, 0, 0.4);
}

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

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.hidden { display: none !important; }

/* Ticker */
.ticker-bar {
  display: flex;
  align-items: center;
  background: #0f172a;
  color: #f8fafc;
  height: 32px;
  font-size: 12.5px;
  overflow: hidden;
}

.ticker-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #dc2626;
  color: #fff;
  font-weight: 700;
  font-size: 10.5px;
  letter-spacing: 0.6px;
  padding: 0 12px;
  height: 100%;
  flex-shrink: 0;
}

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #fff;
  animation: pulse 1.5s infinite;
}
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.35; } }

.ticker-track { flex: 1; overflow: hidden; white-space: nowrap; }
.ticker-content { display: inline-block; padding-left: 100%; animation: scrollTicker 45s linear infinite; }
.ticker-content:hover { animation-play-state: paused; }
.ticker-content a { color: #93c5fd; text-decoration: none; margin: 0 14px; }
.ticker-content a:hover { text-decoration: underline; }
@keyframes scrollTicker { 0% { transform: translateX(0); } 100% { transform: translateX(-100%); } }

/* Header */
.top-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 40;
}

.brand-wrap { display: flex; align-items: center; gap: 12px; }

.logo-box {
  position: relative;
  width: 52px;
  height: 52px;
  border-radius: 12px;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: pointer;
  flex-shrink: 0;
}
.logo-box img { width: 100%; height: 100%; object-fit: cover; }
.logo-fallback { color: #fff; font-weight: 800; font-size: 20px; }
.logo-edit-pill {
  position: absolute;
  bottom: 0;
  inset-inline: 0;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  font-size: 10px;
  text-align: center;
  padding: 2px 0;
  opacity: 0;
  transition: opacity 0.15s;
}
.logo-box:hover .logo-edit-pill { opacity: 1; }

.title-row { display: flex; align-items: center; gap: 10px; }
.brand-text h1 { font-size: 20px; font-weight: 700; letter-spacing: -0.2px; }
.brand-text p { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.status-chip {
  font-size: 11px;
  font-weight: 600;
  background: var(--green-soft);
  color: var(--green);
  padding: 2px 8px;
  border-radius: 999px;
}

.header-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

.live-clock {
  font-variant-numeric: tabular-nums;
  font-size: 12.5px;
  font-weight: 600;
  padding: 7px 11px;
  border-radius: 9px;
  background: var(--primary-soft);
  color: var(--primary);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 7px 12px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  transition: all 0.14s ease;
}
.btn:hover { background: var(--surface-hover); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { opacity: 0.92; background: var(--primary); }
.btn-outline { border-color: var(--primary); color: var(--primary); }
.btn-success { background: var(--green-soft); border-color: rgba(22, 163, 74, 0.3); color: var(--green); }
.spinning { display: inline-block; animation: spin 0.8s linear infinite; }
@keyframes spin { 100% { transform: rotate(360deg); } }

/* Notification Dropdown */
.notif-wrapper { position: relative; }
.notif-count {
  background: #dc2626;
  color: #fff;
  border-radius: 999px;
  padding: 1px 6px;
  font-size: 10.5px;
  font-weight: 700;
}
.notif-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: 350px;
  max-height: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-hover);
  overflow: hidden;
  z-index: 60;
}
.notif-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 12.5px;
}
.link-btn { background: none; border: none; color: var(--primary); cursor: pointer; font-size: 12px; font-weight: 600; }
.notif-list { max-height: 340px; overflow-y: auto; }
.notif-item {
  display: block;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  font-size: 12.5px;
}
.notif-item:hover { background: var(--surface-hover); }
.notif-item small { display: block; color: var(--text-muted); margin-top: 2px; font-size: 11px; }

/* Container & Nav */
.container { max-width: 1380px; margin: 0 auto; padding: 18px 24px 48px; }

.nav-bar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 14px;
}

.tabs-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.14s ease;
}

.tab:hover { border-color: var(--primary); color: var(--text); }
.tab.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.tab-highlight:not(.active) { border-color: rgba(234, 88, 12, 0.35); color: var(--accent); background: var(--accent-soft); }
.tab-urgent:not(.active) { border-color: rgba(220, 38, 38, 0.4); color: #dc2626; background: rgba(220, 38, 38, 0.08); }
.tab-studio:not(.active) { border-color: rgba(124, 58, 237, 0.4); color: var(--purple); background: var(--purple-soft); }
.tab-bg:not(.active) { border-color: rgba(13, 148, 136, 0.4); color: var(--teal); background: var(--teal-soft); }

.subfilter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.subfilter-label { font-size: 12px; font-weight: 700; color: var(--text-muted); }
.subpill {
  padding: 5px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.subpill.active, .subpill:hover {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary);
}

.tab-cnt {
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.08);
}
.tab.active .tab-cnt { background: rgba(255, 255, 255, 0.22); color: #fff; }
body.dark .tab-cnt { background: rgba(255, 255, 255, 0.1); }

.search-wrap { position: relative; max-width: 560px; }
.search-icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); font-size: 13.5px; opacity: 0.65; }
.search-wrap input {
  width: 100%;
  padding: 10px 36px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 13.5px;
  outline: none;
}
.search-wrap input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.clear-search {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 14px;
}

.meta-bar {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 14px;
}

/* Cards Grid */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(305px, 1fr));
  gap: 12px;
}

.item-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 15px 16px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.item-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}

.card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.badge-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

.cat-badge {
  font-size: 10.5px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.cat-jaruri_services { background: var(--accent-soft); color: var(--accent); }
.cat-universities { background: #eef2ff; color: #4338ca; }
body.dark .cat-universities { background: rgba(99, 102, 241, 0.18); color: #a5b4fc; }
.cat-forms { background: var(--primary-soft); color: var(--primary); }
.cat-admit_cards { background: var(--teal-soft); color: var(--teal); }
.cat-admission { background: var(--amber-soft); color: var(--amber); }
.cat-scholarships { background: #fdf2f8; color: #be185d; }
body.dark .cat-scholarships { background: rgba(236, 72, 153, 0.18); color: #f9a8d4; }
.cat-offline_forms { background: #f1f5f9; color: #334155; }
body.dark .cat-offline_forms { background: rgba(148, 163, 184, 0.18); color: #cbd5e1; }
.cat-schemes { background: var(--purple-soft); color: var(--purple); }
.cat-results { background: var(--green-soft); color: var(--green); }
.cat-resume_tools { background: #f3e8ff; color: #7e22ce; }
body.dark .cat-resume_tools { background: rgba(168, 85, 247, 0.2); color: #d8b4fe; }
.cat-bg_remover { background: #ccfbf1; color: #0f766e; }
body.dark .cat-bg_remover { background: rgba(20, 184, 166, 0.2); color: #5eead4; }

.new-tag { background: #dc2626; color: #fff; font-size: 10px; font-weight: 700; padding: 2px 6px; border-radius: 5px; }
.urgent-tag { background: #ea580c; color: #fff; font-size: 10px; font-weight: 700; padding: 2px 6px; border-radius: 5px; }

.card-title { font-size: 14px; font-weight: 600; line-height: 1.42; margin-top: 8px; }
.card-summary { font-size: 12.5px; color: var(--text-muted); line-height: 1.4; margin-top: 6px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.univ-meta-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.um-chip { font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 6px; border: 1px solid var(--border); background: var(--bg); color: var(--text); }
.um-purpose { background: #fef3c7; border-color: #fcd34d; color: #92400e; }
.um-course { background: #e0e7ff; border-color: #c7d2fe; color: #3730a3; }
.um-sem { background: #dcfce7; border-color: #86efac; color: #166534; }
.um-session { background: #f3e8ff; border-color: #d8b4fe; color: #6b21a8; }
body.dark .um-purpose { background: rgba(245, 158, 11, 0.18); border-color: rgba(245, 158, 11, 0.35); color: #fcd34d; }
body.dark .um-course { background: rgba(99, 102, 241, 0.2); border-color: rgba(99, 102, 241, 0.4); color: #c7d2fe; }
body.dark .um-sem { background: rgba(34, 197, 94, 0.18); border-color: rgba(34, 197, 94, 0.35); color: #86efac; }
body.dark .um-session { background: rgba(168, 85, 247, 0.18); border-color: rgba(168, 85, 247, 0.35); color: #d8b4fe; }

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-muted);
}

.last-date { color: #dc2626; font-weight: 600; }

.card-btns { display: flex; align-items: center; gap: 6px; }
.mini-btn {
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-muted);
  border-radius: 7px;
  padding: 4px 8px;
  font-size: 12px;
  cursor: pointer;
  text-decoration: none;
}
.mini-btn:hover { border-color: var(--primary); color: var(--primary); }
.mini-btn.pinned { color: #d97706; border-color: rgba(217, 119, 6, 0.45); background: var(--amber-soft); }
.mini-btn.del:hover { color: #dc2626; border-color: rgba(220, 38, 38, 0.4); }
.mini-btn.wa { background: rgba(22, 163, 74, 0.1); border-color: rgba(22, 163, 74, 0.35); color: #15803d; font-weight: 600; }
body.dark .mini-btn.wa { color: #4ade80; border-color: rgba(74, 222, 128, 0.35); }
.mini-btn.wa:hover { background: #16a34a; color: #fff; border-color: #16a34a; }

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 100;
}

.modal {
  width: 100%;
  max-width: 490px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 24px 55px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}
.modal-lg { max-width: 760px; }

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-header h2 { font-size: 16.5px; line-height: 1.35; }
.close-btn { background: none; border: none; color: var(--text-muted); font-size: 18px; cursor: pointer; padding: 2px 6px; }

.modal-body {
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
}
.modal-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
}

/* Detail Modal Content */
.det-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.5;
}
.det-box h4 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.4px; color: var(--primary); margin-bottom: 6px; }
.det-list { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.det-list li {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12.5px;
  line-height: 1.45;
}
.det-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.det-loading { padding: 24px; text-align: center; color: var(--text-muted); font-size: 13.5px; }
.det-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 10px; }
.det-bullets { list-style: disc; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; }
.det-table-wrap { overflow-x: auto; margin-top: 4px; }
.det-table { width: 100%; border-collapse: collapse; font-size: 12px; background: var(--surface); border-radius: 8px; overflow: hidden; }
.det-table th, .det-table td { border: 1px solid var(--border); padding: 6px 8px; text-align: left; }
.det-table th { background: var(--primary-soft); color: var(--primary); font-weight: 700; }

.wa-box { background: rgba(22, 163, 74, 0.06); border: 1px solid rgba(22, 163, 74, 0.35); border-radius: 10px; padding: 12px 14px; }
.wa-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.wa-head h4 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.4px; color: #15803d; margin: 0; }
body.dark .wa-head h4 { color: #4ade80; }
.wa-textarea {
  width: 100%;
  min-height: 175px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, sans-serif;
  font-size: 12.5px;
  line-height: 1.48;
  resize: vertical;
  outline: none;
}
.btn-wa { background: #16a34a; border-color: #16a34a; color: #fff; }
.btn-wa:hover { background: #15803d; border-color: #15803d; color: #fff; }

.ai-choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ai-choice-btn {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px;
  border-radius: 12px; border: 1.5px solid var(--border); cursor: pointer;
  text-align: left; transition: all 0.15s ease; background: var(--surface); color: var(--text);
}
.ai-choice-btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); }
.ai-choice-btn .ai-ico { font-size: 26px; }
.ai-choice-btn strong { display: block; font-size: 14.5px; }
.ai-choice-btn small { display: block; font-size: 11.5px; color: var(--text-muted); margin-top: 2px; }
.ai-chatgpt { border-color: #10a37f; background: rgba(16, 163, 127, 0.08); }
.ai-chatgpt:hover { background: #10a37f; color: #fff; }
.ai-chatgpt:hover small { color: rgba(255,255,255,0.88); }
.ai-gemini { border-color: #2563eb; background: rgba(37, 99, 235, 0.08); }
.ai-gemini:hover { background: #2563eb; color: #fff; }
.ai-gemini:hover small { color: rgba(255,255,255,0.88); }

/* Form inputs */
.logo-upload-area { display: flex; align-items: center; gap: 16px; }
.logo-preview {
  width: 72px; height: 72px; border-radius: 14px;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff; display: flex; align-items: center; justify-content: center;
  overflow: hidden; font-size: 24px; font-weight: 800; flex-shrink: 0;
}
.logo-preview img { width: 100%; height: 100%; object-fit: cover; }
.hint { font-size: 11.5px; color: var(--text-muted); margin-top: 5px; }

.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group label { font-size: 12px; color: var(--text-muted); font-weight: 600; }
.form-group input, .form-group select {
  padding: 9px 11px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--bg); color: var(--text); font-size: 13.5px; outline: none;
}
.form-group input:focus, .form-group select:focus { border-color: var(--primary); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.checkbox-row { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }

.toast-container { position: fixed; bottom: 18px; right: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 120; }
.toast { background: #0f172a; color: #fff; padding: 10px 15px; border-radius: 10px; font-size: 13px; box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3); }

.empty-state {
  grid-column: 1 / -1; text-align: center; padding: 48px 20px;
  color: var(--text-muted); background: var(--surface); border-radius: var(--radius); border: 1px dashed var(--border);
}
