/* ============================================================
   BE:KI Loop – styles.css
   Design-System: Petrol/Türkis, Light & Dark Mode
   ============================================================ */

/* ---- Custom Properties (Light Mode) ---- */
:root {
  --color-primary:        #1e3d73;
  --color-primary-dark:   #162d54;
  --color-primary-light:  #2a4f8f;
  --color-primary-muted:  rgba(30, 61, 115, 0.12);
  --color-secondary:      #3a8c68;
  --color-accent:         #3a8c68;

  --color-bg:             #f0f4f8;
  --color-surface:        #ffffff;
  --color-surface-2:      #f4f7fb;
  --color-border:         #dde3ec;
  --color-border-light:   #eef1f5;

  --color-text:           #1e293b;
  --color-text-muted:     #6b7a8d;
  --color-text-light:     #9ba8bb;

  --color-warning:        #b06a20;
  --color-warning-bg:     #fff4e0;
  --color-warning-border: #ffd280;

  --color-success:        #2d7055;
  --color-success-bg:     #f0faf5;
  --color-success-border: #c8e8d8;

  --color-info:           #1e3d73;
  --color-info-bg:        #e8eef8;
  --color-info-border:    #c8d4ea;

  --color-danger:         #c0392b;
  --color-danger-bg:      #fef2f2;
  --color-danger-border:  #e88080;

  --sidebar-bg:           #1e3d73;
  --sidebar-text:         #b8c8e8;
  --sidebar-text-hover:   #e8eef8;
  --sidebar-active-bg:    rgba(255, 255, 255, 0.16);
  --sidebar-hover-bg:     rgba(255, 255, 255, 0.08);
  --sidebar-border:       rgba(255, 255, 255, 0.10);
  --sidebar-width:        260px;
  --topbar-height:        60px;

  --shadow-xs:  0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-sm:  0 2px 6px rgba(0, 0, 0, 0.08);
  --shadow-md:  0 4px 14px rgba(0, 0, 0, 0.10);
  --shadow-lg:  0 8px 28px rgba(0, 0, 0, 0.12);

  --radius-xs:  4px;
  --radius-sm:  8px;
  --radius-md:  12px;
  --radius-lg:  18px;
  --radius-xl:  24px;
  --radius-full: 9999px;

  --transition: 0.18s ease;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* ---- Dark Mode Overrides ---- */
[data-theme="dark"] {
  --color-bg:             #0d1826;
  --color-surface:        #162338;
  --color-surface-2:      #1c2d45;
  --color-border:         #253a58;
  --color-border-light:   #1e3050;

  --color-text:           #d0dcee;
  --color-text-muted:     #7a9ab8;
  --color-text-light:     #4a6888;

  --color-primary-muted:  rgba(30, 61, 115, 0.25);

  --color-warning-bg:     #2a1800;
  --color-warning-border: #8a5000;
  --color-success-bg:     #0a1f16;
  --color-success-border: #1a5038;
  --color-info-bg:        #0d1a38;
  --color-info-border:    #1e3d73;
  --color-danger-bg:      #1e0000;
  --color-danger-border:  #6a1010;

  --shadow-sm:  0 2px 8px rgba(0, 0, 0, 0.40);
  --shadow-md:  0 4px 16px rgba(0, 0, 0, 0.50);
  --shadow-lg:  0 8px 32px rgba(0, 0, 0, 0.60);
}

/* ============================================================
   Reset & Base
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg);
  min-height: 100vh;
  display: flex;
  transition: background var(--transition), color var(--transition);
}

a { color: var(--color-primary); text-decoration: none; }
a:hover { color: var(--color-primary-light); }

img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: var(--font); }
ul, ol { list-style: none; }

/* ============================================================
   Layout
   ============================================================ */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 300;
  overflow-y: auto;
  overflow-x: hidden;
  transition: transform var(--transition);
}

.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  padding: 2rem 2.5rem;
  overflow-y: auto;
  background: var(--color-bg);
  transition: background var(--transition);
}

.topbar {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--topbar-height);
  background: var(--sidebar-bg);
  z-index: 400;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
  box-shadow: var(--shadow-sm);
}

