/* ===============================================================
   Start Free Agent — styles/main.css
   Editorial Brutalist AI Interface: Pure Single Sentence, Seamless Inline Input
   =============================================================== */

/* Self-hosted Typography */
@font-face {
  font-family: 'Unbounded';
  font-style: normal;
  font-weight: 200;
  font-display: swap;
  src: url('../fonts/unbounded-200.woff2') format('woff2');
}
@font-face {
  font-family: 'Unbounded';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/unbounded-400.woff2') format('woff2');
}
@font-face {
  font-family: 'Unbounded';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('../fonts/unbounded-700.woff2') format('woff2');
}
@font-face {
  font-family: 'Unbounded';
  font-style: normal;
  font-weight: 900;
  font-display: swap;
  src: url('../fonts/unbounded-900.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url('../fonts/inter-300.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/inter-400.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('../fonts/inter-500.woff2') format('woff2');
}

/* Design Tokens */
:root {
  --c-bg:        #F7F6F3;
  --c-ink:       #0A0A0A;
  --c-ink-mid:   #1A1A1A;
  --c-ink-muted: #666666;
  --c-ink-faint: #A0A0A0;

  /* Start Free Signature Colored Glitch Palette */
  --c-glitch-a:  #ff003c; /* Neon Crimson / Cyber Red */
  --c-glitch-b:  #00ffcc; /* Electric Teal / Neon Cyan */

  --f-display:   'Unbounded', 'Arial Black', Arial, sans-serif;
  --f-body:      'Inter', Arial, sans-serif;

  --ease-out:    cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

html, body {
  width: 100%;
  height: 100%;
  min-height: 100dvh;
  background: var(--c-bg);
  color: var(--c-ink);
  font-family: var(--f-body);
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
}

/* Film Grain Overlay */
.grain {
  position: fixed;
  inset: -50%;
  width: 200%;
  height: 200%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
  opacity: 0.032;
  pointer-events: none;
  z-index: 999;
  transform: translateZ(0);
}

/* Subtle Screen Glitch with Start Free Chromatic Aberration */
body.glitching {
  animation: glitchBody 0.08s steps(2) forwards;
}

body.glitching .brand-tag {
  text-shadow: -2px 0 var(--c-glitch-a), 2px 0 var(--c-glitch-b);
}

body.glitching .brand-dot {
  background: var(--c-glitch-a);
  box-shadow: 0 0 8px var(--c-glitch-a), 0 0 16px var(--c-glitch-b);
}

body.glitching .cursor-bar::before {
  background: var(--c-glitch-a);
  box-shadow: -2px 0 var(--c-glitch-a), 2px 0 var(--c-glitch-b);
}

body.glitching .phrase-placeholder {
  text-shadow: -3px 0 var(--c-glitch-a), 3px 0 var(--c-glitch-b);
}

@keyframes glitchBody {
  0%   { transform: translate3d(0, 0, 0); }
  35%  { transform: translate3d(-3px, 1px, 0) skewX(-0.8deg); }
  75%  { transform: translate3d(3px, -1px, 0) skewX(0.6deg); }
  100% { transform: translate3d(0, 0, 0); }
}

/* App Viewport Layout */
.agent-app {
  position: relative;
  width: 100%;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: calc(1.8rem + env(safe-area-inset-top)) calc(2rem + env(safe-area-inset-right)) calc(1.8rem + env(safe-area-inset-bottom)) calc(2rem + env(safe-area-inset-left));
  z-index: 1;
  touch-action: pan-y pinch-zoom;
}

@media (min-width: 768px) {
  .agent-app {
    padding: 3rem 5rem;
  }
}

/* Minimalist Header */
.agent-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 0.8rem;
  z-index: 20;
}

.brand-tag {
  font-family: var(--f-display);
  font-size: clamp(0.8rem, 1.2vw, 0.95rem);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--c-ink);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  cursor: pointer;
  transition: opacity 0.2s ease;
  flex-shrink: 0;
}

.brand-tag:hover {
  opacity: 0.65;
}

.brand-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--c-ink);
}

/* Chrono Scrubber (Машина Времени) - Top buttons removed for pure brutalist aesthetic */
.chrono-hud {
  display: none !important;
}

.chrono-hud-btn {
  font-family: var(--f-display);
  font-weight: 800;
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  padding: 0.25rem 0.5rem;
  background: transparent;
  color: var(--c-ink);
  border: 1px solid rgba(10, 10, 10, 0.2);
  cursor: pointer;
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
  transition: all 0.15s ease;
}

.chrono-hud-btn:hover {
  background: rgba(10, 10, 10, 0.05);
}

.chrono-hud-btn:active {
  transform: scale(0.94);
  background: var(--c-ink);
  color: var(--c-bg);
}

.chrono-live-btn {
  font-weight: 900;
  background: var(--c-ink);
  color: var(--c-bg);
  border-color: var(--c-ink);
}

body.chrono-active .chrono-live-btn {
  background: transparent;
  color: var(--c-ink);
  border-color: rgba(10, 10, 10, 0.25);
}

.chrono-tape {
  position: relative;
  width: 80px;
  height: 18px;
  background: rgba(10, 10, 10, 0.04);
  border: 1px solid rgba(10, 10, 10, 0.2);
  cursor: ew-resize;
  touch-action: none;
  display: flex;
  align-items: center;
  padding: 0 2px;
}

.chrono-tape-track {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  background: rgba(10, 10, 10, 0.25);
  pointer-events: none;
}

.chrono-tape-thumb {
  position: absolute;
  top: 2px;
  bottom: 2px;
  width: 5px;
  background: var(--c-ink);
  left: calc(100% - 7px); /* Default LIVE position */
  pointer-events: none;
  transition: left 0.08s ease;
}

.chrono-badge {
  font-family: var(--f-display);
  font-weight: 800;
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  padding: 0.25rem 0.6rem;
  background: transparent;
  color: var(--c-ink);
  border: 1px solid rgba(10, 10, 10, 0.2);
  cursor: pointer;
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  touch-action: manipulation;
  transition: all 0.15s ease;
}

.chrono-badge-tag {
  color: var(--c-ink-muted);
  font-size: 0.6rem;
}

.chrono-badge-label {
  font-weight: 900;
}

body.chrono-active .chrono-badge {
  background: var(--c-ink);
  color: var(--c-bg);
  border-color: var(--c-ink);
}

body.chrono-active .chrono-badge-tag {
  color: var(--c-glitch-b);
}

/* Chrono Historical Archive Banner in Prompt Area */
.chrono-banner {
  display: none;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.65rem 0.9rem;
  background: rgba(10, 10, 10, 0.04);
  border-left: 3px solid var(--c-ink);
  margin-bottom: 1rem;
  user-select: none;
}

body.chrono-active .chrono-banner {
  display: flex;
}

.chrono-banner-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--f-display);
}

.chrono-banner-badge {
  font-weight: 900;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: var(--c-glitch-a);
}

.chrono-banner-time {
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: var(--c-ink);
}

.chrono-banner-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.chrono-btn-action {
  font-family: var(--f-display);
  font-weight: 800;
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.35rem 0.7rem;
  min-height: 32px;
  background: transparent;
  color: var(--c-ink);
  border: 1px solid rgba(10, 10, 10, 0.25);
  cursor: pointer;
  touch-action: manipulation;
  transition: all 0.12s ease;
}

.chrono-btn-action:active {
  transform: scale(0.95);
  background: var(--c-ink);
  color: var(--c-bg);
}

.chrono-btn-action#chrono-fork-btn {
  background: var(--c-ink);
  color: var(--c-bg);
  border-color: var(--c-ink);
}

/* VHS Tape Glitch Animation on Stage when Scrubbing */
body.glitching-chrono .agent-stage {
  animation: chronoTapeGlitch 0.18s steps(2) forwards;
}

@keyframes chronoTapeGlitch {
  0% {
    transform: translate3d(0, 0, 0);
    filter: drop-shadow(0 0 0 transparent);
  }
  30% {
    transform: translate3d(-3px, 1px, 0) skewX(-1.2deg);
    filter: drop-shadow(-3px 0 var(--c-glitch-a)) drop-shadow(3px 0 var(--c-glitch-b));
  }
  70% {
    transform: translate3d(3px, -1px, 0) skewX(0.8deg);
    filter: drop-shadow(3px 0 var(--c-glitch-b)) drop-shadow(-2px 0 var(--c-glitch-a));
  }
  100% {
    transform: translate3d(0, 0, 0);
    filter: drop-shadow(0 0 0 transparent);
  }
}

/* Voice HUD (Push-to-Talk Recording Banner) */
.voice-hud {
  display: none;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.65rem 0.9rem;
  background: rgba(230, 57, 70, 0.07);
  border-left: 3px solid #E63946;
  margin-bottom: 1rem;
  user-select: none;
  animation: voicePulse 1.2s infinite ease-in-out;
}

body.voice-recording .voice-hud {
  display: flex;
}

@keyframes voicePulse {
  0%, 100% {
    border-left-color: #E63946;
    background: rgba(230, 57, 70, 0.06);
  }
  50% {
    border-left-color: var(--c-glitch-a);
    background: rgba(255, 0, 60, 0.12);
  }
}

.voice-hud-meta {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-family: var(--f-display);
}

.voice-hud-indicator {
  font-weight: 900;
  font-size: 0.74rem;
  letter-spacing: 0.06em;
  color: #E63946;
}

.voice-hud-timer {
  font-family: var(--f-mono);
  font-weight: 700;
  font-size: 0.74rem;
  letter-spacing: 0.04em;
  color: var(--c-ink);
}

.voice-hud-wave {
  font-family: var(--f-mono);
  font-size: 0.9rem;
  letter-spacing: 0.12em;
  color: #E63946;
  font-weight: 800;
}

.voice-hud-hint {
  font-family: var(--f-body);
  font-size: 0.78rem;
  color: var(--c-ink-muted);
}


