/* Design system of crm.aleksandarpetrov.com, with the orange accent swapped for green. */
:root {
  --bg: #f4f6f9; --card: #ffffff; --line: #e6e9ef; --line-soft: #eef0f4; --line-strong: #d7dce4;
  --ink-1: #111827; --ink-2: #4b5563; --ink-3: #6b7280; --ink-4: #9aa3af;
  --panel: #f8fafc; --hover: #f5f7fa; --hover-warm: #f5fdf8; --track: #eef1f5;
  --brand: #16a34a; --brand-2: #15803d; --brand-soft: #effcf3; --brand-line: #bbf7d0;
  --red: #e11d48; --red-soft: #fff1f3; --amber: #d97706; --amber-soft: #fffbeb;
  --pill-on: #111827; --pill-on-ink: #fff;
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.8'/%3E%3C/svg%3E");
}
.dark {
  color-scheme: dark;
  --bg: #0f1115; --card: #171a21; --line: #262a33; --line-soft: #22262e; --line-strong: #363b46;
  --ink-1: #eef0f3; --ink-2: #b6bcc6; --ink-3: #8f96a2; --ink-4: #6b7280;
  --panel: #1b1f26; --hover: #1f232b; --hover-warm: #17221b; --track: #262a33;
  --brand: #22c55e; --brand-2: #4ade80; --brand-soft: #102117; --brand-line: #1f5133;
  --red: #fb7185; --red-soft: #2b1218; --amber: #fbbf24; --amber-soft: #2b210c;
  --pill-on: #eef0f3; --pill-on-ink: #0f1115;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink-1); font: 14.5px/1.45 Montserrat, system-ui, -apple-system, sans-serif; -webkit-font-smoothing: antialiased; }
h1, h2, h3 { font-weight: 600; margin: 0; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---- grain components ---- */
.btn-grain { color: #fff; border: 1px solid #15803d; border-radius: 10px; padding: 10px 16px; font-weight: 600; cursor: pointer;
  background: var(--grain), radial-gradient(120% 160% at 18% -10%, rgba(134,239,172,.75) 0%, rgba(74,222,128,.22) 35%, transparent 62%), linear-gradient(180deg, #4ade80 0%, #22c55e 45%, #16a34a 100%);
  background-blend-mode: overlay, normal, normal;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.3), 0 1px 2px rgba(16,24,40,.12), 0 6px 16px -6px rgba(22,163,74,.6); }
.btn-grain:hover { filter: brightness(1.05); }
.mark-grain { color: #fff; background: var(--grain), linear-gradient(180deg, #22c55e, #15803d); background-blend-mode: overlay, normal; box-shadow: inset 0 1px 0 rgba(255,255,255,.25); }
.hero-grain { color: #fff; text-shadow: 0 1px 2px rgba(20,83,45,.35); border: 1px solid #15803d;
  background: var(--grain), var(--grain), radial-gradient(700px 320px at 0% 0%, rgba(134,239,172,.28), transparent 65%), radial-gradient(600px 300px at 100% 100%, rgba(20,83,45,.6), transparent 70%), linear-gradient(135deg, #22c55e 0%, #16a34a 50%, #15803d 100%);
  background-blend-mode: overlay, soft-light, normal, normal, normal;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.25), 0 10px 28px -16px rgba(22,163,74,.7); }
.tab-grain { color: var(--brand-2); background: var(--grain), linear-gradient(180deg, #ecfdf3, #d3f7e0); background-blend-mode: soft-light, normal; box-shadow: inset 0 0 0 1px #bbf7d0; }
.dark .tab-grain { color: #86efac; background: var(--grain), linear-gradient(180deg, #14301f, #0e2417); box-shadow: inset 0 0 0 1px #1f5133; }
.chip-grain { color: #16a34a; background: var(--grain), linear-gradient(180deg, #ecfdf3, #d3f7e0); background-blend-mode: soft-light, normal; box-shadow: inset 0 0 0 1px #bbf7d0; }
.chip-red { color: #e11d48; background: var(--grain), linear-gradient(180deg, #fff1f3, #ffd9df); background-blend-mode: soft-light, normal; box-shadow: inset 0 0 0 1px #fecdd3; }
.chip-amber { color: #d97706; background: var(--grain), linear-gradient(180deg, #fffbeb, #fde9b8); background-blend-mode: soft-light, normal; box-shadow: inset 0 0 0 1px #fde68a; }
.chip-zinc { color: #52525b; background: var(--grain), linear-gradient(180deg, #fafafa, #ececee); background-blend-mode: soft-light, normal; box-shadow: inset 0 0 0 1px #e4e4e7; }
.dark .chip-grain { color: #4ade80; background: var(--grain), linear-gradient(180deg, #14301f, #0e2417); box-shadow: inset 0 0 0 1px #1f5133; }
.dark .chip-red { color: #fb7185; background: var(--grain), linear-gradient(180deg, #3b1820, #2b1218); box-shadow: inset 0 0 0 1px #5f2230; }
.dark .chip-amber { color: #fbbf24; background: var(--grain), linear-gradient(180deg, #3a2c10, #2b210c); box-shadow: inset 0 0 0 1px #5a4316; }
.dark .chip-zinc { color: #a9afb9; background: var(--grain), linear-gradient(180deg, #252a33, #1d2129); box-shadow: inset 0 0 0 1px #363b46; }
.bar-grain { background: var(--grain), linear-gradient(90deg, #4ade80, #22c55e 60%, #16a34a); background-blend-mode: overlay, normal; }
.login-bg { background: radial-gradient(900px 500px at 50% -10%, #d3f7e0, transparent 70%), var(--bg); }
.dark .login-bg { background: radial-gradient(900px 500px at 50% -10%, #12301e, transparent 70%), var(--bg); }

/* ---- shell ---- */
.shell { display: flex; min-height: 100vh; }
aside { position: sticky; top: 0; height: 100vh; width: 264px; flex: none; display: none; flex-direction: column; border-right: 1px solid var(--line); background: var(--card); padding: 24px 16px; }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px; margin-bottom: 20px; }
.mark { display: grid; place-items: center; border-radius: 8px; font-weight: 700; width: 36px; height: 36px; font-size: 13px; }
.brand b { display: block; font-size: 14.5px; font-weight: 600; line-height: 1.2; }
.brand span { font-size: 12px; font-weight: 500; color: var(--ink-3); }
.group { padding: 16px 10px 6px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .12em; color: var(--ink-4); }
.group:first-child { padding-top: 4px; }
.navlink { display: flex; align-items: center; gap: 10px; border-radius: 8px; padding: 8px 10px; font-size: 14px; font-weight: 500; color: var(--ink-2); cursor: pointer; border: 0; background: none; width: 100%; text-align: left; }
.navlink:hover { background: var(--hover); color: var(--ink-1); }
.navlink svg { color: var(--ink-4); }
.navlink.on svg { color: var(--brand); }
.navlink .dot { width: 8px; height: 8px; border-radius: 99px; margin: 0 5px; }
.navlink .count { margin-left: auto; font-size: 12px; color: var(--ink-4); }
.userbox { margin-top: auto; border: 1px solid var(--line); background: var(--panel); border-radius: 10px; padding: 14px; font-size: 12.5px; color: var(--ink-3); }
.userbox b { display: block; color: var(--ink-1); font-weight: 600; }
.userbox .row { margin-top: 8px; display: flex; justify-content: space-between; }
.linkbtn { border: 0; background: none; padding: 0; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); font-size: 12.5px; }
.linkbtn.brandc { color: var(--brand); }
.linkbtn svg { width: 14px; height: 14px; }
.content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--line); background: var(--card); padding: max(10px, env(safe-area-inset-top)) 14px 10px; }
.topbar .mark { width: 32px; height: 32px; font-size: 12px; }
.topbar .t { font-weight: 600; }
.topbar .linkbtn { margin-left: auto; }
main { width: 100%; max-width: 1100px; margin: 0 auto; padding: 22px 16px 110px; }
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; gap: 4px; background: var(--card); border-top: 1px solid var(--line); padding: 6px 8px calc(env(safe-area-inset-bottom) + 6px); }
.tabbar button { flex: 1; border: 0; background: none; border-radius: 10px; padding: 6px 0 5px; display: grid; justify-items: center; gap: 2px; font-size: 11.5px; font-weight: 600; color: var(--ink-3); cursor: pointer; }
.tabbar button svg { width: 21px; height: 21px; }
.tabbar button.tab-grain svg { color: var(--brand); }
@media (min-width: 900px) {
  aside { display: flex; }
  .topbar, .tabbar { display: none; }
  main { padding: 28px 36px 48px; }
}

/* ---- page parts ---- */
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.head h1 { font-size: 24px; letter-spacing: -.01em; }
.head p { margin: 2px 0 0; color: var(--ink-3); font-size: 13.5px; }
.stack > * + * { margin-top: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 20px; border-bottom: 1px solid var(--line-soft); }
.card-h h2 { font-size: 15px; }
.pad { padding: 16px 20px; }
.hero { border-radius: 16px; padding: 22px 24px; }
.hero h2 { font-size: 22px; font-weight: 700; }
.hero p { margin: 4px 0 0; opacity: .92; }
.hero .hstats { display: flex; gap: 28px; margin-top: 16px; flex-wrap: wrap; }
.hero .hstats b { display: block; font-size: 26px; font-weight: 700; line-height: 1.1; }
.hero .hstats span { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; opacity: .9; }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); overflow: hidden; }
.stats > div { padding: 18px 22px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); margin: 0 -1px -1px 0; }
.stats b { display: block; font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.15; }
.stats span { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); }
@media (min-width: 640px) { .stats.s4 { grid-template-columns: repeat(4, 1fr); } .stats.s3 { grid-template-columns: repeat(3, 1fr); } }
.c-red { color: var(--red); } .c-amber { color: var(--amber); } .c-green { color: var(--brand); }
.chip { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; flex: none; }
.chip svg { width: 17px; height: 17px; }

.seg { display: inline-flex; gap: 2px; font-size: 13px; font-weight: 600; }
.seg button { border: 0; background: none; border-radius: 8px; padding: 7px 12px; cursor: pointer; color: var(--ink-3); }
.seg button:hover { background: var(--hover); }
.seg button .n { opacity: .6; margin-left: 4px; }
.pills { display: flex; gap: 6px; flex-wrap: wrap; }
.pills button { border: 0; border-radius: 99px; padding: 5px 12px; font-size: 13px; font-weight: 500; cursor: pointer; color: var(--ink-2); background: none; box-shadow: inset 0 0 0 1px var(--line-strong); }
.pills button:hover { background: var(--hover); }
.pills button.on { background: var(--pill-on); color: var(--pill-on-ink); box-shadow: none; }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 16px; border-bottom: 1px solid var(--line-soft); }

ul.rows { list-style: none; margin: 0; padding: 0; }
ul.rows > li { display: flex; align-items: flex-start; gap: 12px; padding: 13px 20px; border-top: 1px solid var(--line-soft); }
ul.rows > li:first-child { border-top: 0; }
ul.rows > li:hover { background: var(--hover-warm); }
ul.rows > li.late { background: color-mix(in oklab, var(--red-soft) 60%, transparent); }
.check { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 99px; border: 2px solid var(--line-strong); background: none; color: transparent; cursor: pointer; flex: none; margin-top: 1px; padding: 0; }
.check svg { width: 13px; height: 13px; stroke-width: 3; }
.check:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }
.check.done { border-color: var(--brand); background: var(--brand); color: #fff; }
.grow { flex: 1; min-width: 0; }
.ttl { font-weight: 500; }
.ttl.doneT { color: var(--ink-3); text-decoration: line-through; }
.meta { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 3px; font-size: 12.5px; color: var(--ink-3); }
.meta .late { color: var(--red); font-weight: 600; }
.meta .nudge { color: var(--amber); font-weight: 600; }
.acts { display: flex; gap: 2px; opacity: .85; }
.acts button { border: 0; background: none; color: var(--ink-3); font-size: 12px; font-weight: 600; padding: 4px 7px; border-radius: 6px; cursor: pointer; }
.acts button:hover { background: var(--hover); color: var(--ink-1); }
.tag { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: var(--panel); box-shadow: inset 0 0 0 1px var(--line); color: var(--ink-2); white-space: nowrap; }
.tag i { width: 7px; height: 7px; border-radius: 99px; }
.empty { padding: 32px 20px; text-align: center; color: var(--ink-3); font-size: 13.5px; }

.form { display: grid; gap: 10px; }
.form .r2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (min-width: 720px) { .form .r4 { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr auto; gap: 10px; align-items: end; } }
.r4 { display: grid; gap: 10px; }
label.f { display: grid; gap: 4px; font-size: 12px; font-weight: 600; color: var(--ink-3); }
input, select, textarea { width: 100%; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--card); font-size: 14px; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in oklab, var(--brand) 18%, transparent); }
textarea { min-height: 76px; resize: vertical; }

/* calendar */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal .dow { padding: 10px 0; text-align: center; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-4); border-bottom: 1px solid var(--line-soft); }
.cal .d { min-height: 64px; padding: 6px; border-right: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); cursor: pointer; display: flex; flex-direction: column; gap: 3px; background: none; border-top: 0; border-left: 0; text-align: left; }
.cal .d:nth-child(7n+7) { border-right: 0; }
.cal .d:hover { background: var(--hover-warm); }
.cal .d.out { opacity: .4; }
.cal .d .n { font-size: 12.5px; font-weight: 600; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 99px; }
.cal .d.today .n { background: var(--brand); color: #fff; }
.cal .d.sel { background: var(--brand-soft); box-shadow: inset 0 0 0 2px var(--brand-line); }
.cal .dots { display: flex; flex-wrap: wrap; gap: 3px; }
.cal .dots i { width: 7px; height: 7px; border-radius: 99px; }
.cal .lbl { display: none; font-size: 11px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-radius: 5px; padding: 1px 5px; background: var(--panel); color: var(--ink-2); }
@media (min-width: 900px) { .cal .d { min-height: 104px; } .cal .dots { display: none; } .cal .lbl { display: block; } }
.iconbtn { border: 0; background: none; width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; cursor: pointer; color: var(--ink-2); }
.iconbtn:hover { background: var(--hover); }

/* gym */
.week { display: flex; gap: 8px; }
.week div { flex: 1; text-align: center; font-size: 11px; font-weight: 600; color: var(--ink-3); }
.week i { display: block; height: 40px; border-radius: 10px; background: var(--track); margin-bottom: 6px; }
.week i.on { background: var(--grain), linear-gradient(180deg, #4ade80, #16a34a); background-blend-mode: overlay, normal; }
.bars { display: flex; align-items: flex-end; gap: 8px; height: 120px; }
.bars > div { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 6px; font-size: 11px; color: var(--ink-3); font-weight: 600; }
.bars .b { width: 100%; border-radius: 6px 6px 3px 3px; min-height: 3px; }
.bars .b.zero { background: var(--track); }
.grid2 { display: grid; gap: 16px; }
@media (min-width: 900px) { .grid2 { grid-template-columns: 1fr 1fr; } .grid2.wide { grid-template-columns: 1.4fr 1fr; } }

/* projects */
.pgrid { display: grid; gap: 16px; }
@media (min-width: 720px) { .pgrid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1100px) { .pgrid { grid-template-columns: repeat(3, 1fr); } }
.pcard { display: flex; flex-direction: column; gap: 14px; padding: 18px 20px; cursor: pointer; transition: box-shadow .15s, transform .15s; }
.pcard:hover { box-shadow: 0 10px 28px -18px rgba(16,24,40,.35); transform: translateY(-1px); }
.plogo { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 14px; background-blend-mode: overlay, normal; box-shadow: inset 0 1px 0 rgba(255,255,255,.25); }
.pcard h3 { font-size: 16px; }
.pcard p { margin: 2px 0 0; font-size: 13px; color: var(--ink-3); }
.pnums { display: flex; gap: 18px; font-size: 12.5px; color: var(--ink-3); }
.pnums b { color: var(--ink-1); font-size: 15px; margin-right: 3px; }
.plinks { display: flex; gap: 8px; flex-wrap: wrap; }
.open { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 9px; font-size: 13px; font-weight: 600; box-shadow: inset 0 0 0 1px var(--line-strong); background: var(--card); color: var(--ink-1); }
.open:hover { background: var(--hover); }
.open svg { width: 14px; height: 14px; }
.open.primary { color: #fff; box-shadow: none; }
.back { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink-3); border: 0; background: none; cursor: pointer; padding: 0; margin-bottom: 12px; }
.back:hover { color: var(--ink-1); }
.timeline .body { white-space: pre-wrap; font-size: 13px; color: var(--ink-2); margin-top: 6px; max-height: 6.2em; overflow: hidden; cursor: pointer; }
.timeline .body.openb { max-height: none; }
.err { color: var(--red); font-size: 13px; }
#login { max-width: 380px; margin: 0 auto; padding-top: 16vh; }
#login .mark { width: 48px; height: 48px; font-size: 16px; border-radius: 12px; margin: 0 auto 16px; }
#login h1 { text-align: center; font-size: 22px; }
#login p { text-align: center; color: var(--ink-3); margin: 4px 0 22px; }

/* ---- added for modules ---- */
.stack > .grid2, .grid2 > .stack { margin-top: 0; }
.grid2 > .stack > * + * { margin-top: 16px; }
.stack > * + * { margin-top: 16px; }
.monthnav { display: flex; align-items: center; gap: 4px; }
.mlabel { font-weight: 600; min-width: 132px; text-align: center; font-size: 14px; }
.checkline { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--ink-2); cursor: pointer; }
.checkline input { width: 18px; height: 18px; accent-color: var(--brand); }
.catlist { display: grid; gap: 12px; }
.catrow { display: flex; justify-content: space-between; font-size: 13.5px; margin-bottom: 5px; }
.track { height: 8px; border-radius: 99px; background: var(--track); overflow: hidden; }
.track > div { height: 100%; border-radius: 99px; }
.bars .b.neg { background: var(--red); opacity: .8; }
.amt { white-space: nowrap; font-variant-numeric: tabular-nums; padding-top: 2px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-4); font-weight: 600; padding: 10px 20px; border-bottom: 1px solid var(--line-soft); }
.tbl td { padding: 11px 20px; border-bottom: 1px solid var(--line-soft); font-variant-numeric: tabular-nums; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl th:not(:first-child), .tbl td:not(:first-child) { text-align: right; }
.navlink .dot { margin-left: 22px; }
.tabbar button { font-size: 10.5px; }
@media (max-width: 899px) { ul.rows > li { flex-wrap: wrap; } ul.rows > li .acts { width: 100%; padding-left: 36px; margin-top: -4px; } }
/* kernel: error boundaries */
.errcard { display: flex; align-items: center; gap: 12px; border-color: color-mix(in oklab, var(--red) 35%, var(--line)); }
.errcard > svg { color: var(--red); }
.errdot { width: 7px; height: 7px; border-radius: 99px; background: var(--red); margin-left: 6px; }
