/* ===========================================================================
   Habibi TTS - design system
   ---------------------------------------------------------------------------
   One neutral scale + one accent. No gradients, no glows, no second accent.
   Colour is reserved for two jobs: the primary action, and money/credit values.
   Everything else is neutral and separated by space, weight and hairlines.

   Tailwind handles LAYOUT (flex/grid/spacing) in the templates.
   This file handles LOOK (colour, borders, states) via component classes,
   so a template never hardcodes a palette.
   =========================================================================== */

:root {
    color-scheme: dark;

    /* Neutral ramp - true grey, not blue-grey */
    --c-canvas: 10 10 11;
    --c-surface: 24 24 27;
    --c-sunken: 16 16 18;
    --c-line: 39 39 42;
    --c-line-strong: 63 63 70;

    --c-ink: 250 250 250;
    --c-ink-2: 161 161 170;
    /* 4.85:1 on the surface behind it. The previous #71717a measured
       3.67:1, which 13px muted text and 11px labels do not clear. The
       light theme's own #71717a sits on white and passes at 4.65:1. */
    --c-ink-3: 133 133 143;

    /* The single accent */
    --c-accent: 16 185 129;
    --c-accent-soft: 6 78 59;
    --c-accent-text: 16 185 129;  /* small accent text; the accent itself is light enough here */
    --c-on-accent: 9 9 11;

    --c-danger: 244 63 94;
    --c-warn: 234 179 8;
    --c-on-warn: 9 9 11;

    --radius: 10px;
    --radius-lg: 14px;
}

/* Dark is the product's default look, not a system-following preference.
   Light stays available, but only when the viewer asks for it via the toggle. */
:root[data-theme="light"] {
    color-scheme: light;
    --c-canvas: 250 250 250;
    --c-surface: 255 255 255;
    --c-sunken: 244 244 245;
    --c-line: 228 228 231;
    --c-line-strong: 212 212 216;
    --c-ink: 24 24 27;
    --c-ink-2: 82 82 91;
    --c-ink-3: 113 113 122;
    --c-accent: 5 150 105;
    --c-accent-soft: 209 250 229;
    --c-accent-text: 4 112 81;  /* small accent text on a tint: 4.9:1 where the accent gives 3.1:1 */
    --c-on-accent: 255 255 255;
    --c-danger: 225 29 72;
    --c-warn: 161 98 7;
    --c-on-warn: 255 255 255;
}

/* --------------------------------------------------------------------------
   Base
   -------------------------------------------------------------------------- */

html,
body {
    background: rgb(var(--c-canvas));
    color: rgb(var(--c-ink));
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

[dir="rtl"] body,
html[dir="rtl"],
body.font-ar,
:lang(ar) {
    font-family: 'Cairo', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

::selection {
    background: rgb(var(--c-accent) / 0.25);
    color: rgb(var(--c-ink));
}

:focus-visible {
    outline: 2px solid rgb(var(--c-accent));
    outline-offset: 2px;
}

.ar {
    font-family: "Cairo", system-ui, sans-serif;
}

.mono {
    font-family: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, monospace;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.01em;
}

/* --------------------------------------------------------------------------
   Typography helpers
   -------------------------------------------------------------------------- */

.t-title {
    font-size: 1.5rem;
    line-height: 1.25;
    font-weight: 650;
    letter-spacing: -0.02em;
    color: rgb(var(--c-ink));
}

.t-section {
    font-size: 0.8125rem;
    font-weight: 600;
    color: rgb(var(--c-ink));
}

.t-body {
    font-size: 0.875rem;
    color: rgb(var(--c-ink-2));
    line-height: 1.6;
}

.t-muted {
    font-size: 0.8125rem;
    color: rgb(var(--c-ink-3));
}

.t-label {
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: rgb(var(--c-ink-3));
}

.t-accent {
    color: rgb(var(--c-accent));
}

/* A link inside a paragraph must not be distinguishable by colour alone.
   Standalone accent links - buttons, nav, list rows - carry their own
   shape and are left as they are. */
p a.t-accent,
.t-body a.t-accent,
.t-muted a.t-accent {
    text-decoration: underline;
    text-underline-offset: 0.2em;
}

.t-danger {
    color: rgb(var(--c-danger));
}

/* --------------------------------------------------------------------------
   Surfaces
   -------------------------------------------------------------------------- */

.card {
    background: rgb(var(--c-surface));
    border: 1px solid rgb(var(--c-line));
    border-radius: var(--radius-lg);
}

.card-pad {
    padding: 1.25rem;
}

.sunken {
    background: rgb(var(--c-sunken));
    border: 1px solid rgb(var(--c-line));
    border-radius: var(--radius);
}

.divide-line > * + * {
    border-top: 1px solid rgb(var(--c-line));
}

.hr {
    height: 1px;
    background: rgb(var(--c-line));
    border: 0;
}

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

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5625rem 0.9375rem;
    border-radius: var(--radius);
    border: 1px solid transparent;
    font-size: 0.8125rem;
    font-weight: 550;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.15s, border-color 0.15s, color 0.15s, opacity 0.15s;
    white-space: nowrap;
    text-decoration: none;
}

.btn:disabled,
.btn[disabled] {
    opacity: 0.45;
    cursor: not-allowed;
}

.btn-primary {
    background: rgb(var(--c-accent));
    color: rgb(var(--c-on-accent));
}

.btn-primary:hover:not(:disabled) {
    background: rgb(var(--c-accent) / 0.88);
}

.btn-secondary {
    background: rgb(var(--c-sunken));
    color: rgb(var(--c-ink));
    border-color: rgb(var(--c-line));
}

.btn-secondary:hover:not(:disabled) {
    border-color: rgb(var(--c-line-strong));
}

.btn-ghost {
    background: transparent;
    color: rgb(var(--c-ink-2));
}

.btn-ghost:hover:not(:disabled) {
    background: rgb(var(--c-sunken));
    color: rgb(var(--c-ink));
}

.btn-danger {
    background: transparent;
    color: rgb(var(--c-danger));
    border-color: rgb(var(--c-danger) / 0.35);
}

.btn-danger:hover:not(:disabled) {
    background: rgb(var(--c-danger) / 0.1);
}

/* The recharge call-to-action. Outlined rather than filled so it never competes
   with the page's real primary action. */
.btn-topup {
    background: transparent;
    color: rgb(var(--c-warn));
    border-color: rgb(var(--c-warn) / 0.45);
}

.btn-topup:hover:not(:disabled) {
    background: rgb(var(--c-warn) / 0.1);
    border-color: rgb(var(--c-warn) / 0.7);
}

.btn-lg {
    padding: 0.75rem 1.25rem;
    font-size: 0.875rem;
}

.btn-xl {
    padding: 0.9375rem 1.5rem;
    font-size: 0.9375rem;
    font-weight: 600;
    border-radius: var(--radius-lg);
}

.btn-sm {
    padding: 0.375rem 0.625rem;
    font-size: 0.75rem;
}

.btn-block {
    width: 100%;
}

/* --------------------------------------------------------------------------
   Ways to pay
   --------------------------------------------------------------------------
   One colour per way, shared by its tile in "How do you want to pay?" and by
   the button that starts it on every pack, so a buyer learns it once:
   green is Edahabia/CIB (the accent: instant), blue is PayPal (PayPal's own
   blue, one of the button colours PayPal's brand rules allow), amber is a
   transfer (the warn colour of the header's Top up and of the "checked within
   a few hours" badge). Each way sets its colour once, as variables:
     --way       the solid colour (tile border when chosen, icon, radio, button)
     --on-way    text and icons on that solid colour
     --way-text  the way's name as text on the page background */

.pay-way-card,
.btn-pay-card {
    --way: var(--c-accent);
    --on-way: var(--c-on-accent);
    --way-text: var(--c-accent);
}

.pay-way-paypal,
.btn-pay-paypal {
    /* #0070ba. White on it is 5.2:1. As text on the dark surface it is only
       3.4:1, so the name there takes PayPal's lighter blue (#33b0e6). */
    --way: 0 112 186;
    --on-way: 255 255 255;
    --way-text: 51 176 230;
}

:root[data-theme="light"] .pay-way-paypal {
    --way-text: 0 112 186;
}

.pay-way-transfer,
.btn-pay-transfer {
    --way: var(--c-warn);
    --on-way: var(--c-on-warn);
    --way-text: var(--c-warn);
}

/* The two steps: "1. How do you want to pay?" then "2. Choose a pack". */
.pricing-step {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.9375rem;
    font-weight: 600;
    color: rgb(var(--c-ink));
}

.pricing-step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 999px;
    border: 1px solid rgb(var(--c-line-strong));
    background: rgb(var(--c-sunken));
    color: rgb(var(--c-ink));
    font-size: 0.75rem;
    font-weight: 700;
    flex: 0 0 auto;
}

/* A tile. Without JavaScript it is a coloured explainer, as it always was;
   pricing.js turns the three into one choice (rules further down). */
.pay-way {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
    padding: 1rem;
    border-color: rgb(var(--way) / 0.45);
    background: rgb(var(--way) / 0.06);
    text-align: start;
    transition: border-color 0.15s, background-color 0.15s, box-shadow 0.15s;
}

