/* ══════════════════════════════════════════════════
   MiTurno365 — Design System & Global Styles
   Colors derived from Logo: Navy, Teal, Green
   ══════════════════════════════════════════════════ */

/* ── Design Tokens ── */
:root {
  /* Context-based spacing tokens */
  --touch-target-size: 44px;
  --form-spacing: 16px;
  --modal-padding: 24px;
}

:root[data-mt365-device="mobile"] {
  --touch-target-size: 48px;
  --form-spacing: 20px;
}

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

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

body {
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-body);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── App Layout ── */
.app-container {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  color: var(--text-on-dark);
  z-index: 100;
  display: flex;
  flex-direction: column;
  transition: transform var(--transition);
  overflow-y: auto;
  isolation: isolate;
}

.sidebar-ambient {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  opacity: var(--sidebar-ambient-opacity);
  transform: translateZ(0);
}

.sidebar-ambient-layer,
.sidebar-ambient-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.sidebar-ambient-depth {
  background:
    radial-gradient(circle at 22% 16%, rgba(82, 214, 255, 0.2), transparent 28%),
    radial-gradient(circle at 74% 28%, rgba(88, 255, 183, 0.16), transparent 24%),
    radial-gradient(circle at 38% 56%, rgba(56, 180, 255, 0.16), transparent 32%),
    radial-gradient(circle at 66% 82%, rgba(104, 255, 190, 0.14), transparent 26%),
    linear-gradient(180deg, rgba(255,255,255,0.025) 0%, rgba(255,255,255,0) 22%, rgba(0,0,0,0.1) 100%);
  opacity: var(--sidebar-ambient-depth-opacity);
  mix-blend-mode: screen;
  animation: sidebarDepthFloat calc(24s * var(--sidebar-ambient-speed)) ease-in-out infinite alternate;
}

.sidebar-ambient-aurora {
  background:
    conic-gradient(from 210deg at 56% 58%, transparent 0deg, rgba(70, 217, 255, 0.12) 48deg, transparent 110deg, rgba(111, 255, 188, 0.12) 182deg, transparent 250deg, rgba(77, 196, 255, 0.1) 320deg, transparent 360deg),
    radial-gradient(circle at 58% 64%, rgba(88, 221, 255, 0.18), transparent 34%);
  opacity: var(--sidebar-ambient-aurora-opacity);
  mix-blend-mode: screen;
  filter: blur(14px);
  animation: sidebarAuroraFlow calc(36s * var(--sidebar-ambient-speed)) ease-in-out infinite alternate;
}

.sidebar-ambient-focus {
  background:
    radial-gradient(circle at 58% 61%, rgba(76, 228, 255, 0.18), transparent 18%),
    radial-gradient(circle at 61% 61%, rgba(96, 255, 188, 0.1), transparent 26%),
    radial-gradient(circle at 54% 23%, rgba(89, 221, 255, 0.12), transparent 16%);
  opacity: var(--sidebar-ambient-focus-opacity);
  mix-blend-mode: screen;
  filter: blur(8px);
  animation: sidebarFocusPulse calc(20s * var(--sidebar-ambient-speed)) ease-in-out infinite alternate;
}

.sidebar-ambient-core {
  background:
    radial-gradient(circle at 58% 60%, rgba(102, 235, 255, 0.18), transparent 22%),
    radial-gradient(circle at 60% 61%, rgba(99, 255, 194, 0.08), transparent 32%),
    linear-gradient(180deg, transparent 0%, rgba(73, 205, 255, 0.03) 44%, rgba(88, 255, 186, 0.04) 60%, transparent 100%);
  opacity: var(--sidebar-ambient-core-opacity);
  filter: blur(10px);
  mix-blend-mode: screen;
  animation: sidebarCoreShift calc(18s * var(--sidebar-ambient-speed)) ease-in-out infinite alternate;
}

.sidebar-ambient-halo {
  background:
    radial-gradient(circle at 22% 24%, rgba(96, 233, 255, 0.3), transparent 24%),
    radial-gradient(circle at 70% 48%, rgba(88, 255, 177, 0.22), transparent 28%),
    radial-gradient(circle at 54% 78%, rgba(70, 212, 255, 0.18), transparent 32%);
  filter: blur(28px);
  opacity: var(--sidebar-ambient-halo-opacity);
  mix-blend-mode: screen;
  animation: sidebarHaloDrift calc(28s * var(--sidebar-ambient-speed)) ease-in-out infinite alternate;
}

.sidebar-ambient-sweep {
  background:
    linear-gradient(118deg, transparent 14%, rgba(116, 241, 255, 0.02) 28%, rgba(116, 241, 255, 0.1) 42%, rgba(95, 255, 186, 0.14) 54%, transparent 74%);
  transform: translate3d(-46%, -12%, 0) rotate(8deg);
  filter: blur(16px);
  opacity: var(--sidebar-ambient-sweep-opacity);
  mix-blend-mode: screen;
  animation: sidebarSweep calc(32s * var(--sidebar-ambient-speed)) linear infinite;
}

.sidebar-ambient-sweep-alt {
  background:
    linear-gradient(198deg, transparent 18%, rgba(107, 235, 255, 0.08) 46%, rgba(92, 255, 176, 0.1) 58%, transparent 78%);
  transform: translate3d(34%, -18%, 0) rotate(-14deg);
  filter: blur(22px);
  opacity: 0.44;
  animation-duration: calc(42s * var(--sidebar-ambient-speed));
  animation-direction: reverse;
}

.sidebar-ambient-column {
  width: 42px;
  left: auto;
  right: 8px;
  background:
    linear-gradient(180deg, transparent 0%, rgba(93, 230, 255, 0.02) 12%, rgba(93, 230, 255, 0.12) 46%, rgba(118, 255, 183, 0.08) 66%, transparent 100%);
  opacity: 0.7;
  filter: blur(6px);
  mix-blend-mode: screen;
  animation: sidebarColumnShift calc(26s * var(--sidebar-ambient-speed)) ease-in-out infinite alternate;
}

.sidebar-ambient-vignette {
  background:
    radial-gradient(circle at center, transparent 38%, rgba(3, 18, 34, 0.14) 78%, rgba(2, 12, 24, 0.32) 100%);
  opacity: 0.9;
}

