:root {
  color-scheme: light;
  --ink: #17202a;
  --muted: #637083;
  --line: #d7dde5;
  --panel: #ffffff;
  --soft: #f4f6f8;
  --good: #157a52;
  --warn: #a45c00;
  --accent: #0f6b99;
  --accent-2: #7d4e24;
  --danger: #a43a3a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #eef2f5;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

.shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 28px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 28px;
  letter-spacing: 0;
}

.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

button {
  border: 0;
  cursor: pointer;
}

.ghost,
.primary,
.secondary {
  min-height: 40px;
  border-radius: 6px;
  padding: 0 14px;
  font-weight: 700;
}

.ghost {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
}

.primary {
  background: var(--accent);
  color: white;
}

.secondary {
  background: #e6edf2;
  color: var(--ink);
}

.workspace {
  flex: 1;
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  min-height: 0;
}

.call-list {
  background: #fbfcfd;
  border-right: 1px solid var(--line);
  padding: 18px;
  overflow: auto;
}

.list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

#calls {
  display: grid;
  gap: 10px;
}

.call-row {
  width: 100%;
  min-height: 76px;
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  text-align: left;
}

.call-row.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent), transparent 82%);
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--good);
}

.caller,
.phone {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.phone {
  margin-top: 3px;
  color: var(--muted);
}

.badge {
  border-radius: 999px;
  padding: 4px 8px;
  background: #e5f3ed;
  color: var(--good);
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
}

.badge.unknown {
  background: #fff0dc;
  color: var(--warn);
}

.detail {
  padding: 28px;
  overflow: auto;
}

.empty {
  display: grid;
  place-items: center;
}

.empty-state {
  text-align: center;
  max-width: 340px;
}

.pulse {
  width: 48px;
  height: 48px;
  margin: 0 auto 18px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 12px color-mix(in srgb, var(--accent), transparent 86%);
}

.summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 20px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

.summary h2 {
  margin-bottom: 8px;
  font-size: 34px;
  letter-spacing: 0;
}

.meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  color: var(--muted);
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border-radius: 999px;
  padding: 0 10px;
  background: var(--soft);
  color: var(--ink);
  font-weight: 700;
}

.pill.client {
  background: #e5f3ed;
  color: var(--good);
}

.pill.unknown {
  background: #fff0dc;
  color: var(--warn);
}

.columns {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 24px;
  margin-top: 24px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}

.panel h3 {
  margin-bottom: 14px;
  font-size: 18px;
}

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

.ticket {
  width: 100%;
  display: grid;
  gap: 4px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--soft);
  text-align: left;
}

.ticket strong,
.ticket span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.ticket small {
  color: var(--muted);
}

form {
  display: grid;
  gap: 12px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  background: #fff;
  color: var(--ink);
}

.inline-form {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
}

.resource-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.resource-row {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--soft);
  text-align: left;
}

.resource-row strong,
.resource-row small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.resource-row small {
  color: var(--muted);
}

.resource-row span {
  grid-row: 1 / span 2;
  grid-column: 2;
  border-radius: 999px;
  padding: 4px 8px;
  background: #e6edf2;
  font-size: 12px;
  font-weight: 800;
}

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

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: 360px;
  border-radius: 8px;
  padding: 12px 14px;
  background: var(--ink);
  color: white;
  font-weight: 700;
  box-shadow: 0 18px 48px rgba(23, 32, 42, 0.22);
}

@media (max-width: 900px) {
  .topbar,
  .summary {
    align-items: stretch;
    flex-direction: column;
  }

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

  .call-list {
    max-height: 36vh;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
}