.pay-way-head {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.pay-way-name {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.3125rem;
    min-width: 0;
}

.pay-way-title {
    font-size: 0.875rem;
    line-height: 1.3;
    color: rgb(var(--way-text));
}

.pay-way-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.pay-way-body {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.pay-way .pay-marks {
    justify-content: flex-start;
}

.pay-way-desc {
    display: block;
    font-size: 0.8125rem;
    line-height: 1.45;
}

.pay-way-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 999px;
    flex: 0 0 auto;
    background: rgb(var(--way));
    color: rgb(var(--on-way));
}

.pay-way-icon svg {
    width: 1.125rem;
    height: 1.125rem;
}

/* The radio: an empty ring, filled with the way's colour once chosen. */
.pay-way-radio {
    display: none;
    width: 1.25rem;
    height: 1.25rem;
    border-radius: 999px;
    border: 2px solid rgb(var(--c-line-strong));
    flex: 0 0 auto;
    transition: border-color 0.15s, background-color 0.15s;
}

/* Chosen-or-not, only once pricing.js has made the tiles a choice. */
[data-pay-way] .pay-way {
    cursor: pointer;
    border-color: rgb(var(--c-line));
    background: rgb(var(--c-surface));
}

[data-pay-way] .pay-way:hover {
    border-color: rgb(var(--c-line-strong));
}

[data-pay-way] .pay-way.is-selected {
    border-color: rgb(var(--way));
    background: rgb(var(--way) / 0.08);
    box-shadow: 0 0 0 1px rgb(var(--way));
}

[data-pay-way] .pay-way-radio {
    display: inline-block;
}

[data-pay-way] .pay-way.is-selected .pay-way-radio {
    border-color: rgb(var(--way));
    background: rgb(var(--way));
    box-shadow: inset 0 0 0 3px rgb(var(--c-surface));
}

[data-pay-way] .pay-way.is-unavailable {
    cursor: not-allowed;
    opacity: 0.6;
}

/* The radio itself is visually hidden, so its keyboard focus shows on the tile. */
.pay-way:has(.pay-way-input:focus-visible) {
    outline: 2px solid rgb(var(--way));
    outline-offset: 2px;
}

[data-pricing]:not([data-pay-way]) .pay-way-input {
    display: none;
}

/* On a phone the tiles stack, so only the chosen one keeps its logos and
   description: the other two shrink to a row each and the packs start
   within the first screen. */
@media (max-width: 639px) {
    [data-pay-way] .pay-way:not(.is-selected) .pay-way-body {
        display: none;
    }
}

/* Each pack shows the price and the button of the chosen way only. An element
   marked data-way="card transfer" belongs to those ways. */
[data-pay-way="card"] [data-way]:not([data-way~="card"]),
[data-pay-way="paypal"] [data-way]:not([data-way~="paypal"]),
[data-pay-way="transfer"] [data-way]:not([data-way~="transfer"]),
[data-pricing]:not([data-pay-way]) .js-only,
[data-pay-way] .nojs-only {
    display: none !important;
}

.pack-card.is-featured {
    border-color: rgb(var(--c-accent) / 0.5);
}

/* Four packs side by side: a little less padding keeps the longest pay label,
   "Payer par PayPal/carte Visa", on one line (it needs 222px of button). */
@media (min-width: 1280px) {
    .pack-card {
        padding: 1rem;
    }
}

.pack-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* The one action on each pack, a little taller than an ordinary button. Its
   label fits one line wherever four packs sit side by side (the pack row is
   wider than the rest of the page for that, see pricing.html); on a screen
   too narrow even for that it takes a second, balanced line rather than
   spilling out of the button. */
.btn-pay {
    min-height: 2.5rem;
    padding-inline: 0.75rem;
    white-space: normal;
    text-wrap: balance;
    line-height: 1.2;
    text-align: center;
}

.btn-pay-card,
.btn-pay-paypal,
.btn-pay-transfer {
    background: rgb(var(--way));
    color: rgb(var(--on-way));
}

.btn-pay-card:hover:not(:disabled),
.btn-pay-paypal:hover:not(:disabled),
.btn-pay-transfer:hover:not(:disabled) {
    background: rgb(var(--way) / 0.88);
}

.btn-icon {
    width: 1rem;
    height: 1rem;
    flex: 0 0 auto;
}

/* Telegram's own blue for the community: it is Telegram, not a way to pay
   here, so it borrows neither of the two payment colours. */
.community-card {
    border-color: rgb(42 171 238 / 0.4);
    background: rgb(42 171 238 / 0.06);
}

.btn-telegram {
    background: #2aabee;
    color: #fff;
}

.btn-telegram:hover:not(:disabled) {
    background: #229ed9;
}

/* --------------------------------------------------------------------------
   Generate transcript
   -------------------------------------------------------------------------- */
/* Its own green rather than the accent: this is the one button on the page
   that writes words instead of spending tokens, and it should not be mistaken
   for the primary action, which is generating the voice. */
.btn-scriptwriter {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 0.75rem;
    border: 1px solid transparent;
    background: #0e794b;
    color: #fff;
    font-size: 0.8125rem;
    font-weight: 550;
    line-height: 1.25;
    cursor: pointer;
    transition: background-color 0.15s, opacity 0.15s;
}

.btn-scriptwriter:hover:not(:disabled) {
    background: #0b643e;
}

.btn-scriptwriter:disabled,
.btn-scriptwriter.is-busy {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-scriptwriter svg {
    flex: 0 0 auto;
}

/* The four text tools sit on one line, the writer first. Each is a peer: the
   page has exactly one filled button and it is the one that makes audio. */
.studio-toolbar {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.studio-tools {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

/* Outlined rather than filled, for the same reason. */
.btn-scriptwriter-outline {
    background: transparent;
    border-color: #0e794b;
    color: #0e794b;
}

:root:not([data-theme="light"]) .btn-scriptwriter-outline,
[data-theme="dark"] .btn-scriptwriter-outline {
    border-color: #1aa86a;
    color: #1aa86a;
}

.btn-scriptwriter-outline:hover:not(:disabled) {
    background: rgb(14 121 75 / 0.12);
}

.scriptwriter {
    position: static;
}

/* Below the row and over the composer, the way the other tool menus open,
   rather than pushing the textarea down the page every time it is used. */
.scriptwriter-panel {
    position: absolute;
    top: calc(100% + 0.5rem);
    inset-inline: 0;
    z-index: 40;
    padding: 1rem;
    border: 1px solid rgb(var(--c-line));
    border-radius: var(--radius);
    background: rgb(var(--c-surface));
    box-shadow: 0 18px 40px rgb(0 0 0 / 0.28);
}

/* The taller composer, for people writing full scripts rather than a line.
   Desktop only as a min-height: on mobile the composer is sized against the
   viewport, and min-height wins over max-height, so an unscoped value here
   would push the tools and the generate button off the screen. */
@media (min-width: 1024px) {
    #tts-text.is-expanded { min-height: 560px; }
}

/* The panel header for each side of the Studio. */
.studio-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.studio-panel-title {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9375rem;
    font-weight: 600;
    color: rgb(var(--c-ink));
}

.studio-panel-title svg {
    flex: 0 0 auto;
    color: rgb(var(--c-accent));
}

.scriptwriter-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.scriptwriter-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

/* --------------------------------------------------------------------------
   Social follow rewards
   -------------------------------------------------------------------------- */
.social-card {
    display: flex;
    flex-direction: column;
    transition: border-color 0.15s, opacity 0.15s;
}

.social-card:hover {
    border-color: rgb(var(--c-accent) / 0.4);
}

.social-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem;
}

/* Each network in its own colour: the mark is the thing being recognised, and
   a row of identical grey glyphs asks the reader to stop and read instead. */
.social-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: var(--radius);
    background: rgb(var(--c-ink) / 0.04);
}

.social-mark svg {
    width: 1.25rem;
    height: 1.25rem;
}

.social-mark-linkedin { color: #0A66C2; }
.social-mark-instagram { color: #E4405F; }
.social-mark-facebook { color: #1877F2; }
.social-mark-tiktok { color: rgb(var(--c-ink)); }

.social-check {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.375rem;
    height: 1.375rem;
    border-radius: 999px;
    background: rgb(var(--c-accent));
    color: rgb(var(--c-on-accent));
}

.social-check svg {
    width: 0.875rem;
    height: 0.875rem;
}

.social-card-body {
    margin-top: 0.875rem;
    flex: 1;
}

.social-reward {
    margin-top: 0.25rem;
    font-size: 1.125rem;
}

/* A claimed card steps back rather than disappearing: the reader should still
   see that this one is done, not wonder where it went. */
.social-card-done {
    opacity: 0.72;
}

.social-done {
    cursor: default;
    pointer-events: none;
}

.social-error:empty {
    display: none;
}

/* --------------------------------------------------------------------------
   Invite a friend
   -------------------------------------------------------------------------- */
/* Tinted with the accent like the card payment panel: what it pays out is
   credit, and credit is what the accent is reserved for. */
.referral-card {
    border-color: rgb(var(--c-accent) / 0.45);
    background: rgb(var(--c-accent) / 0.06);
}

.referral-code {
    display: block;
    padding: 0.4375rem 0.75rem;
    border: 1px dashed rgb(var(--c-accent) / 0.55);
    border-radius: var(--radius);
    background: rgb(var(--c-sunken));
    color: rgb(var(--c-accent));
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: 0.18em;
    text-align: center;
}

.referral-teaser {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.8125rem;
    font-weight: 550;
    color: rgb(var(--c-accent));
}

.referral-teaser:hover {
    text-decoration: underline;
}

.referral-steps li {
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
}

.referral-step {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.375rem;
    height: 1.375rem;
    flex: 0 0 auto;
    border-radius: 999px;
    background: rgb(var(--c-accent));
    color: rgb(var(--c-on-accent));
    font-size: 0.75rem;
    font-weight: 600;
}

.referral-shield-icon {
    width: 1.375rem;
    height: 1.375rem;
    flex: 0 0 auto;
    color: rgb(var(--c-accent));
}

[data-copy].is-done {
    pointer-events: none;
}

/* WhatsApp's own green, the same reasoning as .btn-telegram: it is the app's
   button, not one of ours. */
.btn-whatsapp {
    background: #25d366;
    color: #fff;
}

.btn-whatsapp:hover:not(:disabled) {
    background: #1fb956;
}

/* "Have an invite code?" on the signup form, closed unless there is one. */
.invite-toggle > summary {
    list-style: none;
    cursor: pointer;
    font-size: 0.8125rem;
    color: rgb(var(--c-accent));
}

.invite-toggle > summary::-webkit-details-marker {
    display: none;
}

.invite-toggle > summary:hover {
    text-decoration: underline;
}

/* Brand marks on the sign-in buttons. Their own colours in both themes - a
   provider logo recoloured to match the page is no longer the provider's
   logo - so nothing here touches fill. */
.oauth-logo {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
}

/* --------------------------------------------------------------------------
   Form controls
   -------------------------------------------------------------------------- */

.input,
.select,
.textarea {
    width: 100%;
    background: rgb(var(--c-sunken));
    border: 1px solid rgb(var(--c-line));
    border-radius: var(--radius);
    padding: 0.5625rem 0.75rem;
    font-size: 0.875rem;
    color: rgb(var(--c-ink));
    transition: border-color 0.15s;
}

.input::placeholder,
.textarea::placeholder {
    color: rgb(var(--c-ink-3));
}

.input:focus,
.select:focus,
.textarea:focus {
    outline: none;
    border-color: rgb(var(--c-accent));
}

.textarea {
    resize: none;
    line-height: 1.7;
}

.select {
    appearance: none;
    padding-inline-end: 2rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%2371717a'%3E%3Cpath d='M5.5 7.5 10 12l4.5-4.5'  stroke='%2371717a' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    /* The shorthand has no logical form, so the RTL page flips it explicitly
       below rather than leaving the arrow stranded on the reading-end side. */
    background-position: right 0.5rem center;
    background-size: 1.125rem;
}

html[dir="rtl"] .select {
    background-position: left 0.5rem center;
}

.field-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 550;
    color: rgb(var(--c-ink-2));
    margin-bottom: 0.375rem;
}

/* --------------------------------------------------------------------------
   Signup form
   -------------------------------------------------------------------------- */

.input-error,
.input-error:focus {
    border-color: rgb(var(--c-danger));
}

.field-error {
    margin-top: 0.375rem;
    font-size: 0.8125rem;
    color: rgb(var(--c-danger));
}

/* "or with your email", between the Google button and the form. */
.auth-or {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.75rem;
    color: rgb(var(--c-ink-3));
}

.auth-or::before,
.auth-or::after {
    content: "";
    flex: 1;
    height: 1px;
    background: rgb(var(--c-line));
}

.password-field {
    position: relative;
}

.password-field .input {
    padding-inline-end: 2.75rem;
}

.password-toggle {
    position: absolute;
    inset-block: 0;
    inset-inline-end: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    color: rgb(var(--c-ink-3));
    border-radius: var(--radius);
}

.password-toggle:hover,
.password-toggle:focus-visible {
    color: rgb(var(--c-ink));
}

.password-toggle:focus-visible {
    outline: 2px solid rgb(var(--c-accent));
    outline-offset: -2px;
}

.password-toggle svg {
    width: 1.125rem;
    height: 1.125rem;
}

.password-toggle .icon-eye-off,
.password-toggle[aria-pressed="true"] .icon-eye {
    display: none;
}

.password-toggle[aria-pressed="true"] .icon-eye-off {
    display: block;
}

.password-hint {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    margin-top: 0.375rem;
    font-size: 0.8125rem;
    color: rgb(var(--c-ink-3));
    transition: color 0.15s;
}

.password-hint-mark {
    position: relative;
    width: 0.875rem;
    height: 0.875rem;
    border-radius: 999px;
    border: 1.5px solid currentColor;
    flex: 0 0 auto;
}

.password-hint.is-met {
    color: rgb(var(--c-accent));
}

/* Met: a filled circle with a tick drawn in the page colour. */
.password-hint.is-met .password-hint-mark {
    background: currentColor;
}

.password-hint.is-met .password-hint-mark::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 45%;
    width: 0.25rem;
    height: 0.4375rem;
    border: solid rgb(var(--c-surface));
    border-width: 0 1.5px 1.5px 0;
    transform: translate(-50%, -50%) rotate(45deg);
}

.email-suggestion {
    margin-top: 0.375rem;
    font-size: 0.8125rem;
    color: rgb(var(--c-ink-2));
}

.email-suggestion button {
    font-weight: 600;
    color: rgb(var(--c-accent));
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* Below 16px, iOS Safari zooms the page into a field when it takes focus. */
@media (max-width: 640px) {
    #register-form .input {
        font-size: 16px;
    }
}

/* Radio / checkbox rendered as a selectable tile.
   Markup: <label class="choice"><input type="radio" class="choice-input"><span class="choice-body">…</span></label> */
.choice-input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.choice-body {
    display: block;
    border: 1px solid rgb(var(--c-line));
    background: rgb(var(--c-sunken));
    border-radius: var(--radius);
    padding: 0.625rem 0.75rem;
    font-size: 0.8125rem;
    color: rgb(var(--c-ink-2));
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s, background-color 0.15s;
}

.choice-body:hover {
    border-color: rgb(var(--c-line-strong));
}

.choice-input:checked + .choice-body {
    border-color: rgb(var(--c-accent));
    color: rgb(var(--c-ink));
    background: rgb(var(--c-accent) / 0.07);
}

.choice-input:focus-visible + .choice-body {
    outline: 2px solid rgb(var(--c-accent));
    outline-offset: 2px;
}

/* Compact variant for pill rows */
.choice-pill {
    display: inline-block;
    border: 1px solid rgb(var(--c-line));
    background: rgb(var(--c-sunken));
    border-radius: 999px;
    padding: 0.3125rem 0.75rem;
    font-size: 0.75rem;
    color: rgb(var(--c-ink-2));
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s, background-color 0.15s;
}

.choice-pill:hover {
    border-color: rgb(var(--c-line-strong));
}

.choice-input:checked + .choice-pill {
    border-color: rgb(var(--c-accent));
    color: rgb(var(--c-accent));
    background: rgb(var(--c-accent) / 0.09);
}

/* Square scale cell, used by every 1-5 rating row */
.choice-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border: 1px solid rgb(var(--c-line));
    background: rgb(var(--c-sunken));
    border-radius: var(--radius);
    font-size: 0.8125rem;
    color: rgb(var(--c-ink-3));
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s, background-color 0.15s;
    font-variant-numeric: tabular-nums;
}

.choice-cell:hover {
    border-color: rgb(var(--c-line-strong));
    color: rgb(var(--c-ink));
}

.choice-input:checked + .choice-cell {
    border-color: rgb(var(--c-accent));
    color: rgb(var(--c-accent));
    background: rgb(var(--c-accent) / 0.09);
    font-weight: 600;
}

/* Segmented control */
.seg {
    display: flex;
    gap: 0.25rem;
    padding: 0.25rem;
    background: rgb(var(--c-sunken));
    border: 1px solid rgb(var(--c-line));
    border-radius: var(--radius);
}

.seg-item {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    padding: 0.4375rem 0.75rem;
    border-radius: 7px;
    font-size: 0.8125rem;
    font-weight: 550;
    color: rgb(var(--c-ink-3));
    cursor: pointer;
    border: 0;
    background: transparent;
    transition: background-color 0.15s, color 0.15s;
}

.seg-item:hover {
    color: rgb(var(--c-ink));
}

.seg-item[aria-selected="true"],
.choice-input:checked + .seg-item {
    background: rgb(var(--c-surface));
    color: rgb(var(--c-ink));
    box-shadow: 0 1px 2px rgb(0 0 0 / 0.18);
}

/* A .seg that states rather than offers - the accepted cards, where the choice
   itself belongs to someone else's checkout page. Same shape as the control so
   it sits in the card layout, without the affordances that would invite a
   click that does nothing. */
.seg-static {
    cursor: default;
}

.seg-note {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.4375rem 0.75rem;
    border-radius: 7px;
    font-size: 0.8125rem;
    font-weight: 550;
    color: rgb(var(--c-ink-3));
    background: transparent;
    cursor: default;
    user-select: none;
}

/* The mark on a choice - a speed dial, a purpose. Sized in em so it tracks
   whatever type size the control it is dropped into uses, and drawn in
   currentColor so it inherits that control's selected and hover states rather
   than needing a rule per state. */
.choice-icon {
    width: 1.25em;
    height: 1.25em;
    flex-shrink: 0;
}

/* The speed and purpose tabs stack their mark above the label. Side by side,
   four Arabic purpose labels plus four marks do not fit the options column,
   and what gives is the end of each label - ريل لمواقع التواصل truncated to
   ريل لمو... tells the user less than no icon would have. */
.speed-tab-btn,
.purpose-tab-btn {
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.5rem 0.375rem;
    line-height: 1.3;
    text-align: center;
}

.speed-tab-btn .choice-icon,
.purpose-tab-btn .choice-icon {
    width: 1.125rem;
    height: 1.125rem;
}

.seg-item[aria-selected="true"] .choice-icon {
    color: rgb(var(--c-accent));
}

/* Unified 24x24 UI icon set (templates/icons/<name>.html) */
.icon {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
}

.icon-md {
    width: 1.25rem;
    height: 1.25rem;
    flex-shrink: 0;
}

.badge .icon {
    width: 0.8125rem;
    height: 0.8125rem;
}

[dir="rtl"] .icon-rtl {
    transform: scaleX(-1);
}

/* Theme-switched SVG illustrations (mirrors .home-art-dark / .home-art-light) */
.art-dark {
    display: block;
}

.art-light {
    display: none;
}

:root[data-theme="light"] .art-dark {
    display: none;
}

:root[data-theme="light"] .art-light {
    display: block;
}

[dir="rtl"] .art-flip {
    transform: scaleX(-1);
}

/* --------------------------------------------------------------------------
   Payment marks
   --------------------------------------------------------------------------
   The cards and services a panel actually accepts, as their own logos. Each
   sits on a light plate: half of these marks are dark navy on transparent
   (Algerie Poste, PayPal, BaridiMob) and would disappear against the dark
   theme's canvas, and a plate for some and not others reads as a mistake.
   -------------------------------------------------------------------------- */

.pay-marks {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.pay-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 2.75rem;
    padding: 0 0.625rem;
    border-radius: 9px;
    border: 1px solid rgb(var(--c-line));
    /* Not var(--c-surface): the plate has to stay light in both themes, since
       it exists to hold marks that are only legible on a light ground. */
    background: #fff;
}

.pay-mark img {
    display: block;
    width: auto;
    height: 1.25rem;
    /* A cap, so one wide wordmark cannot set the width of the whole row. */
    max-width: 5.5rem;
    object-fit: contain;
}

/* Wordmarks sit at 18px, where they are still readable because they are wide.
   A square or stacked mark at 18px is a smudge - Algerie Poste is a mark over
   a wordmark, CIB is three letters inside a badge - so those get the height
   the wordmarks do not need. */
.pay-mark-tall img {
    height: 1.75rem;
}

/* --------------------------------------------------------------------------
   Transfer page: choose a method, then pay in its dialog
   --------------------------------------------------------------------------
   The same order as the Telegram bot: the method first, and only then the
   account to send to and the receipt upload, for that one method. Amber is
   the transfer colour from the pricing page. */

.pay-methods {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.625rem;
}

/* An odd last tile spans the row instead of leaving a hole beside it. */
.pay-methods > .pay-method:last-child:nth-child(odd),
.pay-methods-empty {
    grid-column: 1 / -1;
}

.pay-method {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 8.5rem;
    padding: 1.25rem 0.75rem 1rem;
    border: 1px solid rgb(var(--c-line));
    border-radius: 14px;
    background: rgb(var(--c-surface));
    color: rgb(var(--c-ink));
    text-align: center;
    text-decoration: none;
    transition: border-color 0.15s ease, background-color 0.15s ease, transform 0.15s ease;
}

.pay-method:hover {
    border-color: rgb(var(--c-warn) / 0.7);
    background: rgb(var(--c-warn) / 0.06);
}

.pay-method:active {
    transform: scale(0.98);
}

.pay-method:focus-visible {
    outline: 2px solid rgb(var(--c-warn));
    outline-offset: 2px;
}

.pay-method-name {
    font-size: 0.875rem;
    font-weight: 600;
}

.pay-method-amount {
    font-size: 0.8125rem;
    color: rgb(var(--c-ink-2));
}

.pay-method-badge {
    padding: 0.125rem 0.5rem;
    border-radius: 999px;
    font-size: 0.6875rem;
    font-weight: 600;
    background: rgb(var(--c-warn) / 0.15);
    color: rgb(var(--c-warn));
}

.pay-dialog {
    width: min(520px, calc(100vw - 24px));
    max-height: min(820px, calc(100dvh - 32px));
    margin: auto;
    padding: 0;
    border: 1px solid rgb(var(--c-line));
    border-radius: 16px;
    color: rgb(var(--c-ink));
    background: rgb(var(--c-surface));
    box-shadow: 0 24px 80px rgb(0 0 0 / 0.3);
}

.pay-dialog::backdrop {
    background: rgb(0 0 0 / 0.55);
}

.pay-dialog[open] {
    display: flex;
}

/* The page behind a modal must not scroll under the finger. */
html:has(.pay-dialog[open]) {
    overflow: hidden;
}

.pay-dialog-form {
    display: flex;
    flex-direction: column;
    width: 100%;
    min-height: 0;
}

.pay-dialog-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    border-bottom: 1px solid rgb(var(--c-line));
    flex-shrink: 0;
}

.pay-dialog-header .t-section {
    font-size: 1rem;
}

/* The title takes the focus when the dialog opens (screen readers announce
   it), but it is not a control, so it gets no focus ring. */
.pay-dialog-title:focus {
    outline: none;
}

.pay-dialog-x {
    font-size: 1.375rem;
    line-height: 1;
    min-width: 2.5rem;
    min-height: 2.5rem;
}

.pay-dialog-body {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    min-height: 0;
    padding: 1rem;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.pay-dialog-footer {
    display: flex;
    gap: 0.75rem;
    padding: 1rem;
    border-top: 1px solid rgb(var(--c-line));
    flex-shrink: 0;
}

.pay-dialog-footer .btn {
    min-height: 46px;
}

.pay-dialog-footer .btn-pay-transfer {
    flex: 1;
}

.pay-step {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: rgb(var(--c-ink));
}

.pay-step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 999px;
    font-size: 0.75rem;
    background: rgb(var(--c-warn));
    color: rgb(var(--c-on-warn));
    flex: 0 0 auto;
}

/* The number to send is the one thing on the screen that must not be
   misread, so it is the largest. */
.pay-amount {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    border: 1px solid rgb(var(--c-warn) / 0.45);
    border-radius: 12px;
    background: rgb(var(--c-warn) / 0.08);
}

.pay-amount-value {
    margin-top: 0.125rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: rgb(var(--c-ink));
}

.pay-details {
    border: 1px solid rgb(var(--c-line));
    border-radius: 12px;
    background: rgb(var(--c-sunken));
}

.pay-detail {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
}

.pay-detail + .pay-detail {
    border-top: 1px solid rgb(var(--c-line));
}

.pay-drop {
    display: block;
    padding: 1.25rem 1rem;
    border: 2px dashed rgb(var(--c-line-strong));
    border-radius: 12px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

.pay-drop:hover,
.pay-drop:focus-within {
    border-color: rgb(var(--c-warn));
    background: rgb(var(--c-warn) / 0.05);
}

.has-file .pay-drop {
    border-style: solid;
    border-color: rgb(var(--c-accent));
    background: rgb(var(--c-accent) / 0.06);
}

.pay-drop-icon {
    width: 1.75rem;
    height: 1.75rem;
    margin: 0 auto 0.5rem;
    color: rgb(var(--c-warn));
}

.has-file .pay-drop-icon {
    color: rgb(var(--c-accent));
}

/* On a phone the dialog is a sheet from the bottom edge, in thumb reach. */
@media (max-width: 640px) {
    .pay-dialog {
        width: 100%;
        max-width: 100%;
        max-height: calc(100dvh - 16px);
        margin: auto 0 0;
        border-bottom: 0;
        border-radius: 18px 18px 0 0;
    }

    .pay-dialog-footer {
        padding-bottom: max(1rem, env(safe-area-inset-bottom));
    }
}

@media (prefers-reduced-motion: no-preference) {
    .pay-dialog[open] {
        animation: pay-dialog-in 0.2s ease-out;
    }
}

@media (prefers-reduced-motion: no-preference) and (max-width: 640px) {
    .pay-dialog[open] {
        animation-name: pay-sheet-in;
    }
}

@keyframes pay-dialog-in {
    from { opacity: 0; transform: translateY(8px) scale(0.98); }
    to { opacity: 1; transform: none; }
}

@keyframes pay-sheet-in {
    from { transform: translateY(100%); }
    to { transform: none; }
}

/* --------------------------------------------------------------------------
   Voice picker
   --------------------------------------------------------------------------
   One selectable row per voice: index, avatar, name and accent, a preview
   link, and the per-conversion limit. Selection is a real radio input, so the
   whole list is keyboard- and screen-reader-navigable.
   -------------------------------------------------------------------------- */

.voice-row {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding-block: 0.625rem;
    /* Extra room on the start side for the absolutely-positioned index badge. */
    padding-inline: 1.75rem 0.75rem;
    border: 1px solid rgb(var(--c-line));
    background: rgb(var(--c-sunken));
    border-radius: var(--radius);
    cursor: pointer;
    transition: border-color 0.15s, background-color 0.15s;
}

.voice-row:hover {
    border-color: rgb(var(--c-line-strong));
}

.voice-row.is-selected {
    border-color: rgb(var(--c-accent));
    background: rgb(var(--c-accent) / 0.07);
}

.voice-index {
    position: absolute;
    top: 0.3125rem;
    inset-inline-start: 0.4375rem;
    font-size: 0.625rem;
    font-variant-numeric: tabular-nums;
    color: rgb(var(--c-ink-3));
    line-height: 1;
}

.voice-radio-dot {
    width: 1rem;
    height: 1rem;
    border-radius: 50%;
    border: 1px solid rgb(var(--c-line-strong));
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: border-color 0.15s;
}

.voice-radio-dot::after {
    content: "";
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: rgb(var(--c-accent));
    opacity: 0;
    transition: opacity 0.15s;
}

.voice-row.is-selected .voice-radio-dot {
    border-color: rgb(var(--c-accent));
}

.voice-row.is-selected .voice-radio-dot::after {
    opacity: 1;
}

/* Initial-based avatar: no image assets, still distinct per voice. */
.avatar {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.8125rem;
    font-weight: 600;
    background: rgb(var(--c-line));
    color: rgb(var(--c-ink-2));
    border: 1px solid rgb(var(--c-line-strong));
    user-select: none;
}

.voice-row.is-selected .avatar {
    background: rgb(var(--c-accent) / 0.15);
    border-color: rgb(var(--c-accent) / 0.4);
    color: rgb(var(--c-accent));
}

/* Inline text action, e.g. the per-voice "Example" preview. */
.link-action {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.6875rem;
    font-weight: 550;
    color: rgb(var(--c-accent));
    background: none;
    border: 0;
    padding: 0;
    cursor: pointer;
}

.link-action:hover {
    text-decoration: underline;
}

.link-quiet {
    color: rgb(var(--c-ink-3));
    font-size: 0.75rem;
    text-decoration: none;
}

.link-quiet:hover {
    color: rgb(var(--c-ink));
}

/* Scroll region for long lists, with the fade cue at the bottom edge. */
.scroll-list {
    overflow-y: auto;
    overscroll-behavior: contain;
}

/* --------------------------------------------------------------------------
   Disclosure (More settings)
   -------------------------------------------------------------------------- */

details > summary {
    list-style: none;
}

details > summary::-webkit-details-marker,
details > summary::marker {
    display: none;
    content: "";
}

details > summary:hover .chevron {
    color: rgb(var(--c-ink-2));
}

details[open] > summary .chevron {
    transform: rotate(180deg);
}

.chevron {
    transition: transform 0.15s ease;
}

/* --------------------------------------------------------------------------
   Dropdown menu (Insert pause)
   -------------------------------------------------------------------------- */

.menu-wrap {
    position: relative;
}

.menu {
    position: absolute;
    inset-inline-start: 0;
    top: calc(100% + 0.375rem);
    z-index: 30;
    min-width: 13rem;
    padding: 0.25rem;
    background: rgb(var(--c-surface));
    border: 1px solid rgb(var(--c-line));
    border-radius: var(--radius);
    box-shadow: 0 10px 30px rgb(0 0 0 / 0.4);
    display: none;
}

/* The default anchors to the menu's own inline-start edge. A menu opened from
   a button hugging the far edge of the header needs the other edge instead,
   or it runs off the viewport. */
.menu-end {
    inset-inline-start: auto;
    inset-inline-end: 0;
}

.menu.is-open {
    display: block;
    animation: fade-in 0.12s ease-out;
}

.menu-head {
    padding: 0.5rem 0.5625rem 0.625rem;
    margin-bottom: 0.25rem;
    border-bottom: 1px solid rgb(var(--c-line));
}

.menu-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    width: 100%;
    padding: 0.4375rem 0.5625rem;
    border: 0;
    background: none;
    border-radius: 7px;
    font-size: 0.8125rem;
    color: rgb(var(--c-ink-2));
    text-decoration: none;
    cursor: pointer;
    text-align: start;
}

.menu-item:hover {
    background: rgb(var(--c-sunken));
    color: rgb(var(--c-ink));
}

.menu-item.is-current {
    color: rgb(var(--c-ink));
}

/* On a phone a menu cannot be anchored to its own button and stay on screen.
   The header wraps below `sm`, so the account button lands at a different x at
   every width - at 390 it is against one edge, at 360 it has wrapped to the
   other - and the panel follows it off the viewport. It was leaving `Account`
   through `Sign out` entirely past the right edge in Arabic, with nothing to
   scroll to them.

   Pinned to the viewport instead, keeping only its vertical placement under
   the button. Same treatment the Studio's own tool menus already get. */
@media (max-width: 639px) {
    /* Anything a phone has elsewhere (the header's sign-in sits in the nav row). */
    .hide-phone {
        display: none;
    }

    .menu {
        position: fixed;
        top: auto;
        inset-inline: 12px;
        min-width: 0;
        max-width: none;
        max-height: min(70svh, 28rem);
        overflow-y: auto;
        overscroll-behavior: contain;
        z-index: 60;
    }

    /* Touch targets. 13px rows at 7px of padding are a 30px target; the
       guidance is 44, and this is the menu holding Sign out. */
    .menu-item {
        min-height: 44px;
        padding: 0.625rem 0.75rem;
        font-size: 0.875rem;
    }

    .menu-head {
        padding: 0.625rem 0.75rem 0.75rem;
    }
}

/* The header wraps on a phone, and what wraps last is the account button -
   which ends up alone on a third row, on a sticky bar already eating a quarter
   of the screen. The word after the balance is what buys that row back: a
   number sitting against a Top up button does not need "tokens" spelled out,
   and in Arabic توكن is the longest part of the chip. */
@media (max-width: 479px) {
    .balance-chip > span + span {
        display: none;
    }

    .balance-chip {
        padding-inline: 0.5rem;
    }
}

/* --------------------------------------------------------------------------
   Badges
   -------------------------------------------------------------------------- */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.1875rem 0.4375rem;
    border-radius: 6px;
    border: 1px solid rgb(var(--c-line));
    background: rgb(var(--c-sunken));
    color: rgb(var(--c-ink-2));
    font-size: 0.6875rem;
    font-weight: 550;
    line-height: 1.2;
    white-space: nowrap;
}

