/* ─── Design Tokens ───────────────────────────────────────────────────────── */
/* Palette aligned with the CloudConsult Telefonie logo CI:
   accent #3a7fd4 (light brand blue), surfaces lean cool/navy to match the
   dark-navy → near-black gradient (#1e3c8a → #07112a) of the logo. */
:root {
    --bg:              #0a0e16;
    --surface:         #10141d;
    --surface-raised:  #161b27;
    --surface-hover:   #1c2230;
    --border:          #252b3a;
    --border-subtle:   #1c2230;
    --border-focus:    #3a7fd4;

    --text:            #e8ebf1;
    --text-muted:      #7d83a0;
    --text-faint:      #4a5070;

    --accent:          #3a7fd4;
    --accent-hover:    #5a9aea;
    --accent-subtle:   rgba(58, 127, 212, 0.10);
    --accent-glow:     rgba(58, 127, 212, 0.22);

    --success:         #4ade80;
    --success-subtle:  rgba(74, 222, 128, 0.08);
    --success-border:  rgba(74, 222, 128, 0.25);

    --danger:          #f87171;
    --danger-subtle:   rgba(248, 113, 113, 0.08);
    --danger-border:   rgba(248, 113, 113, 0.25);

    /* Amber for "pending action" states (e.g. configured but not yet
       authorised). Kept distinct from --accent so the brand-blue accent
       never collides with a warning state. */
    --warning:         #e0a93a;
    --warning-subtle:  rgba(224, 169, 58, 0.10);
    --warning-border:  rgba(224, 169, 58, 0.30);

    --info-subtle:     rgba(99, 145, 210, 0.07);
    --info-border:     rgba(99, 145, 210, 0.25);
    --info-text:       #8ba8d4;

    --radius-sm:       4px;
    --radius:          8px;
    --radius-lg:       12px;

    --shadow-card:     0 1px 3px rgba(0,0,0,0.4), 0 4px 16px rgba(0,0,0,0.25);
    --shadow-focus:    0 0 0 3px var(--accent-glow);

    --font-ui:         'Outfit', system-ui, sans-serif;
    --font-mono:       'JetBrains Mono', 'Fira Code', monospace;

    --transition:      0.15s ease;
}

/* ─── Reset & Base ────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { height: 100%; }

body {
    font-family: var(--font-ui);
    font-size: 14px;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    min-height: 100%;
    -webkit-font-smoothing: antialiased;
}

/* ─── Shell Layout ────────────────────────────────────────────────────────── */
.shell {
    display: grid;
    grid-template-rows: auto 1fr;
    min-height: 100vh;
}

.topbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 28px;
    height: 56px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.topbar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

.topbar-icon {
    width: 30px;
    height: 30px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}

.topbar-icon svg,
.topbar-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.topbar-wordmark {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text);
    letter-spacing: 0.01em;
}

.topbar-wordmark span {
    color: var(--accent);
}

.topbar-divider {
    width: 1px;
    height: 22px;
    background: var(--border);
    margin: 0 4px;
}

.topbar-label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 400;
    letter-spacing: 0.02em;
}

.page-content {
    padding: 36px 28px 64px;
    max-width: 780px;
    margin: 0 auto;
    width: 100%;
}

/* ─── Page Title ──────────────────────────────────────────────────────────── */
.page-title {
    font-size: 22px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
    letter-spacing: -0.01em;
}

.page-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 32px;
}

/* ─── Section Cards ───────────────────────────────────────────────────────── */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    margin-bottom: 20px;
    overflow: hidden;
    transition: border-color var(--transition);
}

.card:focus-within {
    border-color: var(--border-focus);
}

.card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-subtle);
}

