:root {
  color-scheme: dark;
  font-family: Inter, Arial, sans-serif;
  color: #f4f7f2;
  background: #050704;
  --bg: #050704;
  --panel: rgba(12, 16, 11, .92);
  --panel-2: rgba(17, 23, 15, .94);
  --line: rgba(151, 201, 74, .22);
  --line-soft: rgba(255, 255, 255, .09);
  --text: #f4f7f2;
  --muted: #9fae9d;
  --green: #94c83d;
  --orange: #ff8a00;
  --danger: #ff4d3d;
  --shadow: 0 22px 70px rgba(0, 0, 0, .34);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 18% 12%, rgba(148, 200, 61, .18), transparent 28%),
    radial-gradient(circle at 82% 18%, rgba(255, 138, 0, .13), transparent 30%),
    linear-gradient(135deg, #050704 0%, #0d120b 48%, #050704 100%);
  color: var(--text);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(rgba(255, 255, 255, .025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .018) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, .75), transparent 75%);
}

button,
input,
select,
textarea {
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  font: inherit;
}

button {
  min-height: 36px;
  padding: 8px 14px;
  background: linear-gradient(135deg, var(--green), #5f9f22);
  color: #081006;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(148, 200, 61, .16);
  transition: border-color .16s ease, box-shadow .16s ease, filter .16s ease, transform .16s ease;
}

button:disabled {
  opacity: .62;
  cursor: not-allowed;
}

button:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0);
}

input,
select,
textarea {
  width: 100%;
  padding: 11px 12px;
  background: rgba(3, 5, 3, .62);
  color: var(--text);
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(148, 200, 61, .66);
  box-shadow: 0 0 0 3px rgba(148, 200, 61, .13);
}

input::placeholder,
textarea::placeholder {
  color: #6f7b70;
}

textarea {
  min-height: 132px;
  resize: vertical;
}

h1,
h2,
p {
  margin: 0;
}

.shell {
  width: 100%;
  min-height: 100vh;
  margin: 0;
  padding: 22px clamp(22px, 3vw, 58px) 44px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 78px;
  margin-bottom: 18px;
  padding: 14px 0 18px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  color: var(--orange);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .14em;
}

.topbar h1 {
  margin-top: 6px;
  font-size: clamp(30px, 3vw, 48px);
  line-height: 1;
  letter-spacing: 0;
}

.account-line {
  margin-top: 6px;
  color: #cbd8c8;
  font-size: 14px;
}

.module-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.module-nav a {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border: 1px solid rgba(148, 200, 61, .26);
  border-radius: 7px;
  background: rgba(3, 5, 3, .38);
  color: #dbe8d8;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}

.module-nav a:hover {
  border-color: rgba(255, 138, 0, .45);
  color: #fff;
}

.top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.top-actions button,
.button-secondary {
  width: auto;
  background: transparent;
  color: var(--green);
  border-color: rgba(148, 200, 61, .42);
  box-shadow: none;
}

.button-secondary:hover {
  border-color: rgba(148, 200, 61, .7);
  box-shadow: 0 8px 22px rgba(148, 200, 61, .11);
}

.language-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 4px 5px 4px 10px;
  border: 1px solid rgba(148, 200, 61, .28);
  border-radius: 7px;
  background: rgba(3, 5, 3, .45);
  color: var(--muted);
  font-size: 12px;
}

.language-switch select {
  appearance: none;
  width: 66px;
  min-height: 28px;
  padding: 4px 22px 4px 8px;
  border-color: transparent;
  background-color: rgba(255, 255, 255, .045);
  color: var(--text);
  font-weight: 700;
}

.language-switch::after {
  content: "";
  position: absolute;
  right: 12px;
  width: 7px;
  height: 7px;
  margin-top: -3px;
  border-right: 2px solid rgba(244, 247, 242, .72);
  border-bottom: 2px solid rgba(244, 247, 242, .72);
  transform: rotate(45deg);
  pointer-events: none;
}

.language-switch option {
  background: #091008;
  color: #f4f7f2;
}

.button-compact {
  width: auto;
  min-height: 30px;
  padding: 6px 10px;
  border: 1px solid rgba(148, 200, 61, .34);
  background: rgba(148, 200, 61, .08);
  color: var(--green);
  box-shadow: none;
  white-space: nowrap;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.stat,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.stat {
  position: relative;
  overflow: hidden;
  min-height: 96px;
  padding: 15px;
}

.stat::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  width: 46%;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--orange));
}

.stat strong {
  display: block;
  color: var(--green);
  font-size: clamp(28px, 2.4vw, 42px);
  line-height: .95;
}

.stat span {
  display: block;
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
}