.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 250;
  backdrop-filter: blur(2px);
}

/* ============================================================
   Sidebar Components
   ============================================================ */
.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.25rem 1rem;
  border-bottom: 1px solid var(--sidebar-border);
  flex-shrink: 0;
}

.sidebar-logo {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
}

.logo-text {
  font-size: 1.35rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.02em;
}

.logo-colon {
  color: var(--color-accent);
  font-weight: 900;
}

.logo-sub {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--sidebar-text);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.topbar-logo {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
}

.theme-toggle {
  background: transparent;
  border: none;
  color: var(--sidebar-text);
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  transition: background var(--transition), color var(--transition);
  flex-shrink: 0;
}

.theme-toggle:hover {
  background: var(--sidebar-hover-bg);
  color: var(--sidebar-text-hover);
}

.sidebar-nav {
  flex: 1;
  padding: 0.75rem 0;
  overflow-y: auto;
}

.sidebar-nav ul { display: flex; flex-direction: column; gap: 2px; }

.nav-divider {
  height: 1px;
  background: var(--sidebar-border);
  margin: 0.5rem 1.25rem;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 1.25rem;
  color: var(--sidebar-text);
  border-radius: 0;
  transition: background var(--transition), color var(--transition);
  position: relative;
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  margin: 0 0.5rem;
  border-radius: var(--radius-sm);
}

.nav-link:hover {
  background: var(--sidebar-hover-bg);
  color: var(--sidebar-text-hover);
}

.nav-link.active {
  background: var(--sidebar-active-bg);
  color: #fff;
}

.nav-link.active::before {
  content: '';
  position: absolute;
  left: 0; top: 25%; bottom: 25%;
  width: 3px;
  background: var(--color-accent);
  border-radius: 0 2px 2px 0;
  margin-left: -0.5rem;
}

.nav-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.85;
}

.nav-icon svg {
  width: 18px;
  height: 18px;
}

.nav-link.active .nav-icon { opacity: 1; }

.nav-label { flex: 1; }

.nav-badge {
  background: var(--color-danger);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  min-width: 18px;
  text-align: center;
  line-height: 1.5;
}

.nav-badge-accent { background: var(--color-warning); }
.nav-badge[style*="display: none"],
.nav-badge:empty { display: none !important; }

.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--sidebar-border);
  flex-shrink: 0;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.user-avatar {
  width: 36px;
  height: 36px;
  background: var(--color-primary);
  color: #fff;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.user-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.user-name {
  color: var(--sidebar-text-hover);
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  color: var(--sidebar-text);
  font-size: 0.75rem;
  opacity: 0.75;
}

/* Mobile Menu Button */
.menu-btn {
  background: transparent;
  border: none;
  width: 40px;
  height: 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0;
}

.hamburger-line {
  width: 22px;
  height: 2px;
  background: #fff;
  border-radius: 2px;
  transition: transform var(--transition), opacity var(--transition);
  display: block;
}

.menu-btn.open .hamburger-line:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.menu-btn.open .hamburger-line:nth-child(2) { opacity: 0; }
.menu-btn.open .hamburger-line:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Loading State */
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  gap: 1rem;
  color: var(--color-text-muted);
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   Section Layout
   ============================================================ */
.section-header {
  margin-bottom: 1.75rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--color-border);
}

.section-header h1 {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--color-text);
  line-height: 1.3;
}

.section-subtitle {
  margin-top: 0.35rem;
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

.section-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 1rem;
  margin-top: 1.75rem;
}

.section-title:first-of-type { margin-top: 0; }

.header-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.header-actions h1 { margin-bottom: 0; border-bottom: none; padding-bottom: 0; }

/* ============================================================
   Cards
   ============================================================ */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition), transform var(--transition), border-color var(--transition);
  overflow: hidden;
}

.card:hover { box-shadow: var(--shadow-md); }

.card-body { padding: 1.25rem; }
.card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.card-footer {
  padding: 0.75rem 1.25rem;
  border-top: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  background: var(--color-surface-2);
}

