:root {
  --background: #f3efe6;
  --panel: #fffdf8;
  --ink: #12160f;
  --foreground: #1a1f16;
  --muted: #5c6554;
  --line: #ded7c9;
  --accent: #c45c26;
  --accent-deep: #8f3d14;
  --ok: #2f6b4f;
  --warn: #a15c12;
  --danger: #9b2c2c;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    radial-gradient(ellipse 80% 50% at 8% -12%, #e9dcc6 0%, transparent 55%),
    radial-gradient(ellipse 55% 40% at 100% 0%, #dde7d6 0%, transparent 48%),
    var(--background);
  color: var(--foreground);
  font-family: "DM Sans", system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
}

.shell,
.auth-shell {
  max-width: 480px;
  margin: 0 auto;
  padding: 32px 20px 64px;
}

.eyebrow {
  margin: 0;
  font-family: Fraunces, Georgia, serif;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent-deep);
}

/* —— App shell —— */
.app-body {
  min-height: 100vh;
}

.app {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  min-height: 100vh;
  max-width: 1280px;
  margin: 0 auto;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 28px 18px 20px;
  border-right: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 253, 248, 0.92) 0%, rgba(243, 239, 230, 0.55) 100%);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-brand {
  padding: 0 8px 12px;
}

.sidebar-company {
  margin: 6px 0 0;
  font-family: Fraunces, Georgia, serif;
  font-size: 20px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.25;
  word-break: break-word;
}

.sidebar-switch {
  margin: 0 8px 10px;
}