/* Main Interactive Stage */
.agent-stage {
  position: relative;
  flex: 1;
  width: 100%;
  max-width: 1600px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  padding: 0;
}

/* Top Response Area (Word-by-word streaming) */
.response-container {
  width: 100%;
  min-height: 0;
  height: 0;
  margin-bottom: 0;
  opacity: 0;
  transform: translateY(-16px);
  transition: opacity 0.4s var(--ease-out), transform 0.4s var(--ease-out), margin-bottom 0.35s ease;
  pointer-events: none;
  z-index: 10;
  overflow: hidden;
}

.response-container.active,
.response-container.glitching-out {
  min-height: 2.5rem;
  height: auto;
  margin-bottom: clamp(2.5rem, 5.5vh, 4.5rem);
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
  overflow: visible;
}

/* Graceful Chromatic Glitch Dissolution for Previous Response */
.response-container.glitching-out {
  opacity: 1;
  pointer-events: none;
  animation: glitchResponseFadeOut 0.28s steps(3) forwards !important;
}

@keyframes glitchResponseFadeOut {
  0% {
    opacity: 1;
    transform: translate3d(0, 0, 0);
    text-shadow: none;
    clip-path: inset(0 0 0 0);
  }
  35% {
    opacity: 0.65;
    transform: translate3d(-4px, 0, 0) skewX(-1.5deg);
    color: var(--c-glitch-a);
    text-shadow: -3px 0 var(--c-glitch-a), 3px 0 var(--c-glitch-b);
    clip-path: inset(12% 0 40% 0);
  }
  70% {
    opacity: 0.3;
    transform: translate3d(3px, 0, 0) skewX(1deg);
    color: var(--c-glitch-b);
    text-shadow: 3px 0 var(--c-glitch-b), -3px 0 var(--c-glitch-a);
    clip-path: inset(45% 0 10% 0);
  }
  100% {
    opacity: 0;
    transform: translate3d(0, 0, 0);
    text-shadow: none;
    clip-path: inset(100% 0 0 0);
  }
}

.response-text {
  font-family: var(--f-display);
  font-weight: 800;
  font-size: clamp(2.4rem, 6.2vw, 5.6rem);
  line-height: 1.08;
  letter-spacing: -0.04em;
  color: var(--c-ink);
  word-break: break-word;
}

/* Response area styling (Word-by-word streamed through Start Free colored glitch) */

/* Agent Response Words Streamed Through Start Free Colored Glitch */
.response-word {
  display: inline-block;
  opacity: 0;
  margin-right: 0.28em;
  animation: wordGlitchAppear 0.2s steps(2) forwards;
}

@keyframes wordGlitchAppear {
  0% {
    opacity: 0;
    transform: translate3d(-4px, 2px, 0) skewX(-2deg);
    color: var(--c-glitch-a);
    text-shadow: -3px 0 var(--c-glitch-a), 3px 0 var(--c-glitch-b);
    clip-path: inset(10% 0 35% 0);
  }
  35% {
    opacity: 0.85;
    transform: translate3d(3px, -1px, 0) skewX(1.2deg);
    color: var(--c-glitch-b);
    text-shadow: 3px 0 var(--c-glitch-b), -3px 0 var(--c-glitch-a);
    clip-path: inset(40% 0 10% 0);
  }
  70% {
    opacity: 0.95;
    transform: translate3d(-1px, 0, 0) skewX(-0.4deg);
    color: var(--c-ink);
    text-shadow: -1.5px 0 var(--c-glitch-a), 1.5px 0 var(--c-glitch-b);
    clip-path: none;
  }
  100% {
    opacity: 1;
    transform: translate3d(0, 0, 0) skewX(0);
    color: var(--c-ink);
    text-shadow: none;
    clip-path: none;
  }
}

/* Prompt Stage */
.prompt-container {
  position: relative;
  width: 100%;
  cursor: text;
  z-index: 5;
}

/* Command Drum Menu (Rotating 3D Text Tumbler: календарь / события / сообщения / заметки) */
.command-drum {
  display: none;
}

.prompt-container.drum-active #agent-phrase {
  display: none !important;
}

.prompt-container.drum-active .command-drum {
  display: flex;
  align-items: center;
  position: relative;
  width: 100%;
  height: clamp(160px, 24vh, 260px);
  perspective: 900px;
  user-select: none;
  cursor: grab;
  touch-action: none;
}

.prompt-container.drum-active .command-drum:active {
  cursor: grabbing;
}

.drum-slash {
  font-family: var(--f-display);
  font-weight: 900;
  font-size: clamp(3.2rem, 9vw, 8rem);
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--c-ink);
  margin-right: clamp(0.75rem, 2vw, 2rem);
  flex-shrink: 0;
  animation: slashPulse 1.2s infinite ease-in-out;
  pointer-events: auto !important;
  cursor: pointer;
  background: transparent;
  border: none;
  padding: 0;
  outline: none;
  touch-action: manipulation;
  transition: transform 0.12s ease;
}

.drum-slash:active {
  transform: scale(0.92);
}

@keyframes slashPulse {
  0%, 100% {
    text-shadow: none;
    transform: translate3d(0, 0, 0);
  }
  50% {
    text-shadow: -2px 0 var(--c-glitch-a), 2px 0 var(--c-glitch-b);
    transform: translate3d(-1px, 0, 0);
  }
}

.drum-viewport {
  position: relative;
  height: 100%;
  flex: 1;
  max-width: 100%;
  overflow: visible;
  mask-image: linear-gradient(to bottom, transparent 0%, black 22%, black 78%, transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black 22%, black 78%, transparent 100%);
  pointer-events: auto;
}

.drum-cylinder {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
}

.drum-item {
  position: absolute;
  left: 0;
  top: 50%;
  margin-top: -0.5em;
  font-family: var(--f-display);
  font-weight: 900;
  font-size: clamp(3.2rem, 9vw, 8rem);
  line-height: 1;
  letter-spacing: -0.05em;
  color: var(--c-ink);
  white-space: nowrap;
  cursor: pointer;
  transform-origin: center center;
  transition: transform 0.26s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.26s ease-out, filter 0.26s ease-out;
  will-change: transform, opacity;
  user-select: none;
}

.drum-item.is-active {
  color: var(--c-ink);
  cursor: pointer;
}

.drum-item.is-active:hover {
  text-shadow: -2px 0 var(--c-glitch-a), 2px 0 var(--c-glitch-b);
}

.drum-item.drum-selected {
  color: var(--c-glitch-b) !important;
  text-shadow: -3px 0 var(--c-glitch-a), 3px 0 var(--c-glitch-b) !important;
  animation: wordGlitchAppear 0.16s steps(2) forwards !important;
}

/* Background Echo Layer (Hidden completely so question text does not linger on screen) */
.background-echo {
  display: none !important;
}

/* Monumental Giant Single Phrase with Dynamic Input Replacement */
.greeting-phrase {
  font-family: var(--f-display);
  font-weight: 900;
  font-size: clamp(5.5rem, 15vw, 14rem);
  line-height: 0.92;
  letter-spacing: -0.05em;
  color: var(--c-ink);
  user-select: none;
  word-break: break-word;
  display: inline;
  transition: font-size 0.16s var(--ease-out);
  caret-color: transparent !important;
}

/* Suppress any line breaks inserted by browser contenteditable */
.greeting-phrase br,
.phrase-placeholder br,
.phrase-input br {
  display: none !important;
}

/* Default Greeting Placeholder: Visible when input is empty, disappears when typing */
.phrase-placeholder {
  display: inline;
  color: var(--c-ink);
  pointer-events: none;
  user-select: none;
  white-space: normal;
}

.greeting-phrase:not(.is-empty) .phrase-placeholder:not(.glitching-out),
.greeting-phrase.dialogue-active .phrase-placeholder:not(.glitching-out) {
  display: none !important;
}

.greeting-phrase.is-empty:not(.dialogue-active) .phrase-placeholder {
  display: inline !important;
}

/* Start Free Signature Colored Glitch on Greeting Disappearance */
.phrase-placeholder.glitching-out {
  display: inline-block !important;
  pointer-events: none;
  animation: glitchPlaceholderOut 0.22s steps(3) forwards !important;
}

@keyframes glitchPlaceholderOut {
  0% {
    opacity: 1;
    transform: translate3d(0, 0, 0);
    text-shadow: -3px 0 var(--c-glitch-a), 3px 0 var(--c-glitch-b);
  }
  35% {
    opacity: 0.65;
    transform: translate3d(-6px, 1px, 0) skewX(-2deg);
    color: var(--c-glitch-a);
    text-shadow: 6px 0 var(--c-glitch-b), -6px 0 var(--c-glitch-a);
    clip-path: inset(10% 0 35% 0);
  }
  70% {
    opacity: 0.3;
    transform: translate3d(5px, -3px, 0) skewX(1.8deg);
    color: var(--c-glitch-b);
    text-shadow: -5px 0 var(--c-glitch-a), 5px 0 var(--c-glitch-b);
    clip-path: inset(45% 0 10% 0);
  }
  100% {
    opacity: 0;
    transform: translate3d(0, -8px, 0);
    text-shadow: none;
    clip-path: inset(100% 0 0 0);
  }
}

/* Continuous Processing Glitch: Active while agent computes and prepares response */
.phrase-input.glitch-processing {
  position: relative;
  display: inline-block !important;
  vertical-align: baseline !important;
  pointer-events: none !important;
  user-select: none !important;
  animation: glitchProcessingText 0.38s steps(2) infinite !important;
}

.phrase-input.glitch-processing::before {
  content: attr(data-text);
  position: absolute;
  left: -4px;
  top: 0;
  width: 100%;
  height: 100%;
  font-family: inherit;
  font-size: inherit;
  font-weight: inherit;
  line-height: inherit;
  letter-spacing: inherit;
  white-space: inherit;
  word-break: inherit;
  color: var(--c-glitch-a) !important; /* Neon Crimson #ff003c */
  pointer-events: none;
  z-index: 2;
  animation: glitchProcessingGhostCrimson 0.32s steps(2) infinite !important;
}

