:root {
  /* Base Backgrounds (slightly cooler tone) */
  --bg-body: #0f0f0f;
  --bg-header: #0f0f0f;
  --bg-sidebar: #0f0f0f;
  --bg-case-controls: #0f0f0f;
  --inner-layout-borders: rgba(255, 255, 255, 0.05);

  --bg-surface-02: rgba(255, 255, 255, 0.02);
  --bg-surface-03: rgba(255, 255, 255, 0.03);
  --bg-surface-05: rgba(255, 255, 255, 0.05);
  --bg-surface-08: rgba(255, 255, 255, 0.08);
  --bg-surface-10: rgba(255, 255, 255, 0.1);
  --bg-surface-15: rgba(255, 255, 255, 0.15);
  --bg-surface-20: rgba(255, 255, 255, 0.2);

  --bg-dropdown: rgba(40, 40, 40, 0.95);
  --bg-tab-active: rgba(80, 80, 80, 0.4);
  --bg-button-hover: rgba(128, 128, 128, 0.45);
  --bg-overlay: rgba(0, 0, 0, 0.8);
  --bg-modal-gradient-start: rgba(20, 20, 20, 0.92);
  --bg-modal-gradient-end: rgba(30, 30, 30, 0.88);

  /* Borders */
  --border-05: rgba(255, 255, 255, 0.05);
  --border-08: rgba(255, 255, 255, 0.08);
  --border-10: rgba(255, 255, 255, 0.1);
  --border-15: rgba(255, 255, 255, 0.15);
  --border-20: rgba(255, 255, 255, 0.2);
  --border-30: rgba(255, 255, 255, 0.3);
  --border-tab: rgba(100, 100, 100, 0.5);

  /* Text */
  --text-pure: #ffffff;
  --text-global: rgba(255, 255, 255, 0.7);
  --text-primary: rgba(255, 255, 255, 0.7);
  --text-muted: rgba(255, 255, 255, 0.6);
  --text-dim: rgba(255, 255, 255, 0.5);
  --text-placeholder: rgba(255, 255, 255, 0.3);
  --text-disabled: rgba(255, 255, 255, 0.2);
  --text-stat-number: #a0a0a0;

  /* Accent (Cyan/Blue) */
  --primary-main: #00d4ff;
  --primary-02: rgba(0, 212, 255, 0.2);
  --primary-03: #0a4a57;
  --primary-04: rgba(0, 212, 255, 0.4);
  --primary-05: rgba(0, 212, 255, 0.5);
  --primary-06: rgba(0, 212, 255, 0.6);
  --primary-07: rgba(0, 212, 255, 0.7);
  --primary-08: rgba(0, 212, 255, 0.8);
  --primary-09: rgba(0, 212, 255, 0.9);

  /* Status Colors */
  --danger-main: rgba(255, 80, 80, 0.6);
  --danger-bg: #5b2626;
  --danger-hover: rgba(255, 80, 80, 0.4);
  --danger-soft: #572222;
  --danger-border: rgba(255, 120, 120, 0.7);
  --danger-light: rgba(255, 120, 120, 0.8);

  --warning-main: rgba(255, 165, 0, 0.6);
  --warning-bg: #573c0a;
  --warning-soft: #33260d;
  --warning-text: rgba(255, 200, 100, 1);
  --warning-glow: #9a7300;

  --success-main: rgba(34, 197, 94, 0.6);
  --success-bg: #144526;
  --success-soft: #122a1b;
  --success-text: rgba(134, 239, 172, 1);

  /* --gold-bg: rgba(255, 215, 0, 0.3);
  --gold-bg-hover: rgba(255, 215, 0, 0.2);
  --gold-border: rgba(255, 215, 0, 0.5);
  --gold-text: rgba(255, 215, 0, 0.8);
  --gold-text-highlight: rgba(255, 215, 0, 0.9); */

  --gold-bg: #a67c00;
  --gold-bg-hover: #9a7300;
  --gold-border: rgba(255, 215, 0, 0.5);
  --gold-text: rgba(255, 215, 0, 0.8);
  --gold-text-highlight: #e7c301;

  /* Shadows */
  --shadow-dark: rgba(0, 0, 0, 0.12);
  --shadow-light: rgba(0, 0, 0, 0.08);
  --shadow-glow: rgba(80, 80, 80, 0.25);
  --shadow-modal: rgba(0, 0, 0, 0.4);
  --shadow-modal-light: rgba(0, 0, 0, 0.2);

  /* Initial font-sizes */
  /* --font-size-global: 12.5px;
  --font-size-11: 11px;
  --font-size-14: 14px;
  --font-size-18: 18px; */

  --font-size-global: 14px;
  --font-size-11: 12px;
  --font-size-14: 15px;
  --font-size-18: 19px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

button,
select,
input {
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
}

input[type="text"],
input[type="email"],
input[type="number"],
input[type="date"],
input[type="time"],
input[type="url"] {
  cursor: text;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: var(--font-size-global);
  line-height: 1.4;
  background: var(--bg-body);
  min-height: 100vh;
  color: var(--text-global);
}

*:focus:not(:focus-visible) {
  outline: none;
}

/* Layout */

/* WORKSPACE */
.workspace-container {
  height: 100vh;
  width: 100vw;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  /* Prevent the whole page from scrolling */
}

/* HEADER */

.app-header {
  flex: 0 0 auto;
  min-height: 70px;
  background: var(--bg-header);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  border-bottom: 1px var(--inner-layout-borders) solid;

  display: flex;
  justify-content: space-between;
  position: relative;
}

/* APP BODY */
.app-body {
  flex: 1;
  /* Take all remaining height */
  display: flex;
  /* Side-by-side: Sidebar and Content */
  min-height: 0;
  /* CRITICAL: Allows children to be smaller than their content */
  position: relative;
}

/*  Sidebar Base */
.app-body-sidebar {
  width: 260px;
  flex: 0 0 auto;
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  padding: 20px 30px;
  overflow-y: auto;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  /* Add smooth transition */
  opacity: 1;
  visibility: visible;
  border-right: 1px var(--inner-layout-borders) solid;
}

/* Updated Closed State for Desktop */
.app-body-sidebar.closed {
  width: 0;
  padding: 16px 0;
  /* Shrink horizontal padding */
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* APP BODY CONTENT */
.app-body-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  background: var(--bg-body);
}

/* THE SCROLL ZONE */
.main-content {
  flex: 1;
  overflow-y: auto;
  padding: 0 30px 30px 30px;
  min-height: 0;
}

/* --- UNIFIED BUTTON SYSTEM --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 7px 16px;
  border-radius: 8px;
  font-weight: 400;
  transition: all 0.2s ease;
  border: 1px solid transparent;
  font-family: inherit;
  white-space: nowrap;
  color: var(--text-global);
  box-sizing: border-box;
  user-select: none;
  min-height: 40px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Modifiers */
.btn-primary {
  background: var(--primary-03);
  border-color: var(--primary-05);
}

.btn-primary:hover,
.btn-primary:focus {
  background: var(--primary-04);
  border-color: var(--primary-06);
}

.btn-secondary {
  background: var(--bg-surface-05);
  border-color: var(--border-15);
}

.btn-secondary:hover,
.btn-secondary:focus {
  background: var(--bg-surface-10);
  border-color: var(--border-30);
}

.btn-danger {
  background: var(--danger-main);
  border-color: var(--danger-border);
}

.btn-danger:hover,
.btn-danger:focus {
  background: var(--danger-hover) !important;
  border-color: var(--danger-border) !important;
  color: var(--text-global);
}

.btn-gold {
  background: var(--gold-bg);
  border-color: var(--gold-border);
}

.btn-gold:hover,
.btn-gold:focus {
  background: var(--gold-bg-hover) !important;
  border-color: var(--gold-text) !important;
  color: var(--text-global);
}

.btn-tab {
  background: var(--bg-surface-02);
  border: 1px solid var(--border-08);
  box-shadow:
    0 4px 16px var(--shadow-dark),
    0 1px 4px var(--shadow-light),
    inset 0 1px 0 var(--border-05);

  justify-content: flex-start;
}

.btn-tab:hover,
.btn-tab:focus {
  border-color: var(--border-tab);
  transform: translateY(-1px);
}

.btn-tab.active {
  background: var(--bg-tab-active);
  border-color: var(--border-tab);
  box-shadow: 0 0 10px var(--shadow-glow);
}

.btn-icon {
  /* min-width: 33px;
  height: 33px; */
  padding: 7px 12px;
  padding: 4px;
}

.btn-icon img,
.btn-icon svg {
  width: 16px;
  height: 16px;
}

.btn-icon:hover,
.btn-icon:focus {
  background: var(--bg-surface-10);
}

.btn-ghost {
  background: transparent;
  border: none;
  padding: 4px;
}

.btn-ghost:hover,
.btn-ghost:focus {
  background: var(--bg-surface-10);
}

.btn-free-tier:hover,
.btn-free-tier:focus {
  background: linear-gradient(145deg, #666, #555) !important;
  border-color: var(--border-15) !important;
}

.btn.btn-large {
  padding: 12px 24px;
  font-size: var(--font-size-18);
}

.btn-small {
  padding: 4px 12px;
  font-size: var(--font-size-11);
  min-height: 30px;
}

.btn-icon.btn-small {
  padding: 0.5rem;
  min-height: unset;
}

.upgrade-confirm-btn {
  background: linear-gradient(135deg, var(--gold-bg), rgba(255, 165, 0, 0.3));
  border: 1px solid var(--gold-border);
  border-radius: 8px;
  color: var(--text-global);
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s ease;
}

.upgrade-confirm-btn:hover,
.upgrade-confirm-btn:focus {
  transform: translateY(-1px);
  border-color: var(--gold-text);
  box-shadow: 0 4px 12px rgba(255, 215, 0, 0.15);
}

.btn-accent-outline {
  background: rgba(0, 212, 255, 0.1);
  border: 0.0625rem solid var(--primary-03);
  color: var(--primary-main);
}

.btn-accent-outline:hover,
.btn-accent-outline:focus {
  background: var(--primary-02);
}

/* Guide Buttons */
.btn-guide {
  background: var(--bg-surface-03);
  border: 0.0625rem solid var(--border-10);
  padding: 0.875rem 1rem;

  text-align: left;
  justify-content: flex-start;
  color: var(--text-global);
}

.btn-guide:hover,
.btn-guide:focus {
  border-color: var(--primary-05);
  background: var(--bg-surface-08);
}

/* Workspace */
.workspace-container {
  max-width: 100%;
  width: 100%;
  margin: 0 auto;

  position: relative;
  transition: padding-top 0.3s ease;
}

.workspace-container.banner-active {
  /* padding-top: 70px; */
}

.search-container {
  margin-right: auto;
}

/* Search bar */

.search-bar {
  min-height: 40px;
  background: var(--bg-surface-10);
  border: 1px solid var(--border-20);
  border-radius: 8px;
  padding: 7px 40px 7px 16px;
  width: 100%;
  color: var(--text-global);
}

.search-bar:focus {
  outline: none;
  box-shadow: 0 0 0 2px var(--primary-03);
  border-color: transparent;
}

.search-bar::placeholder {
  color: var(--text-placeholder);
}

.search-wrapper {
  position: relative;
  display: inline-block;
  max-width: 31.25rem;
  /* 500px */
  width: 100%;
}

.search-clear-icon {
  position: absolute;
  right: var(--font-size-11);
  /* 12px */
  top: 50%;
  transform: translateY(-50%);
  display: none;
  /* Display state handled by existing JS logic */
  color: var(--text-muted);
}

.search-clear-icon:hover,
.search-clear-icon:focus {
  color: var(--text-global);
}

/* Ensure the search results dropdown width matches the search bar */
.search-results {
  background: var(--border-08);
  border: 1px solid var(--border-30);
  max-height: 300px;
  overflow-y: auto;
  display: none;
  max-width: 100%;
  margin: 10px 0 30px;
  flex-direction: column;
}

.search-clear-icon {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.search-clear-btn:hover,
.search-clear-btn:focus {
  color: var(--text-global);
  background: var(--bg-surface-10);
}

.select-clear-btn {
  background: var(--bg-surface-10);
  border: 1px solid var(--border-20);
  border-radius: 4px;
  padding: 6px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  min-height: unset;
}

.select-clear-btn:hover,
.select-clear-btn:focus {
  background: var(--bg-surface-20);
  color: var(--text-global);
}

.search-result-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-10);
  cursor: pointer;
  transition: background 0.2s ease;
}

.search-result-item:hover,
.search-result-item:focus {
  background: var(--bg-surface-1);
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-title {
  font-weight: 500;
  margin-bottom: 4px;
  font-size: 16px;
  color: var(--text-global);
}

.search-result-category {
  color: var(--primary-04);
  margin-bottom: 4px;
}

.search-result-text {
  color: var(--text-global);
}

/* Case Controls */
.case-controls {
  flex: 0 0 auto;
  padding: 20px 30px;
  margin-bottom: 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  position: relative;
  z-index: 5000;
  background: var(--bg-case-controls);
  border-bottom: 1px var(--inner-layout-borders) solid;
}

.case-selector {
  background: var(--primary-03);
  border-color: var(--primary-05);
  color: var(--text-global) !important;
  border-radius: 8px;
  padding: 8px 40px 8px 12px;
  margin: 0 0 30px;
  min-width: 200px;
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='1.5'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
  background-position: calc(100% - 12px) center;
  background-repeat: no-repeat;
  background-size: 16px 16px;
}

.case-selector:focus {
  outline: none;
  box-shadow: 0 0 0 2px var(--primary-03);
  border-color: transparent;
}

.case-selector option {
  background: var(--bg-dropdown);
  color: var(--text-global);
}

.overview-footer {
  font-size: var(--font-size-11);
  margin-top: auto;
  text-align: center;
  padding-top: 15px;
}

.overview-footer a {
  color: var(--text-global);
  text-decoration: none;
  transition: color 0.2s ease;
}

.overview-footer a:hover,
.overview-footer a:focus {
  color: var(--text-global);
}

/* FAQ Modal Styles */
.faq-category {
  margin-bottom: 4px;
}

.faq-category-header {
  padding: 14px 18px;
  font-weight: 400;
  font-size: 15px;
  color: var(--text-global);
  background: var(--bg-surface-03);
  border: 1px solid var(--border-08);
  border-radius: 8px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: background 0.2s ease;
  user-select: none;
}

.faq-category-header:hover,
.faq-category-header:focus {
  background: var(--bg-surface-05);
}

.faq-category.expanded .faq-category-header {
  background: var(--bg-surface-05);
}

.faq-category-title {
  display: flex;
  align-items: center;
  gap: 20px;
}

.faq-category-icon {
  color: var(--primary-06);
  transition: transform 0.3s ease;
  font-size: 16px;
}

.faq-category.expanded .faq-category-icon {
  transform: rotate(180deg);
}

.faq-category-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
  width: 97%;
  margin: 0 auto 8px auto;
}

.faq-category.expanded .faq-category-content {
  max-height: 2000px;
}

.faq-item {
  margin-bottom: 8px;
  background: var(--bg-surface-02);
  border: 1px solid var(--border-08);
  border-radius: 8px;
  overflow: hidden;
}

.faq-question {
  padding: 12px 18px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background 0.2s ease;
  user-select: none;

  color: var(--text-global);
}

.faq-question:hover,
.faq-question:focus {
  background: var(--bg-surface-05);
}

.faq-icon {
  color: var(--primary-06);
  transition: transform 0.3s ease;
  font-size: 14px;
  min-width: 14px;
}

.faq-item.expanded .faq-icon {
  transform: rotate(180deg);
}

.faq-item.expanded .faq-question {
  background: var(--bg-surface-05);
}

.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.faq-item.expanded .faq-answer {
  max-height: 2000px;
}

.faq-answer-content {
  padding: 12px 18px 16px 18px;

  line-height: 1.6;
  color: var(--text-global);
}

.faq-answer-content p {
  margin-bottom: 10px;
}

.faq-answer-content p:last-child {
  margin-bottom: 0;
}

.faq-answer-content ul {
  margin: 8px 0;
  padding-left: 20px;
}

.faq-answer-content li {
  margin-bottom: 6px;
}

/* Contact Form Styles */
.contact-form-input,
.contact-form-textarea {
  width: 100%;
  background: var(--bg-surface-05);
  border: 1px solid var(--border-15);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text-global);

  font-family: inherit;
  transition: border-color 0.2s ease;
}

