/* IVR Studio — "Switchboard" theme.
 * Display: Space Grotesk · Body: IBM Plex Sans · Numbers/keys: IBM Plex Mono.
 * Identity: telephony control surface; signature = phone-keypad keys. */

/* Tokens mirror the Earth Design System (anywhere.co): monochrome, neutral,
 * black accent, soft cool-gray shadows, sparse semantic colors. */
:root {
  --ink: #111111;          /* text-primary */
  --bg: #fafafa;           /* page */
  --surface: #ffffff;      /* cards */
  --surface-2: #f4f4f4;
  --line: #dbdbdb;         /* border-secondary */
  --line-soft: #f0f0f0;    /* border-tertiary */
  --line-hover: #c7c7c7;
  --muted: #676767;        /* text-secondary */
  --muted-2: #9c9c9c;      /* text-tertiary */
  --brand: #111111;        /* accent = black */
  --brand-bright: #323232;
  --brand-soft: #f2f2f2;
  --link: #1d90f6;
  --shadow: 0 -1px 4px rgba(88,104,116,.10), 0 1px 4px rgba(88,104,116,.12);
  --shadow-lg: 0 4px 8px rgba(88,104,116,.12), 0 8px 24px rgba(88,104,116,.10);

  --c-greeting: #1d90f6;   /* info blue */
  --c-menu: #e27e27;       /* caution orange */
  --c-transfer: #198057;   /* positive green */
  --c-voicemail: #512fb1;  /* violet */
  --c-trigger: #676767;    /* neutral */

  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink);
       font: 15px/1.55 "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
       -webkit-font-smoothing: antialiased; }

/* Topbar */
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); padding: 14px 28px;
          display: flex; align-items: center; justify-content: space-between; }
.who { font-size: 13px; color: var(--muted); }
.signin { max-width: 380px; margin: 80px auto; text-align: center; background: var(--surface);
          border: 1px solid var(--line); border-radius: 14px; padding: 32px; box-shadow: var(--shadow); }
.signin .btn { margin-top: 18px; display: inline-block; }
.signin .coverage-item { margin: 14px 0; text-align: left; }
.brand { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; color: var(--ink);
         font-family: "Inter", sans-serif; font-weight: 700; font-size: 18px; letter-spacing: -.01em; }
.brand-thin { font-weight: 500; color: var(--muted); }
.brand-icon { width: 20px; height: 20px; color: var(--brand); display: block; }