.phrase-input.glitch-processing::after {
  content: attr(data-text);
  position: absolute;
  left: 4px;
  top: 0;
  width: 100%;
  height: 100%;
  font-family: inherit;
  font-size: inherit;
  font-weight: inherit;
  line-height: inherit;
  letter-spacing: inherit;
  white-space: inherit;
  word-break: inherit;
  color: var(--c-glitch-b) !important; /* Electric Teal #00ffcc */
  pointer-events: none;
  z-index: 2;
  animation: glitchProcessingGhostTeal 0.28s steps(2) infinite !important;
}

@keyframes glitchProcessingText {
  0% {
    transform: translate3d(0, 0, 0);
    text-shadow: -2.5px 0 var(--c-glitch-a), 2.5px 0 var(--c-glitch-b);
  }
  25% {
    transform: translate3d(-3px, 0, 0) skewX(-1.2deg);
    text-shadow: 3px 0 var(--c-glitch-b), -3px 0 var(--c-glitch-a);
  }
  50% {
    transform: translate3d(3px, 0, 0) skewX(0.8deg);
    text-shadow: -2.5px 0 var(--c-glitch-b), 2.5px 0 var(--c-glitch-a);
  }
  75% {
    transform: translate3d(-2px, 0, 0);
    text-shadow: 2.5px 0 var(--c-glitch-a), -2.5px 0 var(--c-glitch-b);
  }
  100% {
    transform: translate3d(0, 0, 0);
    text-shadow: -2.5px 0 var(--c-glitch-a), 2.5px 0 var(--c-glitch-b);
  }
}

@keyframes glitchProcessingGhostCrimson {
  0% {
    opacity: 0.85;
    transform: translate3d(-5px, 0, 0);
    clip-path: inset(14% 0 54% 0);
  }
  33% {
    opacity: 0.65;
    transform: translate3d(6px, 0, 0) skewX(-2deg);
    clip-path: inset(48% 0 18% 0);
  }
  66% {
    opacity: 0.9;
    transform: translate3d(-4px, 0, 0);
    clip-path: inset(68% 0 10% 0);
  }
  100% {
    opacity: 0.85;
    transform: translate3d(-5px, 0, 0);
    clip-path: inset(14% 0 54% 0);
  }
}

@keyframes glitchProcessingGhostTeal {
  0% {
    opacity: 0.85;
    transform: translate3d(5px, 0, 0);
    clip-path: inset(54% 0 14% 0);
  }
  33% {
    opacity: 0.7;
    transform: translate3d(-6px, 0, 0) skewX(2deg);
    clip-path: inset(16% 0 52% 0);
  }
  66% {
    opacity: 0.85;
    transform: translate3d(4px, 0, 0);
    clip-path: inset(34% 0 34% 0);
  }
  100% {
    opacity: 0.85;
    transform: translate3d(5px, 0, 0);
    clip-path: inset(54% 0 14% 0);
  }
}

/* 320ms High-Impact Question Text Colored Glitch Dissolution */
.phrase-input.glitch-disappearing {
  position: relative;
  display: inline-block !important;
  vertical-align: baseline !important;
  pointer-events: none !important;
  animation: glitchQuestionDisappear 0.32s steps(4) forwards !important;
}

.phrase-input.glitch-disappearing::before {
  content: attr(data-text);
  position: absolute;
  left: -4px;
  top: 0;
  width: 100%;
  height: 100%;
  font-family: inherit;
  font-size: inherit;
  font-weight: inherit;
  line-height: inherit;
  letter-spacing: inherit;
  white-space: inherit;
  word-break: inherit;
  color: var(--c-glitch-a) !important;
  clip-path: inset(15% 0 55% 0);
  animation: glitchGhostRed 0.35s steps(3) forwards !important;
  pointer-events: none;
  z-index: 2;
}

.phrase-input.glitch-disappearing::after {
  content: attr(data-text);
  position: absolute;
  left: 4px;
  top: 0;
  width: 100%;
  height: 100%;
  font-family: inherit;
  font-size: inherit;
  font-weight: inherit;
  line-height: inherit;
  letter-spacing: inherit;
  white-space: inherit;
  word-break: inherit;
  color: var(--c-glitch-b) !important;
  clip-path: inset(55% 0 15% 0);
  animation: glitchGhostCyan 0.35s steps(3) forwards !important;
  pointer-events: none;
  z-index: 2;
}

@keyframes glitchGhostRed {
  0% { opacity: 0.95; transform: translate3d(-6px, 1px, 0); clip-path: inset(15% 0 55% 0); }
  35% { opacity: 0.8; transform: translate3d(8px, -2px, 0); clip-path: inset(45% 0 15% 0); }
  70% { opacity: 0.45; transform: translate3d(-10px, 3px, 0); clip-path: inset(70% 0 5% 0); }
  100% { opacity: 0; transform: translate3d(0, -14px, 0); clip-path: inset(100% 0 0 0); }
}

@keyframes glitchGhostCyan {
  0% { opacity: 0.95; transform: translate3d(6px, -1px, 0); clip-path: inset(60% 0 10% 0); }
  35% { opacity: 0.8; transform: translate3d(-8px, 2px, 0); clip-path: inset(10% 0 60% 0); }
  70% { opacity: 0.45; transform: translate3d(10px, -2px, 0); clip-path: inset(30% 0 35% 0); }
  100% { opacity: 0; transform: translate3d(0, -14px, 0); clip-path: inset(100% 0 0 0); }
}

@keyframes glitchQuestionDisappear {
  0% {
    opacity: 1;
    transform: translate3d(0, 0, 0);
    text-shadow: -4px 0 var(--c-glitch-a), 4px 0 var(--c-glitch-b);
    clip-path: inset(0 0 0 0);
  }
  18% {
    opacity: 0.9;
    transform: translate3d(-10px, -2px, 0) skewX(-2.5deg);
    color: var(--c-glitch-a);
    text-shadow: 7px 0 var(--c-glitch-b), -9px 0 var(--c-glitch-a);
    clip-path: inset(8% 0 40% 0);
  }
  38% {
    opacity: 0.7;
    transform: translate3d(10px, 2px, 0) skewX(3deg);
    color: var(--c-glitch-b);
    text-shadow: -8px 0 var(--c-glitch-a), 7px 0 var(--c-glitch-b);
    clip-path: inset(42% 0 20% 0);
  }
  60% {
    opacity: 0.45;
    transform: translate3d(-8px, -4px, 0) skewX(-2deg);
    color: var(--c-ink);
    text-shadow: 7px 0 var(--c-glitch-b), -8px 0 var(--c-glitch-a);
    clip-path: inset(62% 0 8% 0);
  }
  82% {
    opacity: 0.2;
    transform: translate3d(6px, -8px, 0) skewX(1.8deg);
    color: var(--c-glitch-a);
    text-shadow: -5px 0 var(--c-glitch-a), 5px 0 var(--c-glitch-b);
    clip-path: inset(82% 0 0 0);
  }
  100% {
    opacity: 0;
    transform: translate3d(0, -16px, 0);
    text-shadow: none;
    clip-path: inset(100% 0 0 0);
  }
}

/* Visible Colored Glitch on Font Shrinking (Typing Scale Step-Down) */
.greeting-phrase.glitch-shrink {
  display: inline-block !important;
  animation: glitchShrink 0.22s steps(2) forwards !important;
}

@keyframes glitchShrink {
  0% {
    transform: translate3d(0, 0, 0);
    text-shadow: none;
  }
  25% {
    transform: translate3d(-6px, 1px, 0) skewX(-1.8deg);
    text-shadow: -5px 0 var(--c-glitch-a), 5px 0 var(--c-glitch-b);
    clip-path: inset(12% 0 35% 0);
  }
  65% {
    transform: translate3d(5px, -0.8px, 0) skewX(1.4deg);
    text-shadow: 5px 0 var(--c-glitch-b), -4px 0 var(--c-glitch-a);
    clip-path: inset(40% 0 12% 0);
  }
  100% {
    transform: translate3d(0, 0, 0);
    text-shadow: none;
    clip-path: none;
  }
}

.phrase-input {
  display: inline-block;
  vertical-align: baseline;
  color: inherit;
  word-break: break-word;
  white-space: normal;
  outline: none !important;
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  caret-color: transparent !important;
  cursor: text;
}

.phrase-input:focus {
  outline: none !important;
  border: none !important;
  box-shadow: none !important;
  caret-color: transparent !important;
}

/* Guarantee no browser caret is ever rendered */
.greeting-phrase, .phrase-placeholder, .phrase-input, #user-typed {
  caret-color: transparent !important;
}

/* Blinking Cursor Bar (Zero-width inline anchor with absolutely positioned bar - NEVER wraps alone) */
.cursor-bar {
  display: inline-block;
  position: relative;
  width: 0 !important;
  height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  vertical-align: baseline;
  pointer-events: none;
  user-select: none;
}

.cursor-bar::before {
  content: "";
  position: absolute;
  left: clamp(4px, 0.5vw, 10px);
  bottom: -0.04em;
  width: clamp(10px, 1.4vw, 24px);
  height: 0.82em;
  background: var(--c-ink);
  animation: cursorBlink 0.9s steps(1) infinite;
  pointer-events: none;
}

/* When empty initial, use the placeholder cursor bar and hide the input cursor bar */
.greeting-phrase.is-empty:not(.dialogue-active) #cursor-bar {
  display: none !important;
}

.greeting-phrase.dialogue-active #cursor-bar {
  display: inline-block !important;
}

@keyframes cursorBlink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

/* Footer / Action Hints */
.agent-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding-top: 1.2rem;
  border-top: 1px solid rgba(10, 10, 10, 0.06);
  z-index: 20;
}

.footer-hint {
  font-family: var(--f-body);
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--c-ink-muted);
  letter-spacing: 0.02em;
}