.sidebar-ambient-svg {
  overflow: visible;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.08), rgba(0, 0, 0, 0.92) 14%, rgba(0, 0, 0, 0.96) 86%, rgba(0, 0, 0, 0.42));
  transform: translateZ(0);
}

.sidebar-ambient-grid rect,
.sidebar-ambient-timelines path,
.sidebar-ambient-timelines circle,
.sidebar-ambient-orbits ellipse,
.sidebar-ambient-mesh path,
.sidebar-ambient-signals path,
.sidebar-ambient-links line,
.sidebar-ambient-arcs path,
.sidebar-ambient-rings ellipse,
.sidebar-ambient-beacons circle,
.sidebar-ambient-particles circle,
.sidebar-ambient-ghosts g,
.sidebar-ambient-ghosts path,
.sidebar-ambient-ghosts rect,
.sidebar-ambient-ghosts circle {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sidebar-ambient-grid rect {
  fill: rgba(137, 236, 255, 0.024);
  stroke: rgba(136, 226, 255, calc(var(--sidebar-ambient-grid-opacity) * 1.04));
  stroke-width: 1;
  opacity: 0.74;
  animation: sidebarGridPulse calc(14s * var(--sidebar-ambient-speed)) ease-in-out infinite;
}

.sidebar-ambient-grid rect.is-active {
  fill: rgba(116, 246, 255, 0.12);
  stroke: rgba(138, 255, 196, 0.38);
  opacity: 1;
}

.sidebar-ambient-timelines path {
  stroke: rgba(112, 232, 255, 0.15);
  stroke-width: 1.05;
  stroke-dasharray: 3 10;
}

.sidebar-ambient-timelines circle {
  fill: rgba(165, 248, 255, 0.48);
  stroke: rgba(95, 238, 255, 0.28);
  stroke-width: 1;
  animation: sidebarTimelinePulse calc(7.2s * var(--sidebar-ambient-speed)) ease-in-out infinite;
}

.sidebar-ambient-orbits ellipse {
  stroke: rgba(131, 238, 255, calc(var(--sidebar-ambient-orbit-opacity) + var(--orbit-opacity, 0.12)));
  stroke-dasharray: 4 16;
  transform-box: fill-box;
  transform-origin: center;
  animation: sidebarOrbitSpin calc(42s * var(--sidebar-ambient-speed)) linear infinite;
}

.sidebar-ambient-mesh path {
  stroke: url(#sidebarAmbientMeshGradient);
  stroke-width: 1.05;
  stroke-dasharray: 5 12;
  opacity: var(--mesh-opacity, 0.28);
  animation: sidebarMeshFlow calc(26s * var(--sidebar-ambient-speed)) ease-in-out infinite;
}

.sidebar-ambient-signals path {
  stroke: rgba(116, 242, 255, calc(var(--sidebar-ambient-signal-opacity) + var(--signal-opacity, 0.18)));
  stroke-width: 1.15;
  stroke-dasharray: 8 14;
  animation: sidebarSignalFlow calc(18s * var(--sidebar-ambient-speed)) ease-in-out infinite;
}

.sidebar-ambient-links line {
  stroke: url(#sidebarAmbientLineGradient);
  stroke-width: 1.15;
  stroke-dasharray: 4 10;
  opacity: calc(var(--sidebar-ambient-line-opacity) * var(--line-opacity, 1));
  animation: sidebarLinkPulse calc(18s * var(--sidebar-ambient-speed)) ease-in-out infinite;
}

.sidebar-ambient-nodes circle {
  fill: rgba(160, 246, 255, calc(var(--sidebar-ambient-node-opacity) * var(--node-opacity, 1)));
  filter: drop-shadow(0 0 8px rgba(92, 232, 255, 0.28));
  transform-box: fill-box;
  transform-origin: center;
  animation: sidebarNodePulse calc(5.4s * var(--sidebar-ambient-speed)) ease-in-out infinite;
}

.sidebar-ambient-arcs path {
  stroke: url(#sidebarAmbientArcGradient);
  stroke-dasharray: 12 14;
  opacity: var(--arc-opacity, 0.24);
  animation: sidebarArcFloat calc(22s * var(--sidebar-ambient-speed)) ease-in-out infinite alternate;
}

.sidebar-ambient-rings ellipse {
  stroke: rgba(137, 241, 255, var(--ring-opacity, 0.18));
  stroke-dasharray: 4 12;
  animation: sidebarRingBreathe calc(16s * var(--sidebar-ambient-speed)) ease-in-out infinite;
}

.sidebar-ambient-beacons circle {
  fill: rgba(90, 228, 255, calc(var(--sidebar-ambient-beacon-opacity) * var(--beacon-opacity, 1)));
  filter: blur(18px);
  animation: sidebarBeaconPulse calc(12s * var(--sidebar-ambient-speed)) ease-in-out infinite;
}

.sidebar-ambient-particles circle {
  fill: rgba(173, 248, 255, calc(var(--sidebar-ambient-particle-opacity) * var(--particle-opacity, 1)));
  filter: drop-shadow(0 0 8px rgba(101, 234, 255, 0.34));
  animation: sidebarParticlePulse calc(8s * var(--sidebar-ambient-speed)) ease-in-out infinite;
}

.sidebar-ambient-ghosts g {
  stroke: rgba(168, 244, 255, var(--sidebar-ambient-ghost-opacity));
  stroke-width: 1.1;
  opacity: 0.92;
  animation: sidebarGhostFloat calc(24s * var(--sidebar-ambient-speed)) ease-in-out infinite alternate;
}

.sidebar-ambient-ghosts .ghost-pattern circle {
  fill: rgba(154, 247, 255, 0.12);
}

.sidebar-ambient-ghosts .ghost-clock .ghost-core,
.sidebar-ambient-ghosts .ghost-plan circle {
  fill: rgba(152, 247, 255, 0.11);
}

.sidebar-logo,
.sidebar-nav,
.sidebar-user {
  position: relative;
  z-index: 1;
}

.sidebar-logo {
  padding: 20px 18px 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  overflow: hidden;
}

.sidebar-logo::before {
  content: '';
  position: absolute;
  inset: 12px 18px;
  border-radius: 20px;
  background:
    linear-gradient(135deg, rgba(111, 233, 255, 0.12), rgba(89, 255, 187, 0.05)),
    rgba(255,255,255,0.02);
  border: 1px solid rgba(150, 240, 255, 0.14);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.08),
    0 12px 28px rgba(3, 18, 34, 0.18);
}

.sidebar-logo::after {
  content: '';
  position: absolute;
  width: 180px;
  height: 76px;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  border-radius: 999px;
  background: radial-gradient(circle, rgba(86, 228, 255, 0.26), rgba(86, 228, 255, 0.02) 64%, transparent 78%);
  filter: blur(16px);
  opacity: 0.88;
}

.sidebar-logo img {
  width: min(210px, 100%);
  height: auto;
  max-height: 82px;
  position: relative;
  z-index: 1;
  filter:
    drop-shadow(0 6px 16px rgba(0,0,0,0.32))
    drop-shadow(0 0 18px rgba(94, 228, 255, 0.2));
}

.sidebar-logo h1 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.sidebar-logo h1 span {
  color: var(--green-400);
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;
}

.sidebar-nav::before {
  content: '';
  position: absolute;
  top: 26px;
  bottom: 34px;
  left: 22px;
  width: 1px;
  background: linear-gradient(180deg, rgba(113, 236, 255, 0.24), rgba(113, 236, 255, 0.03) 24%, rgba(118, 255, 185, 0.08) 62%, transparent 100%);
  opacity: 0.6;
  pointer-events: none;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  border-radius: var(--border-radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all var(--transition-fast);
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(0px);
}

.sidebar-nav a::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
  transform: scaleY(0);
  transition: transform var(--transition-fast);
}

.sidebar-nav a::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, rgba(110, 238, 255, 0.04), transparent 42%, rgba(116, 255, 189, 0.06));
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.sidebar-nav a:hover {
  color: var(--white);
  background: rgba(255,255,255,0.08);
  box-shadow: inset 0 0 0 1px rgba(129, 231, 255, 0.08);
}

.sidebar-nav a:hover::after {
  opacity: 1;
}

.sidebar-nav a.active {
  color: var(--white);
  background:
    linear-gradient(135deg, rgba(0,180,216,0.2), rgba(16, 103, 177, 0.24));
  box-shadow:
    inset 0 0 0 1px rgba(115, 230, 255, 0.16),
    0 12px 28px rgba(0, 26, 52, 0.22);
}

.sidebar-nav a.active::before {
  transform: scaleY(1);
}

.sidebar-nav a.active::after {
  opacity: 1;
}

.sidebar-nav a svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}

.sidebar-nav a > * {
  position: relative;
  z-index: 1;
}

@media (hover: hover) {
  .sidebar:hover .sidebar-ambient,
  .sidebar:focus-within .sidebar-ambient {
    opacity: calc(var(--sidebar-ambient-opacity) + 0.1);
  }

  .sidebar:hover .sidebar-ambient-sweep,
  .sidebar:hover .sidebar-ambient-sweep-alt,
  .sidebar:focus-within .sidebar-ambient-sweep,
  .sidebar:focus-within .sidebar-ambient-sweep-alt {
    opacity: 0.88;
  }

  .sidebar:hover .sidebar-logo::after,
  .sidebar:focus-within .sidebar-logo::after {
    opacity: 1;
  }

  .sidebar:hover .sidebar-user,
  .sidebar:focus-within .sidebar-user {
    border-color: rgba(146, 235, 255, 0.16);
  }

  .sidebar:hover .sidebar-nav a.active,
  .sidebar:focus-within .sidebar-nav a.active {
    box-shadow:
      inset 0 0 0 1px rgba(124, 234, 255, 0.2),
      0 14px 30px rgba(0, 28, 55, 0.24);
  }
}

.sidebar-user {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  gap: 12px;
  border-radius: 18px;
  margin: 12px 14px 16px;
  background:
    linear-gradient(135deg, rgba(255,255,255,0.06), rgba(255,255,255,0.03)),
    rgba(255,255,255,0.02);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.07),
    0 10px 26px rgba(3, 18, 34, 0.18);
  border: 1px solid rgba(142, 231, 255, 0.08);
  overflow: hidden;
}

