﻿/* Page styles, lifted from design/home.html and design/not-found.html. */

/* Home */
    .hero {
      position: relative; overflow: hidden; isolation: isolate;
      background: var(--hero-bg); color: var(--hero-text);
      padding-block: var(--space-16) var(--space-20);
    }
    .hero__pattern { position: absolute; inset: 0; z-index: -1; width: 100%; height: 100%; color: var(--hero-pattern); }
    .hero__inner { display: grid; gap: var(--space-8); max-width: 46rem; }
    .hero h1 { font-size: clamp(var(--text-2xl), 5vw + 0.5rem, var(--text-4xl)); font-weight: var(--weight-black); letter-spacing: -0.01em; }
    .hero__lead { color: var(--hero-muted); font-size: var(--text-md); max-width: 38rem; }
    .hero__lead .ltr { color: var(--hero-text); font-weight: var(--weight-medium); }

    .shortener { display: grid; gap: var(--space-3); }
    .shortener label { font-weight: var(--weight-medium); color: var(--hero-text); }
    .shortener__row {
      display: flex; gap: var(--space-2); padding: var(--space-2);
      background: var(--color-surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
    }
    .shortener__row .input { border: 0; min-height: 52px; font-size: var(--text-md); background: transparent; }
    .shortener__row .input:focus-visible { box-shadow: none; }
    .shortener__row:focus-within { box-shadow: var(--shadow-lg), 0 0 0 3px var(--hero-bg), 0 0 0 5px var(--color-accent); }
    .shortener__row .btn { border-radius: calc(var(--radius-lg) - var(--space-2)); }
    .shortener__note { font-size: var(--text-sm); color: var(--hero-muted); }
    .shortener__note a { color: var(--hero-text); }

    .result {
      display: grid; grid-template-columns: 1fr auto; gap: var(--space-5);
      padding: var(--space-6); background: var(--color-surface); color: var(--color-text);
      border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
      animation: result-in var(--duration-3) var(--ease-out);
    }
    @keyframes result-in { from { opacity: 0; transform: translateY(10px); } }
    .result__label { display: flex; align-items: center; gap: var(--space-2); font-size: var(--text-sm); color: var(--color-success); font-weight: var(--weight-medium); }
    .result__label svg { width: 18px; height: 18px; }
    .result__dest { font-size: var(--text-sm); color: var(--color-text-subtle); }
    .result__actions { display: flex; gap: var(--space-2); flex-wrap: wrap; }

    /* Signature: the short link set large, saffron underline */
    .shortlink {
      display: inline-block; font-size: clamp(var(--text-xl), 4vw, var(--text-3xl)); font-weight: var(--weight-black);
      color: var(--color-text); line-height: 1.3; text-decoration: none; letter-spacing: -0.01em;
      background: linear-gradient(var(--color-accent), var(--color-accent)) no-repeat left 92% / 100% 0.14em;
      padding-block-end: 0.12em;
    }
    .shortlink__code { color: var(--color-primary); }
    .shortlink:hover { color: var(--color-text); background-size: 100% 0.22em; }

    .section { padding-block: var(--space-16); }
    .section h2 { font-size: var(--text-xl); margin-block-end: var(--space-2); }
    .section__lead { color: var(--color-text-muted); max-width: 40rem; margin-block-end: var(--space-8); }
    .features { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-8) var(--space-6); list-style: none; padding: 0; }
    .feature svg { width: 28px; height: 28px; color: var(--color-primary); margin-block-end: var(--space-3); }
    .feature h3 { font-size: var(--text-md); margin-block-end: var(--space-1); }
    .feature p { color: var(--color-text-muted); font-size: var(--text-sm); line-height: var(--leading-body); }

    .api-teaser { display: grid; grid-template-columns: 1fr 1.2fr; gap: var(--space-8); align-items: center; border-block-start: 1px solid var(--color-border); }
    .cta-row { display: flex; gap: var(--space-3); flex-wrap: wrap; margin-block-start: var(--space-5); }

    @media (max-width: 760px) {
      .hero { padding-block: var(--space-10) var(--space-12); }
      .shortener__row { flex-direction: column; border-radius: var(--radius-md); }
      .shortener__row .btn { border-radius: var(--radius-sm); }
      .result { grid-template-columns: 1fr; padding: var(--space-5); }
      .result .qr { justify-self: start; }
      .features, .api-teaser { grid-template-columns: 1fr; }
      .site-nav .btn--ghost.hide-sm { display: none; }
    }

/* Link unavailable */
    .nf { min-height: 100dvh; display: grid; grid-template-rows: auto 1fr auto; }
    .nf__main { display: grid; place-items: center; padding: var(--space-12) var(--space-5); }
    .nf__box { max-width: 34rem; display: grid; justify-items: center; text-align: center; gap: var(--space-5); }
    .nf__art { width: 120px; height: 120px; color: var(--color-primary); }
    .nf__code {
      font-size: var(--text-xl); font-weight: var(--weight-bold); color: var(--color-text-muted);
      text-decoration: line-through; text-decoration-color: var(--color-accent); text-decoration-thickness: 3px;
    }
    .nf h1 { font-size: var(--text-2xl); }
    .nf p { color: var(--color-text-muted); }
    .nf__actions { display: flex; gap: var(--space-3); flex-wrap: wrap; justify-content: center; }
    .nf__report { font-size: var(--text-sm); }

