:root {
  color-scheme: light;
  --ink: #20302c;
  --muted: #5e706a;
  --line: #dce4e0;
  --paper: #f5f7f5;
  --white: #fff;
  --pine: #172c28;
  --green: #226754;
  --mint: #e6f2eb;
  --radius: 12px;
  font-family: "Instrument Sans", Inter, system-ui, -apple-system, sans-serif;
  font-size: 15px;
  color: var(--ink);
  background: var(--paper);
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 290px; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .55; }
:focus-visible { outline: 3px solid #578977; outline-offset: 3px; }
h1, h2, h3, p { margin: 0; }
small { color: var(--muted); font-size: .8rem; }
a { color: #226754; text-underline-offset: 3px; }
input, select, textarea {
  width: 100%; padding: .68rem .75rem; border: 1px solid #cbd8d2;
  border-radius: 8px; background: var(--white); min-height: 42px;
}
textarea { resize: vertical; }
label { font-size: .88rem; font-weight: 600; }
label > input, label > textarea, label > select { margin-top: .35rem; font-weight: 400; }
.primary, .secondary {
  padding: .65rem .95rem; border: 1px solid transparent; border-radius: 8px;
  font-weight: 650; white-space: nowrap; min-height: 42px;
}
.primary { background: var(--green); color: white; }
.primary:hover:not(:disabled) { background: #174b3b; }
.secondary { border-color: var(--line); background: var(--white); }
.secondary:hover:not(:disabled) { background: var(--mint); }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0;
  margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}
.startup { padding: 48px; color: var(--muted); }
.login-shell { min-height: 100svh; display: grid; grid-template-columns: 1fr 1fr; }
.login-story {
  padding: clamp(32px, 6vw, 100px); background: var(--pine); color: #f6fbf7;
  display: flex; flex-direction: column; justify-content: center;
  position: relative;
}
.login-story .brand { margin-bottom: 56px; }
.login-story h1 { font-size: clamp(2.7rem, 5.2vw, 5rem); letter-spacing: -.065em; line-height: 1.02; }
.login-story p { color: #b9cec4; margin-top: 22px; max-width: 340px; line-height: 1.55; }
.login-area { display: grid; place-items: center; padding: 28px; }
.login-form {
  width: min(100%, 420px); background: var(--white); border: 1px solid var(--line);
  padding: clamp(24px, 4vw, 44px); border-radius: 18px;
}
.login-form h2 { font-size: 1.8rem; letter-spacing: -.035em; }
.login-form p { color: var(--muted); margin: 8px 0 22px; line-height: 1.5; }
.login-form input { margin: 6px 0 14px; }
.login-form .primary { width: 100%; }
.login-form .error { color: #9f332c; font-size: .88rem; margin: 12px 0 0; }
.login-form .error:empty { display: none; }
.workspace { display: grid; grid-template-columns: 230px minmax(0,1fr); min-height: 100svh; }
.sidebar {
  padding: 25px 17px; min-width: 0; color: #eef6f0; background: var(--pine);
  display: flex; flex-direction: column; gap: 34px;
}
.brand { display: flex; align-items: center; gap: 11px; font-size: 1.22rem; font-weight: 750; line-height: 1.25; }
.sidebar .brand { padding: 0 6px; }
.brand-icon {
  width: 39px; height: 39px; border-radius: 10px; display: grid; place-items: center;
  color: var(--pine); background: #a6d5b8; font-weight: 850; font-size: 1.4rem;
}
.brand small { display: block; color: #b9cfc4; font-weight: 500; font-size: .76rem; }
.sidebar nav { display: grid; gap: 6px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; text-align: left; border: 0;
  background: none; color: #d2dfd8; border-radius: 8px; padding: 10px 12px;
  white-space: nowrap;
}
.nav-item.selected, .nav-item:hover { background: #2d453e; color: #fff; }
.nav-icon { width: 20px; text-align: center; color: #b2d6c2; }
.account {
  margin-top: auto; padding: 15px 5px 0; border-top: 1px solid #41554e;
  display: flex; align-items: center; gap: 10px; font-weight: 620; font-size: .85rem;
}
.avatar { width: 36px; height: 36px; flex: 0 0 36px; display: grid; place-items: center; border-radius: 50%; background: #34534a; }
.account button { display: block; border: 0; background: none; color: #c3d8cd; padding: 4px 0; font-size: .78rem; }
.account button:hover { text-decoration: underline; }
.main { padding: clamp(20px, 3.3vw, 56px); width: 100%; max-width: 1760px; }
.page-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 24px; }
.page-header h1 { font-size: clamp(1.8rem, 3vw, 2.8rem); letter-spacing: -.055em; line-height: 1.12; }
.page-header p, .panel-heading p { color: var(--muted); margin-top: 6px; line-height: 1.45; }
.stages { display: grid; grid-template-columns: repeat(8,minmax(0,1fr)); gap: 9px; margin-bottom: 22px; }
.stage-card {
  display: grid; align-content: space-between; gap: 9px; text-align: left;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--white);
  min-height: 88px; padding: 12px 11px;
}
.stage-card span { font-size: .77rem; font-weight: 650; white-space: nowrap; }
.stage-card strong { font-size: 1.8rem; line-height: 1; letter-spacing: -.06em; }
.stage-card[aria-pressed="true"] { background: var(--mint); border-color: #78a693; color: #164d3c; }
.stage-card i { display: inline-block; width: 7px; height: 7px; margin-right: 5px; border-radius: 50%; background: var(--dot, #657a73); vertical-align: 1px; }
.new { --dot: #507cc8; --chip: #e9f0fc; --chip-ink: #274c89; }
.contacted { --dot: #477d9a; --chip: #e5f2f8; --chip-ink: #255571; }
.qualified { --dot: #a18439; --chip: #fff4d8; --chip-ink: #745b24; }
.estimate { --dot: #8069aa; --chip: #f0eaf9; --chip-ink: #5c4482; }
.booked, .completed { --dot: #378164; --chip: #e2f2e9; --chip-ink: #265d47; }
.lost { --dot: #ae6960; --chip: #f9e9e6; --chip-ink: #8c4239; }
.website { --chip: #e5f2ee; --chip-ink: #235e50; }
.phone { --chip: #eeeaf8; --chip-ink: #594789; }
.test { --chip: #f3eeea; --chip-ink: #745d51; }
.lead-panel { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.panel-heading { padding: 17px 19px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.panel-heading h2 { font-size: 1.25rem; letter-spacing: -.02em; }
.panel-heading p { font-size: .85rem; }
.filters { display: flex; gap: 8px; align-items: center; }
.filters input { width: min(20vw, 245px); }
.filters select { width: auto; }
.filters input, .filters select { margin: 0; }
.table-status:not(:empty) { margin: 0 19px 18px; padding: 12px; background: var(--paper); border-radius: 8px; color: var(--muted); }
table { width: 100%; border-collapse: collapse; text-align: left; }
th {
  background: #f3f6f4; color: #4b6158; font-size: .77rem; font-weight: 700;
  border-block: 1px solid var(--line);
}
th, td { padding: 12px 14px; overflow-wrap: anywhere; }
th:first-child, td:first-child { padding-left: 19px; }
td { font-size: .89rem; }
td small { display: block; margin-top: 3px; }
tbody tr + tr { border-top: 1px solid #e9eeeb; }
tbody tr:hover, tbody tr:focus-within { background: #f5faf7; }
tbody tr[data-id] { cursor: pointer; }
.lead-name { font-weight: 740; padding: 2px 0; background: none; border: none; text-align: left; }
.lead-name:hover { text-decoration: underline; text-underline-offset: 3px; }
.tag {
  display: inline-block; padding: 4px 8px; border-radius: 6px;
  color: var(--chip-ink,#41564d); background: var(--chip,#edf2ef);
  font-weight: 650; font-size: .75rem; line-height: 1.15; margin-right: 4px;
}
.arrow { color: #647c71; font-size: 1.25rem; text-align: right; padding-right: 19px; }
.paging { display: flex; justify-content: space-between; align-items: center; border-top: 1px solid var(--line); padding: 10px 18px; }
.paging span { color: var(--muted); font-size: .85rem; }
dialog {
  border: none; padding: 0; margin: 0 0 0 auto; width: min(100vw, 620px);
  height: 100dvh; max-height: 100dvh; max-width: 100vw; color: var(--ink);
  box-shadow: -10px 0 44px #112c252b; overflow: auto;
}
dialog::backdrop { background: #12292060; }
.drawer-header {
  position: sticky; top: 0; z-index: 1; padding: 17px 23px;
  background: var(--white); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.drawer-header span { color: var(--muted); font-size: .8rem; }
.drawer-header h2 { font-size: 1.55rem; letter-spacing: -.025em; overflow-wrap: anywhere; }
.icon-button { width: 42px; padding: 0; font-size: 1.6rem; flex-shrink: 0; }
.drawer-body { padding: 18px 23px 30px; overflow-wrap: anywhere; }
.detail-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.detail-tags > span:last-child { font-size: .82rem; color: var(--muted); }
.detail-section { padding: 16px 0; border-bottom: 1px solid var(--line); }
.detail-section h3 { font-size: 1rem; margin-bottom: 12px; }
.detail-section dl, .edit-grid { margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 12px 18px; }
dt { font-size: .8rem; color: var(--muted); }
dd { margin: 3px 0 0; line-height: 1.4; }
.detail-section details { margin-top: 11px; border-radius: 8px; background: var(--paper); padding: 10px; }
summary { cursor: pointer; font-weight: 650; font-size: .86rem; }
.detail-section .pre { white-space: pre-wrap; }
.detail-section details p { padding-top: 8px; font-size: .85rem; line-height: 1.45; }
#edit-lead { display: grid; gap: 12px; }
.save-line { display: flex; align-items: center; gap: 10px; }
.save-line span { font-size: .84rem; color: var(--muted); }
.timeline { margin: 0; padding-left: 20px; }
.timeline li { padding: 4px 0; font-size: .85rem; }
.timeline span { margin-left: 8px; color: var(--muted); }
.timeline p { margin-top: 4px; white-space: pre-wrap; }
@media (max-width: 1320px) {
  .stages { grid-template-columns: repeat(4,minmax(0,1fr)); }
  .stage-card { min-height: 72px; }
}
@media (max-width: 850px) {
  .workspace { grid-template-columns: minmax(0,1fr); grid-template-rows: auto 1fr; }
  .sidebar { display: flex; flex-direction: row; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 17px; flex-wrap: wrap; }
  .sidebar .brand { padding: 0; }
  .sidebar nav { display: flex; order: 3; width: 100%; gap: 4px; overflow-x: auto; }
  .nav-item { font-size: .87rem; padding: 8px 10px; }
  .account { margin: 0; padding: 0; border: none; }
  .main { padding: 17px; }
}
@media (max-width: 575px) {
  .login-shell { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .login-story { padding: 24px; }
  .login-story .brand { margin-bottom: 21px; }
  .login-story h1 { font-size: 2.5rem; }
  .login-story p { margin-top: 10px; }
  .login-area { place-items: start center; padding: 18px; }
  .page-header { margin-bottom: 15px; align-items: flex-start; }
  .page-header p { font-size: .85rem; }
  .page-header .secondary { padding: .48rem .65rem; }
  .stages { gap: 5px; margin-bottom: 15px; }
  .stage-card { min-height: 60px; padding: 7px 5px; gap: 5px; border-radius: 8px; }
  .stage-card span { font-size: .67rem; }
  .stage-card strong { font-size: 1.36rem; }
  .stage-card i { display: none; }
  .panel-heading { display: grid; padding: 12px; }
  .filters label:first-child { flex: 1; min-width: 0; }
  .filters input { width: 100%; }
  th, td { padding: 8px 5px; }
  th:first-child, td:first-child { padding-left: 10px; }
  th:nth-child(3), td:nth-child(3), th:nth-child(6), td:nth-child(6) { display: none; }
  td { font-size: .76rem; }
  td small { font-size: .69rem; }
  .tag { font-size: .65rem; padding: 3px 5px; }
  .table-status:not(:empty) { margin: 0 12px 12px; }
  .drawer-header, .drawer-body { padding-inline: 15px; }
}
