:root {
  --bg-primary:    #0b1a2e;
  --bg-secondary:  #112240;
  --bg-card:       #132847;
  --bg-hover:      #1a3158;
  --border:        #1e3a5f;
  --border-light:  #1a3258;
  --gold:          #c9a84c;
  --gold-hover:    #b8963e;
  --gold-dim:      rgba(201,168,76,0.10);
  --gold-border:   rgba(201,168,76,0.22);
  --gold-glow:     rgba(201,168,76,0.06);
  --text-primary:  #f0f4f8;
  --text-secondary:#8fa8c8;
  --text-muted:    #4a6a8a;
  --danger:        #e05252;
  --danger-dim:    rgba(224,82,82,0.10);
  --sidebar-w:     272px;
  --topbar-h:      64px;
}

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

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── LOGIN ────────────────────────────────────────────────── */

.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  background: linear-gradient(145deg, #060f1c 0%, #0b1a2e 45%, #0d1f36 100%);
}

.login-bg-pattern {
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(ellipse at 15% 15%, rgba(201,168,76,0.07) 0%, transparent 55%),
    radial-gradient(ellipse at 85% 85%, rgba(17,34,64,0.8) 0%, transparent 55%),
    radial-gradient(ellipse at 80% 10%, rgba(201,168,76,0.04) 0%, transparent 40%);
  pointer-events: none;
}

.login-card {
  position: relative;
  background: rgba(17,34,64,0.85);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-top: 1px solid rgba(201,168,76,0.18);
  border-radius: 20px;
  padding: 52px 44px 40px;
  width: 100%;
  max-width: 440px;
  box-shadow:
    0 40px 80px rgba(0,0,0,0.7),
    0 0 0 1px rgba(255,255,255,0.03) inset;
  z-index: 1;
}

/* Gold top accent line on login card */
.login-card::before {
  content: '';
  position: absolute;
  top: 0; left: 40px; right: 40px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  border-radius: 0 0 2px 2px;
}

.login-logo {
  text-align: center;
  margin-bottom: 36px;
}

.login-logo-img-wrap {
  width: 90px;
  height: 90px;
  margin: 0 auto 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-logo-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 2px 12px rgba(201,168,76,0.25));
}

.login-logo-fallback {
  width: 90px; height: 90px;
  background: var(--gold-dim);
  border: 1px solid var(--gold-border);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Playfair Display', serif;
  font-size: 28px;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 1px;
}

.login-logo h1 {
  font-family: 'Playfair Display', serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.3px;
  line-height: 1.2;
}

.login-subtitle {
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-top: 5px;
}

.login-divider {
  width: 48px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  margin: 14px auto;
}

.login-slogan {
  color: var(--gold);
  font-size: 13px;
  font-weight: 500;
  font-style: italic;
  letter-spacing: 0.3px;
}

.login-values {
  text-align: center;
  color: var(--text-muted);
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

/* ── FIELDS ───────────────────────────────────────────────── */

.field { margin-bottom: 16px; }

.field label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.field input {
  width: 100%;
  padding: 12px 16px;
  background: rgba(6,15,28,0.6);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.field input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201,168,76,0.10);
}

.field input::placeholder { color: var(--text-muted); }

/* ── BUTTONS ──────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s;
  border-radius: 8px;
  border: 1px solid transparent;
  white-space: nowrap;
  letter-spacing: 0.2px;
}

.btn-primary {
  width: 100%;
  padding: 13px;
  background: linear-gradient(135deg, var(--gold) 0%, #b8963e 100%);
  color: #0a1628;
  font-size: 14px;
  font-weight: 700;
  margin-top: 4px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  box-shadow: 0 4px 16px rgba(201,168,76,0.25);
}
.btn-primary:hover  { background: linear-gradient(135deg, #d4b05a 0%, #c9a84c 100%); box-shadow: 0 6px 20px rgba(201,168,76,0.35); }
.btn-primary:active { transform: scale(0.99); }

.btn-secondary {
  padding: 7px 14px;
  background: linear-gradient(135deg, var(--gold), #b8963e);
  color: #0a1628;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.3px;
}
.btn-secondary:hover { background: linear-gradient(135deg, #d4b05a, #c9a84c); }

.btn-outline {
  padding: 7px 14px;
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border);
  font-size: 13px;
}
.btn-outline:hover { border-color: var(--gold); color: var(--gold); }

.btn-ghost {
  padding: 9px 12px;
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  border-color: transparent;
  width: 100%;
  justify-content: flex-start;
}
.btn-ghost:hover { background: rgba(255,255,255,0.04); color: var(--text-secondary); }

.btn-icon {
  padding: 8px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 18px;
  line-height: 1;
  display: none;
  cursor: pointer;
  border-radius: 6px;
}
.btn-icon:hover { background: rgba(255,255,255,0.05); }

/* ── APP SHELL ────────────────────────────────────────────── */