.action-btn {
  background: transparent;
  border: 1px solid var(--c-ink);
  color: var(--c-ink);
  font-family: var(--f-display);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.5rem 1rem;
  cursor: pointer;
  border-radius: 0;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, color 0.2s ease, transform 0.15s ease;
}

.action-btn:hover {
  background: var(--c-ink);
  color: var(--c-bg);
}

.action-btn:active {
  transform: scale(0.96);
}

.send-trigger-mobile {
  display: none;
}

.desktop-close-label {
  display: inline;
}

.mobile-close-label {
  display: none;
}

.drum-compass-selector {
  display: none;
}

.mobile-shortcut-hint {
  display: none;
}

@media (max-width: 767px) {
  .footer-hint {
    font-size: 0.72rem;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
  }

  .desktop-shortcut-hint {
    display: none;
  }

  .mobile-shortcut-hint {
    display: inline-block;
    font-family: var(--f-body);
    font-size: 0.72rem;
    color: var(--c-ink-muted);
    letter-spacing: 0.02em;
    text-align: center;
  }

  /* Mobile Stage & App Layout */
  .agent-app {
    padding-top: calc(0.8rem + env(safe-area-inset-top));
    padding-bottom: calc(0.8rem + env(safe-area-inset-bottom));
    padding-left: 1.2rem;
    padding-right: 1.2rem;
    height: 100%;
    min-height: 100%;
  }

  .agent-header {
    margin-bottom: 0.4rem;
  }

  .agent-stage {
    display: flex;
    flex-direction: column;
    justify-content: flex-start !important;
    align-items: flex-start !important;
    padding-top: 0;
    flex: 1;
    width: 100%;
    height: 100%;
    min-height: 0;
    position: relative;
  }

  /* 1. Prompt Container: Initial Resting State = Centered Vertically */
  .prompt-container {
    margin-top: clamp(120px, calc(42dvh - 3.5rem), 300px);
    transition: margin-top 0.38s cubic-bezier(0.16, 1, 0.3, 1), transform 0.38s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: margin-top;
    width: 100%;
  }

  /* 2. When Drum is Active: Centered Vertically in Same Mid-Screen Position */
  .prompt-container.drum-active {
    margin-top: clamp(80px, calc(42dvh - 6.5rem), 220px) !important;
  }

  /* 3. Smooth Animated Transfer to Top ("Анимация и перенос вверх") */
  body.prompt-pinned-top .prompt-container,
  body.typing-active .prompt-container,
  body.keyboard-open .prompt-container,
  body:has(.phrase-input:focus) .prompt-container {
    margin-top: 0.25rem !important;
  }

  /* 4. Streamed Response Active: Position Prompt Directly Below Response at Top */
  .response-container.active ~ .prompt-container,
  .response-container.glitching-out ~ .prompt-container {
    margin-top: 1.2rem !important;
  }

  body.keyboard-open .response-container,
  body.typing-active .response-container,
  body:has(.phrase-input:focus) .response-container {
    margin-bottom: 0.8rem;
    min-height: 1.4rem;
  }

  body.keyboard-open .greeting-phrase,
  body.typing-active .greeting-phrase,
  body:has(.phrase-input:focus) .greeting-phrase {
    line-height: 1.05;
  }

  body.keyboard-open .agent-footer,
  body.typing-active .agent-footer,
  body:has(.phrase-input:focus) .agent-footer {
    padding-top: 0.4rem;
    position: sticky;
    bottom: 0;
    background: var(--c-bg);
  }

  body.keyboard-open .desktop-shortcut-hint,
  body.typing-active .desktop-shortcut-hint,
  body:has(.phrase-input:focus) .desktop-shortcut-hint {
    display: none !important;
  }

  body.keyboard-open .action-btn,
  body.typing-active .action-btn,
  body:has(.phrase-input:focus) .action-btn {
    min-height: 38px;
    padding: 0.35rem 0.8rem;
    font-size: 0.68rem;
  }

  /* Chrono Scrubber Mobile Rules: Buttons removed for pure brutalist aesthetic */
  .chrono-hud {
    display: none !important;
  }

  .chrono-banner {
    flex-direction: column;
    align-items: stretch;
    gap: 0.6rem;
    padding: 0.6rem 0.8rem;
  }

  .chrono-banner-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .chrono-banner-actions .action-btn {
    min-height: 38px;
    flex: 1;
    text-align: center;
  }

  .voice-hud {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.6rem 0.8rem;
  }

  /* Command Drum Mobile: Focused 3D Cylinder Tumbler in Center */
  body.drum-open .agent-stage {
    justify-content: flex-start !important;
    align-items: flex-start !important;
    flex: 1 !important;
    height: 100% !important;
    min-height: 0 !important;
  }

  .prompt-container.drum-active {
    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-start !important;
    align-items: stretch !important;
    flex: none !important;
    width: 100% !important;
  }

  .prompt-container.drum-active .command-drum {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: flex-start !important;
    width: 100% !important;
    height: clamp(170px, 25vh, 230px) !important;
    min-height: 0 !important;
    perspective: 1000px !important;
    gap: 0.5rem;
  }

  .prompt-container.drum-active .command-drum .drum-viewport {
    position: relative !important;
    width: 100% !important;
    height: clamp(170px, 25vh, 230px) !important;
    min-height: 0 !important;
    flex: 1 !important;
    mask-image: linear-gradient(to bottom, transparent 0%, black 18%, black 82%, transparent 100%) !important;
    -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black 18%, black 82%, transparent 100%) !important;
  }

  .prompt-container.drum-active .command-drum .drum-cylinder {
    position: relative !important;
    width: 100% !important;
    height: 100% !important;
    transform-style: preserve-3d !important;
  }

  .drum-slash {
    font-size: clamp(3rem, 11vw, 5.5rem) !important;
    letter-spacing: -0.03em !important;
    margin-right: 0.5rem !important;
    flex-shrink: 0 !important;
  }

  .drum-item {
    font-size: clamp(2.2rem, 9vw, 4.4rem) !important;
    letter-spacing: -0.04em !important;
    line-height: 1 !important;
  }
}

/* Long-press / Hold Gesture Visual Tension */
body.holding-charge .agent-stage,
body.holding-charge .prompt-container {
  transform: scale(0.985);
  transition: transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
  filter: drop-shadow(0 0 16px rgba(230, 57, 70, 0.35));
}

/* ==========================================================================
   Real Atomic Modules — Floating Borderless Layout ("Парящие блоки совсем без рамок")
   ========================================================================== */
.module-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: none;
  background: var(--c-bg);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.24s cubic-bezier(0.16, 1, 0.3, 1);
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: none;
}

.module-overlay.is-active {
  display: flex;
  flex-direction: column;
  opacity: 1;
  pointer-events: auto;
}

body.module-open {
  overflow: hidden !important;
}

.module-backdrop {
  display: none !important; /* Zero modal dimming — seamless full-screen canvas */
}

.module-window {
  position: relative;
  width: 100%;
  min-height: 100dvh;
  height: 100%;
  max-width: 1600px;
  margin: 0 auto;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  display: flex;
  flex-direction: column;
  padding: calc(1.8rem + env(safe-area-inset-top)) calc(2rem + env(safe-area-inset-right)) calc(1.8rem + env(safe-area-inset-bottom)) calc(2rem + env(safe-area-inset-left));
  animation: modFloatingFadeIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@media (min-width: 768px) {
  .module-window {
    padding: 3rem 5rem;
  }
}

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

.module-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 0 0 clamp(1.5rem, 4vh, 3rem) 0;
  background: transparent;
  border: none !important;
  border-bottom: none !important;
  flex-shrink: 0;
}

.module-header-title {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.module-badge {
  font-family: var(--f-display);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--c-ink-muted);
  background: transparent;
  padding: 0;
  display: inline-block;
}

.module-title {
  font-family: var(--f-display);
  font-size: clamp(2.6rem, 7vw, 5.5rem);
  font-weight: 900;
  letter-spacing: -0.045em;
  color: var(--c-ink);
  margin: 0;
  line-height: 0.95;
}

.module-header-nav {
  display: flex;
  align-items: center;
  margin-right: 1.5rem;
}

.module-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--f-display);
  font-size: clamp(0.74rem, 1.3vw, 0.88rem);
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.55rem 1.15rem;
  border: 1.5px solid var(--c-ink) !important;
  background: transparent !important;
  color: var(--c-ink) !important;
  cursor: pointer;
  min-height: 42px;
  touch-action: manipulation;
  transition: all 0.15s ease;
  user-select: none;
}

.module-back-btn:hover {
  background: var(--c-ink) !important;
  color: var(--c-bg) !important;
}

.module-back-btn:active {
  transform: scale(0.95);
  background: var(--c-ink) !important;
  color: var(--c-bg) !important;
}

.module-back-arrow {
  font-size: 1.25em;
  line-height: 1;
}

.module-back-label {
  line-height: 1;
}

.module-header-actions {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.module-close-btn {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0.4rem 0;
  font-family: var(--f-display);
  font-size: clamp(0.75rem, 1.4vw, 0.92rem);
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--c-ink);
  opacity: 0.55;
  cursor: pointer;
  transition: opacity 0.2s ease, text-shadow 0.2s ease;
}

.module-close-btn:hover {
  opacity: 1;
  text-shadow: -2px 0 var(--c-glitch-a), 2px 0 var(--c-glitch-b);
}

.module-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  background: transparent;
}

/* Shared Module Utilities */
.mod-btn-primary {
  background: var(--c-ink) !important;
  color: var(--c-bg) !important;
  border: none !important;
  font-family: var(--f-display);
  font-weight: 800;
  font-size: clamp(0.75rem, 1.3vw, 0.9rem);
  padding: 0.75rem 1.4rem;
  cursor: pointer;
  letter-spacing: 0.04em;
  transition: background 0.15s ease, color 0.15s ease;
}

.mod-btn-primary:hover {
  background: var(--c-glitch-b) !important;
  color: var(--c-ink) !important;
}