.container { max-width: 1000px; margin: 32px auto; padding: 0 24px; }
.actions { display: flex; align-items: center; gap: 10px; }
.actions #save-btn { margin-left: auto; }   /* secondary actions left, Save right */
.btn-ghost { font: inherit; font-weight: 600; padding: 9px 16px; border-radius: 9px;
             background: #fff; color: var(--ink); border: 1px solid var(--line); cursor: pointer; }
.btn-ghost:hover { border-color: var(--line-hover); background: var(--surface-2); }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.row-actions form { margin: 0; }
.row-act { font: inherit; font-size: 13px; background: none; border: none; color: var(--muted);
           cursor: pointer; padding: 4px 8px; border-radius: 6px; }
.row-act:hover { color: var(--ink); background: var(--surface-2); }
.head-right { display: flex; align-items: center; gap: 16px; }
.tz-form { display: flex; align-items: center; gap: 8px; margin: 0; }
.tz-form select { font: inherit; font-size: 14px; padding: 7px 10px; border: 1px solid var(--line);
                  border-radius: 8px; background: #fff; }
.tz-note { margin: -10px 0 18px; }
.muted { color: var(--muted); }
a { color: var(--brand); }

h1 { font-family: "Inter", sans-serif; font-size: 25px; font-weight: 600;
     letter-spacing: -.015em; margin: 0 0 4px; }
h2 { font-family: "Inter", sans-serif; font-size: 13px; text-transform: uppercase;
     letter-spacing: .06em; color: var(--muted); margin: 30px 0 14px; }

.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 22px; }
.btn { font: inherit; font-weight: 600; padding: 9px 18px; border-radius: 9px; border: none;
       background: var(--brand); color: #fff; text-decoration: none; cursor: pointer; }
.btn:hover { background: var(--brand-bright); }
.btn-disabled { background: #c3cad3; cursor: not-allowed; }
.btn:disabled { cursor: default; }
.btn.is-clean { background: var(--surface-2); color: var(--muted); }   /* "Saved" resting state */
.tag { display: inline-block; font-family: var(--mono); font-size: 10px; font-weight: 600;
       text-transform: uppercase; letter-spacing: .04em; padding: 2px 7px; border-radius: 5px;
       background: var(--brand-soft); color: var(--brand); vertical-align: middle; }
.tag-on { background: #E4F5EC; color: #0E7C66; }
.tag-beta { background: var(--caution-soft); color: #8a5a12; }
.tag-off { background: #FBE9E7; color: #C5221F; }

/* Account home */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.card { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
        padding: 20px; text-decoration: none; color: var(--ink); box-shadow: var(--shadow);
        transition: transform .15s, border-color .15s; }
.card:hover { transform: translateY(-2px); border-color: var(--brand-bright); }
.card-num { font-family: var(--mono); font-size: 20px; font-weight: 600; letter-spacing: -.02em; }
.card-meta { font-size: 13px; margin-top: 6px; color: var(--muted); }
.card-go { margin-top: 16px; color: var(--brand); font-weight: 600; font-size: 14px; }
.empty { color: var(--muted); padding: 48px; text-align: center; background: var(--surface);
         border: 1px dashed var(--line); border-radius: 14px; }

/* Rules table */
table.rules { width: 100%; border-collapse: collapse; background: var(--surface);
              border: 1px solid var(--line); border-radius: 14px; overflow: hidden; box-shadow: var(--shadow); }
table.rules th, table.rules td { text-align: left; padding: 13px 16px; border-bottom: 1px solid var(--line); }
table.rules th { font-family: "Inter", sans-serif; font-size: 11px; text-transform: uppercase;
                 letter-spacing: .06em; color: var(--muted); }
table.rules tbody tr { cursor: pointer; }
table.rules tbody tr:hover { background: var(--brand-soft); }
table.rules tr:last-child td { border-bottom: none; }
table.rules a { font-weight: 600; text-decoration: none; }

/* Coverage banner (rules list) */
.coverage { display: flex; flex-direction: column; gap: 8px; margin-bottom: 22px; }
.coverage-item { padding: 10px 14px; border-radius: 9px; font-size: 14px; border: 1px solid; }
.coverage-error { background: var(--critical-soft); border-color: #f3c3bf; color: #841515; }
.coverage-warn { background: var(--caution-soft); border-color: #f3dcc0; color: #7a4a12; }
.coverage-ok { background: var(--positive-soft); border-color: #b9e7d3; color: #0d442e; }

/* Buttons: ghost danger + row delete */
.btn-ghost-danger { font: inherit; font-weight: 600; padding: 9px 16px; border-radius: 9px;
                    background: #fff; color: var(--critical); border: 1px solid var(--line); cursor: pointer; }
.btn-ghost-danger:hover { border-color: var(--critical); background: var(--critical-soft); }
.row-del { font: inherit; font-size: 13px; background: none; border: none; color: var(--muted-2);
           cursor: pointer; padding: 4px 8px; border-radius: 6px; }
.row-del:hover { color: var(--critical); background: var(--critical-soft); }
table.rules form { margin: 0; }

/* Rule settings panel */
.settings { background: var(--surface); border: 1px solid var(--line); border-radius: 13px;
            padding: 18px; box-shadow: var(--shadow-sm); margin-bottom: 22px; }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.settings-toggles { display: flex; flex-wrap: wrap; gap: 18px; margin-top: 14px; }
.chk { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.chk input { width: 16px; height: 16px; accent-color: var(--accent); }
.settings select { font: inherit; font-size: 15px; padding: 9px 11px; border: 1px solid var(--line);
                   border-radius: 9px; background: #fff; }
.schedule { margin-top: 16px; border-top: 1px solid var(--line-soft); padding-top: 16px; }
.days { display: flex; gap: 8px; flex-wrap: wrap; }
.day { font: inherit; font-size: 13px; font-weight: 500; padding: 7px 14px; border-radius: 999px;
       border: 1px solid var(--line); background: #fff; color: var(--ink); cursor: pointer; transition: all .12s; }
.day:hover { border-color: var(--line-hover); }
.day.day-on { background: #111111; color: #ffffff; border-color: #111111; font-weight: 600; }
.times { display: flex; gap: 14px; margin-top: 14px; }
.times .fld { max-width: 160px; }

/* ---- Designer: palette + canvas ---- */
.designer { display: grid; grid-template-columns: 216px 1fr; gap: 26px; align-items: start; }

.palette { position: sticky; top: 20px; background: var(--surface); border: 1px solid var(--line);
           border-radius: 13px; padding: 16px; box-shadow: var(--shadow); }
.palette-title { font-family: "Inter", sans-serif; font-size: 12px; text-transform: uppercase;
                 letter-spacing: .06em; color: var(--muted); }
.palette-hint { font-size: 12px; color: var(--muted); margin: 5px 0 14px; }
.palette-item { display: flex; gap: 11px; align-items: center; padding: 11px 12px; border: 1px solid var(--line);
                border-radius: 10px; margin-bottom: 9px; cursor: grab; background: #fff; transition: border-color .12s; }
.palette-item:hover { border-color: var(--brand-bright); background: var(--brand-soft); }
.palette-item:active { cursor: grabbing; }
.palette-label { font-weight: 600; font-size: 14px; }
.palette-desc { font-size: 12px; color: var(--muted); }

/* Type dots */
.dot { flex: none; width: 11px; height: 11px; border-radius: 3px; background: var(--muted); display: inline-block; }
.dot-trigger { background: var(--c-trigger); }
.dot-greeting { background: var(--c-greeting); }
.dot-menu { background: var(--c-menu); }
.dot-transfer { background: var(--c-transfer); }
.dot-voicemail { background: var(--c-voicemail); }
.dot-hangup { background: #C5221F; }

/* Flow column */
.canvas { min-width: 0; }   /* fill the column, aligned with the settings block above */
.step { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.step-trigger { background: var(--surface-2); }
.step-head { display: flex; align-items: center; gap: 11px; padding: 14px 17px; cursor: pointer; }
.step-trigger .step-head { cursor: default; }
.step-head:hover { background: #fafafa; border-radius: 12px; }
.step-type { font-family: "Inter", sans-serif; font-weight: 600; font-size: 15px; flex: none; }
.step-summary { flex: 1; min-width: 0; color: var(--muted); font-size: 14px;
                white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.step-summary.mono, .num { font-family: var(--mono); font-size: 14px; color: var(--ink); }
.icon-btn { background: none; border: none; color: #aab2bd; font-size: 15px; cursor: pointer;
            padding: 3px 8px; border-radius: 6px; flex: none; line-height: 1; }
.icon-btn:hover { color: #C5221F; background: #FBE9E7; }

/* Inline editor (collapsed until open) */
.step-edit { display: none; flex-direction: column; gap: 11px; padding: 2px 17px 17px; }
.step.open .step-edit { display: flex; }
.fld { display: flex; flex-direction: column; gap: 4px; }
.fld-label { font-size: 13px; color: var(--muted); font-weight: 500; }
.fld input, .fld textarea { font: inherit; font-size: 15px; padding: 9px 12px; border: 1px solid var(--line);
                            border-radius: 9px; background: #fff; resize: vertical; }
.fld input:focus, .fld textarea:focus { outline: none; border-color: var(--brand-bright);
                                         box-shadow: 0 0 0 3px var(--brand-soft); }
.fld textarea { min-height: 88px; line-height: 1.5; }
.fld-hint { font-size: 13px; color: var(--muted); margin: 0; }

/* Routing-wire connectors */
.connector { height: 30px; display: flex; justify-content: center; align-items: center;
             position: relative; border-radius: 7px; }
.connector::before { content: ""; position: absolute; top: 0; bottom: 0; width: 2px; background: var(--line); }
.connector.drop-hot { background: var(--brand-soft); outline: 2px dashed var(--brand); outline-offset: -2px; }
.add-btn { position: relative; width: 24px; height: 24px; border-radius: 50%; background: var(--surface);
           border: 1px solid var(--line); color: var(--muted); display: grid; place-items: center;
           font-size: 16px; cursor: pointer; line-height: 1; }
.add-btn:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }
.step-trigger.drop-hot { outline: 2px dashed var(--brand); outline-offset: 1px; }
.flow-end { text-align: center; color: var(--muted); font-size: 13px; padding: 12px;
            font-family: var(--mono); letter-spacing: .04em; }

/* Menu branches + nested side-tracks */
.branches { border-top: 1px dashed var(--line); margin: 0 17px; padding: 12px 0 14px;
            display: flex; flex-direction: column; gap: 10px; }
.branch { border-left: 2px solid #ead9c0; padding-left: 14px; }
/* One row per branch: [key] -> [target step], delete on the right */
.branch-row { display: flex; align-items: flex-start; gap: 10px; }
.branch-target { flex: 1; min-width: 0; }

/* Signature: phone-keypad key (compact) */
.keycap { width: 34px; height: 34px; border-radius: 8px; background: #fff; margin-top: 6px;
          border: 1px solid var(--line); box-shadow: 0 2px 0 #e5e5e5, inset 0 1px 0 #fff;
          display: flex; flex-direction: column; align-items: center; justify-content: center; flex: none; }
.keycap-digit { font-family: var(--mono); font-weight: 600; font-size: 15px; line-height: 1; color: var(--ink); }
.keycap-letters { font-family: var(--mono); font-size: 6px; letter-spacing: .1em; color: var(--muted); margin-top: 1px; }
.branch-arrow { color: var(--muted-2); margin-top: 14px; flex: none; }
.branch-del { margin-top: 12px; background: none; border: none; color: #c3b19a; cursor: pointer;
              font-size: 14px; padding: 2px 7px; border-radius: 5px; flex: none; }
.branch-del:hover { color: #C5221F; background: #FBE9E7; }
.branch-add { align-self: flex-start; background: none; border: 1px dashed var(--line); color: var(--muted);
              border-radius: 9px; padding: 7px 13px; cursor: pointer; font-size: 13px; font-weight: 500; }
.branch-add:hover { border-color: var(--brand); color: var(--brand); }

/* "+" type chooser popover */
.type-menu { position: absolute; z-index: 50; background: var(--surface); border: 1px solid var(--line);
             border-radius: 11px; box-shadow: 0 10px 30px rgba(15,23,34,.16); padding: 6px; min-width: 168px; }
.type-menu-item { display: flex; gap: 10px; align-items: center; padding: 9px 11px; border-radius: 8px;
                  cursor: pointer; font-size: 14px; }
.type-menu-item:hover { background: var(--brand-soft); }
