/* ============================================================
   Landaus Inbox — Stage 1 styles
   Calm, neutral palette · one muted-green accent · light + dark
   ============================================================ */

/* ---- Light (default) ---- */
:root {
  --bg: #f4f5f3;
  --surface: #ffffff;
  --surface-2: #fafbf9;
  --border: #e3e5e0;
  --border-strong: #d2d5cd;
  --text: #25281f;
  --text-muted: #6b6f64;
  --text-faint: #9aa092;
  --accent: #1F5C3F;
  --accent-hover: #1A4F36;
  --accent-soft: #E6EFEA;
  --danger: #b4503f;
  --danger-soft: #f6e7e3;
  --warn: #9a7b34;
  --shadow: 0 1px 2px rgba(20, 24, 18, 0.05), 0 4px 16px rgba(20, 24, 18, 0.06);
  --radius: 10px;
  --radius-sm: 7px;
}

/* ---- Dark via system preference (when user hasn't chosen) ---- */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161815;
    --surface: #1e211d;
    --surface-2: #232621;
    --border: #313530;
    --border-strong: #3d423b;
    --text: #e7e9e3;
    --text-muted: #a3a89b;
    --text-faint: #767c6e;
    --accent: #4B9D72;
    --accent-hover: #5BAD82;
    --accent-soft: #1E2F26;
    --danger: #d2705f;
    --danger-soft: #36231f;
    --warn: #c7a559;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 4px 18px rgba(0, 0, 0, 0.35);
  }
}

