* { box-sizing: border-box; margin: 0; }
:root {
  --bg: #fafafa; --card: #ffffff; --line: #e7e7e5;
  --text: #16161a; --muted: #71717a; --soft: #f4f4f3;
}
html, body { height: 100%; }
body { background: var(--bg); color: var(--text); font: 14px/1.55 'Inter', -apple-system, sans-serif; -webkit-font-smoothing: antialiased; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
h1, h2 { font-weight: 600; letter-spacing: -0.01em; }

/* login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 44px 36px; width: 100%; max-width: 380px; text-align: center; }
.login-mark { width: 44px; height: 44px; border-radius: 12px; background: var(--text); color: #fff; font-weight: 700; font-size: 20px; display: flex; align-items: center; justify-content: center; margin: 0 auto 16px; }
.login-card h1 { font-size: 18px; margin-bottom: 4px; }
.login-card form { margin-top: 24px; display: flex; flex-direction: column; gap: 10px; }
.login-msg { margin-top: 14px; font-size: 13px; color: var(--muted); }

input, button { font: inherit; }
input[type='email'], input[type='search'] {
  background: var(--card); color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; width: 100%;
}
input::placeholder { color: #a1a1aa; }
input:focus { outline: none; border-color: var(--text); }
button { background: var(--text); color: #fff; border: 0; border-radius: 10px; padding: 10px 16px; font-weight: 500; cursor: pointer; }
button:hover { opacity: 0.9; }
button.ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); }
button.ghost:hover { color: var(--text); opacity: 1; }
button:disabled { opacity: 0.5; }

/* shell + sidebar */
.shell { display: flex; min-height: 100vh; }
.sidebar { width: 230px; flex-shrink: 0; background: var(--card); border-right: 1px solid var(--line); padding: 24px 16px; display: flex; flex-direction: column; gap: 6px; position: sticky; top: 0; height: 100vh; }
.side-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 15px; padding: 0 8px 18px; }
.mark { width: 30px; height: 30px; border-radius: 9px; background: var(--text); color: #fff; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; font-size: 15px; }
.side-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); padding: 0 8px 6px; }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.tab { background: transparent; color: var(--muted); text-align: left; font-weight: 500; padding: 9px 12px; border-radius: 9px; }
.tab:hover { color: var(--text); background: var(--soft); opacity: 1; }
.tab.active { background: var(--soft); color: var(--text); font-weight: 600; }
.side-foot { margin-top: auto; }
.side-foot .ghost { width: 100%; text-align: left; }

main { flex: 1; padding: 36px 40px 80px; max-width: 1060px; }
.page-title { font-size: 24px; margin-bottom: 4px; }
.pagesub { margin-bottom: 24px; }
h2 { font-size: 15px; margin: 26px 0 12px; }

/* tables */
table { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-size: 12px; font-weight: 500; }
tr:last-child td { border-bottom: 0; }
.badge { border: 1px solid var(--line); background: var(--soft); border-radius: 999px; padding: 2px 10px; font-size: 12px; color: var(--text); }
.badge.warn { background: var(--text); color: #fff; border-color: var(--text); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; }
.dot.green { background: var(--text); }
.dot.amber { background: #b9b9b3; }
.dot.red { background: transparent; border: 2px solid var(--text); }
.dot.gray { background: transparent; border: 1px solid var(--line); }

/* cards + chart */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; }
.chart-card { margin-bottom: 8px; }
.chart-title { font-size: 12px; font-weight: 500; color: var(--muted); margin-bottom: 10px; }
.bars { display: flex; align-items: flex-end; gap: 2px; height: 90px; }
.bar-col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; position: relative; cursor: default; }
.bar { width: 100%; max-width: 34px; background: var(--text); border-radius: 4px 4px 0 0; }
.bar-label { font-size: 10px; color: var(--muted); height: 14px; order: -1; }
.bar-col:hover::after {
  content: attr(data-tip); position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%);
  background: var(--text); color: #fff; font-size: 11px; padding: 4px 8px; border-radius: 6px; white-space: nowrap; z-index: 10; margin-bottom: 4px;
}
.bar-axis { display: flex; justify-content: space-between; font-size: 10px; color: var(--muted); margin-top: 6px; }

