/* ==========================================================================
   Ayden Advisory Group — client portal and administration
   --------------------------------------------------------------------------
   Layered on site.css. The same palette and the same type, arranged as a
   working interface rather than as a page: denser, flatter, quicker to scan.
   ========================================================================== */

.app { min-height: 100vh; display: flex; flex-direction: column; background: var(--ivory); }

/* --------------------------------------------------------------------------
   Top bar
   -------------------------------------------------------------------------- */
.app-bar {
  position: sticky;
  top: 0;
  z-index: 60;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.app-bar__inner {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  min-height: 4.25rem;
}
.app-bar__brand { display: inline-flex; align-items: center; gap: .7rem; text-decoration: none; }
.app-bar__brand .brand__mark { width: 34px; height: 34px; }
.app-bar__brand .brand__name { font-size: 1.25rem; }
.app-bar__tag {
  font-family: var(--mono);
  font-size: .5625rem;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--slate-light);
  border-left: 1px solid var(--line);
  padding-left: .8rem;
  margin-left: .3rem;
}
.app-bar__spacer { margin-left: auto; }
.app-bar__who { text-align: right; line-height: 1.3; }
.app-bar__who strong { display: block; font-size: .875rem; font-weight: 500; color: var(--navy); }
.app-bar__who span { font-size: .75rem; color: var(--slate-light); }

.app-bar__signout { display: inline; }

/* --------------------------------------------------------------------------
   Section navigation
   -------------------------------------------------------------------------- */
.app-nav { border-bottom: 1px solid var(--line); background: var(--paper); }
.app-nav__list {
  display: flex;
  gap: clamp(.75rem, 2vw, 2rem);
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.app-nav__list::-webkit-scrollbar { display: none; }
.app-nav__list a {
  display: block;
  padding: 1rem .15rem;
  font-family: var(--mono);
  font-size: var(--t-eyebrow);
  letter-spacing: .15em;
  text-transform: uppercase;
  color: var(--slate-light);
  text-decoration: none;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: color .3s var(--ease), border-color .3s var(--ease);
}
.app-nav__list a:hover { color: var(--navy); }
.app-nav__list a[aria-current="page"] { color: var(--navy); border-bottom-color: var(--azure); }
.app-nav__badge {
  display: inline-block;
  margin-left: .45rem;
  min-width: 1.15rem;
  padding: 0 .3rem;
  border-radius: 999px;
  background: var(--azure);
  color: #fff;
  font-size: .625rem;
  line-height: 1.15rem;
  text-align: center;
  letter-spacing: 0;
}

/* --------------------------------------------------------------------------
   Page frame
   -------------------------------------------------------------------------- */
.app-main { flex: 1; padding-block: clamp(2rem, 4vw, 3rem) clamp(3rem, 6vw, 5rem); }

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem 2rem;
  margin-bottom: clamp(1.5rem, 3vw, 2.25rem);
}
.page-head h1 { font-size: clamp(1.9rem, 1.4rem + 1.8vw, 2.75rem); margin: 0; }
.page-head p { color: var(--slate); margin: .5rem 0 0; max-width: 60ch; font-size: .9375rem; }

.back-link {
  display: inline-flex; align-items: center; gap: .5rem;
  font-family: var(--mono); font-size: var(--t-eyebrow); letter-spacing: .16em;
  text-transform: uppercase; color: var(--slate-light); text-decoration: none;
  margin-bottom: 1rem;
}
.back-link:hover { color: var(--azure); }

/* --------------------------------------------------------------------------
   Panels
   -------------------------------------------------------------------------- */
.panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.panel + .panel { margin-top: 1.5rem; }
.panel__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .75rem 1.5rem;
  padding: 1.1rem clamp(1rem, 2vw, 1.6rem);
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(232,241,248,.5), transparent);
}
.panel__head h2, .panel__head h3 {
  font-family: var(--mono);
  font-size: var(--t-eyebrow);
  font-weight: 500;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--navy);
  margin: 0;
}
.panel__body { padding: clamp(1rem, 2vw, 1.6rem); }
.panel__body--flush { padding: 0; }
.panel__foot {
  padding: 1rem clamp(1rem, 2vw, 1.6rem);
  border-top: 1px solid var(--line);
  background: rgba(232,241,248,.35);
}