textarea.contact-form-textarea {
  min-height: 80px;
}

.contact-form-input:focus,
.contact-form-textarea:focus {
  outline: none;
  box-shadow: 0 0 0 2px var(--primary-03);
  border-color: transparent;
}

.contact-form-input::placeholder,
.contact-form-textarea::placeholder {
  color: var(--text-disabled);
}

.contact-form-input:-webkit-autofill,
.contact-form-input:-webkit-autofill:hover,
.contact-form-input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text-global);
  -webkit-box-shadow: 0 0 0px 1000px var(--bg-surface-05) inset;
  transition: background-color 5000s ease-in-out 0s;
}

select.contact-form-input {
  padding: 10px 40px 10px 12px;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='1.5'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
  background-position: calc(100% - 12px) center;
  background-repeat: no-repeat;
  background-size: 16px 16px;
  cursor: pointer;
  color: var(--text-disabled);
}

select.contact-form-input:focus,
select.contact-form-input:not([value=""]):valid {
  color: var(--text-global);
}

select.contact-form-input option {
  background: var(--bg-dropdown);
  color: var(--text-global);
}

select.contact-form-input option[disabled] {
  color: var(--text-disabled);
}

.contact-form-textarea {
  resize: vertical;
  min-height: 120px;
}

.case-status.hidden {
  opacity: 0;
  visibility: hidden;
}