.sidebar-user::before {
  content: '';
  position: absolute;
  inset: -10% 48% -18% -14%;
  background: radial-gradient(circle, rgba(88, 230, 255, 0.16), transparent 70%);
  filter: blur(16px);
  opacity: 0.72;
}

.sidebar-user-avatar {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 1;
  box-shadow: none;
  background: transparent;
}

.sidebar-user-avatar .app-avatar {
  box-shadow: 0 0 0 1px rgba(169, 247, 255, 0.14), 0 10px 20px rgba(6, 28, 47, 0.26), inset 0 1px 0 rgba(255,255,255,0.18);
}

.sidebar-user-info {
  flex: 1;
  min-width: 0;
  position: relative;
  z-index: 1;
}

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

.sidebar-user-role {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.5);
}

.inline-user-identity {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.inline-user-avatar {
  flex-shrink: 0;
}

.inline-user-copy {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-meta-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  color: var(--text-secondary);
  font-size: 0.82rem;
}

.attachment-author-identity .inline-user-copy {
  max-width: 160px;
}

.form-grid-three {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.avatar-settings-panel {
  display: grid;
  gap: 18px;
  padding: 20px;
  margin-bottom: 24px;
  border: 1px solid rgba(13, 74, 139, 0.12);
  border-radius: var(--border-radius-lg);
  background:
    linear-gradient(145deg, rgba(235, 247, 255, 0.9), rgba(247, 252, 255, 0.98)),
    radial-gradient(circle at 18% 18%, rgba(0, 180, 216, 0.12), transparent 36%);
}

.avatar-settings-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 20px;
  align-items: center;
}

.avatar-settings-preview-shell {
  width: 152px;
  min-width: 152px;
  min-height: 152px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 28px;
  background: radial-gradient(circle at 30% 20%, rgba(255,255,255,0.8), rgba(255,255,255,0.2));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.7), 0 16px 30px rgba(13, 74, 139, 0.12);
}