.card-list {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.55rem 1.1rem;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  transition: background var(--transition), color var(--transition),
              border-color var(--transition), box-shadow var(--transition),
              transform var(--transition);
  cursor: pointer;
  font-family: var(--font);
  white-space: nowrap;
  text-decoration: none;
  line-height: 1.4;
}

.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; }

.btn-primary {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}
.btn-primary:hover { background: var(--color-primary-light); border-color: var(--color-primary-light); color: #fff; }

.btn-secondary {
  background: var(--color-secondary);
  color: #fff;
  border-color: var(--color-secondary);
}
.btn-secondary:hover { background: #24a082; border-color: #24a082; color: #fff; }

.btn-outline {
  background: transparent;
  color: var(--color-primary);
  border-color: var(--color-primary);
}
.btn-outline:hover { background: var(--color-primary-muted); color: var(--color-primary); }

.btn-ghost {
  background: transparent;
  color: var(--color-text-muted);
  border-color: transparent;
}
.btn-ghost:hover { background: var(--color-surface-2); color: var(--color-text); border-color: var(--color-border); }

.btn-danger {
  background: var(--color-danger);
  color: #fff;
  border-color: var(--color-danger);
}
.btn-danger:hover { background: #9a1818; color: #fff; }

.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.8rem; }
.btn-lg { padding: 0.75rem 1.5rem; font-size: 1rem; }

.btn-icon {
  padding: 0.5rem;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
}

.btn svg { width: 15px; height: 15px; flex-shrink: 0; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ============================================================
   Badges & Status Labels
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.6rem;
  font-size: 0.72rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.badge-primary   { background: var(--color-primary-muted); color: var(--color-primary); }
.badge-secondary { background: rgba(44, 184, 150, 0.12); color: var(--color-secondary); }
.badge-success   { background: var(--color-success-bg); color: var(--color-success); }
.badge-warning   { background: var(--color-warning-bg); color: var(--color-warning); }
.badge-danger    { background: var(--color-danger-bg); color: var(--color-danger); }
.badge-info      { background: var(--color-info-bg); color: var(--color-info); }
.badge-muted     { background: var(--color-border); color: var(--color-text-muted); }

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.status-dot-success { background: var(--color-success); }
.status-dot-warning { background: var(--color-warning); }
.status-dot-muted   { background: var(--color-text-light); }

/* ============================================================
   Filter Bars
   ============================================================ */
.filter-bar {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

.filter-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.85rem;
  font-size: 0.82rem;
  font-weight: 500;
  border-radius: var(--radius-full);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all var(--transition);
  font-family: var(--font);
  white-space: nowrap;
}

.filter-pill:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: var(--color-primary-muted);
}

.filter-pill.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}

/* ============================================================
   Search
   ============================================================ */
.search-wrap {
  position: relative;
  max-width: 400px;
}

.search-input {
  width: 100%;
  padding: 0.6rem 1rem 0.6rem 2.5rem;
  font-size: 0.9rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  background: var(--color-surface);
  color: var(--color-text);
  transition: border-color var(--transition), box-shadow var(--transition);
  font-family: var(--font);
}

.search-input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-muted);
}

.search-icon {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--color-text-muted);
  pointer-events: none;
}

.search-icon svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; }

/* ============================================================
   Forms
   ============================================================ */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.form-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text);
}

.form-control {
  padding: 0.6rem 0.9rem;
  font-size: 0.9rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text);
  transition: border-color var(--transition), box-shadow var(--transition);
  font-family: var(--font);
}

.form-control:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-muted);
}

.form-control:disabled {
  background: var(--color-surface-2);
  color: var(--color-text-muted);
  cursor: not-allowed;
}

textarea.form-control { resize: vertical; min-height: 80px; }

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235a7878' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2.5rem;
}

.form-hint {
  font-size: 0.78rem;
  color: var(--color-text-muted);
}

/* ============================================================
   Toast Notifications
   ============================================================ */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.8rem 1.1rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text);
  max-width: 340px;
  pointer-events: auto;
  animation: toast-in 0.25s ease;
  border-left: 4px solid var(--color-primary);
}

