:root {
  --primary: #c8102e; /* SDP Red accent */
  --primary-hover: #a50d24;
  --primary-light: #fff0f2;
  --text-main: #1f2937;
  --text-muted: #6b7280;
  --bg-page: #f3f4f6;
  --bg-card: #ffffff;
  --border-color: #e5e7eb;
  --border-focus: #c8102e;
  --input-border: #d1d5db;
  --error-bg: #fee2e2;
  --error-text: #991b1b;
  --success-bg: #dcfce7;
  --success-text: #166534;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Visually Hidden Utility for Accessibility */
.visually-hidden {
  position: absolute;
  clip-path: inset(50%);
  overflow: hidden;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  white-space: nowrap;
}

/* Page Container */
.auth-wrapper {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 1.5rem;
}

.auth-card {
  background: var(--bg-card);
  width: 100%;
  max-width: 440px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 2.25rem 2rem;
  border: 1px solid var(--border-color);
}

.brand-header {
  text-align: center;
  margin-bottom: 2rem;
}

.brand-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-color: var(--primary);
  color: #ffffff;
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: 0.05em;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  margin-bottom: 0.75rem;
}

.brand-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-main);
}

.brand-header p {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* Form Styles */
.form-group {
  margin-bottom: 1.25rem;
}

label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 0.375rem;
}

.input-container {
  position: relative;
  display: flex;
  align-items: center;
}

input[type="text"],
input[type="email"],
input[type="password"] {
  width: 100%;
  min-height: 48px;
  padding: 0.75rem 1rem;
  font-size: 0.95rem;
  border: 1px solid var(--input-border);
  border-radius: var(--radius-md);
  background-color: #ffffff;
  color: var(--text-main);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input[type="password"],
.has-icon-right {
  padding-right: 3rem;
}

input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(200, 16, 46, 0.15);
}

.toggle-password-btn {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  min-width: 40px;
  min-height: 40px;
}

.toggle-password-btn:hover {
  color: var(--text-main);
}

.toggle-password-btn:focus-visible {
  outline: 2px solid var(--border-focus);
}

/* Options Row */
.form-options {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  font-size: 0.875rem;
}

.remember-label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: normal;
  color: var(--text-muted);
  cursor: pointer;
  margin-bottom: 0;
}

.remember-label input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  accent-color: var(--primary);
  cursor: pointer;
}

.link-btn {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

.link-btn:hover {
  text-decoration: underline;
  color: var(--primary-hover);
}

.link-btn:focus-visible {
  outline: 2px solid var(--border-focus);
  border-radius: 2px;
}

/* Submit Button */
.btn-primary {
  width: 100%;
  min-height: 48px;
  background-color: var(--primary);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: background-color 0.15s ease, transform 0.05s ease;
}

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

.btn-primary:active {
  transform: scale(0.99);
}

.btn-primary:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

.btn-primary:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.btn-secondary {
  min-height: 44px;
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-main);
  border-radius: var(--radius-md);
  padding: 0.5rem 1rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  line-height: 1;
}

.btn-secondary:hover {
  background: var(--bg-page);
}

/* Alerts */
.alert {
  padding: 0.875rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  margin-bottom: 1.25rem;
  display: none;
  align-items: flex-start;
  gap: 0.5rem;
}

.alert.show {
  display: flex;
}

.alert-error {
  background-color: var(--error-bg);
  color: var(--error-text);
  border: 1px solid #fecaca;
}

.alert-success {
  background-color: var(--success-bg);
  color: var(--success-text);
  border: 1px solid #bbf7d0;
}

/* Modal Dialog - Fade in and Fade out Animations */
dialog {
  border: none;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 2rem;
  max-width: 480px;
  width: 90%;
  margin: auto;
  background: var(--bg-card);

  /* Closed / Starting exit state */
  opacity: 0;
  transform: scale(0.95) translateY(-8px);

  /* Modern top-layer transition including allow-discrete */
  transition-property: opacity, transform, display, overlay;
  transition-duration: 0.25s;
  transition-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
  transition-behavior: allow-discrete;
}

/* Open / Visible State */
dialog[open] {
  opacity: 1;
  transform: scale(1) translateY(0);

  /* Smooth entry transition starting point */
  @starting-style {
    opacity: 0;
    transform: scale(0.95) translateY(-8px);
  }
}

/* Explicit closing state for smooth exit animation */
dialog.is-closing {
  opacity: 0 !important;
  transform: scale(0.95) translateY(-8px) !important;
  transition-property: opacity, transform, display, overlay;
  transition-duration: 0.25s;
  transition-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
  transition-behavior: allow-discrete;
}

/* Backdrop Styling & Animation */
dialog::backdrop {
  background-color: rgba(0, 0, 0, 0);
  backdrop-filter: blur(0px);

  transition-property: background-color, backdrop-filter, display, overlay;
  transition-duration: 0.25s;
  transition-timing-function: ease-out;
  transition-behavior: allow-discrete;
}

dialog[open]::backdrop {
  background-color: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(2px);

  @starting-style {
    background-color: rgba(0, 0, 0, 0);
    backdrop-filter: blur(0px);
  }
}

dialog.is-closing::backdrop {
  background-color: rgba(0, 0, 0, 0) !important;
  backdrop-filter: blur(0px) !important;
  transition-property: background-color, backdrop-filter, display, overlay;
  transition-duration: 0.25s;
  transition-timing-function: ease-out;
  transition-behavior: allow-discrete;
}

/* Motion accessibility preference */
@media (prefers-reduced-motion: reduce) {
  dialog {
    transform: none;
    transition-duration: 0.1s;
  }
  @starting-style {
    dialog[open] {
      transform: none;
    }
  }
}

dialog h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

dialog p {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

.dialog-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  margin-top: 1.5rem;
}

/* Confirmation Dialog (Unsaved Changes Prompt) */
dialog.confirm-dialog {
  max-width: 460px;
  padding: 1.75rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-lg);
  z-index: 1000;
}

.confirm-dialog-content {
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
}

.confirm-dialog-icon {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #fef3c7;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #d97706;
}

.confirm-dialog-body {
  flex: 1;
}

.confirm-dialog-title {
  margin: 0 0 0.5rem 0;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.3;
}

.confirm-dialog-message {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Dashboard Styles */
.dashboard-nav {
  background: #ffffff;
  border-bottom: 1px solid var(--border-color);
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.nav-brand .badge {
  background: var(--primary);
  color: white;
  font-weight: 800;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
}

.nav-brand .title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-main);
}

/* User Menu & Avatar */
.user-menu-container {
  position: relative;
  display: inline-block;
  flex-shrink: 0;
}

.user-avatar-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  background: var(--bg-page);
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.user-avatar-btn:hover {
  background: #ffffff;
  border-color: var(--primary);
  color: var(--primary);
  box-shadow: 0 0 0 3px rgba(200, 16, 46, 0.1);
}

.user-avatar-btn:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

.user-menu-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 250px;
  background: #ffffff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
  z-index: 100;
  display: none;
  flex-direction: column;
  overflow: hidden;
  animation: fadeIn 0.15s ease;
}

.user-menu-dropdown.show {
  display: flex;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.user-menu-header {
  padding: 0.85rem 1rem;
  background: #fafafa;
}

.menu-fullname {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-main);
}

.menu-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
  word-break: break-all;
}

.menu-divider {
  height: 1px;
  background: var(--border-color);
  width: 100%;
}

.user-menu-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.75rem 1rem;
  border: none;
  background: transparent;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-main);
  cursor: pointer;
  text-align: left;
  transition: background-color 0.15s ease;
}

.user-menu-item:hover {
  background: var(--bg-page);
}

.user-menu-item.text-danger {
  color: var(--primary);
}

.user-menu-item.text-danger:hover {
  background: var(--primary-light);
}

.form-row-responsive {
  display: flex;
  gap: 1rem;
}