.status-wrapper {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.search-clear-btn,
.select-clear-btn {
  cursor: pointer !important;
}

.investigation-tabs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;

  flex-direction: column;
}

.tab-content {
  display: none;
}

.tab-content {
  display: none;
  opacity: 0;
  transition: opacity 0.5s ease;
}

.tab-content.active {
  display: block;
  opacity: 1;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(5px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.tab-content.active {
  animation: fadeIn 0.5s ease-out;
}

.section-header {
  display: none;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 12px;
  margin-bottom: 30px;
  margin-top: 30px;
}

.stats-toggle {
  display: none;
}

.stat-card {
  background: var(--bg-surface-02);
  border: 1px solid var(--border-08);
  border-radius: 8px;
  padding: 10px;
  text-align: center;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
  position: relative;
  min-height: 50px;
  box-shadow:
    0 4px 16px var(--shadow-dark),
    0 1px 4px var(--shadow-light),
    inset 0 1px 0 var(--border-05);
}

.stat-card:hover,
.stat-card:focus {
  transform: translateY(-1px);
  border-color: var(--border-15);
}

.stat-number {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-stat-number);
  display: block;
  margin-bottom: 2px;
}

.stat-label {
  font-size: var(--font-size-11);
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.recent-activity {
  background: var(--bg-surface-02);
  border: 1px solid var(--border-08);
  border-radius: 16px;
  padding: 0;
  overflow: hidden;
  box-shadow:
    0 8px 32px var(--shadow-dark),
    0 2px 8px var(--shadow-light),
    inset 0 1px 0 var(--border-05);
}

.activity-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 20px;
  border-bottom: 1px solid var(--border-10);
  transition: background 0.2s ease;
}

.activity-item:hover,
.activity-item:focus {
  background: var(--bg-surface-05);
}

.activity-content-wrapper {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
  margin-right: 40px;
}

.activity-icon {
  margin-right: 8px;
  flex-shrink: 0;
  transform: translateY(1px);
  stroke: rgba(255, 255, 255, 0.4);
}

/* Update activity-time to match your JS requirements */
.activity-time {
  color: var(--text-dim);
  /* Matches your rgba(255,255,255,0.5) */
  white-space: nowrap;
  flex-shrink: 0;
  font-size: var(--font-size-11);
}

.activity-item:last-child {
  border-bottom: none;
}

.list-item>div:first-child {
  flex: 1;
  min-width: 0;
  margin-right: 40px;
}

.list-item>div:first-child>div span:last-child {
  padding-right: 10px;
}

.activity-time {
  color: var(--text-muted);

  flex-shrink: 0;
  white-space: nowrap;
}

/* Form Styles */
.data-form {
  background: var(--bg-surface-02);
  border: 1px solid var(--border-08);
  border-radius: 16px;
  padding: 25px;
  margin-bottom: 50px;
  box-shadow:
    0 8px 32px var(--shadow-dark),
    0 2px 8px var(--shadow-light),
    inset 0 1px 0 var(--border-05);
}

.data-form h3 {
  margin-bottom: 20px;
  font-size: var(--font-size-18);
  font-weight: 600;
}

.form-row {
  display: grid;
  gap: 20px;
  margin-bottom: 20px;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}


.form-group {
  display: flex;
  flex-direction: column;
}

.form-label {
  font-weight: 400;
  margin-bottom: 8px;
  color: var(--text-dim);
}

.form-input,
.form-textarea,
.form-select {
  background: var(--bg-surface-03);
  border: 1px solid var(--border-10);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text-global);
  font-family: inherit;
  font-size: var(--font-size-global);
  transition: all 0.25s ease;
}