/* employee detail */
.detail-card { margin-top: 14px; }
.detail-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.detail-head h2 { margin: 0; font-size: 16px; }
.detail-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin: 14px 0 4px; font-size: 13px; }
textarea { width: 100%; background: var(--card); color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font: inherit; resize: vertical; }
textarea:focus { outline: none; border-color: var(--text); }
.detail-actions { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.rowlink { cursor: pointer; }
.rowlink:hover td { background: var(--soft); }

/* conversation filters */
.conv-filters { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; }
select, input[type='date'] {
  background: var(--card); color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; font: inherit;
}
select:focus, input[type='date']:focus { outline: none; border-color: var(--text); }
.check { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; background: var(--card); }
.thread-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.folder-link { color: var(--text); font-size: 13px; text-decoration: none; border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; }
.folder-link:hover { border-color: var(--text); }

/* groups / import */
.import-card { margin-bottom: 8px; }
.import-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.import-row select, .import-row input[type='text'] { min-width: 200px; }
.dropzone { flex: 1; min-width: 260px; border: 1px dashed var(--line); border-radius: 10px; padding: 14px 16px; text-align: center; color: var(--muted); cursor: pointer; background: var(--soft); }
.dropzone.drag { border-color: var(--text); color: var(--text); }
.stat-row { margin: 14px 0 8px; }
.preview-lines { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--soft); font-size: 13px; }
.pl { padding: 3px 0; border-bottom: 1px solid var(--line); }
.pl:last-child { border-bottom: 0; }
#imp-preview { margin-top: 8px; }
#imp-actions { margin-top: 12px; display: flex; align-items: center; gap: 12px; }
.groups-head { display: flex; align-items: center; justify-content: space-between; }

/* compliance */
.sigcell { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border: 1px solid var(--line); border-radius: 7px; cursor: pointer; color: var(--muted); user-select: none; }
.sigcell:hover { border-color: var(--text); }
.sigcell.on { background: var(--text); color: #fff; border-color: var(--text); }
.due-over { font-weight: 600; text-decoration: underline; }

/* onboarding wizard */
.cap-banner { border: 1px solid var(--line); background: var(--soft); border-radius: 10px; padding: 10px 14px; font-size: 13px; margin-bottom: 18px; }
.cap-banner.warn { background: var(--text); color: #fff; border-color: var(--text); }
.wiz { list-style: none; counter-reset: none; padding: 0; margin: 0; }
.wiz-step { border: 1px solid var(--line); background: var(--card); border-radius: 12px; padding: 16px 18px; margin-bottom: 10px; }
.wiz-h { display: flex; align-items: center; gap: 10px; font-weight: 600; margin-bottom: 10px; }
.wiz-n { width: 24px; height: 24px; border-radius: 50%; background: var(--text); color: #fff; font-size: 13px; display: inline-flex; align-items: center; justify-content: center; }
.chk { display: flex; align-items: flex-start; gap: 8px; padding: 5px 0; font-size: 14px; color: var(--text); }
.chk input { margin-top: 3px; }
.wiz-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.wiz-grid input { background: var(--card); color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font: inherit; }
.wiz-grid input:focus { outline: none; border-color: var(--text); }
.wiz-step button { margin-right: 10px; }

/* conversations */
.conv-toolbar { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.conv-toolbar input { flex: 1; min-width: 220px; }
.conv-row { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 13px 16px; margin-bottom: 8px; cursor: pointer; }
.conv-row:hover { border-color: var(--text); }
.conv-meta { color: var(--muted); font-size: 13px; margin-top: 2px; }
#msg-search-results { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin-bottom: 16px; }
#msg-search-results h3 { font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.hit { border-top: 1px solid var(--line); padding: 9px 0; font-size: 13px; }

/* thread */
#thread-title { margin: 14px 0 18px; font-size: 18px; }
#thread-messages { max-width: 720px; }
.bubble { max-width: 78%; width: fit-content; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 8px 13px; margin: 6px 0; font-size: 14px; }
.bubble.out { margin-left: auto; background: var(--text); color: #fff; border-color: var(--text); }
.bubble.out a { color: #fff; }
.bubble a { color: var(--text); }
.bubble.out .muted { color: #a1a1aa; }
.sender { font-size: 11px; font-weight: 600; color: var(--muted); margin-bottom: 2px; }
.bubble.out .sender { color: #c8c8cc; }
.stamp { font-size: 11px; color: var(--muted); margin-top: 3px; }
.bubble.out .stamp { color: #8e8e93; }

@media (max-width: 720px) {
  .shell { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; flex-direction: row; align-items: center; padding: 10px 12px; gap: 8px; }
  .side-brand { padding: 0 6px 0 0; } .brand-name, .side-label { display: none; }
  .side-nav { flex-direction: row; flex: 1; }
  .side-foot { margin: 0; } .side-foot .ghost { width: auto; }
  main { padding: 20px 14px 60px; }
  th, td { padding: 9px 10px; font-size: 13px; }
  .bubble { max-width: 92%; }
}
