/* Auto Attendant Setup Form — Network Intelligence */

:root {
  --bg: #f4f6fa;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #dde3ec;
  --border-strong: #c3ccdb;
  --text: #16202f;
  --text-2: #5a6779;
  --text-3: #8592a5;
  --brand: #1a56a8;
  --brand-2: #2b7bd4;
  --brand-soft: #e8f0fb;
  --accent: #0d9488;
  --warn: #b45309;
  --warn-soft: #fef3c7;
  --danger: #b91c1c;
  --danger-soft: #fee2e2;
  --ok: #15803d;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(16,32,47,.06), 0 4px 16px rgba(16,32,47,.06);
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
}

/* ---------- Layout ---------- */

.masthead {
  background: linear-gradient(135deg, #12376b 0%, #1a56a8 55%, #2b7bd4 100%);
  color: #fff;
  padding: 26px 0 22px;
}
.masthead .wrap { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.masthead h1 { margin: 0 0 4px; font-size: 22px; font-weight: 650; letter-spacing: -.01em; }
.masthead p { margin: 0; color: #cfe0f7; font-size: 14px; max-width: 68ch; }
/* Tel link in the intro — needs to read as a link against the gradient. */
.mast-link { color: #fff; font-weight: 600; text-decoration: underline; text-underline-offset: 2px; white-space: nowrap; }
.mast-link:hover { color: #e8f0fb; }

.brandblock { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.brand-logo { display: block; height: 88px; width: auto; flex: 0 0 auto; }
@media (max-width: 620px) { .brand-logo { height: 62px; } .brandblock { gap: 14px; } }

/* The logo already carries the wordmark, so the text version is only a fallback:
   shown if the image fails to load, and in print where a light mark would vanish. */
.brandmark { display: none; font-size: 12px; text-transform: uppercase; letter-spacing: .13em; color: #9dc2f0; margin: 0 0 8px; font-weight: 600; }
body.no-logo .brand-logo { display: none; }
body.no-logo .brandmark { display: block; }

.wrap { max-width: 1240px; margin: 0 auto; padding: 0 22px; }

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 26px;
  align-items: start;
  padding: 26px 0 80px;
}
@media (max-width: 1040px) { .layout { grid-template-columns: minmax(0,1fr); } }

/* ---------- Stepper ---------- */

.stepper {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px;
  margin-bottom: 18px;
  display: flex;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: thin;
  box-shadow: var(--shadow);
}
.stepper button {
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 8px;
  border: 0; background: transparent; cursor: pointer;
  font: inherit; font-size: 13px; color: var(--text-2);
  padding: 8px 12px; border-radius: var(--radius-sm);
  white-space: nowrap;
}
.stepper button:hover { background: var(--surface-2); color: var(--text); }
.stepper button[aria-current="step"] { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.stepper .num {
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--border); color: var(--text-2);
  display: grid; place-items: center; font-size: 11px; font-weight: 700;
}
.stepper button[aria-current="step"] .num { background: var(--brand); color: #fff; }
.stepper button.done .num { background: var(--ok); color: #fff; }

.progress { height: 3px; background: var(--border); border-radius: 2px; overflow: hidden; margin-bottom: 18px; }
.progress > i { display: block; height: 100%; background: var(--brand-2); width: 0; transition: width .25s ease; }

/* ---------- Cards / steps ---------- */

.step { display: none; }
.step.active { display: block; animation: fade .18s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 24px 24px;
  margin-bottom: 18px;
}
.card > h2 {
  margin: 0 0 4px; font-size: 18px; font-weight: 650; letter-spacing: -.01em;
  display: flex; align-items: center; gap: 10px;
}
.card > .lede { margin: 0 0 20px; color: var(--text-2); font-size: 14px; max-width: 76ch; }

h3.sub {
  font-size: 13px; text-transform: uppercase; letter-spacing: .07em;
  color: var(--text-3); font-weight: 700;
  margin: 26px 0 12px; padding-bottom: 7px; border-bottom: 1px solid var(--border);
}
h3.sub:first-of-type { margin-top: 4px; }

/* ---------- Fields ---------- */

.grid { display: grid; gap: 14px 16px; grid-template-columns: repeat(12, minmax(0,1fr)); }
.f      { grid-column: span 12; }
.f-2    { grid-column: span 2; }
.f-3    { grid-column: span 3; }
.f-4    { grid-column: span 4; }
.f-5    { grid-column: span 5; }
.f-6    { grid-column: span 6; }
.f-7    { grid-column: span 7; }
.f-8    { grid-column: span 8; }
.f-9    { grid-column: span 9; }
@media (max-width: 760px) { .f-2,.f-3,.f-4,.f-5,.f-6,.f-7,.f-8,.f-9 { grid-column: span 12; } }

label, .lbl { display: block; font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 5px; }
label .req { color: var(--danger); margin-left: 2px; }
.hint { font-size: 12px; color: var(--text-3); margin-top: 5px; line-height: 1.45; }

input[type=text], input[type=email], input[type=tel], input[type=date], input[type=time],
input[type=number], input[type=url], select, textarea {
  width: 100%; font: inherit; font-size: 14px; color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  transition: border-color .12s, box-shadow .12s;
}
select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%2212%22 height=%2212%22 viewBox=%220 0 12 12%22%3E%3Cpath fill=%22%235a6779%22 d=%22M6 8.5 1.5 4h9z%22/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
}
textarea { resize: vertical; min-height: 86px; line-height: 1.5; }
textarea.script { font-family: var(--mono); font-size: 13px; min-height: 104px; }

input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand-2);
  box-shadow: 0 0 0 3px rgba(43,123,212,.16);
}
input:disabled, select:disabled, textarea:disabled { background: var(--surface-2); color: var(--text-3); }
input.invalid, select.invalid, textarea.invalid { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(185,28,28,.12); }

.check { display: flex; gap: 9px; align-items: flex-start; font-size: 14px; font-weight: 400; margin-bottom: 0; cursor: pointer; }
.check input { margin: 3px 0 0; width: 15px; height: 15px; flex: 0 0 auto; accent-color: var(--brand); }
.check span { color: var(--text); }
.checks { display: grid; gap: 9px; }
.checks.cols2 { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }

.radios { display: grid; gap: 8px; }
.radios.inline { grid-auto-flow: column; grid-auto-columns: max-content; gap: 18px; }
@media (max-width: 620px) { .radios.inline { grid-auto-flow: row; gap: 8px; } }

fieldset { border: 0; margin: 0; padding: 0; }
fieldset > legend { font-size: 13px; font-weight: 600; margin-bottom: 7px; padding: 0; }

/* ---------- Repeaters ---------- */

.repeat-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 16px 18px;
  margin-bottom: 12px;
  background: var(--surface-2);
  position: relative;
}
.repeat-item > .ri-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin: -4px 0 14px;
}
.ri-title { font-size: 13px; font-weight: 700; color: var(--brand); letter-spacing: .02em; }
.ri-title .idx { color: var(--text-3); font-weight: 600; }

.menu-block {
  border: 1px solid var(--border-strong);
  border-left: 3px solid var(--brand-2);
  background: var(--surface);
}
.menu-block .option-item { background: var(--surface-2); }

.option-item { padding: 13px 14px 15px; }
.option-grid { display: grid; gap: 10px 12px; grid-template-columns: 76px 1.4fr 1.15fr 1.15fr 92px; align-items: start; }
@media (max-width: 1100px) { .option-grid { grid-template-columns: 76px 1fr 1fr; } }
@media (max-width: 700px)  { .option-grid { grid-template-columns: 1fr; } }
.option-grid .full { grid-column: 1 / -1; }

.key-badge {
  display: inline-grid; place-items: center;
  width: 30px; height: 30px; border-radius: 7px;
  background: var(--text); color: #fff;
  font-family: var(--mono); font-size: 15px; font-weight: 700;
  flex: 0 0 auto;
}
.key-badge.dup { background: var(--danger); }

/* ---------- Buttons ---------- */

.btn {
  font: inherit; font-size: 14px; font-weight: 600;
  border-radius: var(--radius-sm); border: 1px solid transparent;
  padding: 9px 16px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 7px;
  transition: background .12s, border-color .12s, color .12s;
}
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: #164a91; }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-add { background: var(--brand-soft); color: var(--brand); border-color: #c3dbf7; }
.btn-add:hover { background: #d9e8fa; }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.btn-del {
  background: transparent; color: var(--text-3); border-color: transparent;
  padding: 4px 8px; font-size: 12.5px;
}
.btn-del:hover { background: var(--danger-soft); color: var(--danger); }
.btn-submit { background: var(--ok); color: #fff; font-size: 15px; padding: 11px 26px; }
.btn-submit:hover { background: #126c34; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.formnav {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding-top: 4px;
}
.formnav .spacer { flex: 1; }

/* ---------- Notices ---------- */

.note {
  border-radius: var(--radius-sm); padding: 11px 13px; font-size: 13px;
  border: 1px solid; margin: 0 0 16px; line-height: 1.5;
}
.note-info { background: var(--brand-soft); border-color: #c3dbf7; color: #15406f; }
.note-warn { background: var(--warn-soft); border-color: #fcd97a; color: #7c4a09; }
.note strong { font-weight: 700; }
.note code { font-family: var(--mono); font-size: 12px; background: rgba(0,0,0,.05); padding: 1px 5px; border-radius: 4px; }

.errorbox { background: var(--danger-soft); border: 1px solid #f5b5b5; color: #7f1d1d; border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 16px; font-size: 13.5px; }
.errorbox ul { margin: 7px 0 0; padding-left: 20px; }
.errorbox li { margin-bottom: 3px; }

/* ---------- Preview pane ---------- */

.preview {
  position: sticky; top: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  max-height: calc(100vh - 36px);
  display: flex; flex-direction: column;
}
.preview header {
  padding: 14px 16px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.preview header h2 { margin: 0; font-size: 13px; text-transform: uppercase; letter-spacing: .07em; color: var(--text-3); font-weight: 700; }
.preview .body { overflow: auto; padding: 14px 16px 18px; flex: 1; }
.tree { font-family: var(--mono); font-size: 12.5px; line-height: 1.75; margin: 0; }
.tree .node { padding-left: 14px; border-left: 1px dotted var(--border-strong); margin-left: 6px; }
.tree .root { padding-left: 0; border: 0; margin: 0 0 4px; }
.tree .k { color: var(--brand); font-weight: 700; }
.tree .a { color: var(--text-2); }
.tree .d { color: var(--accent); }
.tree .muted { color: var(--text-3); font-style: italic; }
.tree .bad { color: var(--danger); }

.savebar { font-size: 12px; color: var(--text-3); padding: 10px 16px; border-top: 1px solid var(--border); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.savebar .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
.savebar a { color: var(--brand); cursor: pointer; text-decoration: none; font-weight: 600; }
.savebar a:hover { text-decoration: underline; }

/* ---------- Tables ---------- */

.tablewrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
table.rows { border-collapse: collapse; width: 100%; min-width: 660px; font-size: 13.5px; }
table.rows th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); background: var(--surface-2); padding: 8px 10px; border-bottom: 1px solid var(--border); font-weight: 700; white-space: nowrap; }
table.rows td { padding: 5px 6px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.rows tr:last-child td { border-bottom: 0; }
table.rows input, table.rows select { border-color: transparent; background: transparent; padding: 6px 8px; }
table.rows input:hover, table.rows select:hover { border-color: var(--border); }
table.rows input:focus, table.rows select:focus { background: var(--surface); }
table.rows td.act { width: 40px; text-align: center; }

/* ---------- Review ---------- */

.review-out { font-size: 14px; }
.review-out h3 { font-size: 15px; margin: 22px 0 8px; color: var(--brand); }
.review-out h3:first-child { margin-top: 0; }
.review-out dl { display: grid; grid-template-columns: minmax(150px, 230px) 1fr; gap: 3px 16px; margin: 0 0 6px; }
.review-out dt { color: var(--text-2); font-size: 13px; }
.review-out dd { margin: 0; }
.review-out .empty { color: var(--text-3); font-style: italic; }
.review-out pre { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; font-family: var(--mono); font-size: 12.5px; white-space: pre-wrap; margin: 4px 0 0; }

.result { text-align: center; padding: 48px 20px; }
.result h2 { font-size: 22px; margin: 0 0 8px; justify-content: center; }
.result p { color: var(--text-2); max-width: 54ch; margin: 0 auto 8px; }
.result .tick { width: 54px; height: 54px; border-radius: 50%; background: #dcfce7; color: var(--ok); display: grid; place-items: center; font-size: 28px; margin: 0 auto 16px; }

.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- Print ---------- */

@media print {
  body { background: #fff; font-size: 11pt; }
  .masthead { background: none; color: #000; border-bottom: 2px solid #000; padding: 0 0 10px; }
  .masthead p, .brandmark { color: #444; }
  .mast-link { color: #000; }
  /* A light-on-dark mark disappears on paper — fall back to the wordmark. */
  .brand-logo { display: none !important; }
  .brandmark { display: block !important; }
  .stepper, .progress, .preview, .formnav, .btn, .savebar, .no-print { display: none !important; }
  .layout { grid-template-columns: 1fr; padding: 12px 0; gap: 0; }
  .step { display: block !important; page-break-inside: avoid; }
  .card { box-shadow: none; border: 1px solid #bbb; page-break-inside: avoid; margin-bottom: 12px; }
  input, select, textarea { border: 0 !important; border-bottom: 1px solid #ccc !important; background: none !important; padding-left: 0 !important; }
}

/* ---------- Dark ---------- */

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e141d;
    --surface: #161e2a;
    --surface-2: #1b2532;
    --border: #2a3646;
    --border-strong: #3a4859;
    --text: #e6ecf5;
    --text-2: #a3b1c4;
    --text-3: #7b8a9e;
    --brand: #7fb2f0;
    --brand-2: #4f93e0;
    --brand-soft: #172c45;
    --accent: #38bfae;
    --warn-soft: #3a2c10;
    --danger: #f08a8a;
    --danger-soft: #3b1c1c;
    --ok: #4ade80;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 4px 16px rgba(0,0,0,.28);
  }
  :root:not([data-theme="light"]) .btn-primary { background: #2563a8; color: #fff; }
  :root:not([data-theme="light"]) .btn-submit { background: #1d7a42; color: #fff; }
  :root:not([data-theme="light"]) .key-badge { background: #3a4859; }
  :root:not([data-theme="light"]) .note-info { color: #bcd7f7; border-color: #26456b; }
  :root:not([data-theme="light"]) .note-warn { color: #f3d08a; border-color: #5b451b; }
  :root:not([data-theme="light"]) .errorbox { color: #f6c2c2; border-color: #5e2626; }
  :root:not([data-theme="light"]) .result .tick { background: #11331f; }
}