.card-header-icon {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    background: var(--accent-subtle);
    border: 1px solid rgba(200, 137, 58, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.card-header-icon svg {
    width: 14px;
    height: 14px;
    stroke: var(--accent);
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.card-title {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text);
    letter-spacing: 0.01em;
}

.card-body {
    padding: 20px;
}

.card-body + .card-body {
    border-top: 1px solid var(--border-subtle);
}

/* ─── Form Controls ───────────────────────────────────────────────────────── */
.field {
    margin-bottom: 16px;
}

.field:last-child { margin-bottom: 0; }

.field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.field label,
.field-label {
    display: block;
    font-size: 11.5px;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.07em;
    margin-bottom: 6px;
}

.field input[type="text"],
.field input[type="password"],
.field input[type="number"],
.field input[type="search"],
input.ctrl,
textarea.ctrl {
    width: 100%;
    padding: 9px 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: var(--font-ui);
    font-size: 13.5px;
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
    appearance: none;
}

.field input[type="text"]:focus,
.field input[type="password"]:focus,
.field input[type="number"]:focus,
.field input[type="search"]:focus,
input.ctrl:focus,
textarea.ctrl:focus {
    border-color: var(--border-focus);
    box-shadow: var(--shadow-focus);
}

.field input::placeholder,
textarea.ctrl::placeholder { color: var(--text-faint); }

/* mono font for secret/technical fields */
.field input[type="password"],
.field input.mono {
    font-family: var(--font-mono);
    font-size: 12.5px;
    letter-spacing: 0.03em;
}

/* ─── Toggle Switch ───────────────────────────────────────────────────────── */
.toggle-label {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    user-select: none;
}

.toggle-label input[type="checkbox"] { display: none; }

.toggle-track {
    position: relative;
    width: 40px;
    height: 22px;
    background: var(--surface-raised);
    border: 1px solid var(--border);
    border-radius: 11px;
    transition: background var(--transition), border-color var(--transition);
    flex-shrink: 0;
}

.toggle-track::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--text-faint);
    top: 2px;
    left: 2px;
    transition: transform var(--transition), background var(--transition);
}

.toggle-label input:checked + .toggle-track {
    background: var(--accent);
    border-color: var(--accent);
}

.toggle-label input:checked + .toggle-track::after {
    background: #fff;
    transform: translateX(18px);
}

.toggle-text {
    font-size: 13.5px;
    color: var(--text);
}

.toggle-text small {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 400;
    margin-top: 1px;
}

/* ─── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 18px;
    border-radius: var(--radius);
    font-family: var(--font-ui);
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background var(--transition), border-color var(--transition),
                box-shadow var(--transition), color var(--transition);
    white-space: nowrap;
    text-decoration: none;
    letter-spacing: 0.01em;
}

.btn svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.btn-primary {
    background: var(--accent);
    color: #0e0e11;
    font-weight: 600;
}
.btn-primary:hover { background: var(--accent-hover); box-shadow: 0 0 0 3px var(--accent-glow); }

.btn-secondary {
    background: transparent;
    color: var(--text);
    border-color: var(--border);
}
.btn-secondary:hover { background: var(--surface-hover); border-color: var(--text-muted); }

.btn-danger-ghost {
    background: transparent;
    color: var(--text-muted);
    border-color: transparent;
    padding: 6px 10px;
}
.btn-danger-ghost:hover { color: var(--danger); background: var(--danger-subtle); }

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border-color: var(--border);
    padding: 7px 14px;
    font-size: 13px;
}
.btn-ghost:hover { color: var(--text); background: var(--surface-hover); }

/* Fixed-layout variable table — keeps Example column visible even when
   variable names wrap to multiple lines. Used in the template-editor's
   "Available variables" disclosure. */
.var-table {
    table-layout: fixed;
}
.var-table td {
    word-break: break-all;
    vertical-align: top;
}
.var-table td code {
    word-break: break-all;
    white-space: normal;
}

/* Text-link styled button: no chrome, just a clickable accent-coloured label. */
.btn-link {
    background: transparent;
    border-color: transparent;
    color: var(--accent);
    padding: 4px 8px;
    font-size: 13px;
    font-weight: 500;
}
.btn-link:hover {
    color: var(--accent-hover);
    background: var(--surface-hover);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12.5px;
}

.btn-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border-subtle);
}

/* ─── Notification Field Rows ─────────────────────────────────────────────── */
.field-rows { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }

.field-row-item {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 8px;
    align-items: center;
    background: var(--bg);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    padding: 8px 10px;
    transition: border-color var(--transition);
}

.field-row-item:focus-within { border-color: var(--border-focus); }

.field-row-item input {
    background: transparent;
    border: none;
    outline: none;
    color: var(--text);
    font-family: var(--font-ui);
    font-size: 13px;
    padding: 2px 4px;
    width: 100%;
}

.field-row-item input::placeholder { color: var(--text-faint); }

.field-col-label {
    font-size: 10.5px;
    font-weight: 500;
    color: var(--text-faint);
    text-transform: uppercase;
    letter-spacing: 0.07em;
    margin-bottom: 3px;
}

/* ─── Discovered Fields / Chip Suggestions ────────────────────────────────── */
.suggestions-section {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--border-subtle);
}