/* ---- Forced themes (user toggle) override the above ---- */
:root[data-theme="light"] {
  --bg: #f4f5f3; --surface: #ffffff; --surface-2: #fafbf9;
  --border: #e3e5e0; --border-strong: #d2d5cd;
  --text: #25281f; --text-muted: #6b6f64; --text-faint: #9aa092;
  --accent: #1F5C3F; --accent-hover: #1A4F36; --accent-soft: #E6EFEA;
  --danger: #b4503f; --danger-soft: #f6e7e3; --warn: #9a7b34;
  --shadow: 0 1px 2px rgba(20, 24, 18, 0.05), 0 4px 16px rgba(20, 24, 18, 0.06);
}
:root[data-theme="dark"] {
  --bg: #161815; --surface: #1e211d; --surface-2: #232621;
  --border: #313530; --border-strong: #3d423b;
  --text: #e7e9e3; --text-muted: #a3a89b; --text-faint: #767c6e;
  --accent: #4B9D72; --accent-hover: #5BAD82; --accent-soft: #1E2F26;
  --danger: #d2705f; --danger-soft: #36231f; --warn: #c7a559;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 4px 18px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

/* ---- Brand mark ---- */
.brand-mark {
  width: 30px; height: 30px; border-radius: 8px;
  background: var(--accent); color: #fff;
  display: grid; place-items: center;
  font-weight: 700; font-size: 16px; letter-spacing: .5px;
  flex-shrink: 0;
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--text); font-size: 14px; font-weight: 500; cursor: pointer;
  transition: background .12s, border-color .12s, opacity .12s;
}
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-danger { color: var(--danger); border-color: var(--danger); background: transparent; }
.btn-danger:hover { background: var(--danger-soft); }
.btn-sm { padding: 6px 11px; font-size: 13px; }
.btn-block { width: 100%; justify-content: center; }
.icon-btn {
  width: 36px; height: 36px; border-radius: 8px; display: grid; place-items: center;
  border: 1px solid transparent; background: transparent; color: var(--text-muted); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn svg { width: 17px; height: 17px; }

/* ---- Forms ---- */
label.field { display: block; margin-bottom: 14px; }
.field-label { display: block; font-size: 13px; font-weight: 600; color: var(--text-muted); margin-bottom: 6px; }
input[type=text], input[type=email], input[type=password], select {
  width: 100%; padding: 10px 12px; font-size: 14px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
}
input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.checkbox { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.checkbox input { width: 16px; height: 16px; accent-color: var(--accent); }

/* ---- Auth screens (login / forgot / set-password) ---- */
.auth-wrap { min-height: 100%; display: grid; place-items: center; padding: 24px; }
.auth-card {
  width: 100%; max-width: 380px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 30px 28px;
}
.auth-head { display: flex; align-items: center; gap: 11px; margin-bottom: 6px; }
.auth-head .brand-name { font-weight: 700; font-size: 17px; }
.auth-title { font-size: 19px; font-weight: 650; margin: 18px 0 4px; }
.auth-sub { color: var(--text-muted); font-size: 14px; margin: 0 0 20px; }
.auth-row { display: flex; align-items: center; justify-content: space-between; margin: 4px 0 18px; }
.auth-foot { margin-top: 18px; text-align: center; font-size: 13px; color: var(--text-muted); }
.auth-or { display: flex; align-items: center; gap: 12px; margin: 18px 0; color: var(--text-faint); font-size: 12.5px; }
.auth-or::before, .auth-or::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.btn-ms svg { width: 17px; height: 17px; }

/* ---- Inline messages ---- */
.msg { padding: 10px 12px; border-radius: var(--radius-sm); font-size: 13.5px; margin-bottom: 14px; }
.msg-error { background: var(--danger-soft); color: var(--danger); }
.msg-ok { background: var(--accent-soft); color: var(--accent-hover); }
.msg-hidden { display: none; }

/* ---- Fatal screen ---- */
.fatal { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--bg); }
.fatal-card {
  text-align: center; max-width: 400px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 34px 30px;
}
.fatal-card .brand-mark { margin: 0 auto 16px; }
.fatal-card h1 { font-size: 20px; margin: 0 0 8px; }
.fatal-card p { color: var(--text-muted); margin: 0 0 22px; }

/* ---- App shell ---- */
.topbar {
  height: 56px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 18px; background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.topbar-left { display: flex; align-items: center; gap: 11px; }
.brand-name { font-weight: 680; font-size: 15.5px; }
.topbar-right { display: flex; align-items: center; gap: 8px; }

.usermenu { position: relative; }
.usermenu-btn {
  display: flex; align-items: center; gap: 9px; padding: 5px 9px 5px 5px;
  border-radius: 999px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; color: var(--text);
}
.usermenu-btn:hover { background: var(--surface-2); }
.avatar {
  width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: #fff;
  display: grid; place-items: center; font-size: 12px; font-weight: 600;
}
.usermenu-name { font-size: 14px; font-weight: 500; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chev { width: 13px; height: 13px; color: var(--text-faint); }
.usermenu-pop {
  position: absolute; right: 0; top: calc(100% + 8px); width: 230px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
}
.usermenu-head { padding: 14px; border-bottom: 1px solid var(--border); }
.usermenu-name-lg { font-weight: 600; }
.usermenu-email { font-size: 13px; color: var(--text-muted); margin-top: 2px; word-break: break-all; }
.usermenu-role { font-size: 12px; color: var(--accent); margin-top: 6px; font-weight: 600; }
.usermenu-action {
  width: 100%; display: flex; align-items: center; gap: 10px; padding: 12px 14px;
  background: transparent; border: 0; cursor: pointer; color: var(--text); font-size: 14px;
}
.usermenu-action:hover { background: var(--surface-2); }
.usermenu-action svg { width: 16px; height: 16px; color: var(--text-muted); }

.layout { display: flex; align-items: flex-start; }
.sidebar {
  width: 224px; flex-shrink: 0; padding: 16px 12px;
  position: sticky; top: 56px; height: calc(100vh - 56px);
  border-right: 1px solid var(--border); background: var(--surface);
}
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: var(--radius-sm);
  color: var(--text-muted); font-weight: 500; font-size: 14px; margin-bottom: 3px;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--accent-hover); }
.nav-ic { display: grid; place-items: center; width: 18px; height: 18px; }
.nav-ic svg { width: 16px; height: 16px; fill: currentColor; }
.nav-badge {
  margin-left: auto; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700;
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; display: inline-grid; place-items: center;
}

.content { flex: 1; min-width: 0; padding: 28px 32px; }

/* ---- Page primitives ---- */
.page-head { margin-bottom: 22px; }
.page-title { font-size: 22px; font-weight: 680; margin: 0; }
.page-sub { color: var(--text-muted); margin: 5px 0 0; }
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px;
}
.card + .card { margin-top: 18px; }
.card-title { font-size: 15px; font-weight: 650; margin: 0 0 14px; }

