* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #f4f6fa; --card: #fff; --ink: #16213a; --muted: #6b7690;
  --accent: #4338ca; --accent-soft: #eef0fe; --green: #14883f; --green-soft: #e4f7ea;
  --red: #c22a3c; --red-soft: #fdeaec; --amber: #a16207; --amber-soft: #fdf3d8;
  --line: #e3e7f0; --radius: 12px;
}
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--ink); font-size: 16px; }
.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 14px; }
code { background: var(--accent-soft); padding: 1px 5px; border-radius: 4px; font-size: 13px; }
hr { border: none; border-top: 1px solid var(--line); margin: 16px 0; }

/* Login */
.login { position: fixed; inset: 0; background: var(--ink); display: flex; align-items: center; justify-content: center; z-index: 50; }
.login-box { background: var(--card); border-radius: 16px; padding: 32px; width: min(360px, 90vw); text-align: center; display: flex; flex-direction: column; gap: 12px; }
.login-box h1 { font-size: 22px; }
.login-box input { padding: 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 16px; text-align: center; }
.err { color: var(--red); font-size: 14px; min-height: 18px; }

/* Layout */
header { background: var(--card); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; padding: 10px 16px; position: sticky; top: 0; z-index: 10; flex-wrap: wrap; }
.brand { font-weight: 700; font-size: 17px; margin-right: 4px; }
nav { display: flex; gap: 4px; flex-wrap: wrap; }
.tab { border: none; background: none; padding: 8px 14px; border-radius: 8px; font-size: 15px; cursor: pointer; color: var(--muted); font-weight: 600; }
.tab.active { background: var(--accent-soft); color: var(--accent); }
main { max-width: 860px; margin: 0 auto; padding: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 14px; }

