/* Portal and admin dashboard. Layered on top of the public site's site.css,
   so the tokens, buttons, forms and notes all come from there. */

.portal { background: var(--cream); }

/* ------------------------------------------------------------- Draft bar */
.draftbar {
  background: var(--gold-tint); color: #6b4c14; font-size: var(--text-sm);
  padding: 0.7rem clamp(1rem, 4vw, 2.5rem); border-bottom: 1px solid var(--gold);
  text-align: center;
}
.draftbar a { color: #6b4c14; }

/* ----------------------------------------------------------------- Header */
.pbar { background: var(--paper); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 50; }
.pbar-inner {
  width: min(1320px, 100% - 2.5rem); margin-inline: auto;
  display: flex; align-items: center; gap: clamp(1rem, 3vw, 2.5rem);
  min-height: 68px; flex-wrap: wrap;
}
.pmark { display: block; width: 32px; height: 32px; }
.pmark svg { width: 32px; height: 32px; }
.pbar .wordmark { flex: none; }

.pnav { display: flex; gap: 0.25rem; flex: 1; flex-wrap: wrap; }
.pnav a {
  font-size: 0.9375rem; font-weight: 550; color: var(--ink-2); text-decoration: none;
  padding: 0.5rem 0.85rem; border-radius: 999px; white-space: nowrap;
  transition: background-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.pnav a:hover { background: var(--cream-2); color: var(--clay); }
.pnav a[aria-current="page"] { background: var(--ink); color: var(--paper); }

.puser { display: flex; align-items: center; gap: 0.75rem; flex: none; }
.puser-name { font-size: 0.875rem; font-weight: 620; }
.puser-role {
  font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--muted); background: var(--cream-2); padding: 0.2rem 0.55rem;
  border-radius: 999px;
}
.pinline { display: inline; }

/* ------------------------------------------------------------------ Shell */
.pmain { padding-block: clamp(1.75rem, 1rem + 3vw, 3.5rem) clamp(3rem, 2rem + 4vw, 5rem); }
.pwrap { width: min(1320px, 100% - 2.5rem); margin-inline: auto; }
.phead { margin-bottom: clamp(1.5rem, 1rem + 2vw, 2.5rem); }
.phead h1 { font-size: clamp(1.75rem, 1.4rem + 1.6vw, 2.75rem); margin-bottom: 0.25rem; }
.phead-sub { color: var(--muted); font-size: var(--text-lg); margin: 0; max-width: 70ch; }

.pfoot {
  border-top: 1px solid var(--line); background: var(--paper);
  padding-block: 2rem; font-size: var(--text-sm); color: var(--muted);
}
.pfoot p { margin: 0 0 0.4rem; }

/* ------------------------------------------------------------------ Panel */
.panel {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: clamp(1.25rem, 1rem + 1vw, 2rem); margin-bottom: 1.5rem;
}
.panel > h2 { font-size: clamp(1.125rem, 1rem + 0.55vw, 1.4rem); margin-bottom: 0.35rem; }
.panel > h2 + p { color: var(--muted); font-size: 0.9375rem; }
.panel-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem;
}
.panel-head h2 { margin: 0; }
.pcols { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 1.5rem; align-items: start; }
@media (max-width: 1180px) { .pcols { grid-template-columns: 1fr; } }