.sidebar-label {
  display: block;
  margin-bottom: 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.sidebar-switch select,
select {
  margin-top: 6px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  padding: 11px 14px;
  font: inherit;
  color: var(--foreground);
}

.sidebar-switch select {
  margin-top: 0;
  padding: 8px 10px;
  font-size: 13px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  padding: 4px 0;
}

.nav-group {
  margin: 14px 8px 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.nav-group:first-child {
  margin-top: 0;
}

.nav-link {
  display: block;
  padding: 9px 12px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  color: var(--foreground);
}

.nav-link:hover {
  background: rgba(255, 253, 248, 0.85);
}

.nav-link.active {
  background: var(--ink);
  color: var(--panel);
}

.sidebar-foot {
  margin-top: auto;
  padding: 14px 8px 0;
  border-top: 1px solid var(--line);
}

.sidebar-user {
  margin: 0 0 4px;
  font-size: 12px;
  color: var(--muted);
  word-break: break-all;
}

.sidebar-foot .linklike {
  padding: 4px 0;
  color: var(--accent-deep);
}

.app-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.app-top {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  padding: 22px 28px 0;
}

.page-heading {
  margin: 0;
  font-family: Fraunces, Georgia, serif;
  font-size: 28px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.2;
}

.app-top-hint {
  margin: 0 0 0 auto;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.menu-btn {
  display: none;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 10px;
  padding: 8px 14px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.mobile-only {
  display: none;
}

.sidebar-backdrop {
  display: none;
}

.overview {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 0 0 22px;
}

.overview-item {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
}

.overview-item .k {
  margin: 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.overview-item .v {
  margin: 6px 0 0;
  font-family: Fraunces, Georgia, serif;
  font-size: 24px;
  font-weight: 600;
  color: var(--ink);
}

.setup-card {
  margin: 0 0 22px;
  padding: 18px 20px;
  border: 1px solid #e8cbb6;
  border-radius: 16px;
  background: linear-gradient(135deg, #fff8f1 0%, #fffdf8 70%);
}

.setup-card h3 {
  margin: 0;
  font-family: Fraunces, Georgia, serif;
  font-size: 18px;
  font-weight: 600;
  color: var(--ink);
}

.setup-list {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.setup-list li {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  font-size: 14px;
}

.setup-list .done {
  color: var(--ok);
  font-weight: 600;
}

.setup-list .todo a {
  color: var(--accent-deep);
  text-decoration: underline;
  font-weight: 600;
}

.page-lead {
  margin: 0 0 8px;
}

.page-lead .sub {
  margin: 0;
}

@media (max-width: 900px) {
  .app {
    display: block;
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 40;
    width: min(280px, 86vw);
    height: 100vh;
    transform: translateX(-105%);
    transition: transform 0.2s ease;
    border-right: 1px solid var(--line);
    box-shadow: none;
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: 12px 0 40px rgba(18, 22, 15, 0.12);
  }

  .menu-btn {
    display: inline-block;
  }

  .mobile-only {
    display: block;
  }

  .app-top-hint {
    display: none;
  }

  .sidebar-backdrop:not([hidden]) {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 30;
    background: rgba(18, 22, 15, 0.35);
  }

  body.nav-open {
    overflow: hidden;
  }

  .app-top {
    padding: 16px 18px 0;
  }

  .page-heading {
    font-size: 22px;
  }

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

.voice-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 6px;
}

.voice-row select {
  margin-top: 0;
  flex: 1 1 180px;
}

.danger-zone {
  border-color: #e5c3c3;
  background: #fff8f8;
}

.statgrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}

.stat .stat-value {
  margin: 6px 0 0;
  font-family: Fraunces, Georgia, serif;
  font-size: 28px;
  font-weight: 600;
  color: var(--ink);
}

.meter {
  margin-top: 10px;
  height: 6px;
  border-radius: 999px;
  background: #efe8da;
  overflow: hidden;
}

.meter span {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
}

.twocol {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.moneylist {
  list-style: none;
  margin: 16px 0 0;
  padding: 0;
}

.moneylist li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}

.moneylist li.total {
  border-bottom: 0;
  padding-top: 12px;
  font-weight: 700;
}

.rate-heading {
  margin: 8px 0 0;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.rategrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

input[type="number"] {
  margin-top: 6px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  padding: 11px 14px;
  font: inherit;
  color: var(--foreground);
}



input[type="email"] {
  margin-top: 6px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  padding: 11px 14px;
  font: inherit;
  color: var(--foreground);
}


.linklike {
  border: 0;
  background: none;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  padding: 8px 12px;
}

.content {
  padding: 20px 28px 64px;
}

.app-main > .content {
  flex: 1;
}

.content.centered {
  max-width: 420px;
  margin: 0 auto;
  padding-top: 72px;
}

@media (max-width: 900px) {
  .content {
    padding: 16px 18px 48px;
  }
}

h2.section {
  font-family: Fraunces, Georgia, serif;
  font-size: 22px;
  font-weight: 600;
  color: var(--ink);
  margin: 0;
}

.sub {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.row-between {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: flex-end;
  justify-content: space-between;
}

/* Filters */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 20px 0 16px;
}

.chip {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
}

.chip.active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--panel);
}

.searchform {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

/* Call list */
.calllist {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  background: var(--panel);
}

.calllist li + li {
  border-top: 1px solid var(--line);
}

.callrow {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
}

.callrow:hover {
  background: #faf6ec;
}

.callrow .who {
  font-weight: 600;
  color: var(--ink);
}

.callrow .why {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 14px;
  max-width: 56ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.meta {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 13px;
  color: var(--muted);
}

.badge {
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid transparent;
}

.badge.completed { color: var(--ok); border-color: #bcd8c8; background: #eef6f1; }
.badge.incomplete,
.badge.in_progress,
.badge.ringing { color: var(--warn); border-color: #e6d3b4; background: #fbf4e7; }
.badge.spam,
.badge.error,
.badge.no_answer { color: var(--danger); border-color: #e5c3c3; background: #fbeeee; }
.badge.high { color: var(--danger); border-color: #e5c3c3; background: #fbeeee; }
.badge.new { color: var(--accent-deep); border-color: #e8cbb6; background: #fbf0e8; }

/* Forms */
label.field {
  display: block;
  font-size: 14px;
  font-weight: 500;
}

input[type="text"],
input[type="password"],
input[type="tel"],
textarea {
  margin-top: 6px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  padding: 11px 14px;
  font: inherit;
  color: var(--foreground);
}

input:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
}

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

.checkline {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.btn {
  display: inline-block;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: var(--panel);
  padding: 12px 22px;
  font: inherit;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}

.btn.accent {
  background: var(--accent);
  color: #fff;
}

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

.btn.danger {
  background: var(--panel);
  color: var(--danger);
  border: 1px solid #e5c3c3;
}

.notice {
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 14px;
}

.notice.ok { background: #eef6f1; color: var(--ok); }
.notice.err { background: #fbeeee; color: var(--danger); }

/* Detail */
.fieldgrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
}

.fieldgrid .k {
  margin: 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
}

.fieldgrid .v {
  margin: 5px 0 0;
  font-weight: 600;
  color: var(--ink);
}

.transcript {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.transcript .speaker {
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent-deep);
}

.transcript .speaker.caller {
  color: var(--muted);
}

.transcript p {
  margin: 2px 0 0;
  font-size: 15px;
}

audio {
  width: 100%;
  margin-top: 12px;
}

.empty {
  border: 1px dashed var(--line);
  border-radius: 16px;
  background: var(--panel);
  padding: 56px 24px;
  text-align: center;
}

.empty h3 {
  font-family: Fraunces, Georgia, serif;
  font-weight: 600;
  font-size: 19px;
  margin: 0;
  color: var(--ink);
}

.empty p {
  margin: 8px auto 0;
  max-width: 46ch;
  color: var(--muted);
  font-size: 14px;
}

code {
  background: #f0ead9;
  border-radius: 5px;
  padding: 1px 5px;
  font-size: 13px;
}

.back {
  font-size: 14px;
  color: var(--muted);
}

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

.hint {
  font-size: 13px;
  color: var(--muted);
  margin: 6px 0 0;
}

.badge.live {
  color: #9a1f1f;
  border-color: #f0b4b4;
  background: #fdeeee;
  animation: pulse-live 1.6s ease-in-out infinite;
}

.badge.joined {
  color: #1f5a3a;
  border-color: #b7dcc7;
  background: #eef7f1;
}

@keyframes pulse-live {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

.callrow.live {
  border-color: #f0b4b4;
  background: #fff7f7;
}

.livebox {
  margin: 0 0 22px;
  padding: 14px 16px 6px;
  border: 1px solid #f0b4b4;
  border-radius: 16px;
  background: #fff7f7;
}

.livebox-title {
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: #9a1f1f;
}

.flash {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 14px;
}

.flash.ok {
  background: #eef7f1;
  border: 1px solid #b7dcc7;
  color: #1f5a3a;
}

.flash.warn {
  background: #fbf4e7;
  border: 1px solid #e6d3b4;
  color: #7a5a20;
}

.flash a {
  text-decoration: underline;
}