.detail-row { display: flex; padding: 11px 0; border-bottom: 1px solid var(--border); }
.detail-row:last-child { border-bottom: 0; }
.detail-label { width: 150px; flex-shrink: 0; color: var(--text-muted); font-size: 14px; }
.detail-value { font-size: 14px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent-hover); font-size: 12.5px; font-weight: 600;
}
.chip-muted { background: var(--surface-2); color: var(--text-muted); border: 1px solid var(--border); }

/* ---- Status badges ---- */
.badge { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge-active { background: var(--accent-soft); color: var(--accent-hover); }
.badge-pending { background: var(--danger-soft); color: var(--warn); }
.badge-off { background: var(--surface-2); color: var(--text-faint); border: 1px solid var(--border); }

/* ---- Table ---- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th {
  text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--text-faint); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--border);
}
table.data td { padding: 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.muted { color: var(--text-muted); }

/* ---- Modal ---- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(15, 18, 13, 0.45);
  display: grid; place-items: center; padding: 20px; z-index: 50;
}
.modal {
  width: 100%; max-width: 460px; max-height: 90vh; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px;
}
.modal-title { font-size: 17px; font-weight: 650; margin: 0 0 4px; }
.modal-sub { color: var(--text-muted); font-size: 13.5px; margin: 0 0 18px; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px; }
.loc-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.loc-opt {
  display: flex; align-items: center; gap: 8px; padding: 9px 11px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); cursor: pointer; font-size: 14px;
}
.loc-opt input { accent-color: var(--accent); }

.empty { text-align: center; color: var(--text-muted); padding: 40px 20px; }

/* ---- Chat ---- */
.chat {
  display: flex;
  height: calc(100vh - 112px);
  min-height: 420px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.chat-list {
  width: 244px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  background: var(--surface-2);
  overflow-y: auto;
  padding: 8px 0;
}
.chat-list-section { padding: 8px 0; }
.chat-list-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 16px; font-size: 12px; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; color: var(--text-faint);
}
.chat-list-head button {
  border: 0; background: transparent; color: var(--text-faint);
  font-size: 17px; line-height: 1; cursor: pointer; padding: 0 2px; border-radius: 4px;
}
.chat-list-head button:hover { color: var(--text); background: var(--border); }
.chat-convs { list-style: none; margin: 0; padding: 0; }
.conv-row {
  display: flex; align-items: center; gap: 9px; padding: 7px 16px;
  cursor: pointer; color: var(--text-muted); font-size: 14px; border-left: 2px solid transparent;
}
.conv-row:hover { background: var(--border); color: var(--text); }
.conv-row.active { background: var(--accent-soft); color: var(--accent-hover); border-left-color: var(--accent); font-weight: 600; }
.conv-hash { width: 18px; text-align: center; color: var(--text-faint); font-weight: 600; }
.conv-row.active .conv-hash { color: var(--accent); }
.conv-av {
  width: 20px; height: 20px; border-radius: 5px; flex-shrink: 0; color: #fff;
  display: grid; place-items: center; font-size: 10px; font-weight: 700;
}
.conv-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.conv-row.has-unread .conv-name { font-weight: 700; color: var(--text); }
.conv-unread {
  background: var(--accent); color: #fff; font-size: 11px; font-weight: 700;
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; display: grid; place-items: center;
}
.conv-empty { padding: 6px 16px; font-size: 13px; color: var(--text-faint); }

.chat-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.chat-empty-main { margin: auto; color: var(--text-muted); padding: 40px; text-align: center; }
.chat-head {
  flex-shrink: 0; padding: 12px 18px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.chat-head-info { min-width: 0; }
.chat-head-title { font-weight: 680; font-size: 15.5px; }
.chat-head-sub { font-size: 12.5px; color: var(--text-muted); margin-top: 1px; }

.chat-messages { flex: 1; overflow-y: auto; padding: 14px 18px; }
.chat-loading { color: var(--text-faint); padding: 8px; }
.msg-row { display: flex; gap: 10px; padding: 2px 0; position: relative; }
.msg-row:hover { background: var(--surface-2); }
.msg-row:not(.grouped) { margin-top: 12px; }
.msg-actions {
  position: absolute; right: 6px; top: -14px; display: none; gap: 2px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  padding: 2px; box-shadow: var(--shadow); z-index: 2;
}
.msg-row:hover .msg-actions { display: flex; }
.msg-actions button {
  border: 0; background: transparent; cursor: pointer; font-size: 13px;
  padding: 4px 7px; border-radius: 5px; color: var(--text-muted); line-height: 1;
}
.msg-actions button:hover { background: var(--surface-2); color: var(--text); }
.msg-edit-input {
  width: 100%; resize: vertical; min-height: 38px; padding: 8px 10px; font: inherit; font-size: 14.5px;
  border: 1px solid var(--accent); border-radius: var(--radius-sm); background: var(--surface); color: var(--text);
}
.msg-edit-input:focus { outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.msg-edit-actions { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.msg-edit-hint { font-size: 11.5px; color: var(--text-faint); }

.msg-reactions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.msg-reactions:empty { display: none; }
.reaction-chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; font-size: 12.5px;
  border: 1px solid var(--border-strong); border-radius: 11px; background: var(--surface);
  cursor: pointer; color: var(--text); line-height: 1.6;
}
.reaction-chip:hover { background: var(--surface-2); }
.reaction-chip.mine { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-hover); }
.reaction-picker {
  position: absolute; z-index: 60; display: flex; gap: 2px; padding: 4px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow);
}
.reaction-picker button {
  border: 0; background: transparent; cursor: pointer; font-size: 18px; padding: 4px 6px; border-radius: 6px; line-height: 1;
}
.reaction-picker button:hover { background: var(--surface-2); }
.msg-gutter { width: 36px; flex-shrink: 0; }
.msg-av {
  width: 36px; height: 36px; border-radius: 8px; color: #fff;
  display: grid; place-items: center; font-size: 13px; font-weight: 700;
}
.msg-body { min-width: 0; max-width: 720px; position: relative; }
.msg-meta { display: flex; align-items: baseline; gap: 8px; margin-bottom: 1px; }
.msg-name { font-weight: 650; font-size: 14px; }
.msg-time { font-size: 11.5px; color: var(--text-faint); }
.msg-text { font-size: 14.5px; line-height: 1.5; color: var(--text); word-wrap: break-word; }
.msg-text.deleted { color: var(--text-faint); font-style: italic; }
.msg-edited { font-size: 11px; color: var(--text-faint); }

.composer-wrap { flex-shrink: 0; border-top: 1px solid var(--border); }
.composer-preview { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 16px 0; }
.composer-preview:empty { display: none; }
.pending-chip {
  display: inline-flex; align-items: center; gap: 7px; padding: 5px 8px;
  border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface-2);
  font-size: 13px; max-width: 220px;
}
.pending-chip img { width: 28px; height: 28px; object-fit: cover; border-radius: 5px; }
.pending-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pending-remove {
  border: 0; background: transparent; cursor: pointer; color: var(--text-faint);
  font-size: 13px; padding: 2px 4px; border-radius: 4px; flex-shrink: 0;
}
.pending-remove:hover { background: var(--danger-soft); color: var(--danger); }
.chat-composer {
  flex-shrink: 0; display: flex; gap: 10px; align-items: flex-end;
  padding: 12px 16px;
}
.chat-composer textarea {
  flex: 1; resize: none; max-height: 160px; padding: 10px 12px; font: inherit; font-size: 14.5px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
}
.chat-composer textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.chat-send { flex-shrink: 0; }
.composer-attach {
  flex-shrink: 0; width: 38px; height: 38px; border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); background: var(--surface); cursor: pointer;
  font-size: 16px; color: var(--text-muted);
}
.composer-attach:hover { background: var(--surface-2); color: var(--text); }

