@import url('https://fonts.googleapis.com/css2?family=Be+Vietnam+Pro:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;700&display=swap');

:root {
  color-scheme: dark;

  /* CRAVEAT Style Deep Carbon Theme */
  --bg: #2b2a33;
  --bg-gradient: #2b2a33;

  /* Opaque rich dark card surfaces */
  --surface: #322f3d;
  --surface-hover: #3d394a;
  --surface-active: #474257;
  --surface-2: #3a3645;
  --surface-opaque: #322f3d;
  
  /* Crisp translucent borders for premium separation */
  --line: rgba(255, 255, 255, 0.05);
  --line-focus: #7c8cff;
  
  /* Typography - High-contrast white and warm silver */
  --text: #cbd5e1;
  --text-bright: #ffffff;
  --muted: #8b8a96;
  
  /* Vivid primary accents and glowing gradients */
  --primary: #6d7cff;
  --primary-hover: #7c8cff;
  --primary-glow: rgba(109, 124, 255, 0.22);
  --primary-surface: #5865f2;
  --primary-gradient: linear-gradient(135deg, #5865f2 0%, #747bff 100%);
  --primary-gradient-hover: linear-gradient(135deg, #6672ff 0%, #8187ff 100%);
  
  --success: #10b981;
  --success-glow: rgba(16, 185, 129, 0.2);
  --success-gradient: linear-gradient(135deg, #10b981 0%, #059669 100%);
  
  --danger: #ef4444;
  --danger-glow: rgba(239, 68, 68, 0.2);
  --danger-gradient: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  
  --warning: #fbbf24;
  --warning-glow: rgba(251, 191, 36, 0.2);
  --warning-gradient: linear-gradient(135deg, #fbbf24 0%, #d97706 100%);
  
  --info: #3b82f6;
  
  /* Deep layered dark shadows */
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.15);
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 15px 40px rgba(0, 0, 0, 0.4);
  
  /* Clay curves - fully rounded */
  --radius-sm: 8px;
  --radius: 16px;
  --radius-lg: 20px;
}

[hidden] {
  display: none !important;
}

* {
  box-sizing: border-box;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
  transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}

html,
body {
  min-height: 100%;
  height: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  background: var(--bg-gradient);
  color: var(--text);
  font-family: 'Be Vietnam Pro', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* Typography headers */
h1, h2, h3, h4, h5, h6 {
  color: var(--text-bright);
  font-family: 'Be Vietnam Pro', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-weight: 600; /* Crisp semi-bold headers for modern aesthetic */
  letter-spacing: 0;
  margin-top: 0;
}

strong {
  color: var(--text-bright);
  font-weight: 700;
}

button,
input,
select,
textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  outline: none;
}

button:disabled,
.button.disabled {
  cursor: not-allowed;
  opacity: 0.4 !important;
  transform: none !important;
  box-shadow: none !important;
}

/* Redesigned Login card */
.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(135deg, #0e121a 0%, #06080c 100%);
  position: relative;
  overflow: hidden;
}

.login-panel {
  width: min(440px, 100%);
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 44px;
  text-align: center;
  position: relative;
  z-index: 2;
  animation: fadeInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.login-panel h1 {
  font-size: 32px;
  margin-bottom: 12px;
  color: var(--text-bright);
}

.login-panel p {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.6;
  margin-bottom: 30px;
}

/* Immersive App Layout */
.app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  position: relative;
}

/* Dark Premium Sidebar */
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: var(--bg); 
  color: #ffffff;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  z-index: 10;
  border-right: 1px solid rgba(255, 255, 255, 0.02);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  margin-bottom: 8px;
}

.brand-mark {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
  background: transparent;
  color: #ffffff;
}

.brand-mark svg {
  width: 28px;
  height: 28px;
  fill: none;
  stroke: var(--text-bright);
  stroke-width: 2.5;
}

.brand-info {
  display: flex;
  flex-direction: column;
}

.brand strong {
  font-size: 18px;
  letter-spacing: 0;
  color: #ffffff;
  font-weight: 800;
  text-transform: none;
}

.brand small {
  display: none;
}

/* Navigation items in the sidebar */
.nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 6px 0;
}

.nav-group-label {
  padding: 8px 20px 2px;
  color: rgba(255, 255, 255, 0.38);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.nav-item {
  width: 100%;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  text-align: left;
  padding: 14px 20px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: all 0.25s ease;
  position: relative;
}

.nav-subitem {
  padding-left: 28px;
}

.nav-item svg {
  width: 18px;
  height: 18px;
  stroke: var(--muted);
  fill: none;
  stroke-width: 2.5;
  transition: stroke 0.25s ease;
}

.nav-item:hover {
  color: var(--text-bright);
}

.nav-item:hover svg {
  stroke: var(--text-bright);
}

/* Selected navigation tab */
.nav-item.active {
  background: var(--surface);
  color: #ffffff;
  font-weight: 700;
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 10%;
  height: 80%;
  width: 4px;
  background: var(--text-bright);
  border-radius: 0 4px 4px 0;
}

.nav-item.active svg {
  stroke: #ffffff;
}

/* Sidebar session card */
.session {
  margin-top: auto;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.session-user {
  display: flex;
  align-items: center;
  gap: 12px;
}

.session-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--primary-surface);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 14px;
  color: white;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.session-avatar,
.tag-avatar,
.shift-avatar,
.person-avatar,
.ranking-avatar {
  position: relative;
}

.avatar-fallback {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: grid;
  place-items: center;
  line-height: 1;
}

.session-avatar svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}

.session-avatar img {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.tag-avatar img,
.shift-avatar img,
.person-avatar img,
.ranking-avatar img {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.session-details {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

#sessionName {
  font-weight: 700;
  color: #ffffff;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.session-role {
  font-size: 11px;
  color: var(--muted);
}

/* Right Content Area */
.content {
  min-width: 0;
  padding: 34px 36px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  overflow-y: auto;
  height: 100vh;
}

/* Top bar details */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 12px;
}

.topbar-title h1 {
  font-size: 24px;
  margin: 0;
  color: var(--text-bright);
  font-weight: 600;
}

.topbar-actions {
  position: relative;
  display: flex;
  align-items: center;
  gap: 16px;
}

.search-box {
  display: flex;
  align-items: center;
  background: var(--surface);
  border-radius: 30px;
  padding: 0 16px;
  height: 40px;
  gap: 10px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-box:focus-within {
  border-color: var(--primary);
}

.search-box svg {
  color: var(--muted);
}

.search-box input {
  background: transparent !important;
  border: none !important;
  color: var(--text-bright) !important;
  outline: none;
  box-shadow: none !important;
  min-height: auto !important;
  padding: 0 !important;
  width: 200px;
}

.icon-btn {
  background: transparent;
  color: var(--muted);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  display: grid;
  place-items: center;
  transition: background-color 0.2s ease, color 0.2s ease;
  cursor: pointer;
  position: relative;
}

.icon-btn:hover {
  background: var(--surface);
  color: var(--text-bright);
}

.notification-badge {
  position: absolute;
  top: 9px;
  right: 9px;
  width: 8px;
  height: 8px;
  background: var(--danger);
  border-radius: 50%;
  border: 1px solid var(--surface);
}

.user-menu-button {
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  cursor: pointer;
}

.topbar-popover {
  position: absolute;
  top: 52px;
  right: 0;
  width: 280px;
  z-index: 50;
  padding: 16px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.075);
  background: #302a3d;
  box-shadow: var(--shadow);
  color: var(--text);
}

.topbar-popover[hidden] {
  display: none !important;
}

.topbar-popover strong {
  color: var(--text-bright);
  font-size: 14px;
}

.topbar-popover p,
.topbar-popover span {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.menu-action {
  width: 100%;
  min-height: 42px;
  margin-top: 10px;
  border: 1px solid rgba(255, 255, 255, 0.075);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--text-bright);
  font-weight: 850;
  cursor: pointer;
}

.menu-action:hover {
  background: rgba(255, 255, 255, 0.075);
}

.menu-action.danger {
  color: #ff8585;
  border-color: rgba(255, 112, 112, 0.3);
  background: rgba(255, 112, 112, 0.08);
}

.user-popover-head {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
}

.user-popover-head .session-avatar {
  width: 42px;
  height: 42px;
}

.user-popover {
  width: 300px !important;
}

.user-popover-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.user-popover-info strong {
  font-size: 14px !important;
  color: var(--text-bright) !important;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-popover-info span {
  font-size: 11px !important;
  color: var(--muted) !important;
  margin: 0 !important;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-popover-divider {
  height: 1px;
  background: var(--line);
  margin: 12px 0;
}

.user-status-card {
  padding: 13px 14px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.035);
  margin-bottom: 12px;
}

.user-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.user-status-row span,
.user-status-card small {
  margin: 0 !important;
  color: var(--muted) !important;
  font-size: 11px !important;
}

.user-status-row strong {
  color: #f8d77b !important;
  font-size: 12px !important;
  font-weight: 900;
  white-space: nowrap;
}

.user-status-row strong.active {
  color: var(--success) !important;
}

.user-status-card small {
  display: block;
  margin-top: 7px !important;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-popover-roles {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 14px;
}

.user-popover-role {
  display: none;
}

.role-badge {
  margin: 0 !important;
  font-size: 11px;
  font-weight: 800;
  color: #dfe4ff;
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 6px 10px;
  border-radius: 999px;
  letter-spacing: 0;
}

.role-badge.muted {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.08);
}

/* Quick Settings popover classes */
.settings-popover {
  width: 318px !important;
}

.popover-section-title {
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.1em;
  margin: 12px 0 8px;
  text-transform: uppercase;
}

.settings-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  min-height: 54px;
  padding: 12px 0;
}

.settings-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.settings-label strong {
  font-size: 13px !important;
  color: var(--text-bright) !important;
}

.settings-label span {
  font-size: 11px !important;
  color: var(--muted) !important;
  margin: 0 !important;
}

.settings-divider {
  height: 1px;
  background: var(--line);
  margin: 12px 0;
}

/* Toggle Switch styling */
.switch-control {
  position: relative;
  display: block;
  width: 48px;
  height: 28px;
  flex: 0 0 48px;
  border-radius: 999px;
  line-height: 0;
}

.switch-control input {
  opacity: 0;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
}

.switch-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.12);
  transition: .2s;
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.switch-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 4px;
  top: 50%;
  background-color: #ffffff;
  transform: translateY(-50%);
  transition: transform 0.16s ease;
  border-radius: 50%;
}

