/* TrackerTed — Inter, black/slate, one green accent. */

@font-face { font-family: 'Inter'; src: url('/fonts/Inter-Regular.ttf') format('truetype'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Inter'; src: url('/fonts/Inter-Medium.ttf') format('truetype'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Inter'; src: url('/fonts/Inter-SemiBold.ttf') format('truetype'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Inter'; src: url('/fonts/Inter-Bold.ttf') format('truetype'); font-weight: 700; font-display: swap; }

:root {
  /* Brand */
  --green: #00D539;        /* accent only — never text on white */
  --green-ink: #00601A;    /* green wording */
  --green-pale: #F0FCF3;
  --green-soft: #D9F9E1;
  --black: #000000;
  --ink: #111111;
  --slate: #414042;
  --body: #1D1D1D;
  --muted: #6B7280;
  --divider: #E5E7EB;
  --row-alt: #F7F9FC;
  /* Status */
  --amber: #F59E0B; --amber-tint: #FEF3C7; --amber-ink: #92400E;
  --red: #DC2626; --red-tint: #FEE2E2; --red-ink: #991B1B;
  --blue: #1D4ED8; --blue-tint: #EFF4FF;
  /* Surfaces */
  --page: #F4F5F7;
  --surface: #FFFFFF;
  --list-bg: #F1F2F4;
  --hover: #E9EBEE;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow-card: 0 1px 1px rgba(9, 30, 66, .25), 0 0 1px rgba(9, 30, 66, .31);
  --shadow-pop: 0 8px 28px rgba(9, 30, 66, .22), 0 0 1px rgba(9, 30, 66, .31);
  --topbar-h: 52px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  color: var(--body);
  background: var(--page);
  -webkit-font-smoothing: antialiased;
}
#app { min-height: 100%; display: flex; flex-direction: column; }
h1, h2, h3, h4 { margin: 0; color: var(--ink); font-weight: 600; }
h1 { font-size: 22px; }
h2 { font-size: 16px; }
h3 { font-size: 15px; }
h4 { font-size: 12px; }
a { color: var(--green-ink); }
p { margin: 0 0 10px; }
code { background: var(--row-alt); border: 1px solid var(--divider); padding: 1px 5px; border-radius: 4px; font-size: 12.5px; }
hr { border: 0; border-top: 1px solid var(--divider); margin: 8px 0; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.center { text-align: center; }
.grow { flex: 1; min-width: 0; }
.spacer { flex: 1; }
.row { display: flex; align-items: center; gap: 8px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.end { justify-content: flex-end; }
.boot, .loading { padding: 40px; color: var(--muted); text-align: center; }
.ic { flex: none; vertical-align: -3px; }

/* --- Buttons ------------------------------------------------------------- */

button, .btn { font: inherit; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 14px; border-radius: 6px; border: 0; cursor: pointer;
  background: #E9EBEE; color: var(--ink); font-weight: 500; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: #DCDFE4; }
.btn.primary { background: var(--green); color: var(--black); font-weight: 600; }
.btn.primary:hover { background: #00BF33; }
.btn.danger { background: var(--red); color: #fff; }
.btn.danger:hover { background: #B91C1C; }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--hover); }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.btn.block { display: flex; width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border: 0; border-radius: 6px; background: transparent; color: inherit; cursor: pointer; flex: none;
}
.icon-btn:hover { background: rgba(9, 30, 66, .08); }
.icon-btn:disabled { opacity: .35; cursor: default; }
.icon-btn.light { background: #E9EBEE; }
.link { background: none; border: 0; padding: 0; color: var(--green-ink); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; font: inherit; display: inline-flex; align-items: center; gap: 4px; }
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 99px; font-size: 12px; font-weight: 500; background: #E9EBEE; color: var(--slate); }
.pill.green { background: var(--green-soft); color: var(--green-ink); }
.pill.amber { background: var(--amber-tint); color: var(--amber-ink); }

/* --- Forms --------------------------------------------------------------- */

.form { display: flex; flex-direction: column; gap: 12px; }
.form label, label.inline { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; color: var(--slate); }
label.inline { flex-direction: row; align-items: center; gap: 8px; }
.form label.check, label.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 400; font-size: 14px; color: var(--body); cursor: pointer; }
input, select, textarea {
  font: inherit; font-weight: 400; font-size: 14px; color: var(--body);
  border: 1px solid #C9CDD3; border-radius: 6px; padding: 7px 10px; background: #fff; width: 100%;
}
input[type=checkbox], input[type=radio] { width: 16px; height: 16px; padding: 0; accent-color: var(--green-ink); flex: none; }
input[type=file] { padding: 6px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--green); outline-offset: -1px; border-color: transparent; }
select { padding-right: 28px; }
select:disabled { background: var(--row-alt); color: var(--muted); }
textarea { resize: vertical; line-height: 1.45; }
fieldset { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
legend { font-size: 12px; font-weight: 600; color: var(--slate); padding: 0; margin-bottom: 6px; }
.form-error { color: var(--red-ink); font-size: 13px; min-height: 0; }
.form-error:empty { display: none; }
.narrow-form { max-width: 420px; }
:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }

/* --- Colours ------------------------------------------------------------- */

.bg-ink    { background: linear-gradient(135deg, #111111 0%, #2B2B2D 100%); }
.bg-slate  { background: linear-gradient(135deg, #414042 0%, #5E5D60 100%); }
.bg-forest { background: linear-gradient(135deg, #00601A 0%, #003B10 100%); }
.bg-green  { background: linear-gradient(135deg, #00B830 0%, #00601A 100%); }
.bg-ocean  { background: linear-gradient(135deg, #1D4ED8 0%, #1E3A8A 100%); }
.bg-teal   { background: linear-gradient(135deg, #0F766E 0%, #134E4A 100%); }
.bg-plum   { background: linear-gradient(135deg, #6D28D9 0%, #4C1D95 100%); }
.bg-wine   { background: linear-gradient(135deg, #9F1239 0%, #6B0F2A 100%); }
.bg-earth  { background: linear-gradient(135deg, #92400E 0%, #5C2A0B 100%); }
.bg-steel  { background: linear-gradient(135deg, #64748B 0%, #334155 100%); }

.lc-green  { background: #00D539; color: #00330E; }
.lc-yellow { background: #F5CD47; color: #4A3804; }
.lc-orange { background: #FEA362; color: #5F2700; }
.lc-red    { background: #F87168; color: #5D1F1A; }
.lc-purple { background: #9F8FEF; color: #2B2257; }
.lc-blue   { background: #579DFF; color: #09326C; }
.lc-sky    { background: #6CC3E0; color: #133E4C; }
.lc-lime   { background: #94C748; color: #2E3B19; }
.lc-pink   { background: #E774BB; color: #4A2039; }
.lc-black  { background: #414042; color: #FFFFFF; }

.uc-ink { background: #111111; } .uc-slate { background: #414042; } .uc-forest { background: #00601A; }
.uc-ocean { background: #1D4ED8; } .uc-teal { background: #0F766E; } .uc-plum { background: #6D28D9; }
.uc-wine { background: #9F1239; } .uc-earth { background: #92400E; } .uc-none { background: #DCDFE4; color: var(--slate) !important; }

/* --- Avatars & labels ---------------------------------------------------- */

.avatar {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  border-radius: 50%; color: #fff; font-weight: 600; letter-spacing: .02em; user-select: none;
}
.av-sm { width: 24px; height: 24px; font-size: 10px; }
.av-md { width: 28px; height: 28px; font-size: 11px; }
.av-lg { width: 32px; height: 32px; font-size: 12px; }
.av-xl { width: 56px; height: 56px; font-size: 20px; }
.avatar.more { background: #DCDFE4; color: var(--slate); }

.lbl {
  display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 12px; font-weight: 600; line-height: 16px; padding: 0 8px; border-radius: 4px; min-width: 40px; height: 16px;
}
.lbl.empty { min-width: 40px; height: 8px; padding: 0; }
.lbl.big { height: 28px; line-height: 28px; padding: 0 12px; font-size: 13px; min-width: 48px; border-radius: 4px; }
.lbl.big.empty { height: 28px; }

/* --- Toasts -------------------------------------------------------------- */

#toast-root { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 400; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 8px; box-shadow: var(--shadow-pop); font-size: 13.5px; max-width: 90vw; transition: opacity .4s, transform .4s; border-left: 4px solid var(--green); }
.toast.error { border-left-color: var(--red); }
.toast.out { opacity: 0; transform: translateY(8px); }

/* --- Auth ---------------------------------------------------------------- */

.auth { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px; background: var(--page); }
.auth-card { width: 100%; max-width: 400px; background: #fff; border-radius: var(--radius-lg); padding: 32px; box-shadow: var(--shadow-pop); border-top: 4px solid var(--green); }
.auth-card h1 { font-size: 18px; margin: 20px 0 8px; }
.auth-wordmark { font-size: 30px; font-weight: 700; letter-spacing: -.02em; color: var(--ink); line-height: 1; }
.auth-wordmark span { color: var(--green-ink); }
.auth-card .form { margin: 16px 0; }
.auth-foot { margin-top: 16px; color: var(--muted); font-size: 12px; }

/* --- Top bar ------------------------------------------------------------- */

.topbar {
  height: var(--topbar-h); flex: none; display: flex; align-items: center; gap: 12px; padding: 0 12px;
  background: var(--black); color: #fff; position: sticky; top: 0; z-index: 50;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: #fff; padding: 4px 6px; border-radius: 6px; }
.brand-product { font-weight: 700; font-size: 17px; letter-spacing: -.01em; }
.brand-product span { color: var(--green); }
.topnav { display: flex; gap: 2px; }
.topnav a { color: #D1D5DB; text-decoration: none; padding: 6px 10px; border-radius: 6px; font-weight: 500; }
.topnav a:hover { background: #1F1F21; color: #fff; }
.topnav a.active { color: #fff; box-shadow: inset 0 -2px 0 var(--green); border-radius: 6px 6px 0 0; }
.search { position: relative; display: flex; align-items: center; width: min(340px, 34vw); }
.search > .ic { position: absolute; left: 10px; color: #9CA3AF; pointer-events: none; }
.search input { background: #1F1F21; border: 1px solid #3A3A3C; color: #fff; padding: 6px 10px 6px 32px; border-radius: 6px; }
.search input::placeholder { color: #9CA3AF; }
.search input:focus { background: #fff; color: var(--body); }
.search-results {
  position: absolute; top: calc(100% + 6px); right: 0; width: min(440px, 92vw); max-height: 70vh; overflow: auto;
  background: #fff; color: var(--body); border-radius: var(--radius); box-shadow: var(--shadow-pop); padding: 8px; z-index: 60;
}
.search-results h4 { color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-size: 11px; padding: 6px 8px 4px; }
.sr-item { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 6px; color: var(--body); text-decoration: none; }
.sr-item:hover { background: var(--hover); }
.sr-item .grow { display: flex; flex-direction: column; }
.sr-swatch { width: 28px; height: 20px; border-radius: 4px; flex: none; }
.sr-empty { padding: 8px; margin: 0; }
.avatar-btn { border: 0; background: none; padding: 0; cursor: pointer; border-radius: 50%; }
.avatar-btn:focus-visible { outline-color: var(--green); }

/* --- Pages --------------------------------------------------------------- */

main { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.page { width: 100%; max-width: 1180px; margin: 0 auto; padding: 28px 20px 60px; }
.page.narrow { max-width: 960px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.page-head h1 { margin-bottom: 2px; }
.page-head p { margin: 0; }
.panel { background: #fff; border-radius: var(--radius-lg); padding: 20px; margin-bottom: 18px; box-shadow: var(--shadow-card); }
.panel > h2 { margin-bottom: 12px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.empty-state { text-align: center; padding: 48px 20px; }
.empty-state h1, .empty-state h2 { margin-bottom: 8px; }

/* Home */
.home-section { margin-bottom: 28px; }
.home-section h2 { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; color: var(--slate); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; margin-top: 12px; }
.tiles.closed .tile { opacity: .7; }
.tile {
  position: relative; display: flex; flex-direction: column; justify-content: space-between; height: 104px; padding: 12px 14px;
  border-radius: var(--radius); color: #fff; text-decoration: none; overflow: hidden; border: 0; cursor: pointer; text-align: left;
  box-shadow: var(--shadow-card); transition: transform .12s, box-shadow .12s;
}
.tile::after { content: ''; position: absolute; inset: 0; background: rgba(0, 0, 0, 0); transition: background .12s; }
.tile:hover::after { background: rgba(0, 0, 0, .12); }
.tile:hover { transform: translateY(-1px); }
.tile-title { position: relative; z-index: 1; font-weight: 700; font-size: 16px; line-height: 1.25; text-shadow: 0 1px 2px rgba(0, 0, 0, .25); }
.tile-meta { position: relative; z-index: 1; font-size: 12px; opacity: .9; display: flex; align-items: center; gap: 4px; }
.tile-star { position: absolute; right: 8px; bottom: 8px; z-index: 2; background: none; border: 0; color: #fff; padding: 4px; cursor: pointer; opacity: 0; transition: opacity .12s; border-radius: 4px; }
.tile:hover .tile-star, .tile-star.on { opacity: 1; }
.tile-delete { position: absolute; right: 8px; top: 8px; z-index: 2; display: flex; padding: 5px; border: 0; border-radius: 6px; background: rgba(0, 0, 0, .35); color: #fff; cursor: pointer; opacity: 0; transition: opacity .12s, background .12s; }
.tile:hover .tile-delete, .tile-delete:focus-visible { opacity: 1; }
.tile-delete:hover { background: var(--red); }
.tile:has(.tile-delete) .tile-title { padding-right: 30px; }
.tile-star.on { color: #F5CD47; }
.tile-new { background: #E2E4E9; color: var(--slate); align-items: center; justify-content: center; flex-direction: row; gap: 6px; font-weight: 500; font-size: 14px; }
.tile-new:hover { background: #D5D8DE; }
.tile-new::after { display: none; }

/* My cards */
.mycards { display: flex; flex-direction: column; gap: 6px; }
.mycard { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--radius); background: var(--row-alt); text-decoration: none; color: var(--body); }
.mycard:hover { background: var(--hover); }
.mycard .grow { display: flex; flex-direction: column; }
.mc-bar { width: 6px; align-self: stretch; border-radius: 3px; flex: none; }

/* Tables */
.table-wrap { overflow: auto; }
.data-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.data-table th, .data-table td { padding: 8px 12px; text-align: left; border-bottom: 1px solid var(--divider); vertical-align: middle; white-space: nowrap; }
.data-table th { font-size: 12px; font-weight: 600; color: var(--slate); background: #fff; position: sticky; top: 0; z-index: 1; }
.data-table th button { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
.data-table th.num, .data-table td.num { text-align: right; }
.data-table th.num button { flex-direction: row-reverse; }
.data-table tbody tr:nth-child(even) td { background: var(--row-alt); }
.data-table tbody tr[data-act] { cursor: pointer; }
.data-table tbody tr[data-act]:hover td { background: var(--green-pale); }
.data-table tfoot td { border-top: 2px solid var(--divider); background: #fff; position: sticky; bottom: 0; }
.data-table tr.inactive td { color: var(--muted); }
.data-table td.actions { text-align: right; }
.data-table td.actions .btn + .btn { margin-left: 6px; }
.data-table select { width: auto; padding: 4px 26px 4px 8px; font-size: 13px; }
.t-title { color: var(--ink); font-weight: 500; text-decoration: none; white-space: normal; min-width: 200px; display: inline-block; }
.t-title:hover { text-decoration: underline; }
.t-labels { display: flex; gap: 4px; }
.t-members { display: flex; }
.t-members .avatar + .avatar { margin-left: -4px; box-shadow: 0 0 0 2px #fff; }

/* --- Board page ---------------------------------------------------------- */

.board-page { flex: 1; display: flex; flex-direction: column; min-height: 0; height: calc(100vh - var(--topbar-h)); }
.board-header {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 8px 12px; min-height: 52px;
  background: rgba(0, 0, 0, .32); color: #fff; backdrop-filter: blur(4px);
}
.bh-title { font-size: 18px; font-weight: 700; color: #fff; padding: 4px 8px; border-radius: 6px; cursor: pointer; max-width: 40vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bh-title:hover { background: rgba(255, 255, 255, .18); }
.bh-title-input { font-size: 18px; font-weight: 700; width: 320px; max-width: 60vw; padding: 3px 8px; }
.bh-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px; border-radius: 6px; border: 0; cursor: pointer;
  background: rgba(255, 255, 255, .16); color: #fff; font-weight: 500; white-space: nowrap;
}
.bh-btn:hover { background: rgba(255, 255, 255, .28); }
.bh-btn.icon { width: 32px; padding: 0; justify-content: center; }
.bh-btn.on { background: #fff; color: var(--ink); }
.bh-btn .count { background: var(--green); color: var(--black); border-radius: 99px; padding: 0 6px; font-size: 11px; }
.bh-members { display: flex; cursor: pointer; padding: 0 4px; }
.bh-members .avatar { box-shadow: 0 0 0 2px rgba(0, 0, 0, .35); }
.bh-members .avatar + .avatar { margin-left: -4px; }
.view-tabs { display: flex; gap: 2px; background: rgba(0, 0, 0, .25); border-radius: 8px; padding: 3px; margin-left: 6px; }
.view-tabs button { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; color: #E5E7EB; padding: 4px 10px; border-radius: 6px; cursor: pointer; font-weight: 500; }
.view-tabs button:hover { background: rgba(255, 255, 255, .14); color: #fff; }
.view-tabs button.active { background: #fff; color: var(--ink); }

.board-wrap { flex: 1; display: flex; min-height: 0; position: relative; }
.board-body { flex: 1; min-width: 0; display: flex; flex-direction: column; min-height: 0; }

/* Lists */
.canvas { flex: 1; display: flex; align-items: flex-start; gap: 12px; padding: 12px; overflow-x: auto; overflow-y: hidden; min-height: 0; }
.list {
  flex: 0 0 272px; width: 272px; max-height: 100%; display: flex; flex-direction: column;
  background: var(--list-bg); border-radius: var(--radius-lg); box-shadow: var(--shadow-card);
}
/* List colours: soft tints so dark text and white cards stay readable. */
.lcol-green  { background: #D9F9E1; } .lcol-yellow { background: #FFF1B8; } .lcol-orange { background: #FFE0C2; }
.lcol-red    { background: #FFD8D4; } .lcol-purple { background: #E5DEFB; } .lcol-blue   { background: #D5E5FF; }
.lcol-sky    { background: #D0F0F8; } .lcol-lime   { background: #E2F4C6; } .lcol-pink   { background: #FBDAEC; }
.lcol-black  { background: #D3D6DB; }
.list[class*="lcol-"] .list-stats { color: var(--slate); }
.list[class*="lcol-"] .add-card-btn:hover { background: rgba(0, 0, 0, .07); }
.list-colours .swatches.big { margin-bottom: 8px; }
.list-colours .swatch-btn { border: 1px solid rgba(0, 0, 0, .08); }
.list-header { user-select: none; display: flex; align-items: flex-start; gap: 4px; padding: 8px 8px 0 8px; cursor: grab; }
.list-title { flex: 1; font-size: 14px; font-weight: 600; padding: 5px 6px; border-radius: 6px; cursor: pointer; overflow-wrap: anywhere; }
.list-title-input { flex: 1; font-weight: 600; padding: 4px 6px; }
.list-stats { user-select: none; cursor: grab; display: flex; justify-content: space-between; gap: 6px; padding: 0 14px 6px; font-size: 12px; color: var(--muted); }
.list-total { font-weight: 600; color: var(--green-ink); background: var(--green-soft); padding: 0 6px; border-radius: 4px; }
.list-cards { flex: 1 1 auto; overflow-y: auto; padding: 2px 8px; display: flex; flex-direction: column; gap: 8px; min-height: 4px; }
.add-card-btn, .add-list-btn {
  display: flex; align-items: center; gap: 6px; width: auto; margin: 6px 8px 8px; padding: 7px 8px; border: 0; border-radius: 8px;
  background: transparent; color: var(--slate); cursor: pointer; font-weight: 500; text-align: left;
}
.add-card-btn:hover { background: #DCDFE4; color: var(--ink); }
.card-composer { padding: 4px 8px 8px; display: flex; flex-direction: column; gap: 8px; }
.card-composer textarea { border: 0; box-shadow: var(--shadow-card); resize: none; min-height: 56px; }
.add-list { flex: 0 0 272px; }
.add-list-btn { margin: 0; width: 100%; padding: 12px; background: rgba(255, 255, 255, .22); color: #fff; border-radius: var(--radius-lg); }
.add-list-btn:hover { background: rgba(255, 255, 255, .34); color: #fff; }
.list-composer { background: var(--list-bg); border-radius: var(--radius-lg); padding: 8px; display: flex; flex-direction: column; gap: 8px; }

/* Cards */
.card {
  display: block; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow-card); color: var(--body);
  text-decoration: none; cursor: pointer; overflow: hidden; flex: none; outline-offset: -2px;
}
.card:hover { box-shadow: 0 0 0 2px var(--green), var(--shadow-card); }
.card-cover { height: 32px; }
.card-inner { padding: 8px 10px 6px; display: flex; flex-direction: column; gap: 6px; }
.card-labels { display: flex; flex-wrap: wrap; gap: 4px; }
.card-title { font-size: 14px; color: var(--ink); overflow-wrap: anywhere; }
.card-fields { display: flex; flex-direction: column; gap: 2px; }
.cf { font-size: 12px; color: var(--slate); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cf i { font-style: normal; color: var(--muted); }
.cf i::after { content: ':'; }
.card-foot { display: flex; align-items: flex-end; justify-content: space-between; gap: 6px; flex-wrap: wrap; }
.badges { display: flex; flex-wrap: wrap; gap: 2px 10px; align-items: center; min-height: 20px; }
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); border-radius: 4px; }
.badge.done { background: var(--green-soft); color: var(--green-ink); padding: 0 4px; }
.badge.due { padding: 1px 5px; }
.badge.due.overdue { background: var(--red-tint); color: var(--red-ink); }
.badge.due.soon { background: var(--amber-tint); color: var(--amber-ink); }
.badge.due.complete { background: var(--green-soft); color: var(--green-ink); }
.card-members { display: flex; flex-wrap: wrap; gap: 2px; margin-left: auto; }
.card-placeholder { background: rgba(9, 30, 66, .12); border-radius: var(--radius); flex: none; }
.list-placeholder { flex: 0 0 272px; align-self: stretch; max-height: 100%; background: rgba(0, 0, 0, .22); border-radius: var(--radius-lg); }
.drag-hidden { display: none !important; }
body.dragging .card:hover { box-shadow: var(--shadow-card); }

/* View toolbars (table, calendar) */
.table-view, .calendar-view, .dashboard-view { flex: 1; min-height: 0; display: flex; flex-direction: column; margin: 12px; background: #fff; border-radius: var(--radius-lg); box-shadow: var(--shadow-card); overflow: hidden; }
.view-toolbar { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--divider); flex-wrap: wrap; }
.view-toolbar h2 { margin-left: 6px; }
.view-toolbar select { width: auto; }
.table-view .table-wrap { flex: 1; }
.table-wrap.plain { margin: 0 -8px; }

/* Calendar */
.cal-grid { flex: 1; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); grid-template-rows: auto; grid-auto-rows: minmax(96px, 1fr); overflow: auto; }
.cal-dow { padding: 6px 8px; font-size: 12px; font-weight: 600; color: var(--muted); border-bottom: 1px solid var(--divider); background: #fff; position: sticky; top: 0; z-index: 1; }
.cal-day { border-right: 1px solid var(--divider); border-bottom: 1px solid var(--divider); padding: 4px; display: flex; flex-direction: column; gap: 3px; min-width: 0; overflow: hidden; }
.cal-day:nth-child(7n) { border-right: 0; }
.cal-day.other { background: var(--row-alt); }
.cal-day.other .cal-num { color: #A3A8B0; }
.cal-day.today .cal-num { background: var(--green); color: var(--black); border-radius: 99px; padding: 0 7px; align-self: flex-start; font-weight: 700; }
.cal-day.drop { background: var(--green-pale); box-shadow: inset 0 0 0 2px var(--green); }
.cal-num { font-size: 12px; font-weight: 600; color: var(--slate); padding: 1px 4px; }
.cal-chip { display: flex; align-items: center; gap: 5px; font-size: 12px; padding: 2px 6px; border-radius: 4px; background: #EEF0F3; color: var(--ink); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: none; }
.cal-chip i { width: 6px; height: 12px; border-radius: 2px; flex: none; }
.cal-tag { flex: none; font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; color: var(--slate); background: rgba(0, 0, 0, .06); padding: 0 4px; border-radius: 3px; max-width: 45%; overflow: hidden; text-overflow: ellipsis; }
.cal-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.cal-chip:hover { background: #E2E5EA; }
.cal-chip.overdue { background: var(--red-tint); color: var(--red-ink); }
.cal-chip.complete { background: var(--green-soft); color: var(--green-ink); }

/* Dashboard */
.dashboard-view { background: transparent; box-shadow: none; overflow: auto; margin: 0; padding: 12px; }
.dash-note { background: #fff; padding: 8px 12px; border-radius: var(--radius); display: flex; gap: 6px; align-items: center; }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin-bottom: 12px; }
.kpi { background: #fff; border-radius: var(--radius-lg); padding: 14px 16px; box-shadow: var(--shadow-card); display: flex; flex-direction: column; gap: 2px; border-top: 3px solid var(--divider); }
.kpi-val { font-size: 26px; font-weight: 700; color: var(--ink); letter-spacing: -.02em; }
.kpi-label { font-size: 12px; color: var(--muted); }
.kpi.accent { border-top-color: var(--green); }
.kpi.bad { border-top-color: var(--red); }
.kpi.bad .kpi-val { color: var(--red-ink); }
.kpi.warn { border-top-color: var(--amber); }
.kpi.warn .kpi-val { color: var(--amber-ink); }
.dash-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 12px; }
.dash-card { background: #fff; border-radius: var(--radius-lg); padding: 16px; box-shadow: var(--shadow-card); }
.dash-card h3 { margin-bottom: 12px; font-size: 14px; }
.bar-row { display: grid; grid-template-columns: minmax(90px, 38%) 1fr auto; gap: 10px; align-items: center; padding: 4px 0; font-size: 13px; }
.bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--slate); }
.bar-track { height: 14px; background: #EEF0F3; border-radius: 3px; overflow: hidden; }
.bar-track i { display: block; height: 100%; border-radius: 3px; min-width: 2px; }
.bar-track i:not([class*="lc-"]) { background: var(--green); }
.bar-track i[style*="width:0.0%"] { min-width: 0; }
.bar-val { font-weight: 600; color: var(--ink); min-width: 40px; text-align: right; }

/* Board menu drawer */
.board-menu {
  width: 340px; flex: none; background: #fff; box-shadow: -4px 0 20px rgba(0, 0, 0, .18);
  display: flex; flex-direction: column; min-height: 0; z-index: 5;
}
.bm-head { display: grid; grid-template-columns: 32px 1fr 32px; align-items: center; padding: 10px 10px; border-bottom: 1px solid var(--divider); }
.bm-head h3 { text-align: center; font-size: 14px; }
.bm-body { flex: 1; overflow: auto; padding: 12px; }
.menu { display: flex; flex-direction: column; }
.menu button, .menu a {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; background: none; border-radius: 6px;
  text-align: left; cursor: pointer; color: var(--body); text-decoration: none; font-size: 14px;
}
.menu button:hover, .menu a:hover { background: var(--hover); }
.menu button.danger { color: var(--red-ink); }
.menu-note { padding: 2px 10px 6px; }
.about-row { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; }
.bg-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.bg-swatch { height: 72px; border-radius: var(--radius); border: 0; cursor: pointer; color: #fff; display: flex; align-items: center; justify-content: center; }
.bg-swatch.on { box-shadow: 0 0 0 3px var(--green); }
.label-list { display: flex; flex-direction: column; gap: 6px; margin: 10px 0; }
.label-edit-row { display: flex; align-items: center; gap: 8px; border: 0; background: none; padding: 0; cursor: pointer; text-align: left; }
.label-edit-row .lbl { flex: 1; }
.label-edit-row:hover .lbl { filter: brightness(.95); box-shadow: 0 0 0 2px var(--ink); }
.field-list { display: flex; flex-direction: column; gap: 6px; margin: 10px 0; }
.field-row { display: flex; align-items: center; gap: 6px; }
.field-name { flex: 1; display: flex; flex-direction: column; align-items: flex-start; gap: 0; padding: 8px 10px; border: 1px solid var(--divider); border-radius: 6px; background: #fff; cursor: pointer; text-align: left; }
.field-name:hover { border-color: var(--green); background: var(--green-pale); }
.opt-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 6px; }
.opt-row { display: flex; gap: 4px; }
.seg { display: flex; background: #E9EBEE; padding: 3px; border-radius: 8px; margin-bottom: 12px; }
.seg button { flex: 1; border: 0; background: none; padding: 5px; border-radius: 6px; cursor: pointer; font-weight: 500; }
.seg button.on { background: #fff; box-shadow: var(--shadow-card); }
.arch-row { display: flex; flex-direction: column; gap: 6px; padding: 10px; border: 1px solid var(--divider); border-radius: var(--radius); margin-bottom: 8px; }
.arch-row a, .arch-row span { color: var(--ink); font-weight: 500; overflow-wrap: anywhere; }

/* --- Popovers ------------------------------------------------------------ */

.popover {
  position: fixed; z-index: 300; width: 304px; max-width: calc(100vw - 16px); background: #fff; border-radius: var(--radius);
  box-shadow: var(--shadow-pop); display: flex; flex-direction: column; max-height: calc(100vh - 16px);
}
.popover.wide { width: 380px; }
.pop-head { display: grid; grid-template-columns: 1fr 30px; align-items: center; padding: 6px 6px 6px 14px; font-size: 14px; font-weight: 600; color: var(--slate); }
.pop-head span { text-align: center; padding-left: 30px; }
.pop-body { padding: 4px 12px 12px; overflow: auto; }
.pop-search { margin-bottom: 8px; }
.pop-sub { margin: 14px 0 6px; color: var(--slate); }
.pop-list { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.member-row { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border: 0; background: none; border-radius: 6px; text-align: left; cursor: pointer; width: 100%; color: var(--body); }
.member-row:hover { background: var(--hover); }
.member-row.on { background: var(--green-pale); }
.member-row.static { cursor: default; }
.member-row.static:hover { background: none; }
.member-row select { width: auto; padding: 3px 24px 3px 6px; font-size: 12px; }
.member-row .ic:last-child { color: var(--green-ink); }
.add-member select { flex: 1; }
.label-row { display: flex; align-items: center; gap: 4px; }
.label-pick { display: flex; align-items: center; gap: 8px; flex: 1; cursor: pointer; min-width: 0; }
.label-pick .lbl { flex: 1; }
.label-preview { background: var(--row-alt); padding: 20px; display: flex; justify-content: center; border-radius: 6px; }
.swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.swatches.big { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-bottom: 10px; }
.swatch { position: relative; cursor: pointer; border-radius: 6px; width: 44px; height: 30px; display: inline-flex !important; }
.swatch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.swatch span { flex: 1; display: flex; align-items: center; justify-content: center; border-radius: 6px; color: #fff; font-size: 11px; font-weight: 600; }
.swatch input:checked + span { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--ink); }
.swatch input:focus-visible + span { outline: 2px solid var(--green); outline-offset: 3px; }
.swatch.lc-yellow span, .swatch.lc-green span, .swatch.lc-lime span, .swatch.lc-sky span, .swatch.lc-orange span { color: var(--ink); }
.swatch.uc-ink, .swatch.uc-slate, .swatch.uc-forest, .swatch.uc-ocean, .swatch.uc-teal, .swatch.uc-plum, .swatch.uc-wine, .swatch.uc-earth { width: 36px; height: 36px; border-radius: 50%; }
.swatch[class*=uc-] span { border-radius: 50%; }
.swatch-btn { height: 36px; border: 0; border-radius: 6px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.swatch-btn.on { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--ink); }

/* --- Dialogs & modal ----------------------------------------------------- */

.overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, .55); z-index: 100; overflow-y: auto; display: flex; align-items: flex-start; justify-content: center; padding: 48px 16px; }
.dlg-overlay { z-index: 200; align-items: center; }
.dialog { background: #fff; border-radius: var(--radius-lg); width: 100%; max-width: 440px; box-shadow: var(--shadow-pop); }
.dialog.wide { max-width: 640px; }
.dlg-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 14px 6px 20px; }
.dlg-body { padding: 8px 20px 20px; }
.dlg-msg { font-size: 14px; margin-bottom: 18px; }
.cb-preview { height: 110px; border-radius: var(--radius); display: flex; gap: 8px; padding: 14px; align-items: flex-start; }
.cb-preview i { display: block; width: 52px; height: 64px; background: rgba(255, 255, 255, .85); border-radius: 4px; }
.cb-preview i:nth-child(2) { height: 44px; }
.cb-preview i:nth-child(3) { height: 28px; }

.card-modal { position: relative; background: #F4F5F7; border-radius: var(--radius-lg); width: 100%; max-width: 820px; box-shadow: var(--shadow-pop); padding-bottom: 20px; }
.cm-cover { height: 110px; border-radius: var(--radius-lg) var(--radius-lg) 0 0; display: flex; align-items: flex-end; justify-content: flex-end; padding: 10px 56px 10px 10px; }
.cm-cover .btn { background: rgba(255, 255, 255, .75); }
.cm-close { position: absolute; top: 10px; right: 10px; width: 36px; height: 36px; border-radius: 50%; z-index: 2; }
.cm-cover + .cm-close { background: rgba(255, 255, 255, .8); }
.cm-banner { background: var(--amber-tint); color: var(--amber-ink); padding: 12px 24px; display: flex; gap: 8px; align-items: center; font-weight: 500; }
.cm-header { display: flex; gap: 12px; padding: 18px 56px 8px 20px; }
.cm-icon { width: 24px; flex: none; display: flex; justify-content: center; padding-top: 6px; color: var(--slate); }
.cm-title { font-size: 20px; font-weight: 600; color: var(--ink); border: 0; background: transparent; padding: 3px 6px; margin-left: -6px; resize: none; overflow: hidden; border-radius: 6px; }
.cm-title:focus { background: #fff; }
.cm-grid { display: grid; grid-template-columns: minmax(0, 1fr) 180px; gap: 20px; padding: 0 20px; }
.cm-main { min-width: 0; display: flex; flex-direction: column; gap: 22px; padding-top: 6px; }
.cm-meta { display: flex; flex-wrap: wrap; gap: 16px 24px; padding-left: 36px; }
.meta-block h4 { color: var(--muted); margin-bottom: 6px; font-weight: 600; }
.meta-btn { border: 0; background: #E9EBEE; padding: 6px 10px; border-radius: 6px; cursor: pointer; font-weight: 500; display: inline-flex; gap: 8px; align-items: center; }
.meta-btn:hover { background: #DCDFE4; }
.round-btn { width: 32px; height: 32px; border-radius: 50%; border: 0; background: #E9EBEE; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.round-btn:hover { background: #DCDFE4; }
.lbl-btn { border: 0; background: none; padding: 0; cursor: pointer; }
.due-check { width: 18px; height: 18px; }
.pill.due.overdue { background: var(--red); color: #fff; }
.pill.due.soon { background: var(--amber); color: var(--black); }
.pill.due.complete { background: var(--green); color: var(--black); }
.cm-section { display: flex; flex-direction: column; gap: 10px; }
.cm-section > :not(.cm-sec-head) { margin-left: 36px; }
.cm-sec-head { display: flex; align-items: center; gap: 12px; }
.cm-sec-head .cm-icon { padding-top: 0; }
.cm-sec-head h3 { flex: 1; font-size: 15px; }
.cf-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.cf-block label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; color: var(--slate); }
.cf-block input, .cf-block select { background: #fff; }
.cf-money { display: flex; align-items: stretch; }
.cf-money > span { display: flex; align-items: center; padding: 0 10px; background: #E9EBEE; border: 1px solid #C9CDD3; border-right: 0; border-radius: 6px 0 0 6px; font-weight: 600; color: var(--slate); }
.cf-money input { border-radius: 0 6px 6px 0; }
.cf-check { display: flex; align-items: center; gap: 8px; height: 37px; font-weight: 400; font-size: 14px; color: var(--body); }
.desc { background: transparent; cursor: pointer; padding: 2px 0; overflow-wrap: anywhere; }
.desc-empty { border: 0; background: #E9EBEE; text-align: left; padding: 12px; border-radius: 6px; cursor: pointer; min-height: 56px; color: var(--slate); width: calc(100% - 36px); }
.desc-empty:hover { background: #DCDFE4; }
.desc-input { min-height: 120px; }
.att { display: flex; gap: 12px; align-items: center; }
.att-thumb { width: 88px; height: 60px; flex: none; border-radius: 6px; background: #E2E4E9; display: flex; align-items: center; justify-content: center; font-weight: 700; color: var(--slate); text-decoration: none; overflow: hidden; font-size: 13px; }
.att-thumb img { width: 100%; height: 100%; object-fit: cover; }
.att-name { font-weight: 600; color: var(--ink); text-decoration: none; overflow-wrap: anywhere; }
.att-name:hover { text-decoration: underline; }
.cl-title { cursor: pointer; }
.cl-title-input { flex: 1; font-weight: 600; }
.cl-progress { display: flex; align-items: center; gap: 10px; font-size: 11px; color: var(--muted); }
.cl-progress span { width: 30px; }
.cl-progress .bar { flex: 1; height: 8px; background: #DCDFE4; border-radius: 4px; overflow: hidden; }
.cl-progress .bar i { display: block; height: 100%; background: var(--slate); transition: width .2s; }
.cl-progress .bar i.full { background: var(--green); }
.cl-items { display: flex; flex-direction: column; }
.cl-item { display: flex; align-items: flex-start; gap: 10px; padding: 5px 4px; border-radius: 6px; margin-left: -4px; }
.cl-item:hover { background: #E9EBEE; }
.cl-item input[type=checkbox] { margin-top: 2px; }
.cl-item .icon-btn { width: 24px; height: 24px; opacity: 0; }
.cl-item:hover .icon-btn { opacity: 1; }
.cl-text { flex: 1; cursor: pointer; overflow-wrap: anywhere; }
.cl-item.done .cl-text { text-decoration: line-through; color: var(--muted); }
.item-input { flex: 1; }
.checklist > .btn { align-self: flex-start; }
.comment-form { display: flex; gap: 10px; align-items: flex-start; margin-left: 0 !important; }
.comment-form .grow { display: flex; flex-direction: column; gap: 8px; }
.comment-form textarea { background: #fff; min-height: 40px; resize: none; }
.feed { display: flex; flex-direction: column; gap: 14px; }
.feed-item { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; }
.feed-item > div { min-width: 0; }
.cm-section .feed { margin-left: 0 !important; }
.comment-body { background: #fff; padding: 8px 12px; border-radius: 8px; box-shadow: var(--shadow-card); margin-top: 4px; overflow-wrap: anywhere; }
.feed-actions { display: flex; gap: 10px; margin-top: 4px; font-size: 12px; }
.feed-actions .link { color: var(--muted); }
.cm-side { display: flex; flex-direction: column; gap: 6px; padding-top: 6px; }
.cm-side h4 { color: var(--muted); margin: 8px 0 2px; }
.cm-side h4:first-child { margin-top: 0; }
.side-btn { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border: 0; border-radius: 6px; background: #E2E4E9; cursor: pointer; text-align: left; font-weight: 500; color: var(--ink); }
.side-btn:hover { background: #D5D8DE; }
.side-btn.danger { background: var(--red); color: #fff; }
.side-btn.danger:hover { background: #B91C1C; }
.cm-created { margin-top: 12px; }
.inline-edit { font: inherit; }

/* --- Responsive ---------------------------------------------------------- */

@media (max-width: 900px) {
  .topnav { display: none; }
  .view-tabs span, .bh-btn span { display: none; }
  .bh-members { display: none; }
  .board-menu { position: absolute; right: 0; top: 0; bottom: 0; width: min(340px, 100%); }
}
@media (max-width: 700px) {
  .topbar { gap: 8px; }
  .topbar .btn.primary span { display: none; }
  .search { width: auto; flex: 1; }
  .cm-grid { grid-template-columns: 1fr; }
  .cm-side { display: grid; grid-template-columns: 1fr 1fr; }
  .cm-side h4, .cm-created { grid-column: 1 / -1; }
  .cm-section > :not(.cm-sec-head), .cm-meta { margin-left: 0; padding-left: 0; }
  .overlay { padding: 0; }
  .card-modal { border-radius: 0; min-height: 100%; }
  .dash-grid { grid-template-columns: 1fr; }
  .page { padding: 20px 16px 48px; }
  .bh-title { max-width: 60vw; }
}
