@font-face {
    font-family: "Vazirmatn";
    src: url("fonts/Vazirmatn-400.ttf") format("truetype");
    font-style: normal;
    font-weight: 400;
    font-display: swap;
}
@font-face {
    font-family: "Vazirmatn";
    src: url("fonts/Vazirmatn-500.ttf") format("truetype");
    font-style: normal;
    font-weight: 500;
    font-display: swap;
}
@font-face {
    font-family: "Vazirmatn";
    src: url("fonts/Vazirmatn-700.ttf") format("truetype");
    font-style: normal;
    font-weight: 700;
    font-display: swap;
}
@font-face {
    font-family: "Vazirmatn";
    src: url("fonts/Vazirmatn-800.ttf") format("truetype");
    font-style: normal;
    font-weight: 800;
    font-display: swap;
}

:root {
    --bg: #f3f6f2;
    --surface: #ffffff;
    --surface-2: #f7faf7;
    --ink: #18241f;
    --muted: #66746d;
    --line: #dce5df;
    --primary: #176b4d;
    --primary-dark: #0f5139;
    --primary-soft: #e5f3ec;
    --accent: #dca743;
    --danger: #b63a3a;
    --danger-soft: #fff0f0;
    --success: #176b4d;
    --shadow: 0 16px 45px rgba(27, 54, 42, .08);
    --radius: 18px;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); -webkit-text-size-adjust: 100%; }
