.shell {
    width: min(1200px, calc(100% - 32px));
    margin: 0 auto;
    padding: 28px 0 48px;
}

/* ── Hero ───────────────────────────────────────────────── */
.hero {
    display: flex;
    gap: 24px;
    align-items: end;
    justify-content: space-between;
    margin-bottom: 22px;
}

.hero__content { min-width: 0; }

.hero h1 {
    margin: 0;
    font-size: clamp(2.2rem, 4vw, 3.8rem);
    line-height: 1.3;
    letter-spacing: 0;
}

.hero__copy {
    margin: 0.9rem 0 0;
    max-width: 68ch;
    color: var(--muted);
    font-size: 1.03rem;
    line-height: 1.9;
}

.hero__actions {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.hero__badge {
    align-self: center;
    padding: 0.9rem 1rem;
    border-radius: 999px;
    background: var(--surface-strong);
    border: 1px solid var(--border);
    color: var(--text);
    font-weight: 800;
    white-space: nowrap;
    box-shadow: var(--shadow);
}

/* ── Preset strip ───────────────────────────────────────── */
.preset-strip {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin: 18px 0 22px;
}

.preset-pill {
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.7);
    color: var(--text);
    border-radius: 999px;
    padding: 0.78rem 1rem;
    cursor: pointer;
    transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
    font-weight: 700;
}

html[data-theme="dark"] .preset-pill {
    background: rgba(255, 255, 255, 0.06);
}

.preset-pill:hover { transform: translateY(-1px); }

.preset-pill.is-active {
    background: color-mix(in srgb, var(--accent) 12%, white);
    border-color: color-mix(in srgb, var(--accent) 28%, white);
}

html[data-theme="dark"] .preset-pill.is-active {
    background: rgba(96, 165, 250, 0.12);
}

/* ── کارت‌ها ────────────────────────────────────────────── */
.generator-card,
.batch-card,
.results-card {
    padding: 24px;
    margin-top: 18px;
}

/* ── section-head ───────────────────────────────────────── */
.section-head {
    display: flex;
    gap: 16px;
    align-items: start;
    justify-content: space-between;
    margin-bottom: 18px;
}

.section-head--tight { margin-bottom: 14px; }

.section-head h2 { margin: 0; font-size: 1.25rem; }
.section-head h3 { margin: 0; font-size: 1.08rem; }

.section-head p {
    margin: 0.45rem 0 0;
    color: var(--muted);
    line-height: 1.8;
}

/* گروه دکمه + باقی‌مانده در سمت چپ section-head */
.section-head__actions {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-shrink: 0;
}

.section-head__meta {
    padding: 0.7rem 1rem;
    border-radius: 999px;
    background: color-mix(in srgb, var(--accent) 10%, white);
    color: var(--text);
    font-weight: 800;
    white-space: nowrap;
    transition: background 200ms ease, color 200ms ease;
}

html[data-theme="dark"] .section-head__meta {
    background: rgba(96, 165, 250, 0.12);
}

/* وقتی از سقف گذشت، متر قرمز می‌شود */
.section-head__meta.is-warning {
    background: rgba(239, 68, 68, 0.12);
    color: #dc2626;
}

html[data-theme="dark"] .section-head__meta.is-warning {
    background: rgba(239, 68, 68, 0.18);
    color: #f87171;
}

/* ── خط جداکننده ─────────────────────────────────────────── */
.card-divider {
    height: 1px;
    background: var(--border);
    margin: 26px 0 20px;
}

/* ── output-row ─────────────────────────────────────────── */
.output-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.75rem;
    align-items: center;
}

.output-row--hash {
    grid-template-columns: 1fr auto auto auto;
    margin-top: 14px;
}

.output-row input {
    width: 100%;
    min-height: 58px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.96);
    padding: 0.95rem 1rem;
    font-size: 1rem;
    color: var(--text);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
    direction: ltr;
    text-align: left;
    unicode-bidi: plaintext;
}

/* ── hash-grid ──────────────────────────────────────────── */
.hash-grid {
    display: grid;
    grid-template-columns: 1fr 170px 170px;
    gap: 16px;
    align-items: start;
}

.hash-grid .field--wide { grid-column: 1 / -1; }

/* textarea هش: راست‌چین فارسی */
#hash-input {
    direction: rtl;
    text-align: right;
}