.mod-btn-subtle {
  background: transparent !important;
  border: none !important;
  color: var(--c-ink-muted) !important;
  font-family: var(--f-display);
  font-weight: 700;
  font-size: clamp(0.72rem, 1.2vw, 0.85rem);
  letter-spacing: 0.04em;
  cursor: pointer;
  padding: 0.4rem 0;
  transition: color 0.15s ease;
}

.mod-btn-subtle:hover {
  color: var(--c-ink) !important;
  text-shadow: -1.5px 0 var(--c-glitch-a), 1.5px 0 var(--c-glitch-b);
}

.mod-btn-danger {
  background: transparent !important;
  border: none !important;
  color: var(--c-glitch-a) !important;
  font-family: var(--f-display);
  font-weight: 700;
  font-size: clamp(0.72rem, 1.2vw, 0.85rem);
  letter-spacing: 0.04em;
  cursor: pointer;
  padding: 0.4rem 0;
  transition: opacity 0.15s ease;
}

.mod-btn-danger:hover {
  opacity: 0.75;
}

.mod-empty-state {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  padding: 3rem 0;
  text-align: left;
  color: var(--c-ink-muted);
  font-size: clamp(1.1rem, 2vw, 1.5rem);
  gap: 1.2rem;
}

/* --------------------------------------------------------------------------
   1. Notes Module Styling — Floating & Borderless
   -------------------------------------------------------------------------- */
.mod-notes-layout {
  display: grid;
  grid-template-columns: clamp(280px, 28vw, 420px) 1fr;
  gap: clamp(2.5rem, 6vw, 6rem);
  width: 100%;
  flex: 1;
  overflow: hidden;
}

.mod-notes-sidebar {
  width: 100%;
  border-right: none;
  display: flex;
  flex-direction: column;
  background: transparent;
  flex-shrink: 0;
  overflow-y: auto;
}

.mod-notes-toolbar {
  padding: 0 0 1.5rem 0;
  border: none;
  border-bottom: 1px solid rgba(10, 10, 10, 0.08);
  margin-bottom: 1rem;
}

.mod-notes-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.mod-note-item {
  padding: 1.2rem 0;
  border: none;
  border-bottom: 1px solid rgba(10, 10, 10, 0.08);
  background: transparent;
  cursor: pointer;
  transition: transform 0.18s ease, color 0.18s ease;
}

.mod-note-item:hover {
  background: transparent;
  transform: translateX(6px);
}

.mod-note-item.is-active {
  background: transparent;
  border-left: none;
  transform: translateX(10px);
}

.mod-note-item.is-active .mod-note-item-title {
  color: var(--c-ink);
  text-shadow: -2px 0 var(--c-glitch-a), 2px 0 var(--c-glitch-b);
}

.mod-note-item-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.4rem;
  font-size: 0.72rem;
}

.mod-note-tag {
  font-family: var(--f-display);
  font-weight: 800;
  text-transform: uppercase;
  color: var(--c-ink-muted);
  letter-spacing: 0.08em;
}

.mod-note-date {
  color: var(--c-ink-faint);
}

.mod-note-item-title {
  font-family: var(--f-display);
  font-size: clamp(1.25rem, 2.4vw, 1.9rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--c-ink);
  margin: 0 0 0.4rem 0;
  line-height: 1.15;
}

.mod-note-item-snippet {
  font-size: 0.92rem;
  color: var(--c-ink-muted);
  margin: 0;
  line-height: 1.5;
}

.mod-notes-editor {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 0;
  background: transparent;
  overflow-y: auto;
}

.mod-editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.2rem;
  margin-bottom: 0.6rem;
  flex-wrap: wrap;
}

.mod-editor-title {
  font-family: var(--f-display);
  font-size: clamp(2rem, 5vw, 4rem);
  font-weight: 900;
  letter-spacing: -0.04em;
  color: var(--c-ink);
  border: none;
  background: transparent;
  outline: none;
  flex: 1;
  padding: 0;
  min-width: 250px;
}

.mod-editor-actions {
  display: flex;
  gap: 0.8rem;
  align-items: center;
}

.mod-editor-meta-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.6rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(10, 10, 10, 0.1);
  font-size: 0.8rem;
  color: var(--c-ink-muted);
}

.mod-editor-category {
  border: none;
  border-bottom: 1px solid rgba(10, 10, 10, 0.2);
  background: transparent;
  font-size: 0.8rem;
  padding: 0.2rem 0;
  color: var(--c-ink);
  font-family: var(--f-body);
  font-weight: 600;
  outline: none;
}

.mod-editor-textarea {
  flex: 1;
  min-height: 320px;
  border: none;
  background: transparent;
  outline: none;
  font-family: var(--f-body);
  font-size: clamp(1.15rem, 2vw, 1.5rem);
  line-height: 1.75;
  color: var(--c-ink);
  resize: none;
  padding: 0;
}

/* --------------------------------------------------------------------------
   2. Calendar Module Styling — Floating & Borderless
   -------------------------------------------------------------------------- */
.mod-calendar-layout {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: clamp(2.5rem, 6vw, 6rem);
  width: 100%;
  flex: 1;
  overflow: hidden;
}

.mod-cal-main {
  border-right: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  background: transparent;
  overflow-y: auto;
}

.mod-cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.8rem;
}

.mod-cal-title {
  font-family: var(--f-display);
  font-size: clamp(1.8rem, 4vw, 3.2rem);
  font-weight: 900;
  letter-spacing: -0.04em;
  color: var(--c-ink);
  margin: 0;
}

.mod-cal-nav {
  display: flex;
  gap: 0.4rem;
}

.mod-cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  margin-bottom: 12px;
  text-align: center;
  font-family: var(--f-display);
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--c-ink-faint);
  letter-spacing: 0.12em;
}

.mod-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  flex: 1;
}

.mod-cal-cell {
  position: relative;
  aspect-ratio: 1 / 1;
  min-height: 54px;
  border: none !important; /* ZERO CELL BORDERS */
  background: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.16s ease, color 0.16s ease;
  user-select: none;
}

.mod-cal-cell.is-inactive {
  opacity: 0.2;
  cursor: default;
}

.mod-cal-cell.is-current:hover {
  transform: scale(1.12);
}

.mod-cal-cell.is-selected {
  background: transparent !important;
  transform: scale(1.22);
}

.mod-cal-cell.is-selected .mod-cal-cell-num {
  color: var(--c-ink) !important;
  text-shadow: -2.5px 0 var(--c-glitch-a), 2.5px 0 var(--c-glitch-b);
}

.mod-cal-cell-num {
  font-family: var(--f-display);
  font-size: clamp(1.3rem, 2.6vw, 2.2rem);
  font-weight: 800;
  color: var(--c-ink);
  line-height: 1;
}

.mod-cal-cell-badge {
  position: absolute;
  bottom: 4px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--c-glitch-b);
  box-shadow: 0 0 6px var(--c-glitch-b);
}

.mod-cal-sidebar {
  border: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  background: transparent;
  overflow-y: auto;
}

.mod-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.4rem;
}

.mod-sidebar-title {
  font-family: var(--f-display);
  font-size: clamp(1.2rem, 2.2vw, 1.8rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--c-ink);
  margin: 0;
}

.mod-day-events {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  margin-bottom: 1.6rem;
}

.mod-event-card {
  padding: 1rem 0;
  border: none; /* ZERO CARD BORDERS */
  border-bottom: 1px solid rgba(10, 10, 10, 0.08);
  background: transparent;
  position: relative;
  transition: transform 0.15s ease;
}

.mod-event-card:hover {
  transform: translateX(4px);
}

.mod-event-card.is-done {
  opacity: 0.45;
}

.mod-event-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.35rem;
}

.mod-event-time {
  font-family: var(--f-display);
  font-size: clamp(0.95rem, 1.8vw, 1.3rem);
  font-weight: 800;
  color: var(--c-ink-muted);
}

