/* ============================================================================
   Avenir Companies, Admin Portal
   Shared UI shell + components. Brand tokens mirror the public site
   (charcoal #111827, Avenir red #c42b2b, Inter + Playfair Display).
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Playfair+Display:wght@500;600&display=swap');

:root {
  --charcoal:      #111827;
  --charcoal-2:    #1b2230;
  --charcoal-3:    #232d3d;
  --red:           #c42b2b;
  --red-hover:     #a82323;
  --red-soft:      rgba(196,43,43,0.10);
  --ink:           #111827;
  --text:          #1f2937;
  --text-soft:     #6b7280;
  --text-faint:    #9ca3af;
  --line:          #e8eaed;
  --line-soft:     #f1f2f4;
  --bg:            #f6f7f9;
  --surface:       #ffffff;
  --surface-2:     #fbfbfc;

  --teal:          #1f6f6b;
  --gold:          #b8801f;
  --blue:          #3b5b9a;

  --ok:            #16855d;
  --ok-soft:       #e6f5ee;
  --warn:          #b8801f;
  --warn-soft:     #fbf2dd;
  --info:          #3b5b9a;
  --info-soft:     #eaf0fb;
  --muted-soft:    #eef0f3;

  --r-sm: 7px; --r-md: 11px; --r-lg: 16px; --r-pill: 999px;
  --sh-sm: 0 1px 2px rgba(16,24,40,.05), 0 1px 3px rgba(16,24,40,.04);
  --sh-md: 0 4px 12px rgba(16,24,40,.06), 0 2px 4px rgba(16,24,40,.04);
  --sh-lg: 0 14px 40px rgba(16,24,40,.10), 0 4px 10px rgba(16,24,40,.05);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --serif: 'Playfair Display', Georgia, serif;
  --sidebar-w: 264px;
  --topbar-h: 64px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 14px; }

/* ---- App layout --------------------------------------------------------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  background: var(--charcoal);
  color: #cdd3dd;
  position: fixed; inset: 0 auto 0 0;
  display: flex; flex-direction: column;
  z-index: 60;
  border-right: 1px solid rgba(255,255,255,.06);
}
.sidebar-brand {
  display: flex; align-items: center; gap: 11px;
  padding: 20px 22px 18px;
  border-bottom: 1px solid rgba(255,255,255,.07);
}
.sidebar-brand img { height: 30px; width: auto; display: block; filter: brightness(0) invert(1); }
.sidebar-brand .bt { line-height: 1.1; }
.sidebar-brand .bt b { display: block; color: #fff; font-size: 14px; font-weight: 600; letter-spacing: .2px; }
.sidebar-brand .bt span { font-size: 9.5px; letter-spacing: 2px; text-transform: uppercase; color: var(--red); font-weight: 700; }

.sidebar-scroll { overflow-y: auto; flex: 1; padding: 14px 12px 20px; }
.nav-group { margin-bottom: 14px; }
.nav-group-label {
  font-size: 10px; letter-spacing: 1.4px; text-transform: uppercase;
  color: #6b7686; font-weight: 700; padding: 8px 12px 6px;
}
.nav-link {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px; border-radius: var(--r-sm);
  color: #aab2bf; font-size: 13.5px; font-weight: 500;
  transition: background .15s, color .15s; margin-bottom: 2px;
}
.nav-link svg { width: 17px; height: 17px; flex: 0 0 17px; stroke-width: 1.9; }
.nav-link:hover { background: rgba(255,255,255,.05); color: #fff; }
.nav-link.active { background: var(--red); color: #fff; box-shadow: 0 4px 12px rgba(196,43,43,.32); }
.nav-link.active svg { stroke-width: 2.2; }

/* nested nav */
.nav-parent { margin-bottom: 2px; }
.nav-parent-btn { width: 100%; background: none; border: none; text-align: left; font: inherit; }
.nav-chevron { margin-left: auto; width: 14px !important; height: 14px !important; flex: 0 0 14px !important; opacity: .55; transition: transform .2s ease; }
.nav-parent.open > .nav-parent-btn .nav-chevron { transform: rotate(90deg); }
.nav-sub { display: none; margin: 2px 0 8px; padding-left: 30px; }
.nav-parent.open > .nav-sub { display: block; }
.nav-sublink { display: block; padding: 7px 12px; border-radius: var(--r-sm); color: #9098a6; font-size: 12.8px; font-weight: 500; margin-bottom: 1px; position: relative; transition: background .15s, color .15s; }
.nav-sublink:hover { color: #fff; background: rgba(255,255,255,.05); }
.nav-sublink.active { color: #fff; background: rgba(196,43,43,.20); }
.nav-sublink.active::before { content: ""; position: absolute; left: -13px; top: 50%; transform: translateY(-50%); width: 5px; height: 5px; border-radius: 50%; background: var(--red); }

.sidebar-foot {
  border-top: 1px solid rgba(255,255,255,.07);
  padding: 12px 14px; font-size: 11px; color: #6b7686;
}

/* ---- Main column -------------------------------------------------------- */
.main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: var(--topbar-h);
  background: rgba(255,255,255,.86);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px; position: sticky; top: 0; z-index: 40;
}
.topbar-left { display: flex; align-items: center; gap: 14px; min-width: 0; }
.topbar h1 { font-size: 16px; font-weight: 600; color: var(--ink); letter-spacing: -.2px; white-space: nowrap; }
.topbar-crumb { font-size: 11.5px; color: var(--text-faint); text-transform: uppercase; letter-spacing: 1.2px; font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 14px; }

.user-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 6px 6px 14px; border: 1px solid var(--line);
  border-radius: var(--r-pill); background: #fff;
}
.user-chip .who { text-align: right; line-height: 1.2; }
.user-chip .who b { font-size: 12.5px; color: var(--ink); font-weight: 600; display: block; }
.user-chip .who span { font-size: 10.5px; color: var(--text-faint); text-transform: uppercase; letter-spacing: .6px; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--charcoal); color: #fff; display: grid; place-items: center;
  font-size: 12px; font-weight: 600;
}
.btn-ghost-sm {
  display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; line-height: 1;
  background: none; border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: 8px 13px; font-size: 12.5px; font-weight: 600; color: var(--text-soft); cursor: pointer;
}
.btn-ghost-sm svg { width: 16px; height: 16px; flex: 0 0 16px; }
.btn-ghost-sm:hover { border-color: var(--text-faint); color: var(--ink); }