.switch-control input:checked + .switch-slider {
  background-color: #6672ff;
}

.switch-control input:checked + .switch-slider:before {
  transform: translate(22px, -50%);
  background-color: #ffffff;
}

.settings-nav-links {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}

.settings-nav-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 12px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 12px;
  color: var(--text);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.settings-nav-btn:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-bright);
}

.settings-nav-btn svg {
  color: var(--muted);
}

/* Notifications Popover styling */
.notifications-popover {
  width: 330px !important;
}

.popover-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
  margin-bottom: 10px;
}

.clear-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
  font-weight: 500;
  transition: color 0.15s;
}

.clear-btn:hover {
  color: var(--text-bright);
}

.notifications-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 280px;
  overflow-y: auto;
}

.empty-notifications {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 0;
  color: var(--muted);
  gap: 8px;
}

.empty-notifications svg {
  color: rgba(255, 255, 255, 0.08);
}

.empty-notifications span {
  font-size: 12px;
  margin: 0;
}

.notification-item {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 12px;
  padding: 13px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 14px;
  transition: background 0.15s, border-color 0.15s;
}

.notification-item:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.08);
}

.notification-item-icon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(102, 114, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #aeb8ff;
}

.notification-item-icon.pending {
  color: #f8d77b;
  background: rgba(248, 215, 123, 0.1);
}

.notification-item-icon.escalated {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.08);
}

.notification-item-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.notification-item-text {
  margin: 0 !important;
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-bright);
  font-weight: 650;
}

.notification-item-time {
  font-size: 10px;
  color: var(--muted);
}

.notification-item-action {
  align-self: flex-start;
  font-size: 11px;
  font-weight: 600;
  color: #aeb8ff;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 2px 0 0;
  transition: color 0.15s;
}

.notification-item-action:hover {
  color: #ffffff;
  text-decoration: none;
}

.icon-spin-hover {
  transition: transform 0.4s ease;
}

.menu-action:hover .icon-spin-hover,
.spinning .icon-spin-hover {
  transform: rotate(360deg);
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.spinning .icon-spin-hover {
  animation: spin 1s linear infinite;
}

/* Status indicator badge */
.status {
  padding: 8px 18px;
  border-radius: 30px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: none;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.status::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #94a3b8;
}

/* Status pill indicator colors */
#statusText[style*="var(--danger)"] {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.15);
  color: #f87171 !important;
}
#statusText[style*="var(--danger)"]::before {
  background: #ef4444;
}

#statusText[style*="var(--warning)"] {
  background: rgba(251, 191, 36, 0.08);
  border-color: rgba(251, 191, 36, 0.15);
  color: #fbbf24 !important;
}
#statusText[style*="var(--warning)"]::before {
  background: #fbbf24;
}

#statusText[style*="var(--muted)"] {
  background: rgba(16, 185, 129, 0.08);
  border-color: rgba(16, 185, 129, 0.15);
  color: #34d399 !important;
}
#statusText[style*="var(--muted)"]::before {
  background: #10b981;
}

/* Views slide transitions */
.view {
  display: none;
  animation: fadeInUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.view.active {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* Metric Stats Cards in solid dark clay */
.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 24px;
}

.metric {
  background: var(--surface);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  padding: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  border: 1px solid rgba(255, 255, 255, 0.02);
}

.metric:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
  border-color: rgba(255, 255, 255, 0.05);
}

.metric-info {
  display: flex;
  flex-direction: column;
}

.metric-info strong {
  font-size: 32px;
  line-height: 1.1;
  font-weight: 800;
  font-family: inherit;
  color: var(--text-bright);
  margin-bottom: 6px;
}

.metric-info span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.metric-icon {
  width: 40px;
  height: 40px;
  border-radius: 0;
  background: transparent !important;
  color: var(--metric-color, var(--primary)) !important;
  display: grid;
  place-items: center;
  box-shadow: none;
  opacity: 0.92;
  transition: color 0.2s ease, opacity 0.2s ease, transform 0.2s ease;
}

.metric:hover .metric-icon {
  color: var(--metric-color, var(--primary)) !important;
  opacity: 1;
  transform: translateY(-1px);
}

.metric-icon svg {
  width: 23px;
  height: 23px;
  stroke-width: 3.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Master layout grids */
.split {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(340px, 0.9fr);
  gap: 28px;
}

/* Solid Opaque Panel Containers */
.panel {
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.02);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  min-width: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 12px;
}

.panel-head {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.panel-head h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  font-family: inherit;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Rounded Pill buttons */
.button {
  min-height: 40px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 30px; /* Highly rounded */
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  padding: 8px 22px;
  font-weight: 700;
  font-size: 13px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.button svg {
  stroke: currentColor;
  fill: none;
  stroke-width: 2.5;
}

.button:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-bright);
  transform: scale(1.02);
}

.button:active {
  transform: scale(0.98);
}

.button.primary {
  background: var(--primary-gradient);
  border: none;
  color: white;
  box-shadow: none;
}

.button.primary:hover {
  background: var(--primary-gradient-hover);
}

.button.danger {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: #ef4444;
}

.button.danger:hover {
  background: var(--danger-gradient);
  color: white;
  border-color: transparent;
}

.button.ghost {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
}

.button.ghost:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-bright);
}

/* Beautiful dynamic table styles - High contrast */
.table-wrap {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 600px;
  text-align: left;
}