.avatar-settings-preview-art {
  box-shadow: 0 22px 42px rgba(10, 57, 87, 0.2), 0 0 0 1px rgba(255,255,255,0.6);
}

.avatar-settings-copy {
  min-width: 0;
}

.avatar-settings-copy h4 {
  font-size: 1.05rem;
  margin-bottom: 8px;
}

.avatar-settings-copy p {
  color: var(--text-secondary);
  max-width: 60ch;
}

.avatar-settings-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.avatar-settings-grid {
  align-items: end;
}

.avatar-settings-hint {
  margin-top: -4px;
}

@keyframes sidebarHaloDrift {
  0% {
    transform: translate3d(-4%, -2%, 0) scale(0.95);
  }
  100% {
    transform: translate3d(4%, 3%, 0) scale(1.08);
  }
}

@keyframes sidebarDepthFloat {
  0% {
    transform: translate3d(-2%, -1%, 0) scale(0.98);
  }
  100% {
    transform: translate3d(2%, 2%, 0) scale(1.04);
  }
}

@keyframes sidebarAuroraFlow {
  0% {
    transform: translate3d(-2%, -1%, 0) rotate(-4deg) scale(1);
  }
  100% {
    transform: translate3d(3%, 2%, 0) rotate(5deg) scale(1.06);
  }
}

@keyframes sidebarFocusPulse {
  0%, 100% {
    opacity: 0.28;
    transform: scale(0.98);
  }
  50% {
    opacity: 0.56;
    transform: scale(1.04);
  }
}

@keyframes sidebarCoreShift {
  0% {
    opacity: 0.2;
    transform: translate3d(-1%, -1%, 0) scale(0.98);
  }
  100% {
    opacity: 0.48;
    transform: translate3d(2%, 1%, 0) scale(1.04);
  }
}

@keyframes sidebarSweep {
  0% {
    transform: translate3d(-48%, -14%, 0) rotate(8deg);
  }
  100% {
    transform: translate3d(42%, 12%, 0) rotate(8deg);
  }
}

@keyframes sidebarColumnShift {
  0% {
    transform: translate3d(0, -4%, 0) scaleY(0.96);
  }
  100% {
    transform: translate3d(0, 4%, 0) scaleY(1.04);
  }
}

@keyframes sidebarGridPulse {
  0%, 100% {
    opacity: 0.58;
    transform: translate3d(0, 0, 0);
  }
  50% {
    opacity: 0.96;
    transform: translate3d(0, -3px, 0);
  }
}

@keyframes sidebarTimelinePulse {
  0%, 100% {
    opacity: 0.46;
    transform: scale(1);
  }
  50% {
    opacity: 0.96;
    transform: scale(1.18);
  }
}

@keyframes sidebarOrbitSpin {
  0% {
    opacity: 0.22;
    stroke-dashoffset: 0;
    transform: rotate(var(--orbit-rotation, 0deg));
  }
  50% {
    opacity: 0.5;
  }
  100% {
    opacity: 0.28;
    stroke-dashoffset: -18;
    transform: rotate(calc(var(--orbit-rotation, 0deg) + 8deg));
  }
}

@keyframes sidebarMeshFlow {
  0%, 100% {
    opacity: 0.34;
    stroke-dashoffset: 0;
  }
  50% {
    opacity: 0.82;
    stroke-dashoffset: -18;
  }
}

@keyframes sidebarSignalFlow {
  0%, 100% {
    opacity: 0.2;
    stroke-dashoffset: 0;
  }
  50% {
    opacity: 0.82;
    stroke-dashoffset: -20;
  }
}

@keyframes sidebarNodePulse {
  0%, 100% {
    transform: scale(1);
    opacity: 0.65;
  }
  50% {
    transform: scale(var(--pulse-scale, 1.1));
    opacity: 1;
  }
}

@keyframes sidebarLinkPulse {
  0%, 100% {
    opacity: 0.28;
    stroke-dashoffset: 0;
  }
  50% {
    opacity: 0.78;
    stroke-dashoffset: -14;
  }
}

@keyframes sidebarArcFloat {
  0% {
    opacity: 0.24;
    transform: translate3d(0, 0, 0);
  }
  100% {
    opacity: 0.72;
    transform: translate3d(6px, -8px, 0);
  }
}

@keyframes sidebarRingBreathe {
  0%, 100% {
    opacity: 0.22;
    transform: scale(0.98);
  }
  50% {
    opacity: 0.52;
    transform: scale(1.04);
  }
}

@keyframes sidebarGhostFloat {
  0% {
    opacity: 0.28;
    transform: translate3d(0, 0, 0);
  }
  100% {
    opacity: 0.7;
    transform: translate3d(0, -10px, 0);
  }
}

@keyframes sidebarBeaconPulse {
  0%, 100% {
    opacity: 0.18;
    transform: scale(0.92);
  }
  50% {
    opacity: 0.48;
    transform: scale(1.08);
  }
}

@keyframes sidebarParticlePulse {
  0%, 100% {
    opacity: 0.38;
    transform: scale(0.88);
  }
  50% {
    opacity: 1;
    transform: scale(1.26);
  }
}

@media (prefers-reduced-motion: reduce) {
  .sidebar-ambient-depth,
  .sidebar-ambient-aurora,
  .sidebar-ambient-focus,
  .sidebar-ambient-core,
  .sidebar-ambient-halo,
  .sidebar-ambient-sweep,
  .sidebar-ambient-column,
  .sidebar-ambient-grid rect,
  .sidebar-ambient-timelines circle,
  .sidebar-ambient-orbits ellipse,
  .sidebar-ambient-mesh path,
  .sidebar-ambient-signals path,
  .sidebar-ambient-links line,
  .sidebar-ambient-nodes circle,
  .sidebar-ambient-arcs path,
  .sidebar-ambient-rings ellipse,
  .sidebar-ambient-beacons circle,
  .sidebar-ambient-particles circle,
  .sidebar-ambient-ghosts g {
    animation: none !important;
  }

  .sidebar-ambient {
    opacity: calc(var(--sidebar-ambient-opacity) * 0.78);
  }
}

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

/* ── Header ── */
.header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-height);
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
}

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

.header-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--navy-900);
  letter-spacing: -0.01em;
}