.stat em {
  display: inline-block;
  margin-top: 8px;
  color: rgba(255, 138, 0, .78);
  font-size: 11px;
  font-style: normal;
}

.stat-clickable {
  cursor: pointer;
  outline: none;
}

.stat-clickable:hover,
.stat-clickable:focus-visible {
  border-color: rgba(255, 138, 0, .55);
  box-shadow: 0 18px 46px rgba(255, 138, 0, .12);
  transform: translateY(-1px);
}

.panel-grid {
  display: grid;
  grid-template-columns: minmax(420px, .82fr) minmax(520px, 1.18fr);
  gap: 18px;
  margin-bottom: 18px;
}

.panel {
  padding: 18px;
}

.panel h2 {
  margin-bottom: 14px;
  color: #ffffff;
  font-size: 17px;
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.panel-actions {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.panel-heading h2 {
  margin-bottom: 6px;
}

.detail-panel {
  margin-bottom: 18px;
  padding: 0;
  overflow: hidden;
}

.panel-toggle {
  width: 100%;
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 18px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #fff;
  box-shadow: none;
  text-align: left;
  font-size: 17px;
}

.panel-toggle::after {
  content: "−";
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(148, 200, 61, .35);
  border-radius: 7px;
  color: var(--green);
  font-size: 18px;
}

.panel-toggle:hover {
  background: rgba(255, 255, 255, .025);
  transform: none;
}

.toggle-meta {
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.panel-body {
  padding: 0 18px 18px;
}

.detail-panel.is-collapsed .panel-body {
  display: none;
}

.detail-panel.is-collapsed .panel-toggle::after {
  content: "+";
}

.leads-panel {
  margin-bottom: 18px;
}

.leads-list {
  display: grid;
  gap: 12px;
}

.lead-card {
  display: grid;
  gap: 13px;
  padding: 14px;
  border: 1px solid rgba(255, 138, 0, .28);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(19, 25, 16, .96), rgba(8, 12, 7, .96)),
    linear-gradient(135deg, rgba(255, 138, 0, .08), transparent 42%);
}

.lead-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: start;
}

.lead-reason {
  display: inline-flex;
  width: fit-content;
  margin-bottom: 8px;
  padding: 5px 8px;
  border: 1px solid rgba(255, 138, 0, .34);
  border-radius: 999px;
  background: rgba(255, 138, 0, .12);
  color: #ffb45c;
  font-size: 11px;
  font-weight: 800;
}

.lead-card h3 {
  margin: 0;
  color: #fff;
  font-size: 18px;
}

.lead-card p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.lead-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(72px, 1fr));
  gap: 8px;
}

.lead-metrics span {
  min-height: 58px;
  display: grid;
  place-items: center;
  gap: 3px;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 7px;
  background: rgba(255, 255, 255, .04);
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.lead-metrics strong {
  color: var(--green);
  font-size: 22px;
  line-height: 1;
}

.lead-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  color: #c5d3c3;
  font-size: 12px;
}

.lead-action-form {
  display: grid;
  grid-template-columns: minmax(150px, .8fr) 116px minmax(220px, 1fr) auto;
  gap: 9px;
  align-items: end;
}

.lead-action-form label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 11px;
}

.lead-action-form button {
  white-space: nowrap;
}

.lead-actions-list {
  display: grid;
  gap: 8px;
  padding-top: 2px;
}

.lead-actions-list > strong {
  color: #dbe8d8;
  font-size: 12px;
}

.lead-actions-list div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid rgba(148, 200, 61, .16);
  border-radius: 7px;
  background: rgba(148, 200, 61, .055);
}

.lead-actions-list div span {
  color: #dce8d8;
  font-size: 12px;
}

.stack {
  display: grid;
  gap: 10px;
}

.stack button {
  justify-self: start;
  min-width: 178px;
  margin-top: 2px;
}

.stack button,
.login-box button {
  border-color: rgba(148, 200, 61, .55);
}

.company-form {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(180px, 1fr) minmax(160px, 1fr) minmax(150px, .7fr) auto;
  gap: 10px;
  margin-bottom: 16px;
}

.company-form button {
  white-space: nowrap;
}

.crm-panel {
  margin-bottom: 18px;
}

.crm-board {
  display: grid;
  grid-auto-columns: minmax(236px, 1fr);
  grid-auto-flow: column;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 6px;
}

.crm-column {
  min-width: 236px;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 8px;
  background: rgba(3, 5, 3, .34);
}

.crm-column header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 44px;
  padding: 0 12px;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.crm-column header strong {
  color: #f4f7f2;
  font-size: 13px;
}

.crm-column header span {
  display: inline-grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  border-radius: 999px;
  background: rgba(148, 200, 61, .12);
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
}

