/* LineOne Onboarding Tool — shared.css v0.5.1 */
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: #f4f6f8;
    color: #222;
}

.app {
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.header {
    height: 48px;
    flex-shrink: 0;
    background: #37424f;
    color: #fff;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 0 16px;
    gap: 12px;
    border-bottom: 3px solid #17bbb6;
    position: sticky;
    top: 0;
    z-index: 100;
}
.header-center {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.logo {
    height: 36px;
    width: auto;
    display: block;
}

.header-title-wrap {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    line-height: 1;
}

.header-title {
    font-size: 15px;
    font-weight: 700;
}

.header-subtitle {
    font-size: 11px;
    opacity: 0.7;
}

.layout {
    display: flex;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

.sidebar {
    width: 220px;
    background: #2f3944;
    color: #fff;
    padding: 10px 0;
    flex-shrink: 0;
    overflow: hidden;
    height: 100%;
    transition: width 0.2s ease;
    display: flex;
    flex-direction: column;
}

.sidebar-logo {
    padding: 20px 16px 14px;
    border-bottom: 1px solid rgba(255,255,255,.08);
    flex-shrink: 0;
}

.sidebar-logo img {
    width: 100%;
    height: auto;
    display: block;
}

.sidebar-collapsed .sidebar-logo {
    display: none;
}

.nav-items {
    flex: 1;
    overflow-y: auto;
}

.nav-footer {
    border-top: 1px solid rgba(255,255,255,.08);
    padding: 6px 0;
}

.sidebar.sidebar-collapsed {
    width: 52px;
}

.sidebar a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    transition: background 0.15s ease, color 0.15s ease;
    border-left: 3px solid transparent;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar a:hover {
    background: rgba(23, 187, 182, 0.15);
    color: #fff;
}

.sidebar a.active {
    background: rgba(23, 187, 182, 0.2);
    border-left-color: #17bbb6;
    color: #fff;
    font-weight: 700;
}

/* Dim engagement-required nav links when no engagement is active.
   The hard redirect in initPage() is the real enforcement —
   this is purely a visual hint. */
.sidebar.no-engagement a[data-requires-engagement] {
    opacity: 0.35;
    pointer-events: none;
    cursor: not-allowed;
}

.nav-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    width: 20px;
}

.nav-icon svg {
    width: 18px;
    height: 18px;
}

.nav-label {
    font-size: 13px;
    transition: opacity 0.15s ease;
    overflow: hidden;
}

.sidebar-collapsed .nav-label {
    opacity: 0;
    width: 0;
}

.sidebar-collapsed a {
    justify-content: center;
    padding: 10px 0;
    border-left-color: transparent;
}

.sidebar-collapsed a.active {
    border-left-color: #17bbb6;
    padding-left: 14px;
    padding-right: 14px;
    justify-content: flex-start;
}

.main {
    flex: 1;
    padding: 24px;
    overflow-y: scroll;
    scrollbar-gutter: stable;
    height: 100%;
}

.page-title-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.page-title {
    margin: 0;
    font-size: 20px;
    color: #37424f;
}

.page-meta {
    font-size: 12px;
    color: #5d6875;
}

.selector-bar {
    display: grid;
    grid-template-columns: repeat(3, minmax(180px, 1fr));
    gap: 14px;
    background: #fff;
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.card {
    background: #fff;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.card h3 {
    margin: 0 0 16px;
    color: #37424f;
    font-size: 20px;
}

.card h4 {
    margin: 22px 0 12px;
    color: #37424f;
    font-size: 15px;
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(240px, 1fr));
    gap: 14px 18px;
}

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

.input-row {
    margin-bottom: 14px;
}

label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
    color: #37424f;
}

input,
textarea,
select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #cfd6dd;
    border-radius: 7px;
    font-size: 14px;
    background: #fff;
}

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

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: #17bbb6;
    box-shadow: 0 0 0 3px rgba(23, 187, 182, 0.12);
}