th,
td {
  padding: 18px 20px;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

tbody tr {
  background: transparent;
  transition: all 0.25s ease;
  border-bottom: 1px solid rgba(255, 255, 255, 0.02);
}

tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

tbody tr:last-child {
  border-bottom: none;
}

td.actions-cell {
  width: 1%;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 8px;
}

td.actions-cell .button {
  min-width: 78px;
  height: 32px !important;
  min-height: 32px !important;
  padding: 0 12px !important;
  border-radius: 999px;
  font-size: 12px !important;
  line-height: 1;
  gap: 6px;
  transform-origin: center;
}

td.actions-cell .button svg {
  width: 13px;
  height: 13px;
  margin-right: 0 !important;
  stroke-width: 3;
}

td.actions-cell .button.danger {
  background: rgba(239, 68, 68, 0.13);
  border-color: rgba(239, 68, 68, 0.34);
  box-shadow: none;
}

/* Fully rounded opaque dark badges */
.status-pill {
  padding: 6px 12px;
  border-radius: 30px;
  font-weight: 600;
  font-size: 12px;
  text-transform: capitalize;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: none;
  background: transparent !important;
}

.status-pill::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.status-pill.status-pending {
  color: #fbbf24;
}

.status-pill.status-progress {
  color: var(--primary-hover);
}

.status-pill.status-escalated {
  color: #ef4444;
}

.status-pill.status-resolved {
  color: #10b981;
}

/* Styled Roster Active / Toggle Buttons */
.button.toggle {
  min-width: 80px;
  font-size: 12px;
  padding: 4px 12px;
  min-height: 28px;
  border-radius: 30px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.button.toggle[data-active="1"] {
  background: rgba(16, 185, 129, 0.12) !important;
  border: 1px solid rgba(16, 185, 129, 0.25) !important;
  color: #34d399 !important;
}

.button.toggle[data-active="1"]:hover {
  background: var(--success-gradient) !important;
  color: white !important;
  border-color: transparent !important;
}

.button.toggle[data-active="0"] {
  background: rgba(255, 255, 255, 0.03) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  color: var(--muted) !important;
}

.button.toggle[data-active="0"]:hover {
  background: rgba(255, 255, 255, 0.06) !important;
}

/* Status tags for users and queues */
.tag-list {
  min-height: 120px;
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 10px;
  padding: 24px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius);
  margin: 10px;
}

.tag {
  background: rgba(88, 101, 242, 0.08);
  border: 1px solid rgba(88, 101, 242, 0.15);
  border-radius: 8px;
  padding: 6px 14px;
  color: #a5b4fc;
  font-size: 13px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.tag::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #a5b4fc;
}

.staff-tag {
  padding: 6px 10px 6px 6px;
  gap: 8px;
}

.staff-tag::before {
  display: none;
}

.staff-tag strong,
.staff-tag small {
  display: block;
  line-height: 1.15;
}

.staff-tag small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.tag-avatar {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--primary-surface);
  color: #ffffff;
  font-size: 10px;
  font-weight: 800;
  overflow: hidden;
  flex: 0 0 auto;
}

.tag-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Empty Placeholder States */
.empty {
  color: var(--muted);
  padding: 30px;
  text-align: center;
  font-style: italic;
  font-size: 14px;
}

/* Elegant rounded inputs and forms */
.role-row,
.grid-form {
  display: grid;
  gap: 16px;
  padding: 20px;
  border-bottom: 1px solid var(--line);
  background: transparent;
}

.role-row {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  align-items: flex-end;
}

.role-row.compact-settings {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  padding-top: 14px;
  padding-bottom: 14px;
}

.form-hint {
  align-self: center;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.grid-form {
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  align-items: flex-end;
}

.grid-form button {
  height: 38px;
}

label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

input,
select {
  width: 100%;
  min-height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 30px; /* Fully rounded inputs */
  background: rgba(20, 18, 26, 0.45);
  color: var(--text-bright);
  padding: 8px 18px;
  font-weight: 500;
  backdrop-filter: blur(4px);
}

select {
  appearance: none;
  -webkit-appearance: none;
  color-scheme: dark;
  cursor: pointer;
  padding-right: 42px;
  background-image:
    linear-gradient(45deg, transparent 50%, rgba(255, 255, 255, 0.72) 50%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.72) 50%, transparent 50%);
  background-position:
    calc(100% - 21px) 50%,
    calc(100% - 15px) 50%;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

select option {
  background: #2c2738;
  color: #f7f3ff;
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--line-focus);
  box-shadow: 0 0 0 3px rgba(109, 124, 255, 0.15);
  background: rgba(20, 18, 26, 0.7);
}

input::placeholder {
  color: rgba(255, 255, 255, 0.15);
  font-style: italic;
}

/* Shift scheduler */
.shift-scheduler-panel {
  overflow: visible;
}

.shift-toolbar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}

.shift-toolbar.compact {
  grid-template-columns: minmax(420px, 1fr) minmax(260px, auto);
  align-items: end;
}

.shift-toolbar label:nth-child(3) {
  grid-column: span 2;
}

.shift-toolbar.compact label:nth-child(3) {
  grid-column: auto;
}

.filter-group {
  min-width: 0;
  display: grid;
  gap: 8px;
}

.filter-group > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.segmented-control {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  min-height: 38px;
  padding: 4px;
  border-radius: 14px;
  background: rgba(20, 18, 26, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.055);
}

.segment-btn {
  min-height: 30px;
  padding: 6px 11px;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.segment-btn:hover {
  color: var(--text-bright);
  background: rgba(255, 255, 255, 0.045);
}

.segment-btn.active {
  color: #ffffff;
  background: rgba(109, 124, 255, 0.24);
  box-shadow: inset 0 0 0 1px rgba(109, 124, 255, 0.2);
}

.scheduler-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 16px;
  padding: 16px 18px 18px;
  min-height: 0;
}

.scheduler-main,
.people-drawer {
  min-width: 0;
  background: rgba(15, 12, 22, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: var(--radius);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

.scheduler-main {
  overflow: hidden;
}

.scheduler-meta {
  min-height: 38px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
}

.scheduler-meta span,
.count-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(88, 101, 242, 0.1);
  color: #a5b4fc;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.shift-board {
  --board-days: 7;
  display: grid;
  grid-template-columns: 76px repeat(var(--board-days), minmax(150px, 1fr));
  max-height: none;
  overflow: auto;
}

.board-corner,
.board-head,
.time-head {
  position: sticky;
  z-index: 2;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.board-corner {
  top: 0;
  left: 0;
  z-index: 4;
  display: grid;
  place-items: center;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.board-head {
  top: 0;
  min-height: 40px;
  display: grid;
  place-items: center;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.time-head {
  left: 0;
  z-index: 3;
  display: grid;
  place-items: start center;
  min-height: 112px;
  padding-top: 12px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.shift-name-head {
  place-items: center;
  padding-top: 0;
}

.shift-slot {
  min-height: 112px;
  padding: 8px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.018), rgba(255, 255, 255, 0)),
    rgba(15, 12, 22, 0.2);
}

.shift-slot.drop-target {
  outline: 2px solid rgba(88, 101, 242, 0.72);
  outline-offset: -2px;
  background: rgba(88, 101, 242, 0.12);
}

.shift-chip {
  display: grid;
  position: relative;
  grid-template-columns: 30px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  border-radius: 10px;
  border: 1px solid rgba(16, 185, 129, 0.22);
  background: rgba(16, 185, 129, 0.1);
  padding: 8px;
  color: var(--text-bright);
  box-shadow: var(--shadow-sm);
  cursor: grab;
  user-select: none;
  touch-action: none;
}

.shift-delete-btn {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(239, 68, 68, 0.28);
  border-radius: 8px;
  background: rgba(239, 68, 68, 0.12);
  color: #f87171;
  opacity: 0;
  transform: translateY(-2px);
  transition: opacity 0.15s ease, transform 0.15s ease;
  cursor: pointer;
}

.shift-chip:hover .shift-delete-btn,
.shift-delete-btn:focus-visible {
  opacity: 1;
  transform: translateY(0);
}

.shift-chip + .shift-chip {
  margin-top: 8px;
}

.shift-chip:active {
  cursor: grabbing;
}

.shift-chip.dragging,
.person-card.dragging {
  opacity: 0.55;
}

body.shift-dragging,
body.shift-dragging * {
  cursor: grabbing !important;
}

.shift-drag-ghost {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;
  pointer-events: none;
  opacity: 0.92;
  transform: translate3d(-9999px, -9999px, 0);
  transition: none !important;
  will-change: transform;
  contain: layout paint style;
  backface-visibility: hidden;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.3);
}

.shift-chip.inactive {
  background: rgba(255, 255, 255, 0.035);
  border-color: rgba(255, 255, 255, 0.07);
  color: var(--muted);
}

.shift-chip-main {
  min-width: 0;
  padding-right: 18px;
}

.shift-chip strong,
.person-card strong {
  display: block;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.shift-chip span,
.person-card span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
}

.shift-avatar {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--primary-surface);
  color: #ffffff;
  font-weight: 800;
  font-size: 11px;
  overflow: hidden;
}

.shift-avatar img,
.person-avatar img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.chip-actions {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex-shrink: 0;
}

.chip-btn {
  min-height: 22px;
  border-radius: 7px;
  padding: 2px 7px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  font-size: 10px;
  font-weight: 800;
}

.chip-btn.danger {
  background: rgba(239, 68, 68, 0.12);
  color: #f87171;
}

.people-drawer {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: 346px;
}

.people-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.people-head h3 {
  margin: 0;
  font-size: 16px;
}

.people-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  padding-right: 2px;
}