.form-input:-webkit-autofill,
.form-input:-webkit-autofill:hover,
.form-input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0px 1000px var(--bg-surface-03) inset !important;
  -webkit-text-fill-color: var(--text-global) !important;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  box-shadow: 0 0 0 2px var(--primary-03);
  border-color: transparent;
}

.form-input[type="date"]:focus,
.form-input[type="datetime-local"]:focus {
  background: var(--bg-surface-03) !important;
}

.form-input[type="date"]::-webkit-datetime-edit-day-field,
.form-input[type="date"]::-webkit-datetime-edit-month-field,
.form-input[type="date"]::-webkit-datetime-edit-year-field,
.form-input[type="datetime-local"]::-webkit-datetime-edit-day-field,
.form-input[type="datetime-local"]::-webkit-datetime-edit-month-field,
.form-input[type="datetime-local"]::-webkit-datetime-edit-year-field {
  background-color: transparent !important;
  font-size: var(--font-size-global);
}

.rename-modal-input:focus {
  outline: none;
  box-shadow: 0 0 0 2px var(--primary-03);
  border-color: transparent;
}

.form-input:not([type="date"]):not([type="datetime-local"]),
.form-textarea {
  color: var(--text-global);
}

/* Timeline sort and filter dropdowns */
#timelineToggle:focus,
#timelineFilter:focus,
#victimsFilter:focus,
#suspectsFilter:focus,
#evidenceFilter:focus,
#witnessesFilter:focus,
#locationsFilter:focus,
#mediaFilter:focus,
#theoriesFilter:focus {
  outline: none;
  box-shadow: 0 0 0 2px var(--primary-03);
  border-color: transparent;
}

.form-select {
  padding-right: 40px;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='1.5'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
  background-position: calc(100% - 12px) center;
  background-repeat: no-repeat;
  background-size: 16px 16px;
}

.form-select option[disabled] {
  color: var(--text-placeholder);
}

.form-select:focus,
.form-select:not([value=""]):valid,
.form-select option:checked:not([value=""]) {
  color: var(--text-global);
}

.form-input[type="date"],
.form-input[type="datetime-local"] {
  color-scheme: dark;
  background: var(--bg-surface-03);
  position: relative;
  padding: 10px 12px;
  padding-right: 40px;
  color: var(--text-placeholder);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: var(--font-size-global);
  font-weight: normal;
  box-sizing: border-box;
  min-height: unset;
  height: 41px;
  -webkit-text-fill-color: var(--text-placeholder);
}

.form-input[type="date"]::-webkit-calendar-picker-indicator,
.form-input[type="datetime-local"]::-webkit-calendar-picker-indicator {
  background: none;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='1.5'%3e%3crect x='3' y='4' width='18' height='18' rx='2'/%3e%3cline x1='16' y1='2' x2='16' y2='6'/%3e%3cline x1='8' y1='2' x2='8' y2='6'/%3e%3cline x1='3' y1='10' x2='21' y2='10'/%3e%3c/svg%3e");
  cursor: pointer;
  width: 14px;
  height: 14px;
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0.8;
}

.form-select option {
  background: var(--bg-dropdown);
  color: var(--text-global);
  padding: 8px;
}

.form-input::placeholder,
.form-select::placeholder,
.form-textarea::placeholder {
  color: var(--text-placeholder);
}

.form-textarea {
  min-height: 100px;
  resize: vertical;
}

/* Collapsible Form System */
.form-container {
  max-height: 2000px;
  opacity: 1;
  transition:
    max-height 1.3s ease-in-out,
    opacity 1s ease-in-out;
  overflow: hidden;
}

.form-container.collapsed {
  max-height: 0;
  opacity: 0;
  margin-bottom: 0;
}

.form-toggle-btn {
  margin-bottom: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-surface-03);
  border-color: var(--border-15);
}

.form-toggle-btn img {
  width: var(--font-size-11);
  height: var(--font-size-11);
}

.form-toggle-btn:hover,
.form-toggle-btn:focus {
  transform: none;
}

.form-toggle-btn.active {
  background: var(--primary-soft-glow);
  border-color: var(--primary-03);
}

/* Two-column table layout for list items */
.item-table {
  width: calc(100% - 80px);
  border-collapse: separate;
  border-spacing: 0;
  margin-top: 8px;
}

.item-table tr {
  border-bottom: 1px solid var(--border-05);
}

.item-table tr:last-child {
  border-bottom: none;
}

.item-table td {
  padding: 4px 8px;
  vertical-align: top;
}

.item-table td:first-child {
  width: 200px;
  font-size: var(--font-size-11);
  color: var(--text-global);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 400;
  padding-right: 20px;
}

.item-table td:last-child {
  font-size: var(--font-size-11);
  color: var(--text-dim);
  line-height: 1.7;
}

/* Data Lists */
.data-list {
  background: var(--bg-surface-02);
  border: 1px solid var(--border-08);
  border-radius: 16px;
  overflow: hidden;
  box-shadow:
    0 8px 32px var(--shadow-dark),
    0 2px 8px var(--shadow-light),
    inset 0 1px 0 var(--border-05);
}

.list-header {
  background: var(--bg-surface-05);
  padding: 15px 20px;
  font-weight: 600;
  border-bottom: 1px solid var(--border-10);
}

.list-item {
  padding: 15px 70px 15px 20px;
  border-bottom: 1px solid var(--border-10);
  transition: background 0.2s ease;
  position: relative;
  user-select: none;
}

.list-item:has(.collapsible-content[style*="display: block"]):hover {
  background: var(--bg-surface-03);
}

/* Blue arrow when item is expanded */
.list-item .collapse-arrow {
  transition:
    transform 0.2s ease,
    stroke 0.2s ease;
}

.list-item .item-details {
  line-height: 1.7;
  margin-bottom: 10px;
  max-width: 100%;
  word-wrap: break-word;
}

.list-item .item-details:last-child {
  margin-bottom: 0;
}

/* Make field labels stand out */
.list-item .item-details strong,
.list-item .item-details b {
  color: var(--text-global);
  font-weight: 600;
}

.list-item:last-child {
  border-bottom: none;
}