.suggestions-label {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.suggestions-label::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--success);
    animation: pulse-dot 2.5s ease-in-out infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.35; }
}

.chip-list { display: flex; flex-wrap: wrap; gap: 6px; }

.chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    background: var(--surface-raised);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 12px;
    font-family: var(--font-mono);
    color: var(--text-muted);
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition), color var(--transition);
}

.chip:hover {
    background: var(--accent-subtle);
    border-color: var(--accent);
    color: var(--accent);
}

.chip-add-icon {
    width: 12px;
    height: 12px;
    opacity: 0.5;
    flex-shrink: 0;
}

.chip-label {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1px;
}

.chip-example {
    display: block;
    font-family: var(--font-sans);
    font-size: 10px;
    opacity: 0.55;
    font-style: italic;
}

/* ─── Setup Instructions ──────────────────────────────────────────────────── */
.setup-guide {
    background: var(--info-subtle);
    border: 1px solid var(--info-border);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 4px;
}

.setup-guide-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    cursor: pointer;
    font-size: 12.5px;
    color: var(--info-text);
    font-weight: 500;
    list-style: none;
    transition: background var(--transition);
    gap: 8px;
}

.setup-guide-toggle:hover { background: rgba(99, 145, 210, 0.07); }

.setup-guide-toggle::-webkit-details-marker { display: none; }

.setup-guide-chevron {
    width: 14px;
    height: 14px;
    stroke: var(--info-text);
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

details[open] .setup-guide-chevron { transform: rotate(180deg); }

.setup-guide-body {
    padding: 0 16px 16px;
    border-top: 1px solid var(--info-border);
}

.setup-steps { counter-reset: step; list-style: none; }

.setup-steps li {
    counter-increment: step;
    display: flex;
    gap: 14px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border-subtle);
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.65;
}

.setup-steps li:last-child { border-bottom: none; padding-bottom: 0; }

.setup-steps li::before {
    content: counter(step);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    min-width: 22px;
    border-radius: 50%;
    background: var(--accent-subtle);
    border: 1px solid rgba(200, 137, 58, 0.3);
    color: var(--accent);
    font-size: 11px;
    font-weight: 600;
    margin-top: 1px;
}

.setup-steps strong { color: var(--text); font-weight: 600; }

.setup-steps a {
    color: var(--info-text);
    text-decoration: none;
    border-bottom: 1px solid rgba(99, 145, 210, 0.3);
}

.setup-steps a:hover { border-bottom-color: var(--info-text); }

.setup-steps ul {
    list-style: none;
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.setup-steps ul li {
    padding: 0;
    border: none;
    display: flex;
    gap: 8px;
    font-size: 12.5px;
}

.setup-steps ul li::before {
    content: '─';
    width: auto;
    min-width: auto;
    height: auto;
    border: none;
    background: none;
    color: var(--text-faint);
    font-size: 12px;
    border-radius: 0;
}

.setup-note {
    margin-top: 14px;
    font-size: 12.5px;
    color: var(--text-muted);
    line-height: 1.65;
}

.setup-note code {
    font-family: var(--font-mono);
    font-size: 11.5px;
    background: rgba(99, 145, 210, 0.1);
    padding: 1px 5px;
    border-radius: 3px;
    color: var(--info-text);
}

/* ─── Alert / Status Messages ─────────────────────────────────────────────── */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border-radius: var(--radius);
    font-size: 13px;
    line-height: 1.5;
    margin-top: 14px;
    animation: alert-in 0.18s ease;
}

@keyframes alert-in {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.alert svg {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    margin-top: 1px;
}

.alert-success { background: var(--success-subtle); border: 1px solid var(--success-border); color: var(--success); }
.alert-error   { background: var(--danger-subtle);  border: 1px solid var(--danger-border);  color: var(--danger); }
.alert-info    { background: var(--info-subtle);     border: 1px solid var(--info-border);    color: var(--info-text); }

/* ─── Login / Setup Page ──────────────────────────────────────────────────── */
.auth-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: var(--bg);
}

.auth-card {
    width: 100%;
    max-width: 380px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    overflow: hidden;
}

.auth-card-header {
    padding: 28px 28px 24px;
    border-bottom: 1px solid var(--border-subtle);
    text-align: center;
}

.auth-logo {
    width: 64px;
    height: 64px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    overflow: hidden;
}

.auth-logo svg,
.auth-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.auth-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 4px;
}

.auth-sub {
    font-size: 13px;
    color: var(--text-muted);
}

