:root {
  --ink: #13231f;
  --muted: #697a74;
  --paper: #f6f2e9;
  --panel: #fffdf8;
  --line: #e8e1d3;
  --brand: #116b5d;
  --brand-dark: #0b5046;
  --brand-soft: #e0f0eb;
  --accent: #de8b48;
  --accent-soft: #faecd9;
  --shadow: 0 16px 35px rgba(34, 53, 47, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 78px;
  padding: 14px 28px;
  color: #f9f8f3;
  background: #133b35;
}

.brand-block,
.topbar-actions,
.connection-pill,
.panel-heading,
.detail-header,
.section-heading,
.form-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-block {
  justify-content: flex-start;
  gap: 12px;
}

.brand-mark,
.empty-icon {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  color: #133b35;
  background: #f5c478;
  border-radius: 14px;
  font-size: 24px;
  font-weight: 800;
}

.topbar h1,
h2,
h3,
p {
  margin: 0;
}

.topbar h1 {
  font-size: 22px;
  letter-spacing: -0.02em;
}

.eyebrow {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.topbar .eyebrow {
  color: #afd1c8;
}

.topbar-actions {
  gap: 20px;
}

.connection-pill {
  gap: 8px;
  padding: 8px 12px;
  color: #dbf2eb;
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 99px;
  font-size: 12px;
}

.connection-dot {
  width: 9px;
  height: 9px;
  background: #61d5a8;
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(97, 213, 168, 0.14);
}

.today {
  color: #c7ddd8;
  font-size: 12px;
}

.workspace {
  padding: 20px 24px 28px;
}

.dashboard {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 16px;
}

.metric-card,
.customer-panel,
.detail-panel,
.followup-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.metric-card {
  padding: 15px 18px;
}

.metric-label,
.metric-caption,
.result-count,
.shared-label,
.contact-strip span,
label span,
.timeline-section .section-heading > span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.metric-value {
  display: block;
  margin: 5px 0 2px;
  color: var(--brand-dark);
  font-size: 30px;
  letter-spacing: -0.06em;
}

.content-grid {
  display: grid;
  grid-template-columns: 294px minmax(590px, 1fr) 282px;
  gap: 16px;
  min-height: calc(100vh - 206px);
}

.customer-panel,
.followup-panel {
  overflow: hidden;
}

.panel-heading {
  min-height: 67px;
  padding: 15px 16px;
  border-bottom: 1px solid var(--line);
}

h2 {
  font-size: 18px;
  letter-spacing: -0.03em;
}

h3 {
  font-size: 16px;
  letter-spacing: -0.02em;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px;
  padding: 9px 11px;
  background: #f7f4ec;
  border: 1px solid #ede5d7;
  border-radius: 10px;
}

.search-icon {
  font-size: 13px;
}

.search-box input {
  width: 100%;
  color: var(--ink);
  background: transparent;
  border: 0;
  outline: 0;
  font-size: 13px;
}

.customer-list {
  height: calc(100vh - 302px);
  min-height: 460px;
  overflow-y: auto;
}

.customer-row {
  display: block;
  width: 100%;
  padding: 11px 14px;
  text-align: left;
  background: transparent;
  border: 0;
  border-top: 1px solid #f0ebe1;
}

.customer-row:hover,
.customer-row.is-active {
  background: var(--brand-soft);
}

.customer-row strong,
.customer-row span {
  display: block;
}

.customer-row strong {
  margin-bottom: 3px;
  color: var(--ink);
  font-size: 13px;
}

.customer-row span {
  color: var(--muted);
  font-size: 11px;
}

.row-meta {
  display: flex;
  justify-content: space-between;
  margin-top: 5px;
}

.detail-panel {
  overflow: hidden;
}

.empty-state {
  display: grid;
  min-height: 560px;
  place-content: center;
  justify-items: center;
  color: var(--muted);
  text-align: center;
}

.empty-state .empty-icon {
  margin-bottom: 14px;
}

.empty-state h2 {
  margin-bottom: 6px;
  color: var(--ink);
}

.empty-state p {
  max-width: 330px;
  font-size: 13px;
  line-height: 1.6;
}

.is-hidden {
  display: none;
}

.detail-header {
  padding: 20px 22px;
  border-bottom: 1px solid var(--line);
}

.detail-header h2 {
  font-size: 25px;
}

.detail-company {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.phonebook-chip,
.shared-label,
.live-label {
  padding: 6px 9px;
  color: var(--brand-dark);
  background: var(--brand-soft);
  border-radius: 99px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.contact-strip {
  display: grid;
  grid-template-columns: 1fr 1fr 1.2fr;
  gap: 1px;
  background: var(--line);
  border-bottom: 1px solid var(--line);
}

.contact-strip div {
  padding: 12px 16px;
  background: #fbfaf5;
}

.contact-strip strong,
.phone-link {
  display: block;
  margin-top: 5px;
  color: var(--brand-dark);
  font-size: 13px;
  font-weight: 800;
}

.phone-link.is-disabled {
  color: var(--ink);
  pointer-events: none;
  text-decoration: none;
}

.note-composer,
.live-remark-panel,
.timeline-section {
  padding: 18px 22px;
}

.note-composer,
.live-remark-panel {
  border-bottom: 1px solid var(--line);
}

.live-remark-panel {
  background: linear-gradient(180deg, #fff9eb 0%, #fffdf8 100%);
}

.live-remark-panel textarea {
  min-height: 104px;
  border-color: #deb469;
  background: #fffaf0;
  font-size: 15px;
  font-weight: 650;
}

.live-remark-panel textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(222, 139, 72, 0.18);
}

.remark-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
}

.remark-footer span {
  color: #7d5d20;
  font-size: 12px;
  font-weight: 800;
}

.remark-footer button {
  padding: 9px 13px;
  color: #fff;
  background: var(--accent);
  border: 0;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 800;
}

.remark-footer button:disabled {
  opacity: 0.55;
  cursor: wait;
}

.shared-note-help {
  margin: -2px 0 14px;
  padding: 10px 12px;
  color: #5f4a1b;
  background: #fff5d8;
  border: 1px solid #efd282;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
}

.section-heading {
  margin-bottom: 12px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr 0.7fr 1.2fr;
  gap: 10px;
}

label span {
  margin-bottom: 5px;
}

input,
select,
textarea {
  width: 100%;
  color: var(--ink);
  background: #fffefb;
  border: 1px solid #e1dacc;
  border-radius: 8px;
  outline: none;
}

input,
select {
  height: 36px;
  padding: 0 9px;
  font-size: 12px;
}

textarea {
  padding: 9px;
  resize: vertical;
  font-size: 13px;
  line-height: 1.45;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(17, 107, 93, 0.12);
}

.note-field {
  display: block;
  margin-top: 10px;
}

.form-footer {
  margin-top: 10px;
}

.form-message {
  color: var(--brand);
  font-size: 12px;
}

.form-footer button {
  padding: 10px 16px;
  color: white;
  background: var(--brand);
  border: 0;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 800;
}

.form-footer button:hover {
  background: var(--brand-dark);
}

.timeline {
  max-height: 292px;
  overflow-y: auto;
}

.timeline-empty,
.followup-empty {
  padding: 18px 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.timeline-item {
  position: relative;
  margin-left: 7px;
  padding: 0 0 14px 18px;
  border-left: 1px solid #dcd5c7;
}

.timeline-item::before {
  position: absolute;
  top: 3px;
  left: -5px;
  width: 9px;
  height: 9px;
  content: "";
  background: var(--brand);
  border: 2px solid var(--panel);
  border-radius: 50%;
}

.timeline-item.event::before {
  background: var(--accent);
}

.timeline-item.chat::before {
  background: #7467b8;
}

.timeline-meta,
.timeline-footer {
  display: flex;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 11px;
}

.timeline-body {
  margin: 5px 0;
  font-size: 13px;
  line-height: 1.45;
}

.timeline-footer strong {
  color: var(--brand);
}

.call-note-card {
  margin-top: 10px;
  padding: 10px;
  background: #fffaf2;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.call-note-field {
  display: grid;
  gap: 6px;
}

.call-note-field span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.call-note-field textarea {
  width: 100%;
  min-height: 74px;
  padding: 10px 12px;
  color: var(--ink);
  background: white;
  border: 1px solid #d6ccbd;
  border-radius: 8px;
  font: inherit;
  resize: vertical;
}

.call-note-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
}

.call-note-status {
  color: var(--muted);
  font-size: 11px;
}

.call-note-actions button {
  padding: 8px 10px;
  color: white;
  background: var(--brand);
  border: 0;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 800;
}

.call-note-actions button:disabled {
  cursor: wait;
  opacity: 0.6;
}

.recording-link {
  color: var(--brand);
  font-weight: 800;
}
.tag {
  padding: 3px 6px;
  color: #8d572b;
  background: var(--accent-soft);
  border-radius: 99px;
  font-size: 10px;
  font-weight: 800;
}

.followup-list,
.recent-list {
  padding: 6px 14px 12px;
}

.followup-row,
.recent-row {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.followup-row button,
.recent-row button {
  padding: 0;
  color: var(--brand-dark);
  background: transparent;
  border: 0;
  font-size: 12px;
  font-weight: 800;
  text-align: left;
}

.followup-row span,
.recent-row span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.recent-section {
  margin-top: 8px;
  border-top: 1px solid var(--line);
}

body.popup-mode {
  background: #fffdf8;
}

body.popup-mode .topbar,
body.popup-mode .dashboard,
body.popup-mode .customer-panel,
body.popup-mode .followup-panel {
  display: none;
}

body.popup-mode .workspace {
  padding: 0;
}

body.popup-mode .content-grid {
  display: block;
  min-height: 100vh;
}

body.popup-mode .detail-panel {
  min-height: 100vh;
  border-radius: 0;
  box-shadow: none;
}

body.popup-mode .detail-header {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #fffdf8;
}

body.popup-mode .detail-header h2 {
  font-size: 22px;
}

body.popup-mode .phonebook-chip {
  display: none;
}

body.popup-mode .contact-strip {
  grid-template-columns: 1fr;
}

body.popup-mode .live-remark-panel {
  padding: 16px;
}

body.popup-mode .live-remark-panel textarea {
  min-height: 150px;
  font-size: 17px;
}

body.popup-mode .remark-footer {
  align-items: stretch;
  flex-direction: column;
}

body.popup-mode .remark-footer button,
body.popup-mode .form-footer button,
body.popup-mode .call-note-actions button {
  width: 100%;
  min-height: 46px;
  font-size: 14px;
}

body.popup-mode .note-composer,
body.popup-mode .timeline-section {
  padding: 16px;
}

@media (max-width: 1280px) {
  .content-grid {
    grid-template-columns: 276px minmax(570px, 1fr) 264px;
  }

  .workspace {
    padding-inline: 16px;
  }
}

@media (max-width: 1100px) {
  .content-grid {
    grid-template-columns: 272px minmax(0, 1fr);
  }

  .followup-panel {
    display: none;
  }

  .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .topbar {
    min-height: 68px;
    padding: 12px 16px;
  }

  .brand-mark {
    width: 42px;
    height: 42px;
  }

  .topbar h1 {
    font-size: 19px;
  }

  .today {
    display: none;
  }

  .connection-pill {
    padding: 7px 9px;
    font-size: 10px;
  }

  .workspace {
    padding: 12px;
  }

  .dashboard {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 10px;
  }

  .metric-card {
    padding: 11px 13px;
  }

  .metric-value {
    font-size: 24px;
  }

  .metric-caption {
    font-size: 10px;
  }

  .content-grid {
    display: block;
  }

  .customer-panel {
    margin-bottom: 10px;
  }

  .customer-list {
    height: 250px;
    min-height: 0;
  }

  .detail-header {
    padding: 17px;
  }

  .detail-header h2 {
    font-size: 22px;
  }

  .phonebook-chip {
    max-width: 120px;
    text-align: center;
  }

  .contact-strip {
    grid-template-columns: 1fr;
  }

  .contact-strip div {
    padding: 10px 16px;
  }

  .note-composer,
  .live-remark-panel,
  .timeline-section {
    padding: 16px;
  }

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

  .timeline {
    max-height: none;
  }
}