.crm-column-body {
  display: grid;
  align-content: start;
  gap: 9px;
  min-height: 210px;
  padding: 10px;
}

.crm-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(148, 200, 61, .18);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(20, 27, 18, .98), rgba(9, 13, 8, .98)),
    linear-gradient(135deg, rgba(255, 138, 0, .08), transparent 45%);
  box-shadow: 0 12px 34px rgba(0, 0, 0, .24);
}

.crm-card-main {
  display: grid;
  gap: 3px;
}

.crm-card-main strong {
  color: #ffffff;
  font-size: 14px;
}

.crm-card-main span,
.crm-card-main a,
.crm-card-footer span {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.crm-card-main a {
  color: #ffbd72;
}

.crm-card-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
}

.crm-card-stats span {
  padding: 6px;
  border-radius: 6px;
  background: rgba(255, 255, 255, .045);
  color: #cbd8c8;
  font-size: 11px;
  text-align: center;
}

.crm-status-select {
  min-height: 32px;
  padding: 6px 9px;
  font-size: 12px;
}

.crm-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.crm-details {
  margin-top: 16px;
  padding: 16px;
  border: 1px solid rgba(255, 138, 0, .28);
  border-radius: 8px;
  background: rgba(255, 138, 0, .055);
}

.crm-detail-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(160px, 220px);
  gap: 14px;
  align-items: start;
  margin-bottom: 14px;
}

.crm-detail-header h3 {
  margin: 4px 0 5px;
  font-size: clamp(20px, 2.2vw, 30px);
}

.crm-detail-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}

.crm-detail-grid article {
  min-height: 88px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 8px;
  background: rgba(255, 255, 255, .035);
}

.crm-detail-grid span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
}

.crm-detail-grid strong,
.crm-detail-grid a {
  color: #f4f7f2;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.note-form {
  display: grid;
  gap: 9px;
  margin-bottom: 14px;
}

.note-form button {
  justify-self: start;
}

.notes-list {
  display: grid;
  gap: 9px;
}

.notes-list h4 {
  margin: 0;
  font-size: 14px;
}

.notes-list article {
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 8px;
  background: rgba(3, 5, 3, .32);
}

.notes-list article p {
  color: #eef4eb;
  line-height: 1.45;
}

.notes-list article span {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 11px;
}

.inline {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 13px;
}

.inline input {
  width: auto;
  accent-color: var(--green);
}

.list {
  display: grid;
  gap: 9px;
  max-height: 240px;
  overflow: auto;
  margin-top: 14px;
  padding-right: 4px;
}

.mailbox {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  background: rgba(255, 255, 255, .035);
}

.mailbox strong {
  display: block;
  color: #fff;
  font-size: 13px;
}

.mailbox span,
.muted {
  color: var(--muted);
  font-size: 12px;
}

.badge {
  align-self: start;
  padding: 4px 8px;
  border: 1px solid rgba(255, 138, 0, .32);
  border-radius: 999px;
  background: rgba(255, 138, 0, .12);
  color: #ffb45c;
  font-size: 12px;
}

.table {
  overflow: auto;
}

table {
  width: 100%;
  min-width: 920px;
  border-collapse: collapse;
  font-size: 13px;
}

th,
td {
  padding: 13px 10px;
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
  vertical-align: top;
}

th {
  color: #c5d3c3;
  font-weight: 700;
}

td {
  color: #eef4eb;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}

.login-box {
  width: min(100%, 390px);
  display: grid;
  gap: 13px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  box-shadow: var(--shadow);
}

.login-box label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

.error {
  color: var(--danger);
  font-size: 13px;
}

@media (max-width: 1040px) {
  .stats {
    grid-template-columns: repeat(3, 1fr);
  }

  .panel-grid {
    grid-template-columns: 1fr 1fr;
  }

  .company-form {
    grid-template-columns: 1fr 1fr;
  }

  .company-form button {
    justify-self: start;
  }

  .crm-detail-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .shell {
    padding: 18px 14px 28px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .top-actions {
    width: 100%;
    justify-content: space-between;
  }

  .stats {
    grid-template-columns: 1fr 1fr;
  }

  .panel-grid {
    grid-template-columns: 1fr;
  }

  .panel-heading,
  .crm-detail-header {
    grid-template-columns: 1fr;
  }

  .panel-heading {
    flex-direction: column;
  }

  .panel-actions {
    justify-content: flex-start;
  }

  .company-form {
    grid-template-columns: 1fr;
  }

  .lead-main,
  .lead-action-form {
    grid-template-columns: 1fr;
  }

  .lead-metrics {
    grid-template-columns: repeat(3, 1fr);
  }

  .crm-board {
    grid-auto-columns: minmax(252px, 84vw);
  }

  table {
    min-width: 760px;
  }
}