/* ------------------------------------------------------------------ Pills */
.pill {
  display: inline-block; font-size: var(--text-xs); font-weight: 650;
  letter-spacing: 0.06em; text-transform: uppercase; padding: 0.25rem 0.65rem;
  border-radius: 999px; white-space: nowrap;
}
.pill[data-tone="ok"]   { background: var(--sage-tint); color: #2f4c40; }
.pill[data-tone="wait"] { background: var(--gold-tint); color: #6b4c14; }
.pill[data-tone="warn"] { background: var(--clay-tint); color: #7a3419; }
.pill[data-tone="off"]  { background: var(--cream-2); color: var(--muted); }

/* ------------------------------------------------------------- Item lists */
.itemlist { list-style: none; margin: 0; padding: 0; }
.itemlist > li {
  border-top: 1px solid var(--line-soft); padding: 1.1rem 0; margin: 0;
  display: grid; grid-template-columns: 1fr auto; gap: 0.75rem 1.5rem; align-items: start;
}
.itemlist > li:first-child { border-top: 0; padding-top: 0; }
.itemlist > li:last-child { padding-bottom: 0; }
.item-title { font-weight: 620; margin: 0 0 0.15rem; }
.item-meta { font-size: var(--text-sm); color: var(--muted); margin: 0; }
.item-actions { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 640px) {
  .itemlist > li { grid-template-columns: 1fr; }
  .item-actions { justify-content: flex-start; }
}

/* ------------------------------------------------------------ Matter rows */
.matterlist { display: grid; gap: 0.75rem; }
.matter {
  display: grid; grid-template-columns: auto 1fr auto auto; gap: 1rem;
  align-items: center; background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: 1rem 1.25rem; text-decoration: none;
  color: inherit; transition: border-color var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.matter:hover { border-color: var(--clay); transform: translateY(-2px); }
.matter-ref { font-family: var(--font-display); font-size: 1.0625rem; color: var(--clay); }
.matter-name { font-weight: 620; margin: 0; }
.matter-sub { font-size: var(--text-sm); color: var(--muted); margin: 0; }
.matter-count { font-size: var(--text-sm); color: var(--muted); text-align: right; white-space: nowrap; }
@media (max-width: 760px) {
  .matter { grid-template-columns: 1fr; gap: 0.5rem; }
  .matter-count { text-align: left; }
}

/* --------------------------------------------------------------- Dropzone */
.drop {
  border: 2px dashed var(--line); border-radius: var(--radius-lg);
  background: var(--cream); padding: 1.5rem; text-align: center;
  transition: border-color var(--dur-fast) var(--ease), background-color var(--dur-fast) var(--ease);
}
.drop[data-over="true"] { border-color: var(--clay); background: var(--clay-tint); }
.drop input[type="file"] { display: block; margin: 0.75rem auto 0; max-width: 100%; font-size: 0.9375rem; }
.drop .drop-hint { font-size: var(--text-sm); color: var(--muted); margin: 0.5rem 0 0; }
.drop-name { font-weight: 620; margin-top: 0.5rem; font-size: 0.9375rem; }

/* --------------------------------------------------------------- Messages */
.msg {
  border-left: 3px solid var(--clay); background: var(--paper);
  border: 1px solid var(--line); border-left-width: 3px;
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
  padding: 1.25rem 1.5rem; margin-bottom: 1rem;
}
.msg h3 { font-size: 1.125rem; margin-bottom: 0.25rem; }
.msg-meta { font-size: var(--text-sm); color: var(--muted); margin-bottom: 0.85rem; }
.msg-body { white-space: pre-wrap; margin: 0; }

/* ----------------------------------------------------------------- Tables */
.ptable { width: 100%; min-width: 0; font-size: 0.9375rem; }
.ptable td, .ptable th { padding: 0.7rem 0.9rem; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.8125rem; }

/* ------------------------------------------------------------ Login cards */
.plogin { max-width: 460px; margin-inline: auto; }
.plogin .panel { padding: clamp(1.5rem, 1.2rem + 1.5vw, 2.5rem); }

/* ------------------------------------------------------------------ Utils */
.stackgap > * + * { margin-top: 1.25rem; }
.rowgap { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.mb-0 { margin-bottom: 0; }
.summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; }
.summary-grid > div { background: var(--paper); padding: 1rem 1.25rem; }
.summary-grid dt { font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); margin-bottom: 0.3rem; }
.summary-grid dd { margin: 0; font-weight: 620; overflow-wrap: anywhere; }

/* ------------------------------------------------------------ E-signature */
.sigpad { display: grid; gap: 0.5rem; }
.sigpad[hidden] { display: none; }
.sigpad-label { margin: 0; font-size: 0.875rem; font-weight: 620; color: var(--ink-2); }
.sigpad canvas {
  display: block; width: 100%; max-width: 640px; height: auto; aspect-ratio: 16 / 5;
  background: #fff; border: 1.5px dashed var(--line); border-radius: var(--radius);
  touch-action: none; cursor: crosshair;
}
input.sig-typed { font-family: var(--font-display); font-style: italic; font-size: 1.375rem; }
.disclosure {
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--cream);
  padding: 0.75rem 1rem; font-size: 0.9375rem;
}
.disclosure summary { cursor: pointer; font-weight: 620; }
.disclosure ul { margin: 0.75rem 0 0; }
.fingerprint { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 0.75rem; overflow-wrap: anywhere; }

/* Narrower screens: the menu takes its own row under the logo and sign-out, and
   scrolls sideways if it must, so no link is ever pushed out of reach. */
@media (max-width: 1180px) {
  .pbar-inner { row-gap: 0; padding-top: 0.5rem; }
  .puser { margin-left: auto; }
  .pnav {
    order: 3; flex: 1 0 100%; flex-wrap: nowrap; overflow-x: auto;
    padding: 0.25rem 0 0.6rem; scrollbar-width: none;
  }
  .pnav::-webkit-scrollbar { display: none; }
}
@media (max-width: 560px) {
  .puser-name, .puser-role { display: none; }
}