.badge-accent {
    border-color: rgb(var(--c-accent) / 0.35);
    background: rgb(var(--c-accent) / 0.1);
    color: rgb(var(--c-accent-text));
}

.badge-danger {
    border-color: rgb(var(--c-danger) / 0.35);
    background: rgb(var(--c-danger) / 0.1);
    color: rgb(var(--c-danger));
}

.badge-warn {
    border-color: rgb(var(--c-warn) / 0.35);
    background: rgb(var(--c-warn) / 0.1);
    color: rgb(var(--c-warn));
}

.badge-solid {
    border-color: transparent;
    background: rgb(var(--c-accent));
    color: rgb(var(--c-on-accent));
}

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

.table-wrap {
    overflow-x: auto;
    border: 1px solid rgb(var(--c-line));
    border-radius: var(--radius-lg);
    /* A phone shows a wide table cut off at one edge with no scrollbar and
       nothing to say it scrolls. These are scroll shadows: a soft edge on
       whichever side still has columns hidden, covered by the surface-coloured
       layers (attached to the content) once that edge is reached. */
    background:
        linear-gradient(to right, rgb(var(--c-surface)) 40%, rgb(var(--c-surface) / 0)) 0 0 / 48px 100%,
        linear-gradient(to left, rgb(var(--c-surface)) 40%, rgb(var(--c-surface) / 0)) 100% 0 / 48px 100%,
        linear-gradient(to right, rgb(var(--c-ink) / 0.16), rgb(var(--c-ink) / 0)) 0 0 / 16px 100%,
        linear-gradient(to left, rgb(var(--c-ink) / 0.16), rgb(var(--c-ink) / 0)) 100% 0 / 16px 100%,
        rgb(var(--c-surface));
    background-repeat: no-repeat;
    background-attachment: local, local, scroll, scroll, scroll;
}