/* Buttons */
.btn { border: none; border-radius: 10px; padding: 12px 16px; font-size: 15px; font-weight: 700; cursor: pointer; background: #e8ebf3; color: var(--ink); }
.btn:active { transform: scale(0.98); }
.btn.primary { background: var(--accent); color: #fff; }
.btn.green { background: var(--green); color: #fff; }
.btn.red { background: var(--red-soft); color: var(--red); }
.btn.ghost { background: none; border: 1px solid var(--line); }
.btn.small { padding: 7px 10px; font-size: 13px; }

/* Call screen */
.callhead { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; flex-wrap: wrap; }
.bizname { font-size: 24px; font-weight: 800; line-height: 1.2; }
.leadmeta { margin-top: 6px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.chip { background: var(--accent-soft); color: var(--accent); border-radius: 999px; padding: 3px 10px; font-size: 13px; font-weight: 600; }
.chip.gray { background: #eef1f6; color: var(--muted); }
.phone-btn { font-size: 20px; font-weight: 800; color: var(--accent); text-decoration: none; display: inline-block; margin-top: 8px; }
.tzbadge { border-radius: 10px; padding: 10px 14px; font-weight: 700; font-size: 14px; text-align: right; min-width: 190px; }
.tzbadge.ok { background: var(--green-soft); color: var(--green); }
.tzbadge.no { background: var(--red-soft); color: var(--red); }
.tzbadge .sub { display: block; font-weight: 500; font-size: 12.5px; margin-top: 3px; opacity: .85; }
.statsbar { display: flex; gap: 14px; margin-bottom: 12px; font-size: 14px; color: var(--muted); flex-wrap: wrap; }
.statsbar b { color: var(--ink); }

/* Script */
.script h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); margin: 16px 0 5px; display: flex; align-items: center; gap: 8px; }
.script h3:first-child { margin-top: 0; }
.script p { line-height: 1.5; margin-bottom: 4px; }
.script .aside { color: var(--muted); font-style: italic; font-size: 14px; }
.stub-note { background: var(--amber-soft); color: var(--amber); border-radius: 8px; padding: 10px 12px; font-size: 14px; margin-bottom: 8px; }
.stepnum { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 12.5px; font-weight: 800; flex-shrink: 0; }
.muted-inline { color: var(--muted); text-transform: none; letter-spacing: 0; font-weight: 500; }
.opener { position: relative; padding: 10px 12px; border-radius: 8px; margin: 6px 0; background: var(--bg); cursor: pointer; border: 2px solid transparent; }
.opener.selected { border-color: var(--green); background: var(--green-soft); }
.opener.selected::after { content: "✓ used"; position: absolute; top: 8px; right: 10px; color: var(--green); font-size: 12px; font-weight: 800; }
.opener > b { display: block; margin-bottom: 2px; font-size: 13px; }
.opener span { font-size: 14.5px; line-height: 1.45; }
.opener span b, .obj span b { display: inline; font-size: inherit; }
.vm-block { background: var(--bg); border-radius: 8px; padding: 10px 12px; margin-top: 16px; }
.vm-block h3 { margin: 0 0 4px; color: var(--muted); }

/* Objections */
details.objections summary { cursor: pointer; font-weight: 700; padding: 4px 0; }
.obj { position: relative; padding: 10px 40px 10px 12px; border-radius: 8px; margin-top: 8px; background: var(--bg); cursor: pointer; border: 2px solid transparent; }
.obj.selected { border-color: var(--accent); background: var(--accent-soft); }
.obj > b { display: block; margin-bottom: 2px; }
.obj span { font-size: 14.5px; line-height: 1.45; }
.objnum { position: absolute; top: 10px; right: 10px; width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 13px; font-weight: 800; display: none; align-items: center; justify-content: center; }
.obj.selected .objnum { display: inline-flex; }

/* Dispositions */
.dispo-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.dispo-grid .btn { padding: 14px 8px; }

/* Forms */
.formgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0; }
.formgrid label, .fullrow label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 3px; }
.formgrid input, .formgrid select, .fullrow input, .fullrow textarea, .fullrow select, textarea, select, input[type=text] {
  width: 100%; padding: 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 15px; font-family: inherit; background: #fff;
}
.fullrow { grid-column: 1 / -1; }
textarea { resize: vertical; }

/* Tables & lists */
table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
th, td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-size: 12.5px; text-transform: uppercase; letter-spacing: .04em; }
tr.rowlink { cursor: pointer; }
tr.rowlink:hover { background: var(--accent-soft); }
.stagepill { border-radius: 999px; padding: 3px 10px; font-size: 12.5px; font-weight: 700; background: #eef1f6; color: var(--muted); white-space: nowrap; }
.stagepill.hot { background: var(--green-soft); color: var(--green); }
.stagepill.lost { background: var(--red-soft); color: var(--red); }
.kpis { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; flex: 1; min-width: 130px; }
.kpi .n { font-size: 24px; font-weight: 800; }
.kpi .l { font-size: 13px; color: var(--muted); }

/* Timeline */
.timeline { list-style: none; }
.timeline li { padding: 8px 0 8px 14px; border-left: 2px solid var(--line); margin-left: 6px; font-size: 14.5px; }
.timeline .ts { color: var(--muted); font-size: 12.5px; display: block; }

/* Modal & toast */
.modal { position: fixed; inset: 0; background: rgba(10,15,30,.5); display: flex; align-items: center; justify-content: center; z-index: 40; padding: 14px; }
.modal-body { background: var(--card); border-radius: 14px; padding: 20px; width: min(640px, 96vw); max-height: 90vh; overflow-y: auto; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 11px 20px; border-radius: 999px; font-size: 14.5px; z-index: 60; }

.warn-banner { background: var(--red-soft); color: var(--red); border-radius: 8px; padding: 10px 12px; font-size: 14px; font-weight: 600; margin-bottom: 10px; }
@keyframes pulse-red { 0%, 100% { box-shadow: 0 0 0 0 rgba(194, 42, 60, .55); } 50% { box-shadow: 0 0 0 7px rgba(194, 42, 60, 0); } }
.btn.pulse { animation: pulse-red 1.1s infinite; background: var(--red); color: #fff; }

.btnrow { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.emailbox { background: var(--bg); border-radius: 8px; padding: 12px; white-space: pre-wrap; font-size: 14px; line-height: 1.5; margin: 10px 0; }

@media (max-width: 640px) {
  .bizname { font-size: 20px; }
  .formgrid { grid-template-columns: 1fr; }
  main { padding: 10px; }
  .tzbadge { text-align: left; width: 100%; }
}