.warning {
    background: #fff1f1;
    border-left: 5px solid #d62828;
    padding: 12px 14px;
    border-radius: 6px;
    margin-bottom: 16px;
    color: #8a1c1c;
    font-size: 13px;
    line-height: 1.4;
}

.info-note {
    background: #eef8f8;
    border-left: 5px solid #17bbb6;
    padding: 12px 14px;
    border-radius: 6px;
    margin-bottom: 16px;
    color: #37424f;
    font-size: 13px;
    line-height: 1.4;
}

.accent {
    color: #17bbb6;
    font-weight: 700;
}

.text-danger {
    color: #c62828;
    font-weight: 700;
}

.text-linkish {
    color: #1b57c8;
    text-decoration: underline;
}

.button-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 16px;
}

.btn {
    border: 0;
    border-radius: 8px;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
}

.btn-primary {
    background: #17bbb6;
    color: #fff;
}

.btn-secondary {
    background: #37424f;
    color: #fff;
}

.btn-accent {
    background: #fdc33b;
    color: #37424f;
}

@media (max-width: 1100px) {
    .grid-3,
    .selector-bar {
        grid-template-columns: repeat(2, minmax(180px, 1fr));
    }
}

@media (max-width: 840px) {
    /* On mobile, revert fixed-height layout so the page scrolls naturally.
       iOS Safari in particular has unreliable 100vh behaviour. */
    .app {
        height: auto;
        overflow: visible;
    }

    .layout {
        flex-direction: column;
        overflow: visible;
        height: auto;
    }

    .sidebar {
        width: 100%;
        height: auto;
        overflow-y: visible;
        padding: 10px 0;
    }

    .main {
        height: auto;
        overflow-y: visible;
        padding: 16px;
    }

    .grid-2,
    .grid-3,
    .selector-bar {
        grid-template-columns: 1fr;
    }
}

.task-row {
    display: grid;
    grid-template-columns: 40px 1fr 160px;
    align-items: center;
    padding: 10px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
}

.task-row:hover {
    background: #f9f9f9;
}

.task-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-pill {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
}