table.tbl {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
}

table.tbl th {
    text-align: start;
    padding: 0.6875rem 1rem;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: rgb(var(--c-ink-3));
    background: rgb(var(--c-sunken));
    border-bottom: 1px solid rgb(var(--c-line));
    white-space: nowrap;
}

table.tbl td {
    padding: 0.6875rem 1rem;
    color: rgb(var(--c-ink-2));
    border-bottom: 1px solid rgb(var(--c-line) / 0.6);
}

table.tbl tbody tr:last-child td {
    border-bottom: 0;
}

table.tbl tbody tr:hover td {
    background: rgb(var(--c-sunken) / 0.5);
}

.num {
    text-align: right;
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
    font-variant-numeric: tabular-nums;
    color: rgb(var(--c-ink));
}

.empty {
    padding: 2.5rem 1rem;
    text-align: center;
    color: rgb(var(--c-ink-3));
    font-size: 0.8125rem;
}

/* --------------------------------------------------------------------------
   Meters
   -------------------------------------------------------------------------- */

.meter {
    height: 4px;
    border-radius: 999px;
    background: rgb(var(--c-line));
    overflow: hidden;
}

.meter > span {
    display: block;
    height: 100%;
    background: rgb(var(--c-accent));
    border-radius: 999px;
}

/* --------------------------------------------------------------------------
   Insights (staff dashboard)
   --------------------------------------------------------------------------
   One series everywhere, so one hue: the accent. Numbers are always printed
   next to their bar; hover titles only repeat them. */

.seg-item.is-current {
    background: rgb(var(--c-surface));
    color: rgb(var(--c-ink));
    box-shadow: 0 1px 2px rgb(0 0 0 / 0.18);
}

table.tbl th.num {
    font-family: inherit;
    text-align: right;
}

.ins-kpis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.75rem;
}

.ins-kpi {
    font-size: 1.75rem;
    font-weight: 650;
    line-height: 1.15;
    color: rgb(var(--c-ink));
    margin-bottom: 0.25rem;
}

.ins-unit {
    font-size: 0.875rem;
    font-weight: 500;
    color: rgb(var(--c-ink-3));
}

.ins-figure {
    font-size: 1.125rem;
    font-weight: 650;
    color: rgb(var(--c-ink));
}

.ins-split {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
}

.ins-funnel {
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
}

.ins-funnel-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.75rem;
    font-size: 0.8125rem;
    margin-bottom: 0.375rem;
}

.ins-funnel-bar,
.ins-share-bar {
    display: block;
    height: 8px;
    border-radius: 4px;
    background: rgb(var(--c-line) / 0.6);
    overflow: hidden;
}

.ins-share-bar {
    height: 6px;
}

.ins-funnel-bar > span,
.ins-share-bar > span {
    display: block;
    height: 100%;
    min-width: 2px;
    border-radius: 4px;
    background: rgb(var(--c-accent));
}

.ins-share {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.ins-share li {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(60px, 1fr) auto;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.8125rem;
}

.ins-share-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: rgb(var(--c-ink-2));
}