.header-subtitle {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-left: 4px;
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  padding: 8px;
  border-radius: var(--border-radius-sm);
}

.menu-toggle:hover {
  background: var(--gray-100);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--border-radius-sm);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  position: relative;
}

.header-btn:hover {
  background: var(--gray-100);
  color: var(--text-primary);
}

.header-btn .badge {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  background: var(--danger);
  border-radius: var(--border-radius-full);
  border: 2px solid var(--white);
}

.header-avatar {
  width: auto;
  height: auto;
  padding: 0;
  border-radius: var(--border-radius-full);
  background: transparent;
  color: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.header-avatar:hover {
  box-shadow: none;
}

.app-avatar {
  --avatar-size: 40px;
  width: var(--avatar-size);
  height: var(--avatar-size);
  flex: 0 0 var(--avatar-size);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  border-radius: var(--border-radius-full);
  background: radial-gradient(circle at 25% 20%, rgba(255,255,255,0.18), transparent 40%), linear-gradient(140deg, rgba(10, 34, 59, 0.98), rgba(12, 76, 104, 0.95));
  box-shadow: 0 10px 24px rgba(8, 37, 61, 0.22), inset 0 1px 0 rgba(255,255,255,0.18);
}

.app-avatar--rounded {
  border-radius: 18px;
}

.app-avatar-svg {
  width: 100%;
  height: 100%;
  display: block;
}

.app-avatar--fallback {
  background: linear-gradient(135deg, var(--navy-700), var(--teal-500));
}

.app-avatar-fallback-text {
  font-weight: 700;
  font-size: calc(var(--avatar-size) * 0.34);
  color: var(--white);
  letter-spacing: -0.03em;
}

.header-avatar .app-avatar {
  box-shadow: 0 0 0 1px rgba(7, 31, 52, 0.88), 0 0 0 4px rgba(255,255,255,0.06), 0 10px 18px rgba(15, 43, 67, 0.16);
}

.header-avatar:hover .app-avatar,
.header-avatar:focus-visible .app-avatar {
  transform: translateY(-1px);
  box-shadow: 0 0 0 1px rgba(7, 31, 52, 0.92), 0 0 0 4px rgba(139, 240, 255, 0.18), 0 14px 24px rgba(9, 44, 70, 0.22);
}

/* ── Page Content ── */
.page-content {
  flex: 1;
  padding: 28px;
  max-width: 1400px;
  width: 100%;
}

.page-content > section {
  display: none;
}

.page-content > section.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

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

/* ── Cards ── */
.card {
  background: var(--bg-card);
  border-radius: var(--border-radius);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition), transform var(--transition);
}

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

.card-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-header h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--navy-900);
}

.card-body {
  padding: 20px 24px;
}

.card-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ── Dashboard Stats Grid ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-card);
  border-radius: var(--border-radius);
  padding: 24px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: flex-start;
  gap: 16px;
  transition: all var(--transition);
  cursor: default;
}

.stat-card-link {
  cursor: pointer;
  color: inherit;
  text-decoration: none;
}

.stat-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.stat-card-link:focus-visible {
  outline: 3px solid rgba(0,180,216,0.25);
  outline-offset: 2px;
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--border-radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-icon.blue { background: var(--navy-100); color: var(--navy-600); }
.stat-icon.teal { background: var(--teal-100); color: var(--teal-600); }
.stat-icon.green { background: var(--green-100); color: var(--green-600); }
.stat-icon.orange { background: #fff7ed; color: #ea580c; }

.stat-icon svg { width: 24px; height: 24px; }

.stat-info h4 {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--navy-900);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.stat-info p {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* ── Today's Shift Banner ── */
.today-shift {
  background: linear-gradient(135deg, var(--navy-800), var(--navy-700), var(--teal-600));
  border-radius: var(--border-radius-lg);
  padding: 32px;
  color: var(--white);
  margin-bottom: 28px;
  position: relative;
  overflow: hidden;
}

.today-shift::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -10%;
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(0,180,216,0.2) 0%, transparent 70%);
  border-radius: 50%;
}

.today-shift::after {
  content: '';
  position: absolute;
  bottom: -30%;
  left: 20%;
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(67,160,71,0.15) 0%, transparent 70%);
  border-radius: 50%;
}

.today-shift-content {
  position: relative;
  z-index: 1;
}

.today-shift-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  opacity: 0.8;
  margin-bottom: 8px;
}

.today-shift-name {
  font-size: 1.75rem;
  font-weight: 800;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.today-shift-name .shift-badge {
  padding: 4px 12px;
  border-radius: var(--border-radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  background: rgba(255,255,255,0.2);
  backdrop-filter: blur(4px);
}

.today-shift-time {
  font-size: 1.1rem;
  opacity: 0.9;
  display: flex;
  align-items: center;
  gap: 8px;
}

.today-shift-meta {
  display: flex;
  gap: 24px;
  margin-top: 16px;
}

.today-shift-meta span {
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 6px;
  opacity: 0.85;
}

/* ── Dashboard Grid ── */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

/* ── Upcoming Shifts List ── */
.upcoming-list {
  list-style: none;
}

.upcoming-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--gray-100);
}

.upcoming-item:last-child {
  border-bottom: none;
}

.upcoming-date {
  width: 48px;
  height: 48px;
  border-radius: var(--border-radius-sm);
  background: var(--navy-100);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.upcoming-date .day {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--navy-700);
  line-height: 1;
}

.upcoming-date .month {
  font-size: 0.65rem;
  color: var(--navy-500);
  text-transform: uppercase;
  font-weight: 600;
}

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

.upcoming-info h4 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
}

.upcoming-info p {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.upcoming-tag {
  padding: 4px 10px;
  border-radius: var(--border-radius-full);
  font-size: 0.7rem;
  font-weight: 600;
  white-space: nowrap;
}

/* ── Quick Actions ── */
.quick-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.quick-action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 20px 12px;
  border-radius: var(--border-radius);
  border: 2px dashed var(--border-color);
  background: var(--gray-50);
  cursor: pointer;
  transition: all var(--transition);
  text-align: center;
}

.quick-action-btn:hover {
  border-color: var(--accent);
  background: var(--teal-100);
  transform: translateY(-2px);
}