.item-title {
  font-weight: 600;
  margin-bottom: 5px;
  color: var(--text-global);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.item-details {
  color: var(--text-global);
}

.item-meta {
  color: var(--text-dim);

  padding: 12px 8px;
  border-top: 1px solid var(--border-05) !important;
  font-size: var(--font-size-11);
}

/* Status labels stand out */
.list-item div[style*="text-transform: uppercase"]:first-of-type {
  color: var(--primary-08) !important;
  font-weight: 600 !important;
  margin-bottom: 8px !important;
}

/* Timeline Styles - Merged and Updated */
.timeline-container {
  position: relative;
  padding-left: 40px;
  padding-right: 20px;
}

.timeline-line {
  position: absolute;
  left: 20px;
  top: 8px;
  bottom: 0;
  width: 2px;
  background: var(--primary-06);
}

.timeline-item {
  position: relative;
  margin-bottom: 30px;
  padding-left: 20px;
  padding-right: 110px;
  transition: background 0.2s ease;
  cursor: pointer;
}

.timeline-item:hover {
  background: var(--bg-surface-03);
}

.timeline-dot {
  position: absolute;
  left: -24px;
  top: 3px;
  width: 10px;
  height: 10px;
  background: var(--primary-main);
  border-radius: 50%;
  border: 3px solid var(--border-20);
  box-shadow: 0 0 0 4px var(--primary-02);
}

.timeline-time {
  font-weight: 600;
  color: var(--primary-08);
  margin-bottom: 5.5px;
  font-size: var(--font-size-11);
}

.timeline-type {
  color: var(--text-global);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: var(--font-size-11);
}

.timeline-title {
  font-weight: 500;
  color: var(--text-global);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  position: relative;
}

.timeline-text {
  display: block;
  word-wrap: break-word;
  max-width: 100%;
  font-size: var(--font-size-14);
}

.timeline-actions {
  position: absolute;
  right: -120px;
  top: 0;
  display: flex;
  align-items: center;
  gap: 2px;
}

.timeline-description {
  color: var(--text-dim);
  line-height: 1.5;
  font-size: var(--font-size-11);
}

.event-actions {
  display: flex;
  gap: 4px;
}

/* Header Utilities */
.order-icon {
  font-size: var(--font-size-11);
  margin-right: 4px;
}

/* Status badges */
.status-badge {
  display: inline-block;
  padding: 0;
  border-radius: 0;

  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border: none !important;
  background: transparent !important;
}

.status-active:before {
  content: "● ";
  color: var(--primary-04);
  margin-right: 4px;
}

.status-active {
  color: var(--text-muted);
}

.status-pending:before {
  content: "● ";
  color: var(--gold-text);
  margin-right: 4px;
}

.status-pending {
  color: var(--text-muted);
}

.status-closed:before {
  content: "● ";
  color: var(--danger-light);
  margin-right: 4px;
}

.status-closed {
  color: var(--text-muted);
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--primary-07);
  font-style: normal;
  font-size: var(--font-size-14);
  font-weight: 400;
}

/* Modal Styles */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg-overlay);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  width: 100%;
  height: 100%;
  display: none;
}

.modal-overlay.show {
  display: flex !important;
}

.modal-content {
  background: linear-gradient(135deg,
      var(--bg-modal-gradient-start),
      var(--bg-modal-gradient-end));
  border: 1px solid var(--border-15);
  border-radius: 16px;
  padding: 30px;
  max-width: 90%;
  width: auto;
  max-height: 85vh;
  overflow-y: auto;
  color: var(--text-global);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow:
    0 8px 32px var(--shadow-modal),
    0 2px 8px var(--shadow-modal-light),
    inset 0 1px 0 var(--border-10);
}

.modal-header {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 20px;
  text-align: center;
  color: var(--text-global);
}

.modal-buttons {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 20px;
}

/* Hidden file input */
.hidden-file-input {
  display: none;
}

/* Notification */
.notification {
  width: auto;
  max-width: calc(100% - 30px);
  border-radius: 8px;
  padding: 7px 16px;
  min-height: 40px;
  font-weight: 400;
  transition:
    opacity 0.3s ease,
    visibility 0.3s ease;
  display: flex;
  align-items: center;
  opacity: 0;
  visibility: hidden;
  z-index: 100000;
  background: var(--success-bg);
  color: var(--text-global);
}

.connection-banner {
  position: static;
  top: 0;
  left: 0;
  right: 0;
  z-index: 8000;
  padding: 12px 20px;
  display: none;
  align-items: center;
  justify-content: center;
  gap: 15px;
  box-shadow: 0 4px 12px var(--shadow-modal);
}

.connection-banner-icon {
  font-size: 18px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  transform: translateY(-2px);
}

.connection-banner-text {
  font-weight: 400;

  display: flex;
  align-items: center;
  gap: 8px;
}

.connection-banner-button {
  border: 1px solid var(--warning-main);
  border-radius: 6px;
  padding: 6px 16px;
  color: var(--text-global);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

/* Connection Warning Banner */

.connection-warning {
  background: var(--warning-bg);
  border-bottom: 2px solid var(--warning-main);
}

.connection-warning.show,
.connection-success.show {
  display: flex !important;
}

.connection-warning .connection-banner-text {
  color: var(--warning-text);
}

.connection-warning .connection-banner-button {
  background: var(--warning-bg);
}

.connection-warning .connection-banner-button:hover,
.connection-warning .connection-banner-button:focus {
  background: var(--warning-glow);
  transform: translateY(-1px);
}

.connection-success {
  background: var(--success-soft);
  border-bottom: 2px solid var(--success-main);
  color: var(--success-text);
}

/* 
.connection-success.show {
  display: flex;
} */

.connection-success .connection-banner-text {
  color: var(--success-text);
}

.notification.show {
  opacity: 1;
  visibility: visible;
}

.notification.error {
  background: var(--danger-bg);
  border-color: var(--primary-05);
}

.notification.warning {
  background: var(--warning-bg);
  border-color: var(--warning-glow);
}

.notification.info {
  background: var(--primary-03);
  border-color: var(--primary-05);
}

.form-success {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--primary-soft-glow);
  border: 2px solid var(--primary-03);
  border-radius: 50%;
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  z-index: 100;
}

@keyframes successPulse {
  0% {
    transform: translate(-50%, -50%) scale(0.8);
    opacity: 0;
  }

  40% {
    transform: translate(-50%, -50%) scale(1.1);
    opacity: 1;
  }

  60% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }

  100% {
    transform: translate(-50%, -50%) scale(0.9);
    opacity: 0;
  }
}

.form-success.show {
  animation: successPulse 1s ease;
}

#syncInfoBtn {
  position: absolute;
  top: 20px;
  right: 20px;
}

@media (max-width: 900px) {
  #syncInfoBtn {
    position: static;
  }
}

/* Update base icon to handle alignment previously in style tag */
.connection-warning .connection-banner-icon {
  display: inline-flex;
  align-items: center;
  font-size: 18px;
  line-height: 1;
  transform: translateY(-2px);
}

/* Specific styling for Danger/Payment Failed Banner */
.connection-danger {
  background: var(--danger-soft) !important;
  border-bottom-color: var(--danger-main) !important;
}

.connection-danger .connection-banner-button {
  background: var(--danger-bg);
  border-color: var(--danger-main);
}

.connection-danger .connection-banner-button:hover,
.connection-danger .connection-banner-button:focus {
  background: var(--danger-main);
  border-color: var(--text-global);
}

/* Modal text utility to replace inline paragraph styles */
.modal-text-center {
  margin-bottom: 20px;
  color: var(--text-global);
  text-align: center;
  line-height: 1.5;
}