.ins-share-value {
    white-space: nowrap;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.ins-share .empty,
.ins-share + .empty {
    padding: 1rem 0;
}

.ins-daily {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 120px;
    border-bottom: 1px solid rgb(var(--c-line));
}

.ins-daily-col {
    flex: 1;
    height: 100%;
    display: flex;
    align-items: flex-end;
}

.ins-daily-col > span {
    display: block;
    width: 100%;
    border-radius: 4px 4px 0 0;
    background: rgb(var(--c-accent));
}

.ins-daily-col:hover > span {
    background: rgb(var(--c-accent) / 0.75);
}

.ins-path {
    font-size: 0.75rem;
    color: rgb(var(--c-ink-3));
}

.ins-path > span {
    color: rgb(var(--c-ink-2));
}

.meter-neutral > span {
    background: rgb(var(--c-ink-3));
}

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

.notice {
    border: 1px solid rgb(var(--c-line));
    background: rgb(var(--c-surface));
    border-radius: var(--radius);
    padding: 0.875rem 1rem;
    font-size: 0.8125rem;
    color: rgb(var(--c-ink-2));
}

.notice-accent {
    border-color: rgb(var(--c-accent) / 0.3);
    background: rgb(var(--c-accent) / 0.06);
}

.notice-danger {
    border-color: rgb(var(--c-danger) / 0.3);
    background: rgb(var(--c-danger) / 0.06);
    color: rgb(var(--c-danger));
}

.notice-warn {
    border-color: rgb(var(--c-warn) / 0.3);
    background: rgb(var(--c-warn) / 0.06);
}

/* --------------------------------------------------------------------------
   Toasts - Django flash messages, floated over the page under the header.
   base.html sets --toast-top from the header's real height and runs the
   timers; only success and info leave by themselves.
   -------------------------------------------------------------------------- */

.toast-region {
    position: fixed;
    top: var(--toast-top, 4.5rem);
    inset-inline: 0;
    z-index: 70;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding-inline: 0.75rem;
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    width: 100%;
    max-width: 26rem;
    padding: 0.625rem 0.5rem;
    padding-inline-start: 0.875rem;
    background: rgb(var(--c-surface));
    border: 1px solid rgb(var(--c-line));
    border-radius: var(--radius);
    box-shadow: 0 10px 30px rgb(0 0 0 / 0.22);
    font-size: 0.8125rem;
    line-height: 1.5;
    color: rgb(var(--c-ink));
    animation: toast-in 0.2s ease-out;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.is-leaving {
    opacity: 0;
    transform: translateY(-6px);
}

.toast-icon {
    flex-shrink: 0;
    width: 1.125rem;
    height: 1.125rem;
    margin-top: 0.3rem;
    color: rgb(var(--c-ink-3));
}

.toast-success .toast-icon { color: rgb(var(--c-accent)); }
.toast-warning .toast-icon { color: rgb(var(--c-warn)); }
.toast-error { border-color: rgb(var(--c-danger) / 0.45); }
.toast-error .toast-icon { color: rgb(var(--c-danger)); }

.toast-body {
    flex: 1;
    min-width: 0;
    padding-block: 0.25rem;
    overflow-wrap: anywhere;
}

.toast-close {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 6px;
    color: rgb(var(--c-ink-3));
}

.toast-close:hover {
    background: rgb(var(--c-sunken));
    color: rgb(var(--c-ink));
}

.toast-close:focus-visible {
    outline: 2px solid rgb(var(--c-accent));
    outline-offset: 1px;
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

/* --------------------------------------------------------------------------
   Audio
   -------------------------------------------------------------------------- */

audio {
    width: 100%;
    height: 36px;
    border-radius: var(--radius);
}

/* The native player is built for light backgrounds; invert it back on dark. */
:root:not([data-theme="light"]) audio {
    filter: invert(92%) hue-rotate(180deg) saturate(0.2);
}

:root[data-theme="light"] audio {
    filter: none;
}

/* --------------------------------------------------------------------------
   Code
   -------------------------------------------------------------------------- */

code,
kbd {
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
    font-size: 0.8125em;
}

.code-block {
    background: rgb(var(--c-sunken));
    border: 1px solid rgb(var(--c-line));
    border-radius: var(--radius);
    padding: 0.875rem 1rem;
    overflow-x: auto;
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
    font-size: 0.75rem;
    line-height: 1.7;
    color: rgb(var(--c-ink-2));
    white-space: pre;
    tab-size: 2;
}

.code-block .tok-key {
    color: rgb(var(--c-accent));
}

.code-block .tok-str {
    color: rgb(var(--c-ink));
}

.code-block .tok-com {
    color: rgb(var(--c-ink-3));
}

.code-inline {
    background: rgb(var(--c-sunken));
    border: 1px solid rgb(var(--c-line));
    border-radius: 5px;
    padding: 0.0625rem 0.3125rem;
    color: rgb(var(--c-ink));
}

/* --------------------------------------------------------------------------
   Utilities
   -------------------------------------------------------------------------- */

.line-clamp-1 {
    display: -webkit-box;
    -webkit-line-clamp: 1;
    line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.spinner {
    display: inline-block;
    width: 0.875rem;
    height: 0.875rem;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* tailwind.css is linked first, and its .hidden ties with .spinner on
   specificity, so the display above won the tie: the Studio's Convert button
   spun from page load whether or not anything was generating. */
.spinner.hidden {
    display: none;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.fade-in {
    animation: fade-in 0.2s ease-out;
}

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

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* Scrollbars */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgb(var(--c-line-strong));
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgb(var(--c-ink-3));
}

/* --------------------------------------------------------------------------
   Modal
   -------------------------------------------------------------------------- */

.modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgb(0 0 0 / 0.6);
    backdrop-filter: blur(2px);
}

.modal.is-open {
    display: flex;
}

.modal-panel {
    width: 100%;
    max-width: 30rem;
    max-height: 88vh;
    overflow-y: auto;
    background: rgb(var(--c-surface));
    border: 1px solid rgb(var(--c-line));
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 50px rgb(0 0 0 / 0.35);
    animation: fade-in 0.2s ease-out;
}

/* ---------------------------------------------------------------------------
   Legal documents
   Long prose typed as plain HTML: the rhythm is set here once instead of
   hanging a utility class on every paragraph.
   --------------------------------------------------------------------------- */
.legal-doc h2 {
    font-size: 15px;
    font-weight: 600;
    color: rgb(var(--c-ink));
    margin-top: 1.75rem;
    margin-bottom: 0.5rem;
}

.legal-doc h3 {
    font-size: 13.5px;
    font-weight: 600;
    color: rgb(var(--c-ink-2));
    margin-top: 1.1rem;
    margin-bottom: 0.35rem;
}

.legal-doc p,
.legal-doc li {
    font-size: 13.5px;
    line-height: 1.7;
    color: rgb(var(--c-ink-2));
}

.legal-doc p {
    margin-bottom: 0.75rem;
}

.legal-doc ul,
.legal-doc ol {
    margin: 0 0 0.9rem;
    margin-inline-start: 1.25rem;
    list-style: disc;
}

.legal-doc ol {
    list-style: decimal;
}

.legal-doc li {
    margin-bottom: 0.35rem;
}

.legal-doc a {
    color: rgb(var(--c-accent));
}

.legal-doc a:hover {
    text-decoration: underline;
}

/* --------------------------------------------------------------------------
   Layout shell, nav and footer links
   -------------------------------------------------------------------------- */

.shell {
    max-width: 1400px;
    margin-inline: auto;
    padding-inline: 1rem;
}

@media (min-width: 640px) {
    .shell {
        padding-inline: 1.5rem;
    }
}

.skip-link {
    position: absolute;
    inset-inline-start: 1rem;
    top: -3rem;
    z-index: 50;
    padding: 0.5rem 0.875rem;
    background: rgb(var(--c-accent));
    color: rgb(var(--c-on-accent));
    border-radius: var(--radius);
    font-size: 0.8125rem;
    font-weight: 600;
    transition: top 0.15s;
}

.skip-link:focus {
    top: 0.75rem;
}

.nav-link {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius);
    font-size: 0.8125rem;
    font-weight: 550;
    color: rgb(var(--c-ink-2));
    text-decoration: none;
    white-space: nowrap;
}

.nav-link:hover {
    color: rgb(var(--c-ink));
    background: rgb(var(--c-sunken));
}

.nav-link.is-current {
    color: rgb(var(--c-ink));
    background: rgb(var(--c-sunken));
}

/* --------------------------------------------------------------------------
   Claude
   --------------------------------------------------------------------------
   Claude's own coral, used only where Claude is meant: the nav link, the
   key button and the step numbers on the connect page. */

.nav-claude {
    gap: 0.375rem;
}

.nav-claude img {
    width: 0.875rem;
    height: 0.875rem;
    flex: 0 0 auto;
}

.btn-claude {
    background: #d97757;
    color: #fff;
}

.btn-claude:hover:not(:disabled) {
    background: #c6613f;
}

.connect-hero {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.625rem;
    padding-top: 0.5rem;
}

.connect-logos {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    margin-bottom: 0.25rem;
}

.connect-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 16px;
    border: 1px solid rgb(var(--c-line));
    background: rgb(var(--c-surface));
}

.connect-logo img {
    max-width: 2.25rem;
    max-height: 2.25rem;
}

.connect-plus {
    font-size: 1.25rem;
    color: rgb(var(--c-ink-3));
}

/* Every inline code on the connect page is a command or a path, which reads
   left to right. Isolated, so in Arabic "~/.zshrc" does not come out as
   "zshrc./~" and "/mcp" as "mcp/". Scoped to this page: some articles put
   Arabic inside <code>, and those must keep their own direction. */
#claude-connect code {
    direction: ltr;
    unicode-bidi: isolate;
}

/* Other agents: the tabs sit full width above the panel they switch. */
.agent-tabs { width: 100%; }
.agent-tabs .seg-item { flex: 1; }
.agent-panel { display: flex; flex-direction: column; gap: 0.625rem; }
/* The agents' logos: drawn from one hidden sprite (api/_agent_logos.html). */
.agent-logo-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.agent-logo { width: 1.125rem; height: 1.125rem; flex-shrink: 0; }
.agent-logos { display: inline-flex; align-items: center; gap: 0.25rem; flex-shrink: 0; }
.agent-logos .agent-logo { width: 1.375rem; height: 1.375rem; }
#other-agents .connect-step-head { flex-wrap: wrap; }
.agent-panel[hidden] { display: none; }
#other-agents h3 { margin-top: 0.375rem; }

.connect-step {
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
}

.connect-step-head {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    font-size: 1rem;
    font-weight: 650;
    color: rgb(var(--c-ink));
}

.connect-step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 999px;
    font-size: 0.8125rem;
    font-weight: 700;
    background: #d97757;
    color: #fff;
    flex: 0 0 auto;
}

.connect-step-num-done {
    background: rgb(var(--c-accent));
    color: rgb(var(--c-on-accent));
}

.connect-done {
    border-color: rgb(var(--c-accent) / 0.4);
}

/* A command and its Copy button: the button sits under the command on a
   phone and beside it otherwise, so a long command is never squeezed. */
.code-copy {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
}

/* Wrapped, not scrolled: a command cut off at the edge of a phone screen
   looks complete, and half a command pasted into Claude Code fails. */
.code-copy .code-block {
    margin: 0;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.code-copy .btn {
    align-self: flex-end;
}

.connect-key {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    border: 1px solid rgb(217 119 87 / 0.5);
    background: rgb(217 119 87 / 0.08);
    font-size: 0.8125rem;
    color: rgb(var(--c-ink));
}

.connect-more > summary {
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 600;
    color: rgb(var(--c-ink));
}

[data-copy-target].is-copied {
    color: rgb(var(--c-accent));
    border-color: rgb(var(--c-accent) / 0.5);
}

.balance-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.625rem;
    border-radius: var(--radius);
    border: 1px solid rgb(var(--c-line));
    background: rgb(var(--c-sunken));
    font-size: 0.8125rem;
    text-decoration: none;
}

.initial {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 999px;
    background: rgb(var(--c-accent) / 0.15);
    color: rgb(var(--c-accent));
    font-size: 0.75rem;
    font-weight: 700;
}

.footer-link {
    display: block;
    font-size: 0.8125rem;
    color: rgb(var(--c-ink-2));
    text-decoration: none;
}

.footer-community-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8125rem;
    color: rgb(var(--c-ink-2));
    text-decoration: none;
}

.footer-community-link:hover {
    color: rgb(var(--c-ink));
}

.footer-community-link img {
    width: 1.125rem;
    height: 1.125rem;
}

.footer-socials {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding-top: 0.25rem;
}

.footer-social {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 999px;
    border: 1px solid rgb(var(--c-line));
    color: rgb(var(--c-ink-2));
    transition: color 0.15s, border-color 0.15s;
}

.footer-social:hover {
    color: rgb(var(--c-ink));
    border-color: rgb(var(--c-line-strong));
}

.footer-social svg {
    width: 0.9375rem;
    height: 0.9375rem;
}

.footer-link:hover {
    color: rgb(var(--c-ink));
}

.footer-link.is-current {
    color: rgb(var(--c-accent));
}

/* --------------------------------------------------------------------------
   Home page
   -------------------------------------------------------------------------- */

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3125rem 0.75rem;
    border-radius: 999px;
    border: 1px solid rgb(var(--c-line));
    background: rgb(var(--c-sunken));
    font-size: 0.75rem;
    font-weight: 600;
    color: rgb(var(--c-ink-2));
}

.eyebrow .dot {
    width: 0.4rem;
    height: 0.4rem;
    border-radius: 999px;
    background: rgb(var(--c-accent));
}