.quick-action-btn svg {
  width: 28px;
  height: 28px;
  color: var(--navy-600);
}

.quick-action-btn span {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* ══════════════════════════════════════════
   CALENDAR PAGE
   ══════════════════════════════════════════ */

.calendar-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.calendar-nav {
  display: flex;
  align-items: center;
  gap: 12px;
}

.calendar-nav h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--navy-900);
  min-width: 200px;
  text-align: center;
}

.calendar-views {
  display: flex;
  background: var(--gray-100);
  border-radius: var(--border-radius-sm);
  padding: 3px;
}

.calendar-views button {
  padding: 8px 16px;
  border: none;
  background: transparent;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.calendar-views button.active {
  background: var(--white);
  color: var(--navy-700);
  box-shadow: var(--shadow-sm);
  font-weight: 600;
}

/* Month Calendar Grid */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--border-color);
  border-radius: var(--border-radius);
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.calendar-day-header {
  background: var(--navy-800);
  color: var(--text-on-dark);
  padding: 10px 8px;
  text-align: center;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.calendar-day {
  background: var(--white);
  min-height: 100px;
  padding: 8px;
  cursor: pointer;
  transition: background var(--transition-fast);
  position: relative;
}

.calendar-day:hover {
  background: var(--gray-50);
}

.calendar-day.other-month {
  background: var(--gray-50);
  opacity: 0.5;
}

.calendar-day.today {
  background: var(--teal-100);
}

.calendar-day .day-number {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.calendar-day.today .day-number {
  background: var(--accent);
  color: var(--white);
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--border-radius-full);
  font-size: 0.8rem;
}

.calendar-day.holiday .day-number {
  color: var(--danger);
}

.calendar-event {
  display: block;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 500;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--white);
}

/* Week View */
.week-view {
  display: none;
}

.week-view.active {
  display: block;
}

.week-grid {
  display: grid;
  grid-template-columns: 60px repeat(7, 1fr);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  overflow: hidden;
}

.week-time-slot {
  padding: 8px 4px;
  font-size: 0.7rem;
  color: var(--text-muted);
  text-align: right;
  border-bottom: 1px solid var(--gray-100);
  height: 50px;
}

.week-cell {
  border-left: 1px solid var(--gray-100);
  border-bottom: 1px solid var(--gray-100);
  min-height: 50px;
  padding: 2px;
  position: relative;
  cursor: pointer;
}

.week-cell:hover {
  background: var(--gray-50);
}

.week-header {
  background: var(--navy-800);
  color: var(--white);
  padding: 10px 8px;
  text-align: center;
  font-size: 0.8rem;
  font-weight: 600;
  border-left: 1px solid rgba(255,255,255,0.1);
}

.week-header.today-col {
  background: var(--teal-600);
}

.week-corner {
  background: var(--navy-900);
}

/* Day View */
.day-view {
  display: none;
}

.day-view.active {
  display: block;
}

.day-timeline {
  position: relative;
}

.day-hour {
  display: grid;
  grid-template-columns: 60px 1fr;
  min-height: 60px;
  border-bottom: 1px solid var(--gray-100);
}

.day-hour-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  padding: 8px 8px 0 0;
  text-align: right;
}

.day-hour-content {
  border-left: 1px solid var(--gray-200);
  padding: 4px 8px;
  cursor: pointer;
}

.day-hour-content:hover {
  background: var(--gray-50);
}

.day-event-block {
  padding: 8px 12px;
  border-radius: 6px;
  color: var(--white);
  font-size: 0.8rem;
  font-weight: 500;
  margin-bottom: 4px;
}

/* ══════════════════════════════════════════
   SHIFTS PAGE
   ══════════════════════════════════════════ */

.shifts-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.shifts-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 8px 16px;
  border-radius: var(--border-radius-full);
  border: 1px solid var(--border-color);
  background: var(--white);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.filter-btn.active, .filter-btn:hover {
  background: var(--navy-700);
  color: var(--white);
  border-color: var(--navy-700);
}

.shifts-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.shift-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition);
  cursor: pointer;
}

.shift-item:hover {
  box-shadow: var(--shadow-md);
  transform: translateX(4px);
}

.shift-color-bar {
  width: 4px;
  height: 48px;
  border-radius: 2px;
  flex-shrink: 0;
}

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

.shift-item-info h4 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}

.shift-item-info p {
  font-size: 0.8rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
}

.shift-item-tag {
  padding: 4px 12px;
  border-radius: var(--border-radius-full);
  font-size: 0.7rem;
  font-weight: 600;
  white-space: nowrap;
}

.shift-item-actions {
  display: flex;
  gap: 4px;
}

.shift-item-actions button {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.shift-item-actions button:hover {
  background: var(--gray-100);
  color: var(--text-primary);
}

.shift-item-actions button.delete:hover {
  background: #fee2e2;
  color: var(--danger);
}

/* ══════════════════════════════════════════
   EVENTS PAGE
   ══════════════════════════════════════════ */

.events-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.event-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  overflow: hidden;
  transition: all var(--transition);
  cursor: pointer;
}

.event-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.event-card-banner {
  height: 8px;
}

.event-card-body {
  padding: 20px;
}

.event-card-type {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--border-radius-full);
  font-size: 0.7rem;
  font-weight: 600;
  margin-bottom: 12px;
}

.event-card-body h4 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.event-card-body p {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.event-card-dates {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.event-card-dates svg {
  width: 16px;
  height: 16px;
  color: var(--navy-500);
}

/* ══════════════════════════════════════════
   STATS PAGE
   ══════════════════════════════════════════ */

.stats-charts-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

.chart-container {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.chart-container h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--navy-900);
  margin-bottom: 20px;
}

.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 200px;
  padding-top: 20px;
}

.bar-chart-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  height: 100%;
  justify-content: flex-end;
}

.bar {
  width: 100%;
  max-width: 40px;
  border-radius: 6px 6px 0 0;
  min-height: 4px;
  transition: height var(--transition-slow);
  position: relative;
}

.bar:hover {
  opacity: 0.85;
}

.bar-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  font-weight: 500;
  text-align: center;
}

.bar-value {
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
}