.modal-text-center strong {
  color: var(--text-global);
}

/* Reusable Danger Button class for modals/forms */
.button-danger {
  background: var(--danger-soft) !important;
  border: 1px solid var(--danger-main) !important;
  color: var(--text-global) !important;
}

.button-danger:hover,
.button-danger:focus {
  background: var(--danger-bg) !important;
  border-color: var(--danger-main) !important;
  color: var(--text-global) !important;
}

/* App header */

.logo-container {
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
}

.logo-icon {
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-icon img {
  object-fit: contain;
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 2px var(--danger-main) solid;
}

.logo-text-wrapper {
  transform: translateY(0);
}

.logo-title {
  font-size: 28px;
  font-weight: 700;
  margin: 0;
  color: var(--primary-main);
  line-height: 1;
}

.logo-subtitle {
  color: var(--text-muted);
  font-weight: 300;
  margin: 3px 0 0 1px;
  font-size: 14px;
}

/* Header Actions Container */
.header-actions {
  position: relative;
  display: flex;
  align-items: center;
  gap: 15px;
}

.header-actions .btn {
  letter-spacing: 0.5px;
}

.premium-container {
  position: relative;
}

/* Subscription Dropdown */
.subscription-dropdown {
  display: none;
  /* Toggle with JS */
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: rgba(20, 20, 20, 0.98);
  border: 1px solid var(--border-15);
  border-radius: 12px;
  min-width: 220px;
  box-shadow: 0 8px 32px var(--shadow-modal);
  z-index: 10000;
  overflow: hidden;
}

.dropdown-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-10);
}

.dropdown-section-label {
  font-size: var(--font-size-11);
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.dropdown-plan-name {
  color: var(--text-global);
  font-weight: 600;
}

.dropdown-body {
  padding: 15px;
}

.dropdown-button {
  width: 100%;
  padding: 12px 16px;
  background: none;
  border: none;
  color: var(--text-global);
  text-align: left;
  cursor: pointer;

  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 10px;
}

.dropdown-button:hover:not(:disabled),
.dropdown-button:focus:not(:disabled) {
  background: var(--bg-surface-05);
  color: var(--text-global);
}

.dropdown-button:disabled {
  color: var(--text-disabled);
  cursor: not-allowed;
  opacity: 0.6;
}

/* Helper for JS toggling */
.subscription-dropdown.show {
  display: block;
}

/* Ensure the Case Control Delete Button uses the Danger variables */

#deleteCaseBtn.button-danger {
  background: var(--danger-soft);
  border: 1px solid var(--danger-main);
}

#deleteCaseBtn.button-danger:hover,
#deleteCaseBtn.button-danger:focus {
  background: var(--danger-bg) !important;
  border-color: var(--danger-main) !important;
}

/* Premium Tools Container - Controlled by JS (display: block/none) */
.premium-tools-container {
  position: relative;
  display: none;
}

/* Premium Tools Dropdown - Reusing logic from subscription dropdown */
.premium-dropdown {
  display: none;
  /* Toggle with JS class .show */
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: rgba(20, 20, 20, 0.98);
  border: 1px solid var(--border-15);
  border-radius: 12px;
  min-width: 250px;
  box-shadow: 0 8px 32px var(--shadow-modal);
  z-index: 10000;
  overflow: hidden;
}

/* Helper for JS toggling */
.premium-dropdown.show {
  display: block;
}

/* Divider for section separation */
.dropdown-section-label.divider-top {
  border-top: 1px solid var(--border-05);
  margin-top: 4px;
  padding-top: 12px;
}

.modal-close-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  z-index: 10;
}

.modal-close-btn:hover,
.modal-close-btn:focus {
  transform: scale(1.1);
  color: var(--text-global);
}

.upgrade-modal-body {
  text-align: center;
  padding: 20px 16px;
}

.upgrade-modal-title {
  font-size: 20px;
  margin-bottom: 10px;
  color: var(--text-global);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.upgrade-star {
  font-size: 24px;
}

/* Feature Card Styling */
.premium-features-card {
  background: var(--bg-surface-05);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 24px;
  text-align: left;
}

.features-title {
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text-global);
}

.features-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--text-global);
}

/* Actions Styling */
.modal-actions-centered {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 28px;
  flex-wrap: wrap;
}

.restore-link-wrapper {
  text-align: center;
  margin-top: 16px;
}

.restore-link {
  color: var(--primary-04);

  text-decoration: none;
  cursor: pointer;
  transition: color 0.2s ease;
}

.restore-link:hover,
.restore-link:focus {
  color: var(--primary-main);
  text-decoration: underline;
}

.gold-text-highlight {
  color: var(---gold-text-highlight);
}

.info-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.info-table tr td {
  border-bottom: 0.0625rem solid var(--border-10);
}

.info-table tr:last-child td {
  border-bottom: none;
}

.info-label {
  padding: var(--font-size-11) 1rem var(--font-size-11) 0;
  width: 160px;
  color: var(--primary-09);
  font-size: var(--font-size-11);
  font-weight: 600;
  vertical-align: top;
}

.info-text {
  padding: var(--font-size-11) 0;
  color: rgba(255, 255, 255, 0.85);
  font-size: var(--font-size-11);
  line-height: 1.6;
  vertical-align: top;
}

/* Mobile adjustments for the table */
@media (max-width: 900px) {

  .info-table tr,
  .info-table td {
    display: block;
    width: 100%;
  }

  .info-label {
    padding-bottom: 0;
    width: 100%;
  }

  .info-text {
    padding-top: 0.25rem;
  }
}

.info-label.label-sm {
  width: 7.5rem;
  /* 120px */
}

.code-inline {
  background: var(--bg-surface-10);
  padding: 0.125rem 0.375rem;
  border-radius: 8px;
  display: block;
  font-family: monospace;
  font-size: var(--font-size-11);
  color: var(--text-global);
}

.mb-xs {
  margin-bottom: 0.5rem;
}

.text-muted {
  color: var(--text-muted);
}

.info-note {
  margin-top: 0.5rem;
  font-size: var(--font-size-11);
}

.vertical-divider {
  width: 1px;
  height: 20px;
  background-color: var(--bg-surface-20);
  margin: 0 10px;
}

/* AI Synthesis Modal Specifics */
.ai-modal-content {
  max-width: 43.75rem;
  /* 700px */
  max-height: 85vh;
  overflow-y: auto;
  position: relative;
}

.ai-results-wrapper {
  display: none;
  margin-top: 1.5625rem;
  /* 25px */
}

.ai-results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.9375rem;
  /* 15px */
}

.ai-results-title {
  color: var(--primary-main);
  font-size: 1.125rem;
  /* 18px */
  margin: 0;
}

.ai-error-box {
  display: none;
  padding: var(--font-size-11);
  background: var(--danger-soft);
  border: 0.0625rem solid var(--danger-main);
  border-radius: 0.375rem;
  color: var(--text-global);
  margin-bottom: 0.9375rem;
}

