/* OX Engine — dark-slate shell, orange accent */
:root {
  --bg: #f4f5f7; --panel: #ffffff; --ink: #1a2027; --muted: #6b7683;
  --line: #e3e7ec; --accent: #ff6b1a; --accent-ink: #ffffff;
  --side: #171d26; --side-ink: #aeb8c4; --side-active: #ffffff;
  --ok: #1f9d55; --warn: #b7791f; --bad: #c0392b;
  --radius: 10px; --shadow: 0 1px 3px rgba(16,24,40,.08), 0 4px 16px rgba(16,24,40,.06);
}
* { box-sizing: border-box; margin: 0; }
body { font: 14px/1.45 -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--ink); }
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid #ffb480; border-color: var(--accent); }

/* Login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; background: var(--side); }
.login-card { background: var(--panel); border-radius: 14px; padding: 34px 30px; width: 360px; box-shadow: var(--shadow); }
.login-card .logo { font-size: 30px; font-weight: 800; letter-spacing: -1px; margin-bottom: 4px; }
.login-card .logo b { color: var(--accent); }
.login-card .sub { color: var(--muted); margin-bottom: 22px; }
.login-card label { display: block; font-weight: 600; font-size: 12.5px; margin: 12px 0 4px; }
.login-err { color: var(--bad); margin-top: 10px; min-height: 18px; font-size: 13px; }

/* Shell */
.shell { display: grid; grid-template-columns: 218px 1fr; min-height: 100vh; }
.side { background: var(--side); color: var(--side-ink); padding: 18px 12px; display: flex; flex-direction: column; }
.side .logo { color: #fff; font-size: 21px; font-weight: 800; letter-spacing: -.5px; padding: 4px 10px 16px; }
.side .logo b { color: var(--accent); }
.side a.nav { display: flex; align-items: center; gap: 10px; color: var(--side-ink); text-decoration: none; padding: 9px 10px; border-radius: 8px; margin-bottom: 2px; font-weight: 500; }
.side a.nav.active, .side a.nav:hover { background: rgba(255,255,255,.08); color: var(--side-active); }
.side .spacer { flex: 1; }
.side .who { padding: 10px; font-size: 12.5px; border-top: 1px solid rgba(255,255,255,.09); }
.side .who .n { color: #fff; font-weight: 600; }
.side .who button { background: none; border: none; color: var(--accent); padding: 4px 0 0; }
.tenant-badge { background: rgba(255,107,26,.15); color: #ffb480; border-radius: 6px; padding: 4px 10px; font-size: 12px; margin-bottom: 14px; }

.main { padding: 26px 30px; max-width: 1280px; min-width: 0; } /* min-width:0 — without it the kanban's min-content width inflates the grid column past the viewport */
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; gap: 12px; }
.page-head h1 { font-size: 21px; letter-spacing: -.3px; }
.btn { background: var(--accent); color: var(--accent-ink); border: none; border-radius: 8px; padding: 9px 16px; font-weight: 600; }
.btn:hover { filter: brightness(1.06); }
.btn.ghost { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.btn.sm { padding: 5px 10px; font-size: 12.5px; }

/* Cards / tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 22px; }
.tile { background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; }
.tile .v { font-size: 24px; font-weight: 800; letter-spacing: -.5px; }
.tile .k { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.card { background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 18px; }
.card h2 { font-size: 15px; margin-bottom: 12px; }

/* Table */
table { width: 100%; border-collapse: collapse; background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); }
th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); background: #fafbfc; }
tr:last-child td { border-bottom: none; }
tr.row:hover { background: #fff8f3; cursor: pointer; }
.searchbar { max-width: 320px; }

/* Kanban */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(230px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.kcol { background: #eceff3; border-radius: var(--radius); padding: 10px; min-height: 300px; }
.kcol.drag-over { outline: 2px dashed var(--accent); }
.kcol h3 { font-size: 12.5px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); padding: 2px 6px 10px; display: flex; justify-content: space-between; }
.kcard { background: #fff; border-radius: 8px; box-shadow: 0 1px 2px rgba(16,24,40,.1); padding: 10px 12px; margin-bottom: 8px; cursor: grab; border-left: 3px solid var(--accent); }
.kcard .t { font-weight: 600; margin-bottom: 3px; }
.kcard .m { color: var(--muted); font-size: 12.5px; }
.kcard .val { color: var(--ok); font-weight: 700; font-size: 12.5px; }
.kcol.won .kcard { border-left-color: var(--ok); }
.kcol.lost .kcard { border-left-color: var(--bad); opacity: .75; }

/* Inbox */
.inbox { display: grid; grid-template-columns: 300px 1fr; gap: 14px; height: calc(100vh - 140px); }
.convs { background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); overflow-y: auto; }
.conv { padding: 12px 14px; border-bottom: 1px solid var(--line); cursor: pointer; }
.conv:hover, .conv.active { background: #fff4ec; }
.conv .n { font-weight: 600; }
.conv .p { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thread { background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); display: flex; flex-direction: column; }
.msgs { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.bubble { max-width: 70%; padding: 8px 12px; border-radius: 14px; font-size: 13.5px; }
.bubble.out { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 4px; }
.bubble.in { align-self: flex-start; background: #eef1f4; border-bottom-left-radius: 4px; }
.bubble .st { display: block; font-size: 10.5px; opacity: .7; margin-top: 2px; }
.compose { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); }

/* Modal */
.modal-back { position: fixed; inset: 0; background: rgba(13,18,25,.5); display: grid; place-items: center; z-index: 50; }
.modal { background: #fff; border-radius: 14px; width: min(480px, 94vw); max-height: 90vh; overflow-y: auto; padding: 22px; }
.modal h2 { font-size: 17px; margin-bottom: 14px; }
.modal label { display: block; font-weight: 600; font-size: 12.5px; margin: 10px 0 4px; }
.modal .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }

.pill { display: inline-block; border-radius: 20px; padding: 2px 10px; font-size: 11.5px; font-weight: 600; }
.pill.open { background: #fff1e6; color: #c05010; }
.pill.won { background: #e6f7ee; color: var(--ok); }
.pill.lost { background: #fdeceb; color: var(--bad); }
.muted { color: var(--muted); }
.empty { color: var(--muted); text-align: center; padding: 34px 0; }
@media (max-width: 860px) { .shell { grid-template-columns: 64px 1fr; } .side .logo, .side a.nav span, .side .who, .tenant-badge { display: none; } .main { padding: 16px; } .inbox { grid-template-columns: 1fr; } }