/* Sign-in (design/login.html) */

    .steps-meta { font-size: var(--text-sm); color: var(--color-text-subtle); }
    .sent-to { color: var(--color-text-muted); }
    .sent-to .ltr { color: var(--color-text); font-weight: var(--weight-bold); }

    /* Phone: LTR digits, fixed +98 hint is not shown — Iranians type 09… */
    .input--phone { font-size: var(--text-md); letter-spacing: 0.04em; }

    /* OTP: one real field (paste + SMS autofill work), drawn as boxes */
    .otp {
      --len: 6; --box: 3rem; --gap: 0.5rem;
      position: relative; width: calc(var(--len) * var(--box) + (var(--len) - 1) * var(--gap)); max-width: 100%;
      direction: ltr; margin-inline: auto;
    }
    .otp__boxes { display: flex; gap: var(--gap); pointer-events: none; }
    .otp__box {
      flex: 1; height: 3.5rem; display: grid; place-items: center;
      border: 1px solid var(--color-border-strong); border-radius: var(--radius-sm); background: var(--color-surface);
      font-size: var(--text-xl); font-weight: var(--weight-bold); font-variant-numeric: tabular-nums;
      transition: border-color var(--duration-1), box-shadow var(--duration-1);
    }
    .otp__input {
      position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; border: 0; padding: 0;
      font-size: 16px; /* stops iOS zoom */ caret-color: transparent;
    }
    .otp__input:focus-visible ~ .otp__boxes .otp__box.is-current { border-color: var(--color-focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-focus) 30%, transparent); }
    .otp__input:focus-visible ~ .otp__boxes .otp__box.is-current:empty::after { content: ""; width: 2px; height: 1.4rem; background: var(--color-text); animation: blink 1s steps(1) infinite; }
    @keyframes blink { 50% { opacity: 0; } }
    .otp.is-invalid .otp__box { border-color: var(--color-danger); border-width: 2px; }
    .otp.is-disabled .otp__box { background: var(--color-surface-2); border-color: var(--color-border); color: var(--color-text-subtle); }
    .otp.is-disabled .otp__input { cursor: not-allowed; }
    @media (max-width: 380px) { .otp { --box: 2.6rem; --gap: 0.375rem; } }

    .resend { display: flex; align-items: center; justify-content: center; gap: var(--space-2); font-size: var(--text-sm); color: var(--color-text-muted); min-height: 36px; }
    .resend svg { width: 18px; height: 18px; }
    .linkish { background: none; border: 0; padding: 0; color: var(--color-primary); cursor: pointer; font-size: inherit; text-decoration: underline; text-underline-offset: 0.25em; }
    .linkish:hover { color: var(--color-primary-hover); }


/* Dashboard (design/dashboard.html) */
    .new-link { margin-block-end: var(--space-8); }
    .new-link__grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-5); }
    .new-link__grid .span-2 { grid-column: 1 / -1; }
    .avail { display: flex; align-items: center; gap: var(--space-1); font-size: var(--text-sm); color: var(--color-success); font-weight: var(--weight-medium); }
    .avail svg { width: 16px; height: 16px; stroke-width: 2.4; }

    .toolbar { display: flex; gap: var(--space-3); flex-wrap: wrap; align-items: center; padding: var(--space-4) var(--space-5); }
    .toolbar .search { flex: 1 1 16rem; }
    .toolbar .select { width: auto; min-width: 10rem; }

    .link-cell { display: grid; gap: 2px; min-width: 0; max-width: 26rem; }
    .link-cell__short { font-weight: var(--weight-bold); color: var(--color-text); text-decoration: none; font-size: var(--text-base); }
    .link-cell__short:hover { color: var(--color-primary); }
    .link-cell__dest { color: var(--color-text-subtle); font-size: var(--text-xs); }
    .clicks { font-weight: var(--weight-bold); }

    .pager { display: flex; align-items: center; gap: var(--space-2); justify-content: space-between; padding: var(--space-3) var(--space-5); border-block-start: 1px solid var(--color-border); font-size: var(--text-sm); }

    .qr-modal .qr { width: 220px; height: 220px; margin-inline: auto; }

    @media (max-width: 760px) {
      .new-link__grid { grid-template-columns: 1fr; }
      .toolbar { padding: var(--space-4); }
      .toolbar .segmented { overflow-x: auto; max-width: 100%; }
      .link-cell { max-width: none; }
      .table--stack td.link-td::before { display: none; }
    }
    .new-link__grid .span-full { grid-column: 1 / -1; }
    .actions form { display: contents; }
    .link-cell__lock { inline-size: 14px; block-size: 14px; color: var(--color-text-subtle); vertical-align: -2px; }

