:root {
  --flo-dark: #053939;
  --flo-teal: #6fc7b6;
  --flo-bg: #f0f8f7;
  --flo-card: #ffffff;
  --flo-border: #d7e9e6;
  --flo-border-soft: #e8f3f1;
  --flo-text: #0d2626;
  --flo-muted: #527a78;
  --flo-danger: #d94b55;
  --flo-warning: #ee9b3a;
  --flo-blue: #4d78e8;
  --flo-shadow: 0 18px 40px rgba(4, 47, 45, .07);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  background: var(--flo-bg);
  color: var(--flo-text);
  font-family: Inter, "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.sales-app { min-height: 100vh; }

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 24px;
  background: var(--flo-dark);
  color: #fff;
}
.login-layout {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1100px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(96px, 10vw, 144px);
}
.login-brand-panel {
  flex: 1;
  display: flex;
  justify-content: flex-end;
  min-width: 0;
}
.login-brand-inner {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}
.login-wordmark {
  position: relative;
  display: flex;
  align-items: baseline;
  white-space: nowrap;
  font-size: clamp(54px, 6vw, 72px);
  line-height: 1;
}
.login-wordmark span {
  color: var(--flo-teal);
  font-weight: 800;
  letter-spacing: -.025em;
}
.login-wordmark i {
  margin-left: 16px;
  color: #fff;
  font-style: normal;
  font-weight: 100;
  letter-spacing: .025em;
}
.login-subtitle {
  margin-top: 14px;
  margin-right: 24px;
  color: rgba(255,255,255,.68);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .28em;
  text-transform: uppercase;
}
.login-ecg {
  position: absolute;
  left: 50%;
  top: calc(100% + 20px);
  width: 200vw;
  height: 100px;
  transform: translateX(-50%);
  pointer-events: none;
  z-index: -1;
}
.login-ecg svg { width: 100%; height: 100%; display: block; }
.ecg-base, .ecg-reveal {
  fill: none;
  stroke: #e74c3c;
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.ecg-base { opacity: .18; }
.ecg-reveal { filter: drop-shadow(0 0 2px rgba(231, 76, 60, .35)); }
.login-card {
  position: relative;
  z-index: 2;
  flex: 1;
  width: 100%;
  max-width: 384px;
  border: 1px solid rgba(111,199,182,.15);
  border-radius: 16px;
  background: rgba(255,255,255,.04);
  box-shadow: 0 25px 50px -12px rgba(0,0,0,.25);
  padding: 32px;
  backdrop-filter: blur(8px);
}
.login-card form { display: grid; gap: 20px; }
.login-field { display: grid; gap: 6px; }
.login-field span {
  color: rgba(255,255,255,.48);
  font-size: 12px;
  font-weight: 800;
}
.login-field input {
  width: 100%;
  min-height: 42px;
  border: 1px solid rgba(111,199,182,.22);
  border-radius: 8px;
  background: rgba(255,255,255,.06);
  color: #fff;
  outline: none;
  padding: 10px 12px;
}
.login-field input::placeholder { color: rgba(255,255,255,.32); }
.login-field input:focus { border-color: rgba(111,199,182,.48); box-shadow: 0 0 0 3px rgba(111,199,182,.08); }
.login-btn {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  background: #fff;
  color: var(--flo-dark);
  font-weight: 800;
}

.page {
  width: min(1244px, calc(100% - 48px));
  margin: 18px auto 48px;
  display: grid;
  gap: 14px;
}
.topbar {
  width: min(1244px, calc(100% - 48px));
  margin: 18px auto 0;
  min-height: 56px;
  border-radius: 12px;
  background: var(--flo-dark);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
}
.brand {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 20px;
}
.brand b { color: var(--flo-teal); font-weight: 800; }
.brand span { color: #fff; font-weight: 400; }
.topbar-user {
  display: flex;
  align-items: center;
  gap: 14px;
}
.logout {
  min-height: 36px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 10px;
  background: rgba(255,255,255,.06);
  color: #fff;
  padding: 7px 14px;
  font-weight: 800;
}
.logout:hover { background: rgba(255,255,255,.1); }

.panel {
  border: 1px solid var(--flo-border);
  border-radius: 14px;
  background: var(--flo-card);
  box-shadow: 0 8px 22px rgba(4, 47, 45, .035);
  overflow: hidden;
}
.panel-title {
  padding: 14px 16px;
  border-bottom: 1px solid var(--flo-border);
  color: var(--flo-dark);
  font-size: 16px;
  font-weight: 800;
}
.panel-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.panel-body { padding: 14px; }
.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.field {
  position: relative;
  display: grid;
  gap: 6px;
}
.field span {
  color: var(--flo-dark);
  font-size: 12px;
  font-weight: 800;
}
.field em {
  color: #d72836;
  font-style: normal;
}
.field input, .field select, .field textarea {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--flo-border);
  border-radius: 10px;
  background: #fff;
  color: var(--flo-text);
  outline: none;
  padding: 9px 11px;
}
.field textarea {
  min-height: 82px;
  resize: vertical;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--flo-teal);
  box-shadow: 0 0 0 3px rgba(111,199,182,.14);
}
.field select:disabled {
  background: #f6fbfa;
  color: #6d8e8b;
  cursor: not-allowed;
}
.span-full { grid-column: 1 / -1; }
.form-actions, .modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
}
.primary-btn, .secondary-btn, .danger-btn {
  min-height: 38px;
  border-radius: 10px;
  padding: 8px 16px;
  font-weight: 800;
}
.primary-btn {
  border: 1px solid var(--flo-dark);
  background: var(--flo-dark);
  color: #fff;
  box-shadow: 0 10px 22px rgba(4, 63, 60, .16);
}
.secondary-btn {
  border: 1px solid var(--flo-border);
  background: #fff;
  color: var(--flo-dark);
}
.danger-btn {
  border: 1px solid #f0bcc1;
  background: #fff7f7;
  color: #b8202d;
}
.compact {
  min-height: 34px;
  padding: 6px 12px;
}