.person-card {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 58px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.035);
  cursor: grab;
  user-select: none;
  touch-action: none;
}

.person-card:hover {
  border-color: rgba(88, 101, 242, 0.4);
  background: rgba(88, 101, 242, 0.09);
}

.person-card.selected {
  border-color: rgba(88, 101, 242, 0.72);
  background: rgba(88, 101, 242, 0.14);
  box-shadow: 0 0 0 2px rgba(88, 101, 242, 0.14);
}

.person-avatar {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--primary-surface);
  color: #ffffff;
  font-weight: 800;
  overflow: hidden;
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 24px;
  overflow-y: auto;
}

.modal[hidden] {
  display: none !important;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 7, 12, 0.7);
  backdrop-filter: blur(8px);
}

.modal-card {
  position: relative;
  z-index: 1;
  width: min(480px, 100%);
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.012)),
    var(--surface);
  box-shadow: var(--shadow-lg);
}

.modal-card.wide {
  width: min(760px, 100%);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.modal-head h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 800;
}

.icon-btn.compact {
  width: 34px;
  height: 34px;
}

.modal-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 18px 20px;
}

.modal-grid label {
  letter-spacing: 0;
}

.modal-grid input,
.modal-grid select {
  border-radius: 12px;
  background-color: rgba(20, 18, 26, 0.72);
  border-color: rgba(255, 255, 255, 0.1);
}

.modal-grid input[type="time"] {
  font-family: 'JetBrains Mono', monospace;
}

.check-row {
  grid-column: 1 / -1;
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.028);
  text-transform: none;
  letter-spacing: 0;
}

.check-row input {
  width: 18px;
  min-height: 18px;
  accent-color: var(--primary);
}

.modal-actions {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 10px;
  padding: 16px 20px 18px;
  border-top: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.08);
}

/* System Terminal Backup Panel */
.details {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 12px 24px;
  padding: 24px;
  margin: 10px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: var(--radius);
}

.details dt {
  color: var(--muted);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.05em;
  align-self: center;
}

.details dd {
  margin: 0;
}

.details pre {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-family: 'JetBrains Mono', Consolas, Monaco, monospace;
  font-size: 13px;
  background: rgba(15, 12, 22, 0.6);
  padding: 16px 20px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.03);
  color: #34d399;
}

/* Fluid Keyframe Animations */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Custom layout overrides */
#slaRows tr td:nth-child(2) {
  font-weight: 700;
}

#view-overview {
  gap: 14px;
}

#view-overview .metrics {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

#view-overview .metric {
  min-height: 76px;
  padding: 14px 18px;
}

#view-overview .metric-info {
  min-width: 0;
}

#view-overview .metric-info strong {
  font-size: 28px;
  margin-bottom: 2px;
}

#view-overview .metric-info span,
#view-overview .panel-head h2,
#view-overview th,
#view-overview td {
  white-space: nowrap;
}

#view-overview .metric-icon {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
}

.overview-charts {
  display: grid;
  grid-template-columns: minmax(320px, 0.95fr) minmax(340px, 1.05fr);
  gap: 14px;
  align-items: stretch;
}

.chart-panel {
  min-height: 214px;
  padding: 16px 18px;
}

.question-volume-panel {
  min-height: 214px;
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 10px;
}

.question-volume-panel .chart-head {
  grid-column: 1;
  grid-row: 1;
  margin-bottom: 0;
}

.chart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.chart-head h2 {
  margin: 0;
  font-size: 16px;
  line-height: 1.25;
  white-space: nowrap;
}

.chart-head span {
  color: var(--muted);
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  white-space: nowrap;
}

.mini-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.mini-stats div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.mini-stats span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.mini-stats strong {
  font-family: 'JetBrains Mono', monospace;
  white-space: nowrap;
}

.question-trend-chart {
  grid-column: 1;
  grid-row: 3;
  height: 100%;
  min-height: 130px;
  overflow-x: hidden;
  overflow-y: hidden;
  padding: 2px 0 0;
  border-radius: 0;
  background: transparent;
  border: 0;
}

.question-volume-detail {
  grid-column: 1;
  grid-row: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
}

.question-volume-detail .mini-stats {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
  gap: 12px;
}

.question-volume-detail .mini-stats div {
  min-height: 0;
  padding: 0;
  border-radius: 0;
  background: transparent;
  border: 0;
}

.question-volume-detail .mini-stats span {
  max-width: none;
  line-height: 1.2;
  font-size: 11px;
}

.question-volume-detail .mini-stats strong {
  font-size: 12px;
}

.hot-hours {
  min-width: 0;
  padding: 0;
  border-radius: 0;
  background: transparent;
  border: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.hot-hours > span {
  display: inline;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  margin-bottom: 0;
  white-space: nowrap;
}

.hot-hour-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.hot-hour {
  min-width: 0;
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  padding: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text-bright);
}

.hot-hour strong {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
}

.hot-hour small,
.small-empty {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.daily-chart {
  height: 154px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(32px, 1fr));
  align-items: end;
  gap: 10px;
  padding-top: 4px;
}

.daily-bar {
  min-width: 0;
  display: grid;
  grid-template-rows: 1fr auto auto;
  gap: 6px;
  align-items: end;
  text-align: center;
}

.daily-column-wrap {
  width: 100%;
  height: 102px;
  display: flex;
  align-items: end;
  justify-content: center;
  border-bottom: 1px solid var(--line);
}

.daily-column {
  width: min(24px, 72%);
  height: var(--bar-height);
  border-radius: 9px 9px 3px 3px;
  background: linear-gradient(180deg, #7c8cff, #5865f2);
  box-shadow: 0 12px 24px rgba(88, 101, 242, 0.16);
}

.daily-bar strong {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
}

.daily-bar span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}

.chart-empty {
  grid-column: 1 / -1;
  align-self: stretch;
}