.panel-grid { display: grid; gap: 1.5rem; align-items: start; }
.panel-grid--sidebar { grid-template-columns: minmax(0, 1fr) 20rem; }
.panel-grid--half { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* --------------------------------------------------------------------------
   Stat tiles
   -------------------------------------------------------------------------- */
/* Separators are drawn by each tile rather than by a gap over a coloured
   container. With a gap, a row that does not fill — six tiles across five
   columns — left the empty track showing as a grey block. A tile that draws its
   own right and bottom hairline leaves empty tracks invisible, and the
   container's overflow clips the outermost lines. */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.stat {
  padding: 1.25rem clamp(1rem, 2vw, 1.4rem);
  box-shadow: 1px 0 0 var(--line), 0 1px 0 var(--line);
}
.stat__label {
  font-family: var(--mono); font-size: .625rem; letter-spacing: .16em;
  text-transform: uppercase; color: var(--slate-light); display: block; margin-bottom: .6rem;
}
.stat__value {
  font-family: var(--serif); font-size: 2.1rem; line-height: 1;
  letter-spacing: -.03em; color: var(--navy); display: block;
}
.stat__value a { text-decoration: none; }
.stat__sub { display: block; margin-top: .45rem; font-size: .75rem; color: var(--slate-light); }
.stat--alert .stat__value { color: var(--azure); }

/* --------------------------------------------------------------------------
   Tables
   -------------------------------------------------------------------------- */
.table-wrap { overflow-x: auto; }
.table { font-size: .875rem; }
.table th, .table td { padding: .85rem clamp(.75rem, 1.5vw, 1.1rem); text-align: left; vertical-align: top; }
.table thead th {
  font-family: var(--mono);
  font-size: .625rem;
  font-weight: 500;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--slate-light);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.table tbody tr { border-bottom: 1px solid var(--line); }
.table tbody tr:last-child { border-bottom: 0; }
.table tbody tr:hover { background: rgba(232,241,248,.45); }
.table td strong { color: var(--navy); font-weight: 500; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .nowrap { white-space: nowrap; }
.table a { color: var(--navy); }

.table__empty { padding: 2.5rem 1.5rem; text-align: center; color: var(--slate-light); font-size: .9375rem; }

/* A bar drawn inside a table cell — no chart library, no external script. */
.bar { position: relative; height: 6px; background: var(--cream); border-radius: 999px; overflow: hidden; min-width: 4rem; }
.bar__fill { position: absolute; inset: 0 auto 0 0; background: var(--azure); border-radius: 999px; }

.spark { display: flex; align-items: flex-end; justify-content: flex-start; gap: 2px; height: 3rem; }
/* max-width so that a range with one or two days reads as two bars rather than
   as one block filling the panel. */
.spark__col { flex: 1 1 0; min-width: 2px; max-width: 2.5rem; background: var(--champagne); border-radius: 1px 1px 0 0; }
.spark__col--hi { background: var(--azure); }

/* --------------------------------------------------------------------------
   Definition rows
   -------------------------------------------------------------------------- */
.dl { display: grid; grid-template-columns: 11rem minmax(0, 1fr); gap: .1rem 1.25rem; font-size: .875rem; }
.dl dt {
  font-family: var(--mono); font-size: .625rem; letter-spacing: .14em;
  text-transform: uppercase; color: var(--slate-light); padding: .55rem 0;
}
.dl dd { margin: 0; padding: .55rem 0; color: var(--ink); overflow-wrap: anywhere; }
.dl dt + dd { border-bottom: 1px solid var(--line); }
.dl dt { border-bottom: 1px solid var(--line); }
.dl dt:last-of-type, .dl dd:last-of-type { border-bottom: 0; }

/* --------------------------------------------------------------------------
   Documents
   -------------------------------------------------------------------------- */
.doc-list { list-style: none; margin: 0; padding: 0; }
.doc-item {
  display: grid;
  grid-template-columns: 2.75rem minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: center;
  padding: 1rem clamp(1rem, 2vw, 1.6rem);
  border-bottom: 1px solid var(--line);
}
.doc-item:last-child { border-bottom: 0; }
.doc-item:hover { background: rgba(232,241,248,.45); }
.doc-item__type {
  width: 2.75rem; height: 2.75rem;
  display: grid; place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-family: var(--mono);
  font-size: .5625rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--slate);
  background: var(--cream);
}
.doc-item__title { font-weight: 500; color: var(--navy); text-decoration: none; display: block; }
.doc-item__title:hover { color: var(--azure); }
.doc-item__meta { font-size: .75rem; color: var(--slate-light); margin-top: .25rem; }
.doc-item__actions { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }

/* View, Download and Manage on a row of the library or a folder */
.file-actions { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.file-actions .btn--sm, .doc-item__actions .btn--sm { padding: .6rem 1rem; }
.btn--icon.btn--sm { gap: .45rem; }
.btn--icon.btn--sm .ico { width: 14px; height: 14px; }

.copyfield { display: flex; gap: .5rem; align-items: stretch; }
.copyfield input {
  flex: 1;
  font-family: var(--mono);
  font-size: .75rem;
  padding: .7rem .8rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--cream);
  color: var(--navy);
  min-width: 0;
}

/* --------------------------------------------------------------------------
   Forms inside the app
   -------------------------------------------------------------------------- */
.app .field { margin-bottom: 1.25rem; }
.app .input, .app .select, .app .textarea {
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: .7rem .8rem;
  background: var(--paper);
  font-size: .9375rem;
}
.app .input:focus, .app .select:focus, .app .textarea:focus {
  border-color: var(--azure); box-shadow: 0 0 0 3px rgba(26,108,168,.12);
}
.app .select { background-position: right .6rem center; padding-right: 2.2rem; }

.filelist {
  max-height: 14rem;
  overflow-y: auto;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: .65rem .8rem;
  background: var(--paper);
}
.filelist .check { margin-bottom: .55rem; font-size: .875rem; }
.filelist .check:last-child { margin-bottom: 0; }

.inline-form { display: inline; }
.btn-row { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }

.filter-row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.filter-chip {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .45rem .85rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-family: var(--mono); font-size: .625rem; letter-spacing: .14em; text-transform: uppercase;
  color: var(--slate); text-decoration: none; background: var(--paper);
  transition: border-color .3s var(--ease), color .3s var(--ease);
}
.filter-chip:hover { border-color: var(--line-strong); color: var(--navy); }
.filter-chip[aria-current="true"] { background: var(--navy); border-color: var(--navy); color: var(--ivory); }
.filter-chip__n { opacity: .6; }

/* --------------------------------------------------------------------------
   Activity feed
   -------------------------------------------------------------------------- */
.feed { list-style: none; margin: 0; padding: 0; }
.feed li {
  display: grid;
  grid-template-columns: .6rem minmax(0, 1fr) auto;
  gap: .85rem;
  align-items: baseline;
  padding: .7rem clamp(1rem, 2vw, 1.6rem);
  border-bottom: 1px solid var(--line);
  font-size: .875rem;
}
.feed li:last-child { border-bottom: 0; }
.feed__dot { width: 6px; height: 6px; border-radius: 50%; background: var(--champagne); }
.feed__dot--down { background: var(--azure); }
.feed__dot--login { background: var(--ok); }
.feed__when { font-size: .75rem; color: var(--slate-light); white-space: nowrap; }
.feed__what { color: var(--slate); overflow-wrap: anywhere; }
.feed__what strong { color: var(--navy); font-weight: 500; }

/* --------------------------------------------------------------------------
   Auth screens
   -------------------------------------------------------------------------- */
.auth {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
}
.auth__aside {
  position: relative;
  background: linear-gradient(162deg, var(--navy) 0%, var(--navy-deep) 100%);
  color: var(--cream);
  padding: clamp(2.5rem, 5vw, 4.5rem);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
}
.auth__aside::after {
  content: "";
  position: absolute; inset: 0;
  background-image: radial-gradient(circle at 1px 1px, rgba(197,219,233,.16) 1px, transparent 0);
  background-size: 34px 34px;
  mask-image: radial-gradient(ellipse 70% 60% at 30% 80%, #000, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 30% 80%, #000, transparent 70%);
  pointer-events: none;
}
.auth__aside > * { position: relative; z-index: 1; }
.auth__aside h2 {
  color: var(--ivory);
  font-size: clamp(1.9rem, 1.3rem + 2vw, 3rem);
  line-height: 1.08;
  margin: 0 0 1.1rem;
}
.auth__aside p { color: rgba(232,241,248,.72); max-width: 38ch; }
.auth__aside .brand__name { color: var(--ivory); }
.auth__aside .brand__sub { color: rgba(197,219,233,.55); }
.auth__points { list-style: none; margin: 2rem 0 0; padding: 0; }
.auth__points li {
  display: grid; grid-template-columns: 1rem minmax(0,1fr); gap: .8rem;
  padding: .6rem 0; font-size: .875rem; color: rgba(232,241,248,.72);
  border-top: 1px solid var(--line-invert);
}
.auth__points li::before { content: "—"; color: var(--champagne); }

.auth__panel {
  padding: clamp(2.5rem, 5vw, 4.5rem) clamp(1.5rem, 5vw, 5rem);
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: var(--ivory);
}
.auth__form { width: 100%; max-width: 30rem; margin-inline: auto; }
.auth__form h1 { font-size: clamp(1.9rem, 1.4rem + 1.6vw, 2.5rem); margin-bottom: .5rem; }
.auth__form > .lede { margin-bottom: 2rem; }
.auth__alt { margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid var(--line);
  font-size: .875rem; color: var(--slate); }

/* The registration form is wider than a sign-in form. */
.auth--wide { grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); }
.auth--wide .auth__form { max-width: 40rem; }

.pw-meter { display: flex; gap: 4px; margin-top: .6rem; }
.pw-meter__seg { height: 3px; flex: 1; background: var(--line); border-radius: 999px; transition: background .3s var(--ease); }
.pw-meter[data-score="1"] .pw-meter__seg:nth-child(-n+1) { background: var(--bad); }
.pw-meter[data-score="2"] .pw-meter__seg:nth-child(-n+2) { background: var(--warn); }
.pw-meter[data-score="3"] .pw-meter__seg:nth-child(-n+3) { background: var(--azure); }
.pw-meter[data-score="4"] .pw-meter__seg { background: var(--ok); }

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 1080px) {
  .panel-grid--sidebar { grid-template-columns: 1fr; }
  .auth, .auth--wide { grid-template-columns: 1fr; }
  .auth__aside { display: none; }
  .auth__panel { padding-block: clamp(2rem, 6vw, 3.5rem); min-height: 100vh; }
}

