/*
 * Case Manager app chrome, on top of the NAX design system (nax.css).
 * The cm-* shell comes from the "Case Manager Screens" design doc: dark
 * chrome (topbar + icon rail) around a rounded light panel. The chrome stays
 * dark in both themes; the panel and everything inside it follow the
 * [data-theme] tokens.
 */

.cm-app {
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #0c0e11;
}

.cm-body {
  flex: 1;
  display: flex;
  min-height: 0;
}

/* ── Topbar ─────────────────────────────────────────────────────────────── */
.cm-topbar {
  height: 52px;
  display: flex;
  align-items: center;
  padding: 0 18px;
  gap: 14px;
  flex: none;
  color: #fff;
}

.cm-brand {
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -.01em;
  color: #fff;
  text-decoration: none;
}
.cm-brand:hover { color: #fff; text-decoration: none; }

.cm-topbar-user {
  font-size: .769rem;
  color: rgba(255, 255, 255, .5);
}

.cm-topbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, .55);
  border-radius: 6px;
  cursor: pointer;
}
.cm-topbtn:hover { background: rgba(255, 255, 255, .08); color: #fff; }

/* button_to wraps its button in a form — keep it inline in the topbar */
.cm-topbar form { display: contents; }

/* Theme toggle — swap glyphs by theme */
.cm-topbtn .cm-theme-light-icon { display: none; }
[data-theme="light"] .cm-topbtn .cm-theme-dark-icon  { display: none; }
[data-theme="light"] .cm-topbtn .cm-theme-light-icon { display: block; }

/* ── Icon rail ──────────────────────────────────────────────────────────── */
.cm-rail {
  width: 60px;
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 0 14px;
  gap: 6px;
}

.cm-rail-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, .45);
  border-radius: 10px;
  cursor: pointer;
}
.cm-rail-btn:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.cm-rail-btn.is-active { background: rgba(255, 255, 255, .1); color: #93aefc; }
.cm-rail-btn.is-disabled { opacity: .35; pointer-events: none; }
.cm-rail-spacer { flex: 1; }

/* ── Panel ──────────────────────────────────────────────────────────────── */
.cm-panel {
  flex: 1;
  min-width: 0;
  background: var(--nax-canvas);
  border-radius: 10px;
  margin: 0 12px 12px 0;
  overflow: auto;
  position: relative;
  display: flex;
  flex-direction: column;
}

/* No rail on unauthenticated screens — keep the panel inset symmetric */
.cm-body > .cm-panel:first-child { margin-left: 12px; }

.cm-pghead {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px 26px 16px;
  flex: none;
}

.cm-pgtitle {
  margin: 0;
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -.02em;
  color: var(--nax-ink);
}

.cm-content {
  padding: 0 26px 26px;
  flex: 1;
  min-height: 0;
}

/* White context bar across the top of the panel, carrying the breadcrumbs */
.cm-context-bar {
  background: var(--nax-surface);
  border-bottom: 1px solid var(--nax-ink-10);
  padding: 10px 26px;
  flex: none;
  position: sticky;
  top: 0;
  z-index: 4; /* under the detail pane (z 5) */
}

.cm-context-bar .nax-breadcrumbs { padding: 0; }

.cm-panel .nax-flash { padding: 0 26px; }

/* ── Definition grid (detail pane) ──────────────────────────────────────── */
.cm-dl {
  display: grid;
  grid-template-columns: 120px 1fr;
  row-gap: 10px;
  column-gap: 12px;
  align-items: baseline;
}
.cm-dl dt {
  font-size: .692rem;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--nax-ink-45);
  margin: 0;
}
.cm-dl dd { margin: 0; font-size: .923rem; color: var(--nax-ink); overflow-wrap: anywhere; }

.cm-sec {
  font-size: .692rem;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--nax-ink-45);
}

/* ── Exhibit detail pane (1d) — slides over the register ────────────────── */
turbo-frame { display: contents; }

.cm-detail-pane {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 480px;
  max-width: 90%;
  background: var(--nax-surface);
  border-left: 1px solid var(--nax-ink-10);
  box-shadow: -8px 0 24px rgba(12, 14, 17, .08);
  display: flex;
  flex-direction: column;
  z-index: 5;
}

