
/* ── Typography & Manifest Authority ────────────────────────────────── */
body, button, input, textarea, select {
  font-family: 'Inter', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, .serif-heading {
  font-family: 'Noto Serif', Georgia, serif;
  letter-spacing: -0.02em;
  font-weight: 500;
}

.display-editorial {
  font-size: 3.5rem;
  line-height: 1.1;
  font-family: 'Noto Serif', serif;
  letter-spacing: -0.03em;
}

/* ── CASEMATE Brand System ───────────────────────────────────────────── */
.brand-header-wrap {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  min-height: 60px;
  flex: 0 0 auto;
  margin: 0;
  padding: 0;
}

.brand-login-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  width: 100%;
  min-height: 90px;
  margin: 0;
  padding: 0;
}

.brand-logo-image {
  display: block;
  width: auto;
  height: 46px;
  object-fit: contain;
  flex: 0 0 auto;
  max-width: min(86vw, 270px);
  image-rendering: auto;
  image-rendering: -webkit-optimize-contrast;
}

.brand-logo-image-header {
  height: 46px;
  max-width: min(40vw, 250px);
}

.brand-logo-image-login {
  height: 74px;
  max-width: min(94vw, 820px);
  margin: 0;
}

.dark .brand-logo-image {
  filter: brightness(0) invert(1);
}

@media (max-width: 640px) {
  .brand-logo-image {
    height: 38px;
    max-width: 86vw;
  }

  .brand-logo-image-header {
    height: 38px;
    max-width: 86vw;
  }

  .brand-logo-image-login {
    height: 58px;
    max-width: 92vw;
  }
}

.brand-header-text {
  line-height: 1.05;
}

.brand-login-text {
  line-height: 1.1;
}

.brand-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: #ffffff;
}

.brand-title-login {
  font-family: 'Noto Serif', Georgia, serif;
  font-size: clamp(2rem, 5.5vw, 2.75rem);
  font-weight: 700;
  letter-spacing: 0.045em;
  color: #0f172a;
  text-shadow: 0 8px 24px rgba(148, 163, 184, 0.24);
}

.dark .brand-title-login {
  color: #ffffff;
  text-shadow: 0 8px 24px rgba(5, 15, 46, 0.52);
}

.brand-subtitle {
  margin: 0;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: rgba(255, 255, 255, 0.78);
  display: none;
}

.brand-subtitle-login {
  display: block;
  font-size: clamp(0.74rem, 2.3vw, 0.92rem);
  letter-spacing: 0.02em;
  color: rgba(51, 65, 85, 0.8);
}

.dark .brand-subtitle-login {
  color: rgba(222, 231, 255, 0.88);
}

.brand-fade-in {
  animation: brandFadeIn 560ms ease both;
}

.brand-fade-delay {
  animation-delay: 110ms;
}