.toast.toast-success { border-left-color: var(--color-success); }
.toast.toast-warning { border-left-color: var(--color-warning); }
.toast.toast-error   { border-left-color: var(--color-danger); }
.toast.toast-info    { border-left-color: var(--color-info); }

.toast.toast-out { animation: toast-out 0.25s ease forwards; }

@keyframes toast-in {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes toast-out {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(20px); }
}

.toast-icon { font-size: 1rem; flex-shrink: 0; }
.toast-text { flex: 1; line-height: 1.4; }
.toast-close {
  background: transparent;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  padding: 0;
  line-height: 1;
  font-size: 1rem;
  flex-shrink: 0;
}

/* ============================================================
   Dashboard
   ============================================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.75rem;
}

.stat-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  box-shadow: var(--shadow-xs);
  transition: box-shadow var(--transition);
}

.stat-card:hover { box-shadow: var(--shadow-md); }

.stat-icon-wrap {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--color-primary-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.25rem;
}

.stat-icon-wrap svg {
  width: 20px;
  height: 20px;
  stroke: var(--color-primary);
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.stat-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--color-primary);
  line-height: 1;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  font-weight: 500;
}

/* Quick Access */
.quick-access-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.quick-tile {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 1rem 0.75rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  transition: all var(--transition);
  font-family: var(--font);
  color: var(--color-text);
  text-align: center;
  box-shadow: var(--shadow-xs);
}

.quick-tile:hover {
  background: var(--color-primary-muted);
  border-color: var(--color-primary);
  box-shadow: var(--shadow-sm);
  transform: translateY(-2px);
}

.tile-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tile-icon svg {
  width: 22px;
  height: 22px;
  stroke: var(--color-primary);
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tile-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--color-text-muted);
  line-height: 1.3;
}

.quick-tile:hover .tile-label { color: var(--color-primary); }

/* Info Tile */
.info-tile {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  margin-top: 1.75rem;
  box-shadow: var(--shadow-xs);
  border-left: 4px solid var(--color-primary);
}

.info-tile h3 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 1rem;
}

.info-tile-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}

.info-item strong {
  display: block;
  color: var(--color-primary);
  font-size: 0.875rem;
  margin-bottom: 0.25rem;
}

.info-item p {
  font-size: 0.825rem;
  color: var(--color-text-muted);
  line-height: 1.5;
}

/* ============================================================
   News
   ============================================================ */
.news-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 1.1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  box-shadow: var(--shadow-xs);
  transition: box-shadow var(--transition), border-color var(--transition);
  cursor: pointer;
  position: relative;
}

.news-card:hover { box-shadow: var(--shadow-md); border-color: var(--color-primary); }

.news-card.unread::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--color-primary);
  border-radius: 3px 0 0 3px;
}

.news-card.important::before { background: var(--color-warning); }

.news-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.news-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--color-text);
  line-height: 1.4;
}

.news-card.read .news-title { color: var(--color-text-muted); font-weight: 500; }

.news-excerpt {
  font-size: 0.855rem;
  color: var(--color-text-muted);
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.news-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.news-reactions {
  display: flex;
  gap: 0.4rem;
}

.reaction-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.55rem;
  font-size: 0.78rem;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  color: var(--color-text-muted);
  cursor: pointer;
  font-family: var(--font);
  transition: all var(--transition);
}

.reaction-btn:hover {
  background: var(--color-primary-muted);
  border-color: var(--color-primary);
  color: var(--color-primary);
}

/* ============================================================
   Participation
   ============================================================ */
.participation-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  box-shadow: var(--shadow-xs);
}

.participation-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.participation-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text);
  line-height: 1.4;
}

.participation-description {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  line-height: 1.55;
}