.dashboard-container {
  max-width: 1100px;
  margin: 2rem auto;
  padding: 0 1.5rem;
  width: 100%;
  animation: tabFadeIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.dashboard-hero {
  background: #ffffff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  padding: 2.5rem;
  box-shadow: var(--shadow-sm);
  text-align: center;
  margin-bottom: 2rem;
}

.dashboard-hero h2 {
  font-size: 1.75rem;
  margin-bottom: 0.5rem;
  color: var(--text-main);
}

.dashboard-hero p {
  color: var(--text-muted);
  max-width: 600px;
  margin: 0 auto;
}

.user-details-card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  padding: 1.75rem;
  box-shadow: var(--shadow-sm);
}

.user-details-card h3 {
  font-size: 1.1rem;
  margin-bottom: 1rem;
  color: var(--text-main);
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.5rem;
}

.details-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.detail-item .label {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 0.05em;
}

.detail-item .value {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main);
  margin-top: 0.2rem;
}

.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #ffffff;
  animation: spin 0.8s ease-in-out infinite;
}

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

@media (max-width: 768px) {
  .nav-links-desktop {
    display: none !important;
  }

  .mobile-menu-container {
    display: inline-block;
  }

  .dashboard-nav {
    padding: 0.75rem 1rem;
  }

  .notification-toggle-btn {
    width: 44px;
    height: 44px;
    min-height: unset;
    padding: 0;
    justify-content: center;
    border-radius: 50%;
  }

  .notification-toggle-btn .btn-label {
    display: none;
  }
}

@media (max-width: 640px) {
  .form-row-responsive {
    flex-direction: column;
    gap: 0;
  }
  .user-menu-dropdown {
    right: 0;
    min-width: 220px;
  }
}

@media (max-width: 480px) {
  .dashboard-nav {
    padding: 0.5rem 0.75rem;
    gap: 0.5rem;
  }

  .nav-brand {
    gap: 0.4rem;
    min-width: 0;
  }

  .nav-brand .title {
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
  }

  .nav-actions {
    gap: 0.35rem;
  }

  .user-avatar-btn,
  .nav-calendar-btn,
  .mobile-menu-btn,
  .notification-toggle-btn {
    width: 38px;
    height: 38px;
    min-width: 38px;
    flex-shrink: 0;
  }

  .user-menu-dropdown,
  .mobile-menu-dropdown {
    right: 0;
    max-width: calc(100vw - 1.5rem);
  }
}

@media (max-width: 360px) {
  .nav-brand .title {
    display: none;
  }
}

/* ==========================================================================
   Navigation Links, Actions & Mobile Menu
   ========================================================================== */
.nav-links {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: 1rem;
}

.nav-link {
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-md);
  transition: all 0.15s ease;
  white-space: nowrap;
}

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

.nav-link.active {
  color: var(--primary);
  background-color: var(--primary-light);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

/* Always visible Calendar tab button */
.nav-calendar-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  background: var(--bg-page);
  color: var(--text-main);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.nav-calendar-btn:hover {
  background: #ffffff;
  border-color: var(--primary);
  color: var(--primary);
  box-shadow: 0 0 0 3px rgba(200, 16, 46, 0.1);
}

.nav-calendar-btn.active {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary);
}

.nav-calendar-btn:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

/* Mobile Menu (Hamburger) Button & Dropdown */
.mobile-menu-container {
  position: relative;
  display: none;
  flex-shrink: 0;
}

.mobile-menu-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  background: var(--bg-page);
  color: var(--text-main);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.mobile-menu-btn:hover {
  background: #ffffff;
  border-color: var(--primary);
  color: var(--primary);
  box-shadow: 0 0 0 3px rgba(200, 16, 46, 0.1);
}

.mobile-menu-btn:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

.mobile-menu-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 200px;
  background: #ffffff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
  z-index: 100;
  display: none;
  flex-direction: column;
  padding: 0.35rem 0;
  animation: fadeIn 0.15s ease;
}

.mobile-menu-dropdown.show {
  display: flex;
}

.mobile-menu-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-main);
  transition: background-color 0.15s ease;
}

.mobile-menu-link:hover {
  background-color: var(--bg-page);
  color: var(--primary);
}

.mobile-menu-link.active {
  color: var(--primary);
  background-color: var(--primary-light);
  font-weight: 600;
}

.notification-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 40px;
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: #ffffff;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.notification-toggle-btn:hover {
  background: var(--bg-page);
  color: var(--text-main);
}

.notification-toggle-btn.granted {
  border-color: #86efac;
  background-color: #f0fdf4;
  color: #166534;
}

/* ==========================================================================
   Tab Fade-In Animations & Page Transitions
   ========================================================================== */
@view-transition {
  navigation: auto;
}

@keyframes tabFadeIn {
  0% {
    opacity: 0;
    transform: translateY(6px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.tab-fade-in {
  animation: tabFadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* ==========================================================================
   Calendar Styles (Always visible as a whole across all devices & views)
   ========================================================================== */
:root {
  --time-col-w: 52px;
}

.calendar-page-container {
  max-width: 1400px;
  width: 100%;
  margin: 0.75rem auto;
  padding: 0 1rem;
  height: calc(100dvh - 76px);
  min-height: 520px;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  animation: tabFadeIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.calendar-card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  height: 100%;
}

.calendar-toolbar {
  flex-shrink: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.65rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  gap: 0.75rem;
  flex-wrap: wrap;
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-width: 0;
}

.calendar-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
  text-transform: capitalize;
  white-space: nowrap;
}

.toolbar-nav-group {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

.btn-today {
  min-height: 36px;
  padding: 0.3rem 0.75rem;
  font-size: 0.85rem;
}

.btn-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: #ffffff;
  color: var(--text-main);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.15s ease;
  flex-shrink: 0;
}

.btn-icon:hover {
  background: var(--bg-page);
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-shrink: 0;
}

.view-toggle {
  display: flex;
  background: var(--bg-page);
  padding: 3px;
  border-radius: var(--radius-md);
  flex-shrink: 0;
}

.view-btn {
  border: none;
  background: transparent;
  padding: 0.35rem 0.75rem;
  border-radius: calc(var(--radius-md) - 2px);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.view-btn.active {
  background: #ffffff;
  color: var(--text-main);
  box-shadow: var(--shadow-sm);
}

.btn-add-event {
  width: auto;
  padding: 0 0.85rem;
  min-height: 36px;
  font-size: 0.85rem;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Calendar Switcher & Filter Bar */
.calendar-filter-bar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.4rem 1.25rem;
  background: #f8fafc;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.85rem;
  flex-wrap: wrap;
}

.cal-filter-select {
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--input-border);
  background: #ffffff;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-main);
  min-height: 32px;
  max-width: 320px;
}

/* Month Grid */
.calendar-grid-wrapper {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  height: 100%;
  animation: tabFadeIn 0.25s cubic-bezier(0.16, 1, 0.3, 1) both;
  overflow: hidden;
}

.calendar-weekdays {
  flex-shrink: 0;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  background: #fafafa;
  border-bottom: 1px solid var(--border-color);
  text-align: center;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  padding: 0.45rem 0;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.calendar-days-grid {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-template-rows: repeat(6, 1fr);
  background: var(--border-color);
  gap: 1px;
  height: 100%;
}

.calendar-day-cell {
  background: #ffffff;
  height: 100%;
  min-height: 0;
  padding: 0.3rem 0.4rem;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: background-color 0.1s ease;
  overflow: hidden;
}

.calendar-day-cell:hover {
  background-color: #fbfbfb;
}

.calendar-day-cell.other-month {
  background: #fafafa;
  color: #9ca3af;
}

.calendar-day-cell.today .day-number {
  background: var(--primary);
  color: #ffffff;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8rem;
}

.day-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2px;
  flex-shrink: 0;
}

.day-number {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1;
}

.events-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
  flex: 1;
  min-height: 0;
}

.calendar-event-pill {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 1px 4px;
  border-radius: 3px;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 3px;
  cursor: pointer;
  transition: opacity 0.15s ease, transform 0.05s ease;
  min-height: 17px;
  line-height: 1.2;
}

.calendar-event-pill:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.pill-time {
  font-size: 0.68rem;
  opacity: 0.9;
  flex-shrink: 0;
}

/* ==========================================================================
   Week & Day Views
   ========================================================================== */
.week-view-container,
.day-view-container {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: #ffffff;
  height: 100%;
  width: 100%;
  overflow: hidden;
  animation: tabFadeIn 0.25s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.time-grid-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
  background: #ffffff;
  width: 100%;
}

/* Week View Layout */
.week-header-row {
  flex-shrink: 0;
  display: grid;
  grid-template-columns: var(--time-col-w) repeat(7, minmax(0, 1fr));
  background: #fafafa;
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 5;
  text-align: center;
  width: 100%;
  min-width: 0;
}

.week-header-corner {
  padding: 0.45rem 0.2rem;
  border-right: 1px solid var(--border-color);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  text-transform: uppercase;
}

.week-header-cell {
  padding: 0.35rem 0.15rem;
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  min-width: 0;
  overflow: hidden;
}

.week-header-cell:last-child {
  border-right: none;
}

.week-day-name {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  white-space: nowrap;
}

.week-day-number {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-main);
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.week-header-cell.today .week-day-number {
  background: var(--primary);
  color: #ffffff;
}

.week-header-cell.today .week-day-name {
  color: var(--primary);
}

.week-allday-row {
  flex-shrink: 0;
  display: grid;
  grid-template-columns: var(--time-col-w) repeat(7, minmax(0, 1fr));
  width: 100%;
  min-width: 0;
  background: #fbfbfb;
  border-bottom: 2px solid var(--border-color);
  padding: 3px 0;
  font-size: 0.75rem;
}

.day-allday-row {
  flex-shrink: 0;
  display: grid;
  grid-template-columns: var(--time-col-w) 1fr;
  width: 100%;
  background: #fbfbfb;
  border-bottom: 2px solid var(--border-color);
  padding: 3px 0;
}

.allday-label {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-muted);
  text-align: right;
  padding: 3px 6px;
  border-right: 1px solid var(--border-color);
  text-transform: uppercase;
  white-space: nowrap;
}

.allday-slot {
  padding: 2px 3px;
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  overflow: hidden;
}

.allday-slot:last-child {
  border-right: none;
}

.week-time-grid {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-width: 0;
}

.week-hour-row {
  display: grid;
  grid-template-columns: var(--time-col-w) repeat(7, minmax(0, 1fr));
  min-height: 42px;
  border-bottom: 1px solid #f3f4f6;
  width: 100%;
}

.time-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 0.25rem;
  text-align: center;
  border-right: 1px solid var(--border-color);
  background: #fafafa;
  user-select: none;
  white-space: nowrap;
}

