/* ==========================================================================
   Project Management System — Design System
   Light, clean, professional.
   ========================================================================== */

:root {
  /* Surfaces */
  --canvas:      #F6F7F9;
  --surface:     #FFFFFF;
  --surface-2:   #FAFBFC;
  --surface-3:   #F2F4F7;

  /* Text */
  --text:        #101828;
  --text-2:      #475467;
  --text-3:      #737C8E;

  /* Lines */
  --line:        #E4E7EC;
  --line-2:      #EFF1F4;

  /* Brand */
  --brand:       #4F46E5;
  --brand-hover: #4338CA;
  --brand-soft:  #EEF0FE;
  --brand-line:  #C9CCFA;

  /* Semantic */
  --ok:    #059669;  --ok-soft:   #E7F6F0;
  --warn:  #D97706;  --warn-soft: #FEF3E2;
  --bad:   #DC2626;  --bad-soft:  #FDECEC;
  --info:  #2563EB;  --info-soft: #E8F0FE;

  /* Radii */
  --r-xs: 5px; --r-sm: 7px; --r: 10px; --r-md: 12px; --r-lg: 14px; --r-xl: 18px;

  /* Shadows — soft and shallow, never heavy */
  --sh-xs: 0 1px 2px rgba(16, 24, 40, .05);
  --sh-sm: 0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .04);
  --sh-md: 0 4px 8px -2px rgba(16, 24, 40, .08), 0 2px 4px -2px rgba(16, 24, 40, .05);
  --sh-lg: 0 12px 16px -4px rgba(16, 24, 40, .09), 0 4px 6px -2px rgba(16, 24, 40, .04);
  --sh-xl: 0 24px 48px -12px rgba(16, 24, 40, .18);

  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;

  --sidebar-w: 248px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.011em; color: var(--text); }
h1 { font-size: 24px; letter-spacing: -.021em; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }
p  { margin: 0; }

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

.muted   { color: var(--text-2); }
.faint   { color: var(--text-3); }
.small   { font-size: 13px; }
.xs      { font-size: 12px; }
.mono    { font-family: var(--mono); }
.strong  { font-weight: 600; }
.nowrap  { white-space: nowrap; }
.hidden  { display: none !important; }
.mt-0{margin-top:0}.mt-1{margin-top:8px}.mt-2{margin-top:16px}.mt-3{margin-top:24px}
.mb-0{margin-bottom:0}.mb-1{margin-bottom:8px}.mb-2{margin-bottom:16px}.mb-3{margin-bottom:24px}

/* Every inline icon defaults to a sane size and never stretches in a flex row.
   Context-specific rules below can still override the size. */
svg.ic { width: 18px; height: 18px; flex: none; }

.row          { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row-between  { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.row-end      { display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.spacer       { flex: 1; }

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 38px; padding: 0 15px;
  font: inherit; font-size: 13.5px; font-weight: 550;
  border: 1px solid transparent; border-radius: var(--r-sm);
  cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: background .14s ease, border-color .14s ease, box-shadow .14s ease, color .14s ease;
}
.btn:hover { text-decoration: none; }
.btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; flex: none; }

.btn-primary { background: var(--brand); color: #fff; box-shadow: var(--sh-xs); }
.btn-primary:hover { background: var(--brand-hover); }

.btn-default { background: var(--surface); color: var(--text); border-color: var(--line); box-shadow: var(--sh-xs); }
.btn-default:hover { background: var(--surface-3); }

.btn-subtle { background: transparent; color: var(--text-2); }
.btn-subtle:hover { background: var(--surface-3); color: var(--text); }

.btn-danger { background: var(--bad); color: #fff; }
.btn-danger:hover { background: #B91C1C; }

.btn-danger-soft { background: var(--surface); color: var(--bad); border-color: #F3C9C9; }
.btn-danger-soft:hover { background: var(--bad-soft); }

.btn-sm  { height: 32px; padding: 0 11px; font-size: 13px; }
.btn-xs  { height: 27px; padding: 0 9px;  font-size: 12px; border-radius: var(--r-xs); }
.btn-lg  { height: 44px; padding: 0 20px; font-size: 14.5px; }
.btn-block { width: 100%; }
.btn-icon { width: 34px; padding: 0; }

/* ==========================================================================
   Forms
   ========================================================================== */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label,
.label { font-size: 13px; font-weight: 550; color: var(--text); }
.hint  { font-size: 12px; color: var(--text-3); }
.req   { color: var(--bad); }

input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=search], input[type=url], input:not([type]),
select, textarea {
  width: 100%;
  min-height: 38px;
  padding: 8px 12px;
  font: inherit; font-size: 14px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  box-shadow: var(--sh-xs);
  transition: border-color .14s ease, box-shadow .14s ease;
  appearance: none;
}
textarea { min-height: 84px; resize: vertical; line-height: 1.55; padding-top: 10px; }

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23737C8E' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  padding-right: 32px;
}

input::placeholder, textarea::placeholder { color: #9AA2B1; }

input:focus, select:focus, textarea:focus {
  outline: 0;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, .13);
}
input:disabled, select:disabled, textarea:disabled {
  background: var(--surface-3); color: var(--text-2); cursor: default; box-shadow: none;
}
input[type=range] { min-height: 0; padding: 0; border: 0; box-shadow: none; background: transparent; appearance: auto; }
input[type=checkbox], input[type=radio] { width: 16px; height: 16px; min-height: 0; accent-color: var(--brand); cursor: pointer; }

.check { display: inline-flex; align-items: center; gap: 9px; font-size: 13.5px; color: var(--text); cursor: pointer; }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 16px; }
.span-2 { grid-column: 1 / -1; }
@media (max-width: 760px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

/* ==========================================================================
   Cards / panels
   ========================================================================== */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-sm);
}
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 16px 20px; border-bottom: 1px solid var(--line-2); flex-wrap: wrap;
}
.card-head h2 { font-size: 16px; }
.card-head .sub { font-size: 13px; color: var(--text-2); margin-top: 2px; }
.card-body { padding: 20px; }
.card-body.tight { padding: 14px 20px; }
.card + .card { margin-top: 18px; }

.section-label {
  font-size: 11.5px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase;
  color: var(--text-3); margin-bottom: 10px;
}

/* ==========================================================================
   Alerts
   ========================================================================== */
.alert {
  display: flex; gap: 10px;
  padding: 12px 14px; border-radius: var(--r);
  font-size: 13.5px; line-height: 1.55;
  border: 1px solid; margin-bottom: 16px;
}
.alert > svg.ic { width: 17px; height: 17px; margin-top: 1px; }
.alert > div { min-width: 0; flex: 1; }
.alert p { margin: 3px 0 0; }
.alert p:first-child { margin-top: 0; }
.alert strong { font-weight: 600; }
.alert code {
  font-family: var(--mono); font-size: 12.5px;
  background: rgba(0,0,0,.06); padding: 1px 5px; border-radius: 4px;
}
.alert-ok   { background: var(--ok-soft);   border-color: #B6E3D0; color: #05543B; }
.alert-bad  { background: var(--bad-soft);  border-color: #F5C2C2; color: #8C1D1D; }
.alert-warn { background: var(--warn-soft); border-color: #F5D9A8; color: #7A4708; }
.alert-info { background: var(--info-soft); border-color: #BDD3FA; color: #1A428F; }

/* ==========================================================================
   App shell
   ========================================================================== */
.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w); flex: none;
  display: flex; flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--line);
  position: sticky; top: 0; height: 100vh;
}

.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 18px 16px;
  border-bottom: 1px solid var(--line-2);
}
.brand-mark {
  width: 34px; height: 34px; flex: none;
  display: grid; place-items: center;
  border-radius: 9px;
  background: var(--brand); color: #fff;
  font-size: 13px; font-weight: 700; letter-spacing: .02em;
}
.brand-text b { display: block; font-size: 13.5px; font-weight: 600; line-height: 1.2; }
.brand-text span { font-size: 11.5px; color: var(--text-3); }

.nav { flex: 1; overflow-y: auto; padding: 12px 10px; }
.nav-group { font-size: 11px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase;
             color: var(--text-3); padding: 14px 10px 6px; }
.nav-group:first-child { padding-top: 2px; }

