:root {
  --bg: #f6f7fb;
  --panel: #ffffff;
  --text: #1f2430;
  --muted: #6b7385;
  --line: #e4e7ef;
  --line-strong: #d0d4e0;
  --accent: #5b6cff;
  --accent-ink: #ffffff;
  --accent-soft: #eef0ff;
  --side: #1d2233;
  --side-text: #c9cfe0;
  --side-hover: #2a3047;
  --danger: #e2445c;
  --ok: #00a862;
  --shadow: 0 1px 2px rgba(20, 25, 40, .06), 0 4px 16px rgba(20, 25, 40, .06);
  --radius: 10px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  color: var(--text);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h1 { font-size: 22px; } h2 { font-size: 17px; } h3 { font-size: 14px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.boot { padding: 40px; color: var(--muted); }
.hidden { display: none !important; }

/* buttons & inputs */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line-strong); background: var(--panel);
  padding: 7px 12px; border-radius: 8px; cursor: pointer; font-weight: 500; white-space: nowrap; }
.btn:hover { background: #f1f3f8; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.07); }
.btn.danger { color: var(--danger); border-color: #f2c3ca; }
.btn.danger:hover { background: #fff1f3; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: #eef0f5; }
.btn.sm { padding: 4px 9px; font-size: 13px; }
.btn:disabled { opacity: .55; cursor: default; }
input[type=text], input[type=email], input[type=password], input[type=date], input:not([type]), select, textarea {
  border: 1px solid var(--line-strong); border-radius: 8px; padding: 8px 10px; background: #fff; width: 100%; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { resize: vertical; min-height: 80px; }
label { display: block; font-weight: 500; margin: 10px 0; }
label > input, label > select, label > textarea { margin-top: 5px; font-weight: 400; }
label.check { display: flex; gap: 8px; align-items: center; font-weight: 400; }
label.check input { width: auto; margin: 0; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

/* auth */
.auth-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 16px; }
.auth-card { background: var(--panel); padding: 30px; border-radius: 14px; box-shadow: var(--shadow); width: 100%; max-width: 400px; }
.auth-card.wide { max-width: 560px; }
.auth-card h1 { margin-bottom: 6px; }
.auth-card .btn.primary { width: 100%; justify-content: center; padding: 10px; margin-top: 12px; }
.auth-card fieldset { border: 1px solid var(--line); border-radius: 10px; padding: 6px 16px 12px; margin: 16px 0; }
.auth-card legend { font-weight: 600; padding: 0 6px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; margin-bottom: 18px; }
.logo { width: 30px; height: 30px; border-radius: 8px; background: var(--accent); display: grid; place-items: center; color: #fff; font-weight: 800; }
.error-box { background: #fff1f3; color: #a3142c; border: 1px solid #f6c6cf; padding: 10px 12px; border-radius: 8px; margin: 12px 0; }
.warn { background: #fff8e6; border: 1px solid #f5dfa3; padding: 10px 12px; border-radius: 8px; }

/* layout */
.shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.side { background: var(--side); color: var(--side-text); padding: 16px 10px; display: flex; flex-direction: column; gap: 2px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side .brand { color: #fff; padding: 0 8px; font-size: 15px; margin-bottom: 14px; }
.side .brand span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--side-text); cursor: pointer;
  border: 0; background: none; width: 100%; text-align: left; }
.nav-item:hover { background: var(--side-hover); color: #fff; }
.nav-item.active { background: var(--accent); color: #fff; }
.nav-item .dot { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.nav-item .label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.nav-item .count { font-size: 11px; opacity: .7; }
.side-section { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: #8890a8; padding: 16px 10px 6px; display: flex; align-items: center; }
.side-section button { margin-left: auto; background: none; border: 0; color: #c9cfe0; cursor: pointer; font-size: 16px; line-height: 1; padding: 0 4px; border-radius: 4px; }
.side-section button:hover { background: var(--side-hover); color: #fff; }
.side .archived .label { opacity: .55; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 12px 24px; background: var(--panel); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20; }
.topbar .title { font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-btn { display: none; }
.content { padding: 24px; max-width: 1400px; width: 100%; }
.bell { position: relative; }
.badge { position: absolute; top: -4px; right: -4px; background: var(--danger); color: #fff; border-radius: 999px; font-size: 10px;
  min-width: 17px; height: 17px; display: grid; place-items: center; padding: 0 4px; font-weight: 700; }

/* avatars */
.avatar { width: 28px; height: 28px; border-radius: 50%; color: #fff; display: inline-grid; place-items: center; font-size: 11px;
  font-weight: 700; flex: none; letter-spacing: .02em; }
.avatar.sm { width: 22px; height: 22px; font-size: 9px; }
.avatar.unassigned { background: #e4e7ef; color: #8a92a6; }
.person { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.person .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* cards */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.card h2 { margin-bottom: 12px; }
.grid { display: grid; gap: 16px; }
.stats { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.stat .num { font-size: 28px; font-weight: 700; margin-top: 4px; }
.stat .lbl { color: var(--muted); font-size: 13px; }
.stat.alert .num { color: var(--danger); }
.dash-cols { grid-template-columns: 1.3fr 1fr; margin-top: 16px; }
.bar { height: 8px; background: #eef0f5; border-radius: 99px; overflow: hidden; display: flex; }
.bar > span { display: block; height: 100%; }
.stacked { height: 14px; border-radius: 6px; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 10px; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.list-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.list-row:last-child { border-bottom: 0; }
.list-row.click { cursor: pointer; }
.list-row.click:hover { background: #fafbff; }
.wl-row { display: grid; grid-template-columns: minmax(120px, 1fr) 2fr auto; gap: 12px; align-items: center; padding: 8px 0; }
.feed-item { display: flex; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.feed-item:last-child { border-bottom: 0; }
.feed-item .when { color: var(--muted); font-size: 11px; margin-top: 2px; }
.empty { color: var(--muted); padding: 20px 0; text-align: center; }

/* board */
.board-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.board-head .desc { color: var(--muted); margin-top: 4px; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar input[type=text] { width: 220px; }
.toolbar select { width: auto; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; background: #fff; padding: 7px 12px; cursor: pointer; }
.seg button.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.table-wrap { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; box-shadow: var(--shadow); }
table.tasks { border-collapse: collapse; width: 100%; min-width: 860px; }
table.tasks th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12px; padding: 10px; border-bottom: 1px solid var(--line); background: #fafbfd; }
table.tasks td { padding: 6px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.tasks tr:hover td { background: #fafbff; }
table.tasks td.title-cell { min-width: 260px; }
.task-title { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.task-title .t { font-weight: 500; }
.task-title:hover .t { color: var(--accent); }
.chip { font-size: 11px; color: var(--muted); display: inline-flex; gap: 3px; align-items: center; }
.group-head td { background: #f3f5fa !important; font-weight: 600; padding: 8px 10px; }
.group-head .gdot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 8px; }
select.pill { border: 0; color: #fff; font-weight: 600; text-align: center; text-align-last: center; border-radius: 6px; padding: 6px 8px;
  cursor: pointer; -webkit-appearance: none; appearance: none; min-width: 120px; }
select.pill option { color: var(--text); background: #fff; }
select.pill:focus { box-shadow: 0 0 0 3px rgba(0, 0, 0, .12); }
select.plain { border-color: transparent; background: transparent; padding: 5px 6px; min-width: 130px; cursor: pointer; }
select.plain:hover { border-color: var(--line-strong); background: #fff; }
input.cell { border-color: transparent; background: transparent; padding: 5px 6px; }
input.cell:hover { border-color: var(--line-strong); background: #fff; }
input.cell.overdue { color: var(--danger); font-weight: 600; }
.add-row td { padding: 8px 10px; }
.add-row input { border-style: dashed; }

/* kanban */
.kanban { display: grid; grid-template-columns: repeat(5, minmax(190px, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.col { background: #eef0f5; border-radius: var(--radius); padding: 10px; min-height: 200px; display: flex; flex-direction: column; gap: 8px; }
.col.drop { outline: 2px dashed var(--accent); outline-offset: -2px; background: var(--accent-soft); }
.col-head { display: flex; align-items: center; gap: 8px; font-weight: 600; padding: 2px 4px 6px; }
.col-head .bar-top { width: 12px; height: 12px; border-radius: 3px; }
.kcard { background: #fff; border-radius: 8px; padding: 10px 12px; box-shadow: 0 1px 2px rgba(0, 0, 0, .08); cursor: grab; border-left: 4px solid transparent; }
.kcard:hover { box-shadow: 0 2px 8px rgba(0, 0, 0, .12); }
.kcard.dragging { opacity: .4; }
.kcard .t { font-weight: 500; margin-bottom: 8px; }
.kcard .meta { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.kcard .meta .od { color: var(--danger); font-weight: 600; }
.tag { font-size: 11px; padding: 2px 7px; border-radius: 99px; color: #fff; font-weight: 600; }

/* drawer & modal */
.scrim { position: fixed; inset: 0; background: rgba(20, 24, 40, .35); z-index: 50; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100%); background: var(--panel); z-index: 60;
  box-shadow: -8px 0 30px rgba(0, 0, 0, .15); display: flex; flex-direction: column; }
.drawer-head { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; gap: 10px; align-items: center; }
.drawer-body { padding: 16px 20px 30px; overflow-y: auto; flex: 1; }
.drawer .title-input { font-size: 18px; font-weight: 600; border-color: transparent; padding: 6px 8px; }
.drawer .title-input:hover { border-color: var(--line-strong); }
.fields { display: grid; grid-template-columns: 110px 1fr; gap: 8px 12px; align-items: center; margin: 12px 0 18px; }
.fields .k { color: var(--muted); font-size: 13px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 18px 0 12px; }
.tabs button { border: 0; background: none; padding: 8px 12px; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; font-weight: 500; }
.tabs button.on { color: var(--accent); border-bottom-color: var(--accent); }
.comment { display: flex; gap: 10px; padding: 10px 0; }
.comment .bubble { background: #f4f6fb; border-radius: 10px; padding: 9px 12px; flex: 1; min-width: 0; }
.comment .who { font-weight: 600; font-size: 13px; display: flex; gap: 8px; align-items: baseline; }
.comment .who .when { font-weight: 400; color: var(--muted); font-size: 11px; }
.comment .body { white-space: pre-wrap; word-wrap: break-word; margin-top: 3px; }
.comment .body .mention { color: var(--accent); font-weight: 600; }
.comment .del { margin-left: auto; font-size: 11px; color: var(--muted); background: none; border: 0; cursor: pointer; }
.comment .del:hover { color: var(--danger); }
.composer { border: 1px solid var(--line-strong); border-radius: 10px; padding: 8px; margin-top: 8px; }
.composer textarea { border: 0; min-height: 60px; padding: 4px; box-shadow: none !important; }
.mention-bar { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.mention-bar button { font-size: 12px; border: 1px solid var(--line); background: #fff; border-radius: 99px; padding: 2px 9px; cursor: pointer; }
.mention-bar button:hover { border-color: var(--accent); color: var(--accent); }
.modal { position: fixed; z-index: 70; top: 50%; left: 50%; transform: translate(-50%, -50%); width: min(480px, calc(100% - 32px));
  background: var(--panel); border-radius: 14px; box-shadow: 0 20px 60px rgba(0, 0, 0, .25); padding: 22px; max-height: calc(100vh - 40px); overflow-y: auto; }
.modal h2 { margin-bottom: 8px; }
.modal .actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }
.copy-box { display: flex; gap: 8px; margin-top: 8px; }
.copy-box input { font-size: 12px; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.swatches button { width: 26px; height: 26px; border-radius: 7px; border: 2px solid transparent; cursor: pointer; }
.swatches button.on { border-color: var(--text); }
.popover { position: absolute; right: 0; top: calc(100% + 6px); width: 360px; max-width: calc(100vw - 32px); background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: 0 12px 40px rgba(0, 0, 0, .15); z-index: 40; max-height: 70vh; overflow-y: auto; }
.popover .ph { display: flex; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); font-weight: 600; }
.notif { padding: 10px 14px; border-bottom: 1px solid var(--line); cursor: pointer; font-size: 13px; }
.notif:hover { background: #fafbff; }
.notif.unread { background: var(--accent-soft); }
.notif .when { color: var(--muted); font-size: 11px; margin-top: 2px; }
.user-menu { width: 220px; padding: 6px; }
.user-menu button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 6px; cursor: pointer; }
.user-menu button:hover { background: #f1f3f8; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #1f2430; color: #fff; padding: 10px 16px;
  border-radius: 8px; z-index: 100; box-shadow: var(--shadow); max-width: calc(100% - 32px); }
.toast.err { background: #a3142c; }
.role { font-size: 11px; padding: 2px 8px; border-radius: 99px; background: #eef0f5; color: var(--muted); font-weight: 600; text-transform: capitalize; }
.role.owner { background: #fff3d6; color: #8a5a00; }
.role.admin { background: var(--accent-soft); color: var(--accent); }
.status-tag { font-size: 11px; font-weight: 600; }
.status-tag.pending { color: #b07800; }
.status-tag.off { color: var(--danger); }
.team-table { width: 100%; border-collapse: collapse; min-width: 640px; }
.team-table td, .team-table th { padding: 10px; border-bottom: 1px solid var(--line); text-align: left; }
.team-table th { font-size: 12px; color: var(--muted); }
.section-title { display: flex; align-items: center; gap: 10px; margin: 22px 0 10px; }
.section-title:first-child { margin-top: 0; }

/* responsive */
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: 260px; z-index: 80; transform: translateX(-100%); transition: transform .2s; }
  .shell.nav-open .side { transform: none; }
  .shell.nav-open::after { content: ""; position: fixed; inset: 0; background: rgba(0, 0, 0, .35); z-index: 70; }
  .menu-btn { display: inline-flex; }
  .content { padding: 16px; }
  .topbar { padding: 10px 16px; }
  .dash-cols { grid-template-columns: 1fr; }
  .toolbar input[type=text] { width: 100%; }
  .wl-row { grid-template-columns: 1fr 1fr auto; }
}

/* files */
.file-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.file-ext { width: 38px; height: 38px; border-radius: 8px; background: var(--accent-soft); color: var(--accent); font-size: 10px; font-weight: 700; display: grid; place-items: center; flex: none; }
.file-name { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.dropzone { border: 1.5px dashed var(--line-strong); border-radius: 10px; padding: 12px; margin-top: 10px; color: var(--muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 13px; }
.dropzone.over { border-color: var(--accent); background: var(--accent-soft); }

/* settings */
.status-row { display: grid; grid-template-columns: auto 42px 1fr auto auto; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); }
.color-pick { width: 38px; height: 34px; padding: 2px; border: 1px solid var(--line-strong); border-radius: 8px; background: #fff; cursor: pointer; }
details.smtp { margin-top: 12px; border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; }
details.smtp summary { cursor: pointer; font-weight: 600; }
@media (max-width: 600px) { .status-row { grid-template-columns: auto 42px 1fr auto; } .status-row .check { grid-column: 2 / 4; } }
