/* ==========================================================================
   Layout — Containers, Grid, Navigation, Responsive
   ========================================================================== */

/* --- Container --- */
.container {
  max-width: 1000px;
  margin: 0 auto;
  padding: var(--space-5);
}

.container-narrow {
  max-width: 900px;
}

/* --- Navigation ---
   The bar being positioned (sticky counts) is what anchors the panel to it.
   Leave it static and the panel resolves against the viewport instead, which
   on a narrow screen makes it span the full width rather than hang under the
   button. That bug was hit while prototyping this. */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--neutral-50);
  color: var(--neutral-900);
  border-bottom: 1px solid var(--neutral-300);
  padding: var(--space-2) var(--space-4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  font-size: var(--text-base);
}

.site-nav-brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
}

.site-nav-mark {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}

/* The artwork carries its own colour and detail, so it sits on the bar itself
   rather than in a tinted tile — a coloured plate behind a coloured leaf reads
   as two marks fighting. */
.site-nav-mark .brand-leaf {
  display: block;
  width: 28px;
  height: 28px;
}

.site-nav-name {
  font-weight: var(--font-bold);
  font-size: var(--text-md);
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.site-nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  margin-left: var(--space-3);
}

.site-nav-links a {
  color: var(--neutral-600);
  text-decoration: none;
  padding: 8px 13px;
  border-radius: var(--radius-sm);
  font-weight: var(--font-semibold);
  transition: background var(--transition-fast), color var(--transition-fast);
}
.site-nav-links a:hover { background: var(--neutral-100); color: var(--neutral-900); text-decoration: none; }
.site-nav-links a.active { background: var(--neutral-100); color: var(--neutral-900); }

.site-nav-right {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.site-nav-user {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.site-nav-email {
  color: var(--neutral-600);
  font-size: var(--text-sm);
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 44px is the minimum comfortable touch target, and this bar is used from
   phones. The old close/logout controls were well under it. */
.site-nav-menu-btn {
  width: 44px;
  height: 44px;
  border: none;
  border-radius: var(--radius-md);
  background: var(--neutral-100);
  color: var(--neutral-900);
  font-size: 17px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-fast);
  font-family: var(--font-family);
}
.site-nav-menu-btn:hover { background: var(--neutral-200); }
.site-nav-menu-btn:focus-visible { outline: 2px solid var(--neutral-900); outline-offset: 2px; }

.site-nav-panel {
  position: absolute;
  top: calc(100% + 6px);
  right: var(--space-4);
  min-width: 232px;
  max-width: calc(100vw - 2 * var(--space-4));
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  padding: var(--space-2);
  z-index: 60;
}

.site-nav-panel a,
.site-nav-panel .site-nav-logout {
  display: block;
  width: 100%;
  text-align: left;
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  color: var(--neutral-900);
  text-decoration: none;
}
.site-nav-panel a:hover,
.site-nav-panel .site-nav-logout:hover { background: var(--neutral-100); text-decoration: none; }

.site-nav-panel-email {
  display: block;
  padding: 9px 13px;
  font-size: var(--text-sm);
  color: var(--neutral-600);
}

.site-nav-sep {
  border: none;
  border-top: 1px solid var(--neutral-200);
  margin: var(--space-2) var(--space-1);
}

.site-nav-panel .site-nav-lang {
  width: 100%;
  border: 1px solid var(--neutral-300);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: var(--text-base);
  font-family: var(--font-family);
  background: #fff;
  color: var(--neutral-900);
}

.site-nav-logout {
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-family);
  transition: background var(--transition-fast);
}

/* --- Main Layout (chat + panel) --- */
.main-layout {
  width: 100%;
  max-width: 960px;
  flex: 1;
  display: flex;
  gap: var(--space-3);
  padding: var(--space-4);
  margin: 0 auto;
}

/* --- Section Headers --- */
.person-section { margin-bottom: var(--space-6); }
.person-header {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  color: var(--neutral-900);
  margin-bottom: var(--space-3);
  padding-bottom: var(--space-2);
  border-bottom: 2px solid var(--neutral-300);
}

/* --- Checklist Item (flex layout) --- */
.checklist-item {
  background: #fff;
  border-radius: var(--radius-md);
  padding: var(--space-4);
  margin-bottom: var(--space-2);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
}

/* --- Case Meta --- */
.case-meta {
  color: var(--neutral-600);
  margin-bottom: var(--space-5);
  font-size: var(--text-sm);
}

/* --- Empty State --- */
.empty-state {
  text-align: center;
  padding: var(--space-12) var(--space-5);
  color: var(--neutral-600);
}

/* --- Download Section --- */
.download-all { margin-bottom: var(--space-5); }

/* --- Responsive --- */
@media (max-width: 700px) {
  .main-layout { flex-direction: column; }
  .doc-panel { width: 100%; max-height: 200px; }
}

/* Below this width the bar keeps the brand and the button; everything else
   lives in the panel. Squeezing five items into 390px is what made "Log Out"
   overflow the bar and "My Cases" wrap onto a second line. */
@media (max-width: 760px) {
  .site-nav-links,
  .site-nav-email { display: none; }
  .site-nav-panel { right: var(--space-3); left: var(--space-3); max-width: none; }
}

@media (max-width: 600px) {
  .site-nav { padding: var(--space-2) var(--space-3); }
  .summary-bar { flex-direction: column; }
  .checklist-item { flex-direction: column; }
  .container { padding: var(--space-4); }
  .drop-zone { padding: var(--space-5) var(--space-3); }
  .drop-zone-actions { flex-direction: column; }
  .unassociated-doc { flex-direction: column; align-items: flex-start; }
  .reassign-select { width: 100%; }
}