.ranking-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ranking-row {
  display: grid;
  grid-template-columns: 24px 38px minmax(130px, 1fr) 72px 72px 86px;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 7px 8px;
  border-bottom: 1px solid var(--line);
  border-radius: 10px;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.ranking-row:hover {
  background: rgba(255, 255, 255, 0.025);
}

.ranking-row:last-child {
  border-bottom: 0;
}

.ranking-row:nth-child(1) .ranking-index,
.ranking-row:nth-child(1) .ranking-avatar {
  color: #f8d77b;
  border-color: rgba(248, 215, 123, 0.22);
}

.ranking-row:nth-child(2) .ranking-index,
.ranking-row:nth-child(2) .ranking-avatar {
  color: #c7d2fe;
  border-color: rgba(199, 210, 254, 0.18);
}

.ranking-row:nth-child(3) .ranking-index,
.ranking-row:nth-child(3) .ranking-avatar {
  color: #f0abfc;
  border-color: rgba(240, 171, 252, 0.18);
}

.ranking-index {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  font-weight: 800;
  color: var(--muted);
}



.ranking-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 13px;
  color: var(--text-bright);
  overflow: hidden;
  background: rgba(88, 101, 242, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.11);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.18);
}

.ranking-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ranking-main {
  min-width: 0;
}

.ranking-main strong {
  color: var(--text-bright);
  font-size: 14px;
  font-weight: 600;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ranking-main span {
  color: var(--muted);
  font-size: 11px;
  font-family: 'JetBrains Mono', monospace;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ranking-stats {
  text-align: center;
  line-height: 1.3;
  padding: 0 2px;
  min-width: 0;
}

.ranking-stats strong {
  display: block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  color: var(--text-bright);
  white-space: nowrap;
}

.ranking-stats span {
  display: block;
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-top: 1px;
  white-space: nowrap;
}

.ranking-stats.compact {
  color: var(--muted);
}

.ranking-stats.metric-questions strong {
  color: #8ea2ff;
}

.ranking-stats.metric-resolved strong {
  color: #34d399;
}

.ranking-stats.metric-time strong {
  color: #f8d77b;
}

.analysis-panel {
  gap: 18px;
  overflow: visible;
}

.analysis-panel .panel-head {
  align-items: flex-start;
}

.analysis-panel .panel-head h2 {
  white-space: nowrap;
  padding-top: 7px;
}

.analysis-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  padding: 16px 20px 0;
}

.analysis-summary div {
  min-height: 72px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.045);
}

.analysis-summary span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 6px;
}

.analysis-summary strong {
  font-family: 'JetBrains Mono', monospace;
  font-size: 20px;
}

.analysis-grid {
  display: grid;
  grid-template-columns: minmax(520px, 1.15fr) minmax(360px, 0.85fr);
  gap: 16px;
  padding: 0 20px 20px;
}

.analysis-card {
  min-width: 0;
  padding: 16px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.045);
  background: rgba(255, 255, 255, 0.025);
}

.analysis-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.analysis-card-head h3 {
  margin: 0;
  color: var(--text-bright);
  font-size: 15px;
}

.analysis-card-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.analysis-hour-bars {
  display: grid;
  grid-template-columns: repeat(24, minmax(0, 1fr));
  gap: 7px;
  align-items: end;
  min-height: 260px;
}

.analysis-hour-bar {
  min-width: 0;
  text-align: center;
}

.analysis-hour-track {
  height: 190px;
  display: flex;
  align-items: end;
  justify-content: center;
  border-bottom: 1px solid var(--line);
}

.analysis-hour-fill {
  width: min(18px, 74%);
  height: var(--bar-height);
  min-height: 3px;
  border-radius: 8px 8px 3px 3px;
  background: #6d7cff;
  box-shadow: 0 10px 20px rgba(109, 124, 255, 0.16);
}

.analysis-hour-bar strong,
.analysis-hour-bar span {
  display: block;
  font-family: 'JetBrains Mono', monospace;
}

.analysis-hour-bar strong {
  color: var(--text-bright);
  font-size: 11px;
  margin-top: 7px;
}

.analysis-hour-bar span {
  color: var(--muted);
  font-size: 10px;
  margin-top: 2px;
}

.analysis-trend-chart {
  height: 260px;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 4px;
}

.trend-line-wrap {
  width: 100%;
  min-height: 100%;
  overflow-x: auto;
  overflow-y: hidden;
}

.trend-svg {
  width: 100%;
  height: 100%;
  display: block;
}

.trend-line-wrap.compact {
  height: 100%;
}

.trend-line-wrap.compact .trend-svg {
  height: 100%;
}

.trend-grid {
  stroke: rgba(255, 255, 255, 0.12);
  stroke-width: 1;
}

.trend-grid.subtle {
  stroke-dasharray: 4 6;
  opacity: 0.55;
}

.trend-area {
  fill: rgba(16, 185, 129, 0.16);
}

.trend-line {
  fill: none;
  stroke: #10b981;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.trend-point {
  fill: var(--surface);
  stroke: #10b981;
  stroke-width: 2;
}

.trend-label {
  fill: var(--muted);
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 800;
}

.ranking-table th:first-child,
.ranking-table td:first-child {
  width: 52px;
  text-align: center;
}

.ranking-table th,
.ranking-table td {
  white-space: nowrap;
}

.mono-id {
  font-family: 'JetBrains Mono', monospace;
  color: var(--primary);
  font-size: 12px;
}

#view-overview .split {
  grid-template-columns: minmax(0, 1fr) minmax(300px, 0.56fr);
  gap: 14px;
}

#view-overview .panel-head {
  min-height: 50px;
  padding: 10px 18px;
}

#view-overview table {
  min-width: 0;
  table-layout: fixed;
}

#view-overview th,
#view-overview td {
  padding: 11px 16px;
  overflow: hidden;
  text-overflow: ellipsis;
}

#view-overview td:first-child strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#view-overview .tag-list {
  min-height: 76px;
  padding: 14px;
  flex: 1;
  margin: 10px;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 10px;
}

#view-overview .tag-list .empty {
  width: 100%;
  margin: auto;
  text-align: center;
  font-style: italic;
  color: var(--muted);
}

@media (max-width: 1360px) {
  .overview-charts {
    grid-template-columns: 1fr;
  }

  .question-volume-detail {
    grid-template-columns: 1fr;
  }

  .analysis-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .analysis-grid {
    grid-template-columns: 1fr;
  }

  .hour-grid {
    grid-template-columns: repeat(12, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  #view-overview .metrics,
  .overview-charts,
  #view-overview .split {
    grid-template-columns: 1fr;
  }

  .analysis-summary,
  .hour-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .question-volume-detail .mini-stats {
    grid-template-columns: 1fr;
  }

  .date-range-menu {
    right: auto;
    left: 0;
    grid-template-columns: 1fr;
  }

  .range-custom {
    grid-template-columns: 1fr;
  }

  .analysis-grid {
    padding: 0 12px 14px;
  }

  .analysis-hour-bars {
    grid-template-columns: repeat(12, minmax(0, 1fr));
  }

  .analysis-daily-chart,
  .analysis-trend-chart {
    overflow-x: auto;
  }

}

/* Responsive adjustments for Mobile */
@media (max-width: 1024px) {
  .app {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    gap: 16px;
    border-right: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  }

  .brand {
    padding: 2px;
  }
  
  .brand-info {
    display: none;
  }

  .nav {
    flex-direction: row;
    gap: 4px;
    flex-grow: 1;
    justify-content: center;
  }

  .nav-group {
    flex-direction: row;
    gap: 4px;
    margin: 0;
  }

  .nav-group-label {
    display: none;
  }

  .nav-item {
    padding: 10px;
    justify-content: center;
    width: auto;
    font-size: 0;
  }

  .nav-subitem {
    padding-left: 10px;
  }

  .session {
    margin-top: 0;
    padding: 6px;
    border: none;
    background: transparent;
  }
  
  .session-avatar {
    width: 32px;
    height: 32px;
  }
  
  .session-details {
    display: none;
  }

  .split {
    grid-template-columns: 1fr;
  }

  .scheduler-layout {
    grid-template-columns: 1fr;
  }

  .people-drawer {
    max-height: 360px;
  }

  .content {
    padding: 24px;
    height: auto;
    overflow-y: visible;
  }
}

@media (max-width: 640px) {
  .sidebar {
    flex-direction: column;
    gap: 12px;
  }
  
  .nav {
    width: 100%;
    justify-content: space-between;
  }
  
  .nav-item {
    flex-grow: 1;
  }
  
  .content {
    padding: 16px;
  }
  
  .topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .shift-toolbar {
    grid-template-columns: 1fr;
  }

  .shift-toolbar label:nth-child(3) {
    grid-column: auto;
  }

  .scheduler-layout {
    padding: 12px;
  }

  .shift-board {
    grid-template-columns: 66px repeat(var(--board-days), minmax(130px, 1fr));
  }

  .time-head,
  .shift-slot {
    min-height: 84px;
  }
}

.actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.actions input,
.actions select {
  width: auto;
  min-width: 150px;
}

.date-range-control {
  position: relative;
  flex: 0 0 auto;
}

.export-control {
  position: relative;
  flex: 0 0 auto;
}

.export-control[hidden] {
  display: none;
}

.export-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 30;
  width: 280px;
  display: flex;
  flex-direction: column;
  padding: 8px;
  gap: 4px;
  border-radius: var(--radius);
  background: #302b3a;
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.42);
}