.survey-options {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.survey-option {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.9rem;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: var(--font);
  font-size: 0.875rem;
  color: var(--color-text);
  text-align: left;
  transition: all var(--transition);
}

.survey-option:hover {
  border-color: var(--color-primary);
  background: var(--color-primary-muted);
  color: var(--color-primary);
}

.survey-option.voted {
  border-color: var(--color-primary);
  background: var(--color-primary-muted);
  color: var(--color-primary);
  font-weight: 600;
  cursor: default;
}

.vote-results {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-top: 0.25rem;
}

.vote-result-row {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.vote-result-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.vote-result-label .voted-label { color: var(--color-primary); font-weight: 600; }

.progress-bar {
  height: 8px;
  background: var(--color-border);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--color-primary);
  border-radius: var(--radius-full);
  transition: width 0.6s ease;
}

.progress-fill.top { background: var(--color-secondary); }

.idea-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.idea-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.7rem 1rem;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  gap: 1rem;
}

.idea-text { font-size: 0.875rem; color: var(--color-text); flex: 1; }

.idea-votes {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

/* ============================================================
   Wiki
   ============================================================ */
.wiki-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 1.5rem;
  align-items: start;
}

.wiki-sidebar {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 1rem;
  box-shadow: var(--shadow-xs);
  position: sticky;
  top: 1rem;
}

.wiki-sidebar h3 {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.75rem;
}

.wiki-cat-list { display: flex; flex-direction: column; gap: 2px; }

.wiki-cat-btn {
  display: block;
  width: 100%;
  padding: 0.5rem 0.75rem;
  font-size: 0.85rem;
  font-family: var(--font);
  color: var(--color-text-muted);
  background: transparent;
  border: none;
  border-radius: var(--radius-xs);
  text-align: left;
  cursor: pointer;
  transition: all var(--transition);
}

.wiki-cat-btn:hover { background: var(--color-surface-2); color: var(--color-text); }
.wiki-cat-btn.active { background: var(--color-primary-muted); color: var(--color-primary); font-weight: 600; }

.wiki-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 1.1rem 1.25rem;
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: var(--shadow-xs);
}

.wiki-card:hover { box-shadow: var(--shadow-md); border-color: var(--color-primary); }

.wiki-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 0.4rem;
}

.wiki-excerpt {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  line-height: 1.5;
  margin-bottom: 0.75rem;
}

.wiki-tags { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.wiki-tag {
  display: inline-flex;
  padding: 0.15rem 0.55rem;
  font-size: 0.72rem;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  color: var(--color-text-muted);
}

.wiki-expanded {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  display: none;
}

.wiki-expanded.open { display: block; }

.wiki-content {
  font-size: 0.9rem;
  line-height: 1.7;
  color: var(--color-text);
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--color-border);
}

/* ============================================================
   People
   ============================================================ */
.people-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}

.person-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  box-shadow: var(--shadow-xs);
  transition: box-shadow var(--transition);
}

.person-card:hover { box-shadow: var(--shadow-md); }

.person-avatar-wrap {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.person-avatar {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.1rem;
  color: #fff;
  flex-shrink: 0;
}

.person-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--color-text);
  line-height: 1.3;
}

.person-role {
  font-size: 0.82rem;
  color: var(--color-text-muted);
}

.person-responsibility {
  font-size: 0.82rem;
  color: var(--color-text-muted);
  line-height: 1.5;
  padding-top: 0.25rem;
  border-top: 1px solid var(--color-border-light);
}

/* ============================================================
   Files
   ============================================================ */
.category-tabs {
  display: flex;
  gap: 0.25rem;
  border-bottom: 2px solid var(--color-border);
  margin-bottom: 1.25rem;
  overflow-x: auto;
}

.cat-tab {
  padding: 0.55rem 1rem;
  font-size: 0.875rem;
  font-family: var(--font);
  color: var(--color-text-muted);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  white-space: nowrap;
  font-weight: 500;
  transition: all var(--transition);
}

.cat-tab:hover { color: var(--color-primary); }
.cat-tab.active { color: var(--color-primary); border-bottom-color: var(--color-primary); font-weight: 600; }

.files-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.file-row {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1.1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--shadow-xs);
  transition: border-color var(--transition);
}

.file-row:hover { border-color: var(--color-primary); }

.file-icon-wrap {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
}

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

.file-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-meta-row {
  font-size: 0.78rem;
  color: var(--color-text-muted);
  margin-top: 0.15rem;
  display: flex;
  gap: 0.5rem;
}

.file-actions {
  display: flex;
  gap: 0.4rem;
  flex-shrink: 0;
}