.display {
    font-size: 2rem;
    line-height: 1.15;
    font-weight: 700;
    letter-spacing: -0.025em;
    color: rgb(var(--c-ink));
}

@media (min-width: 640px) {
    .display {
        font-size: 2.5rem;
    }
}

.lede {
    font-size: 1rem;
    line-height: 1.6;
    color: rgb(var(--c-ink-2));
    max-width: 38rem;
}

.section-head {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.hero-panel {
    background: rgb(var(--c-surface));
    border: 1px solid rgb(var(--c-line));
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* --------------------------------------------------------------------------
   Logo animation
   --------------------------------------------------------------------------
   A port of the Natiq Studio logo scene to plain SVG + CSS. The authored
   version runs on the Claude Design canvas runtime (React, JSX, a 69 KB editor
   bundle); none of that belongs in a page load, so the four cues are rebuilt
   here as declarative animations on the real logo geometry.

   The timeline, in seconds, matching the authored scenes:
     Draw   0.0 - 1.7   the waveform strokes itself on, tip to tail
     Settle 1.7 - 3.0   the green mark fades in behind it, the whole thing
                        scales down to logo size, the trailing bar draws
     Reveal 3.0 - 3.7   the wordmark fades and rises into place
     Hold   3.7 - 4.8   one slow breath

   Each element carries its own delay, duration and easing rather than sharing
   one keyframe block, so a cue can be retimed without recomputing percentages.
   -------------------------------------------------------------------------- */

.natiq-logo {
    --nl-duration: 5.1s;
    --nl-iterations: 1; /* set to `infinite` to loop the whole scene */
    --nl-ease-out: cubic-bezier(0.215, 0.61, 0.355, 1); /* easeOutCubic  */
    --nl-ease-io: cubic-bezier(0.645, 0.045, 0.355, 1); /* easeInOutCubic */
    --nl-green: #0e8356; /* the logo green, identical to static/img/logo.svg */

    display: block;
    width: 100%;
    height: auto;
}

/* CSS transforms on SVG children default to a bounding-box origin; these two
   lines put them back in user-space coordinates, so the numbers below are the
   same ones the authored scene used. */
.natiq-logo g,
.natiq-logo text {
    transform-box: view-box;
    transform-origin: 0 0;
}

.nl-breathe {
    animation: nl-breathe 1.15s var(--nl-ease-io) 3.95s var(--nl-iterations) both;
}

.nl-mark {
    animation: nl-mark 1.3s var(--nl-ease-io) 1.7s var(--nl-iterations) both;
}

.nl-rect {
    animation: nl-in 0.6s var(--nl-ease-out) 1.7s var(--nl-iterations) both;
}

/* Two copies of the same path: green while it draws on bare canvas, white once
   the green mark is behind it. The crossfade is what makes the line look like
   it was always part of the logo. */
.nl-stroke {
    stroke-width: 32;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 524.2;
    animation: nl-draw 1.7s var(--nl-ease-out) 0s var(--nl-iterations) both;
}

.nl-stroke-lead {
    stroke: var(--nl-green);
    animation:
        nl-draw 1.7s var(--nl-ease-out) 0s var(--nl-iterations) both,
        nl-out 0.6s var(--nl-ease-out) 1.7s var(--nl-iterations) both;
}

.nl-stroke-final {
    stroke: #ffffff;
    animation:
        nl-draw 1.7s var(--nl-ease-out) 0s var(--nl-iterations) both,
        nl-in 0.6s var(--nl-ease-out) 1.7s var(--nl-iterations) both;
}

.nl-bar {
    stroke: #ffffff;
    stroke-width: 32;
    fill: none;
    stroke-linecap: round;
    stroke-dasharray: 70;
    animation:
        nl-draw-bar 0.8s var(--nl-ease-out) 2.2s var(--nl-iterations) both,
        nl-in 0.6s var(--nl-ease-out) 1.7s var(--nl-iterations) both;
}

.nl-word {
    font-family: "Inter", system-ui, sans-serif;
    font-weight: 600;
    font-size: 64px;
    direction: ltr;
}

/* "natiq" arrives first, drifting the short distance out of the mark. */
.nl-word-natiq {
    fill: rgb(var(--c-ink));
    animation: nl-word 0.4s var(--nl-ease-out) 3s var(--nl-iterations) both;
}

/* ".studio" is then swept on left to right by a clip rect - a playhead
   crossing the word rather than a second fade, which is what makes the two
   halves read as one movement instead of two. */
.nl-word-studio {
    fill: rgb(var(--c-accent));
}

.nl-wipe-rect {
    transform-box: fill-box;
    transform-origin: left center;
    animation: nl-wipe 0.6s var(--nl-ease-out) 3.35s var(--nl-iterations) both;
}

@keyframes nl-draw {
    from { stroke-dashoffset: 524.2; }
    to   { stroke-dashoffset: 0; }
}

@keyframes nl-draw-bar {
    from { stroke-dashoffset: 70; }
    to   { stroke-dashoffset: 0; }
}

@keyframes nl-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes nl-out {
    from { opacity: 1; }
    to   { opacity: 0; }
}

/* translate(cx - 200s, cy - 160s) scale(s): the mark stays centred on (cx, cy)
   while it shrinks. It starts centred in the frame at (500, 500) and finishes
   on (296, 500), which parks it to the left of the wordmark. */
@keyframes nl-mark {
    from { transform: translate(200px, 260px) scale(1.5); }
    to   { transform: translate(136px, 372px) scale(0.8); }
}

/* One slow breath on the finished lockup, about the centre of the frame. */
@keyframes nl-breathe {
    0%, 100% { transform: translate(500px, 500px) scale(1) translate(-500px, -500px); }
    50%      { transform: translate(500px, 500px) scale(1.015) translate(-500px, -500px); }
}

@keyframes nl-word {
    from { opacity: 0; transform: translateX(-24px); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes nl-wipe {
    from { transform: scaleX(0); }
    to   { transform: scaleX(1); }
}

/* Reduced motion gets the finished lockup, not a frozen blank first frame. */
@media (prefers-reduced-motion: reduce) {
    .natiq-logo * {
        animation: none !important;
    }
    .nl-stroke,
    .nl-bar {
        stroke-dashoffset: 0;
    }
    .nl-stroke-lead {
        opacity: 0;
    }
    .nl-mark {
        transform: translate(136px, 372px) scale(0.8);
    }
    .nl-wipe-rect {
        transform: scaleX(1);
    }
    .nl-rect,
    .nl-stroke-final,
    .nl-bar,
    .nl-word {
        opacity: 1;
    }
}

.tile {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 1rem;
    border-radius: var(--radius-lg);
    border: 1px solid rgb(var(--c-line));
    background: rgb(var(--c-surface));
}

.tile-value {
    font-size: 1.375rem;
    font-weight: 700;
    color: rgb(var(--c-ink));
}

.tile-label {
    font-size: 0.75rem;
    color: rgb(var(--c-ink-3));
}

.voice-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.375rem;
    padding: 1rem 0.75rem;
    border-radius: var(--radius-lg);
    border: 1px solid rgb(var(--c-line));
    background: rgb(var(--c-surface));
}

.price-figure {
    font-size: 1.75rem;
    font-weight: 700;
    color: rgb(var(--c-ink));
}

.sample-panel {
    background: rgb(var(--c-sunken));
    border: 1px solid rgb(var(--c-line));
    border-radius: var(--radius-lg);
    padding: 1.125rem 1.25rem;
    line-height: 1.9;
}

.faq {
    border-top: 1px solid rgb(var(--c-line));
}

.faq-item {
    border-bottom: 1px solid rgb(var(--c-line));
    padding: 0.875rem 0;
}

.faq-item summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    cursor: pointer;
    list-style: none;
}

.faq-item summary::-webkit-details-marker {
    display: none;
}

.faq-item p {
    margin-top: 0.625rem;
}

.faq-mark {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
    color: rgb(var(--c-ink-3));
    transition: transform 0.15s;
}

.faq-item[open] .faq-mark {
    transform: rotate(180deg);
}

.cta-band {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    border: 1px solid rgb(var(--c-line));
    background: rgb(var(--c-surface));
}

/* Voice chooser: compact trigger and a bounded, accessible modal. */
.studio-accent-label {
    margin-block-start: 1rem;
}

.voice-picker {
    border: 1px solid rgb(var(--c-line));
    border-radius: var(--radius);
    min-width: 0;
}
.voice-picker-summary {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-height: 56px;
    padding: 0.75rem;
    cursor: pointer;
    list-style: none;
}

.voice-picker-selection {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.875rem;
}
.voice-picker-chevron { flex-shrink: 0; }

.voice-picker-options { padding: 0 0.75rem 0.75rem; }

.voice-picker-summary:focus-visible,
.voice-picker .voice-row:focus-within { outline: 2px solid rgb(var(--c-accent)); outline-offset: 2px; }

.voice-picker-summary { width: 100%; background: transparent; color: inherit; text-align: start; border: 0; border-radius: inherit; }
.voice-dialog {
    width: min(560px, calc(100vw - 24px));
    max-height: min(760px, calc(100dvh - 32px));
    margin: auto;
    padding: 0;
    border: 1px solid rgb(var(--c-line));
    border-radius: 16px;
    color: rgb(var(--c-ink));
    background: rgb(var(--c-surface));
    box-shadow: 0 24px 80px rgb(0 0 0 / 0.25);
}
.voice-dialog::backdrop { background: rgb(0 0 0 / 0.5); }
.voice-dialog[open] { display: flex; flex-direction: column; }
.voice-dialog-header { display: flex; justify-content: space-between; align-items: start; gap: 1rem; padding: 1rem; }
.voice-dialog-header .t-muted { margin-top: 0.375rem; }
.voice-dialog .voice-picker-options { min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding-inline: 1rem; }
.voice-dialog #voices-container { max-height: none; overflow: visible; }
.voice-dialog-header, .voice-dialog-footer { flex-shrink: 0; }
.voice-dialog-footer { display: flex; gap: 0.75rem; padding: 1rem; border-top: 1px solid rgb(var(--c-line)); }
.voice-dialog-footer .btn { flex: 1; min-height: 44px; }
@media (max-width: 640px) {
    .voice-dialog { width: calc(100vw - 16px); max-height: calc(100dvh - 24px); }
    .voice-dialog-footer { padding-bottom: max(1rem, env(safe-area-inset-bottom)); }
}

/* Mobile Studio: one compact write / choose / generate flow. */
.studio-compact-option { display: none; }
@media (max-width: 1023px) {
    #tts-form { display: flex; flex-direction: column; gap: 0; }
    #tts-form .studio-script, #tts-form .studio-controls { display: contents; }
    #tts-form .studio-script > *, #tts-form .studio-controls > * { margin-top: 0; margin-bottom: 0; width: 100%; }
    .studio-limits { display: none; }
    /* The panel headings are the two-column layout's way of labelling its
       sides. Here the composer, the tools and the options are one joined card,
       and a heading above it would cut that card in half. The character count
       is still under the box. */
    .studio-panel-head { display: none; }

    /* Where the pricing paragraph used to sit: after the generate button, out
       of the way of the write / choose / generate flow. */
    #tts-form .studio-info { order: 4; margin-top: 1rem; font-size: 11px; line-height: 1.6; }



    /* Pinned to the viewport, exactly as the other tool menus are: the strip it
       would otherwise hang from is only a few pixels tall, and the panel is
       taller than the composer above it. */
    .scriptwriter-panel {
        position: fixed;
        top: auto;
        bottom: 12px;
        inset-inline: 12px;
        z-index: 60;
        max-height: min(72svh, 560px);
        overflow-y: auto;
        overscroll-behavior: contain;
    }
    #tts-form #tts-text.is-expanded { height: 45svh; max-height: 60svh; }
    #tts-form .studio-composer { order: 0; border: 1px solid rgb(var(--c-line)); border-top: 0; border-bottom: 0; border-radius: 0; background: rgb(var(--c-surface)); }
    #tts-form #tts-text {
        display: block;
        height: clamp(150px, 25svh, 220px);
        min-height: 150px;
        max-height: 45svh;
        border: 0;
        border-radius: 0;
        font-size: 16px;
        /* No drag grip: it painted in the bottom-left corner under RTL, over
           the border, and the expand button beside the count does the job. */
        resize: none;
        background: transparent;
    }
    /* The toolbar splits here: the writer goes above the composer, the three
       insert menus stay in their strip below it. Crowding a fourth control into
       that strip cost every label its last few characters. */
    #tts-form .studio-toolbar { display: contents; }
    /* The strip under the composer carries two counts and two icons across a
       phone; at 11px they sit on one line with room to spare. */
    .studio-composer .absolute { font-size: 11px; gap: 0.25rem; }
    /* The width rule above reaches only direct children of .studio-script, and
       the wrapper hands its own children straight to the column instead. */
    #tts-form .studio-toolbar > * { width: 100%; }

    /* "Help me write" is the answer to an empty box, so on a phone it sits
       above the box rather than beside the tools for editing what is already
       there. Full width, and it forms the top of the joined card. */
    #tts-form .scriptwriter {
        order: -1;
        padding: 0.5rem;
        border: 1px solid rgb(var(--c-line));
        border-bottom: 0;
        border-radius: 16px 16px 0 0;
        background: rgb(var(--c-surface));
    }
    #tts-form .scriptwriter > .btn-scriptwriter {
        width: 100%; min-height: 44px; font-size: 13px;
    }

    /* Three across, as before the writer existed: at a third of a phone each
       label still fits whole. */
    #tts-form .studio-tools {
        order: 1; display: grid; grid-template-columns: repeat(3, 1fr);
        align-items: stretch; gap: 0.25rem;
        padding: 0.25rem 0.5rem;
        border-inline: 1px solid rgb(var(--c-line));
        background: rgb(var(--c-surface));
    }
    .studio-tools > * { margin: 0 !important; min-width: 0; }
    .studio-tools > .menu-wrap > .btn {
        width: 100%; padding-inline: 0.35rem; font-size: 11px; min-height: 40px; gap: 0.25rem;
    }
    .studio-tools > .menu-wrap > .btn > span:not([aria-hidden]) {
        overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0;
    }
    .studio-tools .menu { position: fixed; top: auto; inset-inline: 12px; width: auto !important; max-width: calc(100vw - 24px) !important; z-index: 60; }
    #tts-form .studio-options {
        order: 2; display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem;
        padding: 0.5rem 0.75rem 0.75rem;
        background: rgb(var(--c-surface)); border-inline: 1px solid rgb(var(--c-line));
    }
    .studio-options #voice-step { grid-column: 1 / -1; background: rgb(var(--c-sunken)); }
    .studio-options .voice-picker-summary { min-height: 44px; padding: 0.5rem 0.75rem; }
    .studio-options .voice-picker-summary .t-section { font-size: 12px; }
    .studio-desktop-option { display: none; }
    .studio-compact-option { display: block; position: relative; min-width: 0; }
    .studio-dropdown-trigger {
        display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
        /* height:100% so that when one label wraps to two lines the pair still
           reads as a pair, rather than one box standing taller than the other. */
        width: 100%; height: 100%; min-height: 54px; padding: 0.375rem 0.625rem;
        border: 1px solid rgb(var(--c-line)); border-radius: var(--radius);
        background: rgb(var(--c-sunken)); color: rgb(var(--c-ink)); text-align: start;
    }
    .studio-dropdown-copy { display: flex; flex: 1; flex-direction: column; min-width: 0; gap: 0.125rem; }
    /* The chosen option's own mark, so the collapsed row says which pace and
       which job are set without having to be opened. */
    .studio-dropdown-mark {
        display: flex; align-items: center; justify-content: center; flex-shrink: 0;
        width: 34px; height: 34px; border-radius: 9px;
        background: rgb(var(--c-accent) / 0.12); color: rgb(var(--c-accent));
    }
    .studio-dropdown-mark .choice-icon { width: 18px; height: 18px; }
    .studio-dropdown-label { font-size: 10px; color: rgb(var(--c-ink-2)); }
    /* Wrapped to two lines rather than truncated. The mark takes 42px out of
       the row, which at 360px is enough to cost إعلان تجاري its second word -
       and a purpose the user cannot read is worse than a row one line taller.
       Clamped at two so a long label cannot push the strip out of shape. */
    .studio-dropdown-value {
        font-size: 14px;
        line-height: 1.25;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
        overflow: hidden;
        overflow-wrap: anywhere;
    }
    .studio-dropdown-trigger > svg { flex-shrink: 0; color: rgb(var(--c-ink-2)); }
    .studio-dropdown-trigger[aria-expanded="true"] > svg { transform: rotate(180deg); }
    .studio-dropdown-list {
        position: absolute; bottom: calc(100% + 6px); inset-inline: 0; z-index: 65;
        max-height: min(260px, 40svh); overflow-y: auto; overscroll-behavior: contain;
        padding: 0.25rem; border: 1px solid rgb(var(--c-line)); border-radius: var(--radius);
        background: rgb(var(--c-surface)); box-shadow: 0 8px 28px rgb(0 0 0 / 0.18);
    }
    .studio-dropdown-list[hidden] { display: none; }
    .studio-dropdown-option {
        display: flex; align-items: center; justify-content: space-between; gap: 0.375rem;
        width: 100%; min-height: 44px; padding: 0.5rem; border: 0; border-radius: 6px;
        background: transparent; color: rgb(var(--c-ink)); font-size: 14px; text-align: start;
    }
    /* flex-start, not space-between: a mark belongs against its own label, not
       pushed to the far edge of the row by the tick. */
    .studio-dropdown-option { justify-content: flex-start; }
    .studio-dropdown-option > span { overflow-wrap: anywhere; }
    .studio-dropdown-option > .choice-icon { width: 18px; height: 18px; color: rgb(var(--c-ink-3)); }
    .studio-dropdown-option[aria-selected="true"] > .choice-icon { color: rgb(var(--c-accent)); }
    .studio-dropdown-check { flex-shrink: 0; visibility: hidden; margin-inline-start: auto; }
    .studio-dropdown-option[aria-selected="true"] { background: rgb(var(--c-sunken)); font-weight: 600; }
    .studio-dropdown-option[aria-selected="true"] .studio-dropdown-check { visibility: visible; }
    .studio-dropdown-option:hover { background: rgb(var(--c-sunken)); }
    .studio-dropdown-trigger:focus-visible, .studio-dropdown-option:focus-visible {
        outline: 2px solid rgb(var(--c-accent)); outline-offset: -2px;
    }
    .studio-accent-label, .studio-accent { grid-column: 1 / -1; }
    .studio-options .studio-accent { margin: 0; }
    #tts-form #generate-btn {
        order: 3; width: calc(100% - 24px); align-self: center; min-height: 48px;
        margin: 0 12px 12px; border-radius: 10px;
        box-shadow: 0 0 0 12px rgb(var(--c-surface));
    }
    #tts-form #out-of-tokens-banner { order: 5; margin-top: 0.75rem; }
    #tts-form #result-card { order: 6; margin-top: 1rem; }
    #tts-form .studio-recent { order: 8; margin-top: 1rem; }
}