.mod-event-del {
  background: none;
  border: none;
  font-size: 1.3rem;
  color: var(--c-ink-faint);
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.mod-event-del:hover {
  color: var(--c-glitch-a);
}

.mod-event-title {
  font-size: clamp(1.15rem, 2.2vw, 1.6rem);
  font-weight: 700;
  color: var(--c-ink);
  margin: 0;
  line-height: 1.3;
}

.mod-event-add-form {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
  padding-top: 1.2rem;
  border-top: 1px solid rgba(10, 10, 10, 0.1);
}

.mod-input-time {
  width: 85px;
  border: none;
  border-bottom: 1px solid var(--c-ink);
  background: transparent;
  padding: 0.5rem 0;
  font-size: 0.95rem;
  font-family: var(--f-display);
  font-weight: 700;
  outline: none;
}

.mod-input-title {
  flex: 1;
  min-width: 160px;
  border: none;
  border-bottom: 1px solid var(--c-ink);
  background: transparent;
  padding: 0.5rem 0;
  font-size: 0.95rem;
  outline: none;
}

/* --------------------------------------------------------------------------
   3. Events Module Styling — Floating Timeline Feed
   -------------------------------------------------------------------------- */
.mod-events-layout {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 1200px;
  padding: 0;
  background: transparent;
  overflow-y: auto;
}

.mod-events-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.2rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.mod-filter-tabs {
  display: flex;
  gap: clamp(0.8rem, 2vw, 1.8rem);
  flex-wrap: wrap;
}

.mod-tab {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  color: var(--c-ink-muted) !important;
  font-family: var(--f-display) !important;
  font-size: clamp(0.85rem, 1.6vw, 1.15rem) !important;
  font-weight: 800 !important;
  letter-spacing: 0.08em !important;
  text-transform: uppercase !important;
  padding: 0.4rem 0 !important;
  cursor: pointer;
  transition: color 0.15s ease, text-shadow 0.15s ease;
}

.mod-tab:hover {
  color: var(--c-ink) !important;
}

.mod-tab.is-active {
  color: var(--c-ink) !important;
  text-shadow: -2px 0 var(--c-glitch-a), 2px 0 var(--c-glitch-b);
}

.mod-add-event-box {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  padding: 1.4rem 0;
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(10, 10, 10, 0.12);
  margin-bottom: 2rem;
}

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

.mod-input {
  flex: 1;
  min-width: 200px;
  border: none;
  border-bottom: 1px solid var(--c-ink);
  background: transparent;
  padding: 0.6rem 0;
  font-size: 1rem;
  outline: none;
}

.mod-select {
  border: none;
  border-bottom: 1px solid var(--c-ink);
  background: transparent;
  padding: 0.6rem 0;
  font-size: 1rem;
  outline: none;
}

.mod-events-timeline {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
}

.mod-timeline-item {
  display: flex;
  gap: clamp(1.2rem, 3vw, 2.5rem);
  border: none; /* ZERO CARD BORDERS */
  border-bottom: 1px solid rgba(10, 10, 10, 0.08);
  background: transparent;
  padding: 1.6rem 0;
  position: relative;
  align-items: flex-start;
}

.mod-item-indicator {
  width: 4px;
  height: 28px;
  background: var(--c-ink);
  flex-shrink: 0;
  margin-top: 4px;
}

.mod-item-indicator.done { background: #10b981; }
.mod-item-indicator.progress { background: var(--c-glitch-b); }
.mod-item-indicator.planned { background: var(--c-ink-faint); }

.mod-item-content {
  flex: 1;
}

.mod-item-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.5rem;
  font-size: 0.78rem;
}

.mod-item-category {
  font-family: var(--f-display);
  font-weight: 800;
  font-size: 0.78rem;
  text-transform: uppercase;
  color: var(--c-ink);
  letter-spacing: 0.1em;
}

.mod-item-time {
  color: var(--c-ink-muted);
}

.mod-status-badge {
  margin-left: auto;
  border: none;
  background: transparent;
  font-size: 0.72rem;
  font-family: var(--f-display);
  font-weight: 800;
  padding: 0;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.mod-status-badge.done {
  color: #059669;
}

.mod-status-badge.progress {
  color: var(--c-glitch-b);
}

.mod-item-title {
  font-family: var(--f-display);
  font-size: clamp(1.5rem, 3.4vw, 2.6rem);
  font-weight: 800;
  letter-spacing: -0.035em;
  color: var(--c-ink);
  margin: 0.35rem 0 0.5rem 0;
  line-height: 1.15;
}

.mod-item-desc {
  font-size: clamp(1rem, 1.8vw, 1.25rem);
  color: var(--c-ink-muted);
  line-height: 1.6;
  margin: 0 0 1rem 0;
}

.mod-item-actions {
  display: flex;
  gap: 1.2rem;
  align-items: center;
}

/* --------------------------------------------------------------------------
   4. Messages Module Styling — Floating Direct Channels & Chat
   -------------------------------------------------------------------------- */
.mod-messages-layout {
  display: grid;
  grid-template-columns: clamp(280px, 28vw, 380px) 1fr;
  gap: clamp(2.5rem, 6vw, 6rem);
  width: 100%;
  flex: 1;
  overflow: hidden;
}

.mod-msg-sidebar {
  border-right: none;
  background: transparent;
  width: 100%;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.mod-msg-sidebar .mod-sidebar-title {
  padding: 0 0 1.2rem 0;
  border-bottom: 1px solid rgba(10, 10, 10, 0.1);
  font-family: var(--f-display);
  font-size: clamp(1.1rem, 2vw, 1.5rem);
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--c-ink);
}

.mod-msg-channels {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.mod-channel-item {
  padding: 1.2rem 0;
  border: none;
  border-bottom: 1px solid rgba(10, 10, 10, 0.08);
  background: transparent;
  cursor: pointer;
  transition: transform 0.16s ease;
}

.mod-channel-item:hover {
  background: transparent;
  transform: translateX(6px);
}

.mod-channel-item.is-active {
  background: transparent;
  border-left: none;
  transform: translateX(10px);
}

.mod-channel-item.is-active .mod-channel-title {
  color: var(--c-ink);
  text-shadow: -2px 0 var(--c-glitch-a), 2px 0 var(--c-glitch-b);
}

.mod-channel-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.35rem;
}

.mod-channel-title {
  font-family: var(--f-display);
  font-size: clamp(1.3rem, 2.4vw, 1.9rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--c-ink);
}

.mod-unread-pill {
  background: var(--c-glitch-a);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 0.15rem 0.5rem;
  border-radius: 10px;
}

.mod-channel-sub {
  font-size: 0.88rem;
  color: var(--c-ink-muted);
}

.mod-msg-main {
  border: none;
  background: transparent;
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}

.mod-msg-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0 1.2rem 0;
  border-bottom: 1px solid rgba(10, 10, 10, 0.1);
  background: transparent;
}

.mod-chat-title {
  font-family: var(--f-display);
  font-size: clamp(1.6rem, 3.2vw, 2.4rem);
  font-weight: 900;
  letter-spacing: -0.035em;
  color: var(--c-ink);
  margin: 0;
}

.mod-chat-sub {
  font-size: 0.85rem;
  color: var(--c-ink-muted);
}

.mod-msg-thread {
  flex: 1;
  padding: 1.5rem 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.mod-bubble {
  max-width: 85%;
  padding: 0.8rem 0;
  border: none !important; /* ZERO BUBBLE BORDERS */
  box-shadow: none !important;
  background: transparent !important;
}

.mod-bubble.is-user {
  align-self: flex-end;
  text-align: right;
}

.mod-bubble.is-peer {
  align-self: flex-start;
  text-align: left;
}

.mod-bubble-meta {
  display: flex;
  gap: 0.8rem;
  font-size: 0.75rem;
  margin-bottom: 0.4rem;
  color: var(--c-ink-muted);
}

.mod-bubble.is-user .mod-bubble-meta {
  justify-content: flex-end;
}

.mod-bubble-sender {
  font-family: var(--f-display);
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.mod-bubble-text {
  font-family: var(--f-body);
  font-size: clamp(1.25rem, 2.4vw, 1.85rem);
  font-weight: 600;
  line-height: 1.5;
  color: var(--c-ink);
  white-space: pre-wrap;
}

.mod-msg-input-bar {
  display: flex;
  gap: 1rem;
  padding: 0.8rem 0;
  border: none;
  border-bottom: 2px solid var(--c-ink);
  background: transparent;
}

.mod-msg-input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 0.4rem 0;
  font-size: clamp(1.15rem, 2.2vw, 1.6rem);
  font-family: var(--f-body);
  font-weight: 500;
  outline: none;
  color: var(--c-ink);
}

/* --------------------------------------------------------------------------
   5. Projects & Contexts Module (#) — Borderless Architecture
   -------------------------------------------------------------------------- */
.mod-projects-layout {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  width: 100%;
}

.mod-proj-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
}

.mod-proj-pill {
  padding: 0.5rem 1.2rem;
  font-family: var(--f-display);
  font-weight: 700;
  font-size: clamp(0.9rem, 1.4vw, 1.15rem);
  letter-spacing: -0.02em;
  background: transparent;
  color: var(--c-ink-muted);
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.mod-proj-pill:hover,
.mod-proj-pill.is-active {
  color: var(--c-ink);
  background: rgba(10, 10, 10, 0.05);
}

.mod-proj-card {
  display: flex;
  flex-direction: column;
  gap: 1.6rem;
  padding: 1rem 0;
}

.mod-proj-badge {
  font-family: var(--f-display);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--c-ink-muted);
  display: inline-block;
  margin-bottom: 0.4rem;
}

.mod-proj-title {
  font-family: var(--f-display);
  font-weight: 900;
  font-size: clamp(2.4rem, 5.5vw, 4.2rem);
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--c-ink);
}

.mod-proj-role {
  font-family: var(--f-body);
  font-size: 0.95rem;
  color: var(--c-ink-muted);
  margin-top: 0.4rem;
}

.mod-proj-desc {
  font-family: var(--f-body);
  font-size: clamp(1.15rem, 2vw, 1.5rem);
  line-height: 1.5;
  color: var(--c-ink);
  max-width: 850px;
}

.mod-proj-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.mod-stack-tag {
  font-family: var(--f-body);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.35rem 0.8rem;
  background: rgba(10, 10, 10, 0.04);
  color: var(--c-ink);
}

.mod-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1.5rem;
  padding: 1.2rem 0;
}

