:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --panel: #ffffff;
  --ink: #151922;
  --muted: #657083;
  --line: #dde3ea;
  --sidebar: #111722;
  --sidebar-soft: #1b2433;
  --accent: #0f766e;
  --accent-dark: #115e59;
  --warn: #b45309;
  --warn-bg: #fff7ed;
  --soft: #e7f5f2;
  --shadow: 0 18px 38px rgba(17, 24, 39, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 268px minmax(0, 1fr);
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.sidebar {
  position: sticky;
  top: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 24px 18px;
  background: var(--sidebar);
  color: #fff;
}

.brand { display: flex; gap: 12px; align-items: center; margin-bottom: 34px; }
.brand span { display: block; color: #aeb6c2; font-size: 13px; margin-top: 2px; }
.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #21a89a;
  color: #fff;
  font-weight: 800;
}

nav { display: grid; gap: 6px; }
nav a {
  color: #c8d0dc;
  text-decoration: none;
  padding: 11px 12px;
  border-radius: 8px;
  font-weight: 700;
}
nav a.active, nav a:hover { color: #fff; background: var(--sidebar-soft); }
.sidebar-footer { margin: auto 2px 0; color: #8893a5; font-size: 12px; }

.app { width: min(1180px, 100%); padding: 30px; min-width: 0; }
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: 31px; letter-spacing: 0; }
h2 { font-size: 18px; margin-bottom: 14px; }
.eyebrow { color: var(--accent-dark); font-weight: 800; text-transform: uppercase; font-size: 12px; letter-spacing: 0; margin-bottom: 5px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }

button {
  border: 0;
  border-radius: 8px;
  padding: 10px 14px;
  background: var(--accent);
  color: white;
  font-weight: 800;
  cursor: pointer;
}
button:hover { background: var(--accent-dark); }
button:disabled { opacity: 0.65; cursor: not-allowed; }
button.small { padding: 7px 10px; font-size: 12px; border-radius: 6px; }
button.secondary { background: #e5e9ef; color: #202938; }
button.secondary:hover { background: #d6dde7; }

.grid { display: grid; gap: 16px; }
.metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.two { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 16px; align-items: start; }
.section-gap { margin-top: 16px; }
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 20px;
}
.metric strong { display: block; font-size: 35px; margin-top: 10px; }
.metric p { margin-bottom: 0; color: var(--muted); }
.status {
  display: inline-flex;
  align-items: center;
  min-height: 27px;
  padding: 5px 9px;
  border-radius: 8px;
  background: var(--soft);
  color: var(--accent-dark);
  font-weight: 800;
  font-size: 13px;
  white-space: nowrap;
}
.status.warn { background: var(--warn-bg); color: var(--warn); }

.notice {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
  padding: 14px 16px;
  border: 1px solid #fed7aa;
  border-radius: 8px;
  background: var(--warn-bg);
  color: #7c2d12;
}
.notice p { margin: 0; font-weight: 650; }

.stack { display: grid; gap: 10px; }
.mini-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 12px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}
.mini-card strong, .mini-card span, .mini-card p { overflow-wrap: anywhere; }
.mini-card div span { display: block; color: var(--muted); font-size: 13px; margin-top: 3px; }
.mini-card p { grid-column: 1 / -1; margin: 0; color: var(--muted); font-size: 13px; }

.table-wrap { width: 100%; overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.calls-table { min-width: 760px; }
.leads-table { min-width: 920px; }
th, td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0; }
td { overflow-wrap: anywhere; }
.breakable { word-break: break-word; overflow-wrap: anywhere; }
a { color: var(--accent-dark); font-weight: 750; }

.empty {
  display: grid;
  gap: 5px;
  padding: 22px;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  background: #f8fafc;
  color: var(--muted);
}
.empty strong { color: var(--ink); }
.checklist { display: grid; gap: 10px; padding: 0; margin: 0; list-style: none; }
.checklist li { padding: 10px 12px; background: #f8fafc; border: 1px solid var(--line); border-radius: 8px; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 16px;
}
.settings-grid p { margin: 0; }
.simulator-list { display: grid; gap: 14px; }
.simulator-case {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}
.simulator-case div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
pre {
  margin: 0;
  max-height: 360px;
  overflow: auto;
  padding: 12px;
  border-radius: 8px;
  background: #111722;
  color: #f8fafc;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
label { display: grid; gap: 6px; color: var(--muted); font-weight: 700; font-size: 13px; }
input, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 11px;
  font: inherit;
  color: var(--ink);
  background: #fff;
}
textarea { min-height: 92px; resize: vertical; }
.full { grid-column: 1 / -1; }

code {
  display: inline-block;
  max-width: 100%;
  padding: 4px 6px;
  border-radius: 6px;
  background: #f1f5f9;
  overflow-wrap: anywhere;
}

.login {
  display: grid;
  grid-template-columns: 1fr;
  place-items: center;
  padding: 24px;
}
.login-panel {
  width: min(430px, 100%);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 28px;
}
.login-panel .brand-mark { margin-bottom: 18px; }
.login-panel form { display: grid; gap: 12px; }
.form-error { margin: 12px 0 0; color: #b91c1c; font-weight: 700; }

@media (max-width: 900px) {
  body { grid-template-columns: 1fr; }
  .sidebar { position: static; min-height: auto; }
  .sidebar-footer { margin-top: 18px; }
  nav { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  nav a { text-align: center; padding-inline: 8px; }
  .metrics, .two, .form-grid, .settings-grid { grid-template-columns: 1fr; }
  .app { padding: 20px; }
  header { align-items: flex-start; }
}

@media (max-width: 640px) {
  h1 { font-size: 26px; }
  .actions { width: 100%; justify-content: stretch; }
  .actions button { flex: 1; }
  nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .calls-table, .leads-table { min-width: 0; }
  .responsive-table thead { display: none; }
  .responsive-table, .responsive-table tbody, .responsive-table tr, .responsive-table td { display: block; width: 100%; }
  .responsive-table tr {
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
  }
  .responsive-table td {
    display: grid;
    grid-template-columns: 116px minmax(0, 1fr);
    gap: 12px;
    border: 0;
    padding: 7px 0;
  }
  .responsive-table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
  }
}