.week-time-slot {
  border-right: 1px solid #f3f4f6;
  padding: 1px 2px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  cursor: pointer;
  transition: background-color 0.1s ease;
  position: relative;
  min-width: 0;
  overflow: hidden;
}

.week-time-slot:last-child {
  border-right: none;
}

.week-time-slot:hover {
  background-color: #fafbfc;
}

/* Day View Layout */
.day-time-grid {
  display: flex;
  flex-direction: column;
  width: 100%;
}

.day-hour-row {
  display: grid;
  grid-template-columns: var(--time-col-w) 1fr;
  min-height: 52px;
  border-bottom: 1px solid #f3f4f6;
  width: 100%;
}

.day-time-slot {
  padding: 3px 8px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  cursor: pointer;
  transition: background-color 0.1s ease;
}

.day-time-slot:hover {
  background-color: #fafbfc;
}

/* Week Event Pill */
.week-event-pill {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 1px 3px;
  border-radius: 3px;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: transform 0.05s ease, opacity 0.15s ease;
  display: flex;
  align-items: center;
  gap: 2px;
  line-height: 1.2;
}

.week-event-pill:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

/* Day Event Card */
.day-event-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-md);
  color: #ffffff;
  cursor: pointer;
  transition: transform 0.05s ease, opacity 0.15s ease;
}

.day-event-card:hover {
  opacity: 0.92;
  transform: translateY(-1px);
}

.day-event-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.day-event-title {
  font-weight: 700;
  font-size: 0.85rem;
}

.day-event-sub {
  font-size: 0.75rem;
  opacity: 0.92;
}

/* Responsive Overrides for Calendar */
@media (max-width: 768px) {
  .calendar-page-container {
    height: calc(100dvh - 65px);
    min-height: 480px;
    margin: 0.35rem auto;
    padding: 0 0.5rem;
  }
}

@media (max-width: 640px) {
  :root {
    --time-col-w: 36px;
  }

  .calendar-toolbar {
    flex-direction: column;
    align-items: stretch;
    padding: 0.5rem 0.65rem;
    gap: 0.4rem;
  }

  .toolbar-left {
    justify-content: space-between;
    gap: 0.5rem;
  }

  .calendar-title {
    font-size: 1.05rem;
    min-width: 0;
  }

  .toolbar-right {
    justify-content: space-between;
    gap: 0.4rem;
    flex-wrap: wrap;
  }

  .view-btn {
    padding: 0.25rem 0.45rem;
    font-size: 0.75rem;
  }

  .calendar-filter-bar {
    padding: 0.35rem 0.65rem;
    font-size: 0.78rem;
    gap: 0.4rem;
  }

  .cal-filter-select {
    font-size: 0.78rem;
    min-height: 28px;
    padding: 0.2rem 0.4rem;
    flex: 1;
    max-width: 100%;
  }

  .calendar-day-cell {
    padding: 0.15rem;
    min-height: 0;
  }

  .day-number {
    font-size: 0.72rem;
  }

  .calendar-day-cell.today .day-number {
    width: 20px;
    height: 20px;
    font-size: 0.7rem;
  }

  .calendar-event-pill {
    font-size: 0.62rem;
    padding: 1px 2px;
    min-height: 14px;
  }

  .calendar-event-pill .pill-time {
    display: none;
  }

  .calendar-weekdays {
    font-size: 0.7rem;
    padding: 0.25rem 0;
  }

  .week-day-name {
    font-size: 0.62rem;
  }

  .week-day-number {
    width: 20px;
    height: 20px;
    font-size: 0.75rem;
  }

  .time-label {
    font-size: 0.65rem;
    padding: 0.15rem 0.1rem;
  }

  .week-header-corner {
    font-size: 0.62rem;
    padding: 0.25rem 0.1rem;
  }

  .week-event-pill {
    font-size: 0.6rem;
    padding: 1px 2px;
  }

  .week-hour-row {
    min-height: 38px;
  }

  .day-hour-row {
    min-height: 44px;
  }
}

@media (max-width: 480px) {
  .calendar-page-container {
    height: calc(100dvh - 58px);
    min-height: 440px;
    margin: 0.2rem auto;
    padding: 0 0.25rem;
  }

  .btn-add-event span {
    display: none;
  }

  .btn-add-event {
    width: 34px;
    height: 34px;
    min-height: unset;
    padding: 0;
    justify-content: center;
    border-radius: 50%;
  }

  .btn-today {
    padding: 0.25rem 0.5rem;
    font-size: 0.78rem;
    min-height: 32px;
  }

  .btn-icon {
    width: 32px;
    height: 32px;
  }
}

/* Agenda / List View */
.agenda-view-container {
  padding: 1.25rem;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  animation: tabFadeIn 0.25s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.agenda-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.agenda-date-group {
  margin-bottom: 0.5rem;
}

.agenda-date-header {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.35rem;
  margin-bottom: 0.75rem;
  text-transform: capitalize;
}

.agenda-item-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: all 0.15s ease;
}

.agenda-item-card:hover {
  transform: translateX(3px);
  box-shadow: var(--shadow-md);
}