.mod-kpi-item {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.mod-kpi-val {
  font-family: var(--f-display);
  font-weight: 900;
  font-size: clamp(1.8rem, 3.2vw, 2.6rem);
  letter-spacing: -0.03em;
  color: var(--c-ink);
}

.mod-kpi-lbl {
  font-family: var(--f-body);
  font-size: 0.82rem;
  color: var(--c-ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.mod-proj-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 1rem;
}

/* --------------------------------------------------------------------------
   6. System Console & Logs Module (>) — Monospace Diagnostics
   -------------------------------------------------------------------------- */
.mod-console-layout {
  display: flex;
  flex-direction: column;
  gap: 1.8rem;
  width: 100%;
}

.mod-console-nav {
  display: flex;
  gap: 0.8rem;
  border-bottom: 1px solid rgba(10, 10, 10, 0.08);
  padding-bottom: 0.8rem;
}

.mod-console-tab {
  padding: 0.45rem 1rem;
  font-family: var(--f-display);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: transparent;
  color: var(--c-ink-muted);
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.mod-console-tab:hover,
.mod-console-tab.is-active {
  color: var(--c-ink);
  background: rgba(10, 10, 10, 0.05);
}

.mod-console-terminal {
  background: #0A0A0A;
  color: #F7F6F3;
  padding: 1.5rem;
  border-radius: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.88rem;
  line-height: 1.6;
  max-height: 55vh;
  overflow-y: auto;
}

.mod-terminal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 1rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid rgba(247, 246, 243, 0.15);
  font-size: 0.78rem;
  color: #A0A0A0;
}

.mod-terminal-live {
  color: var(--c-glitch-b);
  font-weight: 700;
  letter-spacing: 0.1em;
}

.mod-log-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  padding: 0.35rem 0;
  border-bottom: 1px solid rgba(247, 246, 243, 0.04);
}

.mod-log-time {
  color: #888888;
}

.mod-log-source {
  color: var(--c-glitch-b);
  font-weight: 700;
}

.mod-log-level {
  font-weight: 700;
}
.mod-log-level.info { color: #FFFFFF; }
.mod-log-level.debug { color: #777777; }
.mod-log-level.warn { color: var(--c-glitch-a); }

.mod-log-msg {
  color: #E0E0E0;
  flex: 1;
}

.mod-services-list,
.mod-secrets-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.mod-svc-row,
.mod-secret-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 0;
  border-bottom: 1px solid rgba(10, 10, 10, 0.06);
}

.mod-svc-meta,
.mod-secret-key-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.mod-svc-name,
.mod-secret-name {
  font-family: var(--f-display);
  font-weight: 800;
  font-size: clamp(1.1rem, 2vw, 1.45rem);
  letter-spacing: -0.02em;
  color: var(--c-ink);
}

.mod-svc-type,
.mod-secret-scope {
  font-family: var(--f-body);
  font-size: 0.85rem;
  color: var(--c-ink-muted);
}

.mod-svc-health {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.mod-svc-latency {
  font-family: ui-monospace, monospace;
  font-size: 0.85rem;
  color: var(--c-ink-muted);
}

.mod-svc-pill.ok {
  font-family: var(--f-display);
  font-weight: 800;
  font-size: 0.75rem;
  color: var(--c-ink);
  padding: 0.25rem 0.6rem;
  background: rgba(10, 10, 10, 0.08);
}

.mod-secret-val-mask {
  font-family: ui-monospace, monospace;
  font-size: 1rem;
  letter-spacing: 0.2em;
  color: var(--c-ink-muted);
}

.mod-secrets-notice {
  font-family: var(--f-body);
  font-size: 0.9rem;
  color: var(--c-ink-muted);
  margin-bottom: 0.5rem;
}

.mod-server-telemetry {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.mod-telemetry-item {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.mod-telem-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--f-display);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--c-ink);
}

.mod-telem-bar {
  width: 100%;
  height: 8px;
  background: rgba(10, 10, 10, 0.08);
  position: relative;
  overflow: hidden;
}

.mod-telem-fill {
  height: 100%;
  background: var(--c-ink);
  transition: width 0.4s ease;
}

.mod-telemetry-extra {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(10, 10, 10, 0.06);
}

.mod-extra-row {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-family: var(--f-body);
  font-size: 0.85rem;
  color: var(--c-ink-muted);
}
.mod-extra-row span:last-child {
  font-family: var(--f-display);
  font-weight: 700;
  color: var(--c-ink);
  font-size: 0.95rem;
}

.mod-console-actions {
  margin-top: 1rem;
}

/* --------------------------------------------------------------------------
   7. Tasks & Incidents Module (!) — P0 Priority & Resolution
   -------------------------------------------------------------------------- */
.mod-tasks-layout {
  display: flex;
  flex-direction: column;
  gap: 1.6rem;
  width: 100%;
}

.mod-tasks-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  border-bottom: 1px solid rgba(10, 10, 10, 0.08);
  padding-bottom: 0.8rem;
}

.mod-filter-tabs {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.mod-add-task-box {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  padding: 1.2rem;
  background: rgba(10, 10, 10, 0.03);
  border-left: 3px solid #E63946;
}

.mod-form-row {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.mod-input {
  flex: 1;
  min-height: 44px;
  padding: 0.6rem 0.9rem;
  border: 1px solid rgba(10, 10, 10, 0.2);
  background: var(--c-bg);
  font-family: var(--f-body);
  font-size: 0.9rem;
  color: var(--c-ink);
  border-radius: 0;
  outline: none;
  transition: border-color 0.15s ease;
}

.mod-input:focus {
  border-color: var(--c-ink);
}

.mod-select {
  min-height: 44px;
  padding: 0.6rem 0.9rem;
  border: 1px solid rgba(10, 10, 10, 0.2);
  background: var(--c-bg);
  font-family: var(--f-display);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--c-ink);
  border-radius: 0;
  cursor: pointer;
  outline: none;
}

.mod-tasks-list {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.mod-task-card {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1.4rem;
  background: var(--c-bg);
  border: 1px solid rgba(10, 10, 10, 0.08);
  transition: all 0.15s ease;
}

.mod-task-card:hover {
  border-color: rgba(10, 10, 10, 0.25);
  transform: translateY(-1px);
}

.mod-task-card.is-done {
  opacity: 0.55;
  border-style: dashed;
}

.mod-task-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  font-family: var(--f-display);
  font-size: 0.78rem;
}

.mod-priority-badge {
  font-family: var(--f-display);
  font-weight: 800;
  font-size: 0.68rem;
  padding: 0.2rem 0.55rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.mod-priority-badge.p0 {
  background: #E63946;
  color: #FFFFFF;
}

.mod-priority-badge.p1 {
  background: var(--c-ink);
  color: var(--c-bg);
}

.mod-priority-badge.p2 {
  background: rgba(10, 10, 10, 0.08);
  color: var(--c-ink-muted);
}

.mod-task-owner,
.mod-task-deadline {
  color: var(--c-ink-muted);
  font-weight: 600;
  font-size: 0.75rem;
}

.mod-task-status-btn {
  font-family: var(--f-display);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.25rem 0.65rem;
  border-radius: 0;
  cursor: pointer;
  margin-left: auto;
  min-height: 28px;
  touch-action: manipulation;
  transition: all 0.15s ease;
}

.mod-task-status-btn.urgent {
  background: rgba(230, 57, 70, 0.12);
  color: #E63946;
  border: 1px solid #E63946;
}

.mod-task-status-btn.progress {
  background: rgba(10, 10, 10, 0.08);
  color: var(--c-ink);
  border: 1px solid var(--c-ink);
}

.mod-task-status-btn.done {
  background: transparent;
  color: var(--c-ink-muted);
  border: 1px solid rgba(10, 10, 10, 0.2);
}

.mod-task-title {
  font-family: var(--f-display);
  font-size: clamp(1.15rem, 2.2vw, 1.45rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--c-ink);
  margin: 0;
  line-height: 1.25;
}

.mod-task-desc {
  font-family: var(--f-body);
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--c-ink-muted);
  margin: 0;
}

.mod-task-actions {
  display: flex;
  gap: 0.8rem;
  align-items: center;
  margin-top: 0.4rem;
}

.mod-btn-subtle {
  background: rgba(10, 10, 10, 0.05);
  border: 1px solid rgba(10, 10, 10, 0.2);
  color: var(--c-ink);
}

.mod-btn-subtle:hover {
  background: var(--c-ink);
  color: var(--c-bg);
}

.mod-btn-danger {
  background: transparent;
  border: 1px solid rgba(230, 57, 70, 0.4);
  color: #E63946;
}

.mod-btn-danger:hover {
  background: #E63946;
  color: #FFFFFF;
}

/* --------------------------------------------------------------------------
   8. Search Module (?) — Global Cross-Domain Search
   -------------------------------------------------------------------------- */
.mod-search-layout {
  display: flex;
  flex-direction: column;
  gap: 1.6rem;
  width: 100%;
}

.mod-search-bar {
  display: flex;
  gap: 0.8rem;
  align-items: center;
  flex-wrap: wrap;
}

.mod-search-input {
  flex: 1;
  min-height: 48px;
  font-size: 1rem;
  padding: 0.7rem 1.1rem;
  background: var(--c-bg);
  border: 1px solid rgba(10, 10, 10, 0.25);
}

.mod-search-input:focus {
  border-color: var(--c-ink);
}

.mod-search-tabs {
  border-bottom: 1px solid rgba(10, 10, 10, 0.08);
  padding-bottom: 0.8rem;
}

.mod-search-results {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.mod-search-card {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding: 1.4rem;
  background: var(--c-bg);
  border: 1px solid rgba(10, 10, 10, 0.08);
  cursor: pointer;
  transition: all 0.15s ease;
}

.mod-search-card:hover {
  border-color: rgba(10, 10, 10, 0.3);
  transform: translateY(-1px);
  background: rgba(10, 10, 10, 0.015);
}

.mod-search-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
}

.mod-search-tag {
  font-family: var(--f-display);
  font-weight: 800;
  font-size: 0.68rem;
  padding: 0.2rem 0.55rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.mod-search-tag.p0 {
  background: #E63946;
  color: #FFFFFF;
}

.mod-search-tag.p1 {
  background: var(--c-ink);
  color: var(--c-bg);
}

.mod-search-tag.note {
  background: rgba(10, 10, 10, 0.08);
  color: var(--c-ink);
}

.mod-search-tag.project {
  background: #0A0A0A;
  color: #F7F6F3;
}

.mod-search-tag.person {
  background: rgba(10, 10, 10, 0.06);
  color: var(--c-ink-mid);
  border: 1px solid rgba(10, 10, 10, 0.2);
}

.mod-search-tag.event {
  background: rgba(10, 10, 10, 0.05);
  color: var(--c-ink-muted);
}

.mod-search-title {
  font-family: var(--f-display);
  font-size: clamp(1.15rem, 2vw, 1.45rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--c-ink);
  margin: 0;
  line-height: 1.25;
}

.mod-search-snippet {
  font-family: var(--f-body);
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--c-ink-muted);
  margin: 0;
}

/* --------------------------------------------------------------------------
   9. Settings Module (,) — System Parameters & Environment Control
   -------------------------------------------------------------------------- */
.mod-settings-layout {
  display: flex;
  flex-direction: column;
  gap: 1.8rem;
  width: 100%;
}

.mod-settings-hero {
  border-bottom: 1px solid rgba(10, 10, 10, 0.08);
  padding-bottom: 1.2rem;
}

.mod-settings-headline {
  font-family: var(--f-display);
  font-size: clamp(1.4rem, 2.5vw, 1.8rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--c-ink);
  margin: 0 0 0.4rem 0;
}

.mod-settings-subtitle {
  font-family: var(--f-body);
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--c-ink-muted);
  margin: 0;
}

.mod-settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 1.4rem;
}