.table-wrap {
  overflow-x: auto;
  padding: 10px;
}
.scroll-after-seven {
  max-height: 486px;
  overflow: auto;
}
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 8px;
  table-layout: fixed;
}
th {
  color: var(--flo-dark);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .08em;
  padding: 0 10px;
  text-align: left;
  text-transform: uppercase;
}
td {
  border-top: 1px solid var(--flo-border);
  border-bottom: 1px solid var(--flo-border);
  background: #fbfefe;
  padding: 10px;
  vertical-align: middle;
}
td:first-child { border-left: 1px solid var(--flo-border); border-radius: 10px 0 0 10px; }
td:last-child { border-right: 1px solid var(--flo-border); border-radius: 0 10px 10px 0; }
.click-row { cursor: pointer; }
.click-row:hover td { background: #f6fbfa; border-color: #bfe1db; }
.admin-doctors-table th:last-child, .admin-doctors-table td:last-child { width: 122px; text-align: right; }
.actions-head { text-align: right; }
.row-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}
.icon-btn {
  width: 31px;
  height: 31px;
  border: 1px solid var(--flo-border);
  border-radius: 9px;
  background: #fff;
  color: var(--flo-dark);
  display: inline-grid;
  place-items: center;
  font-weight: 900;
}
.icon-btn:hover { border-color: var(--flo-teal); color: #0f766e; }
.icon-btn:disabled {
  opacity: .42;
  cursor: not-allowed;
  background: #f6fbfa;
}
.icon-btn:disabled:hover {
  border-color: var(--flo-border);
  color: var(--flo-dark);
}
.icon-btn.danger { color: #c52f3c; }
.icon-btn.danger:hover { border-color: #efadb5; background: #fff7f7; }

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  border-radius: 999px;
  border: 1px solid rgba(90,128,128,.24);
  background: rgba(90,128,128,.08);
  color: var(--flo-muted);
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}
.status-visited { border-color: rgba(111,199,182,.38); background: rgba(111,199,182,.14); color: #0f766e; }
.status-interested { border-color: rgba(238,155,58,.36); background: rgba(238,155,58,.14); color: #9b5a12; }
.status-demo-done { border-color: rgba(77,120,232,.34); background: rgba(77,120,232,.12); color: #315dc9; }
.status-follow-up-set { border-color: rgba(139,92,246,.34); background: rgba(139,92,246,.12); color: #6d3fd4; }
.status-subscribed { border-color: rgba(37,167,99,.34); background: rgba(37,167,99,.13); color: #18713d; }
.status-not-interested { border-color: rgba(217,75,85,.34); background: rgba(217,75,85,.12); color: #ac2d38; }

.suggestions {
  position: absolute;
  z-index: 30;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 260px;
  overflow-y: auto;
  border: 1px solid var(--flo-border);
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--flo-shadow);
}
.suggestion {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--flo-border-soft);
  background: #fff;
  text-align: left;
  padding: 10px 12px;
}
.suggestion:last-child { border-bottom: 0; }
.suggestion:hover { background: #f6fbfa; }
.suggestion strong { display: block; color: var(--flo-dark); }
.suggestion small { display: block; color: var(--flo-muted); margin-top: 2px; }
.suggestion.locked {
  background: #f8fbfa;
  opacity: .62;
  cursor: not-allowed;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(5, 57, 57, .42);
  backdrop-filter: blur(3px);
}
.modal {
  width: min(860px, calc(100vw - 44px));
  max-height: min(86vh, 760px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--flo-border);
  border-radius: 16px;
  background: #fff;
  box-shadow: var(--flo-shadow);
}
.modal-narrow { width: min(680px, calc(100vw - 44px)); }
.modal-head {
  min-height: 58px;
  border-bottom: 1px solid var(--flo-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
}
.modal-head strong { font-size: 17px; }
.modal-close {
  width: 32px;
  height: 32px;
  border: 1px solid var(--flo-border);
  border-radius: 999px;
  background: #fff;
  color: var(--flo-muted);
  font-size: 18px;
  font-weight: 800;
}
.modal-body {
  overflow-y: auto;
  padding: 18px;
}
.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.detail {
  border: 1px solid var(--flo-border-soft);
  border-radius: 12px;
  background: #f8fcfb;
  padding: 11px 12px;
}
.detail span {
  display: block;
  color: var(--flo-muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.detail strong {
  display: block;
  margin-top: 4px;
}
.history-block { margin-top: 18px; }
.compact-history { margin-top: 0; }
.history-block h3 { margin: 0 0 10px; font-size: 16px; }
.history-scroll {
  max-height: 440px;
  overflow-y: auto;
  display: grid;
  gap: 4px;
  padding-right: 4px;
}
.compact-history .history-scroll {
  max-height: 420px;
}
.history-line {
  padding: 4px 0;
  color: var(--flo-text);
}
.modal-copy { margin: 0 0 14px; color: var(--flo-muted); }
.warning {
  grid-column: 1 / -1;
  border: 1px solid rgba(238,155,58,.28);
  border-radius: 10px;
  background: rgba(238,155,58,.1);
  color: #8f520f;
  padding: 9px 11px;
  font-weight: 700;
}
.hidden { display: none !important; }
.empty {
  padding: 18px;
  color: var(--flo-muted);
  text-align: center;
  font-weight: 800;
}
.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 120;
  border: 1px solid var(--flo-border);
  border-radius: 12px;
  background: #fff;
  color: var(--flo-dark);
  box-shadow: var(--flo-shadow);
  padding: 12px 15px;
  font-weight: 900;
}
.toast.error {
  border-color: #f0bcc1;
  background: #fff7f7;
  color: #a6212d;
}

@media (max-width: 980px) {
  .form-grid, .form-grid.two, .detail-grid { grid-template-columns: 1fr; }
  .login-layout { flex-direction: column; gap: 32px; }
  .login-brand-panel { justify-content: center; }
  .login-brand-inner { align-items: center; }
  .login-subtitle { margin-right: 0; }
  .login-ecg { display: none; }
}

@media (max-width: 720px) {
  .login-page { justify-content: center; padding: 22px 20px; overflow-x: hidden; }
  .login-layout { left: auto; transform: none; width: min(384px, calc(100vw - 40px)); max-width: min(384px, calc(100vw - 40px)); gap: 30px; overflow: visible; }
  .login-brand-panel, .login-card { flex: 0 1 auto; width: 100%; max-width: 100%; }
  .login-wordmark { justify-content: center; font-size: clamp(46px, 12vw, 62px); max-width: 100%; }
  .login-wordmark i { margin-left: 11px; }
  .login-subtitle { font-size: 12px; letter-spacing: .26em; }
  .login-card { padding: 30px 26px; }
  .page, .topbar { width: calc(100% - 24px); }
  .topbar { align-items: center; flex-direction: row; justify-content: space-between; gap: 12px; }
  .brand { min-width: 0; }
  .brand span { white-space: nowrap; }
  .topbar-user { margin-left: auto; justify-content: flex-end; flex: 0 0 auto; }
  .table-wrap { padding: 8px; }
  th, td { padding: 8px; }
}

@media (max-width: 420px) {
  .login-page { padding: 22px 18px; }
  .login-layout { width: min(360px, calc(100vw - 36px)); max-width: min(360px, calc(100vw - 36px)); }
  .login-wordmark { font-size: clamp(41px, 12vw, 50px); }
  .login-wordmark i { margin-left: 8px; }
  .login-card { padding: 28px 24px; }
  .topbar { padding: 10px 12px; }
  .brand { font-size: 18px; }
  .topbar-user { gap: 8px; }
  .topbar-user span { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .logout { min-height: 34px; padding: 6px 11px; }
}