.ai-cost-box {
  background: var(--primary-02);
  border: 0.0625rem solid var(--primary-03);
  border-radius: 0.375rem;
  padding: 0.625rem 0.9375rem;
  margin-bottom: 0.9375rem;
  font-size: var(--font-size-11);
  /* 13px */
  color: var(--text-global);
}

.ai-content-box {
  background: var(--bg-surface-03);
  border: 0.0625rem solid var(--border-10);
  border-radius: 0.5rem;
  padding: 1.25rem;
  color: var(--text-global);
  line-height: 1.7;
  white-space: pre-wrap;
  max-height: 25rem;
  /* 400px */
  overflow-y: auto;
}

/* Utility / Small Components */
.w-full {
  width: 100%;
}

.mb-md {
  margin-bottom: 1.25rem;
}

.mt-lg {
  margin-top: 1.875rem;
}

.input-hint {
  margin-top: 0.5rem;
  font-size: var(--font-size-11);
  color: var(--text-muted);
}

.accent-link {
  color: var(--primary-main);
  text-decoration: underline;
}

/* Layout Utilities */

.mb-md {
  margin-bottom: 1.25rem;
}

.p-0 {
  padding: 0;
}

/* Case Guidelines (Overview) */
.case-guidelines {
  display: none;
  background: var(--bg-surface-03);
  border: 0.0625rem solid var(--border-10);
  border-radius: var(--font-size-11);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}

.guidelines-content {
  font-size: var(--font-size-11);
  /* 13px */
  color: var(--text-global);
  line-height: 1.8;
  white-space: pre-wrap;
}

/* Footer Dividers */
.footer-divider {
  color: var(--text-placeholder);
  margin: 0 5px;
}

/* Form Headers & Actions */
.form-section-title {
  margin-bottom: 1.25rem;
  color: var(--text-global);
  font-size: 1.125rem;
  /* 18px */
  font-weight: 600;
}

.form-actions {
  display: flex;
  gap: var(--font-size-11);
  margin-top: 0.625rem;
}

/* Select with Clear Button Container */
.select-with-clear {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.select-with-clear .form-select {
  flex: 1;
}

/* List Filters */
.list-header-flex {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.filter-group {
  display: flex;
  align-items: center;
}

.filter-label {
  color: var(--text-dim);
  font-size: var(--font-size-11);
  margin: 0 5px;
}

.filter-select {
  min-height: 30px;
  background: var(--bg-surface-05);
  border: 0.0625rem solid var(--border-15);
  border-radius: 0.375rem;
  padding: 4px 30px 4px 12px;
  color: var(--text-global);
  font-size: var(--font-size-11);
  width: 8.75rem;
  /* 140px */
  appearance: none;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='1.5'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
  background-position: calc(100% - 0.375rem) center;
  background-repeat: no-repeat;
  background-size: var(--font-size-11) var(--font-size-11);
}

.filter-select option {
  background: var(--bg-dropdown);
  color: var(--text-global);
}

.help-icon {
  background: transparent;
  border: 0.0625rem solid var(--text-pure);
  border-radius: 50%;
  width: 0.875rem;
  height: 0.875rem;
  color: var(--text-global);
  cursor: pointer;
  padding: 0;
  margin-left: 0.375rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  top: -0.0625rem;
  font-weight: bold;
  transition: all 0.2s ease;
}

.help-icon:hover,
.help-icon:focus {
  border-color: var(--primary-main);
  color: var(--primary-main);
}

/* Vertical spacing utilities */
.mv-md {
  margin-top: 1.25rem;
  /* 20px */
  margin-bottom: 1.25rem;
}

.mb-md {
  margin-bottom: 1.25rem;
}

.modal-text-center {
  margin-bottom: 1.25rem;
  color: var(--text-global);
  text-align: center;
}

.guide-modal-description {
  color: var(--text-muted);
  margin-bottom: 1.75rem;
  /* 28px */
  font-size: 0.875rem;
  /* 14px */
}

/* Template Grid Layout */
.template-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  /* 20px */
  max-width: 56.25rem;
  margin: 0 auto;
}

/* Responsive Grid */
@media (max-width: 1024px) {
  .template-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 900px) {
  .template-grid {
    grid-template-columns: 1fr;
  }

  .guide-modal-content {
    padding: 1.5rem;
  }
}

/* Password Overlay System */
.password-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-body);
  z-index: 999999;
  display: none;
  /* Controlled by JS */
  align-items: center;
  justify-content: center;
}

.password-modal {
  background: #1a1a1a;
  border: 0.125rem solid var(--primary-main);
  border-radius: var(--font-size-11);
  padding: 2.5rem;
  max-width: 25rem;
  width: 90%;
  box-shadow: 0 0.5rem 2rem var(--primary-soft);
}

.password-header {
  text-align: center;
  margin-bottom: 1.875rem;
}

.password-logo {
  margin-bottom: 1.25rem;
}

.password-title {
  color: var(--primary-main);
  margin-bottom: 0.625rem;
  font-size: 1.5rem;
  /* 24px */
  font-weight: 700;
}

.password-subtitle {
  color: var(--text-muted);
  font-size: 0.875rem;
  /* 14px */
}

.password-input {
  width: 100%;
  margin-bottom: 1.25rem;
  font-size: 1rem;
  background: var(--bg-body) !important;
  border-color: #333;
}

/* Solid Variant for Accent Button */
.btn-accent-solid {
  background: var(--primary-main);
  color: #000;
  font-weight: 600;
  width: 100%;
  padding: var(--font-size-11);
  font-size: 1rem;
}

.btn-accent-solid:hover,
.btn-accent-solid:focus {
  background: #00b8e6;
  transform: translateY(-0.0625rem);
}

.password-error {
  color: #ff4444;
  margin-top: 0.9375rem;
  text-align: center;
  display: none;
  font-size: 0.875rem;
}

/* Collapsible List Item Styling */
.list-item.collapsible-item {
  padding: 0;
  position: relative;
}

.collapsible-header {
  padding: 12px 90px 12px 20px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  margin: 0 !important;
  transition: all 0.25s ease;
}

.collapsible-header:hover {
  background-color: var(--bg-surface-10);
}

.collapse-icon {
  width: 1rem;
  height: 1rem;
  transition: transform 0.2s ease;
}

.item-title-name {
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: var(--font-size-11);
}

.item-title-status {
  color: var(--text-dim);
  font-size: var(--font-size-11);
}

.collapsible-content {
  display: none;
  /* Toggled by JS */
  margin-top: var(--font-size-11);
  /* 12px */
  margin-left: 1.5rem;
  /* 24px */
  padding-right: 50px;
}

/* Action Buttons Positioning */
.item-actions {
  position: absolute;
  right: 20px;
  top: 6px;
  display: flex;
  gap: 5px;
}

/* Active State for JS */
.collapsible-item.active .collapse-icon {
  transform: rotate(90deg);
}

.collapsible-item.active .collapsible-content {
  display: block;
}

/* Scrollbar */
/* Universal Scrollbar for Dark Theme App using variables */
* {
  scrollbar-color: var(--bg-surface-20) var(--bg-surface-05);
  /* Firefox: thumb | track */
}