.app { display: flex; min-height: 100vh; }

/* ── SIDEBAR ──────────────────────────────────────────────── */

.sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(180deg, #0d1f36 0%, #0b1a2e 100%);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 200;
  transition: transform 0.28s cubic-bezier(0.4,0,0.2,1);
}

.sidebar-header {
  padding: 22px 18px 18px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
}

/* Gold top line on sidebar */
.sidebar-header::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

.sidebar-logo-wrap {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-logo-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 1px 6px rgba(201,168,76,0.2));
}

.sidebar-logo-fallback {
  width: 38px; height: 38px;
  background: var(--gold-dim);
  border: 1px solid var(--gold-border);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Playfair Display', serif;
  font-size: 13px;
  font-weight: 700;
  color: var(--gold);
}

.sidebar-logo-name {
  font-family: 'Playfair Display', serif;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
}

.sidebar-logo-sub {
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-top: 2px;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 14px 10px;
}

.nav-group-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-muted);
  padding: 6px 10px 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s;
  margin-bottom: 2px;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
}
.nav-item:hover { background: rgba(255,255,255,0.05); color: var(--text-primary); }
.nav-item.active {
  background: var(--gold-dim);
  color: var(--gold);
  border: 1px solid var(--gold-border);
}

.nav-item-icon {
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.04);
  border-radius: 6px;
  font-size: 13px;
  flex-shrink: 0;
}
.nav-item.active .nav-item-icon { background: rgba(201,168,76,0.12); }

.nav-divider {
  height: 1px;
  background: var(--border);
  margin: 10px 10px;
}

.sidebar-footer {
  padding: 14px 10px 16px;
  border-top: 1px solid var(--border-light);
}

.sidebar-slogan {
  font-size: 10.5px;
  color: var(--gold);
  font-style: italic;
  text-align: center;
  padding: 8px 0 10px;
  opacity: 0.7;
  letter-spacing: 0.3px;
}

/* ── TOP BAR ──────────────────────────────────────────────── */

.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.top-bar {
  height: var(--topbar-h);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky; top: 0; z-index: 100;
}

.top-bar-left { display: flex; align-items: center; gap: 12px; }
.top-bar-left h2 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.top-bar-right { display: flex; align-items: center; gap: 10px; }

.badge-admin {
  background: var(--gold-dim);
  color: var(--gold);
  border: 1px solid var(--gold-border);
  border-radius: 20px;
  padding: 3px 12px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ── CONTENT AREA ─────────────────────────────────────────── */

.content-area { padding: 36px 32px; flex: 1; }

/* ── WELCOME SCREEN ───────────────────────────────────────── */

.welcome-screen {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  min-height: 500px; text-align: center;
}

.welcome-logo-wrap {
  width: 100px; height: 100px;
  margin: 0 auto 24px;
  display: flex; align-items: center; justify-content: center;
}
.welcome-logo-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 4px 20px rgba(201,168,76,0.3));
}
.welcome-logo-fallback {
  width: 100px; height: 100px;
  background: var(--gold-dim);
  border: 1px solid var(--gold-border);
  border-radius: 20px;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Playfair Display', serif;
  font-size: 32px; font-weight: 700;
  color: var(--gold);
}

.welcome-screen h2 {
  font-family: 'Playfair Display', serif;
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text-primary);
}

.welcome-tagline {
  color: var(--text-secondary);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-weight: 500;
  margin-bottom: 10px;
}

.welcome-divider {
  width: 56px; height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  margin: 4px auto 14px;
}

.welcome-slogan {
  color: var(--gold);
  font-size: 14px;
  font-style: italic;
  margin-bottom: 40px;
}

.dept-cards-row {
  display: flex; gap: 12px; flex-wrap: wrap; justify-content: center;
  max-width: 700px;
}