.hamburger { display: none; background: none; border: none; padding: 6px; }
.hamburger span { display: block; width: 20px; height: 2px; background: var(--ink); margin: 4px 0; border-radius: 2px; }

/* ---- Content ------------------------------------------------------------ */
.content { padding: 30px 28px 60px; max-width: 1320px; width: 100%; margin: 0 auto; }
.page-head { margin-bottom: 26px; }
.page-head .eyebrow { font-size: 11px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; color: var(--red); margin-bottom: 8px; display: block; }
.page-head h2 { font-family: var(--serif); font-weight: 600; font-size: 30px; color: var(--ink); letter-spacing: -.3px; line-height: 1.1; }
.page-head p { color: var(--text-soft); margin-top: 8px; max-width: 640px; font-size: 14.5px; }

.section-title { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 1.2px; color: var(--text-faint); margin: 6px 0 14px; }

/* ---- Cards -------------------------------------------------------------- */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); box-shadow: var(--sh-sm);
}
.card-pad { padding: 22px 24px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 24px; border-bottom: 1px solid var(--line-soft); }
.card-head h3 { font-size: 15px; font-weight: 600; color: var(--ink); }
.card-head .sub { font-size: 12.5px; color: var(--text-faint); }

.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }

/* Stat cards */
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 18px 20px; box-shadow: var(--sh-sm); position: relative; overflow: hidden; }
.stat .label { font-size: 12px; color: var(--text-soft); font-weight: 600; letter-spacing: .2px; }
.stat .value { font-size: 27px; font-weight: 700; color: var(--ink); margin-top: 7px; letter-spacing: -.5px; font-variant-numeric: tabular-nums; }
.stat .delta { font-size: 11.5px; color: var(--text-faint); margin-top: 5px; }
.stat .accent-bar { position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--red); }