.status-not-started { background: #eee; }
.status-in-progress { background: #FDC33B; color: #000; }
.status-complete { background: #17bbb6; color: #fff; }

.status-label {
    font-size: 12px;
    opacity: 0.7;
}

.input-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #cfd6dd;
    border-radius: 7px;
    font-size: 14px;
    background: #fff;
}


/* ── Utility additions ──────────────────────────────────────── */

/* Ghost button — used by MACs page */
.btn-ghost {
    background: transparent;
    color: #5d6875;
    border: 1px solid #cfd6dd;
    border-radius: 8px;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}
.btn-ghost:hover { background: #f4f6f8; border-color: #b0b8c1; }

/* Small button variant */
.btn-small {
    padding: 5px 10px;
    font-size: 12px;
    border-radius: 6px;
}

/* Data table — used by MACs page */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.data-table th {
    text-align: left;
    padding: 8px 10px;
    font-size: 11px;
    font-weight: 700;
    color: #5d6875;
    text-transform: uppercase;
    letter-spacing: .04em;
    border-bottom: 2px solid #e0e5ea;
    white-space: nowrap;
}
.data-table td {
    padding: 6px 6px;
    border-bottom: 1px solid #f0f3f5;
    vertical-align: middle;
}
.data-table td input,
.data-table td select {
    padding: 6px 8px;
    font-size: 12px;
}
.data-table tbody tr:hover td { background: #f9fbfc; }

/* Input small — initials fields */
.input-small {
    width: 52px;
    padding: 5px 6px;
    font-size: 12px;
    font-weight: 700;
    text-align: center;
    text-transform: uppercase;
    border: 1px solid #cfd6dd;
    border-radius: 5px;
}

/* Save indicator injected into header */
#api-save-indicator {
    font-size: 11px;
    color: rgba(255,255,255,0.7);
    font-style: italic;
    white-space: nowrap;
}

/* Header right — user switcher area */
.header-right {
    display: flex;
    align-items: center;
    gap: 14px;
    justify-content: flex-end;
}

/* ── Welcome Call / Programming / Installation nav improvements ── */
/* Smooth hover on nav items */
[id^="wc-nav-"]:hover,
[id^="inst-ring-"]:hover {
    background: #f4fbfb;
}

/* =============================================================
   aa.css — Auto Attendant page styles
   Link this file only in aa.html:
       <link rel="stylesheet" href="css/aa.css">

   Hardcoded colour values (replaces JS interpolation):
     AA_COMMENT.bg     = #fffbea
     AA_COMMENT.border = #f5c842
     AA_COMMENT.label  = #b07d00
     AA_COMMENT.text   = #5a4000

   NOTE: Comment textarea uses plain red text (no font-weight:700).
   Do not add font-weight:bold to .fld.comments textarea or
   .aa-pop-textarea.comment — it was removed intentionally.
============================================================= */

/* ── Tabs ─────────────────────────────────────────────────── */
.aa-cf-tab-bar {
    display: flex;
    overflow-x: auto;
    background: #fff;
    border-bottom: 2px solid #17bbb6;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.aa-cf-tab {
    padding: 9px 18px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    color: #5d6875;
    border: none;
    background: none;
    border-bottom: 6px solid transparent;
    margin-bottom: -2px;
    white-space: nowrap;
}
.aa-cf-tab.active {
    color: #17bbb6;
    border-bottom-color: #17bbb6;
}
.aa-cf-tab:hover:not(.active) {
    background: #f4f6f8;
    color: #37424f;
}
.aa-cf-tab-add {
    padding: 9px 14px;
    background: none;
    border: none;
    cursor: pointer;
    color: #17bbb6;
    font-size: 22px;
    line-height: 1;
}

/* ── AA meta grid ─────────────────────────────────────────── */
.aa-cf-meta {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}

/* ── Tier blocks ──────────────────────────────────────────── */
.aa-tier-block {
    width: 100%;
    background: #fff;
    border: 1px solid #e0e5ea;
    border-radius: 10px;
    position: relative;
    box-sizing: border-box;
    overflow: visible;
}
.aa-tier-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-bottom: 1px solid #e0e5ea;
}
.aa-tier-label-input {
    font-size: 13px;
    font-weight: 700;
    color: #37424f;
    border: none;
    background: transparent;
    outline: none;
    flex: 1;
    font-family: Arial, sans-serif;
}

/* ── Child tier connector classes (used by inline styles too) */
.aa-child-connector        { display: flex; align-items: center; gap: 0; margin: 0 0 0 60px; padding: 0; }
.aa-child-connector-vert   { width: 2px; height: 20px; margin-left: 30px; }
.aa-child-connector-horiz  { display: flex; align-items: center; gap: 6px; padding: 0 0 8px 30px; }
.aa-child-connector-line-v { width: 2px; height: 20px; }
.aa-child-connector-line-h { height: 2px; width: 24px; }
.aa-child-connector-label  { font-size: 11px; font-weight: 700; padding: 2px 10px; border-radius: 12px; color: #fff; white-space: nowrap; }

/* ── Tier meta — 70/30 split ──────────────────────────────── */
.aa-tier-smeta {
    display: grid;
    grid-template-columns: 7fr 3fr;
    gap: 10px;
    padding: 12px 14px;
    border-bottom: 1px solid #e0e5ea;
    align-items: start;
}
.aa-tier-smeta .fld label {
    font-size: 11px;
    font-weight: 700;
    display: block;
    margin-bottom: 3px;
}
.aa-tier-smeta .fld.script label   { color: #37424f; }
.aa-tier-smeta .fld.comments label { color: #b07d00; }
.aa-tier-smeta .fld textarea {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid #cfd6dd;
    border-radius: 6px;
    font-size: 12px;
    background: #fff;
    font-family: Arial, sans-serif;
    box-sizing: border-box;
    resize: vertical;
    min-height: 90px;
}
/* Comments textarea — amber bg, red text, no font-weight */
.aa-tier-smeta .fld.comments textarea {
    background: #fffbea;
    border-color: #f5c842;
    color: #c62828;
}
.aa-tier-smeta .fld.comments textarea::placeholder { color: #e8a0a0; }

/* ── Flow area ────────────────────────────────────────────── */
.aa-flow-area {
    padding: 20px 14px 40px;
    overflow: visible;
    position: relative;
}

/* ── Keys row ─────────────────────────────────────────────── */
.aa-keys-outer {
    display: flex;
    justify-content: center;
    overflow: visible;
    margin-bottom: 0;
}
.aa-keys-inner {
    display: inline-flex;
    gap: 0;
    overflow: visible;
    position: relative;
}
.aa-key-slot {
    flex: 0 0 90px;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    overflow: visible;
}
.aa-key-slot.wide { flex: 0 0 120px; }

.aa-key-btn {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    border: 2px solid #cfd6dd;
    background: #fff;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    color: #5d6875;
    transition: all .15s;
    flex-shrink: 0;
}
.aa-key-btn.wide      { border-radius: 14px; width: 100px; font-size: 12px; }
.aa-key-btn.cfg       { border-color: #17bbb6; background: #eef8f8; color: #17bbb6; }
.aa-key-btn.has-child { border-color: #2f5f8a; background: #e8f0f8; color: #2f5f8a; }
.aa-key-btn.open      { border-color: #fdc33b; background: #fffbf0; color: #37424f; box-shadow: 0 0 0 3px rgba(253,195,59,.22); }
.aa-key-btn:hover:not(.cfg):not(.open):not(.has-child) { border-color: #aaa; color: #37424f; }

/* ── Popover ──────────────────────────────────────────────── */
.aa-pop-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    position: relative;
}
.aa-popover {
    position: absolute;
    top: 66px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 400;
    background: #fff;
    border: 1.5px solid #17bbb6;
    border-radius: 10px;
    padding: 13px;
    width: 260px;
    box-shadow: 0 6px 24px rgba(0,0,0,.15);
}
.aa-pop-arrow {
    position: absolute;
    top: -9px;
    left: 50%;
    transform: translateX(-50%);
    width: 0; height: 0;
    border-left: 7px solid transparent;
    border-right: 7px solid transparent;
    border-bottom: 9px solid #17bbb6;
}
.aa-pop-title   { font-size: 12px; font-weight: 700; color: #37424f; margin-bottom: 8px; }
.aa-pop-section { font-size: 11px; font-weight: 700; color: #37424f; margin: 7px 0 3px; }
.aa-pop-section.comment-lbl { color: #b07d00; }

.aa-dest-pills { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 4px; }
.aa-dest-pill {
    padding: 4px 9px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    border: 1px solid #cfd6dd;
    background: #fff;
    cursor: pointer;
    color: #5d6875;
}
.aa-dest-pill.sel { background: #17bbb6; color: #fff; border-color: #17bbb6; }

.aa-pop-input {
    width: 100%;
    padding: 6px 9px;
    border: 1px solid #cfd6dd;
    border-radius: 6px;
    font-size: 12px;
    margin-top: 2px;
    font-family: Arial, sans-serif;
    box-sizing: border-box;
}
.aa-pop-textarea {
    width: 100%;
    padding: 6px 9px;
    border: 1px solid #cfd6dd;
    border-radius: 6px;
    font-size: 12px;
    margin-top: 2px;
    font-family: Arial, sans-serif;
    box-sizing: border-box;
    min-height: 60px;
    resize: vertical;
}
/* Popover comment textarea — amber bg, red text, no font-weight */
.aa-pop-textarea.comment {
    background: #fffbea;
    border-color: #f5c842;
    color: #c62828;
}
.aa-pop-textarea.comment::placeholder { color: #e8a0a0; }

.aa-pop-actions { display: flex; gap: 6px; margin-top: 9px; }
.aa-pop-btn     { flex: 1; padding: 7px; border-radius: 6px; font-size: 12px; font-weight: 700; border: none; cursor: pointer; }
.aa-pop-btn.ok  { background: #17bbb6; color: #fff; }
.aa-pop-btn.cl  { background: #f4f6f8; color: #37424f; }

/* ── Destination cards row ────────────────────────────────── */
.aa-dest-outer { display: flex; justify-content: center; margin-top: 10px; }
.aa-dest-inner { display: inline-flex; gap: 0; }

.aa-dest-slot       { flex: 0 0 90px; display: flex; flex-direction: column; align-items: center; }
.aa-dest-slot.wide  { flex: 0 0 120px; }
.aa-dest-slot.empty { flex: 0 0 90px; visibility: hidden; }
.aa-dest-slot.empty.wide { flex: 0 0 120px; }

.aa-arrow-shaft { width: 2px; height: 16px; }
.aa-arrow-head  { width: 0; height: 0; border-left: 5px solid transparent; border-right: 5px solid transparent; }

.aa-dest-card {
    background: #fff;
    border-radius: 8px;
    width: 90px;
    overflow: hidden;
    cursor: pointer;
    transition: box-shadow .15s;
}
.aa-dest-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,.12); }
.aa-dest-card.wide  { width: 122px; }

.aa-dest-card-head {
    padding: 4px 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.aa-dest-card-key { font-size: 12px; font-weight: 700; }
.aa-dest-card-rm  { background: none; border: none; cursor: pointer; color: #c62828; font-size: 14px; line-height: 1; padding: 0; }

.aa-dest-card-body {
    padding: 5px 8px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    border-top: 1px solid #e0e5ea;
}
.aa-dest-lbl { font-size: 10px; font-weight: 700; color: #5d6875; text-transform: uppercase; letter-spacing: .04em; }
.aa-dest-val { font-size: 12px; color: #37424f; word-break: break-all; line-height: 1.3; }

.aa-dest-pills-row { display: flex; flex-wrap: wrap; gap: 3px; padding: 4px 7px; border-top: 1px solid #e0e5ea; }
.aa-status-pill         { font-size: 9px; font-weight: 700; padding: 2px 6px; border-radius: 10px; white-space: nowrap; }
.aa-status-pill.script  { background: #eef8f8; color: #17bbb6;  border: 1px solid #b5e8e7; }
.aa-status-pill.comment { background: #fffbea; color: #b07d00;  border: 1px solid #f5c842; }
.aa-status-pill.subtier { background: #e8f0f8; color: #2f5f8a;  border: 1px solid #b0c8e0; }

.aa-edit-hint { font-size: 9px; color: #aaa; text-align: center; padding: 2px 0 4px; }

/* ── Tier utility buttons ─────────────────────────────────── */
.tier-btn { background: #fff; border: 1px solid #cfd6dd; border-radius: 6px; padding: 4px 10px; font-size: 12px; cursor: pointer; color: #37424f; }
.tier-btn:hover         { border-color: #17bbb6; color: #17bbb6; }
.tier-btn.danger        { color: #c62828; border-color: #f5c0c0; }
.tier-btn.danger:hover  { background: #fff1f1; }

.aa-no-keys-hint { font-size: 12px; color: #b0b8c1; font-style: italic; padding: 10px 0; text-align: center; }

/* ── Installation page — responsive layout ────────────────── */
.inst-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 16px;
    align-items: start;
}
.inst-nav-wrap   { position: sticky; top: 16px; }
.inst-nav-scroll { max-height: calc(100vh - 300px); overflow-y: auto; }
.inst-mobile-bar { display: none; }

.inst-picker-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: flex-end;
}
.inst-picker-sheet {
    background: #fff;
    border-radius: 16px 16px 0 0;
    width: 100%;
    max-height: 75vh;
    display: flex;
    flex-direction: column;
    padding-bottom: env(safe-area-inset-bottom, 12px);
}
.inst-picker-list {
    overflow-y: auto;
    flex: 1;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 840px) {
    .inst-layout     { grid-template-columns: 1fr; }
    .inst-nav-wrap   { display: none; }
    .inst-mobile-bar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        background: #fff;
        border: 1px solid #e0e5ea;
        border-radius: 10px;
        padding: 12px 14px;
        margin-bottom: 12px;
        gap: 12px;
    }
}