.agenda-item-info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.agenda-item-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.agenda-item-time {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Color Picker */
.color-picker-group {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  margin-top: 0.25rem;
}

.color-option {
  cursor: pointer;
  position: relative;
}

.color-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  cursor: pointer;
}

.color-swatch {
  display: inline-block;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid transparent;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.color-option input:checked + .color-swatch {
  transform: scale(1.15);
  border-color: #ffffff;
  box-shadow: 0 0 0 2px var(--text-main);
}

/* Form Controls */
.form-select,
.form-textarea {
  width: 100%;
  min-height: 48px;
  padding: 0.75rem 1rem;
  font-size: 0.95rem;
  border: 1px solid var(--input-border);
  border-radius: var(--radius-md);
  background-color: #ffffff;
  color: var(--text-main);
  font-family: inherit;
}

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

.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(200, 16, 46, 0.15);
}

.dialog-actions-spaced {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 1.5rem;
  width: 100%;
}

.btn-danger {
  min-height: 44px;
  background: transparent;
  border: 1px solid #f87171;
  color: #dc2626;
  border-radius: var(--radius-md);
  padding: 0.5rem 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.btn-danger:hover {
  background: #fee2e2;
}

/* Push Notification In-App Toast */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-left: 5px solid var(--primary);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  box-shadow: var(--shadow-lg);
  max-width: 360px;
  animation: slideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

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

@keyframes slideIn {
  from { opacity: 0; transform: translateX(30px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes slideOut {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(30px); }
}

.toast-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 700;
  color: var(--text-main);
  font-size: 0.95rem;
}

.toast-body {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ==========================================================================
   Administration System Styles (/admin.html)
   ========================================================================== */
.admin-container {
  max-width: 1240px;
  margin: 1.5rem auto;
  padding: 0 1.5rem;
  width: 100%;
  animation: tabFadeIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) both;
}

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

.admin-header-titles h1 {
  font-size: 1.65rem;
  font-weight: 700;
  color: var(--text-main);
}

.admin-header-titles p {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-top: 0.2rem;
}

/* Admin Tabs Navigation */
.admin-tabs {
  display: flex;
  gap: 0.5rem;
  border-bottom: 2px solid var(--border-color);
  margin-bottom: 1.5rem;
  overflow-x: auto;
  padding-bottom: 1px;
}

.admin-tab-btn {
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  padding: 0.75rem 1.25rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  transition: all 0.15s ease;
  white-space: nowrap;
  margin-bottom: -2px;
}

.admin-tab-btn:hover {
  color: var(--text-main);
  background-color: rgba(0, 0, 0, 0.02);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.admin-tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.admin-tab-btn .tab-count {
  background: var(--bg-page);
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
}

.admin-tab-btn.active .tab-count {
  background: var(--primary-light);
  color: var(--primary);
}

/* Admin Card & Table Toolbar */
.admin-card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.admin-toolbar {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  background: #fafafa;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: #ffffff;
  border: 1px solid var(--input-border);
  border-radius: var(--radius-md);
  padding: 0 0.75rem;
  min-height: 38px;
  min-width: 280px;
  box-sizing: border-box;
}

.search-box input[type="text"],
.search-box input {
  border: none !important;
  outline: none !important;
  font-size: 0.85rem !important;
  font-family: inherit;
  color: var(--text-main);
  width: 100%;
  padding: 0 !important;
  min-height: unset !important;
  height: auto !important;
  background: transparent !important;
  box-shadow: none !important;
}

.search-box input[type="text"]::placeholder,
.search-box input::placeholder {
  font-size: 0.85rem !important;
  font-family: inherit;
  color: var(--text-muted);
}

.search-box svg {
  color: var(--text-muted);
  flex-shrink: 0;
}

.form-select {
  min-height: 38px;
  padding: 0.25rem 0.75rem;
  font-size: 0.85rem;
  font-family: inherit;
  border: 1px solid var(--input-border);
  border-radius: var(--radius-md);
  background-color: #ffffff;
  color: var(--text-main);
  outline: none;
  box-sizing: border-box;
}

/* Data Table */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.875rem;
}

.data-table th {
  background: #f8fafc;
  padding: 0.75rem 1rem;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.data-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
  color: var(--text-main);
}

.data-table tbody tr:hover {
  background-color: #fbfcfe;
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

/* Sortable Table Headers */
.data-table th.sortable-th {
  cursor: pointer;
  user-select: none;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.data-table th.sortable-th:hover {
  background-color: #f1f5f9;
  color: var(--primary);
}

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

.sort-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--text-muted);
}

.sort-icon {
  display: none;
}

.sort-icon.sort-none {
  display: inline-block;
  opacity: 0.35;
}

.sortable-th:hover .sort-icon.sort-none {
  opacity: 0.75;
}

.sortable-th.sorted-asc .sort-icon.sort-none,
.sortable-th.sorted-desc .sort-icon.sort-none {
  display: none;
}

.sortable-th.sorted-asc .sort-icon.sort-asc {
  display: inline-block;
  color: var(--primary);
}

.sortable-th.sorted-desc .sort-icon.sort-desc {
  display: inline-block;
  color: var(--primary);
}

.sortable-th.sorted-asc,
.sortable-th.sorted-desc {
  background-color: #fffafb;
  color: var(--primary);
}

/* Table Column Filters */
.table-filter-row th {
  padding: 0.4rem 0.6rem !important;
  background-color: #fafbfc;
  border-bottom: 2px solid var(--border-color);
  font-weight: normal;
  vertical-align: middle;
}

.table-filter-row input[type="text"],
.table-filter-row select,
input[type="text"].table-col-filter,
select.table-col-filter,
.table-col-filter {
  width: 100%;
  padding: 0.32rem 0.55rem;
  font-size: 0.8rem;
  line-height: 1.4;
  border: 1px solid var(--input-border);
  border-radius: var(--radius-md);
  background-color: #ffffff;
  color: var(--text-main);
  transition: all 0.15s ease;
  box-sizing: border-box;
  font-family: inherit;
  min-height: 32px;
  height: 32px;
}

.table-filter-row input[type="text"]::placeholder,
.table-col-filter::placeholder {
  font-size: 0.8rem;
  font-family: inherit;
  color: var(--text-muted);
  opacity: 0.8;
}

.table-filter-row input[type="text"]:focus,
.table-filter-row select:focus,
.table-col-filter:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-light);
}

.table-filter-row input[type="text"].has-filter,
.table-filter-row select.has-filter,
.table-col-filter.has-filter {
  border-color: var(--primary);
  background-color: #fffafb;
  font-weight: 600;
}

.btn-clear-table-filters {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  padding: 0.3rem 0.6rem;
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: #ffffff;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
  min-height: 32px;
  width: 100%;
}

.btn-clear-table-filters:hover {
  background: #fee2e2;
  color: var(--primary);
  border-color: #fca5a5;
}

.filter-match-count {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-left: 0.5rem;
}