/* Module / workstream cards (dashboard) */
.module {
  display: flex; flex-direction: column; gap: 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 22px; box-shadow: var(--sh-sm); transition: transform .18s, box-shadow .18s, border-color .18s;
  position: relative; overflow: hidden;
}
.module::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--m-accent, var(--red)); }
.module:hover { transform: translateY(-3px); box-shadow: var(--sh-lg); border-color: #dfe2e7; }
.module .m-icon { width: 42px; height: 42px; border-radius: var(--r-md); display: grid; place-items: center; background: var(--m-soft, var(--red-soft)); color: var(--m-accent, var(--red)); }
.module .m-icon svg { width: 21px; height: 21px; stroke-width: 1.9; }
.module h3 { font-size: 16px; font-weight: 600; color: var(--ink); }
.module p { font-size: 13px; color: var(--text-soft); line-height: 1.5; flex: 1; }
.module .m-foot { display: flex; align-items: center; justify-content: space-between; font-size: 12.5px; color: var(--text-faint); font-weight: 600; }
.module .m-foot .go { color: var(--m-accent, var(--red)); display: inline-flex; align-items: center; gap: 5px; }

/* ---- Badges / pills ----------------------------------------------------- */
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600; padding: 4px 11px; border-radius: var(--r-pill); letter-spacing: .2px; white-space: nowrap; }
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill-ok { background: var(--ok-soft); color: var(--ok); }
.pill-warn { background: var(--warn-soft); color: var(--warn); }
.pill-info { background: var(--info-soft); color: var(--info); }
.pill-muted { background: var(--muted-soft); color: var(--text-soft); }
.pill-red { background: var(--red-soft); color: var(--red); }
.pill-paid { background: var(--ok-soft); color: var(--ok); }
.pill-unpaid { background: var(--muted-soft); color: var(--text-soft); }

.tag { display: inline-flex; align-items: center; font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: var(--r-sm); background: var(--muted-soft); color: var(--text-soft); }