.mod-settings-card {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  padding: 1.6rem;
  background: var(--c-bg);
  border: 1px solid rgba(10, 10, 10, 0.08);
  transition: all 0.15s ease;
}

.mod-settings-card:hover {
  border-color: rgba(10, 10, 10, 0.2);
}

.mod-settings-card-header {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid rgba(10, 10, 10, 0.06);
}

.mod-settings-badge {
  font-family: var(--f-mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 0.15rem 0.45rem;
  background: var(--c-ink);
  color: var(--c-bg);
}

.mod-settings-card-title {
  font-family: var(--f-display);
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--c-ink);
  margin: 0;
}

.mod-settings-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.mod-settings-row-info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  flex: 1;
  min-width: 180px;
}

.mod-settings-row-label {
  font-family: var(--f-display);
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--c-ink);
}

.mod-settings-row-desc {
  font-family: var(--f-body);
  font-size: 0.8rem;
  line-height: 1.4;
  color: var(--c-ink-muted);
}

.mod-settings-toggle-group {
  display: flex;
  gap: 0.3rem;
  background: rgba(10, 10, 10, 0.04);
  padding: 0.2rem;
  border: 1px solid rgba(10, 10, 10, 0.08);
}

.mod-toggle-btn {
  font-family: var(--f-mono);
  font-size: 0.75rem;
  padding: 0.35rem 0.65rem;
  background: transparent;
  color: var(--c-ink-muted);
  border: 1px solid transparent;
  cursor: pointer;
  touch-action: manipulation;
  transition: all 0.12s ease;
}

.mod-toggle-btn.is-active {
  background: var(--c-ink);
  color: var(--c-bg);
  border-color: var(--c-ink);
  font-weight: 700;
}

.mod-settings-actions-row {
  margin-top: 0.6rem;
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.mod-settings-shortcuts-card {
  grid-column: 1 / -1;
}

.mod-settings-shortcuts-table {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.mod-shortcut-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0.8rem;
  background: rgba(10, 10, 10, 0.02);
  border: 1px solid rgba(10, 10, 10, 0.04);
  gap: 1rem;
}

.mod-shortcut-key {
  font-family: var(--f-mono);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--c-ink);
  background: rgba(10, 10, 10, 0.06);
  padding: 0.15rem 0.5rem;
}

.mod-shortcut-action {
  font-family: var(--f-body);
  font-size: 0.88rem;
  color: var(--c-ink-mid);
  text-align: right;
}

/* System overrides triggered by settings */
body.no-glitch .glitch-processing::before,
body.no-glitch .glitch-processing::after,
body.no-glitch .glitch-disappearing::before,
body.no-glitch .glitch-disappearing::after,
body.no-glitch .brand-dot.glitch-dot::before,
body.no-glitch .brand-dot.glitch-dot::after {
  display: none !important;
}

body.font-compact .greeting-phrase {
  font-size: clamp(2rem, 6vw, 3.5rem) !important;
}

/* --------------------------------------------------------------------------
   Responsive Mobile Overrides for Atomic Modules
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  .module-window {
    padding: calc(1rem + env(safe-area-inset-top)) 1rem calc(1rem + env(safe-area-inset-bottom)) 1rem !important;
  }

  .module-header {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 0.75rem !important;
    margin-bottom: 1.2rem !important;
    padding-bottom: 0.5rem !important;
  }

  .module-header-nav {
    order: 1 !important;
    margin-right: 0 !important;
  }

  .module-header-actions {
    order: 2 !important;
  }

  .module-header-title {
    order: 3 !important;
    width: 100% !important;
    margin-top: 0.35rem !important;
  }

  .module-back-btn {
    min-height: 44px !important;
    padding: 0.55rem 1.15rem !important;
    border-width: 2px !important;
    font-size: 0.8rem !important;
    background: rgba(10, 10, 10, 0.05) !important;
  }

  .module-title {
    font-size: clamp(2rem, 7.5vw, 3.4rem);
  }

  .mod-btn-back {
    display: inline-flex;
    align-items: center;
    font-family: var(--f-display);
    font-weight: 800;
    font-size: 0.75rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 0.5rem 0.9rem;
    margin-bottom: 0.8rem;
    background: transparent;
    color: var(--c-ink);
    border: 1px solid rgba(10, 10, 10, 0.2);
    cursor: pointer;
    min-height: 40px;
    touch-action: manipulation;
  }

  .mod-btn-back:active {
    transform: scale(0.95);
    background: rgba(10, 10, 10, 0.05);
  }

  /* 1. Notes Mobile Master-Detail View */
  .mod-notes-layout {
    grid-template-columns: 1fr;
    gap: 0;
    width: 100%;
    flex: 1;
    overflow: hidden;
  }

  .mod-notes-layout.view-list .mod-notes-editor {
    display: none !important;
  }

  .mod-notes-layout.view-list .mod-notes-sidebar {
    display: flex !important;
    width: 100% !important;
    max-height: none !important;
    flex: 1;
    overflow-y: auto;
  }

  .mod-notes-layout.view-editor .mod-notes-sidebar {
    display: none !important;
  }

  .mod-notes-layout.view-editor .mod-notes-editor {
    display: flex !important;
    width: 100% !important;
    max-height: none !important;
    flex: 1;
    overflow-y: auto;
    padding: 0;
  }

  .mod-editor-header {
    flex-direction: column;
    align-items: stretch;
    gap: 0.8rem;
  }

  .mod-editor-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 0.6rem;
  }

  /* 2. Messages Mobile Master-Detail View */
  .mod-messages-layout {
    grid-template-columns: 1fr;
    gap: 0;
    width: 100%;
    flex: 1;
    overflow: hidden;
  }

  .mod-messages-layout.view-channels .mod-msg-main {
    display: none !important;
  }

  .mod-messages-layout.view-channels .mod-msg-sidebar {
    display: flex !important;
    width: 100% !important;
    max-height: none !important;
    flex: 1;
    overflow-y: auto;
  }

  .mod-messages-layout.view-thread .mod-msg-sidebar {
    display: none !important;
  }

  .mod-messages-layout.view-thread .mod-msg-main {
    display: flex !important;
    width: 100% !important;
    max-height: none !important;
    flex: 1;
    overflow: hidden;
    padding: 0;
  }

  .mod-msg-thread {
    flex: 1;
    overflow-y: auto;
    padding: 0.8rem 0;
  }

  .mod-bubble {
    max-width: 92%;
  }

  .mod-bubble-text {
    font-size: clamp(1.1rem, 3.4vw, 1.4rem);
  }

  /* 3. Calendar Mobile Unified Flow (No nested scroll traps) */
  .mod-calendar-layout {
    grid-template-columns: 1fr;
    gap: 2.2rem;
    width: 100%;
  }

  .mod-cal-main,
  .mod-cal-sidebar {
    width: 100% !important;
    max-height: none !important;
    overflow: visible !important;
    padding: 0;
  }

  .mod-cal-cell {
    min-height: 42px;
    font-size: 1.1rem;
    touch-action: manipulation;
  }

  .mod-cal-cell:active {
    transform: scale(0.92);
  }

  /* 4. Events Mobile Horizontal Filter Strip */
  .mod-events-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
  }

  .mod-filter-tabs {
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 0.3rem;
  }

  .mod-filter-tabs::-webkit-scrollbar {
    display: none;
  }

  .mod-filter-tabs .action-btn {
    white-space: nowrap;
    flex-shrink: 0;
  }

  .mod-item-actions {
    flex-wrap: wrap;
    gap: 0.8rem;
  }

  /* 5. Projects Mobile Nav Strip & 2-Column Scorecard */
  .mod-projects-layout {
    gap: 1.5rem;
  }

  .mod-proj-nav {
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 0.3rem;
  }

  .mod-proj-nav::-webkit-scrollbar {
    display: none;
  }

  .mod-proj-pill {
    white-space: nowrap;
    flex-shrink: 0;
    min-height: 38px;
  }

  .mod-proj-title {
    font-size: clamp(2rem, 7vw, 3.2rem);
  }

  .mod-kpi-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 1rem;
  }

  .mod-proj-actions .action-btn {
    width: 100%;
    min-height: 48px;
  }

  /* 6. Console Mobile Tab Strip & Terminal */
  .mod-console-layout {
    gap: 1.2rem;
  }

  .mod-console-nav {
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 0.3rem;
  }

  .mod-console-nav::-webkit-scrollbar {
    display: none;
  }

  .mod-console-tab {
    white-space: nowrap;
    flex-shrink: 0;
    min-height: 38px;
  }

  .mod-console-terminal {
    max-height: 48vh;
    padding: 0.85rem;
    font-size: 0.78rem;
  }

  .mod-telemetry-extra {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.8rem;
  }

  .mod-console-actions .action-btn {
    width: 100%;
    min-height: 48px;
  }

  /* 7. Tasks Mobile Responsive Overrides */
  .mod-tasks-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.8rem;
  }

  .mod-filter-tabs {
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 0.3rem;
  }

  .mod-filter-tabs::-webkit-scrollbar {
    display: none;
  }

  .mod-filter-tabs .mod-tab {
    white-space: nowrap;
    flex-shrink: 0;
    min-height: 38px;
  }

  .mod-tasks-toolbar .action-btn {
    width: 100%;
    min-height: 44px;
  }

  .mod-task-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 0.6rem;
  }

  .mod-task-actions .action-btn {
    width: 100%;
    min-height: 44px;
  }

  /* 8. Search Mobile Responsive Overrides */
  .mod-search-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.8rem;
  }

  .mod-search-input {
    font-size: 1.1rem;
    padding: 0.75rem 0.9rem;
    min-height: 48px;
  }

  .mod-search-card {
    padding: 1rem;
  }
}