/* WebKit Browsers (Chrome, Edge, Safari) */
*::-webkit-scrollbar {
  width: 8px;
  height: 8px;
  /* horizontal scrollbar height */
}

*::-webkit-scrollbar-track {
  background: var(--bg-surface-05);
  /* track uses your surface color */
  border-radius: 4px;
}

*::-webkit-scrollbar-thumb {
  background-color: var(--shadow-glow);
  border-radius: 4px;
  border: 1px solid var(--bg-surface-05);
  /* padding effect around thumb */
  transition:
    background-color 0.2s ease,
    transform 0.2s ease;
}

*::-webkit-scrollbar-thumb:hover {
  background-color: var(--primary-08);
  /* slightly lighter variant of accent-main */
  transform: scaleX(1.1);
  /* subtle hover scaling for interaction feel */
}

/* Optional: smooth scrolling for all elements */
* {
  scroll-behavior: smooth;
}

/* Icons */
.feather-icon {
  min-width: 16px;
  width: 16px;
  height: 16px;
}

.mobile-only {
  display: none !important;
}

/* Responsive */
@media screen and (min-width: 901px) {
  .desktop-only {
    display: flex !important;
  }

  .header-container {
    min-width: 245px;
    max-width: 245px;
  }

  .header-actions {
    width: 100%;
    padding-left: 16px;
  }

  .case-status {
    margin-left: auto;
  }

  .modal-content {
    min-width: 400px;
  }
}

/* Update Mobile Logic (Inside your @media (max-width: 900px) block) */
@media screen and (max-width: 900px) {
  .desktop-only {
    display: none !important;
  }

  .mobile-only {
    display: flex !important;
  }

  .app-header {
    padding: 8px 16px;
  }

  .main-content {
    padding: 20px 16px;
  }

  .case-status {
    max-width: calc(100% - 40px);
    width: 100%;
    text-align: right;
  }

  .header-actions {
    gap: 5px;
    justify-content: flex-end;
  }

  .header-actions .btn {
    letter-spacing: normal;
    padding: 7px;
    margin-right: 5px;
  }

  .case-icon-button {
    flex: 0 0 auto;
    padding: 7px 12px;
  }

  .collapsible-header {
    padding: 12px 71px 12px 7px;
  }

  .item-actions {
    right: 0;
  }

  .collapsible-content {
    margin-left: 0;
    padding: 0 16px;
  }

  .stats-grid {
    grid-template-columns: repeat(4, 1fr) !important;
    display: none !important;
  }

  .stats-toggle {
    display: block !important;
    width: auto;
    max-width: 150px;
    margin: 25px auto 15px auto;
    padding: 6px 12px;
    background: var(--bg-surface-03);
    border: 1px solid var(--border-10);
    border-radius: 6px;
    color: var(--text-muted);
    cursor: pointer;

    text-align: center;
    transition: all 0.2s ease;
  }

  .stats-grid.visible {
    display: grid !important;
  }

  /* Remove title bottom margin to match desktop height */
  .item-title {
    margin-bottom: 0 !important;
  }

  .item-table {
    width: 100% !important;
  }

  /* Stack table vertically */
  .item-table,
  .item-table tbody,
  .item-table tr,
  .item-table td {
    display: block !important;
    width: 100% !important;
  }

  .item-table td {
    padding: 0 !important;
  }

  .item-table td:first-child {
    font-weight: 600;
    font-size: var(--font-size-11);
    color: var(--text-muted);
    width: 100% !important;
    margin-bottom: 4px;
    padding-top: 12px !important;
  }

  .item-table td:last-child {
    color: var(--text-global);
    width: 100% !important;
    padding-bottom: 12px !important;
    line-height: 1.7 !important;
  }

  .item-table tr {
    border-bottom: 1px solid var(--border-05);
    padding: 0;
  }

  .item-table tr:last-child {
    border-bottom: none;
  }

  /* Keep buttons on title row at right */
  .list-item>div[style*="position: absolute"] {
    position: absolute !important;
    top: 15px !important;
    right: 15px !important;
    transform: none !important;
  }

  /* Ensure the content still occupies the full available height on mobile */
  .app-body-content {
    height: 100%;
  }
}

/* Stack list headers on small screens */
@media (max-width: 540px) {
  .list-header {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 8px !important;
  }

  .list-header>div {
    width: 100%;
  }
}

/* --- MOBILE DRAWER SYSTEM --- */

.mobile-only-btn {
  display: none;
  min-height: unset;
}

.drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--inner-layout-borders);
}

.mobile-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: var(--bg-overlay);
  z-index: 9000;
  display: none;
  backdrop-filter: blur(1px);
}

@media screen and (max-width: 900px) {
  .mobile-only-btn {
    display: flex;
  }

  .logo-text-wrapper {
    display: none;
  }

  .header-container {
    display: flex;
    justify-content: flex-start;
    gap: 8px;
    margin-right: auto;
  }

  .mobile-toggle-group {
    display: flex;
    gap: 8px;
    margin-left: 7px;
  }

  #caseStatus .btn,
  #premiumBadge.btn {
    min-height: unset;
    padding: 5px 12px;
  }

  /* Sidebar Drawer (Left) */
  .app-body-sidebar {
    position: fixed;
    left: -100%;
    /* Hidden */
    top: 0;
    height: 100vh;
    width: 280px;
    z-index: 9001;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
    border: 1px var(--inner-layout-borders) solid;
  }

  .app-body-sidebar.open {
    left: 0;
    padding: 20px;
    height: 100%;
    max-height: 100%;
  }

  /* Case Controls Drawer (Right) */
  .case-controls {
    position: fixed;
    left: -100%;
    right: auto;
    top: 0;
    height: 100vh;
    width: 300px;
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: stretch;
    background: var(--bg-sidebar);
    z-index: 9001;
    padding: 20px;
    margin-bottom: 0;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.5);
    overflow-y: auto;
  }

  .case-controls.open {
    left: 0;
    height: 100%;
    max-height: 100%;
  }

  /* Adjust vertical stacking in drawer */
  .case-controls>* {
    width: 100%;
    margin-bottom: 10px;
  }

  #premiumToolsBtn,
  .premium-dropdown {
    width: 100%;
  }

  .search-container {
    margin-right: 0;
    margin-bottom: 20px;
  }

  .search-wrapper {
    max-width: 100%;
  }

  .vertical-divider {
    display: none;
  }

  .modal-content {
    padding: 15px;
    width: 100%;
    max-width: 90% !important;
  }

  .notification {
    position: fixed;
    left: 50%;
    transform: translate(-50%);
    bottom: 20px;
    width: 100% !important;
    box-shadow: 0 0 100px 100px var(--bg-body);
  }

  .item-actions {
    margin-right: 3px;
  }

  .case-controls.open,
  .app-body-sidebar.open {
    padding: 10px 20px;
  }

  .case-selector {
    margin: 0 0 20px;
  }
}

@media screen and (max-width: 520px) {
  .header-actions {
    flex-wrap: wrap;
  }
}

.landing-container .logo-text-wrapper {
  display: block !important;
}