.export-menu[hidden] {
  display: none;
}

.export-menu-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  background: transparent;
  color: var(--text-bright);
  text-align: left;
  padding: 9px 12px;
  border-radius: 8px;
}

.export-menu-item strong {
  font-weight: 700;
  font-size: 13px;
}

.export-menu-item small {
  color: var(--muted);
  font-size: 11px;
}

.export-menu-item:hover {
  background: rgba(109, 124, 255, 0.14);
}

.export-menu-item.primary {
  background: rgba(109, 124, 255, 0.18);
}

.export-menu-item.primary:hover {
  background: rgba(109, 124, 255, 0.3);
}

.export-menu-item[hidden],
.export-menu-label[hidden],
.export-menu-select[hidden] {
  display: none;
}

.export-menu-divider {
  height: 1px;
  margin: 4px 2px;
  background: rgba(255, 255, 255, 0.08);
}

.export-menu-label {
  padding: 4px 12px 0;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.export-menu-select {
  margin: 0 8px;
  width: calc(100% - 16px);
  min-height: 36px;
  border-radius: 8px;
  background: rgba(20, 18, 26, 0.55);
  color: var(--text-bright);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 6px 10px;
}

.date-range-button {
  min-width: 154px;
  min-height: 38px;
  border-radius: 30px;
  background: rgba(20, 18, 26, 0.55);
  color: var(--text-bright);
  padding: 8px 18px;
  font-weight: 800;
  text-align: left;
}

.date-range-button::after {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-left: 14px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
  opacity: 0.7;
}

.date-range-menu {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  z-index: 30;
  width: min(560px, 90vw);
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr);
  overflow: hidden;
  border-radius: var(--radius);
  background: #302b3a;
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.42);
}

.date-range-menu[hidden] {
  display: none;
}

.range-presets {
  display: flex;
  flex-direction: column;
  padding: 10px 0;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(16, 14, 22, 0.38);
}

.range-presets button {
  min-height: 38px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  padding: 9px 16px;
  font-weight: 600;
}

.range-presets button:hover,
.range-presets button.active {
  background: rgba(109, 124, 255, 0.14);
  color: var(--text-bright);
}

.range-custom {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 16px;
  padding: 18px;
  min-width: 0;
  background: rgba(255, 255, 255, 0.025);
}

.range-custom label {
  min-width: 0;
  color: var(--muted);
  letter-spacing: 0;
  text-transform: none;
}

.range-custom input {
  width: 100%;
  min-width: 0;
  border-radius: 10px;
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(20, 18, 26, 0.7);
  color: var(--text-bright);
  padding: 8px 12px;
}

.range-custom .button {
  grid-column: 1 / -1;
  justify-self: end;
  align-self: end;
  min-height: 40px;
  height: 40px;
  min-width: 118px;
  border-radius: 12px;
}

@media (max-width: 760px) {
  .date-range-menu {
    left: 0;
    grid-template-columns: 1fr;
  }

  .range-presets {
    border-right: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  }

  .range-custom {
    grid-template-columns: 1fr;
  }
}

/* Premium Database Stats Tabs and Pagination */
.db-stats-tabs {
  display: flex;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.01);
  overflow-x: auto;
}

.db-tab {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 8px 16px;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
}

.db-tab:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.15);
  color: var(--text-bright);
}

.db-tab.active {
  background: rgba(109, 124, 255, 0.15);
  border-color: rgba(109, 124, 255, 0.4);
  color: #a5b4fc;
  box-shadow: 0 4px 12px rgba(109, 124, 255, 0.08);
}

.db-tab .tab-count {
  background: rgba(0, 0, 0, 0.2);
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.03);
}

.db-tab.active .tab-count {
  background: rgba(109, 124, 255, 0.25);
  color: #ffffff;
  border-color: rgba(109, 124, 255, 0.1);
}

.pagination-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.01);
}

.pagination-buttons {
  display: flex;
  gap: 8px;
}

.toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
  max-width: 380px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--surface-opaque);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  color: var(--text-bright);
  font-size: 13px;
  font-weight: 500;
  min-width: 240px;
  pointer-events: auto;
  opacity: 0;
  transform: translateX(20px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.toast.show {
  opacity: 1;
  transform: translateX(0);
}

.toast-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.toast-text {
  flex: 1;
  word-break: break-word;
}

.toast-info {
  border-left: 3px solid var(--success);
}
.toast-info .toast-icon { color: var(--success); }

.toast-error {
  border-left: 3px solid var(--danger);
  background: linear-gradient(135deg, rgba(239,68,68,0.08), var(--surface-opaque));
}
.toast-error .toast-icon { color: var(--danger); }

.toast-warn {
  border-left: 3px solid var(--warning);
}
.toast-warn .toast-icon { color: var(--warning); }

/* Question Structure Overhaul Styling */
.exam-paper-form {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 14px;
}
.exam-paper-form[hidden] {
  display: none;
}
.exam-paper-basic {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) minmax(220px, 2.4fr) minmax(140px, 1fr);
  gap: 12px;
  width: 100%;
  align-items: end;
}
@media (max-width: 720px) {
  .exam-paper-basic {
    grid-template-columns: 1fr;
  }
}
.exam-paper-basic .grow-2 {
  /* placeholder for any future tweak */
}
.exam-paper-advanced-toggle {
  width: 100%;
}
.exam-paper-advanced-toggle .button.ghost {
  min-height: 28px;
  height: 28px;
  padding: 0 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  border-radius: 6px;
  transform: none;
}
.adv-toggle-icon {
  display: inline-block;
  transition: transform 0.2s;
  margin-right: 4px;
}
.adv-toggle-icon.open {
  transform: rotate(90deg);
}
.exam-paper-advanced {
  display: none;
  gap: 12px;
  flex-wrap: wrap;
  width: 100%;
  padding: 12px;
  background: rgba(0, 0, 0, 0.15);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.03);
  box-sizing: border-box;
}
.exam-paper-advanced.open {
  display: flex;
}
.exam-paper-advanced #examPaperStatus {
  min-width: 140px;
}
.exam-paper-actions {
  display: flex;
  gap: 8px;
}
.exam-struct-section {
  margin-top: 4px;
  background: rgba(0, 0, 0, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.03);
  border-radius: 12px;
  padding: 14px 14px 12px;
  width: 100%;
  box-sizing: border-box;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}
.exam-struct-section:focus-within {
  border-color: rgba(109, 124, 255, 0.15) !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}
