/* Yellow Desk — The Yellow brand: Yellow #FFC400 · Ink #17150F · Cream #FAF5EA */
:root {
  --y: #FFC400; --y-soft: #FFF1BF; --ink: #17150F; --ink-2: #2a2720; --ink-3: #3a362c;
  --cream: #FAF5EA; --card: #FFFFFF; --line: #ECE5D3; --muted: #736c5c; --muted-2: #a39b88;
  --green: #1f9d55; --green-soft: #E3F5EA; --red: #d64545; --red-soft: #FCE7E7; --blue: #2f6fd6; --blue-soft: #E5EEFC;
  --orange: #e07b12; --orange-soft: #FDEEDC; --purple: #7b4fd6; --purple-soft: #EEE7FC;
  --r: 14px; --r-sm: 10px; --shadow: 0 1px 2px rgba(23,21,15,.05), 0 6px 20px rgba(23,21,15,.06);
  --head: 'Bricolage Grotesque', 'Montserrat', system-ui, sans-serif;
  --body: 'Spline Sans', 'Open Sans', system-ui, sans-serif;
  --side: 232px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 14.5px/1.5 var(--body); color: var(--ink); background: var(--cream); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { font-family: var(--head); margin: 0; letter-spacing: -.01em; }
h1 { font-size: 26px; font-weight: 800; }
h2 { font-size: 18px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 700; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
code { background: var(--y-soft); padding: 1px 6px; border-radius: 6px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.hidden { display: none !important; }

/* ---------- splash / auth ---------- */
.splash { min-height: 100vh; display: grid; place-items: center; }
.logo-dot { width: 22px; height: 22px; border-radius: 7px; background: var(--y); display: inline-block; box-shadow: inset 0 -6px 0 rgba(0,0,0,.12); }
.logo-dot.big { width: 54px; height: 54px; border-radius: 16px; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(.88); } }
.auth-body { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: var(--ink); background-image: radial-gradient(circle at 85% 0%, rgba(255,196,0,.25), transparent 45%); }
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-hero { background: var(--ink); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between;
  background-image: radial-gradient(circle at 0% 100%, rgba(255,196,0,.22), transparent 50%); }
.auth-hero h1 { font-size: 40px; line-height: 1.08; max-width: 460px; }
.auth-hero h1 span { color: var(--y); }
.auth-hero ul { list-style: none; padding: 0; margin: 28px 0 0; display: grid; gap: 14px; }
.auth-hero li { display: flex; gap: 12px; align-items: flex-start; color: #d9d3c2; }
.auth-hero li b { color: #fff; display: block; }
.auth-hero li i { width: 34px; height: 34px; flex: none; border-radius: 10px; background: var(--ink-3); display: grid; place-items: center; font-style: normal; }
.auth-side { display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 380px; background: var(--card); border-radius: 20px; padding: 28px; box-shadow: var(--shadow); }
.auth-card.wide { max-width: 520px; }
.auth-card h1 { margin: 14px 0 6px; }
.brand-row { display: flex; align-items: center; gap: 6px; font: 800 20px var(--head); }
.brand-row b { color: var(--ink); margin-left: 2px; }
.auth-hero .brand-row b { color: var(--y); }
.err-box { background: var(--red-soft); color: #8f1f1f; border-radius: var(--r-sm); padding: 10px 12px; margin: 12px 0; }
.warn-box { background: var(--y-soft); border-radius: var(--r-sm); padding: 10px 12px; margin: 12px 0; }
textarea.code { width: 100%; font: 12px/1.4 monospace; padding: 10px; border-radius: 10px; border: 1px solid var(--line); }

/* ---------- layout ---------- */
.shell { display: grid; grid-template-columns: var(--side) 1fr; min-height: 100vh; background: linear-gradient(to right, var(--ink) var(--side), transparent var(--side)); }
.side { background: var(--ink); color: #e9e4d6; padding: 18px 12px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; }
.side .brand-row { color: #fff; padding: 4px 10px 18px; }
.side .brand-row b { color: var(--y); }
.nav { display: grid; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 11px; text-decoration: none; color: #cfc8b6; font-weight: 500; position: relative; }
.nav a svg { width: 18px; height: 18px; flex: none; }
.nav a:hover { background: var(--ink-2); color: #fff; }
.nav a.on { background: var(--ink-3); color: var(--y); }
.nav .badge { margin-left: auto; background: var(--red); color: #fff; font-size: 11px; font-weight: 700; border-radius: 99px; padding: 1px 7px; }
.side .me { margin-top: auto; background: var(--ink-2); border-radius: 14px; padding: 10px; display: flex; align-items: center; gap: 10px; }
.side .me .who { flex: 1; min-width: 0; line-height: 1.25; }
.side .me .who b { color: #fff; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side .me .role { display: inline-block; font-size: 11px; background: var(--y); color: var(--ink); border-radius: 6px; padding: 0 6px; font-weight: 600; margin-top: 2px; }
.icon-btn { width: 34px; height: 34px; border-radius: 10px; border: 0; background: var(--ink-3); color: #fff; display: grid; place-items: center; cursor: pointer; flex: none; }
.icon-btn svg { width: 17px; height: 17px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--y); color: var(--ink); display: grid; place-items: center; font: 800 14px var(--head); flex: none; }
.avatar.sm { width: 28px; height: 28px; font-size: 12px; }
.main { min-width: 0; padding: 22px 26px 40px; }
.topbar { display: none; }
.bottom-nav { display: none; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- tabs / chips ---------- */
.tabs { display: flex; gap: 4px; background: var(--ink); padding: 5px; border-radius: 13px; margin-bottom: 16px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { border: 0; background: transparent; color: #d9d3c2; padding: 7px 14px; border-radius: 9px; cursor: pointer; font-weight: 500; white-space: nowrap; }
.tabs button.on { background: var(--y); color: var(--ink); font-weight: 600; }
.seg { display: inline-flex; background: #efe8d6; border-radius: 10px; padding: 3px; }
.seg button { border: 0; background: transparent; padding: 5px 11px; border-radius: 8px; cursor: pointer; font-size: 13px; }
.seg button.on { background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.08); font-weight: 600; }

/* ---------- buttons ---------- */
.btn { border: 0; border-radius: 11px; padding: 9px 15px; font-weight: 600; cursor: pointer; background: #fff; color: var(--ink); box-shadow: inset 0 0 0 1px var(--line);
  display: inline-flex; align-items: center; gap: 7px; text-decoration: none; white-space: nowrap; transition: transform .06s; }
.btn:active { transform: translateY(1px); }
.btn svg { width: 16px; height: 16px; }
.btn.primary { background: var(--y); box-shadow: none; }
.btn.primary:hover { background: #ffcd26; }
.btn.dark { background: var(--ink); color: #fff; box-shadow: none; }
.btn.danger { color: var(--red); }
.btn.ghost { background: transparent; box-shadow: none; }
.btn.wa { background: #25D366; color: #fff; box-shadow: none; }
.btn.sm { padding: 6px 10px; font-size: 13px; border-radius: 9px; }
.btn.block { width: 100%; justify-content: center; padding: 12px; }
.btn[disabled] { opacity: .5; pointer-events: none; }

/* ---------- cards & stats ---------- */
.card { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); padding: 16px 18px; min-width: 0; }
.card.dark { background: var(--ink); color: #fff; }
.card.dark .muted { color: #b6ae9b; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.card-head .muted { font-size: 12.5px; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span2 { grid-column: span 2; }
.stat { background: var(--ink); color: #fff; border-radius: var(--r); padding: 14px 16px; min-width: 0; }
.stat .k { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: #b6ae9b; }
.stat .v { font: 800 28px/1.15 var(--head); margin: 4px 0 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat .s { font-size: 12.5px; color: #b6ae9b; }
.stat.y { background: var(--y); color: var(--ink); }
.stat.y .k, .stat.y .s { color: #5c4a00; }
.stat .v.red { color: #ff8a8a; }
.stat.light { background: #fff; color: var(--ink); box-shadow: var(--shadow); }
.stat.light .k, .stat.light .s { color: var(--muted); }

.month-nav { display: inline-flex; align-items: center; gap: 6px; background: #fff; border-radius: 11px; padding: 4px; box-shadow: inset 0 0 0 1px var(--line); }
.month-nav button { border: 0; background: var(--cream); width: 30px; height: 30px; border-radius: 8px; cursor: pointer; font-size: 16px; }
.month-nav span { min-width: 118px; text-align: center; font-weight: 600; font-size: 13.5px; }

/* ---------- lists & tables ---------- */
.list { display: grid; }
.li { display: flex; align-items: center; gap: 12px; padding: 10px 2px; border-bottom: 1px solid var(--line); text-decoration: none; min-width: 0; }
.li:last-child { border-bottom: 0; }
.li .grow { flex: 1; min-width: 0; }
.li .t { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li .sub { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
a.li:hover .t { text-decoration: underline; }
.empty { color: var(--muted); padding: 18px 4px; text-align: center; font-size: 13.5px; }
.empty b { display: block; color: var(--ink); font-family: var(--head); font-size: 15px; margin-bottom: 2px; }

.table-wrap { overflow-x: auto; margin: 0 -18px; padding: 0 18px; }
table.t { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.t th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; padding: 8px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t td { padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t tr.click { cursor: pointer; }
table.t tr.click:hover td { background: #fffbef; }
table.t .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; background: #f1ecdf; color: var(--ink-2); }
.pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.pill.plain::before { display: none; }
.pill.green { background: var(--green-soft); color: var(--green); }
.pill.red { background: var(--red-soft); color: var(--red); }
.pill.blue { background: var(--blue-soft); color: var(--blue); }
.pill.orange { background: var(--orange-soft); color: var(--orange); }
.pill.purple { background: var(--purple-soft); color: var(--purple); }
.pill.y { background: var(--y-soft); color: #7a5d00; }

.bar { height: 8px; background: #efe8d6; border-radius: 99px; overflow: hidden; min-width: 60px; }
.bar > i { display: block; height: 100%; background: var(--y); border-radius: 99px; }
.bar.green > i { background: var(--green); }
.hbar { display: grid; grid-template-columns: 130px 1fr 44px; align-items: center; gap: 10px; font-size: 13px; padding: 5px 0; }
.hbar .lbl { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbar .n { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }

.cols { display: flex; align-items: flex-end; gap: 10px; height: 150px; padding-top: 8px; }
.cols .c { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; min-width: 0; }
.cols .c i { width: 100%; max-width: 46px; background: var(--y); border-radius: 8px 8px 3px 3px; min-height: 3px; }
.cols .c.cur i { background: var(--ink); }
.cols .c span { font-size: 11.5px; color: var(--muted); }
.cols .c b { font-size: 11.5px; font-variant-numeric: tabular-nums; }

/* ---------- pipeline board ---------- */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 10px; align-items: start; }
.col { background: #efe8d6; border-radius: var(--r); padding: 10px; min-height: 120px; }
.col.drop { outline: 2px dashed var(--ink); }
.col-head { display: flex; justify-content: space-between; align-items: center; padding: 2px 4px 10px; font-weight: 700; font-family: var(--head); }
.col-head span { font: 600 12px var(--body); color: var(--muted); }
.lead-card { background: #fff; border-radius: 11px; padding: 10px 12px; margin-bottom: 8px; box-shadow: 0 1px 2px rgba(0,0,0,.06); cursor: pointer; border-left: 3px solid transparent; }
.lead-card:hover { box-shadow: 0 3px 10px rgba(0,0,0,.1); }
.lead-card.due { border-left-color: var(--red); }
.lead-card .t { font-weight: 600; }
.lead-card .sub { font-size: 12.5px; color: var(--muted); }
.lead-card .row { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; gap: 6px; font-size: 12px; }

/* ---------- toolbar / filters ---------- */
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar .search { flex: 1; min-width: 180px; }
input.in, select.in, textarea.in, .form input, .form select, .form textarea {
  width: 100%; border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 9px 11px; outline: none; }
input.in:focus, select.in:focus, textarea.in:focus, .form input:focus, .form select:focus, .form textarea:focus { border-color: var(--ink); box-shadow: 0 0 0 3px var(--y-soft); }
select.in.auto { width: auto; }

/* ---------- forms ---------- */
.form { display: grid; gap: 12px; }
.form label { display: grid; gap: 5px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.form label small { font-weight: 400; color: var(--muted); }
.form .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form .row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.form h3 { margin-top: 6px; padding-top: 10px; border-top: 1px solid var(--line); }
.form h3:first-child { border-top: 0; padding-top: 0; margin-top: 0; }
.check { display: flex !important; grid-template-columns: none; align-items: center; gap: 8px; font-weight: 500 !important; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--ink); }
.inst-row { display: grid; grid-template-columns: 1.2fr 1fr 1fr 34px; gap: 8px; align-items: center; }
.sumline { display: flex; justify-content: space-between; font-size: 13px; padding: 6px 10px; border-radius: 9px; background: var(--cream); }
.sumline.bad { background: var(--red-soft); color: #8f1f1f; }

/* ---------- modal ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(23,21,15,.55); display: flex; align-items: flex-start; justify-content: center; padding: 5vh 16px; z-index: 50; overflow-y: auto; animation: fade .15s; }
.modal { background: #fff; border-radius: 18px; width: 100%; max-width: 560px; box-shadow: 0 20px 60px rgba(0,0,0,.3); animation: up .18s ease-out; }
.modal.lg { max-width: 760px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-head .icon-btn { background: var(--cream); color: var(--ink); }
.modal-body { padding: 18px 20px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); background: #fcfaf4; border-radius: 0 0 18px 18px; flex-wrap: wrap; }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(14px); opacity: 0; } }

#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 99; display: grid; gap: 8px; pointer-events: none; }
#toast div { background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 12px; box-shadow: 0 8px 24px rgba(0,0,0,.25); animation: up .2s; font-weight: 500; }
#toast div.err { background: var(--red); }

/* ---------- detail pages ---------- */
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); text-decoration: none; font-size: 13px; margin-bottom: 8px; }
.back:hover { color: var(--ink); }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 8px 12px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.timeline { display: grid; gap: 0; }
.tl { display: grid; grid-template-columns: 28px 1fr; gap: 10px; padding: 8px 0; position: relative; }
.tl::before { content: ''; position: absolute; left: 13px; top: 30px; bottom: -8px; width: 2px; background: var(--line); }
.tl:last-child::before { display: none; }
.tl .dot { width: 28px; height: 28px; border-radius: 50%; background: var(--cream); display: grid; place-items: center; font-size: 13px; }
.tl .dot.stage { background: var(--y); }
.tl .meta { font-size: 12px; color: var(--muted); }
.stage-steps { display: flex; gap: 6px; flex-wrap: wrap; }
.stage-steps button { border: 1px solid var(--line); background: #fff; border-radius: 99px; padding: 6px 12px; cursor: pointer; font-size: 13px; font-weight: 500; }
.stage-steps button.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.stage-steps button.done { background: var(--y-soft); border-color: transparent; }
.mod { display: flex; align-items: center; gap: 10px; padding: 9px 4px; border-bottom: 1px solid var(--line); cursor: pointer; }
.mod:last-child { border-bottom: 0; }
.mod input { width: 19px; height: 19px; accent-color: var(--green); flex: none; }
.mod.done .t { color: var(--muted); text-decoration: line-through; }
.mod .t { flex: 1; }
.mod .when { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.ring { --p: 0; width: 86px; height: 86px; border-radius: 50%; background: conic-gradient(var(--y) calc(var(--p) * 1%), #efe8d6 0); display: grid; place-items: center; flex: none; }
.ring b { width: 66px; height: 66px; border-radius: 50%; background: #fff; display: grid; place-items: center; font: 800 18px var(--head); }
.card.dark .ring b { background: var(--ink); }
.tpl-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.notice { background: var(--y-soft); border-radius: 11px; padding: 10px 12px; font-size: 13px; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 860px) {
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-hero { padding: 28px 22px; }
  .auth-hero h1 { font-size: 28px; }
  .auth-hero ul { display: none; }
  .shell { display: block; background: none; }
  .side { display: none; }
  .topbar { display: flex; align-items: center; justify-content: space-between; background: var(--ink); color: #fff; padding: 10px 16px; position: sticky; top: 0; z-index: 20; }
  .topbar .brand-row { font-size: 17px; }
  .topbar .brand-row b { color: var(--y); }
  .main { padding: 16px 16px 92px; }
  .bottom-nav { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: fixed; bottom: 0; left: 0; right: 0; background: var(--ink); z-index: 20; padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  .bottom-nav a { display: grid; justify-items: center; gap: 2px; color: #b6ae9b; text-decoration: none; font-size: 10.5px; padding: 4px 0; position: relative; }
  .bottom-nav a svg { width: 21px; height: 21px; }
  .bottom-nav a.on { color: var(--y); }
  .bottom-nav .badge { position: absolute; top: 0; right: 22%; background: var(--red); color: #fff; font-size: 10px; border-radius: 99px; padding: 0 5px; }
  .g2, .g3 { grid-template-columns: 1fr; }
  .span2 { grid-column: auto; }
  h1 { font-size: 22px; }
  .stat .v { font-size: 23px; }
  .form .row2, .form .row3 { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 110px 1fr; }
  .hbar { grid-template-columns: 100px 1fr 36px; }
  .modal-bg { padding: 0; align-items: flex-end; }
  .modal { border-radius: 18px 18px 0 0; max-height: 92vh; overflow-y: auto; }
  .modal-foot { border-radius: 0; position: sticky; bottom: 0; }
  .hide-m { display: none !important; }
  .inst-row { grid-template-columns: 1fr 1fr 34px; }
  .inst-row .lbl { grid-column: 1 / -1; }
}
@media (min-width: 861px) { .show-m { display: none !important; } }
@media print { .side, .topbar, .bottom-nav, .actions, .toolbar { display: none !important; } .shell { display: block; } body { background: #fff; } }
