:root {
  --fulton-blue: #0b3d78;
  --fulton-blue-dark: #082a54;
  --fulton-blue-light: #eaf1fb;
  --fulton-gold: #d4a017;
  --sidebar-bg: #0a1f3d;
  --sidebar-bg-active: rgba(255, 255, 255, 0.08);
  --sidebar-text: #b7c4dc;
  --sidebar-text-active: #ffffff;
  --bg: #f3f5f9;
  --surface: #ffffff;
  --text-main: #1e2530;
  --text-muted: #6b7684;
  --border: #e7eaf0;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow: 0 1px 3px rgba(16, 24, 40, 0.06), 0 8px 24px -12px rgba(16, 24, 40, 0.12);
  --sidebar-width: 260px;
}

* { box-sizing: border-box; }

html, body {
  background-color: var(--bg);
  color: var(--text-main);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

body { font-size: 0.9375rem; }

h1, h2, h3, h4, h5, h6 { font-weight: 700; letter-spacing: -0.01em; }

a { text-decoration: none; }

/* ---------------------------------------------------------------
   App shell: sidebar + main content
--------------------------------------------------------------- */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--sidebar-bg);
  background-image: linear-gradient(180deg, #0a1f3d 0%, #071730 100%);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 1030;
  transition: transform 0.25s ease;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.5rem 1.25rem 1.25rem;
  color: #fff;
  font-weight: 800;
  font-size: 0.95rem;
  line-height: 1.3;
}

.sidebar-brand small {
  font-weight: 500;
  color: var(--sidebar-text);
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.sidebar-brand-logo {
  max-width: 100%;
  max-height: 56px;
  width: auto;
  height: auto;
  background: #fff;
  border-radius: 10px;
  padding: 0.4rem 0.6rem;
}

.sidebar-brand-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--fulton-gold), #b5860a);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  color: #1a1400;
  flex-shrink: 0;
}

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

.sidebar-section {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(183, 196, 220, 0.5);
  padding: 1rem 0.75rem 0.4rem;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 2px;
  transition: background 0.15s ease, color 0.15s ease;
}

.sidebar-link i { font-size: 1rem; width: 1.1rem; text-align: center; }

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

.sidebar-link.active {
  background: var(--fulton-gold);
  color: #1a1400;
  font-weight: 600;
}

.sidebar-footer {
  padding: 0.9rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

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

.sidebar-user .avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--fulton-blue-light);
  color: var(--fulton-blue);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.sidebar-user .avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sidebar-brand-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 12px;
}

.profile-photo-preview {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--border);
}

.profile-photo-placeholder {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: var(--fulton-blue-light);
  color: var(--fulton-blue);
  font-weight: 700;
  font-size: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
}

.brand-logo-preview {
  max-width: 160px;
  max-height: 60px;
  object-fit: contain;
}

.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-info .name { color: #fff; font-size: 0.82rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-info .role { color: var(--sidebar-text); font-size: 0.72rem; text-transform: capitalize; }

.logout-btn {
  color: var(--sidebar-text);
  font-size: 1.1rem;
  padding: 0.25rem;
  flex-shrink: 0;
}
.logout-btn:hover { color: #fff; }

/* ---------------------------------------------------------------
   Main content area
--------------------------------------------------------------- */
.app-main {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 1rem 1.75rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 1010;
}

.topbar-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0;
  color: var(--text-main);
}

.sidebar-toggle {
  display: none;
  border: none;
  background: transparent;
  font-size: 1.35rem;
  color: var(--text-main);
  padding: 0.25rem;
}

.content {
  flex: 1;
  padding: 1.75rem;
}

.app-footer {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
  padding: 1.25rem;
}

/* ---------------------------------------------------------------
   Cards, tables, badges
--------------------------------------------------------------- */
.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.card-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  padding: 0.9rem 1.25rem;
}

.card-body { padding: 1.25rem; }

.shadow-sm { box-shadow: var(--shadow) !important; }

.table { font-size: 0.875rem; margin-bottom: 0; }
.table thead th {
  text-transform: uppercase;
  font-size: 0.68rem;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 700;
  border-bottom: 1px solid var(--border);
  background: #fafbfc;
}
.table td, .table th { padding: 0.75rem 1rem; vertical-align: middle; }
.table-hover tbody tr:hover { background-color: var(--fulton-blue-light); }

.badge { font-weight: 600; padding: 0.35em 0.65em; border-radius: 999px; font-size: 0.72rem; }

.btn { border-radius: var(--radius-sm); font-weight: 600; font-size: 0.875rem; }
.btn-primary { background: var(--fulton-blue); border-color: var(--fulton-blue); }
.btn-primary:hover { background: var(--fulton-blue-dark); border-color: var(--fulton-blue-dark); }

.form-control, .form-select {
  border-radius: var(--radius-sm);
  border-color: var(--border);
  font-size: 0.875rem;
}
.form-control:focus, .form-select:focus {
  border-color: var(--fulton-blue);
  box-shadow: 0 0 0 3px rgba(11, 61, 120, 0.12);
}

.nav-pills .nav-link { border-radius: var(--radius-sm); font-weight: 600; font-size: 0.875rem; color: var(--text-muted); }
.nav-pills .nav-link.active { background: var(--fulton-blue); }

/* ---------------------------------------------------------------
   Stat tiles
--------------------------------------------------------------- */
.stat-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 1.1rem 1.25rem;
  box-shadow: var(--shadow-sm);
  height: 100%;
}

.stat-icon {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
  background: var(--fulton-blue-light);
  color: var(--fulton-blue);
}

.stat-card.warning .stat-icon { background: #fdf3d9; color: #b5860a; }
.stat-card.critical .stat-icon { background: #fde2e2; color: #c62828; }
.stat-card.success .stat-icon { background: #dcf3e6; color: #1a7d43; }

.stat-value { font-size: 1.6rem; font-weight: 800; line-height: 1.1; color: var(--text-main); }
.stat-label { font-size: 0.78rem; color: var(--text-muted); font-weight: 600; margin-top: 0.15rem; }

/* ---------------------------------------------------------------
   Auth pages (login / register) keep their own full-page layout
--------------------------------------------------------------- */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--fulton-blue), var(--fulton-blue-dark));
}

.auth-card {
  max-width: 440px;
  width: 100%;
  border-radius: var(--radius);
  border: none;
}

/* ---------------------------------------------------------------
   Ticket conversation bubbles
--------------------------------------------------------------- */
.comment-bubble {
  border-radius: var(--radius-sm);
  padding: 0.85rem 1.1rem;
  margin-bottom: 0.75rem;
}

.comment-bubble.public {
  background: var(--fulton-blue-light);
  border-left: 3px solid var(--fulton-blue);
}

.comment-bubble.internal {
  background: #fff8e6;
  border-left: 3px solid var(--fulton-gold);
}

/* ---------------------------------------------------------------
   Responsive: collapse sidebar off-canvas on small screens
--------------------------------------------------------------- */
@media (max-width: 991px) {
  .sidebar {
    transform: translateX(-100%);
    box-shadow: 0 0 0 100vmax rgba(0,0,0,0);
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 8px 0 24px rgba(0,0,0,0.15);
  }
  .app-main { margin-left: 0; }
  .sidebar-toggle { display: inline-flex; align-items: center; justify-content: center; }
  .content { padding: 1.25rem; }
  .topbar { padding: 0.85rem 1.25rem; }
}