/* ============================================================
   Events
   ============================================================ */
.events-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
}

.event-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
  transition: box-shadow var(--transition);
  display: flex;
}

.event-card:hover { box-shadow: var(--shadow-md); }

.event-date-stripe {
  width: 58px;
  background: var(--color-primary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 0.5rem;
  flex-shrink: 0;
  color: #fff;
  text-align: center;
}

.event-day {
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1;
}

.event-month {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  opacity: 0.85;
  margin-top: 0.2rem;
}

.event-body {
  flex: 1;
  padding: 0.9rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.event-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--color-text);
  line-height: 1.4;
}

.event-details {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.event-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.5rem;
}

.attend-btn {
  font-size: 0.8rem;
  padding: 0.35rem 0.75rem;
}

.attend-btn.attending {
  background: var(--color-success-bg);
  border-color: var(--color-success-border);
  color: var(--color-success);
}

.capacity-label {
  font-size: 0.78rem;
  color: var(--color-text-light);
}

/* ============================================================
   Chat
   ============================================================ */
.chat-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 1rem;
  height: calc(100vh - 200px);
  min-height: 400px;
}

.channel-list {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow-y: auto;
  box-shadow: var(--shadow-xs);
}

.channel-list-header {
  padding: 0.85rem 1rem;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--color-border);
}

.channel-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.65rem 1rem;
  cursor: pointer;
  font-family: var(--font);
  font-size: 0.875rem;
  color: var(--color-text-muted);
  background: transparent;
  border: none;
  width: 100%;
  text-align: left;
  transition: all var(--transition);
  border-radius: 0;
}

.channel-item:hover { background: var(--color-surface-2); color: var(--color-text); }
.channel-item.active { background: var(--color-primary-muted); color: var(--color-primary); font-weight: 600; }

.channel-icon { font-size: 0.9rem; flex-shrink: 0; }

.chat-area {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}

.chat-header {
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
  background: var(--color-surface-2);
}

.chat-header-title { font-size: 0.95rem; font-weight: 700; color: var(--color-text); }
.chat-header-desc  { font-size: 0.78rem; color: var(--color-text-muted); }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  scroll-behavior: smooth;
}

.message {
  display: flex;
  flex-direction: column;
  max-width: 72%;
  gap: 0.2rem;
}

.message.mine { align-self: flex-end; align-items: flex-end; }
.message:not(.mine) { align-self: flex-start; }

.message-bubble {
  padding: 0.6rem 0.9rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--color-text);
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
}

.message.mine .message-bubble {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}

.message-meta {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  font-size: 0.72rem;
  color: var(--color-text-light);
  padding: 0 0.25rem;
}

.message-sender { font-weight: 600; color: var(--color-text-muted); }

.chat-input {
  padding: 0.85rem 1.25rem;
  border-top: 1px solid var(--color-border);
  background: var(--color-surface-2);
  flex-shrink: 0;
}

.chat-input-form {
  display: flex;
  gap: 0.6rem;
  align-items: flex-end;
}

.chat-input-field {
  flex: 1;
  padding: 0.6rem 0.9rem;
  font-size: 0.875rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text);
  font-family: var(--font);
  resize: none;
  transition: border-color var(--transition);
}

.chat-input-field:focus {
  outline: none;
  border-color: var(--color-primary);
}

/* ============================================================
   Admin
   ============================================================ */
.demo-banner {
  background: var(--color-warning-bg);
  border: 1px solid var(--color-warning-border);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 1.5rem;
  font-size: 0.875rem;
  color: var(--color-warning);
}

.demo-banner-icon { font-size: 1.2rem; flex-shrink: 0; }
.demo-banner strong { color: var(--color-warning); }

.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.admin-section-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
  opacity: 0.75;
}

.admin-section-card .card-header {
  background: var(--color-surface-2);
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--color-text);
}

.admin-section-card .card-body {
  padding: 1rem 1.25rem;
}

.admin-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-bottom: 0.75rem;
}

.admin-field:last-child { margin-bottom: 0; }

.admin-field label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--color-text-muted);
}