/* Link statistics (design/link-stats.html) */
    .back { display: inline-flex; align-items: center; gap: var(--space-1); font-size: var(--text-sm); color: var(--color-text-muted); text-decoration: none; margin-block-end: var(--space-3); }
    .back svg { width: 18px; height: 18px; }
    .back:hover { color: var(--color-text); }

    .link-head { display: flex; gap: var(--space-4); align-items: flex-start; flex-wrap: wrap; margin-block-end: var(--space-6); }
    .link-head__main { flex: 1 1 22rem; min-width: 0; display: grid; gap: var(--space-1); }
    .link-head h1 { font-size: var(--text-2xl); font-weight: var(--weight-black); }
    .link-head h1 .shortlink__code { color: var(--color-primary); }
    .link-head__dest { display: flex; gap: var(--space-2); align-items: center; color: var(--color-text-muted); font-size: var(--text-sm); min-width: 0; }
    .link-head__dest svg { width: 16px; height: 16px; flex: none; }
    .meta { display: flex; gap: var(--space-2) var(--space-5); flex-wrap: wrap; align-items: center; font-size: var(--text-sm); color: var(--color-text-muted); margin-block-start: var(--space-2); }

    .filters { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; margin-block-end: var(--space-5); }

    .kpis { display: grid; grid-template-columns: repeat(4, 1fr); margin-block-end: var(--space-6); }
    .kpi { padding: var(--space-5); display: grid; gap: var(--space-1); }
    .kpi + .kpi { border-inline-start: 1px solid var(--color-border); }
    .kpi__label { font-size: var(--text-sm); color: var(--color-text-muted); }
    .kpi__value { font-size: var(--text-2xl); font-weight: var(--weight-bold); line-height: 1.2; }
    .kpi__note { font-size: var(--text-xs); color: var(--color-text-subtle); }

    .chart { position: relative; }
    .chart svg { width: 100%; height: auto; overflow: visible; }
    .chart text { font-family: var(--font-sans); font-size: 11px; fill: var(--color-text-subtle); }
    .chart .grid { stroke: var(--chart-grid); stroke-width: 1; }
    .chart .bar { fill: var(--chart-bar); }
    .chart .hit { fill: transparent; cursor: pointer; outline: none; }
    .chart .hit:hover + .bar, .chart .hit:focus + .bar { fill: var(--chart-bar-hover); }
    .chart .hit:focus-visible { stroke: var(--color-focus); stroke-width: 2; }
    .chart__tip {
      position: absolute; transform: translate(-50%, calc(-100% - 8px)); pointer-events: none; white-space: nowrap;
      padding: var(--space-1) var(--space-3); border-radius: var(--radius-sm);
      background: var(--color-text); color: var(--color-bg); font-size: var(--text-xs); font-weight: var(--weight-medium); box-shadow: var(--shadow-md);
    }
    .table-toggle { margin-block-start: var(--space-4); font-size: var(--text-sm); }
    .table-toggle summary { cursor: pointer; color: var(--color-primary); width: fit-content; }
    .table-toggle .table { margin-block-start: var(--space-3); }

    .breakdowns { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-5); margin-block-start: var(--space-6); }
    .bar-list { list-style: none; padding: 0; display: grid; gap: var(--space-4); }
    .bar-list__row { display: flex; align-items: baseline; gap: var(--space-2); font-size: var(--text-sm); margin-block-end: 6px; }
    .bar-list__name { flex: 1; min-width: 0; display: flex; align-items: center; gap: var(--space-2); }
    .bar-list__name svg { width: 18px; height: 18px; color: var(--color-text-muted); flex: none; }
    .bar-list__value { font-weight: var(--weight-bold); }
    .bar-list__pct { color: var(--color-text-subtle); font-size: var(--text-xs); min-width: 3.2em; text-align: end; }
    .bar-list__track { height: 8px; border-radius: var(--radius-xs); background: var(--chart-track); overflow: hidden; }
    .bar-list__fill { height: 100%; width: var(--w); background: var(--chart-bar); border-radius: var(--radius-xs); }

    @media (max-width: 1100px) { .breakdowns { grid-template-columns: 1fr 1fr; } }
    @media (max-width: 760px) {
      .kpis { grid-template-columns: 1fr 1fr; }
      .kpi:nth-child(3) { border-inline-start: 0; }
      .kpi:nth-child(n+3) { border-block-start: 1px solid var(--color-border); }
      .kpi__value { font-size: var(--text-xl); }
      .breakdowns { grid-template-columns: 1fr; }
      .link-head h1 { font-size: var(--text-xl); }
    }
    .qr-preview { display: block; width: 220px; height: 220px; margin-inline: auto; border-radius: var(--radius-sm); background: #fff; }

/* API keys (design/api-keys.html) */
    .create-key { display: flex; gap: var(--space-3); align-items: flex-end; flex-wrap: wrap; }
    .create-key .field { flex: 1 1 18rem; }
    .new-key { margin-block-end: var(--space-6); border: 2px solid var(--color-primary); }
    .new-key .card__body { display: grid; gap: var(--space-4); }
    .new-key .copy-field { padding-block: var(--space-2); }
    .new-key .copy-field code { font-size: var(--text-base); font-weight: var(--weight-medium); }
    .key-prefix { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: var(--text-sm); color: var(--color-text-muted); }
    .grid-2 { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-6); }
  