/* Donut / Pie */
.donut-chart {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.donut-svg {
  width: 180px;
  height: 180px;
}

.donut-legend {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.donut-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
}

.donut-legend-color {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex-shrink: 0;
}

.donut-legend-label {
  flex: 1;
  color: var(--text-secondary);
}

.donut-legend-value {
  font-weight: 600;
  color: var(--text-primary);
}

.export-btns {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* ══════════════════════════════════════════
   SETTINGS PAGE
   ══════════════════════════════════════════ */

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 20px;
}

.settings-section {
  background: var(--bg-card);
  border-radius: var(--border-radius);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.settings-section-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 10px;
}

.settings-section-header svg {
  width: 20px;
  height: 20px;
  color: var(--navy-600);
}

.settings-section-header h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--navy-900);
}

.settings-section-body {
  padding: 20px 24px;
}

.form-group {
  margin-bottom: 18px;
  min-width: 0;
}

.form-group:last-child {
  margin-bottom: 0;
}

.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
  overflow-wrap: anywhere;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--text-primary);
  background: var(--white);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0,180,216,0.1);
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--gray-100);
}

.toggle-row:last-child {
  border-bottom: none;
}

.toggle-row-info h4 {
  font-size: 0.85rem;
  font-weight: 600;
}

.toggle-row-info p {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.toggle-switch {
  position: relative;
  width: 44px;
  height: 24px;
  cursor: pointer;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--gray-300);
  border-radius: var(--border-radius-full);
  transition: background var(--transition-fast);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--white);
  top: 3px;
  left: 3px;
  transition: transform var(--transition-fast);
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--success);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(20px);
}

/* ══════════════════════════════════════════
   BUTTONS
   ══════════════════════════════════════════ */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--border-radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  font-family: inherit;
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  white-space: nowrap;
}

.btn svg { width: 18px; height: 18px; }

.btn-primary {
  background: linear-gradient(135deg, var(--navy-700), var(--navy-600));
  color: var(--white);
  box-shadow: 0 2px 8px rgba(13,74,139,0.25);
}

.btn-primary:hover {
  box-shadow: 0 4px 12px rgba(13,74,139,0.35);
  transform: translateY(-1px);
}

.btn-accent {
  background: linear-gradient(135deg, var(--teal-500), var(--teal-400));
  color: var(--white);
  box-shadow: 0 2px 8px rgba(0,180,216,0.25);
}

.btn-accent:hover {
  box-shadow: 0 4px 12px rgba(0,180,216,0.35);
  transform: translateY(-1px);
}

.btn-success {
  background: linear-gradient(135deg, var(--green-600), var(--green-500));
  color: var(--white);
  box-shadow: 0 2px 8px rgba(67,160,71,0.25);
}

.btn-success:hover {
  box-shadow: 0 4px 12px rgba(67,160,71,0.35);
  transform: translateY(-1px);
}

.btn-outline {
  background: var(--white);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-outline:hover {
  background: var(--gray-50);
  border-color: var(--gray-300);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover {
  background: var(--gray-100);
  color: var(--text-primary);
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  justify-content: center;
}

.btn-sm {
  padding: 6px 14px;
  font-size: 0.8rem;
}

.btn-sm svg {
  width: 16px;
  height: 16px;
}

/* ══════════════════════════════════════════
   MODAL
   ══════════════════════════════════════════ */

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(10,37,64,0.5);
  backdrop-filter: blur(4px);
  z-index: 320;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  overscroll-behavior: none;
  padding:
    max(12px, env(safe-area-inset-top, 0px))
    max(12px, env(safe-area-inset-right, 0px))
    max(12px, env(safe-area-inset-bottom, 0px))
    max(12px, env(safe-area-inset-left, 0px));
}

.modal-overlay.active {
  display: flex;
  animation: modalBgIn 0.2s ease;
}

@keyframes modalBgIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  background: var(--white);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-lg);
  width: min(100%, 520px);
  max-width: 520px;
  max-height: calc(100vh - 24px);
  max-height: calc(100dvh - 24px);
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalIn 0.25s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-shrink: 0;
}

.modal-header h2 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--navy-900);
  min-width: 0;
  overflow-wrap: anywhere;
}

.modal-close {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.modal-close:hover {
  background: var(--gray-100);
  color: var(--text-primary);
}

.modal-body {
  padding: 24px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
}

.modal-body > * {
  min-width: 0;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-shrink: 0;
  padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
}

/* ── Color picker row ── */
.color-options {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.color-option {
  width: 32px;
  height: 32px;
  border-radius: var(--border-radius-full);
  border: 3px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.color-option:hover {
  transform: scale(1.1);
}

.color-option.selected {
  border-color: var(--navy-900);
  box-shadow: 0 0 0 2px var(--white), 0 0 0 4px var(--navy-700);
}

/* ── Mobile Nav ── */
.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--mobile-nav-height);
  background: var(--white);
  border-top: 1px solid var(--border-color);
  z-index: 100;
  padding: 0 8px;
}

.mobile-nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-around;
  height: 100%;
}

.mobile-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.65rem;
  font-weight: 600;
  transition: color var(--transition-fast);
  border-radius: var(--border-radius-sm);
}

.mobile-nav a svg {
  width: 22px;
  height: 22px;
}

.mobile-nav a.active {
  color: var(--navy-700);
}

.mobile-nav a:hover {
  color: var(--navy-600);
}