.auth-body {
    padding: 24px 28px 28px;
}

.auth-body .field { margin-bottom: 14px; }

.auth-body .btn { width: 100%; justify-content: center; margin-top: 8px; }

/* ─── Inline code ─────────────────────────────────────────────────────────── */
code {
    font-family: var(--font-mono);
    font-size: 12px;
    background: var(--surface-raised);
    padding: 1px 5px;
    border-radius: 3px;
    color: var(--accent);
}

/* ─── Scrollbar ───────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-faint); }

/* ─── Utility ─────────────────────────────────────────────────────────────── */
.mt-2 { margin-top: 8px; }
.mono { font-family: var(--font-mono); font-size: 12.5px; }
.hint { font-size: 12px; color: var(--text-faint); margin: 0 0 12px; line-height: 1.5; }

/* ─── CopyableSecret Component ────────────────────────────────────────────── */
.copyable-secret {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.copyable-secret .secret-mask {
    font-family: var(--font-mono);
    background: var(--surface-raised);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
}

.copyable-secret .btn-copy {
    background: transparent;
    border: 1px solid var(--border);
    padding: 6px 10px;
    cursor: pointer;
    font-size: 12px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-family: var(--font-ui);
    transition: background var(--transition), border-color var(--transition), color var(--transition);
}

.copyable-secret .btn-copy:hover {
    background: var(--surface-hover);
    border-color: var(--text-muted);
    color: var(--text);
}

/* Tables */
.table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
}
.table th, .table td {
    padding: 0.6rem 0.8rem;
    text-align: left;
    border-bottom: 1px solid var(--border, rgba(255, 255, 255, 0.08));
}
.table th {
    font-weight: 600;
    color: var(--text-faint, #888);
    border-bottom-width: 2px;
}
.table tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.03);
}
.table td:last-child {
    text-align: right;
    white-space: nowrap;
}

/* ─── Notification Template Editor ───────────────────────────────────────── */

.tpl-label-hint {
    font-size: 0.78em;
    font-weight: 400;
    margin-left: 6px;
    text-transform: lowercase;
    letter-spacing: 0.02em;
}

.tpl-title-input {
    font-size: 1.05em;
    font-weight: 500;
}

.tpl-body-input {
    font-family: var(--font-mono, "SF Mono", Menlo, Consolas, monospace);
    font-size: 0.92em;
    line-height: 1.45;
    resize: vertical;
}

.tpl-preview {
    margin-top: 14px;
    padding: 14px 16px;
    background: var(--surface-raised, rgba(255, 255, 255, 0.03));
    border-left: 3px solid var(--accent);
    border-radius: var(--radius);
}

.tpl-preview-label {
    font-size: 0.72em;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.tpl-preview-title {
    font-size: 1.1em;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 4px;
}

.tpl-preview-body {
    font-size: 0.9em;
    color: var(--text-muted);
    white-space: pre-wrap;
    word-break: break-word;
}

/* Variable picker — collapsible chip-cloud below the inputs/preview */
.tpl-vars-drawer {
    margin-top: 16px;
    background: var(--surface-raised);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    overflow: hidden;
    transition: border-color var(--transition);
}
.tpl-vars-drawer[open] { border-color: var(--border); }

.tpl-vars-drawer > summary {
    list-style: none;
    cursor: pointer;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    user-select: none;
    transition: background var(--transition);
}
.tpl-vars-drawer > summary::-webkit-details-marker { display: none; }
.tpl-vars-drawer > summary:hover { background: var(--surface-hover); }
.tpl-vars-drawer > summary::before {
    content: "";
    width: 7px;
    height: 7px;
    border-right: 2px solid var(--text-muted);
    border-bottom: 2px solid var(--text-muted);
    transform: rotate(-45deg);
    transition: transform var(--transition);
    flex-shrink: 0;
}
.tpl-vars-drawer[open] > summary::before { transform: rotate(45deg); }

.tpl-vars-drawer-title {
    font-size: 0.9em;
    font-weight: 600;
    color: var(--text);
}
.tpl-vars-drawer-count {
    font-size: 0.78em;
    margin-left: auto;
}

.tpl-vars-drawer-body {
    padding: 12px 16px 16px 16px;
    border-top: 1px solid var(--border-subtle);
}

.tpl-vars-filter {
    margin-bottom: 12px;
}
.tpl-vars-filter input {
    width: 100%;
    max-width: 320px;
    font-size: 0.9em;
    padding: 7px 11px;
}

.tpl-vars-group { margin-bottom: 14px; }
.tpl-vars-group:last-child { margin-bottom: 0; }

.tpl-vars-group-label {
    font-size: 0.7em;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 8px;
}
.tpl-vars-group-label .muted { text-transform: none; letter-spacing: 0; }

.tpl-vars-empty {
    font-size: 0.85em;
    margin-top: 4px;
}

/* Chip cloud: chips wrap, sized to their content */
.tpl-vars-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tpl-var-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    max-width: 360px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    font: inherit;
    line-height: 1.4;
    transition: background var(--transition), border-color var(--transition), color var(--transition);
}
.tpl-var-chip:hover {
    background: var(--accent-subtle);
    border-color: var(--accent);
}
.tpl-var-chip:active { transform: translateY(1px); }