.cm-detail-pane-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--nax-ink-10);
  flex: none;
}

.cm-detail-pane-body { flex: 1; overflow: auto; }

.cm-detail-pane-foot {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--nax-ink-10);
  flex: none;
}
.cm-detail-pane-foot form { display: contents; }

.cm-preview {
  background: var(--nax-ink-05);
  padding: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.cm-preview img {
  max-width: 250px;
  max-height: 324px;
  border: 1px solid var(--nax-ink-10);
  box-shadow: 0 2px 8px rgba(12, 14, 17, .1);
}

.cm-preview iframe {
  width: 100%;
  height: 360px;
  border: 1px solid var(--nax-ink-10);
  background: #fff;
}

.cm-preview-placeholder {
  width: 250px;
  height: 200px;
  background: var(--nax-surface);
  border: 1px solid var(--nax-ink-10);
  box-shadow: 0 2px 8px rgba(12, 14, 17, .1);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--nax-ink-20);
}

/* ── Custody timeline dots ──────────────────────────────────────────────── */
.cm-custody-item { display: flex; gap: 10px; }
.cm-custody-line {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.cm-custody-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--nax-ink-20);
  flex: none;
  margin-top: 4px;
}
.cm-custody-dot.is-verified { background: var(--nax-green); }
.cm-custody-line span:last-child:not(.cm-custody-dot) { width: 1px; flex: 1; background: var(--nax-ink-10); }
.cm-custody-rule { width: 1px; flex: 1; background: var(--nax-ink-10); }
.cm-custody-body { padding-bottom: 12px; font-size: .769rem; }
.cm-custody-body .title { font-weight: 500; color: var(--nax-ink); }
.cm-custody-body .meta { color: var(--nax-ink-45); }

/* ── Upload drop zone (1c) ──────────────────────────────────────────────── */
.cm-dropzone {
  border: 1.5px dashed var(--nax-ink-20);
  border-radius: 5px;
  background: var(--nax-surface);
  padding: 26px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
  transition: border-color var(--nax-t), background var(--nax-t);
}
.cm-dropzone.is-dragover {
  border-color: var(--nax-accent);
  background: var(--nax-accent-dim);
}

.cm-queue-row {
  display: grid;
  grid-template-columns: 34px 1fr 200px 28px;
  gap: 10px;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--nax-ink-10);
}
.cm-queue-row:last-child { border-bottom: none; }

.cm-queue-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 5px;
  background: var(--nax-ink-05);
  color: var(--nax-ink-45);
}
.cm-queue-meta {
  font-size: .692rem;
  color: var(--nax-ink-45);
  margin-top: 3px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ── Intake inbox rows — click to open the preview drawer ───────────────── */
.cm-intake-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--nax-ink-10);
  color: inherit;
  text-decoration: none;
  transition: background var(--nax-t);
}
.cm-intake-row:hover { background: var(--nax-ink-05); text-decoration: none; color: inherit; }
.cm-intake-row.is-selected { background: var(--nax-accent-dim); }
.cm-intake-row:last-child { border-bottom: none; }

/* ── Intake attachment cards — preview before adding as exhibit ─────────── */
.cm-intake-card {
  width: 260px;
  border: 1px solid var(--nax-ink-10);
  border-radius: 5px;
  background: var(--nax-surface);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.cm-intake-preview {
  height: 170px;
  background: var(--nax-ink-05);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  overflow: hidden;
  border-bottom: 1px solid var(--nax-ink-10);
  padding: 8px;
}

.cm-intake-preview img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.cm-intake-preview iframe {
  width: 100%;
  height: 100%;
  border: none;
  background: #fff;
}

.cm-intake-card-foot {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
}
.cm-intake-card-foot form { display: contents; }

/* In the drawer, give previews real reading height */
.cm-detail-pane .cm-intake-preview {
  height: min(68vh, 760px);
}

/* ── Auth screens ───────────────────────────────────────────────────────── */
.auth-screen {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 360px;
  overflow: hidden;
}