/* Large screens show the voice catalogue directly beside the script. */
.desktop-voice-picker { display: none; }
@media (min-width: 1024px) {
    #voice-picker-open { display: none; }
    .desktop-voice-picker { display: block; }
    .desktop-voice-heading { padding: 0.75rem; }
    .desktop-voice-picker #voices-container { max-height: 340px; overflow-y: auto; }
}

/* --------------------------------------------------------------------------
   Header on a phone, signed in: logo, balance, an icon-only top-up and the
   avatar share the first row and the nav takes the second. Language and
   theme move into the account menu there (.show-phone), which is what buys
   back the row they used to wrap onto.
   -------------------------------------------------------------------------- */
@media (max-width: 639px) {
    .hdr-balance { margin-inline-start: auto; }
}
@media (min-width: 640px) {
    .show-phone { display: none; }
}

/* --------------------------------------------------------------------------
   Studio: voice chips (phones), price on the button, progress, result actions
   -------------------------------------------------------------------------- */
.voice-chips {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}
/* The phone Studio is one column ordered by CSS; the chips go first, above
   the joined write / choose / generate card rather than inside it. */
@media (max-width: 1023px) {
    #tts-form .voice-chips { order: -2; margin-bottom: 0.75rem; }
}
@media (min-width: 1024px) {
    .voice-chips { display: none; }
}
.voice-chips-label {
    font-size: 0.75rem;
}
.voice-chips-row {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    padding-bottom: 0.25rem;
    scrollbar-width: none;
}
.voice-chips-row::-webkit-scrollbar { display: none; }
.voice-chip {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 2.5rem;
    padding: 0.25rem 0.875rem 0.25rem 0.875rem;
    padding-inline-start: 0.375rem;
    border: 1px solid rgb(var(--c-line));
    border-radius: 999px;
    background: rgb(var(--c-surface));
    color: rgb(var(--c-ink));
    font-size: 0.8125rem;
    font-weight: 500;
    transition: border-color 0.15s ease, background 0.15s ease;
}
.voice-chip.is-selected {
    border-color: rgb(var(--c-accent));
    background: rgb(var(--c-accent) / 0.08);
}
.voice-chip-play {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 50%;
    background: rgb(var(--c-sunken));
    color: rgb(var(--c-accent));
}
.voice-chip.is-playing .voice-chip-play {
    background: rgb(var(--c-accent));
    color: #fff;
}
.voice-chip-more {
    padding-inline-start: 0.875rem;
    color: rgb(var(--c-ink-2));
}

.btn-cost[hidden] { display: none; }
.btn-cost {
    font-weight: 400;
    opacity: 0.85;
    margin-inline-start: 0.25rem;
}

/* Busy, the Convert button stays bright and fills from the reading edge. */
#generate-btn { position: relative; overflow: hidden; isolation: isolate; }
#generate-btn.is-busy:disabled { opacity: 1; cursor: progress; }
.gen-progress {
    position: absolute;
    inset-block: 0;
    inset-inline-start: 0;
    width: 0;
    z-index: -1;
    background: rgb(255 255 255 / 0.24);
    pointer-events: none;
}
.gen-progress.is-running {
    width: 90%;
    transition: width var(--gen-seconds, 15s) cubic-bezier(0.2, 0.6, 0.4, 1);
}
.gen-progress.is-done {
    width: 100%;
    opacity: 0;
    transition: width 0.3s ease-out, opacity 0.3s ease-out 0.3s;
}
@media (prefers-reduced-motion: reduce) {
    .gen-progress.is-running { width: 90%; transition: none; }
}

.result-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.result-actions [hidden] { display: none; }
.result-actions .result-reroll { align-self: center; }
.result-reroll-hint {
    margin: 0;
    text-align: center;
    font-size: 0.75rem;
    color: rgb(var(--c-ink-2));
}

/* The two download formats: the format in bold, what it is for underneath.
   The site's card language (sunken fill, 1px line, accent on hover), so the
   pair reads as a choice rather than as two identical grey buttons. */
.download-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}
.download-option {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    min-width: 0;
    padding: 0.625rem 0.75rem;
    border: 1px solid rgb(var(--c-line));
    border-radius: var(--radius);
    background: rgb(var(--c-sunken));
    color: rgb(var(--c-ink));
    text-decoration: none;
    transition: border-color 0.15s, background-color 0.15s;
}
.download-option:hover {
    border-color: rgb(var(--c-accent) / 0.6);
    background: rgb(var(--c-accent) / 0.06);
}
.download-option:focus-visible {
    outline: 2px solid rgb(var(--c-accent));
    outline-offset: 2px;
}
.download-option-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 999px;
    background: rgb(var(--c-accent) / 0.12);
    color: rgb(var(--c-accent));
}
.download-option-copy {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    min-width: 0;
}
.download-option-format {
    font-size: 0.875rem;
    font-weight: 700;
    line-height: 1.2;
    text-align: start;
}
.download-option-hint {
    font-size: 0.75rem;
    line-height: 1.35;
    color: rgb(var(--c-ink-3));
}
.download-options.is-compact .download-option { padding: 0.5rem 0.625rem; gap: 0.5rem; }
.download-options.is-compact .download-option-icon { width: 1.875rem; height: 1.875rem; }
.download-options.is-compact .download-option-format { font-size: 0.8125rem; }

/* "Try another voice" lands here on a wide screen: one soft pulse round the
   voice list so the eye finds where to choose. */
#voice-step.needs-attention { animation: needs-attention 1.6s ease-out 1; }
@keyframes needs-attention {
    0% { box-shadow: 0 0 0 0 rgb(var(--c-accent) / 0.55); }
    100% { box-shadow: 0 0 0 14px rgb(var(--c-accent) / 0); }
}