/* ── Shift type colors ── */
.bg-morning { background: #f59e0b; }
.bg-afternoon { background: var(--teal-500); }
.bg-night { background: var(--navy-700); }
.bg-guard { background: #7c3aed; }
.bg-rest { background: var(--green-500); }
.bg-vacation { background: #ec4899; }
.bg-permit { background: #8b5cf6; }
.bg-court { background: #ef4444; }
.bg-compensation { background: #06b6d4; }

.text-morning { color: #b45309; background: #fef3c7; }
.text-afternoon { color: #0e7490; background: var(--teal-100); }
.text-night { color: var(--navy-700); background: var(--navy-100); }
.text-guard { color: #6d28d9; background: #f5f3ff; }
.text-rest { color: var(--green-700); background: var(--green-100); }
.text-vacation { color: #be185d; background: #fce7f3; }

/* ── Pattern Wizard ── */
.pattern-wizard {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}

.pattern-wizard h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--navy-900);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.pattern-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.pattern-step {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  border-radius: var(--border-radius-sm);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--white);
}

.pattern-step .step-count {
  font-weight: 700;
}

/* ── Responsive ── */
@media (max-width: 1024px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  .stats-charts-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 0 0 30px rgba(0,0,0,0.3);
  }
  .main-content {
    margin-left: 0;
    padding-bottom: var(--mobile-nav-height);
  }
  .mobile-nav {
    display: block;
  }
  .menu-toggle {
    display: flex;
  }
  .page-content {
    padding: 16px;
  }
  .header {
    padding: 0 16px;
  }
  .today-shift {
    padding: 20px;
  }
  .today-shift-name {
    font-size: 1.25rem;
    flex-direction: column;
    align-items: flex-start;
  }
  .today-shift-meta {
    flex-direction: column;
    gap: 4px;
    font-size: 0.8rem;
  }
  .today-shift-label {
    font-size: 0.7rem;
    margin-bottom: 4px;
  }
  .today-shift-time {
    font-size: 0.95rem;
    margin-top: 4px;
  }
  .calendar-day {
    min-height: 54px;
    padding: 2px;
  }
  .calendar-day-header {
    font-size: 0.75rem;
    padding: 4px 2px;
    color: var(--text-secondary);
  }
  .calendar-day .day-number {
    font-size: 0.7rem;
  }
  .calendar-overflow {
    font-size: 0.55rem;
    padding: 1px 2px;
  }
  .calendar-event {
    font-size: 0.55rem;
    padding: 1px 2px;
  }
  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
  .stat-card {
    padding: 12px;
  }
  .stat-info h4 {
    font-size: 1.1rem;
  }
  .settings-grid {
    grid-template-columns: 1fr;
  }
  .quick-actions {
    grid-template-columns: 1fr 1fr;
  }
  .shifts-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .events-grid {
    grid-template-columns: 1fr;
  }
  .modal {
    max-width: 100%;
    margin: 10px;
    max-height: 85vh;
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr !important;
  }
  .quick-actions {
    grid-template-columns: 1fr;
  }
  .header-left {
    gap: 8px;
  }
  .header-title {
    font-size: 1.1rem;
  }
  .header-subtitle {
    display: none;
  }
}

@media (max-width: 360px) {
  .calendar-day-header {
    font-size: 0.65rem;
    letter-spacing: -0.02em;
  }
  .calendar-day {
    min-height: 48px;
  }
  .today-shift {
    padding: 16px;
  }
  .today-shift-name {
    font-size: 1.1rem;
  }
}

@media (max-width: 932px) and (max-height: 500px) and (orientation: landscape) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: 0 0 30px rgba(0,0,0,0.3);
  }

  .main-content {
    margin-left: 0;
    padding-bottom: var(--mobile-nav-height);
  }

  .mobile-nav {
    display: block;
  }

  .menu-toggle {
    display: flex;
  }

  .page-content {
    padding: 14px;
  }

  .header {
    padding: 0 16px;
  }
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }

/* ── Print Styles ── */
@media print {
  .sidebar, .mobile-nav, .header { display: none !important; }
  .main-content { margin-left: 0 !important; }
  .page-content { padding: 0 !important; }
}

/* ── Empty state ── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}

.empty-state svg {
  width: 64px;
  height: 64px;
  margin-bottom: 16px;
  opacity: 0.4;
}

.empty-state h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.empty-state p {
  font-size: 0.9rem;
  max-width: 400px;
  margin: 0 auto 20px;
}
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }

/* ── Print Styles ── */
@media print {
  .sidebar, .mobile-nav, .header { display: none !important; }
  .main-content { margin-left: 0 !important; }
  .page-content { padding: 0 !important; }
}

/* ── Empty state ── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}

.empty-state svg {
  width: 64px;
  height: 64px;
  margin-bottom: 16px;
  opacity: 0.4;
}

.empty-state h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.empty-state p {
  font-size: 0.9rem;
  max-width: 400px;
  margin: 0 auto 20px;
}

/* Sidebar overlay for mobile */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 99;
}

.sidebar-overlay.active {
  display: block;
}

/* ── Avatar Gallery Settings ── */
.avatar-settings-panel {
  background: var(--bg-card);
  border-radius: var(--border-radius-lg);
  border: 1px solid var(--border-color);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

.avatar-settings-head {
  display: flex;
  gap: 24px;
  align-items: center;
  margin-bottom: 24px;
}

@media (max-width: 640px) {
  .avatar-settings-head {
    flex-direction: column;
    text-align: center;
    gap: 16px;
  }
}

.avatar-settings-preview-shell {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 128px;
  height: 128px;
}

.avatar-settings-copy h4 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--navy-900);
  margin-bottom: 8px;
}

.avatar-settings-copy p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 16px;
  line-height: 1.5;
}

.avatar-settings-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

@media (max-width: 640px) {
  .avatar-settings-tags {
    justify-content: center;
  }
}

.avatar-gallery {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  max-width: 256px;
  margin: 0 auto 20px auto;
}

.avatar-gallery-item {
  background: transparent;
  border: 2px solid transparent;
  padding: 8px;
  border-radius: var(--border-radius);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  outline: none;
}

.avatar-gallery-item:hover, .avatar-gallery-item:focus-visible {
  background: var(--gray-50);
  transform: translateY(-2px);
}

.avatar-gallery-item.active {
  border-color: var(--accent);
  background: var(--teal-50);
  box-shadow: 0 4px 12px rgba(0, 180, 216, 0.15);
}

/* ══════════════════════════════════════════
   NUCLEAR RESPONSIVE OVERRIDES (MOBILE 100%)
   ══════════════════════════════════════════ */

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr !important;
    display: grid !important;
    gap: 12px !important;
  }
  .quick-actions {
    grid-template-columns: 1fr !important;
    display: grid !important;
    gap: 12px !important;
  }
  .stat-card {
    padding: 16px !important;
  }
}

@media (max-width: 375px) {
  .header-left {
    gap: 8px !important;
  }
  .header-title {
    font-size: 1.1rem !important;
  }
  .today-shift {
    padding: 16px !important;
  }
  .today-shift-name {
    font-size: 1.1rem !important;
  }
}