/* Badges */
.badge-role {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge-role-super {
  background: #f3e8ff;
  color: #6b21a8;
  border: 1px solid #d8b4fe;
}

.badge-role-admin {
  background: #eff6ff;
  color: #1e40af;
  border: 1px solid #bfdbfe;
}

.badge-role-user {
  background: #f3f4f6;
  color: #4b5563;
  border: 1px solid #e5e7eb;
}

.badge-status {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge-status.active {
  background: #dcfce7;
  color: #166534;
}

.badge-status.inactive {
  background: #fee2e2;
  color: #991b1b;
}

.badge-group-chip {
  display: inline-block;
  background: #f3f4f6;
  color: #374151;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  font-size: 0.75rem;
  margin: 2px 2px;
  border: 1px solid #e5e7eb;
}

.badge-access-view {
  background: #e0f2fe;
  color: #0369a1;
  border: 1px solid #bae6fd;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 600;
}

.badge-access-update {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 600;
}

/* Action Buttons */
.table-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  white-space: nowrap;
}

.btn-icon-table {
  background: transparent;
  border: 1px solid var(--border-color);
  padding: 0.35rem 0.55rem;
  border-radius: var(--radius-md);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.12s ease;
}

.btn-icon-table:hover {
  background: var(--bg-page);
  border-color: #cbd5e1;
}

.btn-icon-table.btn-toggle-deactivate {
  color: #dc2626;
  border-color: #fecaca;
}

.btn-icon-table.btn-toggle-deactivate:hover {
  background: #fee2e2;
}

.btn-icon-table.btn-toggle-activate {
  color: #166534;
  border-color: #bbf7d0;
}

.btn-icon-table.btn-toggle-activate:hover {
  background: #dcfce7;
}

.btn-icon-table.btn-delete {
  color: #dc2626;
  border-color: #fecaca;
}

.btn-icon-table.btn-delete:hover {
  background: #fee2e2;
}

.btn-danger:disabled,
.btn-secondary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

/* Activity Log Operation & Module Badges */
.badge-module {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  background: #f1f5f9;
  color: #334155;
  border: 1px solid #cbd5e1;
  white-space: nowrap;
}

.badge-op {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge-op-create {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #86efac;
}

.badge-op-update {
  background: #dbeafe;
  color: #1e40af;
  border: 1px solid #93c5fd;
}

.badge-op-delete {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fca5a5;
}

.badge-op-activate {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #6ee7b7;
}

.badge-op-deactivate {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fcd34d;
}

.badge-op-trash {
  background: #ffedd5;
  color: #9a3412;
  border: 1px solid #fdba74;
}

.badge-op-restore {
  background: #e0e7ff;
  color: #3730a3;
  border: 1px solid #a5b4fc;
}

/* Modal Checklists & Permission Matrices */
.checklist-container {
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid var(--input-border);
  border-radius: var(--radius-md);
  padding: 0.5rem;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.checklist-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius-md);
  transition: background-color 0.1s ease;
  cursor: pointer;
}

.checklist-item:hover {
  background: #f8fafc;
}

.checklist-item label {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0;
  cursor: pointer;
  font-weight: normal;
  width: 100%;
}

.checklist-item input[type="checkbox"] {
  accent-color: var(--primary);
  width: 1rem;
  height: 1rem;
}

.permission-matrix {
  border: 1px solid var(--input-border);
  border-radius: var(--radius-md);
  max-height: 240px;
  overflow-y: auto;
}

.permission-matrix table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.825rem;
}

.permission-matrix th {
  background: #f8fafc;
  padding: 0.5rem 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 1;
}

.permission-matrix td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

.permission-radio-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.permission-radio-label {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin-bottom: 0;
  font-size: 0.78rem;
  cursor: pointer;
  font-weight: 500;
}

/* Event Metadata & Audit Log Timeline */
.event-meta-banner {
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.6rem 0.85rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.btn-history {
  background: transparent;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-main);
  padding: 0.25rem 0.55rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.15s ease;
}

.btn-history:hover {
  background: #e2e8f0;
}

.history-timeline {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 340px;
  overflow-y: auto;
  padding-right: 0.25rem;
}

.history-item {
  display: flex;
  gap: 0.75rem;
  padding: 0.75rem;
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
}

.history-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.history-icon.create {
  background: #dcfce7;
  color: #166534;
}

.history-icon.update {
  background: #e0f2fe;
  color: #0369a1;
}

.history-icon.delete {
  background: #fee2e2;
  color: #991b1b;
}

.history-content {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  width: 100%;
}

.history-header {
  display: flex;
  justify-content: space-between;
  font-weight: 600;
  color: var(--text-main);
  font-size: 0.85rem;
}

.history-time {
  font-weight: 400;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.history-details {
  font-size: 0.82rem;
  color: #4b5563;
}

/* Calendar Filter Bar */
.calendar-filter-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 1.25rem;
  background: #f8fafc;
  border-bottom: 1px solid var(--border-color);
  flex-wrap: wrap;
  font-size: 0.875rem;
}

.cal-filter-select {
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--input-border);
  background: #ffffff;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-main);
  min-height: 36px;
}

/* =========================================================================
   Rich Text Editor (Opis događaja)
   ========================================================================= */
.rich-text-container {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--input-border);
  border-radius: var(--radius-md);
  background-color: #ffffff;
  overflow: hidden;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  position: relative;
}

.rich-text-container:focus-within {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(200, 16, 46, 0.15);
}

.rich-text-container.is-disabled {
  background-color: #f9fafb;
  border-color: #e5e7eb;
}

.rich-text-container.is-disabled .rich-text-toolbar {
  background-color: #f3f4f6;
  opacity: 0.6;
  pointer-events: none;
}

.rich-text-container.is-disabled .rich-text-editor {
  cursor: not-allowed;
  color: #6b7280;
  background-color: #f9fafb;
}

.rich-text-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px;
  padding: 0.35rem 0.5rem;
  background-color: #f8fafc;
  border-bottom: 1px solid var(--border-color);
  user-select: none;
}

.rte-btn-group {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.rte-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: #4b5563;
  cursor: pointer;
  transition: all 0.15s ease;
}

.rte-btn:hover:not(:disabled) {
  background-color: #e5e7eb;
  color: var(--text-main);
}

.rte-btn.is-active {
  background-color: #fee2e2;
  color: var(--primary);
  border-color: #fca5a5;
}

.rte-btn:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.rte-btn-text {
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1;
}

.rte-divider {
  width: 1px;
  height: 18px;
  background-color: #d1d5db;
  margin: 0 4px;
}

/* Link Popover */
.rte-link-popover {
  position: absolute;
  top: 42px;
  left: 8px;
  right: 8px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.65rem;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  z-index: 10;
  animation: rteFadeDown 0.15s ease-out;
}