@media (max-width: 760px) {
  .panel-grid--half { grid-template-columns: 1fr; }
  .dl { grid-template-columns: 1fr; gap: 0; }
  .dl dt { border-bottom: 0; padding-bottom: 0; }
  .dl dd { padding-top: .2rem; }
  .app-bar__who { display: none; }
  .doc-item { grid-template-columns: 2.5rem minmax(0, 1fr); }
  .doc-item__actions { grid-column: 2 / -1; }
  .copyfield { flex-direction: column; }
  .stat__value { font-size: 1.75rem; }
}

/* --------------------------------------------------------------------------
   Visual admin: icons, file types, folder cards, people, danger zone
   --------------------------------------------------------------------------
   Added alongside the components above rather than in place of them. Same
   palette and the same square corners, so the new pieces read as part of the
   firm's panel rather than as a dashboard bolted onto it.
   -------------------------------------------------------------------------- */

.ico { display: inline-block; flex: none; vertical-align: middle; }

/* ---- Chips: small, quiet labels ------------------------------------------ */
.chip {
  display: inline-flex; align-items: center; gap: .35rem;
  font-family: var(--mono); font-size: .625rem; font-weight: 500;
  letter-spacing: .08em; text-transform: uppercase; line-height: 1;
  padding: .38rem .55rem; border: 1px solid var(--line-strong);
  border-radius: var(--radius); color: var(--navy); background: var(--paper);
  white-space: nowrap;
}
.chip .ico { width: 12px; height: 12px; }
.chip--ok    { color: var(--ok);    border-color: rgba(28,107,75,.32);  background: rgba(28,107,75,.06); }
.chip--warn  { color: var(--warn);  border-color: rgba(138,100,21,.32); background: rgba(138,100,21,.07); }
.chip--bad   { color: var(--bad);   border-color: rgba(168,50,47,.32);  background: rgba(168,50,47,.06); }
.chip--navy  { color: var(--ivory); border-color: var(--navy);          background: var(--navy); }
.chip--brass { color: var(--brass); border-color: rgba(138,106,31,.35); background: rgba(194,160,90,.10); }
.chip--muted { color: var(--slate-light); border-color: var(--line);    background: transparent; }
.chip__dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.chips { display: flex; flex-wrap: wrap; gap: .35rem; }