.admin-field input,
.admin-field select {
  padding: 0.5rem 0.75rem;
  font-size: 0.85rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xs);
  background: var(--color-surface-2);
  color: var(--color-text-muted);
  font-family: var(--font);
  cursor: not-allowed;
}

/* ============================================================
   Shared Utilities
   ============================================================ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1rem;
  text-align: center;
  gap: 0.75rem;
  color: var(--color-text-muted);
}

.empty-state-icon { font-size: 2.5rem; opacity: 0.5; }
.empty-state h3 { font-size: 0.95rem; font-weight: 600; color: var(--color-text); }
.empty-state p { font-size: 0.85rem; max-width: 280px; line-height: 1.55; }

.divider {
  height: 1px;
  background: var(--color-border);
  margin: 1.25rem 0;
}

.text-muted    { color: var(--color-text-muted); }
.text-primary  { color: var(--color-primary); }
.text-success  { color: var(--color-success); }
.text-warning  { color: var(--color-warning); }
.text-danger   { color: var(--color-danger); }
.text-sm       { font-size: 0.825rem; }
.text-xs       { font-size: 0.75rem; }
.font-bold     { font-weight: 700; }
.font-medium   { font-weight: 500; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-sm { gap: 0.5rem; }
.gap-md { gap: 1rem; }
.mt-sm { margin-top: 0.5rem; }
.mt-md { margin-top: 1rem; }

/* ============================================================
   Responsive – Tablet (≤ 1024px)
   ============================================================ */
@media (max-width: 1024px) {
  .stats-grid         { grid-template-columns: repeat(2, 1fr); }
  .quick-access-grid  { grid-template-columns: repeat(3, 1fr); }
  .info-tile-grid     { grid-template-columns: 1fr; }
  .wiki-layout        { grid-template-columns: 1fr; }
  .wiki-sidebar       { position: static; }
  .wiki-cat-list      { flex-direction: row; flex-wrap: wrap; gap: 0.4rem; }
  .wiki-cat-btn       { width: auto; }
  .chat-layout        { grid-template-columns: 1fr; height: auto; }
  .channel-list       { display: flex; flex-wrap: wrap; gap: 0.5rem; padding: 0.75rem; border-radius: var(--radius-md); }
  .channel-list-header { display: none; }
  .channel-item       { width: auto; border-radius: var(--radius-sm); padding: 0.4rem 0.85rem; }
}

/* ============================================================
   Responsive – Mobile (≤ 768px)
   ============================================================ */
@media (max-width: 768px) {
  .topbar  { display: flex; }
  .overlay { display: none; }
  .overlay.active { display: block; }

  .sidebar {
    transform: translateX(-100%);
    top: 0;
    z-index: 350;
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }

  .main-content {
    margin-left: 0;
    padding: 1rem;
    padding-top: calc(var(--topbar-height) + 1rem);
  }

  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 0.75rem; }
  .quick-access-grid { grid-template-columns: repeat(3, 1fr); gap: 0.5rem; }
  .events-grid { grid-template-columns: 1fr; }
  .people-grid { grid-template-columns: 1fr; }

  .file-row { flex-wrap: wrap; }
  .file-actions { width: 100%; justify-content: flex-end; }

  .chat-layout { grid-template-columns: 1fr; }
  .channel-list { display: flex; overflow-x: auto; flex-wrap: nowrap; gap: 0; padding: 0; border-radius: var(--radius-md); border: 1px solid var(--color-border); }
  .channel-item { flex-shrink: 0; }

  .section-header h1 { font-size: 1.3rem; }

  .toast-container { bottom: 1rem; right: 1rem; left: 1rem; }
  .toast { max-width: 100%; }

  .admin-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   Responsive – Small Mobile (≤ 480px)
   ============================================================ */
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .quick-access-grid { grid-template-columns: repeat(2, 1fr); }
  .filter-bar { gap: 0.35rem; }
  .filter-pill { font-size: 0.78rem; padding: 0.3rem 0.65rem; }
  .news-card-top { flex-direction: column; gap: 0.5rem; }
  .news-reactions { flex-wrap: wrap; }
}
