/* =====================================================================
   Nirmals Task Manager - design system
   Plaster surfaces, peacock-teal brand, brass for "due today".
   Status columns open with a fabric-swatch band.
   ===================================================================== */
:root {
  --bg: #eceef0;          /* plaster */
  --panel: #ffffff;
  --panel-2: #f6f7f8;
  --ink: #17202a;
  --ink-2: #48535f;
  --ink-3: #7b8692;
  --line: #dde1e5;
  --line-2: #cbd1d7;
  --brand: #0e5a5f;       /* peacock */
  --brand-2: #0a4448;
  --brand-soft: #dcecec;
  --brass: #a9761f;
  --brass-soft: #f6ecd6;
  --danger: #b3372d;
  --danger-soft: #f8e3e0;
  --ok: #2b7a4b;
  --ok-soft: #dff0e6;
  --radius: 8px;
  --rail: 232px;
  --font: 'Schibsted Grotesk', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'Bricolage Grotesque', 'Schibsted Grotesk', system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 13.5px/1.45 var(--font); -webkit-font-smoothing: antialiased; overflow: hidden; }
h1, h2, h3, h4, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
.hidden { display: none !important; }
.mono { font-variant-numeric: tabular-nums; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }
::-webkit-scrollbar { width: 8px; height: 8px; } ::-webkit-scrollbar-thumb { background: #c4cbd2; border-radius: 8px; } ::-webkit-scrollbar-track { background: transparent; }
i.fa-solid, i.fa-regular { font-size: .95em; }

/* ---------- shell ---------- */
.shell { display: flex; height: 100vh; }
.rail { width: var(--rail); overflow: visible; background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; flex-shrink: 0; transition: transform .2s; z-index: 30; }
.brand { display: flex; align-items: center; gap: 10px; padding: 16px 16px 14px; }
.brand-mark { width: 30px; height: 30px; border-radius: 7px; background: var(--brand); color: #fff; display: grid; place-items: center; font: 700 15px var(--font-display); flex-shrink: 0;
  box-shadow: inset 0 -6px 0 rgba(169,118,31,.9); }
.brand-name { font: 600 15px/1.2 var(--font-display); letter-spacing: -.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-sub { font-size: 11.5px; color: var(--ink-3); }
.nav { padding: 6px 10px; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 7px; color: var(--ink-2); font-weight: 500; position: relative; }
.nav a i { width: 18px; text-align: center; color: var(--ink-3); }
.nav a:hover { background: var(--panel-2); color: var(--ink); }
.nav a.on { background: var(--brand-soft); color: var(--brand-2); font-weight: 600; }
.nav a.on i { color: var(--brand); }
.nav .sep { height: 1px; background: var(--line); margin: 8px 4px; }
.me { border-top: 1px solid var(--line); padding: 10px; position: relative; }
.me-btn { display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px; border: 0; background: none; border-radius: 8px; cursor: pointer; text-align: left; }
.me-btn:hover { background: var(--panel-2); }
.me-name { font-weight: 600; line-height: 1.2; } .me-role { font-size: 11.5px; color: var(--ink-3); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { height: 52px; background: var(--panel); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; padding: 0 20px; flex-shrink: 0; }
.crumb { color: var(--ink-3); } .crumb b { color: var(--ink); font-weight: 600; }
.topbar .grow { flex: 1; }

#content { flex: 1; min-height: 0; overflow: auto; }
.page { padding: 22px 24px 40px; max-width: 1280px; margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-title { font: 600 26px/1.1 var(--font-display); letter-spacing: -.02em; }
.page-sub { color: var(--ink-3); margin-top: 4px; }

/* ---------- atoms ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 34px; padding: 0 14px; border-radius: 7px; border: 1px solid var(--line-2); background: var(--panel); font-weight: 600; cursor: pointer; white-space: nowrap; transition: background .12s, border-color .12s; }
.btn:hover { background: var(--panel-2); border-color: #b9c0c7; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; } .btn.primary:hover { background: var(--brand-2); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--ink-2); } .btn.ghost:hover { background: var(--panel-2); }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12.5px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.icon-btn { width: 32px; height: 32px; display: inline-grid; place-items: center; border: 0; background: none; color: var(--ink-3); border-radius: 7px; cursor: pointer; position: relative; }
.icon-btn:hover { background: var(--panel-2); color: var(--ink); }
.icon-btn.danger:hover { color: var(--danger); background: var(--danger-soft); }
.dot-badge { position: absolute; top: 5px; right: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); border: 2px solid var(--panel); }
.input, .select, .textarea { width: 100%; height: 34px; padding: 0 10px; border: 1px solid var(--line-2); border-radius: 7px; background: var(--panel); outline: none; }
.textarea { height: auto; padding: 8px 10px; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(14,90,95,.14); }
.select { padding-right: 6px; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > label, .lbl { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.req { color: var(--danger); }
.hint { font-size: 12px; color: var(--ink-3); }
.search { position: relative; } .search i { position: absolute; left: 11px; top: 11px; color: var(--ink-3); } .search .input { padding-left: 32px; }
.avatar { width: 24px; height: 24px; border-radius: 50%; display: inline-grid; place-items: center; font: 600 11px var(--font); flex-shrink: 0; background: var(--brand-soft); color: var(--brand-2); }
.avatar.lg { width: 34px; height: 34px; font-size: 14px; } .avatar.xl { width: 46px; height: 46px; font-size: 18px; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: 11px; font-size: 12px; font-weight: 600; background: var(--panel-2); border: 1px solid var(--line); white-space: nowrap; }
.chip .sw-dot { width: 8px; height: 8px; border-radius: 2px; }
.tag { display: inline-block; padding: 1px 7px; border-radius: 5px; background: var(--panel-2); border: 1px solid var(--line); font-size: 12px; color: var(--ink-2); }
.muted { color: var(--ink-3); } .late { color: var(--danger); font-weight: 600; } .soon { color: var(--brass); font-weight: 600; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
.switch { position: relative; display: inline-block; width: 30px; height: 17px; vertical-align: middle; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; background: #c7ced5; border-radius: 17px; cursor: pointer; transition: .15s; }
.switch span:before { content: ''; position: absolute; width: 13px; height: 13px; left: 2px; top: 2px; background: #fff; border-radius: 50%; transition: .15s; }
.switch input:checked + span { background: var(--brand); } .switch input:checked + span:before { transform: translateX(13px); }
.switch input:disabled + span { opacity: .45; cursor: not-allowed; }
.seg { display: inline-flex; padding: 2px; background: var(--bg); border-radius: 8px; }
.seg a { padding: 5px 12px; border-radius: 6px; font-weight: 600; color: var(--ink-2); font-size: 13px; }
.seg a.on { background: var(--panel); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.toast { position: fixed; bottom: 20px; right: 20px; z-index: 300; padding: 11px 14px; border-radius: 8px; color: #fff; font-weight: 600; max-width: 380px; box-shadow: 0 10px 30px rgba(0,0,0,.22); animation: pop .18s ease-out; }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } }
.empty { padding: 48px 20px; text-align: center; color: var(--ink-3); }
.empty b { display: block; color: var(--ink); font: 600 16px var(--font-display); margin-bottom: 4px; }

/* ---------- toolbar / popover ---------- */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 20px; background: var(--panel); border-bottom: 1px solid var(--line); }
.toolbar .search { width: 240px; }
.pop { position: relative; } .pop > summary { list-style: none; cursor: pointer; } .pop > summary::-webkit-details-marker { display: none; }
.pop-body { position: absolute; left: 0; top: 40px; z-index: 60; width: 270px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 32px rgba(20,30,40,.16); padding: 12px; display: grid; gap: 10px; }
.pop-body.right { left: auto; right: 0; }
.menu { position: absolute; bottom: 62px; left: 10px; right: 10px; z-index: 70; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 32px rgba(20,30,40,.18); overflow: hidden; }
.menu button, .menu .row { display: flex; width: 100%; gap: 10px; align-items: center; padding: 10px 14px; border: 0; background: none; text-align: left; cursor: pointer; }
.menu button:hover { background: var(--panel-2); }
.notif { position: absolute; top: 50px; right: 14px; width: 340px; max-height: 440px; overflow: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 32px rgba(20,30,40,.18); z-index: 80; }
.notif-item { padding: 11px 14px; border-bottom: 1px solid var(--line); cursor: pointer; } .notif-item:hover { background: var(--panel-2); }

/* ---------- board: swatch columns ---------- */
.board { display: flex; gap: 14px; padding: 18px 20px; height: calc(100vh - 52px - 58px); overflow-x: auto; align-items: stretch; }
.col { flex: 1 0 264px; max-width: 360px; display: flex; flex-direction: column; min-height: 0; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.col-band { height: 6px; flex-shrink: 0; }
.col-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px 8px; font-weight: 700; }
.col-count { font-weight: 600; color: var(--ink-3); background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 0 8px; font-size: 12px; }
.col-body { flex: 1; overflow-y: auto; padding: 4px 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.col-body.over { background: var(--brand-soft); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; cursor: pointer; transition: border-color .12s, box-shadow .12s; }
.card:hover { border-color: var(--line-2); box-shadow: 0 2px 8px rgba(20,30,40,.08); }
.card-top { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--ink-3); margin-bottom: 4px; }
.card-title { font-weight: 600; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-meta { display: flex; flex-wrap: wrap; gap: 4px 6px; margin-top: 8px; }
.card-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; font-size: 12.5px; }
.card-foot .icons { display: flex; align-items: center; gap: 8px; color: var(--ink-3); }

/* ---------- tables ---------- */
.tbl-wrap { overflow: auto; }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { position: sticky; top: 0; z-index: 2; background: var(--panel-2); text-align: left; font-weight: 600; font-size: 12.5px; color: var(--ink-2); padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; user-select: none; }
.tbl th.sortable { cursor: pointer; } .tbl th.sortable:hover { color: var(--ink); }
.tbl td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:hover td { background: #f9fafb; }
.tbl .id { color: var(--ink-3); font-size: 12px; white-space: nowrap; }
.list-panel { margin: 18px 20px; border-radius: 10px; overflow: hidden; height: calc(100vh - 52px - 58px - 36px); display: flex; flex-direction: column; }
.list-panel .tbl-wrap { flex: 1; }
.person { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.status-select { border: 0; font-weight: 600; font-size: 12.5px; padding: 3px 4px; border-radius: 5px; cursor: pointer; outline: none; }

/* ---------- drawer & modal ---------- */
.scrim { position: fixed; inset: 0; background: rgba(16,24,32,.42); z-index: 100; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(720px, 100vw); background: var(--panel); z-index: 101; display: flex; flex-direction: column; box-shadow: -16px 0 40px rgba(16,24,32,.18); animation: slide .2s ease-out; }
@keyframes slide { from { transform: translateX(32px); opacity: .6; } }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px 10px 20px; border-bottom: 1px solid var(--line); gap: 8px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 22px 24px 40px; }
.d-title { font: 600 24px/1.2 var(--font-display); letter-spacing: -.015em; margin: 4px 0 18px; }
.props { display: grid; grid-template-columns: 130px 1fr; gap: 9px 12px; padding: 14px 0; border-block: 1px solid var(--line); margin-bottom: 20px; align-items: center; }
.props dt { color: var(--ink-3); } .props dd { margin: 0; min-width: 0; }
.section-title { font: 600 15px var(--font-display); margin: 22px 0 10px; display: flex; justify-content: space-between; align-items: center; }
.rich { line-height: 1.6; } .rich ul { list-style: disc; padding-left: 20px; } .rich ol { list-style: decimal; padding-left: 20px; } .rich p { margin-bottom: .55em; } .rich a { color: var(--brand); text-decoration: underline; }
.progress { height: 6px; background: var(--bg); border-radius: 6px; overflow: hidden; } .progress > div { height: 100%; background: var(--brand); transition: width .3s; }
.tabs { display: flex; gap: 20px; border-bottom: 1px solid var(--line); margin: 26px 0 14px; }
.tabs button { padding: 8px 0; border: 0; background: none; font-weight: 600; color: var(--ink-3); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button.on { color: var(--brand-2); border-color: var(--brand); }
.bubble { max-width: 88%; padding: 8px 12px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line); white-space: pre-wrap; word-break: break-word; }
.bubble.mine { background: var(--brand); border-color: var(--brand); color: #fff; }
.timeline { border-left: 2px solid var(--line); margin-left: 6px; padding-left: 16px; display: grid; gap: 14px; }
.modal-wrap { position: fixed; inset: 0; z-index: 110; display: grid; place-items: center; padding: 16px; background: rgba(16,24,32,.42); animation: fade .15s; }
.modal { background: var(--panel); border-radius: 12px; width: min(520px, 100%); max-height: 92vh; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 24px 60px rgba(16,24,32,.3); }
.modal.wide { width: min(760px, 100%); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal > form { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.modal-head h2 { font: 600 17px var(--font-display); }
.modal-body { padding: 18px; overflow-y: auto; display: grid; gap: 14px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line); background: var(--panel-2); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; } .span2 { grid-column: 1 / -1; }
.ms { position: relative; } .ms-box { min-height: 34px; height: auto; padding: 4px 8px; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; cursor: pointer; }
.ms-list { position: absolute; left: 0; right: 0; top: 38px; z-index: 20; max-height: 220px; overflow: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 12px 28px rgba(20,30,40,.16); }
.ms-list div { display: flex; gap: 10px; align-items: center; padding: 8px 10px; cursor: pointer; } .ms-list div:hover { background: var(--panel-2); }
.recur { padding: 12px; border: 1px dashed var(--line-2); border-radius: 8px; background: var(--panel-2); display: grid; gap: 10px; }
.ql-toolbar.ql-snow { border-color: var(--line-2) !important; border-radius: 7px 7px 0 0; background: var(--panel-2); } .ql-container.ql-snow { border-color: var(--line-2) !important; border-radius: 0 0 7px 7px; font-family: var(--font); }

/* ---------- analytics ---------- */
.score { display: grid; grid-template-columns: minmax(220px, 280px) 1fr; }
.score-main { padding: 22px; border-right: 1px solid var(--line); }
.score-num { font: 700 64px/1 var(--font-display); letter-spacing: -.04em; }
.stats { display: grid; grid-template-columns: repeat(5, 1fr); }
.stat { padding: 22px 18px; border-left: 1px solid var(--line); } .stat:first-child { border-left: 0; }
.stat b { display: block; font: 600 28px/1.1 var(--font-display); letter-spacing: -.02em; } .stat span { color: var(--ink-3); }
.charts { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }
.charts .panel { padding: 18px; } .chart-box { height: 260px; }

/* ---------- settings ---------- */
.settings { display: grid; grid-template-columns: 210px 1fr; gap: 22px; align-items: start; }
.subnav { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 0; }
.subnav a { padding: 8px 12px; border-radius: 7px; color: var(--ink-2); font-weight: 500; } .subnav a:hover { background: var(--panel); } .subnav a.on { background: var(--panel); color: var(--brand-2); font-weight: 600; box-shadow: inset 3px 0 0 var(--brand); }
.set-panel { padding: 20px; } .set-panel h2 { font: 600 19px var(--font-display); } .set-panel .sub { color: var(--ink-3); margin: 2px 0 16px; }
.tbl.compact td, .tbl.compact th { padding: 7px 10px; }
.cell-input { height: 30px; width: 170px; }
.load { width: 90px; height: 6px; background: var(--bg); border-radius: 6px; overflow: hidden; } .load > div { height: 100%; }

/* ---------- auth ---------- */
.auth { position: fixed; inset: 0; z-index: 200; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); background: var(--panel); }
.auth-side { background: var(--brand); color: #e9f3f3; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-side .bands { position: absolute; right: -40px; top: 0; bottom: 0; display: flex; gap: 0; transform: rotate(0); }
.auth-side .bands i { width: 54px; display: block; }
.auth-side h2 { font: 600 40px/1.08 var(--font-display); letter-spacing: -.025em; max-width: 420px; position: relative; }
.auth-side p { max-width: 380px; opacity: .85; margin-top: 14px; position: relative; }
.auth-form { display: grid; place-items: center; padding: 32px; overflow: auto; }
.auth-box { width: min(380px, 100%); display: grid; gap: 14px; }
.auth-box h1 { font: 600 28px var(--font-display); letter-spacing: -.02em; }
.err { color: var(--danger); font-weight: 600; min-height: 18px; }


/* ---------- collapsed sidebar (desktop only) ---------- */
@media (min-width: 901px) {
.shell.collapsed { --rail: 64px; }
.shell.collapsed .brand { justify-content: center; padding-inline: 0; }
.shell.collapsed .brand > div:last-child, .shell.collapsed .nl, .shell.collapsed .me-btn > span:last-child { display: none; }
.shell.collapsed .nav a { justify-content: center; padding: 10px 0; }
.shell.collapsed .nav a i { width: auto; font-size: 1.1em; }
.shell.collapsed .me-btn { justify-content: center; padding: 6px 0; }
.shell.collapsed .menu { left: 8px; right: auto; width: 250px; }
.rail { transition: width .18s ease; }
}
#rail-toggle { font-size: 16px; }

/* notification bell: larger hit area and glyph */
.icon-btn.bell { width: 40px; height: 40px; }
.icon-btn.bell i { font-size: 19px; }
.icon-btn.bell .dot-badge { top: 7px; right: 9px; width: 9px; height: 9px; }
/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .rail { position: fixed; top: 0; bottom: 0; left: 0; transform: translateX(-100%); box-shadow: 0 0 40px rgba(0,0,0,.2); }
  .rail.open { transform: none; }
  .page { padding: 16px 14px 32px; } .toolbar { padding: 10px 14px; } .toolbar .search { width: 100%; }
  .score { grid-template-columns: 1fr; } .score-main { border-right: 0; border-bottom: 1px solid var(--line); }
  .stats { grid-template-columns: repeat(2, 1fr); } .stat { border-left: 0; border-top: 1px solid var(--line); }
  .charts { grid-template-columns: 1fr; } .settings { grid-template-columns: 1fr; } .subnav { flex-direction: row; overflow-x: auto; position: static; }
  .grid2 { grid-template-columns: 1fr; } .props { grid-template-columns: 110px 1fr; }
  .auth { grid-template-columns: 1fr; } .auth-side { display: none; }
  .board { padding: 12px; } .col { flex-basis: 82vw; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