.nav-link {
  display: flex; align-items: center; gap: 10px;
  height: 36px; padding: 0 10px; margin-bottom: 2px;
  border-radius: var(--r-sm);
  font-size: 13.5px; font-weight: 500; color: var(--text-2);
  transition: background .13s ease, color .13s ease;
}
.nav-link:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.nav-link.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.nav-link .ico { width: 17px; height: 17px; flex: none; opacity: .85; }
.nav-link.active .ico { opacity: 1; }
.nav-count {
  margin-left: auto; font-size: 11.5px; font-weight: 600;
  color: var(--text-3); background: var(--surface-3);
  padding: 1px 7px; border-radius: 99px;
}
.nav-link.active .nav-count { background: #fff; color: var(--brand); }

.sidebar-foot { border-top: 1px solid var(--line-2); padding: 10px; }
.who { display: flex; align-items: center; gap: 10px; padding: 6px 8px 10px; }
.avatar {
  width: 32px; height: 32px; flex: none; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand);
  font-size: 12.5px; font-weight: 650;
}
.who-text { min-width: 0; }
.who-text b { display: block; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who-text span { font-size: 11.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex; align-items: center; gap: 14px;
  height: 60px; padding: 0 26px;
  background: rgba(255,255,255,.85);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.crumbs { display: flex; align-items: center; gap: 7px; font-size: 13.5px; color: var(--text-3); min-width: 0; }
.crumbs a { color: var(--text-2); }
.crumbs a:hover { color: var(--text); text-decoration: none; }
.crumbs .sep { color: #C4CAD4; }
.crumbs .now { color: var(--text); font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.content { padding: 26px; max-width: 1240px; width: 100%; margin: 0 auto; }

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head .sub { color: var(--text-2); margin-top: 5px; font-size: 14px; }

.menu-btn { display: none; }

@media (max-width: 900px) {
  .sidebar {
    position: fixed; z-index: 60; left: 0; top: 0;
    transform: translateX(-100%); transition: transform .22s ease;
    box-shadow: var(--sh-xl);
  }
  .sidebar.open { transform: none; }
  .menu-btn { display: inline-flex; }
  .content { padding: 18px 16px 44px; }
  .topbar { padding: 0 16px; }
  .scrim { position: fixed; inset: 0; background: rgba(16,24,40,.4); z-index: 50; }
}

/* ==========================================================================
   Stats
   ========================================================================== */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.stat {
  display: block; padding: 16px 18px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--sh-xs);
  transition: box-shadow .15s ease, border-color .15s ease, transform .15s ease;
}
a.stat:hover { text-decoration: none; box-shadow: var(--sh-md); border-color: #D4D8E0; transform: translateY(-1px); }
.stat-top { display: flex; align-items: center; gap: 9px; }
.stat-ico { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; flex: none; }
.stat-ico svg { width: 16px; height: 16px; }
.stat-name { font-size: 13px; color: var(--text-2); font-weight: 500; }
.stat-num { font-size: 27px; font-weight: 650; letter-spacing: -.02em; margin-top: 10px; }
.stat-sub { font-size: 12px; color: var(--text-3); margin-top: 2px; }

.i-indigo { background: var(--brand-soft); color: var(--brand); }
.i-green  { background: var(--ok-soft);    color: var(--ok); }
.i-blue   { background: var(--info-soft);  color: var(--info); }
.i-amber  { background: var(--warn-soft);  color: var(--warn); }
.i-pink   { background: #FCE8F3;           color: #DB2777; }
.i-violet { background: #F3E8FF;           color: #7C3AED; }

/* ==========================================================================
   Tables
   ========================================================================== */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.tbl th {
  text-align: left; padding: 10px 16px;
  font-size: 11.5px; font-weight: 650; letter-spacing: .04em; text-transform: uppercase;
  color: var(--text-3); background: var(--surface-2);
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
table.tbl td { padding: 13px 16px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
table.tbl tbody tr:last-child td { border-bottom: 0; }
table.tbl tbody tr { transition: background .12s ease; }
table.tbl tbody tr:hover { background: var(--surface-2); }
table.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
table.tbl .actions { text-align: right; white-space: nowrap; }

.empty-row td { padding: 46px 16px !important; text-align: center; color: var(--text-3); }

/* Empty state */
.empty {
  text-align: center; padding: 46px 24px;
  border: 1px dashed var(--line); border-radius: var(--r-lg);
  background: var(--surface-2);
}
.empty-ico {
  width: 44px; height: 44px; margin: 0 auto 12px;
  border-radius: 11px; display: grid; place-items: center;
  background: var(--surface-3); color: var(--text-3);
}
.empty-ico svg { width: 21px; height: 21px; }
.empty h3 { font-size: 14.5px; margin-bottom: 4px; }
.empty p { font-size: 13.5px; color: var(--text-2); max-width: 380px; margin: 0 auto; }
.empty .btn { margin-top: 16px; }

/* ==========================================================================
   Badges / chips / pills
   ========================================================================== */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  height: 22px; padding: 0 9px;
  font-size: 12px; font-weight: 550; border-radius: 99px; white-space: nowrap;
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }

.code-pill {
  display: inline-flex; align-items: center;
  font-family: var(--mono); font-size: 12px; font-weight: 600; letter-spacing: .02em;
  height: 22px; padding: 0 9px; border-radius: var(--r-xs);
  background: var(--surface-3); color: var(--text-2); border: 1px solid var(--line);
}
a.code-pill:hover { background: var(--brand-soft); color: var(--brand); border-color: var(--brand-line); text-decoration: none; }
.code-pill.lg { height: 26px; font-size: 13px; }
.code-pill.brand { background: var(--brand-soft); color: var(--brand); border-color: var(--brand-line); }

.tag {
  display: inline-flex; align-items: center; height: 21px; padding: 0 8px;
  font-size: 11.5px; font-weight: 550; border-radius: var(--r-xs);
  background: var(--surface-3); color: var(--text-2);
}

.prio-urgent { background: var(--bad-soft);  color: var(--bad); }
.prio-high   { background: var(--warn-soft); color: var(--warn); }
.prio-normal { background: var(--surface-3); color: var(--text-2); }
.prio-low    { background: var(--surface-3); color: var(--text-3); }

/* Progress */
.bar { height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; min-width: 60px; }
.bar > i { display: block; height: 100%; border-radius: 99px; background: var(--brand); transition: width .5s cubic-bezier(.4,0,.2,1); }
.bar.tall { height: 8px; }
.bar.ok > i { background: var(--ok); }
.pct { font-size: 12.5px; font-weight: 600; color: var(--text-2); font-variant-numeric: tabular-nums; min-width: 34px; text-align: right; }

/* ==========================================================================
   Toolbar (filters/search)
   ========================================================================== */
.toolbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 14px 20px; border-bottom: 1px solid var(--line-2);
}
.search-field { position: relative; flex: 1; min-width: 200px; }
.search-field svg {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; color: var(--text-3); pointer-events: none;
}
.search-field input { padding-left: 34px; }

.seg { display: inline-flex; background: var(--surface-3); border-radius: var(--r-sm); padding: 3px; gap: 2px; }
.seg a, .seg button {
  height: 28px; padding: 0 11px; border: 0; background: transparent;
  font: inherit; font-size: 12.5px; font-weight: 550; color: var(--text-2);
  border-radius: var(--r-xs); cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
}
.seg a:hover, .seg button:hover { color: var(--text); text-decoration: none; }
.seg a.on, .seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--sh-xs); }

.filter-chips { display: flex; gap: 7px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 30px; padding: 0 11px;
  font-size: 12.5px; font-weight: 500;
  background: var(--surface); color: var(--text-2);
  border: 1px solid var(--line); border-radius: 99px;
  cursor: pointer; transition: all .13s ease;
}
.chip:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.chip.on { background: var(--brand-soft); color: var(--brand); border-color: var(--brand-line); font-weight: 600; }
.chip .cdot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.chip .n { font-size: 11.5px; color: var(--text-3); }
.chip.on .n { color: var(--brand); }

/* ==========================================================================
   Documents
   ========================================================================== */
.doc-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 16px; }
@media (max-width: 1050px) { .doc-grid { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 640px)  { .doc-grid { grid-template-columns: 1fr; } }

.doc {
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); overflow: hidden;
  transition: box-shadow .16s ease, border-color .16s ease, transform .16s ease;
}
.doc:hover { box-shadow: var(--sh-md); border-color: #D4D8E0; transform: translateY(-2px); }

.doc-thumb {
  position: relative; height: 128px;
  display: grid; place-items: center;
  background: var(--surface-2); border-bottom: 1px solid var(--line-2);
  cursor: pointer; overflow: hidden;
}
.doc-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.doc-glyph { width: 46px; height: 46px; border-radius: 11px; display: grid; place-items: center; }
.doc-glyph svg { width: 23px; height: 23px; }
.doc-ext {
  position: absolute; top: 9px; left: 9px;
  font-size: 10px; font-weight: 700; letter-spacing: .05em;
  padding: 3px 7px; border-radius: 4px;
  background: rgba(255,255,255,.94); color: var(--text-2);
  border: 1px solid var(--line); text-transform: uppercase;
}
.doc-info { padding: 12px 14px; flex: 1; min-width: 0; }
.doc-title { font-size: 13.5px; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-meta { font-size: 12px; color: var(--text-3); margin-top: 3px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.doc-desc { font-size: 12.5px; color: var(--text-2); margin-top: 6px; }
.doc-foot { display: flex; gap: 7px; padding: 0 14px 13px; }
.doc-foot .btn { flex: 1; }
.doc-foot .btn-icon { flex: none; }

.t-PDF     { background: #FDECEC; color: #DC2626; }
.t-WORD    { background: #E8F0FE; color: #2563EB; }
.t-IMAGE   { background: #FCE8F3; color: #DB2777; }
.t-SHEET   { background: #E7F6F0; color: #059669; }
.t-SLIDE   { background: #FEF3E2; color: #D97706; }
.t-VIDEO   { background: #F3E8FF; color: #7C3AED; }
.t-AUDIO   { background: #E0F7F5; color: #0D9488; }
.t-ARCHIVE { background: #F2F4F7; color: #475467; }
.t-TEXT    { background: #F2F4F7; color: #475467; }
.t-OTHER   { background: #F2F4F7; color: #737C8E; }

/* List view */
.doc-list { display: flex; flex-direction: column; }
.doc-row {
  display: flex; align-items: center; gap: 13px;
  padding: 11px 20px; border-bottom: 1px solid var(--line-2);
  transition: background .12s ease;
}
.doc-row:last-child { border-bottom: 0; }
.doc-row:hover { background: var(--surface-2); }
.doc-row .doc-glyph { width: 34px; height: 34px; border-radius: 8px; }
.doc-row .doc-glyph svg { width: 17px; height: 17px; }
.doc-row .rname { flex: 1; min-width: 0; }
.doc-row .rname b { display: block; font-size: 13.5px; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Dropzone */
.dropzone {
  border: 1.5px dashed var(--line); border-radius: var(--r-lg);
  padding: 34px 24px; text-align: center;
  background: var(--surface-2);
  transition: border-color .16s ease, background .16s ease;
}
.dropzone.drag { border-color: var(--brand); background: var(--brand-soft); }
.dropzone h3 { font-size: 14.5px; margin-bottom: 4px; }
.dropzone p { font-size: 13px; color: var(--text-2); }

/* ==========================================================================
   Tasks
   ========================================================================== */
.task-list { list-style: none; margin: 0; padding: 0; }
.task {
  display: flex; align-items: center; gap: 14px;
  padding: 13px 20px; border-bottom: 1px solid var(--line-2);
  transition: background .12s ease;
}
.task:last-child { border-bottom: 0; }
.task:hover { background: var(--surface-2); }
.task-body { flex: 1; min-width: 0; }
.task-name {
  font-size: 14px; font-weight: 550; color: var(--text);
  background: none; border: 0; padding: 0; cursor: pointer; text-align: left; font-family: inherit;
}
.task-name:hover { color: var(--brand); }
.task-sub { font-size: 12.5px; color: var(--text-2); margin-top: 2px; }
.task-meta { display: flex; align-items: center; gap: 11px; margin-top: 8px; flex-wrap: wrap; }

/* Timeline */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 18px 22px; }
.timeline li::before {
  content: ""; position: absolute; left: 0; top: 5px;
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--brand);
}
.timeline li::after {
  content: ""; position: absolute; left: 4px; top: 16px; bottom: 0;
  width: 1px; background: var(--line);
}
.timeline li:last-child { padding-bottom: 0; }
.timeline li:last-child::after { display: none; }
.tl-head { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.tl-time { font-size: 12px; color: var(--text-3); margin-top: 3px; }
.tl-note { font-size: 13px; color: var(--text-2); margin-top: 5px; line-height: 1.55; }
.arrow { color: var(--text-3); font-size: 11px; }

/* ==========================================================================
   Modal
   ========================================================================== */
.modal {
  position: fixed; inset: 0; z-index: 100;
  display: none; align-items: center; justify-content: center; padding: 22px;
  background: rgba(16, 24, 40, .5);
  animation: fadeIn .14s ease;
}
.modal.open { display: flex; }
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
@keyframes rise { from { opacity: 0; transform: translateY(8px) scale(.99) } to { opacity: 1; transform: none } }

.modal-box {
  width: 100%; max-width: 620px; max-height: 88vh;
  display: flex; flex-direction: column;
  background: var(--surface); border-radius: var(--r-xl);
  box-shadow: var(--sh-xl); overflow: hidden;
  animation: rise .18s cubic-bezier(.2,.8,.3,1);
}
.modal-box.wide  { max-width: 960px; }
.modal-box.large { max-width: 1120px; }

.modal-head {
  display: flex; align-items: center; gap: 12px;
  padding: 15px 18px; border-bottom: 1px solid var(--line-2);
}
.modal-head h3 { flex: 1; min-width: 0; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.modal-body { padding: 20px; overflow: auto; flex: 1; }
.modal-body.flush { padding: 0; background: var(--surface-2); }
.modal-foot { padding: 14px 18px; border-top: 1px solid var(--line-2); display: flex; justify-content: flex-end; gap: 10px; }

.x {
  width: 30px; height: 30px; flex: none;
  display: grid; place-items: center;
  border: 0; border-radius: var(--r-sm);
  background: transparent; color: var(--text-3);
  cursor: pointer; transition: background .13s ease, color .13s ease;
}
.x:hover { background: var(--surface-3); color: var(--text); }
.x svg { width: 17px; height: 17px; }

/* Viewer */
.viewer-pdf   { width: 100%; height: 72vh; border: 0; display: block; background: #fff; }
.viewer-video { width: 100%; max-height: 70vh; display: block; background: #000; }
.viewer-img   { max-width: 100%; max-height: 72vh; display: block; margin: 0 auto; object-fit: contain; }
.viewer-audio { width: 100%; max-width: 460px; display: block; margin: 26px auto; }
.audio-hero {
  width: 92px; height: 92px; margin: 26px auto 0; border-radius: 22px;
  display: grid; place-items: center; background: #E0F7F5; color: #0D9488;
}
.audio-hero svg { width: 42px; height: 42px; }
.doc-render {
  background: var(--surface); padding: 34px 40px; margin: 18px;
  border: 1px solid var(--line); border-radius: var(--r);
  font-size: 14.5px; line-height: 1.75; color: #1F2937;
}
.doc-render h1,.doc-render h2,.doc-render h3 { margin: 22px 0 9px; }
.doc-render p { margin: 0 0 12px; }
.doc-render table { border-collapse: collapse; width: 100%; margin: 14px 0; font-size: 13.5px; }
.doc-render td, .doc-render th { border: 1px solid var(--line); padding: 8px 11px; }
.doc-render img { max-width: 100%; height: auto; }
.doc-render ul { padding-left: 22px; }

/* ==========================================================================
   Auth + setup pages
   ========================================================================== */
.auth {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 40px 20px; background: var(--canvas);
}
.auth-card { width: 100%; max-width: 400px; }
.setup-card { width: 100%; max-width: 660px; }
.auth-brand { display: flex; align-items: center; gap: 11px; justify-content: center; margin-bottom: 22px; }
.auth-brand .brand-mark { width: 40px; height: 40px; border-radius: 11px; font-size: 14px; }
.auth-brand b { font-size: 17px; font-weight: 650; }
.auth h1 { font-size: 20px; text-align: center; }
.auth .lead { text-align: center; color: var(--text-2); margin-top: 6px; font-size: 13.5px; }

.reqs { list-style: none; margin: 0; padding: 0; }
.reqs li { display: flex; align-items: center; gap: 9px; padding: 9px 0; font-size: 13.5px; border-bottom: 1px solid var(--line-2); }
.reqs li:last-child { border-bottom: 0; }
.reqs .st { margin-left: auto; font-size: 12px; font-weight: 600; }
.reqs .rdot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.reqs .ok  .rdot { background: var(--ok); }   .reqs .ok  .st { color: var(--ok); }
.reqs .bad .rdot { background: var(--bad); }  .reqs .bad .st { color: var(--bad); }
.reqs .wrn .rdot { background: var(--warn); } .reqs .wrn .st { color: var(--warn); }
.reqs .fix { padding: 0 0 10px 17px; font-size: 12.5px; color: var(--text-2); border: 0; display: block; }
.reqs .fix code { font-family: var(--mono); background: var(--surface-3); padding: 1px 5px; border-radius: 4px; }

/* ==========================================================================
   Public tracking page
   ========================================================================== */
.pub { min-height: 100vh; background: var(--canvas); }
.pub-top { background: var(--surface); border-bottom: 1px solid var(--line); padding: 15px 0; }
.pub-wrap { max-width: 780px; margin: 0 auto; padding: 0 20px; }
.pub-main { max-width: 780px; margin: 0 auto; padding: 34px 20px 60px; }
.pub-hero { text-align: center; margin-bottom: 26px; }
.pub-hero h1 { font-size: 26px; }
.pub-hero p { color: var(--text-2); margin-top: 8px; font-size: 14.5px; }

.search-box { display: flex; gap: 10px; }
.search-box input { height: 46px; font-size: 15px; letter-spacing: .02em; }
.search-box .btn { height: 46px; padding: 0 22px; }
@media (max-width: 540px) { .search-box { flex-direction: column; } }

.ring-wrap { display: flex; align-items: center; gap: 20px; }
.ring { position: relative; width: 96px; height: 96px; flex: none; }
.ring svg { transform: rotate(-90deg); display: block; }
.ring b { position: absolute; inset: 0; display: grid; place-items: center; font-size: 21px; font-weight: 650; letter-spacing: -.02em; }

.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 15px; }
.kv > div > b { display: block; font-size: 11px; font-weight: 650; letter-spacing: .05em; text-transform: uppercase; color: var(--text-3); }
.kv > div > span { display: block; font-size: 14px; margin-top: 3px; }

.step { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: var(--r); background: var(--surface-2); }
.step + .step { margin-top: 8px; }
.step .sname { flex: 1; min-width: 0; font-size: 13.5px; }
.step.done { background: var(--ok-soft); }
.step.now  { background: var(--brand-soft); border: 1px solid var(--brand-line); }

/* ==========================================================================
   Share
   ========================================================================== */
.share-link {
  display: flex; gap: 8px; align-items: center;
  padding: 10px 12px; background: var(--surface-2);
  border: 1px solid var(--line); border-radius: var(--r-sm);
}
.share-link input {
  border: 0; background: transparent; box-shadow: none; padding: 0;
  font-family: var(--mono); font-size: 12.5px; min-height: 0;
}
.share-link input:focus { box-shadow: none; }

.copy-ok { color: var(--ok); font-size: 12.5px; font-weight: 600; }

/* Toast */
.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: var(--text); color: #fff;
  padding: 11px 18px; border-radius: var(--r);
  font-size: 13.5px; font-weight: 500; z-index: 200;
  box-shadow: var(--sh-lg); animation: rise .2s ease;
}

@media print {
  .sidebar, .topbar, .btn, .toolbar { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; border-color: #ddd; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* Colour swatch picker */
.swatches { display: flex; gap: 7px; flex-wrap: wrap; }
.swatch {
  width: 28px; height: 28px; border-radius: 50%;
  border: 2px solid transparent; padding: 0; cursor: pointer;
  transition: transform .13s ease, box-shadow .13s ease;
}
.swatch:hover { transform: scale(1.1); }
.swatch.sel { border-color: var(--text); box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--line); }

/* Icon sizes per context */
.badge svg.ic,
.tag svg.ic      { width: 12px; height: 12px; }
.hint svg.ic     { width: 13px; height: 13px; vertical-align: -2px; }
.crumbs svg.ic   { width: 14px; height: 14px; }
.chip svg.ic     { width: 13px; height: 13px; }
.step svg.ic     { width: 14px; height: 14px; }
.btn-xs svg.ic   { width: 13px; height: 13px; }
.btn-sm svg.ic   { width: 15px; height: 15px; }
.seg svg.ic      { width: 14px; height: 14px; }
.x svg.ic        { width: 17px; height: 17px; }
.stat-ico svg.ic { width: 16px; height: 16px; }
.doc-glyph svg.ic{ width: 23px; height: 23px; }
.doc-row .doc-glyph svg.ic { width: 17px; height: 17px; }
.empty-ico svg.ic{ width: 21px; height: 21px; }
.audio-hero svg.ic { width: 42px; height: 42px; }
.nav-link svg.ic { width: 17px; height: 17px; }

/* ==========================================================================
   Photos, logos & avatars
   ========================================================================== */
.avatar-img {
  border-radius: 50%; object-fit: cover; flex: none;
  background: var(--surface-3); border: 1px solid var(--line); display: block;
}
.logo-img {
  border-radius: 9px; object-fit: cover; flex: none;
  background: var(--surface-3); border: 1px solid var(--line); display: block;
}
.logo-fallback {
  border-radius: 9px; flex: none; display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand);
}
.logo-fallback svg.ic { width: 55%; height: 55%; }

.img-editor { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.img-preview {
  width: 84px; height: 84px; flex: none;
  border-radius: 50%; object-fit: cover;
  background: var(--surface-3); border: 1px solid var(--line);
  display: grid; place-items: center; color: var(--text-3);
}
.img-preview.square { border-radius: 14px; }
.img-preview img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; display: block; }
.img-preview svg.ic { width: 28px; height: 28px; }

/* ==========================================================================
   Money
   ========================================================================== */
.money-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }

.money-tile {
  display: flex; flex-direction: column; gap: 3px;
  padding: 15px 17px;
  border: 1px solid var(--line); border-radius: var(--r-lg);
  background: var(--surface-2);
}
.money-tile.ok   { background: var(--ok-soft);   border-color: #BFE7D6; }
.money-tile.warn { background: var(--warn-soft); border-color: #F5DBAE; }
.money-tile.bad  { background: var(--bad-soft);  border-color: #F5C6C6; }

.mt-label { font-size: 11.5px; font-weight: 650; letter-spacing: .04em;
            text-transform: uppercase; color: var(--text-3); }
.money-tile.ok   .mt-label { color: #06795A; }
.money-tile.warn .mt-label { color: #92590A; }
.money-tile.bad  .mt-label { color: #A32020; }
.mt-value { font-size: 21px; font-weight: 650; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.mt-note  { font-size: 11.5px; color: var(--text-3); }
.money-tile.ok .mt-note   { color: #12775C; }
.money-tile.warn .mt-note { color: #96631A; }
.money-tile.bad .mt-note  { color: #A83B3B; }

.bar > i.full { background: var(--ok); }

/* Payment direction chooser */
.dir-opt {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 7px;
  height: 34px; border-radius: var(--r-xs); cursor: pointer;
  font-size: 13px; font-weight: 550; color: var(--text-2);
  transition: background .13s ease, color .13s ease;
}
.dir-opt input { position: absolute; opacity: 0; pointer-events: none; }
.dir-opt:hover { color: var(--text); }
.dir-opt.on { background: var(--surface); color: var(--text); box-shadow: var(--sh-xs); }

/* Accounts table numbers */
table.tbl tfoot td { border-top: 1px solid var(--line); }

/* ==========================================================================
   Upload progress
   ========================================================================== */
/* Floating upload progress card — pinned so it stays visible while a large
   video uploads in the background. */
.up-progress {
  position: fixed; right: 22px; bottom: 22px; z-index: 210;
  width: 320px; max-width: calc(100vw - 44px);
  padding: 14px 16px 12px;
  background: #fff; border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 12px 34px rgba(16, 24, 40, .18);
  animation: rise .2s ease;
}
.up-label {
  font-size: 12.5px; color: var(--text-2); margin-bottom: 8px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.up-pct { font-size: 11.5px; color: var(--text-3); margin-top: 6px; text-align: right; }
.up-bar {
  height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden;
}
.up-bar > i {
  display: block; height: 100%; width: 0; border-radius: 99px;
  background: var(--brand); transition: width .25s ease;
}

/* The document viewer must sit above any modal it was opened from
   (e.g. viewing a receipt from inside the receipts modal). */
#viewerModal { z-index: 130; }

.toast.bad { background: var(--bad); max-width: 90vw; text-align: center; line-height: 1.45; }

/* ==========================================================================
   Project cards — the Projects page in "Cards" view
   ========================================================================== */
.proj-grid {
  display: grid; gap: 18px;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
}
.proj-card {
  display: flex; flex-direction: column;
  padding: 22px 22px 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-xs);
  color: inherit; text-decoration: none;
  transition: box-shadow .16s ease, border-color .16s ease, transform .16s ease;
}
.proj-card:hover {
  text-decoration: none;
  border-color: var(--brand-line);
  box-shadow: var(--sh-lg);
  transform: translateY(-2px);
}
.proj-top {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; margin-bottom: 16px;
}
.proj-card .logo-img,
.proj-card .logo-fallback { border-radius: 14px; }

.proj-name {
  font-size: 19.5px; font-weight: 700; letter-spacing: -.018em;
  line-height: 1.25; color: var(--text); margin: 0;
  overflow-wrap: anywhere;
}
.proj-code {
  font-family: var(--mono); font-size: 11.5px; font-weight: 600;
  letter-spacing: .04em; color: var(--brand); margin-top: 6px;
}
.proj-purpose {
  font-size: 13px; line-height: 1.55; color: var(--text-2);
  margin: 12px 0 0;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.proj-stats {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 10px; margin-top: auto; padding-top: 18px;
}
.proj-stats > div {
  background: var(--surface-2); border: 1px solid var(--line-2);
  border-radius: var(--r-sm); padding: 9px 4px; text-align: center;
}
.proj-stats b { display: block; font-size: 17px; font-weight: 650; color: var(--text); }
.proj-stats span { display: block; font-size: 10.5px; color: var(--text-3); margin-top: 1px; }

.proj-prog { margin-top: 16px; }

/* Bigger, bolder project name in the "List" view too */
.proj-row-name {
  font-size: 15.5px; font-weight: 650; letter-spacing: -.011em;
  color: var(--text); line-height: 1.3;
}
.tbl .logo-img, .tbl .logo-fallback { border-radius: 11px; }

/* ==========================================================================
   Picker tiles — choosing a project on the Documents page
   ========================================================================== */
.pick-grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
}
.pick {
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-areas: "logo body meta" "foot foot foot";
  align-items: center; gap: 14px;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-xs);
  color: inherit; text-decoration: none;
  transition: box-shadow .16s ease, border-color .16s ease, transform .16s ease;
}
.pick:hover {
  text-decoration: none;
  border-color: var(--brand-line);
  box-shadow: var(--sh-lg);
  transform: translateY(-2px);
}
.pick.is-empty { background: var(--surface-2); }
.pick .logo-img, .pick .logo-fallback { grid-area: logo; border-radius: 13px; }
.pick-body { grid-area: body; min-width: 0; }
.pick-name {
  font-size: 16.5px; font-weight: 650; letter-spacing: -.013em;
  color: var(--text); line-height: 1.3;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pick-sub {
  font-size: 12px; color: var(--text-3); margin-top: 3px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pick-meta { grid-area: meta; text-align: right; }
.pick-count { font-size: 21px; font-weight: 700; color: var(--brand); line-height: 1.1; }
.pick.is-empty .pick-count { color: var(--text-3); }
.pick-foot {
  grid-area: foot;
  display: flex; justify-content: space-between; gap: 10px;
  margin-top: 14px; padding-top: 12px;
  border-top: 1px solid var(--line-2);
  font-size: 11.5px; color: var(--text-2);
}

/* ==========================================================================
   Notification bell in the top bar
   ========================================================================== */
.bell {
  position: relative; margin-left: auto; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: var(--r-sm);
  color: var(--text-2); text-decoration: none;
  transition: background .14s ease, color .14s ease;
}
.bell:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.bell.has-new { color: var(--brand); }
.bell-dot {
  position: absolute; top: 1px; right: 0;
  min-width: 17px; height: 17px; padding: 0 4px;
  display: grid; place-items: center;
  background: var(--bad); color: #fff;
  font-size: 10.5px; font-weight: 700; line-height: 1;
  border-radius: 99px; border: 2px solid var(--surface);
}

/* ==========================================================================
   Client reports — the list, and the printable sheet
   ========================================================================== */
.sec-grid {
  display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
}
.sec-opt {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 11px 13px; cursor: pointer;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--r-sm);
  transition: border-color .14s ease, background .14s ease;
}
.sec-opt:hover { border-color: var(--brand-line); }
.sec-opt:has(input:checked) { background: var(--brand-soft); border-color: var(--brand-line); }
.sec-opt input { margin-top: 2px; flex: none; }
.sec-opt b  { display: block; font-size: 13.5px; font-weight: 600; color: var(--text); }
.sec-opt em { display: block; font-size: 11.5px; font-style: normal; color: var(--text-3); margin-top: 2px; line-height: 1.45; }

.rep-row {
  display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap;
  padding: 16px 20px; border-bottom: 1px solid var(--line-2);
}
.rep-row:last-child { border-bottom: 0; }
.rep-row.is-dead { opacity: .55; }
.rep-main { flex: 1; min-width: 260px; }
.rep-side { width: 340px; max-width: 100%; display: flex; flex-direction: column; gap: 8px; }
.rep-title { font-size: 15px; font-weight: 600; color: var(--text); }
.rep-title:hover { color: var(--brand); }

/* ---- the printable sheet ---- */
.rep-page { background: var(--surface-3); }
.rep-bar { background: var(--surface); border-bottom: 1px solid var(--line); }
.rep-bar-in {
  max-width: 860px; margin: 0 auto; padding: 12px 26px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}
.rep-sheet {
  max-width: 860px; margin: 26px auto 60px; padding: 44px 48px 40px;
  background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--sh-sm);
}
.rep-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 20px; flex-wrap: wrap;
  padding-bottom: 16px; border-bottom: 2px solid var(--brand-line);
}
.rep-h2 {
  font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--brand); margin: 30px 0 10px; padding-bottom: 7px;
  border-bottom: 1px solid var(--brand-line);
}
.rep-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.rep-table th {
  text-align: left; font-size: 10px; font-weight: 700; letter-spacing: .05em;
  text-transform: uppercase; color: var(--text-3);
  padding: 9px 10px; background: var(--surface-2); border-bottom: 1px solid var(--line);
}
.rep-table td { padding: 9px 10px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.rep-table tbody tr:nth-child(even) { background: var(--surface-2); }
.rep-table .num { text-align: right; white-space: nowrap; }
.rep-foot {
  margin-top: 34px; padding-top: 14px; border-top: 1px solid var(--line-2);
  font-size: 11px; color: var(--text-3);
}

@media print {
  .no-print { display: none !important; }
  .rep-page { background: #fff; }
  .rep-sheet { margin: 0; padding: 0; border: 0; box-shadow: none; max-width: none; }
  .rep-h2 { page-break-after: avoid; }
  .rep-table { page-break-inside: auto; }
  .rep-table tr { page-break-inside: avoid; }
  @page { margin: 16mm; }
}

/* Inside a report sheet, keep the grids to a fixed, printable rhythm rather
   than auto-fitting — auto-fit gave five ragged columns of labels. */
.rep-sheet .kv { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px 20px; }
.rep-sheet .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.rep-sheet .stat { padding: 14px 16px; }
.rep-sheet .stat-num { font-size: 19px; }
@media (max-width: 720px) {
  .rep-sheet .kv    { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rep-sheet .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media print {
  .rep-sheet .kv    { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .rep-sheet .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* ==========================================================================
   Case stages — the pipeline on a client, and the template list
   ========================================================================== */
.pipe { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.pipe-step { position: relative; display: flex; gap: 14px; padding: 0 0 18px; }
.pipe-step:last-child { padding-bottom: 0; }
/* the connecting line */
.pipe-step::before {
  content: ""; position: absolute; left: 15px; top: 32px; bottom: 0;
  width: 2px; background: var(--line);
}
.pipe-step:last-child::before { display: none; }
.pipe-step.done::before { background: var(--ok); opacity: .35; }

.pipe-dot {
  flex: none; width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center; cursor: pointer;
  background: var(--surface); border: 2px solid var(--line);
  color: var(--text-3); font-size: 12.5px; font-weight: 700;
  transition: transform .14s ease, box-shadow .14s ease;
  position: relative; z-index: 1;
}
.pipe-dot:hover { transform: scale(1.08); box-shadow: var(--sh-sm); }
.pipe-step.done .pipe-dot,
.pipe-step.now  .pipe-dot { color: #fff; }
.pipe-step.now  .pipe-dot { box-shadow: 0 0 0 4px rgba(79, 70, 229, .16); }
.pipe-dot svg { width: 16px; height: 16px; }

.pipe-text { padding-top: 5px; min-width: 0; }
.pipe-name {
  background: none; border: 0; padding: 0; cursor: pointer; font: inherit;
  font-size: 14px; font-weight: 550; color: var(--text); text-align: left;
}
.pipe-name:hover { color: var(--brand); }
.pipe-step.done .pipe-name { color: var(--text-2); }
.pipe-step.now  .pipe-name { font-weight: 650; }

.stage-list { display: flex; flex-direction: column; }
.stage-row {
  display: flex; gap: 14px; align-items: flex-start;
  padding: 14px 20px; border-bottom: 1px solid var(--line-2);
}
.stage-row:last-child { border-bottom: 0; }
.stage-row.is-off { opacity: .6; }
.stage-no {
  flex: none; width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center;
  color: #fff; font-size: 12px; font-weight: 700;
}
.stage-body { flex: 1; min-width: 0; }

/* ==========================================================================
   Task workspace — task.php
   ========================================================================== */

/* Headline figure: the percentage, big enough to read from across the desk. */
.task-hero { display: flex; gap: 22px; align-items: center; flex-wrap: wrap; }
.hero-dial {
  flex: none; width: 118px; padding: 16px 10px; text-align: center;
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--surface-2);
}
.hero-dial.done { border-color: rgba(5, 150, 105, .35); background: rgba(5, 150, 105, .07); }
.dial-num { font-size: 30px; font-weight: 700; line-height: 1; color: var(--text); }
.dial-num span { font-size: 15px; font-weight: 600; color: var(--text-3); margin-left: 1px; }
.hero-dial.done .dial-num { color: var(--ok); }
.dial-cap {
  margin-top: 6px; font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .05em; color: var(--text-3);
}
.hero-fact { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.hero-fact .k {
  font-size: 10.5px; font-weight: 650; letter-spacing: .05em;
  text-transform: uppercase; color: var(--text-3);
}
.hero-fact b { font-size: 13.5px; font-weight: 600; color: var(--text); }

/* The brief: what to do on the left, how to do it on the right. */
.brief-block { min-width: 0; }
.brief-block.instructions {
  border-left: 3px solid var(--brand-line, var(--line));
  padding-left: 16px;
}
.prose {
  font-size: 14px; line-height: 1.7; color: var(--text);
  white-space: pre-line; word-break: break-word;
}

/* Subtasks */
.sub-list { display: flex; flex-direction: column; }
.sub-row {
  display: flex; gap: 13px; align-items: center;
  padding: 12px 20px; border-top: 1px solid var(--line-2);
}
.sub-row:hover { background: var(--surface-2); }
.sub-row.is-done .sub-name { color: var(--text-2); text-decoration: line-through; }
.sub-no {
  flex: none; width: 24px; height: 24px; border-radius: 50%;
  display: grid; place-items: center; font-size: 11.5px; font-weight: 700;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--text-2);
}
.sub-row.is-done .sub-no { background: rgba(5, 150, 105, .12); border-color: rgba(5, 150, 105, .3); color: var(--ok); }
.sub-body { flex: 1; min-width: 0; }
.sub-name { font-size: 13.8px; font-weight: 550; color: var(--text); }
.sub-name:hover { color: var(--brand); }
.sub-set { display: flex; gap: 6px; flex: none; }
.sub-set select { min-width: 118px; font-size: 12.5px; padding: 6px 8px; }
.sub-set select[name="progress"] { min-width: 78px; }
.sub-add {
  display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap;
  border-top: 1px solid var(--line-2); background: var(--surface-2);
}
.sr-label {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* Media and attachments */
.media-group + .media-group { margin-top: 26px; }
.media-grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
}
.media-tile {
  margin: 0; border: 1px solid var(--line); border-radius: var(--r-md);
  overflow: hidden; background: var(--surface);
}
.tile-shot {
  display: block; width: 100%; height: 132px; padding: 0; border: 0;
  cursor: zoom-in; background: var(--surface-2);
}
.tile-shot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.media-tile figcaption { padding: 9px 11px 10px; display: block; }
.tile-name {
  display: block; font-size: 12.5px; font-weight: 550; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tile-acts { display: flex; gap: 5px; margin-top: 7px; }

.player-grid {
  display: grid; gap: 16px; align-items: start;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
}
.player-card {
  border: 1px solid var(--line); border-radius: var(--r-md);
  overflow: hidden; background: var(--surface);
}
.task-player { display: block; width: 100%; }
video.task-player { max-height: 240px; background: #0B1020; }
.audio-strip {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 14px; background: var(--surface-2);
}
.audio-ico {
  flex: none; width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand);
}
.audio-ico svg { width: 19px; height: 19px; }
.audio-strip audio { flex: 1; min-width: 0; }
.player-foot {
  display: flex; justify-content: space-between; align-items: center;
  gap: 10px; padding: 10px 12px; border-top: 1px solid var(--line-2);
}

/* Written progress reports */
.update-feed { display: flex; flex-direction: column; gap: 14px; }
.update-card {
  border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 14px 16px; background: var(--surface);
}
.update-card header { margin-bottom: 10px; }
.upd-block + .upd-block { margin-top: 11px; }
.upd-block .k {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 650; letter-spacing: .05em;
  text-transform: uppercase; color: var(--text-3);
}
.upd-block .k svg { width: 13px; height: 13px; }
.upd-block .prose { margin-top: 3px; font-size: 13.5px; }
.upd-block.done .k    { color: var(--ok); }
.upd-block.pending .k { color: var(--warn); }

/* The assignment panel is shared with the task modal, where it sits inside a
   dialog and drops its own frame. On the full page it needs one back. */
.assign-wrap > .card {
  box-shadow: var(--sh-sm) !important;
  margin-bottom: 18px !important;
  padding: 0 20px 8px;
}

/* ==========================================================================
   Office previews — spreadsheets and slides in the viewer
   ========================================================================== */

/* A workbook is a stack of sheets; keep each one on its own scroller so a
   wide sheet does not stretch the modal. */
.sheet-render { padding: 22px 24px; }
.sheet-block + .sheet-block { margin-top: 26px; }
.sheet-tab {
  display: inline-flex; align-items: baseline; gap: 6px;
  font-size: 12.5px; font-weight: 650; color: var(--text-2);
  background: var(--surface-2); border: 1px solid var(--line);
  border-bottom: 0; border-radius: var(--r-sm) var(--r-sm) 0 0;
  padding: 7px 13px;
}
.sheet-scroll {
  overflow: auto; max-height: 62vh;
  border: 1px solid var(--line); border-radius: 0 var(--r-sm) var(--r-sm) var(--r-sm);
}
.sheet-tbl {
  border-collapse: separate; border-spacing: 0;
  font-size: 13px; width: auto; min-width: 100%; margin: 0 !important;
  font-variant-numeric: tabular-nums;
}
.sheet-tbl th, .sheet-tbl td {
  border: 0; border-right: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2);
  padding: 6px 10px; white-space: nowrap; max-width: 340px;
  overflow: hidden; text-overflow: ellipsis; vertical-align: top;
}
.sheet-tbl thead th {
  position: sticky; top: 0; z-index: 2;
  background: var(--surface-2); color: var(--text-3);
  font-size: 11px; font-weight: 650; text-align: center;
}
.sheet-tbl td.num { text-align: right; }
.sheet-tbl td.rn, .sheet-tbl th.rn {
  position: sticky; left: 0; z-index: 1;
  background: var(--surface-2); color: var(--text-3);
  font-size: 11px; text-align: right; width: 44px; min-width: 44px;
}
.sheet-tbl tbody tr:hover td:not(.rn) { background: var(--brand-soft); }

/* Slides read as a list of cards — title, then what is on the slide. */
.slide-render { padding: 22px 24px; display: flex; flex-direction: column; gap: 14px; }
.slide-card {
  border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 16px 20px 18px; background: var(--surface);
}
.slide-no {
  font-size: 10.5px; font-weight: 650; letter-spacing: .06em;
  text-transform: uppercase; color: var(--text-3); margin-bottom: 6px;
}
.slide-card h3 { margin: 0 0 10px !important; font-size: 16.5px; line-height: 1.35; }
.slide-body { margin: 0; padding-left: 20px; }
.slide-body li { font-size: 14px; line-height: 1.6; margin-bottom: 5px; }

/* ==========================================================================
   The task theme — raised, tactile, a bit of depth
   --------------------------------------------------------------------------
   Scoped to `.t3d`, which is on the <body> of every task page and on the
   Development Tasks / Tasks & Progress card wherever it is embedded. Nothing
   outside a task area is touched, so the rest of the system keeps its flat,
   quiet look.

   The buttons are built from a stack of hard box-shadows rather than a border:
   three 1px layers of a darker shade make the side wall, and a soft shadow
   underneath makes it sit on the page. Pressing moves the button down by
   exactly the height of that wall, so it looks like it goes into the surface.
   ========================================================================== */

.t3d {
  --edge-brand: #3A32B4;
  --edge-grey:  #C4C9D4;
  --edge-red:   #E3B4B4;
  --lift: 3px;
}

/* ---------------------------------------------------------- the buttons -- */
.t3d .btn {
  border: 0;
  border-radius: 9px;
  font-weight: 600;
  letter-spacing: .01em;
  position: relative;
  transition: box-shadow .1s ease, transform .1s ease, filter .14s ease, background .14s ease;
}

.t3d .btn-primary {
  background: linear-gradient(180deg, #6C63F5 0%, #574FE8 48%, #4A41DC 100%);
  color: #fff;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .38),
    inset 0 -1px 0 rgba(0, 0, 0, .12),
    0 1px 0 var(--edge-brand),
    0 2px 0 var(--edge-brand),
    0 3px 0 var(--edge-brand),
    0 5px 10px -2px rgba(58, 50, 180, .42);
}
.t3d .btn-primary:hover { filter: brightness(1.07); }

.t3d .btn-default {
  background: linear-gradient(180deg, #FFFFFF 0%, #F4F6F9 100%);
  color: var(--text);
  box-shadow:
    inset 0 1px 0 #fff,
    0 0 0 1px var(--line),
    0 1px 0 var(--edge-grey),
    0 2px 0 var(--edge-grey),
    0 3px 0 var(--edge-grey),
    0 5px 9px -3px rgba(16, 24, 40, .22);
}
.t3d .btn-default:hover { background: linear-gradient(180deg, #FFFFFF 0%, #EDF0F5 100%); }

.t3d .btn-danger-soft {
  background: linear-gradient(180deg, #FFFFFF 0%, #FDF2F2 100%);
  color: var(--bad);
  box-shadow:
    inset 0 1px 0 #fff,
    0 0 0 1px #F3C9C9,
    0 1px 0 var(--edge-red),
    0 2px 0 var(--edge-red),
    0 3px 0 var(--edge-red),
    0 5px 9px -3px rgba(220, 38, 38, .22);
}
.t3d .btn-danger-soft:hover { background: linear-gradient(180deg, #FFF5F5 0%, #FCE8E8 100%); }

/* Pressing travels the full height of the side wall, so the button really
   does go down into the page rather than just darkening. */
.t3d .btn:not(:disabled):active {
  transform: translateY(var(--lift));
  filter: brightness(.98);
}
.t3d .btn-primary:not(:disabled):active {
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, .28), 0 1px 2px rgba(58, 50, 180, .3);
}
.t3d .btn-default:not(:disabled):active,
.t3d .btn-danger-soft:not(:disabled):active {
  box-shadow: inset 0 2px 4px rgba(16, 24, 40, .17), 0 0 0 1px var(--line);
}

/* A disabled button is flat on the page — nothing to press. */
.t3d .btn:disabled {
  box-shadow: inset 0 0 0 1px var(--line);
  background: var(--surface-3);
  color: var(--text-3);
  filter: none;
  opacity: 1;
}
.t3d .btn-primary:disabled { background: #C7C9E8; color: #fff; box-shadow: none; }

/* Buttons need a little room underneath for the wall they cast. */
.t3d .row-end, .t3d .card-head .row, .t3d .toolbar { align-items: center; }
.t3d .row-end { padding-bottom: 3px; }

/* --------------------------------------------------------- the surfaces -- */
/* The panel gets a coloured header band and a deeper, warmer shadow. */
.t3d.card, .t3d .card {
  border-radius: var(--r-lg);
  box-shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 10px 24px -12px rgba(58, 50, 180, .28);
}

.t3d.card > .card-head,
.t3d .card > .card-head,
.t3d #progress > .card-body:first-child {
  background: linear-gradient(135deg, #F3F2FE 0%, #EFF3FE 55%, #F7F3FE 100%);
  border-bottom: 1px solid #E3E3F8;
  border-radius: var(--r-lg) var(--r-lg) 0 0;
}
.t3d .card > .card-head h2 { letter-spacing: -.01em; }

/* A thin brand rule along the very top of each task card. */
.t3d.card, .t3d .card { position: relative; overflow: hidden; }
.t3d.card::before, .t3d .card::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 3px;
  background: linear-gradient(90deg, #6C63F5, #8B5CF6 45%, #06B6D4);
}
.t3d .modal .card::before, .t3d .assign-wrap > .card::before { display: none; }

/* ------------------------------------------------------------ task rows -- */
.t3d .task-list { padding: 6px; }
.t3d .task {
  margin: 6px; padding: 14px 16px;
  border: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2);
  border-radius: var(--r-md);
  background: linear-gradient(180deg, #FFFFFF 0%, #FCFCFE 100%);
  box-shadow: 0 1px 0 #EDEEF6, 0 2px 5px -2px rgba(16, 24, 40, .1);
}
.t3d .task::before {
  content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--brand-line);
}
.t3d .task { position: relative; }
.t3d .task:hover {
  background: linear-gradient(180deg, #FFFFFF 0%, #F7F7FE 100%);
  border-color: var(--brand-line);
  box-shadow: 0 1px 0 #E6E7F7, 0 6px 14px -6px rgba(58, 50, 180, .3);
}
.t3d .task:hover::before { background: var(--brand); }
.t3d .task-name { font-size: 14.5px; font-weight: 650; }

/* ----------------------------------------------------------- the gauge --- */
.t3d .hero-dial {
  border: 0; border-radius: 18px;
  background: linear-gradient(160deg, #625AF0 0%, #4F46E5 55%, #4038C6 100%);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, .32),
    inset 0 -3px 8px rgba(0, 0, 0, .16),
    0 1px 0 #3A32B4, 0 2px 0 #3A32B4, 0 3px 0 #3A32B4,
    0 10px 20px -6px rgba(58, 50, 180, .45);
}
.t3d .hero-dial .dial-num { color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, .25); }
.t3d .hero-dial .dial-num span { color: rgba(255, 255, 255, .75); }
.t3d .hero-dial .dial-cap { color: rgba(255, 255, 255, .8); }
.t3d .hero-dial.done {
  background: linear-gradient(160deg, #10B981 0%, #059669 55%, #047857 100%);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, .32),
    inset 0 -3px 8px rgba(0, 0, 0, .16),
    0 1px 0 #036B4C, 0 2px 0 #036B4C, 0 3px 0 #036B4C,
    0 10px 20px -6px rgba(5, 150, 105, .45);
}
.t3d .hero-dial.done .dial-num { color: #fff; }

.t3d .hero-fact {
  padding: 8px 13px; border-radius: 10px;
  background: linear-gradient(180deg, #FFFFFF 0%, #F6F7FB 100%);
  box-shadow: inset 0 1px 0 #fff, 0 0 0 1px var(--line-2), 0 2px 4px -2px rgba(16, 24, 40, .12);
}

/* Progress bars get a sunken track and a glossy fill. */
.t3d .bar {
  background: linear-gradient(180deg, #E7E9F2 0%, #EFF1F7 100%);
  box-shadow: inset 0 1px 2px rgba(16, 24, 40, .16);
}
.t3d .bar i {
  background: linear-gradient(180deg, #7C75F8 0%, #4F46E5 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .4);
}

/* ------------------------------------------------------------ subtasks --- */
.t3d .sub-no {
  border: 0; color: #fff;
  background: linear-gradient(160deg, #8B87FA 0%, #6C63F5 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .4),
              0 1px 0 #4A41DC, 0 2px 0 #4A41DC, 0 3px 5px -2px rgba(58, 50, 180, .4);
}
.t3d .sub-row.is-done .sub-no {
  background: linear-gradient(160deg, #34D399 0%, #059669 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .4),
              0 1px 0 #047857, 0 2px 0 #047857, 0 3px 5px -2px rgba(5, 150, 105, .4);
  color: #fff;
}
.t3d .sub-row:hover { background: linear-gradient(90deg, #F7F7FE 0%, #FCFCFF 100%); }
.t3d .sub-set select {
  border-radius: 8px;
  box-shadow: inset 0 1px 0 #fff, 0 0 0 1px var(--line), 0 1px 0 var(--edge-grey), 0 2px 4px -2px rgba(16, 24, 40, .18);
  background: linear-gradient(180deg, #FFFFFF 0%, #F6F7FA 100%);
}

/* -------------------------------------------------------------- extras --- */
.t3d .media-tile, .t3d .player-card, .t3d .update-card, .t3d .slide-card {
  border-radius: 12px;
  box-shadow: 0 1px 0 #EDEEF6, 0 4px 10px -4px rgba(16, 24, 40, .16);
}
.t3d .media-tile:hover, .t3d .player-card:hover {
  box-shadow: 0 1px 0 #E6E7F7, 0 8px 18px -6px rgba(58, 50, 180, .3);
}
.t3d .update-card { border-left: 3px solid var(--brand-line); }
.t3d .tag, .t3d .badge { box-shadow: inset 0 0 0 1px rgba(16, 24, 40, .05); }
.t3d .empty-ico {
  background: linear-gradient(160deg, #EEF0FE 0%, #E4E7FD 100%);
  box-shadow: inset 0 1px 0 #fff, 0 2px 6px -2px rgba(58, 50, 180, .3);
}

/* Someone who has asked for less movement gets the depth without the travel. */
@media (prefers-reduced-motion: reduce) {
  .t3d .btn, .t3d .task { transition: none; }
  .t3d .btn:not(:disabled):active { transform: none; }
}

/* ==========================================================================
   Messenger — the inbox, the thread, the bubbles
   ========================================================================== */
.msgr {
  display: grid; gap: 18px; align-items: start;
  grid-template-columns: 340px minmax(0, 1fr);
}
@media (max-width: 1100px) { .msgr { grid-template-columns: 1fr; } }

.msgr-list { overflow: hidden; }
.msgr-filters { padding: 14px 16px; border-bottom: 1px solid var(--line-2); background: var(--surface-2); }
.msgr-filters .search-field { width: 100%; }

.conv-list { max-height: 66vh; overflow-y: auto; }
.conv {
  display: flex; gap: 11px; align-items: flex-start;
  padding: 13px 16px; border-bottom: 1px solid var(--line-2);
  color: inherit; text-decoration: none;
}
.conv:hover { background: var(--surface-2); text-decoration: none; }
.conv.on { background: var(--brand-soft); box-shadow: inset 3px 0 0 var(--brand); }
.conv.unread b { font-weight: 700; }
.conv-body { flex: 1; min-width: 0; }
.conv-body b { font-size: 13.8px; }
.conv-snip {
  font-size: 12.5px; color: var(--text-2); margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.conv-face {
  flex: none; width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 13px; font-weight: 650; color: #fff;
  background: linear-gradient(160deg, #7C75F8 0%, #4F46E5 100%);
}
.conv-face.lg { width: 44px; height: 44px; font-size: 15px; }

/* "Who is this?" — the one decision an unlinked conversation needs. */
.conv-link {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  padding: 11px 18px; background: var(--surface-2);
  border-bottom: 1px solid var(--line-2);
}

/* the thread */
.thread {
  padding: 18px; overflow-y: auto; max-height: 54vh;
  background:
    radial-gradient(circle at 1px 1px, rgba(16, 24, 40, .045) 1px, transparent 0) 0 0 / 18px 18px,
    var(--surface-2);
}
.thread.mini { max-height: 300px; padding: 14px; border-radius: var(--r-md); border: 1px solid var(--line-2); }
.thread-day { text-align: center; margin: 14px 0 12px; }
.thread-day span {
  font-size: 11px; font-weight: 650; letter-spacing: .04em; text-transform: uppercase;
  color: var(--text-3); background: var(--surface);
  border: 1px solid var(--line); border-radius: 20px; padding: 3px 12px;
}
.bubble-row { display: flex; margin-bottom: 9px; }
.bubble-row.out { justify-content: flex-end; }
.bubble {
  max-width: min(76%, 560px);
  padding: 9px 13px 7px; border-radius: 16px;
  background: var(--surface); border: 1px solid var(--line);
  box-shadow: 0 1px 2px rgba(16, 24, 40, .06);
}
.bubble-row.in  .bubble { border-bottom-left-radius: 5px; }
.bubble-row.out .bubble {
  border-bottom-right-radius: 5px; border-color: transparent; color: #fff;
  background: linear-gradient(180deg, #625AF0 0%, #4F46E5 100%);
}
.bubble.failed {
  background: var(--bad-soft) !important; color: var(--text) !important;
  border-color: #F3C9C9 !important;
}
.bub-text { font-size: 14px; line-height: 1.55; word-break: break-word; }
.bub-meta { font-size: 10.5px; margin-top: 4px; opacity: .72; }
.bubble-row.out .bub-meta { color: rgba(255, 255, 255, .85); }
.bubble.failed .bub-meta { color: var(--text-2); }
.bub-img { display: block; max-width: 260px; border-radius: 10px; margin-top: 6px; }
.bub-file {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 6px;
  font-size: 12.5px; padding: 5px 10px; border-radius: 8px;
  background: rgba(16, 24, 40, .07); color: inherit;
}
.bubble-row.out .bub-file { background: rgba(255, 255, 255, .18); color: #fff; }
.bub-file svg { width: 14px; height: 14px; }
.bub-err { font-size: 11.5px; color: var(--bad); margin-top: 5px; }

/* the reply box */
.composer {
  display: flex; gap: 10px; align-items: flex-end;
  padding: 14px 18px; border-top: 1px solid var(--line-2);
}
.composer textarea { flex: 1; resize: vertical; min-height: 44px; }

/* ==========================================================================
   Voice notes — the recorder and the list
   ========================================================================== */
.recorder {
  display: flex; flex-direction: column; gap: 12px;
  padding: 16px 20px;
  background: linear-gradient(180deg, #FFF5F9 0%, #FDF2F8 100%);
  border-top: 1px solid #FBD5E6; border-bottom: 1px solid #FBD5E6;
}
.rec-face { display: flex; align-items: center; gap: 11px; }
.rec-dot {
  width: 12px; height: 12px; border-radius: 50%; background: #E5E7EB; flex: none;
}
.rec-time {
  font-family: var(--mono); font-size: 26px; font-weight: 600;
  color: var(--text); font-variant-numeric: tabular-nums; line-height: 1;
}
.rec-state {
  font-size: 11.5px; font-weight: 650; letter-spacing: .05em; text-transform: uppercase;
  color: var(--text-3);
}

/* A row of bars that only moves while something is actually being recorded,
   so "is this thing on?" has an answer without a real audio meter. */
.rec-bars { display: flex; align-items: flex-end; gap: 4px; height: 26px; }
.rec-bars i {
  display: block; width: 5px; height: 6px; border-radius: 3px;
  background: #F5C2DA;
}
.rec-bars.live i { animation: recPulse 1s ease-in-out infinite; background: #DB2777; }
.rec-bars.live i:nth-child(2) { animation-delay: .12s; }
.rec-bars.live i:nth-child(3) { animation-delay: .24s; }
.rec-bars.live i:nth-child(4) { animation-delay: .36s; }
.rec-bars.live i:nth-child(5) { animation-delay: .18s; }
.rec-bars.live i:nth-child(6) { animation-delay: .30s; }
.rec-bars.live i:nth-child(7) { animation-delay: .06s; }
@keyframes recPulse { 0%, 100% { height: 6px; } 50% { height: 24px; } }

.recorder .rec-dot { transition: background .2s ease; }
.recorder.live .rec-dot {
  background: #DB2777; box-shadow: 0 0 0 4px rgba(219, 39, 119, .16);
  animation: recBlink 1.4s ease-in-out infinite;
}
@keyframes recBlink { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

.rec-preview { width: 100%; max-width: 460px; }

/* the saved notes */
.voice-list { display: flex; flex-direction: column; gap: 12px; }
.voice-note {
  display: flex; gap: 13px; align-items: flex-start;
  padding: 13px 15px; border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #FFFFFF 0%, #FFF9FC 100%);
  box-shadow: 0 1px 0 #F4E6EE, 0 3px 8px -4px rgba(219, 39, 119, .18);
}
.vn-no {
  flex: none; width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center; font-size: 11.5px; font-weight: 700; color: #fff;
  background: linear-gradient(160deg, #F472B6 0%, #DB2777 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .4), 0 1px 0 #BE185D, 0 2px 0 #BE185D;
}
.vn-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 7px; }
.vn-name {
  font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.vn-player { width: 100%; height: 38px; }