.login-gradient-bg {
  background: linear-gradient(120deg, #f6f9ff 0%, #eef4ff 52%, #f4f7ff 100%);
}

.dark .login-gradient-bg {
  background: linear-gradient(120deg, #061735 0%, #0b1b3b 48%, #03122e 100%);
}

.auth-input-dark {
  width: 100%;
  background: transparent;
  border: 0;
  border-bottom: 1px solid rgba(100, 116, 139, 0.32);
  padding: 0.75rem 0;
  outline: none;
  color: #0f172a;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.11em;
  transition: border-color 180ms ease, box-shadow 180ms ease;
}

.auth-input-dark::placeholder {
  color: rgba(100, 116, 139, 0.58);
}

.auth-input-dark:focus {
  border-bottom-color: rgba(37, 99, 235, 0.95);
  box-shadow: 0 8px 14px -12px rgba(37, 99, 235, 0.45);
}

.dark .auth-input-dark {
  border-bottom-color: rgba(191, 211, 255, 0.32);
  color: #ffffff;
}

.dark .auth-input-dark::placeholder {
  color: rgba(191, 211, 255, 0.45);
}

.dark .auth-input-dark:focus {
  border-bottom-color: rgba(96, 165, 250, 0.95);
  box-shadow: 0 8px 14px -12px rgba(96, 165, 250, 0.55);
}

.auth-file-input {
  width: 100%;
  background: rgba(248, 250, 252, 0.9);
  border: 1px dashed rgba(148, 163, 184, 0.52);
  color: rgba(51, 65, 85, 0.95);
  border-radius: 10px;
  padding: 0.55rem 0.75rem;
  font-size: 11px;
  font-weight: 600;
  transition: border-color 180ms ease, background-color 180ms ease;
}

.auth-file-input:hover,
.auth-file-input:focus {
  border-color: rgba(37, 99, 235, 0.92);
  background: rgba(241, 245, 249, 1);
  outline: none;
}

.dark .auth-file-input {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(191, 211, 255, 0.42);
  color: rgba(219, 234, 254, 0.95);
}

.dark .auth-file-input:hover,
.dark .auth-file-input:focus {
  border-color: rgba(96, 165, 250, 0.92);
  background: rgba(255, 255, 255, 0.07);
}

.upload-preview-enter {
  animation: uploadPreviewEnter 240ms ease-out both;
}

@keyframes uploadPreviewEnter {
  from {
    opacity: 0;
    transform: translateY(4px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.profile-dropdown-enter {
  animation: profileDropdownEnter 180ms ease-out both;
  transform-origin: top right;
}

.case-meta-card {
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.case-meta-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.case-meta-title {
  margin: 0;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #475569;
}

.case-meta-icon-btn {
  height: 24px;
  width: 24px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  border-radius: 8px;
  background: #f8fafc;
  color: #334155;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
}

.case-meta-icon-btn:hover {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: rgba(59, 130, 246, 0.45);
}

.case-meta-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.case-meta-action-btn {
  height: 24px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.38);
  background: #f8fafc;
  color: #334155;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
}

.case-meta-action-btn-primary {
  background: #1d4ed8;
  border-color: #1d4ed8;
  color: #ffffff;
}

.case-meta-input {
  width: min(180px, 58%);
  height: 28px;
  border: 1px solid rgba(148, 163, 184, 0.45);
  border-radius: 8px;
  padding: 0 10px;
  font-size: 11px;
  font-weight: 700;
  color: #0f172a;
  background: #ffffff;
  text-align: right;
}

.case-meta-input:focus {
  outline: none;
  border-color: rgba(59, 130, 246, 0.75);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.16);
}

.case-meta-input-disabled {
  background: #f8fafc;
  color: #1d4ed8;
  cursor: not-allowed;
}

.case-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.case-meta-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #64748b;
  flex-shrink: 0;
}

.case-meta-value {
  font-size: 12px;
  font-weight: 800;
  color: #0f172a;
  text-align: right;
  overflow-wrap: anywhere;
}

.case-meta-value-link {
  color: #1d4ed8;
  text-decoration: none;
  cursor: pointer;
}

@media (max-width: 640px) {
  .case-meta-label {
    font-size: 9px;
  }

  .case-meta-value {
    font-size: 11px;
  }

  .case-meta-input {
    width: min(150px, 62%);
  }
}

@keyframes profileDropdownEnter {
  from {
    opacity: 0;
    transform: translateY(-8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.walkthrough-target-active {
  position: relative;
  z-index: 1550;
  outline: 2px solid rgba(212, 175, 55, 0.82);
  outline-offset: 3px;
  border-radius: 10px;
  box-shadow: 0 0 0 4px rgba(212, 175, 55, 0.18), 0 0 18px rgba(212, 175, 55, 0.32);
}

.walkthrough-target-pulse {
  animation: walkthroughTargetPulse 1.7s ease-in-out infinite;
}

.walkthrough-upload-focus {
  border-color: rgba(212, 175, 55, 0.8) !important;
  box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.22), 0 0 18px rgba(212, 175, 55, 0.34);
}

.walkthrough-ai-focus {
  border-color: rgba(212, 175, 55, 0.82) !important;
  box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.24), 0 0 20px rgba(212, 175, 55, 0.36);
}

@keyframes walkthroughTargetPulse {
  0%, 100% {
    box-shadow: 0 0 0 4px rgba(212, 175, 55, 0.20), 0 0 18px rgba(212, 175, 55, 0.34);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(212, 175, 55, 0.14), 0 0 28px rgba(212, 175, 55, 0.45);
  }
}

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

@media (min-width: 640px) {
  .brand-subtitle {
    display: block;
  }
}

/* ── Sovereign Design Tokens ────────────────────────────────────────── */
:root {
  /* [Courtroom Day] */
  --color-primary:       hsl(43, 60%, 45%);   /* Champagne Gold      */
  --color-primary-light: hsl(43, 60%, 55%);
  --color-primary-dark:  hsl(43, 60%, 35%);
  
  --color-background:    hsl(40, 20%, 96%);   /* Parchment           */
  --color-surface:       hsl(0, 0%, 100%);    /* Pure White          */
  --color-surface-raised: hsl(40, 20%, 94%); 
  
  --color-on-surface:    hsl(222, 47%, 11%);  /* Obsidian Black      */
  --color-muted:         hsl(222, 10%, 45%);
  --color-subtle:        hsl(222, 5%, 80%);
  
  --glass-opacity:       0.05;
  --glass-blur:          12px;
  
  --font-display:        'Noto Serif', serif;
  --font-body:           'Inter', sans-serif;
}

.dark {
  /* [Chamber Night] */
  --color-primary:       hsl(43, 60%, 55%);   /* Polished Brass      */
  --color-primary-light: hsl(43, 60%, 65%);
  --color-primary-dark:  hsl(43, 60%, 45%);
  
  --color-background:    #0d1322;              /* Deep Midnight Navy  */
  --color-surface:       #191f2f;              /* Elevated Slab       */
  --color-surface-raised: #242a3a;
  
  --color-on-surface:    #e5e2e1;              /* Cream/Parchment     */
  --color-muted:         #a1a1aa;
  --color-subtle:        #3f3f46;
  
  --glass-opacity:       0.1;
  --glass-blur:          20px;
}

/* ── Digital Materials & Textures ───────────────────────────────────── */
.parchment-texture {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100' viewBox='0 0 100 100'%3E%3Cfilter id='n' x='0' y='0'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100' height='100' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
}

.dark .obsidian-texture {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100' viewBox='0 0 100 100'%3E%3Cfilter id='n' x='0' y='0'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100' height='100' filter='url(%23n)' opacity='0.08'/%3E%3C/svg%3E");
}

/* ── Architectural Hierarchy (No-Lines) ────────────────────────────── */
body {
  background-color: var(--color-background);
  color: var(--color-on-surface);
  transition: background-color 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.glass-panel {
  background: hsla(0, 0%, 100%, var(--glass-opacity));
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid hsla(0, 0%, 100%, 0.1);
}

.dark .glass-panel {
  background: hsla(222, 47%, 11%, 0.6);
  border: 1px solid hsla(0, 0%, 100%, 0.05);
}

/* ── Radical Layouts ────────────────────────────────────────────────── */
.editorial-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 2rem;
}

.document-stack {
  position: relative;
  transition: transform 0.3s ease;
}

.document-stack:hover {
  transform: translateY(-4px);
}

.gold-shimmer {
  position: relative;
  overflow: hidden;
}

.gold-shimmer::after {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(
    45deg,
    transparent 45%,
    hsla(43, 60%, 55%, 0.1) 50%,
    transparent 55%
  );
  transition: transform 0.6s ease-in-out;
  transform: translateX(-100%);
  pointer-events: none;
}

.gold-shimmer:hover::after {
  transform: translateX(100%);
}

/* ── Tailwind Override Fixes ────────────────────────────────────────── */
.dark .bg-white, .dark .bg-surface { background-color: var(--color-surface) !important; }
.dark .text-gray-900, .dark .text-primary-dark { color: var(--color-on-surface) !important; }
.dark .text-gray-600, .dark .text-muted { color: var(--color-muted) !important; }
.dark .border-gray-100, .dark .border-gray-200 { border-color: var(--color-subtle) !important; border-width: 0.5px; }

/* Remove hard shadows in favor of depth gradients */
.shadow-sm, .shadow, .shadow-md, .shadow-lg {
  box-shadow: none !important;
}

.elevation-1 { background-color: var(--color-surface); }
.elevation-2 { background-color: var(--color-surface-raised); }

/* ── Original Utilities (Preserved) ─────────────────────────────────── */

.custom-scrollbar::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.custom-scrollbar::-webkit-scrollbar-track {
  background: transparent;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
  background: var(--color-primary);
  border-radius: 10px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
  background: var(--color-primary-dark);
}

.line-clamp-2 {
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}

.prose {
  color: var(--color-on-surface);
  line-height: 1.75;
  font-size: 0.9375rem;
}

.prose h1, .prose h2, .prose h3, .prose h4 {
    color: var(--color-on-surface);
    font-weight: 700;
    line-height: 1.3;
    margin-top: 1.5em;
    margin-bottom: 0.5em;
}

.prose h1 { font-size: 1.5rem; }
.prose h2 { font-size: 1.25rem; border-bottom: 1px solid var(--color-subtle); padding-bottom: 0.3em; }

.prose p {
    margin-top: 0.75em;
    margin-bottom: 0.75em;
}

.prose strong {
    color: var(--color-on-surface);
    font-weight: 700;
}

.prose a {
    color: var(--color-primary);
    text-decoration: underline;
}

.prose ul, .prose ol {
    margin-top: 0.5em;
    margin-bottom: 0.5em;
    padding-left: 1.5em;
}

/* Rich text editor (.document-page, contentEditable): Tailwind's preflight
   resets list-style/padding on ul/ol, so bullet and numbered lists inserted
   via the toolbar (or generated by AI) rendered as plain unindented lines.
   Restore proper list rendering inside the editor page. */
.document-page ul {
    list-style: disc outside;
    padding-left: 2em;
    margin: 0.5em 0;
}
.document-page ol {
    list-style: decimal outside;
    padding-left: 2em;
    margin: 0.5em 0;
}
.document-page ol[type="a"] { list-style-type: lower-alpha; }
.document-page ol[type="i"] { list-style-type: lower-roman; }
.document-page li {
    display: list-item;
    margin: 0.25em 0;
}

.prose hr {
    border: none;
    border-top: 1px solid var(--color-subtle);
    margin: 1.25em 0;
}

.prose blockquote {
    border-left: 4px solid var(--color-primary);
    padding-left: 1em;
    color: var(--color-muted);
    margin: 1em 0;
    font-style: italic;
}

/* Dark mode extended color overrides */
.dark .bg-blue-50    { background-color: hsla(217, 70%, 50%, 0.12); }
.dark .bg-green-50   { background-color: hsla(142, 70%, 40%, 0.12); }
.dark .bg-red-50     { background-color: hsla(0,   80%, 55%, 0.12); }
.dark .bg-amber-50   { background-color: hsla(43,  80%, 50%, 0.10); }

.dark .bg-blue-100   { background-color: hsla(217, 70%, 50%, 0.20); }
.dark .bg-green-100  { background-color: hsla(142, 70%, 40%, 0.22); }
.dark .bg-red-100    { background-color: hsla(0,   80%, 55%, 0.20); }

.dark .border-blue-100   { border-color: hsla(217, 70%, 55%, 0.28); }
.dark .border-green-100  { border-color: hsla(142, 70%, 45%, 0.28); }
.dark .border-red-100    { border-color: hsla(0,   80%, 60%, 0.28); }

.dark .text-blue-600   { color: hsl(213 93% 72%); }
.dark .text-green-500  { color: hsl(142 72% 60%); }
.dark .text-red-500    { color: hsl(0 90% 70%); }

/* ── Sovereign Status Elements ─────────────────────────────────── */

.sovereign-alert {
    background: rgba(220, 38, 38, 0.05);
    border: 1px solid rgba(220, 38, 38, 0.1);
    color: #dc2626;
}

.dark .sovereign-alert {
    background: rgba(220, 38, 38, 0.1);
    border-color: rgba(220, 38, 38, 0.2);
    color: #f87171;
}

.sovereign-warning {
    background: rgba(197, 160, 89, 0.05);
    border: 1px solid rgba(197, 160, 89, 0.1);
    color: #C5A059;
}

.dark .sovereign-warning {
    background: rgba(197, 160, 89, 0.1);
    border-color: rgba(197, 160, 89, 0.2);
    color: #D4AF37;
}

.sovereign-success {
    background: rgba(16, 185, 129, 0.05);
    border: 1px solid rgba(16, 185, 129, 0.1);
    color: #059669;
}

.dark .sovereign-success {
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.2);
    color: #34d399;
}

.sovereign-badge {
    text-transform: uppercase;
    letter-spacing: 0.2em;
    font-weight: 900;
    font-size: 8px;
    padding: 4px 10px;
    border-radius: 2px;
}