.dept-quick-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 20px;
  display: flex; align-items: center; gap: 10px;
  cursor: pointer;
  font-size: 13px; font-weight: 500;
  color: var(--text-secondary);
  transition: all 0.18s;
  font-family: inherit;
}
.dept-quick-card:hover {
  border-color: var(--gold-border);
  color: var(--gold);
  background: var(--gold-dim);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}

/* ── DEPARTMENT HEADER ────────────────────────────────────── */

.dept-header {
  display: flex; align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 28px; gap: 12px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.dept-header-left { display: flex; align-items: center; gap: 14px; }

.dept-icon-wrap {
  width: 50px; height: 50px;
  background: var(--gold-dim);
  border: 1px solid var(--gold-border);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.dept-header h2 {
  font-family: 'Playfair Display', serif;
  font-size: 20px;
  font-weight: 700;
}

.dept-header-desc {
  color: var(--text-secondary);
  font-size: 13px;
  margin-top: 3px;
}

/* ── LINK CARDS GRID ──────────────────────────────────────── */

.links-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 14px;
}

.link-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: border-color 0.18s, transform 0.18s, box-shadow 0.18s;
  position: relative;
  overflow: hidden;
}

.link-card::after {
  content: '';
  position: absolute; left: 0; top: 10px; bottom: 10px;
  width: 3px;
  background: linear-gradient(180deg, var(--gold), #b8963e);
  border-radius: 0 3px 3px 0;
  opacity: 0;
  transition: opacity 0.18s;
}

.link-card:hover {
  border-color: var(--gold-border);
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(0,0,0,0.4);
}
.link-card:hover::after { opacity: 1; }

.link-card-info { flex: 1; min-width: 0; }

.link-card-name {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-primary);
}

.link-card-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 3px;
}

.link-card-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.link-open-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 7px 14px;
  background: var(--gold-dim);
  color: var(--gold);
  border: 1px solid var(--gold-border);
  border-radius: 7px;
  font-size: 12px; font-weight: 600;
  text-decoration: none;
  transition: all 0.18s;
  letter-spacing: 0.2px;
}
.link-open-btn:hover { background: rgba(201,168,76,0.20); border-color: var(--gold); }

.btn-delete {
  display: none;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  transition: all 0.15s;
}
.btn-delete:hover { color: var(--danger); background: var(--danger-dim); }
.admin-active .btn-delete { display: block; }

.add-card {
  display: none;
  background: transparent;
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 18px 20px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 13px; font-weight: 500;
  font-family: inherit;
  transition: all 0.18s;
  min-height: 74px;
}
.admin-active .add-card { display: flex; }
.add-card:hover { border-color: var(--gold); color: var(--gold); background: var(--gold-dim); }

/* ── MODALS ───────────────────────────────────────────────── */

.modal {
  position: fixed; inset: 0; z-index: 500;
  display: flex; align-items: center; justify-content: center;
}
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(8px);
}
.modal-box {
  position: relative;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-top-color: rgba(201,168,76,0.2);
  border-radius: 18px;
  padding: 32px;
  width: 90%; max-width: 420px;
  box-shadow: 0 32px 64px rgba(0,0,0,0.7);
}
.modal-box::before {
  content: '';
  position: absolute;
  top: 0; left: 40px; right: 40px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  border-radius: 0 0 2px 2px;
}
.modal-box h3 {
  font-family: 'Playfair Display', serif;
  font-size: 18px; font-weight: 700;
  margin-bottom: 20px;
}
.modal-box .field input {
  background: rgba(6,15,28,0.6);
  margin-bottom: 0;
}
.modal-actions {
  display: flex; gap: 10px; margin-top: 16px;
}
.modal-actions .btn-primary { margin-top: 0; }

/* ── ERROR ────────────────────────────────────────────────── */

.err-msg {
  color: var(--danger);
  font-size: 12px;
  text-align: center;
  margin-top: 10px;
}

/* ── UTILITIES ────────────────────────────────────────────── */

.hidden { display: none !important; }

/* ── SCROLLBAR ────────────────────────────────────────────── */

::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── MOBILE ───────────────────────────────────────────────── */

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .btn-icon { display: flex; }
  .content-area { padding: 20px 16px; }
  .links-grid { grid-template-columns: 1fr; }
  .top-bar { padding: 0 16px; }
  .login-card { padding: 36px 24px 28px; margin: 16px; }
  .dept-cards-row { flex-direction: column; align-items: stretch; }
  .dept-header { flex-direction: column; }
}

.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 150;
}
@media (max-width: 768px) {
  .sidebar-overlay.visible { display: block; }
}