/* --------------------------------------------------------------------------
   History: the empty state is a door to the Studio
   -------------------------------------------------------------------------- */
.history-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    padding: 3rem 1.5rem;
    text-align: center;
}
.history-empty-mark {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 50%;
    background: rgb(var(--c-accent) / 0.1);
    color: rgb(var(--c-accent));
}
.history-empty .t-body {
    max-width: 28rem;
}

/* --------------------------------------------------------------------------
   First-visit tour (Driver.js), in the site's own colours
   -------------------------------------------------------------------------- */
.driver-popover.natiq-tour {
    background: rgb(var(--c-surface));
    color: rgb(var(--c-ink));
    border: 1px solid rgb(var(--c-line));
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 50px rgb(0 0 0 / 0.35);
    font-family: inherit;
    max-width: 20rem;
}
.natiq-tour .driver-popover-title {
    font-size: 0.9375rem;
    font-weight: 600;
    font-family: inherit;
}
.natiq-tour .driver-popover-description {
    color: rgb(var(--c-ink-2));
    font-size: 0.8125rem;
    line-height: 1.6;
    font-family: inherit;
}
.natiq-tour .driver-popover-progress-text {
    color: rgb(var(--c-ink-3));
    font-size: 0.75rem;
}
.natiq-tour .driver-popover-navigation-btns button {
    font-family: inherit;
    font-size: 0.8125rem;
    border-radius: 8px;
    text-shadow: none;
    padding: 0.375rem 0.75rem;
    background: rgb(var(--c-sunken));
    color: rgb(var(--c-ink));
    border: 1px solid rgb(var(--c-line));
}
.natiq-tour .driver-popover-navigation-btns .driver-popover-next-btn {
    background: rgb(var(--c-accent));
    color: #fff;
    border-color: rgb(var(--c-accent));
}
.natiq-tour .driver-popover-close-btn {
    color: rgb(var(--c-ink-3));
}
.natiq-tour.driver-popover-arrow-side-left.driver-popover-arrow,
.natiq-tour .driver-popover-arrow-side-left.driver-popover-arrow { border-left-color: rgb(var(--c-surface)); }
.natiq-tour .driver-popover-arrow-side-right.driver-popover-arrow { border-right-color: rgb(var(--c-surface)); }
.natiq-tour .driver-popover-arrow-side-top.driver-popover-arrow { border-top-color: rgb(var(--c-surface)); }
.natiq-tour .driver-popover-arrow-side-bottom.driver-popover-arrow { border-bottom-color: rgb(var(--c-surface)); }
[dir="rtl"] .natiq-tour .driver-popover-close-btn { right: auto; left: 0; }
[dir="rtl"] .natiq-tour .driver-popover-navigation-btns button + button { margin-left: 0; margin-right: 4px; }
/* The first stop has nowhere to go back to. */
/* Driver sets an inline display on its buttons, hence !important. */
.natiq-tour .driver-popover-prev-btn.driver-popover-btn-disabled { display: none !important; }

/* --------------------------------------------------------------------------
   Speech to text (/transcribe/)
   --------------------------------------------------------------------------
   Built for a phone first: the record button is a 76px target, every action
   is a full-size button, and the file picker is the whole card, not a link. */

.stt-record {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0 0.25rem;
}

.stt-mic {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 76px;
    height: 76px;
    border-radius: 999px;
    border: 0;
    background: rgb(var(--c-accent));
    color: rgb(var(--c-on-accent));
    /* A soft green halo while idle; recording swaps it for the red pulse. */
    box-shadow: 0 0 0 6px rgb(var(--c-accent) / 0.14), 0 14px 34px -12px rgb(var(--c-accent) / 0.7);
    cursor: pointer;
    transition: background-color 0.15s, transform 0.1s;
    -webkit-tap-highlight-color: transparent;
}

.stt-mic:active {
    transform: scale(0.96);
}

.stt-mic-icon {
    width: 32px;
    height: 32px;
}

.stt-stop-icon {
    display: none;
    width: 28px;
    height: 28px;
}

.stt-mic.is-recording {
    background: rgb(var(--c-danger));
    color: #fff;
    box-shadow: 0 0 0 6px rgb(var(--c-danger) / 0.18);
}

.stt-mic.is-recording .stt-mic-icon {
    display: none;
}

.stt-mic.is-recording .stt-stop-icon {
    display: block;
}

@media (prefers-reduced-motion: no-preference) {
    .stt-mic.is-recording {
        animation: stt-pulse 1.6s ease-in-out infinite;
    }
}

@keyframes stt-pulse {
    0%, 100% { box-shadow: 0 0 0 6px rgb(var(--c-danger) / 0.18); }
    50% { box-shadow: 0 0 0 12px rgb(var(--c-danger) / 0.06); }
}

.stt-timer {
    font-size: 1.125rem;
    font-weight: 600;
    color: rgb(var(--c-ink));
}

.stt-meter {
    width: min(220px, 70%);
    height: 4px;
    border-radius: 999px;
    background: rgb(var(--c-sunken));
    overflow: hidden;
}

.stt-meter span {
    display: block;
    width: 0%;
    height: 100%;
    background: rgb(var(--c-accent));
    transition: width 0.08s linear;
}

.stt-drop {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    min-height: 150px;
    padding: 1.25rem;
    border: 1.5px dashed rgb(var(--c-line-strong));
    border-radius: var(--radius-lg);
    background: rgb(var(--c-sunken));
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s, background-color 0.15s;
}

.stt-drop:hover,
.stt-drop.is-over,
.stt-drop:focus-within {
    border-color: rgb(var(--c-accent));
    background: rgb(var(--c-accent) / 0.06);
}

.stt-drop-icon {
    width: 28px;
    height: 28px;
    color: rgb(var(--c-accent));
}

.stt-drop-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: rgb(var(--c-ink));
}

.stt-picked {
    padding: 0.875rem;
    border: 1px solid rgb(var(--c-line));
    border-radius: var(--radius);
    background: rgb(var(--c-sunken));
}

.stt-picked audio {
    height: 40px;
}

.stt-progress {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    font-size: 0.8125rem;
    color: rgb(var(--c-ink-2));
}

/* display:flex would otherwise beat the hidden attribute. */
.stt-progress[hidden],
.stt-record[hidden] {
    display: none;
}

.stt-spinner {
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
    border-radius: 999px;
    border: 2px solid rgb(var(--c-line-strong));
    border-top-color: rgb(var(--c-accent));
    animation: spin 0.8s linear infinite;
}

.stt-transcript {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    font-size: 1rem;
    line-height: 1.9;
    color: rgb(var(--c-ink));
    padding: 1rem;
    border-radius: var(--radius);
    background: rgb(var(--c-sunken));
    border: 1px solid rgb(var(--c-line));
    max-height: 60vh;
    overflow-y: auto;
}

.stt-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* On a phone the actions stack as full-width buttons: three labels side by
   side would not fit at 360px, and a wrapped half-row is hard to hit. */
@media (max-width: 479px) {
    .stt-actions .btn {
        flex: 1 1 100%;
        padding-top: 0.75rem;
        padding-bottom: 0.75rem;
    }
}

.stt-times summary {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    cursor: pointer;
    font-size: 0.8125rem;
    color: rgb(var(--c-ink-2));
}

.stt-segments {
    margin-top: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.stt-segments li {
    display: flex;
    gap: 0.75rem;
    font-size: 0.875rem;
    line-height: 1.7;
    color: rgb(var(--c-ink));
}

.stt-clock {
    flex: 0 0 auto;
    min-width: 2.75rem;
    font-size: 0.75rem;
    line-height: 1.7rem;
    color: rgb(var(--c-ink-3));
}

.stt-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: inherit;
    text-decoration: none;
}

.stt-row:hover {
    background: rgb(var(--c-sunken));
}

.stt-hero {
    display: grid;
    gap: 1.25rem;
    align-items: center;
}

.stt-hero-copy {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-width: 0;
}

.stt-hero-art {
    width: 100%;
    min-width: 0;
}

.stt-hero-art img {
    width: 100%;
    height: auto;
    aspect-ratio: 560 / 240;
}

@media (min-width: 768px) {
    .stt-hero {
        grid-template-columns: minmax(0, 1fr) minmax(0, 268px);
        gap: 1.75rem;
    }
}

.stt-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.875rem;
}

.stt-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
}

.stt-back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
}

.stt-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 1.75rem 1rem;
    text-align: center;
}

.stt-empty-art {
    width: 160px;
    max-width: 100%;
    height: auto;
    aspect-ratio: 160 / 96;
}

/* --------------------------------------------------------------------------
   On-premise (/on-premise/)
   -------------------------------------------------------------------------- */

.onprem-hero {
    display: grid;
    gap: 1.25rem;
    align-items: center;
}

.onprem-hero-copy {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    min-width: 0;
}

.onprem-hero-art {
    width: 100%;
    min-width: 0;
}

.onprem-hero-art img {
    width: 100%;
    height: auto;
    aspect-ratio: 560 / 360;
}

@media (min-width: 768px) {
    .onprem-hero {
        grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
        gap: 2rem;
    }
}

.onprem-head-icon {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.onprem-head-icon .icon {
    color: rgb(var(--c-accent));
}

.onprem-solutions {
    display: grid;
    gap: 0.75rem;
}

@media (min-width: 768px) {
    .onprem-solutions {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.onprem-solution {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.onprem-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: var(--radius);
    background: rgb(var(--c-accent) / 0.1);
    color: rgb(var(--c-accent));
}

.onprem-icon svg {
    width: 1.25rem;
    height: 1.25rem;
}

.onprem-steps {
    display: grid;
    gap: 0.75rem;
    counter-reset: onprem;
}

.onprem-steps li {
    display: flex;
    gap: 0.75rem;
    font-size: 0.875rem;
    line-height: 1.6;
    color: rgb(var(--c-ink-2));
}

.onprem-steps li::before {
    counter-increment: onprem;
    content: counter(onprem);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 999px;
    border: 1px solid rgb(var(--c-line-strong));
    background: rgb(var(--c-sunken));
    color: rgb(var(--c-ink));
    font-size: 0.75rem;
    font-weight: 700;
}

/* Pricing: the speech-to-text price line, and the on-premise band's title. */
.pricing-stt {
    display: flex;
    justify-content: center;
    align-items: baseline;
    gap: 0.5rem;
    font-size: 0.8125rem;
    color: rgb(var(--c-ink-2));
}

.pricing-stt .icon,
.pricing-onprem-title .icon-md {
    color: rgb(var(--c-accent));
    align-self: center;
}

.pricing-onprem-title {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

@media (min-width: 640px) {
    .pricing-onprem-title {
        justify-content: flex-start;
    }
}

/* The interest choices in the request form: the solution's icon, its name,
   and a check that appears once it is picked - several can be. */
.onprem-choice {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    min-height: 48px;
}

.onprem-choice-icon {
    color: rgb(var(--c-accent));
}

.onprem-choice-label {
    flex: 1;
}

.onprem-choice-check {
    color: rgb(var(--c-accent));
    opacity: 0;
    transition: opacity 0.15s;
}

.choice-input:checked + .onprem-choice .onprem-choice-check {
    opacity: 1;
}

/* Text inputs at 16px on a phone: iOS zooms the page into anything smaller. */
@media (max-width: 640px) {
    #onprem-form .input,
    #onprem-form .select,
    #onprem-form .textarea {
        font-size: 16px;
    }
}

/* Payment help (billing/_payment_help.html): after a declined, cancelled or
   failed payment, a person to ask - Telegram or email. */
.payment-help { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 16px; text-align: start; border-color: rgb(var(--c-accent) / 0.3); }
.payment-help-mark { flex: none; width: 40px; height: 40px; }
.payment-help-copy { flex: 1 1 240px; min-width: 0; }
.payment-help-copy p { margin-top: 4px; line-height: 1.7; }
.payment-help-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.payment-help-actions .btn { min-height: 40px; }
@media (max-width: 479px) {
    .payment-help-actions { width: 100%; }
    .payment-help-actions .btn { flex: 1; }
}

/* Article code blocks are left to right, but a subtitle example holds Darija
   lines: each line takes the direction of its first letter, so an Arabic line
   mixed with French words reads in the right order. */
.article-content pre { unicode-bidi: plaintext; }