@keyframes rteFadeDown {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.rte-link-input {
  flex: 1;
  min-width: 0;
  padding: 0.35rem 0.6rem;
  font-size: 0.85rem;
  border: 1px solid var(--input-border);
  border-radius: 4px;
  outline: none;
}

.rte-link-input:focus {
  border-color: var(--border-focus);
}

/* Editor Area */
.rich-text-editor {
  min-height: 95px;
  max-height: 220px;
  overflow-y: auto;
  padding: 0.65rem 0.85rem;
  font-size: 0.9rem;
  color: var(--text-main);
  line-height: 1.5;
  outline: none;
  word-break: break-word;
}

/* Placeholder support */
.rich-text-editor:empty::before,
.rich-text-editor[data-empty="true"]::before {
  content: attr(data-placeholder);
  color: #9ca3af;
  pointer-events: none;
  display: block;
}

/* Formatted content typography */
.rich-text-editor p,
.day-event-sub p,
.day-event-rich-desc p,
.agenda-item-desc p {
  margin: 0.2rem 0;
}

.rich-text-editor h3,
.day-event-sub h3,
.day-event-rich-desc h3,
.agenda-item-desc h3 {
  font-size: 1rem;
  font-weight: 700;
  margin: 0.4rem 0 0.2rem 0;
  color: inherit;
}

.rich-text-editor ul,
.day-event-sub ul,
.day-event-rich-desc ul,
.agenda-item-desc ul {
  list-style-type: disc;
  margin: 0.2rem 0 0.2rem 1.4rem;
}

.rich-text-editor ol,
.day-event-sub ol,
.day-event-rich-desc ol,
.agenda-item-desc ol {
  list-style-type: decimal;
  margin: 0.2rem 0 0.2rem 1.4rem;
}

.rich-text-editor li,
.day-event-sub li,
.day-event-rich-desc li,
.agenda-item-desc li {
  margin-bottom: 0.15rem;
}

.rich-text-editor blockquote,
.agenda-item-desc blockquote {
  border-left: 3px solid #d1d5db;
  padding-left: 0.75rem;
  margin: 0.35rem 0;
  color: #6b7280;
  font-style: italic;
}

.day-event-card .day-event-sub blockquote,
.day-event-card .day-event-rich-desc blockquote {
  border-left: 2px solid rgba(255, 255, 255, 0.7);
  padding-left: 0.5rem;
  margin: 0.25rem 0;
  color: rgba(255, 255, 255, 0.9);
  font-style: italic;
}

.rich-text-editor a,
.agenda-item-desc a {
  color: var(--primary);
  text-decoration: underline;
  word-break: break-all;
}

.day-event-card .day-event-sub a,
.day-event-card .day-event-rich-desc a {
  color: #ffffff;
  text-decoration: underline;
  font-weight: 500;
  word-break: break-all;
}

.day-event-rich-desc {
  font-size: 0.78rem;
  opacity: 0.95;
  margin-top: 0.2rem;
  line-height: 1.4;
}

.agenda-item-desc {
  font-size: 0.85rem;
  color: #374151;
  margin-top: 0.3rem;
  line-height: 1.45;
}

/* Password Policy Info Button & Modal */
.label-with-info {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.35rem;
}

.label-with-info label {
  margin-bottom: 0;
}

.pwd-info-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: #475569;
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.pwd-info-btn:hover,
.pwd-info-btn:focus-visible {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
  outline: none;
  box-shadow: 0 0 0 3px var(--focus-ring);
}

dialog.pwd-policy-dialog {
  max-width: 490px;
  padding: 1.75rem 2.5rem 1.75rem 1.75rem;
}

dialog.pwd-policy-dialog .confirm-dialog-body {
  padding-right: 0.75rem;
}

.pwd-policy-icon {
  background: #fee2e2;
  color: var(--primary);
}

.pwd-policy-list {
  list-style: none;
  padding: 0;
  margin: 0.75rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  font-size: 0.875rem;
  color: var(--text-main);
}

.pwd-policy-list li {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  line-height: 1.4;
}

.pwd-policy-list li::before {
  content: "✓";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  margin-top: 0.08rem;
  border-radius: 50%;
  background: #dcfce7;
  color: #15803d;
  font-size: 0.72rem;
  font-weight: 700;
  flex-shrink: 0;
}

.pwd-policy-example {
  margin-top: 0.75rem;
  padding: 0.55rem 0.75rem;
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  color: var(--text-muted);
}

.pwd-policy-example code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-weight: 600;
  color: var(--text-main);
  background: #e2e8f0;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
}

/* Real-Time Password Strength Meter */
.pwd-strength {
  margin-top: 0.45rem;
  display: none;
  flex-direction: column;
  gap: 0.3rem;
}

.pwd-strength.visible {
  display: flex;
}

.pwd-strength-bars {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.3rem;
  height: 5px;
}

.pwd-strength-bar {
  background: #e2e8f0;
  border-radius: 999px;
  transition: background-color 0.2s ease;
}

.pwd-strength.level-1 .pwd-strength-bar:nth-child(-n+1) {
  background: #dc2626;
}

.pwd-strength.level-2 .pwd-strength-bar:nth-child(-n+2) {
  background: #d97706;
}

.pwd-strength.level-3 .pwd-strength-bar:nth-child(-n+3) {
  background: #16a34a;
}

.pwd-strength.level-4 .pwd-strength-bar:nth-child(-n+4) {
  background: #15803d;
}

.pwd-strength-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  font-size: 0.76rem;
  line-height: 1.3;
}

.pwd-strength-label {
  font-weight: 700;
  white-space: nowrap;
}

.pwd-strength.level-1 .pwd-strength-label {
  color: #dc2626;
}

.pwd-strength.level-2 .pwd-strength-label {
  color: #b45309;
}

.pwd-strength.level-3 .pwd-strength-label {
  color: #16a34a;
}

.pwd-strength.level-4 .pwd-strength-label {
  color: #15803d;
}

.pwd-strength-hint {
  color: var(--text-muted);
  text-align: right;
  font-size: 0.74rem;
}

.pwd-strength.level-1 .pwd-strength-hint.is-error {
  color: #dc2626;
}

.pwd-strength.level-3 .pwd-strength-hint,
.pwd-strength.level-4 .pwd-strength-hint {
  color: #15803d;
}

/* Floating Bottom-Right System Settings Button (Cog Icon) */
.floating-settings-btn {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: #ffffff;
  color: var(--text-main);
  border: 1px solid var(--border-color);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.14);
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 95;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.floating-settings-btn:hover {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 6px 20px rgba(200, 16, 46, 0.28);
  transform: translateY(-2px);
}

.floating-settings-btn svg {
  transition: transform 0.35s ease;
}

.floating-settings-btn:hover svg {
  transform: rotate(45deg);
}

.floating-settings-btn:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

/* System Settings Centered Modal Dialog */
dialog.system-settings-dialog {
  max-width: 600px;
  width: 92%;
  padding: 2rem;
  margin: auto;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

/* 2FA Browser Approval Modal - Prominent Notice & Subtle Resend Button */
.browser-approval-notice {
  display: none;
  padding: 0.5rem 0;
  margin-bottom: 1rem;
  background: transparent;
  border: none;
  color: var(--text-main);
  font-size: 1.12rem;
  font-weight: 600;
  line-height: 1.55;
}

.browser-approval-notice.show {
  display: block;
}

.browser-approval-notice.is-error {
  padding: 0.75rem 1rem;
  background: var(--error-bg);
  border: 1px solid var(--error-border);
  border-radius: var(--radius-md);
  color: var(--error-text);
  font-size: 0.95rem;
  font-weight: 500;
}

.btn-resend-subtle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  width: auto;
  min-height: 30px;
  padding: 0.3rem 0.7rem;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-resend-subtle:hover:not(:disabled) {
  color: var(--text-main);
  background: #f8fafc;
  border-color: #cbd5e1;
}

.btn-resend-subtle:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ==========================================================================
   Wider Event Modal, Croatian Date Inputs, Attachments, PDF Viewer & Lightbox
   ========================================================================== */
dialog#event-dialog {
  max-width: 860px;
  width: 95%;
  max-height: 92vh;
  overflow-y: auto;
  padding: 1.75rem 2rem;
}

.hr-datetime-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.hr-date-input-wrap {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
}

.hr-date-input-wrap input[type="text"] {
  width: 100%;
  padding-right: 2.3rem;
  font-variant-numeric: tabular-nums;
}

.hr-date-picker-btn {
  position: absolute;
  right: 0.45rem;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.hr-date-picker-btn:hover:not(:disabled) {
  color: var(--primary);
  background: #f1f5f9;
}

.hr-date-native-hidden {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 1px;
  height: 1px;
  right: 0.5rem;
  bottom: 0;
}

.hr-time-input {
  width: 112px !important;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.event-attachment-section {
  margin-top: 1.15rem;
  padding: 1rem 1.15rem;
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

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

.event-attachment-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-main);
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0;
}

.event-dropzone {
  border: 2px dashed #cbd5e1;
  border-radius: var(--radius-md);
  background: #ffffff;
  padding: 1rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.18s ease, background-color 0.18s ease;
  margin-bottom: 0.75rem;
}

.event-dropzone:hover,
.event-dropzone.is-dragover {
  border-color: var(--primary);
  background: #fff5f5;
}

.event-dropzone.is-disabled {
  display: none;
}

.event-dropzone-text {
  font-size: 0.84rem;
  color: var(--text-muted);
  margin: 0.25rem 0 0 0;
}

.event-dropzone-text strong {
  color: var(--primary);
  font-weight: 600;
}

.event-attachments-table-wrap {
  overflow-x: auto;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.event-attachments-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.83rem;
}

.event-attachments-table th {
  background: #f1f5f9;
  color: var(--text-muted);
  font-weight: 700;
  text-align: left;
  padding: 0.5rem 0.65rem;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.event-attachments-table td {
  padding: 0.45rem 0.65rem;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}

.event-attachments-table tr:last-child td {
  border-bottom: none;
}

.event-attachments-table tr.is-dragging {
  opacity: 0.45;
  background: #fef2f2;
}

.event-attachments-table tr.drag-over-row td {
  border-top: 2px solid var(--primary);
}

.doc-title-input {
  width: 100%;
  min-height: 32px !important;
  padding: 0.25rem 0.55rem !important;
  font-size: 0.83rem !important;
}

.doc-file-link {
  background: transparent;
  border: none;
  padding: 0;
  font-family: inherit;
  font-size: inherit;
  text-align: left;
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
}

.doc-file-link:hover {
  text-decoration: underline;
}

.reorder-btns {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
}

.btn-reorder {
  width: 26px;
  height: 26px;
  padding: 0;
  border: 1px solid var(--border-color);
  background: #ffffff;
  color: var(--text-main);
  border-radius: 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.12s ease;
}

.btn-reorder:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary);
  background: #fff5f5;
}