.msg-attachments { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.msg-attachments:empty { display: none; }
.att-img img {
  max-width: 260px; max-height: 240px; border-radius: 8px;
  border: 1px solid var(--border); display: block;
}
.att-file {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px;
  border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface);
  color: var(--text); font-size: 13.5px; max-width: 280px;
}
.att-file:hover { background: var(--surface-2); }
.att-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.att-size { color: var(--text-faint); font-size: 12px; flex-shrink: 0; }

/* member picker (create channel / new DM) */
.member-picker {
  max-height: 220px; overflow-y: auto; border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 4px;
}
.member-opt {
  display: flex; align-items: center; gap: 9px; padding: 7px 9px;
  border-radius: var(--radius-sm); cursor: pointer; font-size: 14px;
}
.member-opt:hover { background: var(--surface-2); }
.member-opt input { accent-color: var(--accent); }
.member-av {
  width: 24px; height: 24px; border-radius: 6px; color: #fff;
  display: grid; place-items: center; font-size: 10px; font-weight: 700;
}

/* ---- Complaints ---- */
.cmp-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.cmp-head-actions { display: flex; gap: 10px; flex-shrink: 0; }
.cmp {
  display: flex; height: calc(100vh - 180px); min-height: 420px;
  border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; background: var(--surface); box-shadow: var(--shadow);
}
.cmp-list { width: 320px; flex-shrink: 0; border-right: 1px solid var(--border); display: flex; flex-direction: column; background: var(--surface-2); }
.cmp-filters { padding: 12px; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 10px; }
.cmp-tabs { display: flex; gap: 4px; background: var(--bg); padding: 3px; border-radius: 8px; }
.cmp-tabs button {
  flex: 1; border: 0; background: transparent; padding: 6px 8px; border-radius: 6px;
  font-size: 13px; font-weight: 600; color: var(--text-muted); cursor: pointer;
}
.cmp-tabs button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.cmp-select { width: 100%; }
.cmp-rows { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; }
.cmp-row { padding: 11px 14px; border-bottom: 1px solid var(--border); cursor: pointer; border-left: 2px solid transparent; }
.cmp-row:hover { background: var(--surface); }
.cmp-row.active { background: var(--accent-soft); border-left-color: var(--accent); }
.cmp-row-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 3px; }
.cmp-num { font-size: 12.5px; font-weight: 700; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.cmp-row-cust { font-weight: 600; font-size: 14px; margin-bottom: 2px; }
.cmp-row-meta { font-size: 12.5px; color: var(--text-muted); display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.cmp-row-assignee { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-muted); margin-top: 5px; }
.cmp-row-av { width: 16px; height: 16px; border-radius: 50%; color: #fff; display: grid; place-items: center; font-size: 8px; font-weight: 700; flex-shrink: 0; }
.cmp-row-unassigned { color: var(--text-faint); font-style: italic; }

.cmp-detail { flex: 1; min-width: 0; overflow-y: auto; }
.cmp-detail-head { padding: 16px 20px; border-bottom: 1px solid var(--border); }
.cmp-detail-num { font-size: 17px; font-weight: 680; display: flex; align-items: center; gap: 8px; }
.cmp-detail-sub { font-size: 13px; color: var(--text-muted); margin-top: 3px; }
.cmp-detail-body { padding: 18px 20px; max-width: 860px; }
.cmp-head-line { display: flex; align-items: center; gap: 8px; }
.cmp-num-lg { font-size: 14px; }
.cmp-customer { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
.cmp-cust-avatar { width: 40px; height: 40px; border-radius: 50%; color: #fff; display: grid; place-items: center; font-size: 14px; font-weight: 700; flex-shrink: 0; }
.cmp-cust-name { font-size: 17px; font-weight: 680; }
.cmp-cust-contact { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.cmp-meta-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.cmp-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; background: var(--surface); }
.cmp-chip-label { font-size: 10px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-faint); font-weight: 700; }
.cmp-chip-av { width: 18px; height: 18px; border-radius: 50%; color: #fff; display: grid; place-items: center; font-size: 9px; font-weight: 700; }
.cmp-reassign { cursor: pointer; color: var(--accent); font-weight: 600; text-decoration: underline; margin-left: 2px; }
.cmp-count { color: var(--text-faint); font-weight: 600; }
.cmp-resolution-box { background: var(--accent-soft); border: 1px solid rgba(31,92,63,0.30); border-radius: 8px; padding: 12px 14px; font-size: 14px; line-height: 1.5; }
.cmp-resolved-at { font-size: 12.5px; color: var(--accent-hover); margin-top: 8px; font-weight: 600; }
.cmp-hist-date { margin-left: auto; }
.cmp-hist-click { cursor: pointer; border-radius: 6px; margin: 0 -6px; padding-left: 6px; padding-right: 6px; }
.cmp-hist-click:hover { background: var(--surface-2); }
.cmp-acts { display: flex; flex-direction: column; gap: 14px; }
.cmp-act-row { display: flex; gap: 10px; }
.cmp-act-av { width: 28px; height: 28px; border-radius: 50%; color: #fff; display: grid; place-items: center; font-size: 11px; font-weight: 700; flex-shrink: 0; }
.cmp-act-main { flex: 1; min-width: 0; }
.cmp-act-head { font-size: 13px; }
.cmp-act-head strong { font-weight: 650; }
.cmp-act-body { font-size: 14px; line-height: 1.5; margin-top: 1px; }
.cmp-act-body.system { font-style: italic; color: var(--text-muted); }
.cmp-note-add { position: relative; margin-top: 14px; }
.cmp-note-add textarea { width: 100%; min-height: 64px; padding: 10px 12px 10px 12px; font: inherit; font-size: 14px; resize: vertical; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); }
.cmp-note-add textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.cmp-note-add button { position: absolute; right: 8px; bottom: 8px; }
.cmp-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; }
.cmp-card:empty { display: none; }
.cmp-card-title { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--text-faint); margin-bottom: 10px; }
.cmp-desc { font-size: 14.5px; line-height: 1.55; white-space: pre-wrap; }
.cmp-history { background: var(--danger-soft); border-color: transparent; }
.cmp-history .cmp-card-title { color: var(--warn); }
.cmp-hist-row { display: flex; align-items: center; gap: 10px; padding: 5px 0; font-size: 13px; }

.cmp-timeline { display: flex; flex-direction: column; gap: 12px; }
.cmp-act { padding-left: 14px; border-left: 2px solid var(--border-strong); }
.cmp-act.note { border-left-color: var(--accent); }
.cmp-act-meta { font-size: 12px; color: var(--text-faint); font-weight: 600; margin-bottom: 2px; }
.cmp-act.note .cmp-act-meta { color: var(--text-muted); }
.cmp-act-text { font-size: 14px; line-height: 1.5; }

/* status + severity badges */
.cstatus { display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 999px; font-size: 11px; font-weight: 700; border: 1px solid transparent; }
.cs-new { background: var(--surface); color: var(--accent-hover); border-color: var(--accent); }
.cs-assigned { background: rgba(74,111,165,0.14); color: #4A6FA5; }
.cs-progress { background: rgba(154,123,52,0.16); color: var(--warn); }
.cs-resolved { background: var(--accent-soft); color: var(--accent-hover); }
.csev { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 999px; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; border: 1px solid transparent; }
.csev-low { background: var(--surface-2); color: var(--text-muted); border-color: var(--border-strong); }
.csev-medium { background: rgba(154,123,52,0.12); color: var(--warn); border-color: rgba(154,123,52,0.3); }
.csev-high { background: var(--danger-soft); color: var(--danger); border-color: rgba(180,80,63,0.3); }

.cmp-modal { max-width: 540px; }
.cmp-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.cmp-dup { background: var(--danger-soft); border-radius: var(--radius-sm); padding: 10px 12px; margin-bottom: 14px; font-size: 13px; }
.cmp-dup strong { color: var(--warn); display: block; margin-bottom: 4px; }
.modal textarea, .field textarea, .cmp-card textarea {
  width: 100%; padding: 10px 12px; font: inherit; font-size: 14px; resize: vertical; min-height: 60px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--text);
}
.modal textarea:focus, .field textarea:focus, .cmp-card textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.cmp-act-grp { display: flex; flex-direction: column; gap: 6px; }

/* status stepper (matches prototype) */
.status-track { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.status-track-sep { width: 16px; height: 1px; background: var(--border-strong); }
.status-step {
  font-size: 11px; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--bg); color: var(--text-faint); font-weight: 600;
}
.status-step.reached { color: var(--text); border-color: var(--border-strong); }
.status-step.current { background: var(--accent); color: #fff; border-color: var(--accent); }
.status-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.cmp-act-inline { display: flex; gap: 8px; align-items: center; }
.cmp-act-inline select { flex: 1; }
.md-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.md-name { font-weight: 600; font-size: 14px; }
.md-row select { max-width: 230px; }
.md-add { display: flex; gap: 8px; margin: 16px 0 4px; }
.md-add input { flex: 1; }
@media (max-width: 540px) { .cmp-form-grid { grid-template-columns: 1fr; } }

/* ---- Tasks ---- */
input[type="datetime-local"] {
  width: 100%; padding: 9px 12px; font: inherit; font-size: 14px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--text);
}
input[type="datetime-local"]:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.task-scope { max-width: 250px; }
.task-section { margin-bottom: 22px; max-width: 760px; }
.task-sec-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-faint); }
.task-overdue .task-sec-head { color: var(--danger); }
.task-today .task-sec-head { color: var(--warn); }
.task-sec-count { background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 0 7px; font-size: 11px; color: var(--text-muted); }
.task-list { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.task-row { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.task-row:last-child { border-bottom: 0; }
.task-row:hover { background: var(--surface-2); }
.task-check { flex-shrink: 0; width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--border-strong); background: var(--surface); cursor: pointer; color: #fff; display: grid; place-items: center; font-size: 12px; margin-top: 1px; line-height: 1; }
.task-check:hover { border-color: var(--accent); }
.task-check.checked { background: var(--accent); border-color: var(--accent); }
.task-main { flex: 1; min-width: 0; }
.task-title { font-size: 14.5px; font-weight: 550; }
.task-row.is-done .task-title { text-decoration: line-through; color: var(--text-faint); }
.task-notes { font-size: 13px; color: var(--text-muted); margin-top: 2px; white-space: pre-wrap; }
.task-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 6px; font-size: 12.5px; color: var(--text-muted); }
.task-due.is-overdue { color: var(--danger); font-weight: 600; }
.task-recur { color: var(--accent); }
.task-who { display: inline-flex; align-items: center; gap: 5px; }
.task-av { width: 16px; height: 16px; border-radius: 50%; color: #fff; display: grid; place-items: center; font-size: 8px; font-weight: 700; }
.task-from { font-style: italic; }
.task-actions { display: none; gap: 2px; flex-shrink: 0; }
.task-row:hover .task-actions { display: flex; }
.task-actions button { border: 0; background: transparent; cursor: pointer; font-size: 13px; padding: 4px 6px; border-radius: 5px; color: var(--text-muted); }
.task-actions button:hover { background: var(--border); color: var(--text); }

@media (max-width: 720px) {
  .sidebar { display: none; }
  .content { padding: 20px 16px; }
  .usermenu-name { display: none; }
  .chat { height: calc(100vh - 96px); }
  .chat-list { width: 150px; }
  .cmp { flex-direction: column; height: auto; }
  .cmp-list { width: 100%; }
}