/* ── stats-grid ─────────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-top: 14px;
}

.stat-card {
    padding: 14px 16px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid var(--border);
}

html[data-theme="dark"] .stat-card {
    background: rgba(255, 255, 255, 0.05);
}

.stat-label {
    display: block;
    color: var(--muted);
    font-size: 0.88rem;
    margin-bottom: 0.35rem;
}

.stat-card strong { font-size: 1.02rem; }

/* ── نوار قدرت ──────────────────────────────────────────── */
.strength-track {
    margin-top: 12px;
    height: 12px;
    background: rgba(15, 23, 42, 0.08);
    border-radius: 999px;
    overflow: hidden;
}

html[data-theme="dark"] .strength-track {
    background: rgba(148, 163, 184, 0.12);
}

.strength-fill {
    /* پر شدن از راست به چپ — هم‌جهت با RTL */
    float: right;
    width: 0%;
    height: 100%;
    border-radius: inherit;
    background: #ef4444;
    transition: width 220ms ease, background 220ms ease;
}

/* ── controls-grid ──────────────────────────────────────── */
.controls-grid {
    display: grid;
    gap: 18px;
    margin-top: 18px;
}

.field--wide { grid-column: 1 / -1; }

/* ── اسلایدر طول رمز (RTL) ─────────────────────────────── */
/*
  direction: rtl  ← نقطه‌ی صفر (حداقل) را در سمت راست قرار می‌دهد
  gradient to left ← نوار پرشونده از راست (مقدار صفر) به چپ رشد می‌کند
  هم‌راستا با حرکت دست کاربر در صفحه‌کلید راست‌به‌چپ
*/
.field input[type="range"] {
    width: 100%;
    appearance: none;
    height: 12px;
    border-radius: 999px;
    direction: rtl;
    background: linear-gradient(
        to left,
        var(--range-accent, var(--accent)) 0 var(--range-fill),
        rgba(15, 23, 42, 0.12) var(--range-fill) 100%
    );
    outline: none;
    margin: 0;
    padding: 0;
}

.field input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #fff;
    border: 4px solid var(--range-accent, var(--accent));
    box-shadow: 0 8px 16px rgba(15, 23, 42, 0.14);
    cursor: pointer;
}

.field input[type="range"]::-moz-range-thumb {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #fff;
    border: 4px solid var(--range-accent, var(--accent));
    box-shadow: 0 8px 16px rgba(15, 23, 42, 0.14);
    cursor: pointer;
}

.field input[type="range"]::-moz-range-track {
    height: 12px;
    border-radius: 999px;
    background: transparent;
}

.field strong[data-field="length-value"] {
    display: inline-flex;
    width: fit-content;
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.06);
    color: var(--text);
}

html[data-theme="dark"] .field strong[data-field="length-value"] {
    background: rgba(255, 255, 255, 0.06);
}

/* ── toggle-row ─────────────────────────────────────────── */
.toggle-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.toggle-row--muted .toggle-pill {
    background: rgba(255, 255, 255, 0.56);
}

html[data-theme="dark"] .toggle-row--muted .toggle-pill {
    background: rgba(255, 255, 255, 0.04);
}

/* ── action-row / batch-actions ─────────────────────────── */
.action-row,
.batch-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 18px;
}

/* ── گزینه‌های CSV گروهی ────────────────────────────────── */
.batch-csv-options {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
    margin-top: 18px;
    padding: 16px;
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid var(--border);
}

html[data-theme="dark"] .batch-csv-options {
    background: rgba(255, 255, 255, 0.04);
}

.batch-hash-fields {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: end;
}

.batch-hash-fields .field {
    min-width: 180px;
}

/* ── profile-list ───────────────────────────────────────── */
.profile-list { display: grid; gap: 16px; }

.profile-row { padding: 18px; }

.profile-row__top,
.profile-row__grid {
    display: grid;
    gap: 12px;
    grid-template-columns: 1fr 220px auto;
    align-items: end;
}

.profile-row__grid {
    grid-template-columns: 1fr 220px;
    margin-top: 14px;
}

/* ── results-preview ────────────────────────────────────── */
.results-preview {
    display: grid;
    gap: 10px;
    margin-top: 18px;
}

.results-preview ul {
    margin: 0;
    padding-inline-start: 1.3rem;
    display: grid;
    gap: 6px;
    line-height: 2;
    color: var(--muted);
}

.results-preview li strong { color: var(--text); }

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 980px) {
    .hero {
        align-items: start;
        flex-direction: column;
    }

    .hero__badge { align-self: flex-start; }

    .hash-grid,
    .output-row--hash,
    .profile-row__top,
    .profile-row__grid,
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .batch-csv-options { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 560px) {
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .output-row {
        grid-template-columns: 1fr;
    }

    .output-row .btn {
        width: 100%;
    }

    .section-head {
        flex-direction: column;
    }

    .section-head__actions {
        width: 100%;
        justify-content: space-between;
    }
}