.btn-reorder:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.drag-handle {
  cursor: grab;
  color: #94a3b8;
  display: inline-flex;
  align-items: center;
  padding: 0 0.2rem;
  user-select: none;
}

.drag-handle:active {
  cursor: grabbing;
}

.event-links-adder {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.event-links-adder input {
  flex: 1;
  min-width: 180px;
  min-height: 36px;
  font-size: 0.85rem;
}

.event-gallery-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.event-gallery-item {
  width: 100px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  position: relative;
  user-select: none;
}

.event-gallery-item.is-dragging {
  opacity: 0.4;
}

.event-gallery-item.drag-over-item .event-gallery-thumb-wrap {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.event-gallery-thumb-wrap {
  width: 100px;
  height: 100px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border-color);
  background: #ffffff;
  position: relative;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.event-gallery-thumb-wrap:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
}

.event-gallery-thumb {
  width: 100px;
  height: 100px;
  object-fit: cover;
  display: block;
}

.event-gallery-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100px;
  gap: 2px;
}

.event-gallery-controls .btn-reorder {
  width: 24px;
  height: 22px;
  font-size: 0.7rem;
}

/* PDF Viewer Modal */
dialog#pdf-viewer-dialog {
  max-width: 980px;
  width: 95%;
  height: 88vh;
  max-height: 90vh;
  padding: 0;
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.pdf-viewer-layout {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 88vh;
  background: #1e293b;
}

.pdf-viewer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1.25rem;
  background: #0f172a;
  color: #ffffff;
  border-bottom: 1px solid #334155;
  flex-shrink: 0;
}

.pdf-viewer-title {
  font-size: 0.95rem;
  font-weight: 700;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pdf-viewer-frame {
  flex: 1;
  width: 100%;
  border: none;
  background: #334155;
}

/* Full Image Lightbox Modal */
dialog#image-lightbox-dialog {
  max-width: 1120px;
  width: 96%;
  padding: 0;
  background: rgba(15, 23, 42, 0.96);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.lightbox-layout {
  display: flex;
  flex-direction: column;
  min-height: 460px;
  max-height: 90vh;
}

.lightbox-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.25rem;
  background: rgba(15, 23, 42, 0.85);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.lightbox-counter {
  font-size: 0.85rem;
  font-weight: 600;
  color: #cbd5e1;
}

.lightbox-stage {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem 3.75rem;
  min-height: 380px;
  max-height: calc(90vh - 60px);
  overflow: hidden;
}

.lightbox-img {
  max-width: 100%;
  max-height: calc(90vh - 96px);
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  transition: opacity 0.26s cubic-bezier(0.16, 1, 0.3, 1), transform 0.26s cubic-bezier(0.16, 1, 0.3, 1);
}

.lightbox-img.anim-next {
  animation: lightboxSlideNext 0.32s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.lightbox-img.anim-prev {
  animation: lightboxSlidePrev 0.32s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes lightboxSlideNext {
  0% {
    opacity: 0;
    transform: translateX(38px) scale(0.96);
  }
  100% {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

@keyframes lightboxSlidePrev {
  0% {
    opacity: 0;
    transform: translateX(-38px) scale(0.96);
  }
  100% {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

.lightbox-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(15, 23, 42, 0.72);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.15s ease;
  z-index: 5;
}

.lightbox-nav-btn:hover:not(:disabled) {
  background: var(--primary);
  border-color: var(--primary);
  transform: translateY(-50%) scale(1.06);
}

.lightbox-nav-btn.prev {
  left: 0.85rem;
}

.lightbox-nav-btn.next {
  right: 0.85rem;
}

/* Word, Excel & Text Modal Document Viewer */
.doc-viewer-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.2rem 0.55rem;
  border-radius: 5px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: #334155;
  color: #f8fafc;
  flex-shrink: 0;
}

.doc-viewer-badge.type-pdf {
  background: #dc2626;
}

.doc-viewer-badge.type-word {
  background: #2563eb;
}

.doc-viewer-badge.type-excel {
  background: #16a34a;
}

.doc-viewer-badge.type-text {
  background: #475569;
}

.doc-viewer-scroll-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.75rem 1.25rem;
  background: #cbd5e1;
}

.doc-viewer-paper {
  max-width: 820px;
  min-height: calc(88vh - 110px);
  margin: 0 auto;
  background: #ffffff;
  color: #0f172a;
  padding: 2.5rem 2.75rem;
  border-radius: 6px;
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.22);
  font-size: 0.95rem;
  line-height: 1.65;
  overflow-wrap: break-word;
}

.doc-viewer-paper h1,
.doc-viewer-paper h2,
.doc-viewer-paper h3,
.doc-viewer-paper h4 {
  color: #0f172a;
  margin-top: 1.1rem;
  margin-bottom: 0.5rem;
}

.doc-viewer-paper p {
  margin: 0 0 0.75rem 0;
}

.doc-viewer-paper table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 0.88rem;
}

.doc-viewer-paper table td,
.doc-viewer-paper table th {
  border: 1px solid #cbd5e1;
  padding: 0.45rem 0.65rem;
}

.doc-viewer-paper img {
  max-width: 100%;
  height: auto;
}

.doc-viewer-text-pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.88rem;
  line-height: 1.6;
  color: #1e293b;
}

.doc-viewer-excel-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #f8fafc;
  overflow: hidden;
}

.doc-viewer-excel-tabs {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.5rem 1rem;
  background: #e2e8f0;
  border-bottom: 1px solid #cbd5e1;
  overflow-x: auto;
  flex-shrink: 0;
}

.doc-viewer-excel-tab {
  padding: 0.35rem 0.85rem;
  border-radius: 5px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #334155;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  min-height: 28px;
}

.doc-viewer-excel-tab.active {
  background: #16a34a;
  color: #ffffff;
  border-color: #16a34a;
}

.doc-viewer-excel-sheet {
  flex: 1;
  overflow: auto;
  padding: 1rem;
  background: #ffffff;
}

.doc-viewer-excel-sheet table {
  border-collapse: collapse;
  font-size: 0.82rem;
  color: #0f172a;
  min-width: 100%;
}

.doc-viewer-excel-sheet table td,
.doc-viewer-excel-sheet table th {
  border: 1px solid #cbd5e1;
  padding: 0.38rem 0.65rem;
  white-space: nowrap;
}

.doc-viewer-excel-sheet table tr:first-child td,
.doc-viewer-excel-sheet table tr:first-child th {
  background: #f1f5f9;
  font-weight: 600;
}

.doc-grid-download-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  height: 28px;
  min-height: 28px;
  padding: 0 0.65rem;
  border-radius: 5px;
  border: 1px solid var(--border-color);
  background: #ffffff;
  color: var(--text-main);
  font-size: 0.76rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.12s ease;
}

.doc-grid-download-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: #fff5f5;
}

.doc-viewonly-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.74rem;
  color: var(--text-muted);
  background: #f1f5f9;
  padding: 0.18rem 0.5rem;
  border-radius: 4px;
  font-weight: 500;
}