/* ---- Tables ------------------------------------------------------------- */
.table-wrap { overflow-x: auto; border-radius: var(--r-md); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl thead th {
  text-align: left; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .8px;
  color: var(--text-faint); padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap;
}
table.tbl tbody td { padding: 13px 16px; border-bottom: 1px solid var(--line-soft); color: var(--text); vertical-align: middle; }
table.tbl tbody tr:hover { background: var(--surface-2); }
table.tbl tbody tr:last-child td { border-bottom: none; }
table.tbl td.num, table.tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.tbl .strong { font-weight: 600; color: var(--ink); }
tfoot.tbl-foot td { padding: 13px 16px; border-top: 2px solid var(--line); font-weight: 700; color: var(--ink); background: var(--surface-2); font-variant-numeric: tabular-nums; }

/* ---- Buttons ------------------------------------------------------------ */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 18px; border-radius: var(--r-sm); font-size: 13px; font-weight: 600; border: 1px solid transparent; transition: all .15s; letter-spacing: .2px; }
.btn svg { width: 15px; height: 15px; }
.btn-primary { background: var(--red); color: #fff; box-shadow: 0 4px 12px rgba(196,43,43,.25); }
.btn-primary:hover { background: var(--red-hover); transform: translateY(-1px); box-shadow: 0 6px 16px rgba(196,43,43,.32); }
.btn-dark { background: var(--charcoal); color: #fff; }
.btn-dark:hover { background: var(--charcoal-3); transform: translateY(-1px); }
.btn-outline { background: #fff; border-color: var(--line); color: var(--text); }
.btn-outline:hover { border-color: var(--text-faint); color: var(--ink); }
.btn-sm { padding: 7px 13px; font-size: 12px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; transform: none !important; }

.btn-link { background: none; border: none; color: var(--red); font-weight: 600; font-size: 12.5px; padding: 0; }
.btn-link:hover { text-decoration: underline; }

/* ---- Forms -------------------------------------------------------------- */
.field { margin-bottom: 16px; }
.field > label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text); margin-bottom: 7px; }
.field .hint { font-size: 11.5px; color: var(--text-faint); margin-top: 5px; }
.field .req { color: var(--red); }
.input, .select, .textarea {
  width: 100%; padding: 10px 13px; border: 1px solid var(--line); border-radius: var(--r-sm);
  background: #fff; color: var(--text); transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }
.textarea { resize: vertical; min-height: 84px; line-height: 1.55; }
.select { appearance: none; background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.2' stroke-linecap='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
fieldset { border: none; }
.form-section { padding-top: 6px; margin-top: 6px; }
.form-section-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: var(--text-faint); padding-bottom: 6px; border-bottom: 1px solid var(--line-soft); margin-bottom: 16px; }

/* ---- Notices / banners -------------------------------------------------- */
.notice { display: flex; gap: 12px; padding: 14px 16px; border-radius: var(--r-md); font-size: 13px; line-height: 1.5; }
.notice svg { width: 18px; height: 18px; flex: 0 0 18px; margin-top: 1px; }
.notice-info { background: var(--info-soft); color: #2c477c; }
.notice-warn { background: var(--warn-soft); color: #8a5f15; }
.notice-lock { background: #fdecec; color: #8e2020; }
.notice-ok { background: var(--ok-soft); color: #0f6a49; }
.notice b { font-weight: 700; }

/* TODO ribbon for placeholders/dev work */
.todo-flag { font-size: 11px; font-weight: 700; color: var(--gold); background: var(--warn-soft); padding: 2px 8px; border-radius: var(--r-sm); letter-spacing: .4px; }

/* ---- Empty state -------------------------------------------------------- */
.empty { text-align: center; padding: 46px 20px; color: var(--text-faint); }
.empty svg { width: 34px; height: 34px; margin-bottom: 12px; opacity: .5; }
.empty p { font-size: 13.5px; }

/* ---- Toolbar / filters -------------------------------------------------- */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 18px; }
.toolbar .grow { flex: 1; }
.filter-bar { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.filter-bar .field { margin-bottom: 0; min-width: 150px; }

/* ---- Tabs --------------------------------------------------------------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 22px; flex-wrap: wrap; }
.tab { padding: 10px 16px; font-size: 13px; font-weight: 600; color: var(--text-soft); border-bottom: 2px solid transparent; margin-bottom: -1px; background: none; border-top: none; border-left: none; border-right: none; }
.tab:hover { color: var(--ink); }
.tab.active { color: var(--red); border-bottom-color: var(--red); }

/* ---- Doc list ----------------------------------------------------------- */
.doc-row { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border: 1px solid var(--line); border-radius: var(--r-sm); margin-bottom: 8px; background: #fff; transition: border-color .15s, box-shadow .15s; }
.doc-row:hover { border-color: var(--red); box-shadow: var(--sh-sm); }
.doc-row .ic { width: 32px; height: 32px; border-radius: var(--r-sm); background: var(--red-soft); color: var(--red); display: grid; place-items: center; flex: 0 0 32px; }
.doc-row .ic svg { width: 16px; height: 16px; }
.doc-row .t { flex: 1; font-size: 13.5px; font-weight: 500; color: var(--ink); }
.doc-row .ext { color: var(--text-faint); }

/* ---- Modal -------------------------------------------------------------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(17,24,39,.5); backdrop-filter: blur(2px); z-index: 100; display: none; align-items: flex-start; justify-content: center; padding: 40px 18px; overflow-y: auto; }
.modal-backdrop.open { display: flex; }
.modal { background: #fff; border-radius: var(--r-lg); box-shadow: var(--sh-lg); width: 100%; max-width: 560px; animation: pop .18s ease; }
.modal-lg { max-width: 760px; }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.99); } to { opacity: 1; transform: none; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--line-soft); }
.modal-head h3 { font-size: 16px; font-weight: 600; color: var(--ink); }
.modal-body { padding: 22px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 22px; border-top: 1px solid var(--line-soft); }
.x-btn { background: none; border: none; color: var(--text-faint); font-size: 22px; line-height: 1; padding: 4px; }
.x-btn:hover { color: var(--ink); }

/* ---- Misc helpers ------------------------------------------------------- */
.muted { color: var(--text-soft); }
.faint { color: var(--text-faint); }
.mono { font-variant-numeric: tabular-nums; }
.flex { display: flex; }
.between { justify-content: space-between; }
.items-center { align-items: center; }
.gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; } .mt-32 { margin-top: 32px; }
.mb-0 { margin-bottom: 0; } .mb-16 { margin-bottom: 16px; } .mb-24 { margin-bottom: 24px; }
.text-right { text-align: right; }
.nowrap { white-space: nowrap; }
.hide { display: none !important; }

/* ---- Permission matrix / settings -------------------------------------- */
.perm-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.perm-table th { text-align: center; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--text-faint); padding: 10px 12px; border-bottom: 1px solid var(--line); }
.perm-table th:first-child { text-align: left; }
.perm-table td { padding: 10px 12px; border-bottom: 1px solid var(--line-soft); text-align: center; }
.perm-table td:first-child { text-align: left; color: var(--ink); font-weight: 500; }
.perm-table tr:hover { background: var(--surface-2); }
.perm-table .grp { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: var(--text-faint); background: var(--surface-2); }
input[type="checkbox"].chk { width: 17px; height: 17px; accent-color: var(--red); cursor: pointer; }
input[type="checkbox"].chk:disabled { opacity: .45; cursor: not-allowed; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-rm { display: inline-flex; align-items: center; gap: 7px; padding: 5px 6px 5px 12px; border: 1px solid var(--line); border-radius: var(--r-pill); font-size: 12.5px; background: #fff; }
.chip-rm button { background: none; border: none; color: var(--text-faint); width: 18px; height: 18px; border-radius: 50%; line-height: 1; font-size: 14px; }
.chip-rm button:hover { background: var(--red-soft); color: var(--red); }

/* ---- Task manager (ClickUp-style) --------------------------------------- */
.quickadd { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 10px 12px; box-shadow: var(--sh-sm); margin-bottom: 18px; }
.quickadd .input, .quickadd .select { height: 38px; }
.quickadd .grow { flex: 1; min-width: 180px; }

.prio-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; vertical-align: middle; margin-right: 6px; }
.prio-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: var(--r-pill); }

/* Board / kanban */
.board { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 12px; align-items: flex-start; }
.board-col { flex: 0 0 270px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-md); display: flex; flex-direction: column; max-height: calc(100vh - 230px); }
.board-col.drop-hover { outline: 2px dashed var(--red); outline-offset: -2px; }
.board-col-head { display: flex; align-items: center; justify-content: space-between; padding: 11px 13px; border-bottom: 1px solid var(--line); position: sticky; top: 0; }
.board-col-head .nm { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 700; }
.board-col-head .ct { font-size: 11px; font-weight: 700; color: var(--text-faint); background: #fff; border: 1px solid var(--line); border-radius: var(--r-pill); padding: 1px 8px; }
.board-col-body { padding: 10px; overflow-y: auto; display: flex; flex-direction: column; gap: 9px; min-height: 40px; }
.tcard { background: #fff; border: 1px solid var(--line); border-radius: var(--r-md); padding: 11px 12px; box-shadow: var(--sh-sm); cursor: grab; transition: box-shadow .15s, transform .05s; }
.tcard:hover { box-shadow: var(--sh-md); }
.tcard:active { cursor: grabbing; }
.tcard.dragging { opacity: .5; }
.tcard .t { font-size: 13px; font-weight: 600; color: var(--ink); line-height: 1.35; margin-bottom: 8px; }
.tcard .meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: 11.5px; color: var(--text-soft); }
.tcard .meta .due.over { color: var(--red); font-weight: 700; }
.tcard .who { display: inline-flex; align-items: center; gap: 5px; }
.avatar-xs { width: 20px; height: 20px; border-radius: 50%; background: var(--charcoal); color: #fff; display: grid; place-items: center; font-size: 9px; font-weight: 700; }
.tcard .links a { color: var(--text-faint); }
.tcard .links a:hover { color: var(--red); }

/* My Work columns */
.mywork { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.mywork .card-head .ct { font-size: 11px; font-weight: 700; color: var(--text-faint); }

/* Calendar */
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.cal-dow { background: var(--surface-2); text-align: center; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--text-faint); padding: 8px 0; }
.cal-cell { background: #fff; min-height: 92px; padding: 6px; }
.cal-cell.dim { background: var(--surface-2); }
.cal-cell .d { font-size: 11px; font-weight: 700; color: var(--text-faint); }
.cal-cell.today .d { color: #fff; background: var(--red); border-radius: 50%; width: 20px; height: 20px; display: grid; place-items: center; }
.cal-task { font-size: 10.5px; padding: 2px 6px; border-radius: var(--r-xs); margin-top: 4px; color: #fff; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Subtasks / timer */
.subtask-row { display: flex; align-items: center; gap: 9px; padding: 7px 0; border-bottom: 1px solid var(--line-soft); font-size: 13px; }
.subtask-row input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--ok); }
.subtask-row.done .st { text-decoration: line-through; color: var(--text-faint); }
.timer-live { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--ok); }

/* ---- Progress bar ------------------------------------------------------- */
.progress-wrap { height: 6px; background: var(--line); border-radius: 999px; overflow: hidden; margin: 2px 0; }
.progress-bar { height: 100%; border-radius: 999px; background: var(--red); transition: width .3s ease; }

/* ---- Icon buttons (inline link badges) ---------------------------------- */
.iconbtn { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: var(--r-sm); border: 1px solid var(--line); color: var(--text-soft); margin-right: 5px; transition: all .15s; }
.iconbtn:hover { border-color: var(--red); color: var(--red); }
.iconbtn svg { width: 15px; height: 15px; }

/* ---- PDF preview -------------------------------------------------------- */
.pdf-frame { width: 100%; height: 62vh; min-height: 420px; border: 1px solid var(--line); border-radius: var(--r-md); background: #525659; }
.pdf-toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: flex-end; }
.pdf-toolbar .grow { flex: 1; }

/* ---- Searchbox ---------------------------------------------------------- */
.searchbox { position: relative; }
.searchbox svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--text-faint); }
.searchbox input { padding-left: 36px; }

/* ---- Scrollbar ---------------------------------------------------------- */
.sidebar-scroll::-webkit-scrollbar { width: 6px; }
.sidebar-scroll::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 3px; }

/* ---- Mobile ------------------------------------------------------------- */
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(17,24,39,.45); z-index: 55; }
@media (max-width: 1080px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 960px) {
  .sidebar { transform: translateX(-100%); transition: transform .25s ease; }
  .app.nav-open .sidebar { transform: translateX(0); }
  .app.nav-open .sidebar-overlay { display: block; }
  .main { margin-left: 0; }
  .hamburger { display: block; }
  .nav-collapse-btn { display: none; }          /* desktop-only control */
  .app.nav-collapsed { --sidebar-w: 264px; }     /* never shrink the mobile drawer */
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .form-row-3 { grid-template-columns: 1fr 1fr; }
}

/* ---- Desktop collapsible sidebar --------------------------------------- */
.nav-collapse-btn {
  position: fixed; top: calc(var(--topbar-h) + 16px); left: var(--sidebar-w);
  transform: translateX(-50%);
  width: 26px; height: 26px; border-radius: 50%;
  background: #fff; border: 1px solid var(--line); color: var(--text-soft);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  z-index: 65; box-shadow: 0 2px 6px rgba(17,24,39,.12);
  transition: left .22s ease, background .15s, color .15s;
}
.nav-collapse-btn:hover { color: var(--ink); background: #f8fafc; }
.nav-collapse-btn svg { width: 15px; height: 15px; transition: transform .22s ease; transform: rotate(180deg); }
.app.nav-collapsed .nav-collapse-btn svg { transform: rotate(0deg); }
.sidebar, .main { transition: width .22s ease, margin-left .22s ease; }
@media (min-width: 961px) {
  .app.nav-collapsed { --sidebar-w: 74px; }
  .app.nav-collapsed .sidebar-brand { justify-content: center; padding-left: 0; padding-right: 0; gap: 0; }
  .app.nav-collapsed .sidebar-brand .bt { display: none; }
  .app.nav-collapsed .nav-link { justify-content: center; padding-left: 0; padding-right: 0; }
  .app.nav-collapsed .nav-link span { display: none; }
  .app.nav-collapsed .nav-chevron { display: none; }
  .app.nav-collapsed .nav-sub { display: none !important; }
  .app.nav-collapsed .sidebar-foot { display: none; }
}
@media (max-width: 640px) {
  .content { padding: 22px 16px 50px; }
  .topbar { padding: 0 16px; }
  .grid-2, .grid-3, .grid-4, .grid-auto { grid-template-columns: 1fr; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .user-chip .who { display: none; }
  .page-head h2 { font-size: 25px; }
  .topbar h1 { font-size: 15px; }
}
