/* ================================================================
   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;
  transition: padding 0.2s ease;
}
.desk-timeline-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  user-select: none;
}
.timeline-chevron {
  color: var(--muted);
  transition: transform 0.2s ease;
  flex-shrink: 0;
}
.timeline-body {
  transition: max-height 0.25s ease, opacity 0.2s ease;
  overflow: hidden;
}
/* Collapsed: thin strip */
.timeline-collapsed .timeline-body {
  max-height: 0 !important;
  opacity: 0;
  padding: 0;
}
.timeline-collapsed {
  padding: 0.35rem 0.85rem;
}
.timeline-collapsed .timeline-chevron {
  transform: rotate(-90deg);
}

/* ── Horizontal Timeline (evenly spaced) ─────────────────── */
.ht-wrap {
  overflow-x: auto;
  padding: 0.5rem 0;
  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-strip {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: max-content;
  padding: 0 1rem;
}

/* Event node */
.ht-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
  width: 8rem;
  cursor: default;
}
.ht-node:hover .ht-node-dot {
  transform: scale(1.3);
  box-shadow: 0 0 0 4px rgba(201, 168, 76, 0.15);
}
.ht-node:hover .ht-node-desc {
  white-space: normal;
  -webkit-line-clamp: unset;
}

.ht-node-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--gold);
  border: 2px solid var(--white);
  box-shadow: 0 0 0 2px var(--gold);
  flex-shrink: 0;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  margin-bottom: 0.35rem;
}
.ht-dot-current {
  background: var(--white);
  box-shadow: 0 0 0 2px var(--gold), 0 0 0 5px rgba(201, 168, 76, 0.15);
  width: 14px;
  height: 14px;
}

.ht-node-date {
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
  margin-bottom: 0.15rem;
}

.ht-node-desc {
  font-size: 0.65rem;
  color: var(--ink);
  line-height: 1.3;
  text-align: center;
  max-width: 8rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Duration gap between events */
.ht-gap {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  gap: 0;
  min-width: 3rem;
  padding: 0 0.15rem;
  align-self: flex-start;
  margin-top: 0.2rem;
}
.ht-gap-line {
  flex: 1;
  height: 2px;
  background: var(--border);
  min-width: 0.5rem;
}
.ht-gap-label {
  font-size: 0.55rem;
  color: var(--muted);
  white-space: nowrap;
  padding: 0 0.3rem;
  font-weight: 500;
}

/* ── Proceeding Document Strip ────────────────────────────── */
.proc-docs-strip {
  display: flex;
  gap: 0.4rem;
  overflow-x: auto;
  padding: 0.35rem 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(0,0,0,0.1) transparent;
}
.proc-docs-strip::-webkit-scrollbar { height: 3px; }
.proc-docs-strip::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.1); border-radius: 2px; }

.proc-doc-chip {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.6rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-size: 0.68rem;
  color: var(--ink);
  white-space: nowrap;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.proc-doc-chip:hover {
  background: var(--white);
  border-color: var(--gold);
}
.proc-doc-chip svg { flex-shrink: 0; color: var(--muted); }

/* ── Proceeding Quick Actions ────────────────────────────── */
.proc-quick-actions {
  display: flex;
  gap: 0.2rem;
  flex-shrink: 0;
}
.proc-quick-actions .btn { font-size: 0.65rem; padding: 0.2rem 0.4rem; }

/* ── Manila Folder Cards ─────────────────────────────────── */
.proc-folder {
  position: relative;
  background: #FEFDFB;
  border: 1px solid var(--border);
  border-radius: 0 var(--r-md) var(--r-md) var(--r-md);
  padding: 0.85rem 1rem;
  margin-top: 1.4rem;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.proc-folder:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.proc-folder-tab {
  position: absolute;
  top: -1.2rem;
  left: 0;
  background: #F0E6C8;
  border: 1px solid var(--border);
  border-bottom: 1px solid #FEFDFB;
  border-radius: var(--r-md) var(--r-md) 0 0;
  padding: 0.15rem 0.75rem;
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #7A6B4E;
}
.proc-folder.folder-active { border-color: var(--gold); }
.proc-folder.folder-active .proc-folder-tab {
  background: var(--gold);
  color: white;
  border-color: var(--gold);
}
.proc-folder.folder-closed { opacity: 0.6; }
.proc-folder-title {
  font-family: var(--font-serif);
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 0.2rem;
}
.proc-folder-meta {
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.4;
}
.proc-folder-counts {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.4rem;
  font-size: 0.65rem;
  color: var(--mid);
}
.proc-folder-posture {
  font-size: 0.75rem;
  color: var(--gold);
  font-style: italic;
  margin-top: 0.35rem;
}

/* ── 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;
  }
}