/* ==========================================================================
   Lightbox Close Button & Dark Header Action Buttons (High-Contrast)
   ========================================================================== */
.lightbox-close-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  height: 34px;
  min-height: 34px;
  padding: 0 1.05rem;
  border-radius: var(--radius-md);
  background-color: var(--primary);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.25);
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.1s ease;
}

.lightbox-close-btn:hover {
  background-color: var(--primary-hover);
  color: #ffffff;
}

.lightbox-header-btn.secondary {
  background-color: rgba(255, 255, 255, 0.14);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: var(--radius-md);
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.lightbox-header-btn.secondary:hover {
  background-color: rgba(255, 255, 255, 0.26);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.5);
}

/* ==========================================================================
   Event Read-Only Webpage Article View
   ========================================================================== */
.event-article-view {
  padding-bottom: 0.35rem;
}

.event-article-title {
  font-size: 1.75rem;
  font-weight: 800;
  line-height: 1.25;
  color: var(--text-main);
  margin: 0 0 1rem 0;
  padding-left: 0.85rem;
  border-left: 5px solid var(--event-accent, var(--primary));
  letter-spacing: -0.015em;
  word-break: break-word;
}

.event-article-meta-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.75rem;
  padding: 0.85rem 1.1rem;
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-bottom: 1.25rem;
}

.event-article-meta-item {
  display: inline-flex;
  align-items: baseline;
  gap: 0.4rem;
  font-size: 0.9rem;
  line-height: 1.4;
}

.event-article-meta-label {
  font-weight: 700;
  color: var(--text-muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.event-article-meta-value {
  font-weight: 600;
  color: var(--text-main);
}

.event-article-description {
  font-size: 1rem;
  line-height: 1.7;
  color: #1e293b;
  padding: 0.35rem 0.15rem 0.85rem 0.15rem;
  border-bottom: 1px solid #f1f5f9;
  margin-bottom: 0.5rem;
  word-break: break-word;
}

.event-article-description p {
  margin: 0 0 0.75rem 0;
}

.event-article-description p:last-child {
  margin-bottom: 0;
}

.event-article-description h3 {
  font-size: 1.18rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 1rem 0 0.45rem 0;
}

.event-article-description ul {
  list-style-type: disc;
  margin: 0.4rem 0 0.75rem 1.5rem;
}

.event-article-description ol {
  list-style-type: decimal;
  margin: 0.4rem 0 0.75rem 1.5rem;
}

.event-article-description li {
  margin-bottom: 0.25rem;
}

.event-article-description blockquote {
  border-left: 3px solid var(--primary);
  padding-left: 0.9rem;
  margin: 0.65rem 0;
  color: #475569;
  font-style: italic;
}

.event-article-description a {
  color: var(--primary);
  text-decoration: underline;
  font-weight: 500;
}

dialog#event-dialog.is-article-mode .event-attachment-section {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  padding: 1rem 1.15rem;
  margin-top: 1rem;
}

/* ==========================================================================
   PowerPoint (.pptx, .ppt, .odp) Slide Deck Modal Viewer
   ========================================================================== */
.doc-viewer-badge.badge-pdf {
  background: #dc2626;
}

.doc-viewer-badge.badge-word {
  background: #2563eb;
}

.doc-viewer-badge.badge-excel {
  background: #16a34a;
}

.doc-viewer-badge.badge-ppt {
  background: #ea580c;
}

.doc-viewer-badge.badge-text {
  background: #475569;
}

.doc-viewer-excel-tab.is-active {
  background: #16a34a;
  color: #ffffff;
  border-color: #16a34a;
}

.doc-viewer-ppt-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #1e293b;
  overflow: hidden;
}

.doc-viewer-ppt-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.55rem 1.1rem;
  background: #0f172a;
  border-bottom: 1px solid #334155;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.doc-viewer-ppt-nav {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.ppt-nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  height: 30px;
  min-height: 30px;
  padding: 0 0.75rem;
  border-radius: 5px;
  border: 1px solid #475569;
  background: #1e293b;
  color: #f8fafc;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transition: all 0.15s ease;
}

.ppt-nav-btn:hover:not(:disabled) {
  background: #ea580c;
  border-color: #ea580c;
  color: #ffffff;
}

.ppt-nav-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.ppt-slide-counter {
  font-size: 0.82rem;
  font-weight: 700;
  color: #e2e8f0;
  min-width: 84px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.doc-viewer-ppt-pills {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  overflow-x: auto;
  max-width: 100%;
  padding-bottom: 2px;
}

.ppt-slide-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  min-width: 30px;
  height: 26px;
  min-height: 26px;
  padding: 0 0.5rem;
  border-radius: 5px;
  border: 1px solid #334155;
  background: #1e293b;
  color: #cbd5e1;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
}

.ppt-slide-pill:hover {
  background: #334155;
  color: #ffffff;
}

.ppt-slide-pill.is-active {
  background: #ea580c;
  border-color: #ea580c;
  color: #ffffff;
}

.doc-viewer-ppt-stage-outer {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 1.5rem 1.25rem;
  gap: 1rem;
  background: #334155;
}

.doc-viewer-ppt-stage {
  position: relative;
  width: 100%;
  max-width: 860px;
  aspect-ratio: 16 / 9;
  background: #ffffff;
  color: #0f172a;
  border-radius: 8px;
  box-shadow: 0 14px 36px rgba(15, 23, 42, 0.45);
  overflow: hidden;
  flex-shrink: 0;
}

.doc-viewer-ppt-stage.anim-next {
  animation: lightboxSlideNext 0.26s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.doc-viewer-ppt-stage.anim-prev {
  animation: lightboxSlidePrev 0.26s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.ppt-el-box {
  position: absolute;
  box-sizing: border-box;
  overflow: hidden;
  padding: 0.35rem 0.5rem;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  word-break: break-word;
}

.ppt-el-box.role-title {
  font-size: clamp(1.15rem, 2.3vw, 1.65rem);
  font-weight: 800;
  line-height: 1.22;
  color: #0f172a;
  justify-content: center;
}

.ppt-el-box.role-ctrTitle {
  font-size: clamp(1.35rem, 2.8vw, 2rem);
  font-weight: 800;
  line-height: 1.2;
  color: #0f172a;
  justify-content: center;
  text-align: center;
}

.ppt-el-box.role-subTitle {
  font-size: clamp(0.95rem, 1.7vw, 1.25rem);
  font-weight: 500;
  color: #475569;
  justify-content: flex-start;
  text-align: center;
}

.ppt-el-box.role-body,
.ppt-el-box.role-other {
  font-size: clamp(0.82rem, 1.35vw, 1.02rem);
  line-height: 1.48;
  color: #1e293b;
  overflow-y: auto;
}

.ppt-el-box.role-footer {
  font-size: 0.72rem;
  color: #64748b;
  justify-content: center;
}

.ppt-para {
  margin: 0 0 0.38rem 0;
}

.ppt-para:last-child {
  margin-bottom: 0;
}

.ppt-para.is-bullet {
  position: relative;
  padding-left: 1.15rem;
}

.ppt-para.is-bullet::before {
  content: "•";
  position: absolute;
  left: 0.25rem;
  color: var(--primary);
  font-weight: 800;
}

.ppt-el-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.ppt-el-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
  background: rgba(255, 255, 255, 0.95);
}

.ppt-el-table td,
.ppt-el-table th {
  border: 1px solid #cbd5e1;
  padding: 0.3rem 0.5rem;
}

.ppt-el-table tr:first-child td {
  background: #f1f5f9;
  font-weight: 700;
}

.doc-viewer-ppt-notes {
  width: 100%;
  max-width: 860px;
  background: #0f172a;
  color: #e2e8f0;
  border: 1px solid #475569;
  border-radius: 6px;
  padding: 0.75rem 1rem;
  font-size: 0.83rem;
  line-height: 1.5;
  white-space: pre-wrap;
}

