:root {
  --background: #ffffff;
  --foreground: #1d1d1f;
  --muted: #6e6e73;
  --muted-bg: #f5f5f7;
  --border: #d2d2d7;
  --card: #ffffff;
  --primary: #1d1d1f;
  --primary-hover: #000000;
  --primary-fg: #ffffff;
  --accent: #0071e3;
  --accent-hover: #0077ed;
  --danger: #ff3b30;
  --success: #34c759;
  --row-hover: #f0f7ff;
  --row-alt: #fafafa;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.06), 0 8px 24px rgba(0, 0, 0, 0.04);
  --radius: 12px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
    "Helvetica Neue", Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--muted-bg);
  color: var(--foreground);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: inherit;
}

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 20px;
  background: linear-gradient(180deg, #f5f5f7 0%, #ffffff 100%);
}

.login-card {
  width: min(400px, 100%);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 32px 28px;
  box-shadow: var(--shadow);
}

.login-card h1 {
  margin: 0 0 6px;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.login-card p {
  margin: 0 0 22px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
}

.login-card label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--muted);
}

.login-card input,
.filters input[type="text"],
.filters input[type="datetime-local"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font: inherit;
  background: #fff;
  color: var(--foreground);
}

.login-card input {
  margin-bottom: 16px;
}

.login-card input:focus,
.filters input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.18);
}

.login-card button,
.btn,
.filters button[type="submit"] {
  appearance: none;
  border: 0;
  background: var(--accent);
  color: var(--primary-fg);
  border-radius: 980px;
  padding: 10px 18px;
  font: inherit;
  font-weight: 500;
  cursor: pointer;
}

.login-card button {
  width: 100%;
  margin-top: 4px;
}

.login-card button:hover,
.btn:hover,
.filters button[type="submit"]:hover {
  background: var(--accent-hover);
}

.login-error {
  color: var(--danger);
  min-height: 1.2em;
  margin-bottom: 10px;
  font-size: 13px;
}

.shell {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px 20px 120px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

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

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

.btn.ghost {
  background: rgba(0, 0, 0, 0.06);
  color: var(--foreground);
  border-radius: 980px;
}

.btn.ghost:hover {
  background: rgba(0, 0, 0, 0.1);
}

.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr)) auto auto;
  gap: 12px 14px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  align-items: end;
  background: #fcfcfd;
}

.filters label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}

.filters .check {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  padding-bottom: 10px;
  color: var(--foreground);
  font-size: 13px;
  font-weight: 400;
}

.status-line {
  padding: 12px 18px;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  background: #fff;
  font-size: 13px;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 1080px;
}

thead th {
  position: sticky;
  top: 0;
  background: #f5f5f7;
  text-align: left;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  color: #6e6e73;
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.01em;
}

tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid #ececef;
  white-space: nowrap;
  vertical-align: middle;
}

tbody tr:nth-child(even) {
  background: var(--row-alt);
}

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

.phone {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
}

.status-answered,
.ticket-yes {
  color: var(--success);
  font-weight: 600;
}

.status-no,
.ticket-no {
  color: var(--danger);
  font-weight: 600;
}

.actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
  display: inline-grid;
  place-items: center;
  color: #424245;
  font: inherit;
}

.icon-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.icon-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.empty {
  padding: 24px 18px;
  color: var(--muted);
}

.player {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: min(400px, calc(100vw - 32px));
  background: #1d1d1f;
  color: #f5f5f7;
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 14px 16px 12px;
  display: none;
  z-index: 50;
}

.player.visible {
  display: block;
}

.player .title {
  font-size: 13px;
  margin-bottom: 8px;
  opacity: 0.9;
}

.player audio {
  width: 100%;
  margin-top: 4px;
}

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

.player a,
.player button.linkish {
  color: #64d2ff;
  background: none;
  border: 0;
  cursor: pointer;
  font: inherit;
  text-decoration: none;
}

@media (max-width: 960px) {
  .filters {
    grid-template-columns: 1fr 1fr;
  }

  .shell {
    padding: 16px 12px 120px;
  }
}