.exam-struct-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 8px;
  flex-wrap: wrap;
  gap: 8px;
}
.exam-struct-head strong {
  font-size: 14px;
  color: var(--text-bright);
}
.quick-create-struct {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}
.quick-create-struct span {
  color: var(--muted);
}
.quick-create-struct #quickCreateCount {
  width: 56px;
  min-height: 28px;
  height: 28px;
  padding: 2px 8px;
  font-size: 12px;
  text-align: center;
  border-radius: 6px;
}
.quick-create-struct .button.small {
  min-height: 28px;
  height: 28px;
  padding: 0 12px;
  font-size: 11px;
  border-radius: 6px;
}
#examPaperStructureRows {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 360px;
  overflow-y: auto;
  padding-right: 4px;
  margin-bottom: 12px;
}
.exam-struct-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 12px;
  font-size: 12px;
  color: var(--muted);
  flex-wrap: wrap;
  gap: 8px;
}
.exam-struct-foot .button.small {
  min-height: 32px;
  height: 32px;
  border-radius: 6px;
}
.exam-struct-summary strong {
  color: var(--text-bright);
}
.exam-struct-summary strong:last-child {
  color: var(--primary-hover);
}
.empty-struct {
  text-align: center;
  color: var(--muted);
  padding: 24px;
  font-style: italic;
  font-size: 13px;
  background: rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  border: 1px dashed rgba(255, 255, 255, 0.05);
}
.struct-row:hover {
  background: rgba(255, 255, 255, 0.03) !important;
  border-color: rgba(255, 255, 255, 0.06) !important;
}
.struct-row input[type="text"], 
.struct-row input[type="number"] {
  background: rgba(20, 18, 26, 0.6) !important;
  border-color: rgba(255, 255, 255, 0.05) !important;
  transition: all 0.2s ease;
}
.struct-row input[type="text"]:focus, 
.struct-row input[type="number"]:focus {
  background: rgba(20, 18, 26, 0.85) !important;
  border-color: var(--line-focus) !important;
  box-shadow: 0 0 0 2px rgba(109, 124, 255, 0.1) !important;
}
.button.small.danger.icon-btn-round {
  background: rgba(239, 68, 68, 0.08) !important;
  border: 1px solid rgba(239, 68, 68, 0.15) !important;
  color: #f87171 !important;
  transition: all 0.2s ease !important;
}
.button.small.danger.icon-btn-round:hover {
  background: rgba(239, 68, 68, 0.2) !important;
  color: #ffffff !important;
  transform: scale(1.08) rotate(90deg);
}
.button.small.danger.icon-btn-round:active {
  transform: scale(0.92);
}
#examPaperStructureRows::-webkit-scrollbar {
  width: 6px;
}
#examPaperStructureRows::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.1);
  border-radius: 3px;
}
#examPaperStructureRows::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}
#examPaperStructureRows::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Hierarchical Question Card System */
.main-q-card {
  background: rgba(255, 255, 255, 0.015);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 10px;
  padding: 10px 12px;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.main-q-card:hover {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.08);
}
.main-q-card:focus-within {
  border-color: rgba(109, 124, 255, 0.3);
  background: rgba(109, 124, 255, 0.02);
  box-shadow: 0 2px 12px rgba(109, 124, 255, 0.08);
}
.main-q-card input {
  transition: all 0.2s ease;
}
.main-q-card input:focus {
  border-color: var(--line-focus) !important;
  background: rgba(20, 18, 26, 0.85) !important;
}
.main-q-header {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.main-q-card.has-subs .main-q-header {
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.05);
}
.main-q-tag {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.main-q-path-input {
  width: 60px;
  min-height: 32px;
  height: 32px;
  font-weight: 700;
  text-align: center;
  border-radius: 6px;
  background: rgba(20, 18, 26, 0.6) !important;
}
.main-q-score-input {
  width: 76px;
  min-height: 32px;
  height: 32px;
  text-align: center;
  border-radius: 6px;
  background: rgba(20, 18, 26, 0.6) !important;
}
.main-q-score-input::-webkit-outer-spin-button,
.main-q-score-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.main-q-score-input {
  -moz-appearance: textfield;
}
.main-q-score-input.computed {
  background: rgba(109, 124, 255, 0.1) !important;
  border-color: transparent !important;
  color: var(--primary-hover) !important;
  font-weight: 700;
}
.field-label-inline {
  color: var(--muted);
  font-size: 12px;
}
.main-q-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-left: auto;
}
.main-q-actions .button.small {
  min-height: 28px;
  height: 28px;
  padding: 0 10px;
  font-size: 11px;
  border-radius: 6px;
}
.main-q-actions .icon-btn-round {
  min-height: 28px;
  height: 28px;
  width: 28px;
  padding: 0;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.sub-rows-container {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.sub-q-row {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 4px 0 4px 24px;
  position: relative;
  transition: all 0.2s ease;
}
.sub-q-row::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 1px;
}
.sub-q-row::after {
  content: '';
  position: absolute;
  left: 8px;
  top: 50%;
  width: 10px;
  height: 2px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 1px;
}
.sub-q-row:hover {
  background: rgba(255, 255, 255, 0.015);
  border-radius: 6px;
}
.sub-q-tag {
  color: var(--primary-hover);
  font-size: 13px;
  font-weight: 700;
  min-width: 22px;
}
.sub-q-path-input {
  width: 52px;
  min-height: 28px;
  height: 28px;
  padding: 2px 6px;
  font-size: 12px;
  text-align: center;
  border-radius: 6px;
  background: rgba(20, 18, 26, 0.6) !important;
}
.sub-q-score-input {
  width: 66px;
  min-height: 28px;
  height: 28px;
  padding: 2px 4px;
  font-size: 12px;
  text-align: center;
  border-radius: 6px;
  background: rgba(20, 18, 26, 0.6) !important;
}
.sub-q-score-input::-webkit-outer-spin-button,
.sub-q-score-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.sub-q-score-input {
  -moz-appearance: textfield;
}
.sub-q-remove {
  min-height: 22px !important;
  height: 22px !important;
  width: 22px !important;
  padding: 0 !important;
  margin-left: auto;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── GRADE SHEET ─────────────────────────────────────────────────────────── */
.grade-picker-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.grade-picker-search-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.grade-picker-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 420px;
  overflow-y: auto;
}
.grade-picker-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.12s, border-color 0.12s;
}
.grade-picker-item:hover {
  background: var(--surface-hover);
  border-color: var(--border);
}
.grade-picker-item.graded { opacity: 0.6; }
.grade-picker-info { flex: 1; min-width: 0; }
.grade-picker-name { font-weight: 600; font-size: 14px; color: var(--text-bright); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.grade-picker-sub  { font-size: 12px; color: var(--muted); margin-top: 2px; }
.grade-picker-badge { font-size: 11px; padding: 2px 8px; border-radius: 20px; font-weight: 600; white-space: nowrap; }
.grade-picker-badge.open    { background: rgba(87,242,135,.15); color: #57f287; }
.grade-picker-badge.grading { background: rgba(88,101,242,.18); color: #8b9cf4; }
.grade-picker-badge.graded  { background: rgba(87,242,135,.08); color: var(--muted); }
.grade-picker-badge.expired { background: rgba(237,66,69,.15); color: #ed4245; }

/* Score summary bar */
.grade-score-bar {
  display: flex;
  align-items: flex-start;
  gap: 24px;
  padding: 14px 20px;
  background: var(--primary-surface);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.grade-score-bar-left {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 180px;
}
.grade-score-label { font-size: 13px; color: var(--muted); }
.grade-score-value { font-size: 28px; font-weight: 800; color: var(--primary-hover); line-height: 1; }
.grade-score-sep   { font-size: 18px; color: var(--muted); }
.grade-score-max   { font-size: 18px; color: var(--muted); }
.grade-score-bar-right { flex: 1; min-width: 240px; display: flex; flex-direction: column; gap: 4px; }
.grade-overall-label { font-size: 12px; color: var(--muted); font-weight: 600; }
.grade-overall-textarea {
  width: 100%;
  min-height: 52px;
  resize: vertical;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
}

/* Per-question panels (Modern Redesign) */
.grade-questions-wrap {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.grade-q-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.grade-q-header-modern {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: rgba(88, 101, 242, 0.05);
  border-bottom: 1px solid var(--border);
}
.grade-q-header-title {
  font-weight: 700;
  font-size: 15px;
  color: var(--primary-hover);
}
.grade-q-header-meta {
  display: flex;
  gap: 16px;
  align-items: center;
}
.grade-q-header-meta .grade-q-barem {
  font-size: 12px;
  color: var(--muted);
}
.grade-q-header-meta .grade-q-score-summary {
  font-size: 14px;
  font-weight: 700;
  color: var(--success);
  background: rgba(16, 185, 129, 0.1);
  padding: 3px 10px;
  border-radius: 12px;
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.grading-cards-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
  gap: 20px;
  padding: 20px;
}
@media (max-width: 600px) {
  .grading-cards-container {
    grid-template-columns: 1fr;
    padding: 12px;
    gap: 12px;
  }
}

.grading-q-card {
  background: var(--surface-2);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 18px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.grading-q-card:hover {
  border-color: rgba(109, 124, 255, 0.25);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  transform: translateY(-1px);
}

.grading-q-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  padding-bottom: 10px;
}
.grading-q-card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-bright);
}
.grading-q-card-barem {
  font-size: 12px;
  color: var(--muted);
}
.grading-q-card-barem span {
  font-weight: 700;
  color: var(--warning);
}

.grading-quick-score-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.grading-quick-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
}
.grading-quick-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.quick-score-pill {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 20px;
  padding: 4px 10px;
  color: var(--text);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.12s ease;
}
.quick-score-pill:hover {
  background: rgba(109, 124, 255, 0.08);
  color: var(--primary-hover);
  border-color: rgba(109, 124, 255, 0.2);
}
.quick-score-pill.active {
  background: var(--primary);
  color: var(--text-bright);
  border-color: var(--primary);
  box-shadow: 0 0 10px rgba(109, 124, 255, 0.25);
}

.grading-inputs-row {
  display: flex;
  gap: 16px;
  align-items: stretch;
}
.grading-score-col {
  width: 105px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}
.grading-comment-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.grading-input-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
}

.grading-score-input-wrapper {
  display: flex;
  align-items: center;
  background: rgba(20, 18, 26, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  height: 42px;
  padding: 0 10px;
  transition: all 0.15s ease;
}
.grading-score-input-wrapper:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(109, 124, 255, 0.15);
}
.grade-score-input-modern {
  width: 100%;
  border: none;
  background: transparent;
  color: var(--warning);
  font-weight: 800;
  font-size: 16px;
  text-align: center;
  padding: 0;
  outline: none;
  -moz-appearance: textfield;
}
.grade-score-input-modern::-webkit-outer-spin-button,
.grade-score-input-modern::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.grading-score-slash {
  color: rgba(255, 255, 255, 0.15);
  margin: 0 4px;
  font-size: 14px;
}
.grading-score-max {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.grade-comment-input-modern {
  width: 100%;
  min-height: 42px;
  background: rgba(20, 18, 26, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
  resize: none;
  overflow-y: hidden;
  box-sizing: border-box;
  font-family: inherit;
  transition: all 0.15s ease;
}
.grade-comment-input-modern:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(109, 124, 255, 0.15);
  outline: none;
  color: var(--text-bright);
}

.grade-overall-textarea-modern {
  width: 100%;
  min-height: 100px;
  background: rgba(20, 18, 26, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 14px 18px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  resize: none;
  overflow-y: hidden;
  box-sizing: border-box;
  font-family: inherit;
  transition: all 0.15s ease;
}
.grade-overall-textarea-modern:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(109, 124, 255, 0.15);
  outline: none;
  color: var(--text-bright);
}

.grade-sheet-title-block { display: flex; flex-direction: column; gap: 2px; }
.grade-sheet-meta { font-size: 12px; color: var(--muted); }

/* Score summary bar (Redesign) */
.grade-score-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: linear-gradient(135deg, rgba(88, 101, 242, 0.12) 0%, rgba(109, 124, 255, 0.04) 100%);
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  margin: 0;
}
.grade-score-bar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.grade-score-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.grade-score-value-container {
  display: flex;
  align-items: baseline;
  gap: 4px;
  background: rgba(20, 18, 26, 0.3);
  padding: 4px 14px;
  border-radius: 20px;
  border: 1px solid rgba(109, 124, 255, 0.15);
}
.grade-score-value {
  font-size: 24px;
  font-weight: 800;
  color: var(--warning);
}
.grade-score-sep {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.3);
  margin: 0 2px;
}
.grade-score-max {
  font-size: 14px;
  color: var(--muted);
}

/* ==========================================================================
   GOOGLE SHEETS GRADING SYSTEM STYLES
   ========================================================================== */

.spreadsheet-panel-wrap {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-top: 14px;
}

.spreadsheet-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.spreadsheet-hint {
  font-size: 12px;
  color: var(--muted);
  margin-left: auto;
}

.spreadsheet-grid-scroll-wrap {
  width: 100%;
  overflow: auto;
  max-height: 560px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.2);
  position: relative;
}