/* ---- File-type tile ------------------------------------------------------ */
.ftype {
  --ft: #6c7b8b; --ft-bg: rgba(108,123,139,.07); --ft-bd: rgba(108,123,139,.3);
  position: relative; display: inline-grid; place-items: center;
  width: 2.75rem; height: 3.1rem; flex: none;
  color: var(--ft); background: var(--ft-bg);
  border: 1px solid var(--ft-bd); border-radius: var(--radius);
}
.ftype .ico { width: 22px; height: 22px; opacity: .55; margin-top: -.55rem; }
.ftype__ext {
  position: absolute; left: 50%; bottom: .32rem; transform: translateX(-50%);
  font-family: var(--mono); font-size: .5rem; font-weight: 600;
  letter-spacing: .06em; color: #fff; background: var(--ft);
  padding: .14rem .3rem; border-radius: 1px; line-height: 1;
}
.ftype--pdf     { --ft: #a8322f; --ft-bg: rgba(168,50,47,.07);  --ft-bd: rgba(168,50,47,.3); }
.ftype--doc     { --ft: #1a6ca8; --ft-bg: rgba(26,108,168,.07); --ft-bd: rgba(26,108,168,.3); }
.ftype--sheet   { --ft: #1c6b4b; --ft-bg: rgba(28,107,75,.07);  --ft-bd: rgba(28,107,75,.3); }
.ftype--slide   { --ft: #b0631c; --ft-bg: rgba(176,99,28,.07);  --ft-bd: rgba(176,99,28,.3); }
.ftype--image   { --ft: #6b4c9a; --ft-bg: rgba(107,76,154,.07); --ft-bd: rgba(107,76,154,.3); }
.ftype--archive { --ft: #41505f; --ft-bg: rgba(65,80,95,.07);   --ft-bd: rgba(65,80,95,.3); }
.ftype--text    { --ft: #6c7b8b; --ft-bg: rgba(108,123,139,.07);--ft-bd: rgba(108,123,139,.3); }

/* ---- Document library rows ---------------------------------------------- */
.doc-cell { display: flex; align-items: center; gap: .9rem; min-width: 0; }
.doc-cell__text { min-width: 0; }
.doc-cell__title { font-weight: 500; color: var(--navy); text-decoration: none; }
.doc-cell__title:hover { color: var(--azure); }
.doc-cell__sub {
  display: block; font-size: .75rem; color: var(--slate-light); margin-top: .2rem;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 22rem;
}
.size-chip {
  display: inline-block; font-family: var(--mono); font-size: .6875rem;
  padding: .3rem .5rem; border-radius: var(--radius);
  background: var(--cream); color: var(--navy); white-space: nowrap;
}
.table tr.is-archived td {
  background: repeating-linear-gradient(135deg, rgba(138,100,21,.035) 0 10px, transparent 10px 20px);
}
.table tr.is-archived .ftype { filter: grayscale(1); opacity: .6; }
.table tr.is-archived .doc-cell__title { color: var(--slate); }
.table tr.table__divider td {
  background: var(--ivory); padding-block: .75rem;
  font-family: var(--mono); font-size: .625rem; letter-spacing: .12em;
  text-transform: uppercase; color: var(--warn);
  border-top: 1px solid var(--line-strong);
}
.table tr.table__divider .ico { width: 13px; height: 13px; margin-right: .4rem; }

/* ---- Folder cards ------------------------------------------------------- */
.folder-grid {
  display: grid; gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(15.5rem, 1fr));
  padding: clamp(1rem, 2vw, 1.4rem);
}
.folder-card {
  position: relative; display: flex; flex-direction: column; gap: .85rem;
  padding: 1.15rem 1.15rem 1rem; min-height: 11rem;
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius-lg); color: inherit; text-decoration: none;
  transition: border-color .2s var(--ease), box-shadow .25s var(--ease), transform .25s var(--ease);
}
.folder-card::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 3px;
  background: var(--champagne); border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  opacity: 0; transition: opacity .2s var(--ease);
}
.folder-card:hover, .folder-card:focus-visible {
  border-color: var(--line-strong); box-shadow: var(--shadow-md); transform: translateY(-2px);
}
.folder-card:hover::before, .folder-card:focus-visible::before { opacity: 1; }
.folder-card__top { display: flex; align-items: flex-start; justify-content: space-between; gap: .75rem; }
.folder-card__icon {
  display: grid; place-items: center; width: 2.6rem; height: 2.6rem;
  color: var(--brass); background: rgba(194,160,90,.12);
  border: 1px solid rgba(138,106,31,.22); border-radius: var(--radius);
}
.folder-card__icon .ico { width: 22px; height: 22px; }
.folder-card--empty .folder-card__icon { color: var(--slate-light); background: var(--ivory); border-color: var(--line); }
.folder-card__count { text-align: right; line-height: 1; }
.folder-card__count strong {
  display: block; font-family: var(--serif); font-size: 2rem; font-weight: 500; color: var(--navy);
}
.folder-card__count span {
  font-family: var(--mono); font-size: .5625rem; letter-spacing: .12em;
  text-transform: uppercase; color: var(--slate-light);
}
.folder-card__name {
  font-family: var(--serif); font-size: 1.3rem; font-weight: 500;
  color: var(--navy); line-height: 1.15; margin: 0;
}
.folder-card__desc { font-size: .8125rem; color: var(--slate); margin: .3rem 0 0; line-height: 1.5; }
.folder-card__foot { margin-top: auto; padding-top: .8rem; border-top: 1px solid var(--line); }
.folder-card__label {
  display: block; font-family: var(--mono); font-size: .5625rem; letter-spacing: .14em;
  text-transform: uppercase; color: var(--slate-light); margin-bottom: .45rem;
}
.folder-card__open {
  display: inline-flex; align-items: center; gap: .35rem; margin-top: .8rem;
  font-family: var(--mono); font-size: .625rem; letter-spacing: .12em;
  text-transform: uppercase; color: var(--azure);
}
.folder-card__open .ico { width: 13px; height: 13px; transition: transform .2s var(--ease); }
.folder-card:hover .folder-card__open .ico { transform: translateX(3px); }

/* ---- People ------------------------------------------------------------- */
.people { list-style: none; margin: 0; padding: 0; }
.person {
  display: grid; align-items: center; gap: 1rem;
  grid-template-columns: 2.6rem minmax(0, 1.6fr) minmax(0, 1.2fr) minmax(0, 1fr) auto;
  padding: .95rem clamp(1rem, 2vw, 1.5rem); border-bottom: 1px solid var(--line);
}
.person:last-child { border-bottom: 0; }
.person:hover { background: rgba(232,241,248,.45); }
.person.is-inactive .person__name { color: var(--slate); }
.avatar {
  display: grid; place-items: center; width: 2.6rem; height: 2.6rem;
  border-radius: 50%; font-family: var(--mono); font-size: .75rem; font-weight: 600;
  letter-spacing: .04em; color: var(--navy); background: var(--sand);
  border: 1px solid var(--line);
}
.avatar--admin   { color: var(--ivory); background: var(--navy);      border-color: var(--navy); }
.avatar--founder { color: var(--navy);  background: var(--champagne); border-color: var(--brass); }
.avatar--muted   { color: var(--slate-light); background: var(--ivory); }
.person__name { font-weight: 500; color: var(--navy); text-decoration: none; display: block; }
.person__name:hover { color: var(--azure); }
.person__mail {
  display: block; font-size: .75rem; color: var(--slate-light); margin-top: .15rem;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.person__org { font-size: .875rem; color: var(--ink); }
.person__org span { display: block; font-size: .75rem; color: var(--slate-light); margin-top: .15rem; }
.person__seen { font-size: .75rem; color: var(--slate-light); line-height: 1.5; }
.person__seen strong { color: var(--navy); font-weight: 500; }
.person__badges { margin-top: .45rem; }
.person__go {
  display: inline-grid; place-items: center; width: 2.25rem; height: 2.25rem;
  border: 1px solid var(--line-strong); border-radius: var(--radius); color: var(--navy);
  transition: background .2s var(--ease), color .2s var(--ease), border-color .2s var(--ease);
}
.person__go:hover, .person__go:focus-visible { background: var(--navy); color: var(--ivory); border-color: var(--navy); }
.person__go .ico { width: 16px; height: 16px; }

/* ---- Danger zone -------------------------------------------------------- */
.danger-zone { border-color: rgba(168,50,47,.35); }
.danger-zone .panel__head { background: rgba(168,50,47,.04); border-bottom-color: rgba(168,50,47,.2); }
.danger-zone .panel__head h2 { color: var(--bad); display: flex; align-items: center; gap: .5rem; }
.danger-zone__list { margin: .9rem 0 0; padding-left: 1.1rem; color: var(--slate); font-size: .875rem; line-height: 1.7; }
.danger-zone__confirm { display: flex; gap: .6rem; align-items: flex-end; flex-wrap: wrap; margin-top: 1.1rem; }
.danger-zone__confirm .field { flex: 1 1 16rem; margin: 0; }

@media (max-width: 960px) {
  .person { grid-template-columns: 2.6rem minmax(0, 1fr) auto; }
  .person__org, .person__seen { display: none; }
}
@media (max-width: 560px) {
  .folder-grid { grid-template-columns: 1fr; }
  .doc-cell__sub { max-width: 12rem; }
}

/* --------------------------------------------------------------------------
   Groups board: group cards, a tray of people, drag to add
   --------------------------------------------------------------------------
   Every state here is reached by the same forms that work without a script;
   .is-enhanced is only set once the script has taken over, so nothing that
   needs it (the grip, the search, the drop labels) shows on a page that
   cannot use it.
   -------------------------------------------------------------------------- */
.avatar--sm { width: 2rem; height: 2rem; font-size: .625rem; }

.board {
  display: grid; gap: 1.5rem; align-items: start; margin-top: 1.5rem;
  grid-template-columns: minmax(0, 1fr) 19.5rem;
}
.board.is-busy { cursor: progress; }
.board__bar { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: .9rem; }
.board__title { font-family: var(--serif); font-size: 1.5rem; font-weight: 500; color: var(--navy); margin: 0; line-height: 1.1; }

.group-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); }

/* ---- One group ---------------------------------------------------------- */
.group-card {
  position: relative; display: flex; flex-direction: column; gap: .9rem;
  padding: 1.15rem; min-width: 0;
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-lg);
  transition: border-color .2s var(--ease), box-shadow .25s var(--ease), background-color .2s var(--ease);
}
.group-card::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 3px;
  background: var(--champagne); border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  opacity: 0; transition: opacity .2s var(--ease);
}
.group-card:hover { border-color: var(--line-strong); box-shadow: var(--shadow-sm); }
.group-card:hover::before, .group-card:focus-within::before { opacity: 1; }
.group-card__top { display: flex; align-items: flex-start; justify-content: space-between; gap: .75rem; }
.group-card__icon {
  display: grid; place-items: center; width: 2.6rem; height: 2.6rem; flex: none;
  color: var(--brass); background: rgba(194,160,90,.12);
  border: 1px solid rgba(138,106,31,.22); border-radius: var(--radius);
}
.group-card__icon .ico { width: 22px; height: 22px; }
.group-card__icon--new { color: var(--azure); background: rgba(26,108,168,.06); border-color: rgba(26,108,168,.25); }
.group-card__count { text-align: right; line-height: 1; }
.group-card__count strong {
  display: block; font-family: var(--serif); font-size: 2rem; font-weight: 500; color: var(--navy);
}
.group-card__count span {
  font-family: var(--mono); font-size: .5625rem; letter-spacing: .12em;
  text-transform: uppercase; color: var(--slate-light);
}
.group-card__name {
  font-family: var(--serif); font-size: 1.3rem; font-weight: 500;
  color: var(--navy); line-height: 1.15; margin: 0; overflow-wrap: anywhere;
}
.group-card__desc { font-size: .8125rem; color: var(--slate); margin: .3rem 0 0; line-height: 1.5; }

.member-list {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: .4rem;
  max-height: 17.5rem; overflow-y: auto;
}
.member-list:empty { display: none; }
.member {
  display: grid; grid-template-columns: 2rem minmax(0, 1fr) auto; align-items: center; gap: .6rem;
  padding: .4rem .4rem .4rem .45rem;
  background: var(--ivory); border: 1px solid var(--line); border-radius: var(--radius);
}
.member.is-inactive .member__name { color: var(--slate); }
.member.is-inactive .member__mail { color: var(--warn); }
.member.is-new { animation: ay-member-in 1s var(--ease-out); }
@keyframes ay-member-in {
  from { background: rgba(194,160,90,.3); border-color: var(--champagne); }
  to   { background: var(--ivory);        border-color: var(--line); }
}
.member__text, .pchip__text { min-width: 0; line-height: 1.25; }
.member__name, .pchip__name {
  display: block; font-size: .8125rem; font-weight: 500; color: var(--navy);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.member__mail, .pchip__mail {
  display: block; font-size: .6875rem; color: var(--slate-light);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.member__remove { display: flex; margin: 0; }
.member__x {
  display: grid; place-items: center; width: 1.85rem; height: 1.85rem; padding: 0;
  color: var(--slate-light); background: transparent;
  border: 1px solid transparent; border-radius: var(--radius); cursor: pointer;
  transition: color .2s var(--ease), background-color .2s var(--ease), border-color .2s var(--ease);
}
.member__x:hover, .member__x:focus-visible {
  color: var(--bad); background: rgba(168,50,47,.07); border-color: rgba(168,50,47,.3);
}
.member__x:focus-visible { outline: 2px solid var(--azure); outline-offset: 1px; }

.group-card__empty {
  margin: 0; padding: .9rem; text-align: center; font-size: .8125rem; color: var(--slate-light);
  border: 1px dashed var(--line-strong); border-radius: var(--radius);
}

.group-card__place {
  width: 100%; padding: .75rem; cursor: pointer;
  font-family: var(--mono); font-size: .625rem; letter-spacing: .12em; text-transform: uppercase;
  color: var(--azure); background: rgba(26,108,168,.06);
  border: 1px dashed var(--azure); border-radius: var(--radius);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  transition: background-color .2s var(--ease), color .2s var(--ease);
}
.group-card__place:hover, .group-card__place:focus-visible { color: #fff; background: var(--azure); border-style: solid; }
.group-card__place:disabled { color: var(--slate-light); background: transparent; border-color: var(--line-strong); cursor: default; }

.group-card__add { display: flex; gap: .5rem; align-items: stretch; margin: 0; }
.app .group-card__add .select { flex: 1 1 auto; min-width: 0; font-size: .8125rem; padding-top: .55rem; padding-bottom: .55rem; }
.group-card__add .btn { flex: none; }

.group-card__foot {
  margin-top: auto; padding-top: .75rem; border-top: 1px solid var(--line);
  display: flex; justify-content: flex-end;
}
.group-card__delete {
  display: inline-flex; align-items: center; gap: .35rem; padding: .25rem 0;
  background: none; border: 0; cursor: pointer;
  font-family: var(--mono); font-size: .5625rem; letter-spacing: .14em; text-transform: uppercase;
  color: var(--slate-light); transition: color .2s var(--ease);
}
.group-card__delete .ico { width: 13px; height: 13px; }
.group-card__delete:hover, .group-card__delete:focus-visible { color: var(--bad); }

.group-card--new { border-style: dashed; background: transparent; }
.group-card--new .field { margin-bottom: 0; }
.group-card--new .btn { align-self: flex-start; }

/* ---- Dragging ----------------------------------------------------------- */
.group-card::after {
  content: ""; position: absolute; left: 50%; bottom: .9rem; z-index: 2;
  transform: translate(-50%, .3rem); opacity: 0; pointer-events: none;
  padding: .45rem .75rem; border-radius: 999px; white-space: nowrap;
  font-family: var(--mono); font-size: .5625rem; letter-spacing: .14em; text-transform: uppercase;
  color: #fff; background: var(--azure); box-shadow: var(--shadow-sm);
  transition: opacity .15s var(--ease), transform .15s var(--ease);
}
.board.is-dragging .group-card[data-group-id] { border-style: dashed; border-color: var(--line-strong); }
.board .group-card.is-over {
  border-style: solid; border-color: var(--azure);
  background: rgba(26,108,168,.04); box-shadow: 0 0 0 3px rgba(26,108,168,.12);
}
.group-card.is-over::after { content: "Drop to add"; opacity: 1; transform: translate(-50%, 0); }
.board .group-card.is-dup { border-style: solid; border-color: var(--warn); box-shadow: 0 0 0 3px rgba(138,100,21,.12); }
.group-card.is-dup::after { content: "Already in this group"; background: var(--warn); opacity: 1; transform: translate(-50%, 0); }

/* ---- The tray of people ------------------------------------------------- */
.tray {
  position: sticky; top: 5.5rem;
  display: flex; flex-direction: column; max-height: calc(100vh - 7rem);
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-lg);
}
.tray__head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 1rem;
  padding: 1rem 1.1rem .85rem; border-bottom: 1px solid var(--line);
}
.tray__tools { padding: .85rem 1.1rem 0; }
.tray__search { position: relative; }
.tray__search .ico { position: absolute; left: .7rem; top: 50%; transform: translateY(-50%); color: var(--slate-light); pointer-events: none; }
.app .tray__search .input { padding-left: 2.2rem; font-size: .875rem; }
.tray__only { margin: .75rem 0 0; font-size: .8125rem; }
.tray__note { margin: 0; padding: .85rem 1.1rem 0; font-size: .75rem; line-height: 1.55; color: var(--slate-light); }
.tray__note--empty { padding-bottom: 1.1rem; text-align: center; }
.tray__list {
  list-style: none; margin: 0; padding: .85rem 1.1rem 1.1rem; min-height: 0; overflow-y: auto;
  display: flex; flex-direction: column; gap: .45rem;
}

.pchip {
  display: grid; grid-template-columns: 2rem minmax(0, 1fr) auto; align-items: center; gap: .55rem;
  padding: .5rem .6rem; user-select: none; -webkit-user-select: none;
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease), background-color .2s var(--ease), opacity .2s var(--ease);
}
.pchip__grip { display: none; color: var(--slate-light); }
.is-enhanced .pchip { grid-template-columns: auto 2rem minmax(0, 1fr) auto; cursor: grab; }
.is-enhanced .pchip__grip { display: grid; place-items: center; }
.is-enhanced .pchip:hover { border-color: var(--line-strong); box-shadow: var(--shadow-sm); }
.is-enhanced .pchip:active { cursor: grabbing; }
.pchip:focus-visible { outline: 2px solid var(--azure); outline-offset: 2px; }
.pchip.is-dragging { opacity: .45; }
.pchip.is-picked { border-color: var(--azure); background: rgba(26,108,168,.06); box-shadow: 0 0 0 3px rgba(26,108,168,.12); }
.pchip__count {
  font-family: var(--mono); font-size: .5625rem; letter-spacing: .08em; text-transform: uppercase;
  color: var(--brass); white-space: nowrap;
}
.pchip__count--none { color: var(--warn); }

/* ---- What just happened ------------------------------------------------- */
.board-toast {
  position: fixed; left: 50%; bottom: 1.5rem; z-index: 80; transform: translateX(-50%);
  display: flex; align-items: center; gap: 1rem;
  width: max-content; max-width: calc(100vw - 2rem);
  padding: .8rem .9rem .8rem 1.1rem; font-size: .875rem; line-height: 1.45;
  color: var(--ivory); background: var(--navy);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
}
.board-toast.is-error { background: var(--bad); }
.board-toast.is-shown { animation: ay-toast-in .35s var(--ease-out); }
@keyframes ay-toast-in {
  from { opacity: 0; transform: translate(-50%, .75rem); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}
.board-toast__undo {
  flex: none; padding: .45rem .75rem; cursor: pointer;
  font-family: var(--mono); font-size: .625rem; letter-spacing: .14em; text-transform: uppercase;
  color: var(--ivory); background: transparent;
  border: 1px solid rgba(255,255,255,.4); border-radius: var(--radius);
}
.board-toast__undo:hover, .board-toast__undo:focus-visible { background: rgba(255,255,255,.14); }

@media (prefers-reduced-motion: reduce) {
  .member.is-new, .board-toast.is-shown { animation: none; }
}
@media (max-width: 1100px) {
  .board { grid-template-columns: minmax(0, 1fr); }
  /* People first on a narrow screen: choose somebody, then the group. */
  .tray { position: static; max-height: none; order: -1; }
  .tray__list { max-height: 20rem; }
}
@media (max-width: 560px) {
  .group-grid { grid-template-columns: minmax(0, 1fr); }
  .board-toast { left: 1rem; right: 1rem; width: auto; max-width: none; transform: none; }
  .board-toast.is-shown { animation: none; }
}

/* --------------------------------------------------------------------------
   Email screen
   -------------------------------------------------------------------------- */
.verdict {
  display: flex; align-items: flex-start; gap: 1rem;
  padding: 1.15rem clamp(1rem, 2vw, 1.4rem);
  background: var(--paper); border: 1px solid var(--line); border-left: 3px solid var(--ok);
  border-radius: var(--radius-lg);
}
.verdict__icon {
  display: grid; place-items: center; width: 2.4rem; height: 2.4rem; flex: none;
  border-radius: 50%; color: var(--ok); background: rgba(28,107,75,.08);
}
.verdict__icon .ico { width: 20px; height: 20px; }
.verdict__title { display: block; font-family: var(--serif); font-size: 1.35rem; font-weight: 500; color: var(--navy); line-height: 1.2; }
.verdict__text { margin: .3rem 0 0; font-size: .875rem; color: var(--slate); max-width: 75ch; overflow-wrap: anywhere; }
.verdict--warn { border-left-color: var(--warn); }
.verdict--warn .verdict__icon { color: var(--warn); background: rgba(138,100,21,.09); }
.verdict--bad { border-left-color: var(--bad); }
.verdict--bad .verdict__icon { color: var(--bad); background: rgba(168,50,47,.08); }

.code-inline { font-family: var(--mono); font-size: .8em; color: var(--navy); }
.mono-val { font-family: var(--mono); font-size: .8125rem; color: var(--navy); overflow-wrap: anywhere; }
.mono-val--wrap { font-size: .75rem; word-break: break-all; }
.dl--compact { grid-template-columns: 10rem minmax(0, 1fr); }
.dl--compact dd .chip { margin-left: .35rem; vertical-align: middle; }
.dl--compact dd .chip:first-child { margin-left: 0; }
.btn--icon { display: inline-flex; align-items: center; gap: .55rem; }
.btn--icon .ico { width: 15px; height: 15px; }
.mail-error { display: block; margin-top: .35rem; max-width: 24rem; overflow-wrap: anywhere; }

.panel--details > summary { cursor: pointer; list-style: none; }
.panel--details > summary::-webkit-details-marker { display: none; }
.panel--details > summary h2::before {
  content: "+"; display: inline-block; width: 1.1em; color: var(--azure);
}
.panel--details[open] > summary h2::before { content: "\2212"; }
.panel--details:not([open]) > summary { border-bottom: 0; }
.panel--details > summary:focus-visible { outline: 2px solid var(--azure); outline-offset: -2px; }

.steps { margin: 0; padding-left: 1.2rem; color: var(--slate); font-size: .9375rem; line-height: 1.75; }
.steps > li + li { margin-top: .85rem; }
.code-block {
  flex: 1; min-width: 0; resize: vertical;
  font-family: var(--mono); font-size: .75rem; line-height: 1.7;
  padding: .8rem .9rem; color: var(--navy); background: var(--cream);
  border: 1px solid var(--line-strong); border-radius: var(--radius);
}

@media (max-width: 760px) {
  .dl--compact { grid-template-columns: minmax(0, 1fr); }
  .dl--compact dt { border-bottom: 0; padding-bottom: 0; }
}

/* --------------------------------------------------------------------------
   NDA screen: the version a new file is published under, and the file rules
   -------------------------------------------------------------------------- */
.nda-version {
  display: flex; align-items: baseline; gap: .75rem; flex-wrap: wrap; margin: 0;
  padding: .7rem .85rem; background: var(--cream); border: 1px solid var(--line);
  border-radius: var(--radius);
}
.nda-version strong { font-family: var(--mono); font-size: .9375rem; color: var(--navy); }
.nda-version span { font-size: .75rem; color: var(--slate); line-height: 1.5; flex: 1 1 14rem; }
.nda-rules { list-style: none; margin: .75rem 0 0; padding: 0; display: grid; gap: .35rem; }
.nda-rules li { display: flex; align-items: center; gap: .45rem; font-size: .75rem; color: var(--slate); }
.nda-rules .ico { width: 13px; height: 13px; color: var(--ok); flex: none; }

/* How many have accepted the version in force */
.stat__of { font-size: 1.1rem; color: var(--slate-light); }
.uptake { display: grid; gap: .45rem; }
.uptake__bar { display: block; height: 6px; background: var(--cream); border-radius: 999px; overflow: hidden; }
.uptake__fill { display: block; height: 100%; background: var(--ok); border-radius: 999px; }
.steps--small { font-size: .875rem; line-height: 1.6; }
.steps--small > li + li { margin-top: .5rem; }

/* Checking the text of a new version */
.nda-markup { width: 100%; min-height: 34rem; font-size: .78rem; line-height: 1.65; white-space: pre-wrap; }
.nda-preview { max-height: 40rem; overflow-y: auto; padding-right: .5rem; }
.nda-preview__title { font-family: var(--serif); font-size: 1.35rem; color: var(--navy); margin-top: 0; }
.nda-side-actions { display: grid; gap: .6rem; margin-top: 1.25rem; }
.nda-side-actions .btn { white-space: normal; padding-left: 1rem; padding-right: 1rem; line-height: 1.4; }

/* A client reading the version in force before accepting it */
.agreement-text { max-height: min(60vh, 34rem); }
.agreement-accept { margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid var(--line); }