body {
    min-height: 100vh;
    margin: 0;
    color: var(--ink);
    background:
        radial-gradient(circle at 93% 7%, rgba(220, 167, 67, .10), transparent 24rem),
        radial-gradient(circle at 5% 20%, rgba(23, 107, 77, .08), transparent 30rem),
        var(--bg);
    font-family: "Vazirmatn", Tahoma, "Segoe UI", Arial, sans-serif;
    line-height: 1.65;
    overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.topbar {
    min-height: 78px;
    padding: 12px clamp(18px, 4vw, 60px);
    display: flex;
    align-items: center;
    gap: 28px;
    position: sticky;
    top: 0;
    z-index: 20;
    border-bottom: 1px solid rgba(220, 229, 223, .85);
    background: rgba(255, 255, 255, .90);
    backdrop-filter: blur(14px);
}

.brand { display: flex; align-items: center; gap: 12px; min-width: max-content; }
.brand-mark {
    width: 44px; height: 44px; display: grid; place-items: center;
    color: white; background: linear-gradient(145deg, var(--primary), #24845f);
    border-radius: 14px; font: 800 22px/1 "Vazirmatn", "Segoe UI", sans-serif;
    box-shadow: 0 8px 22px rgba(23, 107, 77, .24);
}
.brand strong, .brand small { display: block; }
.brand strong { font-size: 16px; letter-spacing: .2px; }
.brand small { color: var(--muted); font-size: 11px; margin-top: -2px; }

.nav { display: flex; gap: 5px; align-items: center; }
.nav a { padding: 9px 14px; border-radius: 10px; color: #526059; font-size: 14px; }
.nav a:hover, .nav a.active { background: var(--primary-soft); color: var(--primary-dark); }
.user-menu { margin-right: auto; display: flex; align-items: center; gap: 14px; }
.logout-form { margin: 0; }
.user-menu span { text-align: left; }
.user-menu strong, .user-menu small { display: block; }
.user-menu strong { font-size: 13px; }
.user-menu small { font-size: 11px; color: var(--muted); }

.page-shell { width: min(1460px, calc(100% - 40px)); margin: 34px auto 70px; }
.footer { text-align: center; padding: 22px; color: var(--muted); font-size: 12px; }

.card {
    background: var(--surface);
    border: 1px solid rgba(220, 229, 223, .9);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.card h1, .card h2 { margin-top: 0; }
.card h2 { font-size: 18px; margin-bottom: 20px; }

.hero { display: flex; justify-content: space-between; align-items: center; gap: 35px; margin-bottom: 28px; }
.hero h1, .detail-heading h1 { margin: 4px 0 7px; font-size: clamp(27px, 4vw, 43px); letter-spacing: -.8px; }
.hero p, .detail-heading p, .section-heading p { margin: 0; color: var(--muted); }
.eyebrow { color: var(--primary); font-size: 12px; font-weight: 700; letter-spacing: .3px; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(105px, 1fr)); background: rgba(255,255,255,.75); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.stats div { padding: 17px 20px; text-align: center; border-left: 1px solid var(--line); }
.stats div:last-child { border-left: 0; }
.stats strong, .stats span { display: block; }
.stats strong { font: 700 23px/1.2 "Vazirmatn", Tahoma, sans-serif; color: var(--primary-dark); }
.stats span { color: var(--muted); font-size: 11px; margin-top: 6px; white-space: nowrap; }

.workspace-grid { display: grid; grid-template-columns: 330px minmax(0, 1fr); gap: 24px; align-items: start; }
.module-picker { padding: 20px; position: sticky; top: 102px; max-height: calc(100vh - 125px); overflow: auto; }
.module-picker h2 { margin: 0 3px 13px; }
.module-list { display: grid; gap: 7px; }
.module-list a { padding: 11px 13px; border: 1px solid transparent; border-radius: 12px; transition: .15s ease; }
.module-list a:hover { background: var(--surface-2); border-color: var(--line); }
.module-list a.selected { background: var(--primary-soft); border-color: #b9dcca; color: var(--primary-dark); }
.module-list span, .module-list small { display: block; }
.module-list span { font-size: 13px; font-weight: 700; }
.module-list small { color: var(--muted); font-size: 10px; line-height: 1.45; margin-top: 3px; }

.generator-card { padding: clamp(22px, 4vw, 40px); }
.section-heading { padding-bottom: 22px; border-bottom: 1px solid var(--line); margin-bottom: 24px; }
.section-heading h2 { font-size: 25px; margin: 3px 0 3px; }

fieldset { border: 0; padding: 0; margin: 0 0 28px; }
legend { width: 100%; padding: 0 0 12px; margin-bottom: 15px; border-bottom: 1px dashed var(--line); font-size: 13px; font-weight: 700; color: #47564f; }
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 17px; }
.field { min-width: 0; }
.field label { display: block; margin: 0 2px 7px; font-size: 12px; font-weight: 700; color: #435149; }
.field input, .field select, .field textarea, .reset-form input {
    width: 100%; min-height: 45px; padding: 10px 12px;
    color: var(--ink); background: #fbfdfb; border: 1px solid #cfdad3; border-radius: 10px;
    outline: 0; transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.field textarea { resize: vertical; min-height: 88px; }
.field input:focus, .field select:focus, .field textarea:focus, .reset-form input:focus { background: #fff; border-color: #57a685; box-shadow: 0 0 0 3px rgba(23, 107, 77, .10); }
.customer-name-field { position: relative; z-index: 8; }
.customer-name-input-wrap { position: relative; }
.customer-name-input-wrap input { padding-left: 104px; }
.customer-clear {
    position: absolute; left: 6px; top: 6px; bottom: 6px; padding: 0 10px;
    border: 0; border-radius: 7px; color: var(--primary-dark); background: var(--primary-soft);
    font-size: 10px; font-weight: 700;
}
.customer-picker.has-selected-customer .field input[readonly] { color: var(--primary-dark); background: #edf7f1; border-color: #acd2bd; cursor: default; }
.customer-suggestions {
    position: absolute; z-index: 30; top: 73px; right: 0; left: 0; max-height: 310px; overflow: auto;
    padding: 6px; border: 1px solid #bdd0c4; border-radius: 12px; background: #fff;
    box-shadow: 0 18px 38px rgba(27, 54, 42, .17);
}
.customer-suggestion { display: block; width: 100%; padding: 10px 11px; border: 0; border-radius: 8px; color: var(--ink); background: transparent; text-align: right; }
.customer-suggestion:hover, .customer-suggestion.active { background: var(--primary-soft); }
.customer-suggestion strong, .customer-suggestion span { display: block; }
.customer-suggestion strong { font-size: 13px; }
.customer-suggestion span { margin-top: 2px; color: var(--muted); font-size: 10px; direction: rtl; }
.customer-suggestion-empty { padding: 13px 11px; color: var(--muted); font-size: 11px; }
.quick-values { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 9px; }
.quick-value { min-height: 32px; padding: 5px 11px; border: 1px solid #cad8d0; border-radius: 9px; background: #fff; color: #435149; font-size: 11px; font-weight: 700; transition: .16s ease; }
.quick-value:hover { border-color: #83ae99; color: var(--primary); }
.quick-value.selected { border-color: var(--primary); background: #eaf5ef; color: var(--primary-dark); box-shadow: 0 0 0 2px rgba(23, 107, 77, .07); }
.password-reset-preview { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 14px 20px; padding: 17px 18px; border: 1px dashed #9abbaa; border-radius: 12px; background: #f5faf7; }
.password-reset-preview span, .password-reset-preview strong { display: block; }
.password-reset-preview > div > span { color: var(--primary); font-size: 10px; font-weight: 700; }
.password-reset-preview > div > strong { margin-top: 2px; color: var(--primary-dark); font-size: 14px; }
.password-reset-preview p { margin: 5px 0 0; color: var(--muted); font-size: 11px; }
.password-reset-preview-result { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 5px 14px; padding: 13px 15px; border-radius: 10px; background: #e8f5ee; }
.password-reset-preview-result > span { color: var(--muted); font-size: 10px; }
.password-reset-preview-result > strong { grid-column: 1; color: var(--primary-dark); font: 800 24px/1.3 "Vazirmatn", Tahoma, sans-serif; }
.password-reset-preview-result .button { grid-column: 2; grid-row: 1 / span 2; }
.password-reset-preview-result small { grid-column: 1 / -1; color: #557065; font-size: 9px; }
.password-reset-sms-notice { grid-column: 1 / -1; padding: 10px 13px; border: 1px solid; border-radius: 9px; font-size: 11px; }
.password-reset-sms-notice.success { color: var(--primary-dark); border-color: #b8ddc9; background: #e8f6ee; }
.password-reset-sms-notice.error { color: #8e2828; border-color: #efc1c1; background: var(--danger-soft); }
.password-reset-sms-notice.inactive { color: #725c2e; border-color: #e4d3a9; background: #fffaf0; }
.help { display: block; color: var(--muted); font-size: 10px; margin: 5px 3px 0; }
.checkbox-field { display: flex; align-items: end; min-height: 70px; }
.checkbox-label { display: flex !important; align-items: center; gap: 10px; min-height: 45px; width: 100%; padding: 9px 12px; border: 1px solid #cfdad3; border-radius: 10px; background: #fbfdfb; }
.checkbox-label input { width: 18px; min-height: 18px; height: 18px; accent-color: var(--primary); }
.is-hidden { display: none !important; }

.customer-filter-card { margin-bottom: 20px; }
.customer-admin-list { display: grid; gap: 14px; }
.customer-admin-row { position: relative; padding: 20px 22px; }
.customer-admin-row.inactive { opacity: .65; }
.customer-admin-summary { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.customer-admin-summary strong, .customer-admin-summary span { display: block; }
.customer-admin-summary strong { font-size: 16px; }
.customer-admin-summary span, .customer-admin-summary small { color: var(--muted); font-size: 11px; }
.customer-admin-row details { margin-top: 13px; border-top: 1px solid var(--line); padding-top: 11px; }
.customer-admin-row summary { width: fit-content; color: var(--primary); font-size: 12px; font-weight: 700; cursor: pointer; }
.customer-admin-form { display: grid; grid-template-columns: 2fr 1fr 1fr auto; align-items: end; gap: 10px; margin-top: 13px; }
.customer-merge-form { display: grid; grid-template-columns: minmax(240px, 1fr) auto; align-items: end; gap: 10px; margin-top: 13px; }
.customer-toggle-form { position: absolute; left: 22px; bottom: 18px; }

.form-actions { display: flex; align-items: center; gap: 18px; padding-top: 20px; border-top: 1px solid var(--line); }
.form-actions span { color: var(--muted); font-size: 12px; }
.button {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    min-height: 42px; padding: 9px 17px; border: 1px solid #cfdad3; border-radius: 10px;
    color: var(--ink); background: white; font-weight: 700; font-size: 13px; transition: .15s ease;
}
.button:hover { transform: translateY(-1px); border-color: #aebdb4; }
.button.primary { color: white; border-color: var(--primary); background: linear-gradient(145deg, var(--primary), var(--primary-dark)); box-shadow: 0 8px 18px rgba(23,107,77,.17); }
.button.ghost { background: transparent; }
.button.small { min-height: 34px; padding: 6px 11px; font-size: 11px; }
.button.wide { width: 100%; }

.alert { padding: 13px 16px; margin-bottom: 20px; border: 1px solid; border-radius: 12px; font-size: 13px; }
.alert.error { color: #8e2828; background: var(--danger-soft); border-color: #efc1c1; }
.alert.success { color: #0f5b3f; background: #e9f7ef; border-color: #bce2cc; }

.auth-card { width: min(470px, 100%); margin: 65px auto; padding: clamp(25px, 5vw, 43px); }
.auth-card h1 { font-size: 28px; margin: 4px 0 7px; }
.auth-card > p { color: var(--muted); margin-top: 0; }
.stack-form { display: grid; gap: 16px; margin-top: 24px; }

.detail-heading { display: flex; justify-content: space-between; align-items: end; gap: 25px; margin-bottom: 25px; }
.detail-heading .actions { display: flex; gap: 8px; }
.result-card { padding: 29px; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 8px 20px; margin-bottom: 23px; border-right: 5px solid var(--accent); }
.result-card span { color: var(--muted); font-size: 12px; }
.result-card strong { grid-column: 1; font: 800 clamp(30px, 5vw, 55px)/1.2 "Vazirmatn", Tahoma, sans-serif; letter-spacing: 1px; overflow-wrap: anywhere; }
.result-card > .result-actions { grid-row: 1 / span 2; grid-column: 2; }
.serial-results-card { padding: clamp(22px, 4vw, 34px); margin-bottom: 23px; border-right: 5px solid var(--accent); }
.serial-results-card .section-heading { margin-bottom: 18px; padding-bottom: 16px; }
.serial-results-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.serial-results-grid article { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; align-items: center; padding: 16px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface-2); }
.serial-results-grid article.lock-result { background: #fff9ec; border-color: #ead29f; }
.serial-results-grid span { color: var(--muted); font-size: 11px; }
.serial-results-grid strong { grid-column: 1; color: var(--primary-dark); font: 800 clamp(20px, 3vw, 30px)/1.3 "Vazirmatn", Tahoma, sans-serif; overflow-wrap: anywhere; }
.serial-results-grid .result-actions { grid-column: 2; grid-row: 1 / span 2; }
.result-actions { display: flex; align-items: center; gap: 7px; }
.result-actions form { margin: 0; }
.sms-result-button { min-width: 48px; color: var(--primary-dark); border-color: #9ec9b2; background: #edf8f2; letter-spacing: .2px; }
.sms-result-button:hover { border-color: var(--primary); background: var(--primary-soft); }
.sms-result-button:disabled { color: #819089; border-color: #d4ddd7; background: #f1f4f2; }
.result-sms-hint { width: fit-content; margin: -13px 5px 22px 0; padding: 6px 10px; border-radius: 8px; color: #725c2e; background: #fff8e8; font-size: 10px; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 23px; }
.detail-grid .card { padding: 26px; }
.wide-card { grid-column: 1 / -1; }
.data-list { display: grid; gap: 0; margin: 0; }
.data-list > div { display: grid; grid-template-columns: minmax(130px, .65fr) 1fr; gap: 18px; padding: 11px 0; border-bottom: 1px solid #edf1ee; }
.data-list > div:last-child { border-bottom: 0; }
.data-list dt { color: var(--muted); font-size: 12px; }
.data-list dd { margin: 0; font-weight: 700; overflow-wrap: anywhere; }
.data-list dd small { color: var(--muted); font-weight: 400; }
.data-list.compact { grid-template-columns: 1fr 1fr; column-gap: 30px; }
.meta-note { margin: 20px 0 0; padding-top: 13px; border-top: 1px dashed var(--line); color: var(--muted); font-size: 11px; }

.filter-card { padding: 22px; margin-bottom: 20px; }
.filter-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 13px; align-items: end; }
.filter-grid .span-2 { grid-column: span 2; }
.filter-actions { display: flex; gap: 7px; }
jdp-container { --jdp-primary: var(--primary); max-width: calc(100vw - 24px); font-family: "Vazirmatn", Tahoma, sans-serif; border-radius: 12px; }
jdp-container .jdp-btn-today, jdp-container .jdp-btn-empty, jdp-container .jdp-btn-close { font-family: inherit; }
.table-card { overflow: hidden; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th { background: #f2f6f3; color: #526159; font-weight: 700; text-align: right; white-space: nowrap; }
th, td { padding: 13px 14px; border-bottom: 1px solid #e7eee9; vertical-align: middle; }
tbody tr:hover { background: #fafcfa; }
td strong, td small { display: block; }
td small { color: var(--muted); font-size: 10px; }
.log-date { min-width: 135px; white-space: nowrap; }
.log-date strong { color: var(--ink); font-weight: 700; }
.dual-date strong, .dual-date small { display: block; }
.dual-date small { margin-top: 3px; color: var(--muted); font-weight: 400; }
td code { font: 700 13px/1.4 Consolas, monospace; color: var(--primary-dark); background: var(--primary-soft); padding: 4px 7px; border-radius: 6px; }
.row-link { color: var(--primary); font-weight: 700; white-space: nowrap; }
.pagination { display: flex; justify-content: center; align-items: center; gap: 15px; margin-top: 20px; }
.pagination a, .pagination span { padding: 7px 12px; border-radius: 8px; background: white; border: 1px solid var(--line); font-size: 12px; }

.empty-state { text-align: center; padding: 55px 25px; }
.empty-state p { color: var(--muted); }

.role-guide { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 22px; }
.role-guide article { padding: 14px 16px; border: 1px solid var(--line); border-radius: 13px; background: rgba(255,255,255,.75); }
.role-guide strong, .role-guide span { display: block; }
.role-guide strong { color: var(--primary-dark); font-size: 13px; }
.role-guide span { margin-top: 3px; color: var(--muted); font-size: 10px; line-height: 1.7; }
.users-grid { display: grid; grid-template-columns: 420px 1fr; gap: 23px; align-items: start; }
.users-grid > .card { padding: 25px; }
.create-user-card { position: sticky; top: 102px; max-height: calc(100vh - 125px); overflow: auto; }
.staff-list { display: grid; gap: 10px; }
.staff-list > h2 { margin-bottom: 5px; }
.staff-row { display: grid; gap: 12px; padding: 15px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.staff-row.inactive { opacity: .58; }
.staff-row strong, .staff-row span, .staff-row small { display: block; }
.staff-row span { color: var(--muted); font-size: 11px; }
.staff-row small { color: var(--primary); font-size: 10px; }
.staff-summary { display: flex; justify-content: space-between; align-items: center; gap: 14px; }
.staff-actions { display: flex; flex-direction: column; align-items: end; gap: 6px; }
.reset-form { display: flex; justify-content: flex-end; gap: 5px; padding-top: 10px; border-top: 1px dashed var(--line); }
.reset-form input { width: 120px; min-height: 34px; padding: 5px 8px; font-size: 11px; }
.module-access-fieldset { margin: 4px 0 0; }
.module-checks { display: grid; grid-template-columns: 1fr; gap: 6px; max-height: 285px; padding: 8px; overflow: auto; border: 1px solid var(--line); border-radius: 11px; background: #fbfdfb; }
.module-checks label { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 8px; color: #435149; font-size: 11px; cursor: pointer; }
.module-checks label:hover { background: var(--primary-soft); }
.module-checks input { width: 16px; height: 16px; flex: 0 0 auto; accent-color: var(--primary); }
.module-checks.is-disabled { opacity: .52; background: #f2f5f3; }
.access-editor { border: 1px solid #d5e1d9; border-radius: 10px; background: white; }
.access-editor summary { padding: 9px 12px; color: var(--primary-dark); font-size: 11px; font-weight: 700; cursor: pointer; }
.access-editor[open] summary { border-bottom: 1px solid var(--line); }
.access-form { display: grid; gap: 12px; padding: 13px; }
.access-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.compact-checks { grid-template-columns: repeat(2, minmax(0, 1fr)); max-height: 220px; }
.self-access-note { margin: 0; color: var(--muted); font-size: 11px; }

.settings-hero { align-items: end; }
.settings-hub-hero { margin-bottom: 22px; }
.settings-hub-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: stretch; }
.settings-hub-card { min-height: 190px; padding: 25px; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 14px 18px; align-items: start; border-color: #cfe0d6; transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease; }
.settings-hub-card:hover { transform: translateY(-2px); border-color: #83ae99; box-shadow: 0 19px 48px rgba(27, 54, 42, .12); }
.settings-hub-icon { width: 56px; height: 56px; display: grid; place-items: center; border-radius: 16px; color: white; background: linear-gradient(145deg, var(--primary), #24845f); font: 800 13px/1 "Vazirmatn", sans-serif; box-shadow: 0 9px 22px rgba(23, 107, 77, .20); }
.settings-hub-copy, .settings-hub-copy > span { display: block; }
.settings-hub-copy > span:last-child { margin-top: 9px; color: var(--muted); font-size: 11px; line-height: 1.8; }
.settings-hub-title-row { display: flex !important; align-items: center; justify-content: space-between; gap: 12px; }
.settings-hub-title-row strong { color: var(--primary-dark); font-size: 18px; }
.settings-hub-state { flex: 0 0 auto; padding: 4px 9px; border-radius: 999px; font-size: 9px; }
.settings-hub-state.ready { color: var(--primary-dark); background: #e1f3e9; }
.settings-hub-state.inactive { color: #795f24; background: #fff3d5; }
.settings-hub-arrow { grid-column: 2; align-self: end; color: var(--primary); font-size: 12px; font-weight: 700; }
.settings-hub-placeholder { min-height: 190px; padding: 25px; display: grid; place-content: center; text-align: center; border-style: dashed; color: var(--muted); background: rgba(255,255,255,.55); box-shadow: none; }
.settings-hub-placeholder span, .settings-hub-placeholder small { display: block; }
.settings-hub-placeholder span { font-size: 13px; font-weight: 700; }
.settings-hub-placeholder small { margin-top: 5px; font-size: 10px; }
.settings-breadcrumb { display: flex; align-items: center; gap: 8px; margin: -8px 0 19px; color: var(--muted); font-size: 11px; }
.settings-breadcrumb a { color: var(--primary); font-weight: 700; }
.settings-breadcrumb strong { color: #526059; }
.sms-readiness { min-width: 210px; padding: 16px 20px; border: 1px solid; border-radius: 14px; background: white; }
.sms-readiness strong, .sms-readiness span { display: block; }
.sms-readiness strong { font-size: 15px; }
.sms-readiness span { margin-top: 3px; color: var(--muted); font-size: 11px; }
.sms-readiness.ready { color: var(--primary-dark); border-color: #aad3bf; background: #eaf7f0; }
.sms-readiness.inactive { color: #795f24; border-color: #e6d09c; background: #fff9eb; }
.settings-card { padding: clamp(22px, 4vw, 36px); margin-bottom: 23px; }
.settings-form { display: grid; gap: 25px; }
.settings-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.settings-section-heading h2 { margin: 0; font-size: 19px; }
.settings-section-heading p { margin: 3px 0 0; color: var(--muted); font-size: 11px; }
.settings-toggle { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border: 1px solid #bcd6c8; border-radius: 11px; background: var(--primary-soft); color: var(--primary-dark); font-size: 12px; font-weight: 700; cursor: pointer; }
.settings-toggle input, .clear-secret input { width: 18px; height: 18px; accent-color: var(--primary); }
.cancellation-toggle { justify-self: start; align-items: flex-start; background: #fff9eb; border-color: #e6d09c; color: #725c2e; }
.cancellation-toggle span, .cancellation-toggle strong, .cancellation-toggle small { display: block; }
.cancellation-toggle small { margin-top: 2px; color: #8a7446; font-size: 10px; font-weight: 400; }
.settings-common-grid { align-items: end; }
.provider-settings-grid, .settings-preview-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.provider-card { display: grid; align-content: start; gap: 16px; padding: 20px; margin: 0; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2); }
.provider-card legend { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 0 3px; padding: 0 0 13px; }
.provider-state { padding: 3px 9px; border-radius: 999px; color: #856a2d; background: #fff2ce; font-size: 9px; }
.provider-state.ready { color: var(--primary-dark); background: #dff2e8; }
.compact-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.clear-secret { display: flex; align-items: center; gap: 8px; color: var(--danger); font-size: 11px; cursor: pointer; }
.endpoint { display: block; color: var(--muted); font-size: 9px; overflow-wrap: anywhere; }
.sms-security-note { padding: 13px 15px; border: 1px solid #e4d3a9; border-radius: 11px; color: #725c2e; background: #fffaf0; font-size: 11px; }
.settings-preview-grid { margin-bottom: 23px; }
.message-template-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin: 0 0 14px; padding: 14px 17px; border: 1px solid #d8e3dc; border-radius: 13px; background: rgba(255,255,255,.76); }
.message-template-toolbar strong, .message-template-toolbar span { display: block; }
.message-template-toolbar strong { color: var(--primary-dark); font-size: 13px; }
.message-template-toolbar span { margin-top: 2px; color: var(--muted); font-size: 10px; }
.message-template-toolbar form { margin: 0; }
.message-preview-card { display: grid; gap: 17px; padding: 24px; }
.message-preview { min-height: 190px; padding: 17px; border: 1px solid #d5e2da; border-radius: 12px; color: #31483d; background: #f7faf8; font-size: 12px; line-height: 2; white-space: normal; }
.message-editor { width: 100%; min-height: 210px; padding: 17px; resize: vertical; border: 1px solid #bfcfc6; border-radius: 12px; outline: 0; color: #31483d; background: #f7faf8; font: 400 13px/2 "Vazirmatn", Tahoma, sans-serif; }
.message-editor:focus { border-color: #57a685; background: #fff; box-shadow: 0 0 0 3px rgba(23, 107, 77, .10); }
.message-editor-help { color: var(--muted); font-size: 10px; }
.message-editor-help b { color: var(--primary-dark); }
.message-preview-actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.message-preview-actions form { margin: 0; }
.message-preview-card form { margin: 0; }
.delivery-log-card { overflow: hidden; margin-bottom: 23px; }
.delivery-log-card > .settings-section-heading { padding: 22px 24px 16px; }
.delivery-status { display: inline-flex; padding: 3px 9px; border-radius: 999px; font-size: 10px; font-weight: 700; }
.delivery-status.sent { color: var(--primary-dark); background: #e1f3e9; }
.delivery-status.failed { color: #8e2828; background: var(--danger-soft); }
.delivery-status.sending { color: #795f24; background: #fff3d5; }
.compact-empty { padding: 25px; }

.settings-hub-icon.asan { font-size: 24px; background: linear-gradient(145deg, #183f56, #26718a); }
.asan-settings-hero .sms-readiness { min-width: 240px; }
.asan-path-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.asan-path-grid input[readonly] { color: #526059; background: #eef3f0; }
.settings-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.serial-safety-note { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; padding: 0; overflow: hidden; }
.serial-safety-note > div { min-height: 105px; display: grid; align-content: center; gap: 5px; padding: 19px 21px; border-left: 1px solid var(--line); }
.serial-safety-note > div:last-child { border-left: 0; }
.serial-safety-note strong, .serial-safety-note span { display: block; }
.serial-safety-note strong { color: var(--primary-dark); font-size: 13px; }
.serial-safety-note span { color: var(--muted); font-size: 10px; line-height: 1.8; }
.alert.warning, .alert.info { color: #725c2e; background: #fff9eb; border-color: #e6d09c; }
.button:disabled { cursor: not-allowed; opacity: .5; transform: none; }
.serial-report-heading { align-items: end; }
.serial-filter-card { margin-bottom: 18px; }
.serial-filter-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.serial-empty-state { margin-top: 18px; }
.serial-report-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; margin: 18px 0; }
.serial-report-stats .card { min-height: 88px; display: grid; align-content: center; gap: 4px; padding: 17px 20px; }
.serial-report-stats strong, .serial-report-stats span { display: block; }
.serial-report-stats strong { color: var(--primary-dark); font-size: 20px; }
.serial-report-stats span { color: var(--muted); font-size: 10px; }
.serial-table-card { overflow: hidden; }
.serial-table { min-width: 1120px; }
.serial-table th:first-child { width: 19%; }
.serial-table td { vertical-align: top; line-height: 1.75; }
.serial-table td strong, .serial-table td small { display: block; }
.serial-table td small { color: var(--muted); font-size: 9px; }
.serial-table .party-balance { width: fit-content; margin-top: 5px; padding: 3px 8px; border-radius: 7px; color: #315c49; background: #edf7f1; }
.serial-table .party-balance b { margin-right: 3px; color: var(--primary-dark); font-size: 10px; }
.serial-table .party-mobile { width: fit-content; margin: 3px 0; color: #205f78; font-size: 10px; font-weight: 700; letter-spacing: .03em; }
.serial-table .muted { color: var(--muted); font-size: 11px; }
.serial-identity > strong { max-width: 280px; color: #173d52; overflow-wrap: anywhere; }
.serial-status { display: inline-flex; width: fit-content; margin: 5px 0 4px; padding: 3px 9px; border-radius: 999px; font-size: 9px; font-weight: 800; }
.serial-status.available { color: #0f5b3f; background: #e1f3e9; }
.serial-status.sold { color: #8e3d2d; background: #fbe9e4; }
.serial-main-event strong { direction: ltr; text-align: right; }

@media (max-width: 1100px) {
    .workspace-grid { grid-template-columns: 270px minmax(0,1fr); }
    .form-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .filter-grid { grid-template-columns: repeat(3, minmax(0,1fr)); }
    .users-grid { grid-template-columns: 330px 1fr; }
    .role-guide { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .compact-checks { grid-template-columns: 1fr; }
    .provider-settings-grid { grid-template-columns: 1fr; }
    .customer-admin-form { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .customer-admin-form .button { grid-column: 1 / -1; width: fit-content; }
    .serial-report-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 820px) {
    .topbar { position: static; flex-wrap: wrap; gap: 10px; padding: 10px 12px; padding-left: max(12px, env(safe-area-inset-left)); padding-right: max(12px, env(safe-area-inset-right)); }
    .nav { order: 3; width: 100%; overflow-x: auto; overflow-y: hidden; overscroll-behavior-inline: contain; scrollbar-width: thin; }
    .nav a { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; white-space: nowrap; }
    .user-menu { margin-right: auto; }
    .page-shell { width: min(calc(100% - 24px), 1460px); margin-top: 22px; margin-bottom: 48px; }
    .hero, .detail-heading { align-items: stretch; flex-direction: column; }
    .workspace-grid, .users-grid { grid-template-columns: 1fr; }
    .create-user-card { position: static; max-height: none; }
    .module-picker { position: static; max-height: none; }
    .module-list { display: flex; overflow-x: auto; overflow-y: hidden; gap: 8px; padding-bottom: 7px; scroll-snap-type: inline proximity; overscroll-behavior-inline: contain; }
    .module-list a { min-width: 220px; scroll-snap-align: start; }
    .detail-grid { grid-template-columns: 1fr; }
    .wide-card { grid-column: auto; }
    .data-list.compact { grid-template-columns: 1fr; }
    .filter-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .filter-actions { grid-column: 1 / -1; }
    .detail-heading .actions .button, .detail-heading > .button { min-height: 44px; }
    .module-checks label, .access-editor summary { min-height: 44px; }
    .settings-hero { align-items: stretch; }
    .settings-hub-grid { grid-template-columns: 1fr; }
    .sms-readiness { min-width: 0; }
    .settings-preview-grid { grid-template-columns: 1fr; }
    .message-template-toolbar { align-items: stretch; flex-direction: column; }
    .message-template-toolbar .button { width: 100%; }
    .serial-safety-note { grid-template-columns: 1fr; }
    .serial-safety-note > div { min-height: 0; border-left: 0; border-bottom: 1px solid var(--line); }
    .serial-safety-note > div:last-child { border-bottom: 0; }
}

@media (max-width: 560px) {
    .brand small, .user-menu span { display: none; }
    .brand { gap: 9px; }
    .brand-mark { width: 40px; height: 40px; border-radius: 12px; }
    .nav { gap: 4px; }
    .nav a { flex: 1 0 auto; padding-inline: 12px; text-align: center; }
    .user-menu { gap: 8px; }
    .user-menu .button { min-height: 40px; }
    .page-shell { width: calc(100% - 20px); margin-top: 16px; margin-bottom: 38px; }
    .footer { padding: 18px 10px max(18px, env(safe-area-inset-bottom)); font-size: 11px; }
    .hero { gap: 18px; margin-bottom: 20px; }
    .hero h1, .detail-heading h1 { font-size: clamp(24px, 8vw, 32px); line-height: 1.35; }
    .hero p, .detail-heading p, .section-heading p { font-size: 12px; }
    .stats { width: 100%; }
    .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .stats div { min-width: 0; padding: 12px 4px; }
    .stats strong { font-size: 20px; }
    .stats span { font-size: 9px; white-space: normal; line-height: 1.4; }
    .module-picker { padding: 14px; }
    .module-picker h2 { font-size: 16px; }
    .module-list a { min-width: min(235px, calc(100vw - 68px)); padding: 11px 12px; }
    .generator-card { padding: 20px 16px; }
    .section-heading { padding-bottom: 17px; margin-bottom: 20px; }
    .section-heading h2 { font-size: 21px; line-height: 1.45; }
    .form-grid, .filter-grid { grid-template-columns: 1fr; }
    .field input, .field select, .field textarea, .reset-form input { min-height: 48px; font-size: 16px; }
    .field textarea { min-height: 105px; }
    .customer-suggestions { top: 77px; max-height: 260px; }
    .customer-suggestion { min-height: 54px; }
    .quick-value { min-height: 44px; padding: 8px 14px; font-size: 12px; }
    .checkbox-label { min-height: 48px; }
    .password-reset-preview, .password-reset-preview-result { grid-template-columns: 1fr; }
    .password-reset-preview > .button, .password-reset-preview-result .button { width: 100%; grid-column: 1; grid-row: auto; }
    .filter-grid .span-2 { grid-column: auto; }
    .filter-card { padding: 16px; }
    .filter-actions { display: grid; grid-template-columns: 1fr 1fr; }
    .filter-actions .button { min-width: 0; }
    .form-actions { align-items: stretch; flex-direction: column; }
    .form-actions .button { width: 100%; min-height: 50px; }
    .result-card { grid-template-columns: 1fr; text-align: center; }
    .result-card strong, .result-card > .result-actions { grid-column: 1; grid-row: auto; }
    .result-card, .serial-results-card { padding: 20px 16px; }
    .serial-results-grid { grid-template-columns: 1fr; }
    .serial-results-grid article { grid-template-columns: minmax(0, 1fr) auto; padding: 14px 12px; }
    .serial-results-grid .button { min-height: 42px; }
    .primary-result-actions { justify-content: center; }
    .detail-heading { gap: 15px; margin-bottom: 20px; }
    .detail-heading .actions { display: grid; grid-template-columns: 1fr; }
    .detail-heading .actions .button, .detail-heading > .button { width: 100%; }
    .detail-grid { gap: 14px; }
    .detail-grid .card { padding: 19px 16px; }
    .data-list > div { grid-template-columns: 1fr; gap: 3px; }
    .users-grid > .card { padding: 18px 15px; }
    .staff-row { align-items: stretch; padding: 13px; }
    .staff-summary { align-items: stretch; flex-direction: column; }
    .staff-actions { align-items: stretch; }
    .staff-summary form .button { width: 100%; min-height: 44px; }
    .reset-form { display: grid; grid-template-columns: 1fr; }
    .reset-form input { width: 100%; }
    .reset-form .button { width: 100%; min-height: 44px; }
    .role-guide { grid-template-columns: 1fr; }
    .access-form-grid { grid-template-columns: 1fr; }
    .pagination { gap: 7px; }
    .pagination a, .pagination span { min-height: 42px; display: inline-flex; align-items: center; padding-inline: 10px; }
    .auth-card { margin: 26px auto; padding: 24px 18px; }
    .auth-card h1 { font-size: 25px; }
    .alert { font-size: 12px; }
    .settings-card { padding: 20px 15px; }
    .settings-hub-card { min-height: 0; padding: 19px 16px; grid-template-columns: auto minmax(0, 1fr); }
    .settings-hub-icon { width: 48px; height: 48px; border-radius: 14px; }
    .settings-hub-title-row { align-items: flex-start; flex-direction: column; gap: 5px; }
    .settings-hub-arrow { grid-column: 1 / -1; }
    .settings-hub-placeholder { min-height: 130px; }
    .settings-section-heading { align-items: stretch; flex-direction: column; }
    .settings-toggle { min-height: 48px; }
    .cancellation-toggle { justify-self: stretch; }
    .provider-card { padding: 17px 13px; }
    .compact-grid { grid-template-columns: 1fr; }
    .message-preview-card { padding: 19px 15px; }
    .message-preview { min-height: 0; }
    .message-editor { min-height: 230px; font-size: 16px; }
    .message-preview-actions { display: grid; grid-template-columns: 1fr; }
    .message-preview-actions .button { width: 100%; min-height: 48px; }
    .settings-actions { display: grid; grid-template-columns: 1fr; }
    .settings-actions .button { width: 100%; }
    .serial-report-stats { grid-template-columns: 1fr 1fr; gap: 9px; }
    .serial-report-stats .card { min-height: 78px; padding: 13px; }
    .serial-report-stats strong { font-size: 17px; }
    .customer-admin-row { padding: 17px 14px 72px; }
    .customer-admin-summary { align-items: flex-start; flex-direction: column; gap: 5px; }
    .customer-admin-form, .customer-merge-form { grid-template-columns: 1fr; }
    .customer-admin-form .button, .customer-merge-form .button { width: 100%; min-height: 44px; }
    .customer-toggle-form { right: 14px; left: 14px; bottom: 15px; }
    .customer-toggle-form .button { width: 100%; }
}

@media (max-width: 700px) {
    .table-card { overflow: visible; border: 0; background: transparent; box-shadow: none; }
    .table-wrap { overflow: visible; }
    .logs-table, .logs-table tbody, .logs-table tr, .logs-table td { display: block; width: 100%; }
    .logs-table { font-size: 12px; }
    .logs-table thead { display: none; }
    .logs-table tbody { display: grid; gap: 12px; }
    .logs-table tr { overflow: hidden; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); box-shadow: 0 9px 25px rgba(27, 54, 42, .06); }
    .logs-table td { min-width: 0; padding: 10px 13px; border-bottom: 1px solid #edf1ee; text-align: right; white-space: normal; overflow-wrap: anywhere; }
    .logs-table td:not(.log-details-cell) { display: grid; grid-template-columns: minmax(88px, .72fr) minmax(0, 1fr); gap: 12px; align-items: center; }
    .logs-table td:not(.log-details-cell)::before { content: attr(data-label); color: var(--muted); font-size: 10px; font-weight: 700; }
    .logs-table .log-date strong, .logs-table .log-date small { white-space: normal; }
    .logs-table td code { justify-self: start; max-width: 100%; overflow-wrap: anywhere; }
    .logs-table .log-details-cell { padding: 0; border-bottom: 0; }
    .logs-table .row-link { display: flex; min-height: 48px; align-items: center; justify-content: center; color: var(--primary-dark); background: var(--primary-soft); }
    .serial-table { min-width: 0; }
    .serial-table td:not(.log-details-cell) > * { grid-column: 2; }
    .serial-table td:not(.log-details-cell)::before { grid-column: 1; grid-row: 1 / span 8; align-self: start; padding-top: 2px; }
    .serial-identity > strong { max-width: 100%; }
}

@media (hover: none) {
    .button:hover { transform: none; }
}