.spreadsheet-grid-table {
  width: max-content;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}

.spreadsheet-grid-table th {
  position: sticky;
  top: 0;
  z-index: 10;
  background: #1B2A4A;
  color: #FFFFFF;
  font-weight: 700;
  font-size: 12px;
  padding: 8px 12px;
  text-align: center;
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  border-bottom: 2px solid var(--border);
  box-sizing: border-box;
}

.spreadsheet-grid-table td {
  padding: 0;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  height: 38px;
  box-sizing: border-box;
}

.spreadsheet-grid-table tr:hover td {
  background: var(--surface-hover);
}

.spreadsheet-grid-table th.sticky-col,
.spreadsheet-grid-table td.sticky-col {
  position: sticky;
  left: 0;
  z-index: 5;
  border-right: 2px solid var(--border) !important;
  width: 120px;
  min-width: 120px;
}

.spreadsheet-grid-table th.sticky-col-2,
.spreadsheet-grid-table td.sticky-col-2 {
  position: sticky;
  left: 120px;
  z-index: 5;
  border-right: 2px solid var(--border) !important;
  width: 180px;
  min-width: 180px;
}

.spreadsheet-grid-table td.sticky-col,
.spreadsheet-grid-table td.sticky-col-2 {
  background: #251e33 !important;
}

.spreadsheet-cell-input {
  width: 100%;
  height: 100%;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-bright);
  font-size: 13px;
  padding: 6px 10px;
  box-sizing: border-box;
  outline: none;
  transition: all 0.15s ease;
}

.spreadsheet-cell-input:focus {
  background: rgba(109, 124, 255, 0.12) !important;
  border: 1.5px solid var(--primary-hover) !important;
  box-shadow: inset 0 0 0 1px var(--primary-hover);
  color: #FFFFFF;
}

.spreadsheet-cell-input.score {
  text-align: center;
  font-weight: 700;
}

.spreadsheet-cell-input.total-score {
  text-align: center;
  font-weight: 800;
  color: var(--primary-hover);
  background: rgba(109, 124, 255, 0.05);
}

.grade-question-tabs {
  display: flex;
  gap: 6px;
  padding: 10px 20px;
  background: rgba(255, 255, 255, 0.01);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}

.grade-tab-btn {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  padding: 6px 14px;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.grade-tab-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-bright);
}

.grade-tab-btn.active {
  background: rgba(109, 124, 255, 0.18);
  border-color: rgba(109, 124, 255, 0.4);
  color: #a5b4fc;
}

.grade-canned-comments-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 20px;
  background: rgba(0, 0, 0, 0.12);
  border-top: 1px solid var(--border);
}

.canned-comments-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.canned-comments-header strong {
  font-size: 13px;
  color: var(--text-bright);
}

.canned-comments-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 8px;
  max-height: 180px;
  overflow-y: auto;
  padding-right: 6px;
}

.canned-comment-item {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  position: relative;
  transition: all 0.15s ease;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.canned-comment-item:hover {
  background: rgba(109, 124, 255, 0.08);
  border-color: rgba(109, 124, 255, 0.2);
  color: var(--text-bright);
}

.canned-comment-text {
  flex: 1;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.canned-comment-delete {
  background: transparent;
  border: none;
  color: rgba(239, 68, 68, 0.4);
  padding: 2px;
  cursor: pointer;
  border-radius: 4px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.canned-comment-delete:hover {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
}
