/* ================================================================
   MATTER DASHBOARD — 3-column layout
   Clean card styling with the notepad as the one unique element.
   Loaded AFTER clients.css.
================================================================ */

/* ── Surface ─────────────────────────────────────────────── */
.desk-surface {
  padding: 0.5rem 0;
}

/* ── 3-Column Grid ───────────────────────────────────────── */
.desk-columns {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.75rem;
  align-items: start;
}
.desk-col {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* ── Section Labels ──────────────────────────────────────── */
.desk-section-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gold);
  margin-bottom: 0.5rem;
  user-select: none;
}

/* ── Case Brief (Left) ──────────────────────────────────── */
.desk-brief {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  max-height: 70vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.desk-brief-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 0.85rem 0;
}
.desk-brief-header .desk-section-label { margin-bottom: 0; }
.desk-brief-body {
  padding: 0.6rem 0.85rem 0.85rem;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(0,0,0,0.1) transparent;
}
.desk-brief-body::-webkit-scrollbar { width: 4px; }
.desk-brief-body::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.1); border-radius: 2px; }

/* ── Proceedings ─────────────────────────────────────────── */
.desk-proceedings {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 0.6rem 0.85rem;
  max-height: 30vh;
  overflow-y: auto;
  scrollbar-width: thin;
}

/* ── Active Work (Center) ────────────────────────────────── */
.desk-work {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 0.6rem 0.85rem;
  max-height: 70vh;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(0,0,0,0.1) transparent;
}
.desk-work::-webkit-scrollbar { width: 4px; }
.desk-work::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.1); border-radius: 2px; }

/* ── File Cabinet (Right) ────────────────────────────────── */
.desk-cabinet {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  max-height: 50vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.desk-cabinet-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 0.85rem 0;
}
.desk-cabinet-actions {
  display: flex;
  gap: 0.1rem;
}
.desk-cabinet-body {
  padding: 0.4rem 0.85rem 0.75rem;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  scrollbar-width: thin;
}
.desk-cabinet-body::-webkit-scrollbar { width: 4px; }
.desk-cabinet-body::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.1); border-radius: 2px; }

/* ── Notepad (Legal Pad) ─────────────────────────────────── */
.desk-notepad {
  background:
    /* red margin line */
    linear-gradient(
      90deg,
      transparent 2.25rem,
      #E57373 2.25rem,
      #E57373 2.375rem,
      transparent 2.375rem
    ),
    /* horizontal ruling */
    repeating-linear-gradient(
      to bottom,
      transparent,
      transparent 1.45rem,
      #C8D4C0 1.45rem,
      #C8D4C0 1.5rem
    ),
    /* yellow pad base */
    #FFF9C4;
  border-radius: 2px;
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.1),
    inset 0 -1px 0 rgba(0, 0, 0, 0.04);
  padding: 0.75rem 0.75rem 0.75rem 2.625rem;
  min-height: 8rem;
  position: relative;
}
/* top binding strip */
.desk-notepad::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 6px;
  background: repeating-linear-gradient(
    90deg,
    #C9A84C 0px,
    #C9A84C 4px,
    #E8D9A8 4px,
    #E8D9A8 8px
  );
  border-radius: 2px 2px 0 0;
}
.desk-notepad textarea {
  width: 100%;
  min-height: 6rem;
  border: none;
  background: transparent;
  font-family: var(--font-serif);
  font-size: 0.875rem;
  line-height: 1.5rem;
  color: #3B3B2E;
  resize: vertical;
  outline: none;
  padding: 0;
}
.desk-notepad textarea::placeholder {
  color: #B5A97A;
  font-style: italic;
}

/* ── Timeline Strip ──────────────────────────────────────── */
.desk-timeline {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 0.5rem 0.85rem;
  margin-bottom: 0.75rem;
  overflow: visible;
}

/* ── Horizontal Timeline ─────────────────────────────────── */
.ht-wrap {
  overflow-x: auto;
  padding: 0.25rem 0 0.5rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(0,0,0,0.1) transparent;
}
.ht-wrap::-webkit-scrollbar { height: 4px; }
.ht-wrap::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.1); border-radius: 2px; }

.ht-events {
  position: relative;
  height: 7rem;
  min-width: 100%;
}

/* The horizontal connector line — centered */
.ht-line {
  position: absolute;
  left: 0;
  right: 0;
  top: 3.25rem;
  height: 2px;
  background: var(--gold);
  opacity: 0.3;
  z-index: 0;
}

/* Each event: label-top + dot + label-bottom stacked */
.ht-event {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 8rem;
  margin-left: -4rem; /* center on left position */
  z-index: 1;
  cursor: default;
}
/* Even events: label above the line */
.ht-event.ht-above {
  top: 0;
}
/* Odd events: label below the line */
.ht-event.ht-below {
  top: 3.25rem;
  flex-direction: column-reverse;
}
.ht-below .ht-label-top { margin-bottom: 0; margin-top: 0.25rem; }
.ht-below .ht-label-bottom { margin-top: 0; margin-bottom: 0.25rem; }
.ht-event:hover .ht-dot {
  transform: scale(1.4);
  box-shadow: 0 0 0 3px rgba(201, 168, 76, 0.2);
}
.ht-event:hover .ht-label-top {
  white-space: normal;
  overflow: visible;
  max-height: none;
}

.ht-label-top {
  font-size: 0.65rem;
  color: var(--ink);
  line-height: 1.25;
  text-align: center;
  max-height: 2rem;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  margin-bottom: 0.25rem;
}

.ht-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--gold);
  border: 2px solid var(--white);
  box-shadow: 0 0 0 1px var(--gold);
  flex-shrink: 0;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  z-index: 2;
}
.ht-dot-current {
  background: var(--white);
  box-shadow: 0 0 0 2px var(--gold);
  width: 12px;
  height: 12px;
}

.ht-label-bottom {
  font-size: 0.58rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-top: 0.25rem;
  white-space: nowrap;
}

/* Month axis below the events */
.ht-axis {
  position: relative;
  height: 1rem;
  border-top: 1px solid var(--border);
  margin-top: 0.15rem;
}
.ht-month {
  position: absolute;
  top: 0.2rem;
  font-size: 0.55rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
  transform: translateX(-50%);
}
.ht-month::before {
  content: '';
  position: absolute;
  top: -0.35rem;
  left: 50%;
  width: 1px;
  height: 0.25rem;
  background: var(--border);
}

/* ── Collapsed state ─────────────────────────────────────── */
.collapsed .desk-brief-body,
.collapsed .desk-cabinet-body,
.collapsed #matter-section-obligations,
.collapsed #matter-section-proceedings,
.collapsed #matter-section-notes,
.collapsed #matter-timeline-wrap { display: none !important; }
.collapsed .matter-section-chevron { transform: rotate(-90deg); }

/* ── Chevron ─────────────────────────────────────────────── */
.matter-section-chevron {
  transition: transform 0.2s ease;
  color: var(--muted);
  flex-shrink: 0;
  cursor: pointer;
}

/* ── Hide old tabs ───────────────────────────────────────── */
.matter-tabs { display: none; }
.matter-tab { display: none; }

/* ================================================================
   MOBILE — max-width: 900px
================================================================ */
@media (max-width: 900px) {
  .desk-columns {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }
  .desk-brief,
  .desk-work,
  .desk-cabinet {
    max-height: none;
  }
  .desk-proceedings {
    max-height: none;
  }
  .matter-lex-drawer {
    width: calc(100vw - 2rem);
    right: 1rem;
  }
}