.tpl-var-chip code {
    font-size: 0.82em;
    color: var(--accent);
    background: transparent;
    padding: 0;
    border: none;
    flex-shrink: 0;
}

.tpl-var-chip-sep {
    color: var(--text-faint);
    font-size: 0.78em;
    flex-shrink: 0;
}

.tpl-var-chip-example {
    font-size: 0.8em;
    color: var(--text-muted);
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

/* Visual hint for chips with no example value yet — slightly dimmer */
.tpl-var-chip-noex { opacity: 0.78; }
.tpl-var-chip-noex:hover { opacity: 1; }

.tpl-copy-toast {
    position: sticky;
    bottom: 0;
    margin-top: 12px;
    padding: 8px 12px;
    background: var(--accent-subtle, rgba(82, 130, 220, 0.15));
    border: 1px solid var(--accent);
    color: var(--accent);
    border-radius: var(--radius-sm);
    font-size: 0.8em;
    text-align: center;
}

/* ----------------------------------------------------------
   Setup tutorials  (<details class="setup-guide">)
   ---------------------------------------------------------- */

.setup-guide {
    background: var(--surface-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 18px;
    overflow: hidden;
    transition: border-color var(--transition);
}
.setup-guide[open] {
    border-color: var(--border-focus);
}

.setup-guide > summary {
    list-style: none;
    cursor: pointer;
    padding: 12px 16px;
    font-weight: 600;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 10px;
    user-select: none;
    transition: background var(--transition);
}
.setup-guide > summary::-webkit-details-marker { display: none; }
.setup-guide > summary:hover { background: var(--surface-hover); }

/* Chevron — rotates when expanded */
.setup-guide > summary::before {
    content: "";
    width: 8px;
    height: 8px;
    border-right: 2px solid var(--accent);
    border-bottom: 2px solid var(--accent);
    transform: rotate(-45deg);
    transition: transform var(--transition);
    flex-shrink: 0;
    margin-left: 2px;
}
.setup-guide[open] > summary::before {
    transform: rotate(45deg);
}

.setup-guide-body {
    padding: 4px 20px 18px 20px;
    border-top: 1px solid var(--border-subtle);
    color: var(--text);
}

/* Numbered steps with circular counters */
.setup-guide-body ol {
    list-style: none;
    counter-reset: step;
    padding: 0;
    margin: 14px 0 0 0;
}
.setup-guide-body ol > li {
    counter-increment: step;
    position: relative;
    padding: 4px 0 14px 44px;
    min-height: 32px;
    line-height: 1.55;
}
.setup-guide-body ol > li::before {
    content: counter(step);
    position: absolute;
    left: 0;
    top: 0;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--accent-subtle);
    border: 1px solid var(--accent);
    color: var(--accent);
    font-weight: 600;
    font-size: 0.85em;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.setup-guide-body ol > li:last-child { padding-bottom: 4px; }

/* Nested bullet list inside a step */
.setup-guide-body ol > li ul {
    margin: 8px 0 0 0;
    padding-left: 18px;
    list-style: disc;
    color: var(--text-muted);
}
.setup-guide-body ol > li ul li {
    padding: 2px 0;
    line-height: 1.5;
}
.setup-guide-body ol > li ul li strong { color: var(--text); }

.setup-guide-body code {
    background: var(--surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 1px 6px;
    font-size: 0.88em;
    color: var(--accent);
}

/* Callout for the "Hinweis" boxes */
.setup-note {
    margin-top: 14px;
    padding: 10px 14px;
    background: var(--accent-subtle);
    border-left: 3px solid var(--accent);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.92em;
    line-height: 1.5;
}
.setup-note strong { color: var(--accent); }
