:root {
  --bg: #090b0a;
  --panel: #101311;
  --panel-2: #151916;
  --panel-3: #1b211d;
  --line: #293029;
  --line-soft: #202620;
  --text: #f3f5ef;
  --muted: #8d978e;
  --muted-2: #687169;
  --lime: #c6ff56;
  --lime-2: #9dde31;
  --lime-soft: rgba(198, 255, 86, .1);
  --orange: #ffb664;
  --red: #ff6f70;
  --blue: #73b8ff;
  --radius: 16px;
  --shadow: 0 28px 70px rgba(0, 0, 0, .45);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); }
button, input, textarea, select { font: inherit; }
button { color: inherit; }
[hidden] { display: none !important; }

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 12% 8%, rgba(198,255,86,.12), transparent 28%),
    radial-gradient(circle at 84% 86%, rgba(115,184,255,.08), transparent 26%),
    var(--bg);
}

.login-card {
  width: min(430px, 100%);
  padding: 38px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: linear-gradient(145deg, rgba(22,27,23,.98), rgba(12,15,13,.98));
  box-shadow: var(--shadow);
}

.login-card h1 { font-size: 34px; letter-spacing: -.04em; margin: 12px 0 8px; }
.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: var(--lime);
  color: #0c1008;
  font-weight: 900;
  box-shadow: 0 0 0 5px rgba(198,255,86,.08);
}

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 236px minmax(0, 1fr); }
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
  border-right: 1px solid var(--line-soft);
  background: #0c0f0d;
}

.brand { display: flex; align-items: center; gap: 12px; padding: 0 10px 28px; }
.brand strong { display: block; font-size: 15px; }
.brand span { display: block; margin-top: 3px; font-size: 11px; color: var(--muted-2); }
.navigation { display: grid; gap: 5px; }
.nav-item {
  width: 100%;
  min-height: 43px;
  display: grid;
  grid-template-columns: 24px 1fr auto;
  align-items: center;
  gap: 9px;
  border: 0;
  border-radius: 11px;
  padding: 0 12px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  cursor: pointer;
  transition: .18s ease;
}
.nav-item span { color: var(--muted-2); font-size: 17px; }
.nav-item b { min-width: 23px; padding: 2px 6px; border-radius: 8px; background: var(--panel-3); color: var(--muted); font-size: 10px; text-align: center; }
.nav-item:hover { background: var(--panel); color: var(--text); }
.nav-item.active { background: var(--lime-soft); color: var(--lime); }
.nav-item.active span { color: var(--lime); }
.sidebar-footer { margin-top: auto; padding: 16px 10px 0; border-top: 1px solid var(--line-soft); }
.system-state { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 11px; }
.system-state i { width: 7px; height: 7px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 12px var(--lime); }
.quiet-button { margin-top: 13px; padding: 0; border: 0; background: transparent; color: var(--muted-2); cursor: pointer; font-size: 11px; }

.main { min-width: 0; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 94px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px clamp(24px, 4vw, 58px);
  border-bottom: 1px solid var(--line-soft);
  background: rgba(9,11,10,.88);
  backdrop-filter: blur(18px);
}
.topbar h1 { margin: 3px 0 0; font-size: 25px; line-height: 1; letter-spacing: -.03em; }
.eyebrow { margin: 0; color: var(--lime-2); font-size: 9px; letter-spacing: .16em; font-weight: 800; text-transform: uppercase; }
.topbar-actions { display: flex; align-items: center; gap: 9px; }
.last-updated { color: var(--muted-2); font-size: 10px; margin-right: 6px; }
.workspace { padding: 32px clamp(24px, 4vw, 58px) 64px; max-width: 1500px; margin: 0 auto; }

