/*
 * Visual language borrowed from arzt-frankfurt.de: the turquoise mark, the
 * #109BC5 blue, flat white surfaces on a light grey ground, Helvetica/Arial at
 * 15px. No images and no web fonts — the whole page is text, CSS and one inline
 * SVG, which also keeps the CSP at `default-src 'none'`.
 */

:root {
  --brand: #00bdb5; /* logo turquoise */
  --accent: #109bc5;
  --accent-dark: #0f81a1;
  --accent-deep: #0079a3;
  --accent-tint: #e6f4f9;

  --fg: #444444;
  --fg-strong: #222222;
  --muted: #808080;
  --line: #e1e1e1;
  --bg: #f2f4f5;
  --surface: #ffffff;
  --surface-alt: #f8f8f8;

  --warn-bg: #fff8e6;
  --warn-fg: #7a5a00;
  --error: #b3261e;
  --error-bg: #fdecea;

  --radius: 4px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.07);
  --font: "Helvetica Neue", Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.65 var(--font);
  -webkit-font-smoothing: antialiased;
}

/* ------------------------------------------------------------------ logo */

.logo {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  text-decoration: none;
  color: inherit;
}

.logo svg {
  display: block;
  width: 30px;
  height: 34px;
  flex: none;
}

.logo-text {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--fg-strong);
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.logo-text small {
  display: block;
  font-size: 0.72rem;
  font-weight: 400;
  color: var(--muted);
  letter-spacing: 0.02em;
}

/* ---------------------------------------------------------------- chrome */

.topbar {
  background: var(--accent-dark);
  color: #fff;
  font-size: 0.78rem;
}

.topbar .wrap {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.35rem 0;
}

.wrap {
  width: min(1180px, 100% - 2.5rem);
  margin-inline: auto;
}

.masthead {
  background: var(--surface);
  border-bottom: 3px solid var(--accent);
}

.masthead .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 0;
}

.session {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  font-size: 0.83rem;
  color: var(--muted);
}

.linkbutton {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--accent-deep);
  font: inherit;
  font-size: 0.83rem;
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius);
  cursor: pointer;
}

.linkbutton:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
}

main {
  padding: 1.75rem 0 4rem;
}

h1 {
  margin: 0 0 0.15rem;
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--fg-strong);
  letter-spacing: -0.01em;
}

.lede {
  margin: 0 0 1.5rem;
  color: var(--muted);
  max-width: 68ch;
}

/* --------------------------------------------------------------- metrics */

.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.5rem;
}

.metric {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 0.9rem 1rem;
}

.metric-value {
  font-size: 1.9rem;
  font-weight: 600;
  color: var(--accent-dark);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.metric.is-quiet .metric-value {
  color: var(--muted);
}

.metric-label {
  font-size: 0.78rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 0.3rem;
}

/* ---------------------------------------------------------------- panels */

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 1.25rem;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0.85rem 1.1rem;
  border-bottom: 1px solid var(--line);
}

.panel-title {
  font-weight: 600;
  color: var(--fg-strong);
}

.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 0.7rem;
  padding: 1rem 1.1rem;
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.76rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.control-search {
  flex: 1 1 15rem;
}

input {
  font: inherit;
  text-transform: none;
  letter-spacing: normal;
  color: var(--fg);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.42rem 0.6rem;
  min-width: 9.5rem;
  width: 100%;
}

input:focus-visible,
button:focus-visible,
a:focus-visible,
th:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.button {
  appearance: none;
  font: inherit;
  border-radius: var(--radius);
  padding: 0.45rem 1.05rem;
  cursor: pointer;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
}

.button:hover:not(:disabled) {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
}

.button-secondary {
  background: var(--surface);
  color: var(--accent-deep);
  border-color: var(--line);
}

.button-secondary:hover:not(:disabled) {
  background: var(--accent-tint);
  border-color: var(--accent);
  color: var(--accent-dark);
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* ----------------------------------------------------------------- notes */

.note {
  margin: 0;
  padding: 0.7rem 1.1rem;
  background: var(--warn-bg);
  color: var(--warn-fg);
  font-size: 0.82rem;
  border-top: 1px solid var(--line);
}

.status {
  margin: 0;
  padding: 0.6rem 1.1rem;
  min-height: 1.2em;
  font-size: 0.83rem;
  color: var(--muted);
  border-top: 1px solid var(--line);
}

.status.is-error {
  color: var(--error);
  background: var(--error-bg);
}

/* ----------------------------------------------------------------- table */

.table-wrap {
  overflow-x: auto;
}

table {
  border-collapse: collapse;
  width: 100%;
  font-variant-numeric: tabular-nums;
}

th,
td {
  text-align: left;
  padding: 0.55rem 1.1rem;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-alt);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}

th:hover {
  color: var(--accent-dark);
}

th[aria-sort="ascending"]::after {
  content: " ▲";
  font-size: 0.7em;
}

th[aria-sort="descending"]::after {
  content: " ▼";
  font-size: 0.7em;
}

tbody tr:hover {
  background: var(--accent-tint);
}

tbody tr:last-child td {
  border-bottom: 0;
}

td.num,
th.num {
  text-align: right;
}

td.empty {
  text-align: center;
  color: var(--muted);
  padding: 2.5rem 1rem;
  white-space: normal;
}

.tag {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.tag-missed {
  background: var(--accent-tint);
  color: var(--accent-deep);
}

.tag-voicemail {
  background: #eefaf9;
  color: #067c76;
}

.waiting-long {
  color: var(--error);
  font-weight: 600;
}

a {
  color: var(--accent-deep);
}

.summary {
  margin: 0;
  padding: 0.7rem 1.1rem;
  font-size: 0.83rem;
  color: var(--muted);
  border-top: 1px solid var(--line);
}

.footnote {
  margin: 0;
  font-size: 0.76rem;
  color: var(--muted);
}

/* ----------------------------------------------------------------- login */

.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100%;
  padding: 2rem 1.25rem;
}

.login-card {
  width: min(23rem, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 3px solid var(--accent);
  border-radius: var(--radius);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.08);
  padding: 1.75rem;
}

.login-card .logo {
  margin-bottom: 1.4rem;
}

.login-card h1 {
  font-size: 1.1rem;
  margin-bottom: 1rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  margin-bottom: 0.9rem;
  font-size: 0.76rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.login-card .button {
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.55rem;
}

.form-error {
  margin: 0 0 1rem;
  padding: 0.55rem 0.7rem;
  background: var(--error-bg);
  color: var(--error);
  border-radius: var(--radius);
  font-size: 0.85rem;
}

.login-foot {
  margin: 1.2rem 0 0;
  font-size: 0.74rem;
  color: var(--muted);
  line-height: 1.5;
}

@media (max-width: 640px) {
  .masthead .wrap {
    flex-direction: column;
    align-items: flex-start;
  }

  .topbar .wrap {
    flex-direction: column;
    gap: 0.1rem;
  }
}