.button, .icon-button, .quiet-button, .chip, .lead-row { -webkit-tap-highlight-color: transparent; }
.button {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 15px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 750;
  cursor: pointer;
  transition: .16s ease;
}
.button:hover { transform: translateY(-1px); }
.button:disabled { opacity: .45; cursor: wait; transform: none; }
.button.primary { background: var(--lime); color: #10150a; }
.button.primary:hover { background: #d5ff7b; }
.button.secondary { border-color: var(--line); background: var(--panel-2); color: var(--text); }
.button.ghost { border-color: var(--line); background: transparent; color: var(--muted); }
.button.danger { border-color: rgba(255,111,112,.28); background: rgba(255,111,112,.07); color: var(--red); }
.button.wide { width: 100%; }
.button.small { min-height: 31px; padding: 0 10px; font-size: 10px; }
.icon-button {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-2);
  cursor: pointer;
}
.icon-button:hover { border-color: #3b453c; background: var(--panel-3); }

.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; }
.stat-card, .panel, .entity-card {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: linear-gradient(145deg, rgba(20,24,21,.96), rgba(14,17,15,.96));
}
.stat-card { padding: 20px; min-height: 128px; display: flex; flex-direction: column; justify-content: space-between; }
.stat-card header { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 11px; }
.stat-card header span:last-child { font-size: 16px; color: var(--muted-2); }
.stat-card strong { display: block; margin-top: 12px; font-size: 34px; letter-spacing: -.04em; }
.stat-card small { color: var(--muted-2); font-size: 9px; }
.stat-card.accent { border-color: rgba(198,255,86,.24); background: linear-gradient(145deg, rgba(198,255,86,.1), rgba(14,17,15,.98)); }

.content-grid { margin-top: 16px; display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(290px, .7fr); gap: 16px; }
.panel { overflow: hidden; }
.panel-header { min-height: 62px; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 15px 18px; border-bottom: 1px solid var(--line-soft); }
.panel-header h2, .section-heading h2 { margin: 0; font-size: 14px; letter-spacing: -.01em; }
.panel-header p, .section-heading p { margin: 5px 0 0; color: var(--muted-2); font-size: 10px; }
.panel-body { padding: 18px; }

.overview-section + .overview-section { margin-top: 22px; }
.overview-section-header { display: flex; align-items: center; gap: 9px; margin: 0 0 9px 2px; }
.overview-section-header h2 { margin: 0; font-size: 14px; }
.overview-section-header span { min-width: 23px; padding: 3px 6px; border-radius: 7px; background: var(--panel-3); color: var(--muted); font-size: 9px; text-align: center; }
.overview-section.hot .overview-section-header h2 { color: var(--lime); }
.overview-section.hot .overview-replies { border-color: rgba(198,255,86,.24); }
.overview-replies { overflow-x: auto; }
.overview-row {
  min-width: 1160px;
  display: grid;
  grid-template-columns: 110px minmax(175px, 1fr) minmax(175px, 1fr) 120px minmax(250px, 1.4fr) 95px 105px;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
}
.overview-head {
  border-bottom: 1px solid var(--line);
  color: var(--muted-2);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.overview-lead {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.overview-lead:last-child { border-bottom: 0; }
.overview-lead:hover { background: rgba(255,255,255,.018); }
.overview-account strong { color: var(--lime); font-size: 10px; }
.overview-contact strong, .overview-company strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.overview-contact small, .overview-company small { display: block; margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted-2); font-size: 8px; }
.overview-reply { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; color: var(--muted); font-size: 9px; line-height: 1.45; }
.overview-date { color: var(--muted-2); font-size: 9px; }
.overview-empty { padding: 28px 18px; color: var(--muted-2); font-size: 10px; }
.our-reply-status { display: inline-flex; align-items: center; min-height: 24px; padding: 0 8px; border: 1px solid rgba(198,255,86,.24); border-radius: 8px; background: var(--lime-soft); color: var(--lime); font-size: 8px; font-style: normal; font-weight: 800; white-space: nowrap; }
.explee-intent { display: inline-flex; align-items: center; min-height: 24px; padding: 0 8px; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); background: rgba(255,255,255,.02); font-size: 8px; font-style: normal; font-weight: 800; white-space: nowrap; }
.explee-intent.hot-lead, .explee-intent.interested, .explee-intent.positive { border-color: rgba(198,255,86,.28); color: var(--lime); background: var(--lime-soft); }
.explee-intent.not-interested, .explee-intent.negative { border-color: rgba(255,111,112,.28); color: var(--red); background: rgba(255,111,112,.07); }
.explee-intent.out-of-office, .explee-intent.email-changed { border-color: rgba(115,184,255,.24); color: var(--blue); background: rgba(115,184,255,.06); }

.lead-list { display: grid; }
.lead-row {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(190px, 1.1fr) minmax(160px, .9fr) minmax(220px, 1.5fr) 96px 24px;
  align-items: center;
  gap: 14px;
  padding: 15px 18px;
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.lead-row:last-child { border-bottom: 0; }
.lead-row:hover { background: rgba(255,255,255,.018); }
.identity { min-width: 0; display: flex; align-items: center; gap: 11px; }
.avatar { flex: 0 0 auto; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 11px; background: #252d26; color: var(--lime); font-size: 11px; font-weight: 850; }
.identity strong, .company strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.identity small, .company small, .reply-preview { color: var(--muted); font-size: 10px; }
.identity small, .company small { display: block; margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reply-preview { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.45; }
.row-arrow { color: var(--muted-2); }
.status { display: inline-flex; align-items: center; gap: 5px; width: fit-content; padding: 4px 8px; border-radius: 20px; border: 1px solid var(--line); color: var(--muted); font-size: 8px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.status::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.status.new { color: var(--orange); border-color: rgba(255,182,100,.22); background: rgba(255,182,100,.06); }
.status.researching { color: var(--blue); border-color: rgba(115,184,255,.22); background: rgba(115,184,255,.06); }
.status.ready, .status.drafted { color: var(--lime); border-color: rgba(198,255,86,.22); background: rgba(198,255,86,.06); }
.status.error { color: var(--red); border-color: rgba(255,111,112,.22); background: rgba(255,111,112,.06); }

.mini-list { display: grid; gap: 11px; }
.mini-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 11px; border-bottom: 1px solid var(--line-soft); }
.mini-item:last-child { border-bottom: 0; padding-bottom: 0; }
.mini-item strong { display: block; font-size: 11px; }
.mini-item small { display: block; margin-top: 4px; color: var(--muted-2); font-size: 9px; }
.progress-track { height: 5px; overflow: hidden; margin-top: 7px; border-radius: 10px; background: #242a25; }
.progress-track i { display: block; height: 100%; border-radius: inherit; background: var(--lime); }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 15px; }
.toolbar-group { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.search-input { min-width: min(360px, 60vw); }
.input, input, textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #0c0f0d;
  color: var(--text);
  outline: 0;
}
input, select { min-height: 40px; padding: 0 12px; }
textarea { min-height: 130px; padding: 11px 12px; line-height: 1.5; resize: vertical; }
input:focus, textarea:focus, select:focus { border-color: rgba(198,255,86,.55); box-shadow: 0 0 0 3px rgba(198,255,86,.06); }
.filter-tabs { display: flex; gap: 4px; padding: 4px; border: 1px solid var(--line-soft); border-radius: 11px; background: #0c0f0d; }
.chip { min-height: 29px; padding: 0 10px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font-size: 9px; cursor: pointer; }
.chip.active { background: var(--panel-3); color: var(--lime); }

.cards-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.entity-card { padding: 19px; }
.entity-card header { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }
.entity-card h3 { margin: 0; font-size: 14px; }
.entity-card .meta { margin-top: 7px; color: var(--muted-2); font-size: 9px; }
.entity-card p { color: var(--muted); font-size: 10px; line-height: 1.55; }
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; }
.tag { display: inline-flex; align-items: center; min-height: 23px; padding: 0 8px; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); font-size: 8px; }
.tag.lime { border-color: rgba(198,255,86,.24); color: var(--lime); background: var(--lime-soft); }
.card-actions { display: flex; gap: 7px; margin-top: 15px; }
.section-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 18px; margin-bottom: 16px; }

.empty { min-height: 240px; display: grid; place-items: center; padding: 40px; text-align: center; }
.empty strong { display: block; font-size: 15px; }
.empty p { max-width: 440px; color: var(--muted); font-size: 11px; line-height: 1.6; }
.loading { min-height: 330px; display: grid; place-items: center; color: var(--muted); font-size: 11px; }
.spinner { width: 24px; height: 24px; margin: 0 auto 12px; border: 2px solid var(--line); border-top-color: var(--lime); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.drawer-backdrop { position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.55); backdrop-filter: blur(2px); }
.lead-drawer {
  position: fixed;
  z-index: 50;
  top: 0;
  right: 0;
  width: min(840px, 94vw);
  height: 100vh;
  overflow-y: auto;
  border-left: 1px solid var(--line);
  background: #0d100e;
  box-shadow: var(--shadow);
}
.drawer-header { position: sticky; top: 0; z-index: 4; padding: 21px 24px; border-bottom: 1px solid var(--line); background: rgba(13,16,14,.94); backdrop-filter: blur(18px); }
.drawer-header-row { display: flex; justify-content: space-between; gap: 18px; }
.drawer-header h2 { margin: 9px 0 4px; font-size: 24px; letter-spacing: -.035em; }
.drawer-header p { margin: 0; color: var(--muted); font-size: 11px; }
.drawer-actions { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.drawer-content { padding: 21px 24px 60px; }
.detail-tabs { display: flex; gap: 5px; margin-bottom: 17px; overflow-x: auto; }
.detail-tab { white-space: nowrap; }
.detail-section { margin-bottom: 16px; border: 1px solid var(--line-soft); border-radius: 14px; background: var(--panel); overflow: hidden; }
.detail-section > header { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 13px 15px; border-bottom: 1px solid var(--line-soft); }
.detail-section > header h3 { margin: 0; font-size: 12px; }
.detail-section-body { padding: 15px; }
.message { margin-bottom: 12px; padding: 14px; border: 1px solid var(--line-soft); border-radius: 12px; background: #0b0e0c; }
.message.reply { border-color: rgba(198,255,86,.18); background: rgba(198,255,86,.035); }
.message:last-child { margin-bottom: 0; }
.message header { display: flex; justify-content: space-between; gap: 12px; color: var(--muted-2); font-size: 8px; }
.message strong { color: var(--text); }
.message pre { margin: 11px 0 0; white-space: pre-wrap; word-break: break-word; color: #cdd2cc; font: 10px/1.6 inherit; }
.people-list { display: grid; gap: 10px; }
.person-card { padding: 13px; border: 1px solid var(--line-soft); border-radius: 11px; background: #0b0e0c; }
.person-card header { display: flex; justify-content: space-between; gap: 12px; }
.person-card h4 { margin: 0; font-size: 11px; }
.person-card small { display: block; margin-top: 4px; color: var(--muted-2); font-size: 8px; }
.markdown { color: #c7cdc7; font-size: 10px; line-height: 1.65; overflow-wrap: anywhere; }
.markdown h3 { margin: 17px 0 7px; color: var(--text); font-size: 12px; }
.markdown h3:first-child { margin-top: 0; }
.markdown a { color: var(--lime-2); }
.markdown ul { padding-left: 18px; }
.markdown p { margin: 8px 0; }
.offer-check { display: flex; align-items: flex-start; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--line-soft); }
.offer-check:last-child { border-bottom: 0; }
.offer-check input { width: 16px; min-height: 16px; margin-top: 1px; }
.offer-check strong { display: block; font-size: 10px; }
.offer-check small { display: block; margin-top: 4px; color: var(--muted); font-size: 8px; line-height: 1.45; }
.draft-editor { display: grid; gap: 10px; }
.draft-editor textarea { min-height: 260px; }
.draft-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.job-strip { margin-top: 12px; padding: 10px 12px; border: 1px solid rgba(115,184,255,.2); border-radius: 10px; background: rgba(115,184,255,.055); color: var(--blue); font-size: 9px; }

.modal { width: min(720px, calc(100vw - 32px)); max-height: calc(100vh - 40px); padding: 0; border: 1px solid var(--line); border-radius: 18px; background: #0e110f; color: var(--text); box-shadow: var(--shadow); }
.modal::backdrop { background: rgba(0,0,0,.68); backdrop-filter: blur(3px); }
.modal-frame { max-height: calc(100vh - 42px); display: flex; flex-direction: column; }
.modal-header, .modal-footer { flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 17px 20px; border-bottom: 1px solid var(--line); }
.modal-header h2 { margin: 5px 0 0; font-size: 18px; }
.modal-body { overflow-y: auto; padding: 20px; }
.modal-footer { justify-content: flex-end; border-top: 1px solid var(--line); border-bottom: 0; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.field { display: grid; gap: 7px; margin-top: 15px; }
.field:first-child { margin-top: 0; }
.field.full { grid-column: 1 / -1; }
.field span { color: var(--muted); font-size: 9px; font-weight: 700; }
.field small { color: var(--muted-2); font-size: 8px; line-height: 1.4; }
.check-field { display: flex; align-items: center; gap: 9px; min-height: 40px; }
.check-field input { width: 16px; min-height: 16px; }
.form-error { padding: 9px 11px; border-radius: 9px; background: rgba(255,111,112,.08); color: var(--red); font-size: 10px; }

.toast-stack { position: fixed; z-index: 100; right: 20px; bottom: 20px; display: grid; gap: 8px; }
.toast { width: min(360px, calc(100vw - 40px)); padding: 12px 14px; border: 1px solid var(--line); border-radius: 11px; background: #171c18; box-shadow: var(--shadow); color: var(--text); font-size: 10px; animation: toast-in .2s ease both; }
.toast.error { border-color: rgba(255,111,112,.35); color: #ffd0d0; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

.activity-table { width: 100%; border-collapse: collapse; font-size: 9px; }
.activity-table th { padding: 10px; color: var(--muted-2); text-align: left; font-size: 8px; text-transform: uppercase; letter-spacing: .08em; }
.activity-table td { padding: 11px 10px; border-top: 1px solid var(--line-soft); color: var(--muted); }
.activity-table strong { color: var(--text); }

@media (max-width: 1040px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .content-grid { grid-template-columns: 1fr; }
  .lead-row { grid-template-columns: minmax(180px, 1fr) minmax(150px, .8fr) 96px 20px; }
  .lead-row .reply-preview { display: none; }
}

@media (max-width: 760px) {
  .app-shell { display: block; }
  .sidebar { position: fixed; z-index: 30; top: auto; bottom: 0; width: 100%; height: 67px; padding: 7px 9px; border: 0; border-top: 1px solid var(--line); }
  .brand, .sidebar-footer { display: none; }
  .navigation { height: 100%; display: grid; grid-template-columns: repeat(6, 1fr); gap: 2px; }
  .nav-item { min-height: 52px; display: flex; flex-direction: column; justify-content: center; gap: 3px; padding: 0 2px; font-size: 7px; text-align: center; }
  .nav-item span { font-size: 15px; }
  .nav-item b { display: none; }
  .topbar { min-height: 78px; padding: 14px 17px; }
  .topbar-actions .last-updated, #sync-button { display: none; }
  .workspace { padding: 20px 14px 94px; }
  .overview-row { min-width: 0; grid-template-columns: 76px minmax(0, 1fr) 106px 78px; gap: 8px; padding: 12px; }
  .overview-company, .overview-reply, .overview-date { display: none; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 9px; }
  .stat-card { min-height: 105px; padding: 15px; }
  .stat-card strong { font-size: 28px; }
  .cards-grid { grid-template-columns: 1fr; }
  .toolbar { align-items: stretch; flex-direction: column; }
  .search-input { min-width: 0; }
  .lead-row { grid-template-columns: minmax(0, 1fr) 80px 16px; gap: 8px; padding: 13px; }
  .lead-row .company { display: none; }
  .panel-header { padding: 13px; }
  .lead-drawer { width: 100vw; }
  .drawer-header, .drawer-content { padding-left: 16px; padding-right: 16px; }
  .form-grid { grid-template-columns: 1fr; }
  .field.full { grid-column: auto; }
}
