@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;500;600;700;800;900&family=Inter:wght@400;500;600;700;800;900&display=swap');

:root {
    --bg: #f3f6f8;
    --surface: #ffffff;
    --surface-2: #f8fafb;
    --surface-3: #eef4f6;
    --text: #17212b;
    --muted: #64717d;
    --soft: #8a98a5;
    --border: #dbe4e8;
    --border-2: #edf2f4;
    --primary: #0f9f84;
    --primary-2: #0b7663;
    --accent: #246bfe;
    --cyan: #08a9c7;
    --warn: #b7791f;
    --danger: #d14343;
    --nav: #101820;
    --nav-2: #162331;
    --shadow-sm: 0 8px 20px rgba(16, 24, 32, .06);
    --shadow: 0 18px 45px rgba(16, 24, 32, .10);
    --radius: 10px;
}

/* Version 8 full interface refresh */
:root {
    --bg: #f4f7fa;
    --surface: #ffffff;
    --surface-2: #f8fafc;
    --surface-3: #edf3f7;
    --text: #17212b;
    --muted: #667382;
    --soft: #94a3b8;
    --border: #dbe5ea;
    --border-2: #eef3f6;
    --primary: #0b8f76;
    --primary-2: #076b59;
    --accent: #3157d5;
    --cyan: #0891b2;
    --warn: #b7791f;
    --danger: #c83d3d;
    --nav: #111827;
    --nav-2: #1f2937;
    --shadow-sm: 0 10px 26px rgba(15, 23, 42, .06);
    --shadow: 0 24px 70px rgba(15, 23, 42, .12);
    --radius: 8px;
}

body {
    background:
        linear-gradient(180deg, rgba(49, 87, 213, .055), transparent 360px),
        linear-gradient(90deg, rgba(11, 143, 118, .045), transparent 56%),
        var(--bg);
    font-family: "Segoe UI", Tahoma, Arial, sans-serif;
    letter-spacing: 0;
}

.app-layout {
    grid-template-columns: 292px minmax(0, 1fr);
}

.sidebar {
    padding: 16px 12px;
    overflow-y: auto;
    background: linear-gradient(180deg, #111827, #1f2937);
    border: 0;
    box-shadow: 14px 0 34px rgba(17, 24, 39, .16);
}

.brand,
.language-switch a,
.sidebar-actions,
.nav-group {
    border-radius: 8px;
}

.brand {
    min-height: 72px;
    padding: 12px;
    border-color: rgba(255, 255, 255, .10);
    background: rgba(255, 255, 255, .065);
}

.brand-mark {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    background: linear-gradient(135deg, #ffffff, #d9f5ec);
    color: #0f172a;
}

.sidebar-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin: 0 0 12px;
    padding: 10px;
    border: 1px solid rgba(255, 255, 255, .10);
    background: rgba(255, 255, 255, .045);
}

.sidebar-actions a {
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 10px;
    border: 1px solid rgba(255, 255, 255, .10);
    border-radius: 7px;
    color: rgba(255, 255, 255, .82);
    font-size: 12px;
    font-weight: 800;
    text-decoration: none;
}

.sidebar-actions a.primary {
    grid-column: 1 / -1;
    background: var(--primary);
    border-color: transparent;
    color: #fff;
}

.nav-group {
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .075);
    background: rgba(255, 255, 255, .032);
}

.nav-group + .nav-group {
    margin-top: 8px;
}

.nav-group summary {
    min-height: 38px;
    display: flex;
    align-items: center;
    padding: 0 12px;
    color: rgba(255, 255, 255, .58);
    font-size: 12px;
    font-weight: 900;
    list-style: none;
    cursor: pointer;
}

.nav-group summary::-webkit-details-marker {
    display: none;
}

.nav-group div {
    display: grid;
    gap: 4px;
    padding: 0 6px 8px;
}

.sidebar nav a,
.logout {
    min-height: 38px;
    border-radius: 7px;
    font-size: 13px;
}

.sidebar nav a.active {
    border-color: rgba(255, 255, 255, .18);
    background: linear-gradient(90deg, rgba(11, 143, 118, .28), rgba(49, 87, 213, .18));
}

.content {
    width: min(1440px, calc(100% - 34px));
    margin: 18px auto 44px;
}

.topbar {
    align-items: flex-start;
    padding: 18px 20px;
    border-radius: 8px;
    background: rgba(255, 255, 255, .92);
}

.topbar h1 {
    font-size: 27px;
    letter-spacing: 0;
}

.topbar-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}

.panel,
.notice,
.stats > div,
.info-card,
.agent,
.agent-editor,
.mini-card,
.destination-card {
    border-radius: 8px;
}

.panel {
    padding: 18px;
    margin-bottom: 16px;
}

.section-title {
    align-items: flex-start;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-2);
}

.section-title h2,
.panel h3 {
    font-size: 19px;
    letter-spacing: 0;
}

.grid-form {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

label {
    color: #334155;
    font-size: 12px;
    font-weight: 900;
}

input,
select,
textarea {
    border-radius: 7px;
    border-color: #cfdce5;
    background: #fff;
}

input,
select {
    min-height: 42px;
}

textarea {
    min-height: 116px;
}

.button {
    min-height: 38px;
    border-radius: 7px;
    padding-inline: 14px;
}

.stats {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.stats > div {
    min-height: 108px;
    display: grid;
    align-content: center;
}

.stats strong {
    font-size: 28px;
}

.table-wrap {
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
}

table {
    min-width: 920px;
    border-collapse: separate;
    border-spacing: 0;
}

th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #f8fafc;
    color: #475569;
    font-size: 12px;
    font-weight: 950;
}

th,
td {
    padding: 12px 13px;
    border-bottom: 1px solid var(--border-2);
    vertical-align: top;
}

tr:last-child td {
    border-bottom: 0;
}

tbody tr:hover {
    background: #fbfdff;
}

.mini-input {
    min-width: 92px;
    max-width: 132px;
}

.mini-stack {
    display: grid;
    gap: 8px;
    min-width: 160px;
}

.mini-stack label {
    display: grid;
    gap: 4px;
    margin: 0;
    font-size: 11px;
    color: #64748b;
    font-weight: 800;
}

.mini-stack .mini-input {
    width: 100%;
    max-width: none;
}

.compact-switch {
    display: inline-flex !important;
    grid-template-columns: none !important;
    align-items: center;
    gap: 6px !important;
    color: #0f172a !important;
}

.badge {
    border-radius: 999px;
    font-weight: 900;
}

.dashboard-hero {
    border-radius: 8px;
    background: linear-gradient(135deg, #0f172a, #1e3a4a);
}

.dashboard-hero h2,
.dashboard-hero p,
.dashboard-hero .eyebrow {
    color: #fff;
}

.dashboard-hero p {
    color: rgba(255, 255, 255, .76);
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.destination-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 12px;
    margin-top: 16px;
}

.destination-card {
    display: grid;
    gap: 6px;
    padding: 14px;
    border: 1px solid var(--border);
    background: #fff;
}

.destination-card.active {
    border-color: rgba(11, 143, 118, .38);
    background: #effaf6;
}

.destination-card span,
.destination-card small {
    color: var(--muted);
}

.destination-card a {
    font-weight: 900;
}

.generation-session-dock {
    margin: 0 0 16px;
    padding: 16px;
    border: 1px solid rgba(11, 143, 118, .20);
    background: linear-gradient(180deg, rgba(11, 143, 118, .06), rgba(255, 255, 255, .98));
    box-shadow: var(--shadow-sm);
}

.generation-session-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.generation-session-head strong {
    display: block;
    margin-top: 2px;
    font-size: 18px;
}

.generation-session-head small {
    color: var(--muted);
}

.generation-session-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.generation-session-bar {
    overflow: hidden;
    height: 10px;
    margin: 14px 0 12px;
    border-radius: 999px;
    background: #e5edf1;
}

.generation-session-bar span {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    transition: width .28s ease;
}

.generation-session-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 12px;
}

.generation-session-stats div {
    padding: 12px 14px;
    border: 1px solid var(--border);
    background: #fff;
}

.generation-session-stats span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.generation-session-stats strong {
    display: block;
    margin-top: 4px;
    font-size: 18px;
}

.generation-session-items {
    display: grid;
    gap: 10px;
}

.generation-item {
    padding: 12px 14px;
    border: 1px solid var(--border);
    background: #fff;
}

.generation-item strong {
    display: block;
    font-size: 14px;
}

.generation-item small,
.generation-item p {
    display: block;
    margin-top: 4px;
    color: var(--muted);
}

.generation-item.generation-done {
    border-color: rgba(11, 143, 118, .22);
    background: #f5fffb;
}

.generation-item.generation-failed {
    border-color: rgba(193, 61, 61, .24);
    background: #fff7f7;
}

.generation-item.generation-running {
    border-color: rgba(49, 87, 213, .22);
    background: #f7f9ff;
}

html[dir="rtl"] .app-layout {
    grid-template-columns: minmax(0, 1fr) 292px;
}

html[dir="rtl"] .topbar-actions {
    justify-content: flex-start;
}

html[dir="rtl"] .stats > div::before {
    inset-inline-start: auto;
    inset-inline-end: 0;
}

html[dir="rtl"] th,
html[dir="rtl"] td,
html[dir="rtl"] label,
html[dir="rtl"] .panel,
html[dir="rtl"] .notice {
    text-align: right;
}

html[dir="rtl"] input[type="number"],
html[dir="rtl"] .mini-input {
    direction: ltr;
    text-align: left;
}

@media (max-width: 1100px) {
    .grid-form,
    .dashboard-grid,
    .stats,
    .generation-session-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    .grid-form,
    .dashboard-grid,
    .stats,
    .destination-grid,
    .generation-session-stats,
    .generation-session-head {
        grid-template-columns: 1fr;
    }

    .topbar {
        flex-direction: column;
    }

    .generation-session-head {
        display: grid;
    }
}

* {
    box-sizing: border-box;
}

html {
    background: var(--bg);
}

body {
    margin: 0;
    background:
        linear-gradient(180deg, rgba(36, 107, 254, .05), transparent 300px),
        var(--bg);
    color: var(--text);
    font-family: Tahoma, Arial, sans-serif;
    line-height: 1.5;
}

body.app-busy {
    cursor: progress;
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

h1,
h2,
h3,
p {
    margin: 0;
}

.app-layout {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
}

.ajax-loader {
    position: fixed;
    inset: 0;
    z-index: 120;
    display: none;
    place-items: center;
    padding: 22px;
    background: rgba(15, 23, 32, .24);
    backdrop-filter: blur(5px);
}

.ajax-loader.active {
    display: grid;
}

.ajax-loader::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(255,255,255,.10), rgba(255,255,255,.04));
}

.ajax-loader span,
.ajax-loader strong {
    position: relative;
    z-index: 1;
}

.ajax-loader span {
    width: 34px;
    height: 34px;
    margin-inline-end: 12px;
    display: inline-block;
    border-radius: 999px;
    border: 4px solid rgba(255, 255, 255, .65);
    border-top-color: var(--primary);
    animation: spin .75s linear infinite;
    vertical-align: middle;
}

.ajax-loader strong {
    min-width: min(420px, calc(100vw - 44px));
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 58px;
    padding: 0 22px;
    border: 1px solid rgba(255,255,255,.65);
    border-radius: 12px;
    background: rgba(255, 255, 255, .96);
    color: var(--text);
    box-shadow: 0 20px 55px rgba(15, 23, 32, .24);
}

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

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 18px 14px;
    background: linear-gradient(180deg, var(--nav), var(--nav-2));
    border-left: 1px solid rgba(255,255,255,.08);
    box-shadow: -10px 0 28px rgba(16, 24, 32, .18);
}

.brand {
    min-height: 64px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    margin-bottom: 16px;
    border: 1px solid rgba(255,255,255,.10);
    border-radius: 12px;
    background: rgba(255,255,255,.06);
    color: #fff;
}

.brand-mark {
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 9px;
    background: #fff;
    color: var(--nav);
    font-weight: 900;
    letter-spacing: 0;
}

.brand strong,
.brand small {
    display: block;
}

.brand strong {
    font-size: 14px;
}

.brand small {
    margin-top: 3px;
    color: rgba(255,255,255,.62);
    font-size: 12px;
}

.sidebar nav {
    display: grid;
    gap: 6px;
}

.language-switch {
    display: flex;
    gap: 8px;
    align-items: center;
    margin: 0 0 14px;
}

.login-card .language-switch {
    justify-content: center;
    margin: 14px 0 4px;
}

.language-switch a {
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 7px 11px;
    border: 1px solid rgba(255,255,255,.16);
    border-radius: 8px;
    background: rgba(255,255,255,.08);
    color: #fff;
    font-size: 12px;
    font-weight: 800;
}

.login-card .language-switch a {
    border-color: var(--border);
    background: var(--surface-2);
    color: var(--text);
}

html[dir="rtl"] body {
    text-align: right;
}

html[dir="rtl"] .app-layout {
    grid-template-columns: minmax(0, 1fr) 260px;
}

html[dir="rtl"] .sidebar {
    grid-column: 2;
    grid-row: 1;
    border-left: 0;
    border-right: 1px solid rgba(255,255,255,.08);
    box-shadow: 10px 0 28px rgba(16, 24, 32, .18);
}

html[dir="rtl"] .content {
    grid-column: 1;
    grid-row: 1;
}

html[dir="rtl"] input,
html[dir="rtl"] textarea,
html[dir="rtl"] select {
    text-align: right;
}

html[dir="rtl"] input[type="email"],
html[dir="rtl"] input[type="url"],
html[dir="rtl"] input[name*="url" i],
html[dir="rtl"] input[name*="email" i],
html[dir="rtl"] input[name*="key" i],
html[dir="rtl"] input[name*="secret" i],
html[dir="rtl"] input[name*="slug" i],
html[dir="rtl"] input[name*="id" i],
html[dir="rtl"] textarea[name*="json" i],
html[dir="rtl"] pre {
    direction: ltr;
    text-align: left;
}

html[dir="rtl"] table {
    direction: rtl;
}

html[dir="rtl"] .button-row,
html[dir="rtl"] .form-row,
html[dir="rtl"] .actions,
html[dir="rtl"] .row-actions,
html[dir="rtl"] .brand,
html[dir="rtl"] .topbar,
html[dir="rtl"] .section-title {
    direction: rtl;
}

.sidebar nav a,
.logout {
    min-height: 42px;
    display: flex;
    align-items: center;
    padding: 0 12px;
    border: 1px solid transparent;
    border-radius: 9px;
    color: rgba(255,255,255,.76);
    font-weight: 700;
    text-decoration: none;
    transition: background .16s ease, border-color .16s ease, color .16s ease, transform .16s ease;
}

.sidebar nav a:hover,
.logout:hover {
    transform: translateX(-2px);
    border-color: rgba(255,255,255,.12);
    background: rgba(255,255,255,.07);
    color: #fff;
}

.sidebar nav a.active {
    border-color: rgba(8, 169, 199, .45);
    background: rgba(8, 169, 199, .16);
    color: #fff;
}

.logout {
    margin-top: 16px;
    color: #ffc0bd;
    background: rgba(209, 67, 67, .11);
}

.content {
    width: min(1360px, calc(100% - 34px));
    margin: 20px auto 44px;
    transition: opacity .18s ease, transform .18s ease, filter .18s ease;
}

.content.is-loading {
    opacity: .52;
    transform: translateY(4px);
    filter: saturate(.85);
    pointer-events: none;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 16px;
    padding: 18px 20px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: rgba(255,255,255,.88);
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(10px);
}

.eyebrow {
    display: inline-flex;
    margin-bottom: 5px;
    color: var(--primary-2);
    font-size: 12px;
    font-weight: 900;
}

.topbar h1 {
    font-size: 26px;
    line-height: 1.2;
}

.topbar p,
.section-title p,
.muted {
    color: var(--muted);
}

.topbar p {
    margin-top: 6px;
}

.notice,
.panel,
.stats > div {
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
}

.notice {
    margin-bottom: 14px;
    padding: 13px 15px;
    box-shadow: var(--shadow-sm);
    color: #155e47;
    background: #effaf6;
    border-color: #bce8d7;
    font-weight: 700;
}

.notice.error {
    color: #9f1d1d;
    background: #fff5f5;
    border-color: #f5c2c2;
}

.stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 14px;
}

.stats > div {
    position: relative;
    overflow: hidden;
    padding: 16px;
    box-shadow: var(--shadow-sm);
}

.stats > div::before {
    content: "";
    position: absolute;
    inset-inline-start: 0;
    top: 0;
    width: 4px;
    height: 100%;
    background: var(--primary);
}

.stats span {
    display: block;
    margin-bottom: 7px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.stats strong {
    display: block;
    font-size: 30px;
    line-height: 1;
}

.panel {
    margin-bottom: 14px;
    padding: 20px;
    box-shadow: var(--shadow-sm);
}

.section-title {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.section-title h2,
.panel h3 {
    font-size: 20px;
    line-height: 1.25;
}

.card-grid,
.agent-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.info-card,
.agent,
.agent-editor {
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface-2);
}

.info-card,
.agent {
    padding: 15px;
}

.info-card strong,
.info-card span,
.agent strong,
.agent span {
    display: block;
}

.info-card span,
.agent span {
    margin-top: 6px;
    color: var(--muted);
    direction: ltr;
    text-align: right;
}

.info-card p,
.agent p {
    margin-top: 10px;
    color: #3e4b55;
}

.grid-form {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.form-row,
.actions,
.row-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 10px;
}

.toolbar-row {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 16px;
}

.toolbar-row .form-row {
    margin-bottom: 0;
}

.button-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.button-row form {
    margin: 0;
}

.price-cell {
    min-width: 130px;
}

.price-cell input {
    max-width: 110px;
    height: 36px;
    padding: 7px 9px;
}

.switch.mini {
    margin-top: 6px;
    font-size: 12px;
    font-weight: 700;
    color: var(--muted);
}

label {
    display: grid;
    gap: 6px;
    color: #3f4c56;
    font-size: 13px;
    font-weight: 800;
}

label.wide,
.db-grid .wide {
    grid-column: 1 / -1;
}

label.check,
.switch {
    display: inline-grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 8px;
}

.check-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface-2);
}

.bulk-tools {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 10px;
}

input,
select,
textarea {
    width: 100%;
    min-width: 0;
    border: 1px solid #ccd8dd;
    border-radius: 9px;
    padding: 10px 11px;
    background: #fbfdfe;
    color: var(--text);
    font: inherit;
    font-weight: 400;
    outline: none;
    transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}

input,
select {
    height: 42px;
}

textarea {
    min-height: 108px;
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--accent);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(36, 107, 254, .12);
}

.actions {
    grid-column: 1 / -1;
    margin-top: 4px;
}

.product-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: -2px 0 16px;
}

.product-tabs a {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--surface-2);
    color: var(--text);
    font-weight: 900;
    text-decoration: none;
}

.product-tabs a.active {
    border-color: rgba(15, 159, 132, .42);
    background: #eaf8f4;
    color: var(--primary-2);
}

.product-tabs span {
    min-width: 24px;
    min-height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 7px;
    border-radius: 999px;
    background: #e2ebef;
    color: #40505a;
    font-size: 12px;
}

.button {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 14px;
    border: 1px solid transparent;
    border-radius: 9px;
    background: var(--primary);
    color: #fff;
    font: inherit;
    font-weight: 900;
    text-decoration: none;
    cursor: pointer;
    transition: transform .16s ease, background .16s ease, border-color .16s ease, box-shadow .16s ease;
}

.button.is-generating::before {
    content: "";
    width: 14px;
    height: 14px;
    border-radius: 999px;
    border: 2px solid rgba(255,255,255,.62);
    border-top-color: #fff;
    animation: spin .75s linear infinite;
}

.generation-notice {
    border-color: #c7e8de;
    background: #effaf6;
}

.button:hover {
    background: var(--primary-2);
    text-decoration: none;
    box-shadow: 0 10px 20px rgba(15, 159, 132, .18);
    transform: translateY(-1px);
}

.button.secondary {
    border-color: var(--border);
    background: #fff;
    color: var(--text);
}

.button.secondary:hover {
    background: var(--surface-3);
    box-shadow: none;
}

.button.danger {
    background: var(--danger);
}

.button.success {
    background: #15803d;
}

.button.warning {
    background: #b7791f;
}

.button.ghost {
    border-color: transparent;
    background: transparent;
    color: var(--text);
}

.button.danger:hover {
    background: #a82727;
}

.button.success:hover {
    background: #166534;
}

.button.warning:hover {
    background: #8a5a16;
}

.agent-editor {
    display: grid;
    gap: 14px;
    margin-bottom: 14px;
    padding: 16px;
}

.agent-stats {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.agent-editor {
    overflow: hidden;
    padding: 0;
    background: #fff;
    box-shadow: var(--shadow-sm);
}

.agent-title {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 18px;
    border-bottom: 1px solid var(--border-2);
    background: linear-gradient(90deg, rgba(15, 159, 132, .08), rgba(36, 107, 254, .06));
}

.agent-title strong,
.agent-title span {
    display: block;
}

.agent-title span {
    margin-top: 6px;
    color: var(--muted);
}

.agent-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 10px;
}

.agent-meta b {
    min-height: 24px;
    display: inline-flex;
    align-items: center;
    padding: 0 9px;
    border-radius: 999px;
    background: #eef4f6;
    color: #40505a;
    font-size: 12px;
}

.agent-editor > .grid-form {
    padding: 16px 18px 18px;
    grid-template-columns: 1.1fr 1fr 1fr 130px;
}

.agent-editor textarea {
    min-height: 150px;
}

.agent-editor .check-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    max-height: 150px;
    overflow: auto;
}

.agent-delete-form {
    display: none;
}

.sticky-actions {
    position: sticky;
    bottom: 12px;
    z-index: 4;
    display: flex;
    justify-content: flex-start;
    margin-bottom: 16px;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: rgba(255,255,255,.92);
    box-shadow: var(--shadow);
    backdrop-filter: blur(8px);
}

.panel:has(input[name="action"][value="create_agent"]) {
    border-color: rgba(36, 107, 254, .22);
    background: linear-gradient(180deg, #ffffff, #f8fbff);
}

.panel:has(input[name="action"][value="create_agent"]) .grid-form {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
}

.map-board {
    display: grid;
    gap: 12px;
}

.map-lane {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 190px minmax(0, 1fr);
    gap: 12px;
    align-items: stretch;
}

.map-node,
.map-edge {
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface-2);
    padding: 12px;
}

.map-node strong,
.map-node span,
.map-edge strong,
.map-edge span {
    display: block;
}

.map-node span,
.map-edge span {
    margin-top: 6px;
    color: var(--muted);
    font-size: 12px;
}

.map-edge {
    position: relative;
    display: grid;
    place-items: center;
    text-align: center;
    background: #eef9f6;
    border-color: rgba(15,159,132,.28);
}

.map-edge::before,
.map-edge::after {
    content: "";
    position: absolute;
    top: 50%;
    width: 18px;
    height: 2px;
    background: var(--primary);
}

.map-edge::before {
    right: -18px;
}

.map-edge::after {
    left: -18px;
}

.map-type {
    min-height: 24px;
    display: inline-flex;
    align-items: center;
    padding: 0 9px;
    border-radius: 999px;
    background: #e8eefc;
    color: #244fb3;
    font-size: 12px;
    font-weight: 900;
}

.article-preview {
    max-width: 920px;
    margin: 0 auto;
    padding: 22px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
}

.article-preview h1 {
    margin-bottom: 12px;
    font-size: 28px;
    line-height: 1.25;
}

.article-preview .lead {
    margin-bottom: 18px;
    color: var(--muted);
    font-size: 16px;
}

.article-preview h2,
.article-preview h3 {
    margin: 20px 0 10px;
}

.article-preview p,
.article-preview ul,
.article-preview ol {
    margin: 0 0 12px;
}

table {
    width: 100%;
    min-width: 840px;
    border-collapse: collapse;
    background: #fff;
}

th,
td {
    padding: 12px 11px;
    border-bottom: 1px solid var(--border-2);
    text-align: right;
    vertical-align: middle;
}

th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #f0f5f7;
    color: #53616d;
    font-size: 12px;
    font-weight: 900;
}

tr:hover td {
    background: #fbfdfe;
}

td small {
    color: var(--muted);
}

.badge {
    min-height: 24px;
    display: inline-flex;
    align-items: center;
    padding: 0 10px;
    border-radius: 999px;
    background: #fff4e8;
    color: var(--warn);
    font-size: 12px;
    font-weight: 900;
}

.badge.ok {
    background: #e4f8ed;
    color: #176a3a;
}

.badge.warn {
    background: #fff4e8;
    color: var(--warn);
}

.badge.danger {
    background: #ffe8e8;
    color: var(--danger);
}

.result {
    direction: ltr;
    overflow: auto;
    margin-top: 16px;
    padding: 14px;
    border-radius: 10px;
    background: #111820;
    color: #d8f3dc;
    text-align: left;
}

.db-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.db-grid > div {
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface-2);
}

.db-grid span {
    display: block;
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.db-grid strong {
    font-size: 15px;
}

.webhook-row {
    display: grid;
    grid-template-columns: 180px minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-2);
}

.webhook-row code,
td code,
.db-grid code {
    direction: ltr;
    max-width: 100%;
    display: inline-block;
    overflow-wrap: anywhere;
    padding: 5px 7px;
    border-radius: 6px;
    background: #eef3f6;
    color: #26343b;
    text-align: left;
    font-size: 12px;
}

.logs {
    display: grid;
    gap: 9px;
}

.log {
    padding: 11px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface-2);
}

.log span {
    color: var(--muted);
    font-size: 12px;
}

.log strong {
    margin-inline: 8px;
}

.log.error strong {
    color: var(--danger);
}

.log p {
    display: inline;
}

.log code {
    direction: ltr;
    display: block;
    margin-top: 7px;
    color: #3d4a52;
    text-align: left;
    white-space: pre-wrap;
}

.modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.modal.open {
    display: flex;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 32, .58);
    backdrop-filter: blur(4px);
}

.modal-panel {
    position: relative;
    z-index: 1;
    width: min(1120px, 96vw);
    max-height: 88vh;
    overflow: auto;
    padding: 20px;
    border: 1px solid rgba(255,255,255,.6);
    border-radius: 12px;
    background: var(--surface);
    box-shadow: 0 28px 80px rgba(15, 23, 32, .28);
}

.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-2);
}

.modal-head span {
    display: block;
    color: var(--muted);
    font-size: 13px;
}

.icon-button {
    width: 36px;
    height: 36px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: #fff;
    color: var(--text);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}

.login-body {
    background:
        linear-gradient(180deg, rgba(36, 107, 254, .14), transparent 360px),
        #101820;
}

.login-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 20px;
}

.login-card {
    width: min(430px, 100%);
    padding: 24px;
    border: 1px solid rgba(255,255,255,.16);
    border-radius: 14px;
    background: rgba(255,255,255,.96);
    box-shadow: var(--shadow);
}

.login-card h1 {
    margin-top: 12px;
    font-size: 24px;
}

.login-card p {
    margin-top: 8px;
    color: var(--muted);
}

.login-form {
    display: grid;
    gap: 12px;
    margin-top: 18px;
}

.tenant-mini {
    display: grid;
    gap: 8px;
    margin: 16px 0;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: rgba(255, 255, 255, .76);
}

.tenant-mini strong,
.tenant-mini span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tenant-mini span {
    color: var(--muted);
    font-size: 12px;
}

.tenant-mini select {
    width: 100%;
}

.saas-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.admin-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 16px;
    padding: 22px;
    border: 1px solid rgba(36, 107, 254, .18);
    border-radius: 14px;
    background:
        linear-gradient(135deg, rgba(36, 107, 254, .12), rgba(15, 159, 132, .12)),
        #fff;
    box-shadow: var(--shadow-sm);
}

.admin-hero span {
    color: var(--primary);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0;
}

.admin-hero h2 {
    margin: 8px 0 6px;
    font-size: 26px;
}

.admin-hero p {
    max-width: 760px;
    color: var(--muted);
}

.admin-hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.admin-stats {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.admin-quick-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.admin-quick-card {
    min-height: 116px;
    display: grid;
    align-content: start;
    gap: 8px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
    color: var(--text);
    text-decoration: none;
    box-shadow: var(--shadow-sm);
    transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}

.admin-quick-card:hover {
    transform: translateY(-2px);
    border-color: rgba(36, 107, 254, .34);
    box-shadow: var(--shadow);
}

.admin-quick-card strong {
    font-size: 15px;
}

.admin-quick-card span {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.65;
}

.admin-meter {
    display: block;
    width: 110px;
    height: 7px;
    margin-top: 7px;
    overflow: hidden;
    border-radius: 999px;
    background: #edf2f5;
}

.admin-meter i {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--primary), var(--accent));
}

.admin-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 16px;
}

.compact-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.compact-actions form {
    margin: 0;
}

.inline-check {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.notification-strip {
    border-color: rgba(245, 158, 11, .24);
    background: linear-gradient(180deg, #fff, #fffaf0);
}

.notification-list {
    display: grid;
    gap: 8px;
}

.notification-list article {
    display: grid;
    gap: 4px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: #fff;
}

.notification-list span {
    color: var(--muted);
    font-size: 13px;
}

.mini-card {
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
}

.mini-card h3 {
    grid-column: 1 / -1;
    margin: 0 0 4px;
    font-size: 16px;
}

.edit-card {
    margin-bottom: 16px;
    border-color: rgba(14, 165, 233, .3);
    background: linear-gradient(180deg, #ffffff 0%, #f7fbff 100%);
}

@media (max-width: 980px) {
    .app-layout {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
        height: auto;
    }

    .sidebar nav {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .content {
        width: min(100% - 24px, 1360px);
        margin-top: 16px;
    }

    .topbar,
    .section-title,
    .form-row,
    .admin-hero {
        align-items: stretch;
        flex-direction: column;
    }

    .stats,
    .grid-form,
    .card-grid,
    .agent-grid,
    .db-grid,
    .saas-grid {
        grid-template-columns: 1fr;
    }

    .agent-stats,
    .admin-stats,
    .admin-quick-grid,
    .admin-grid,
    .agent-editor > .grid-form,
    .panel:has(input[name="action"][value="create_agent"]) .grid-form,
    .agent-editor .check-grid {
        grid-template-columns: 1fr;
    }

    .agent-title {
        flex-direction: column;
    }

    .webhook-row {
        grid-template-columns: 1fr;
    }

    .map-lane {
        grid-template-columns: 1fr;
    }

    .map-edge::before,
    .map-edge::after {
        display: none;
    }
}

html[dir="rtl"] {
    direction: rtl;
}

html[dir="rtl"] body {
    direction: rtl;
    text-align: right;
}

html[dir="rtl"] .app-layout {
    direction: rtl;
    grid-template-columns: minmax(0, 1fr) 260px;
}

html[dir="rtl"] .sidebar {
    grid-column: 2;
    border-right: 1px solid rgba(255,255,255,.08);
    border-left: 0;
    box-shadow: 10px 0 28px rgba(16, 24, 32, .18);
}

html[dir="rtl"] .content {
    grid-column: 1;
}

html[dir="rtl"] .brand,
html[dir="rtl"] .sidebar nav a,
html[dir="rtl"] .logout,
html[dir="rtl"] .topbar,
html[dir="rtl"] .section-title,
html[dir="rtl"] .form-row,
html[dir="rtl"] .actions,
html[dir="rtl"] .row-actions,
html[dir="rtl"] .button-row,
html[dir="rtl"] .sticky-actions,
html[dir="rtl"] .bulk-tools,
html[dir="rtl"] .language-switch,
html[dir="rtl"] .agent-title,
html[dir="rtl"] .compact-actions {
    direction: rtl;
}

html[dir="rtl"] .sidebar nav a,
html[dir="rtl"] .logout {
    justify-content: flex-start;
    text-align: right;
}

html[dir="rtl"] .sidebar nav a:hover,
html[dir="rtl"] .logout:hover {
    transform: translateX(2px);
}

html[dir="rtl"] .topbar,
html[dir="rtl"] .section-title,
html[dir="rtl"] .admin-hero,
html[dir="rtl"] .admin-card,
html[dir="rtl"] .agent-card,
html[dir="rtl"] .panel,
html[dir="rtl"] .notice,
html[dir="rtl"] .stats > div,
html[dir="rtl"] .db-grid > div,
html[dir="rtl"] .mini-card,
html[dir="rtl"] .article-preview {
    text-align: right;
}

html[dir="rtl"] label,
html[dir="rtl"] th,
html[dir="rtl"] td {
    text-align: right;
}

html[dir="rtl"] table {
    direction: rtl;
}

html[dir="rtl"] input,
html[dir="rtl"] textarea,
html[dir="rtl"] select {
    direction: rtl;
    text-align: right;
}

html[dir="rtl"] input[type="email"],
html[dir="rtl"] input[type="url"],
html[dir="rtl"] input[type="password"],
html[dir="rtl"] input[name*="url" i],
html[dir="rtl"] input[name*="email" i],
html[dir="rtl"] input[name*="key" i],
html[dir="rtl"] input[name*="secret" i],
html[dir="rtl"] input[name*="slug" i],
html[dir="rtl"] input[name*="id" i],
html[dir="rtl"] textarea[name*="json" i],
html[dir="rtl"] .result,
html[dir="rtl"] pre,
html[dir="rtl"] code {
    direction: ltr;
    text-align: left;
}

html[dir="rtl"] .ajax-loader span {
    margin-inline-end: 0;
    margin-inline-start: 12px;
}

html[dir="rtl"] .table-wrap {
    direction: rtl;
}

@media (max-width: 980px) {
    html[dir="rtl"] .app-layout {
        grid-template-columns: 1fr;
    }

    html[dir="rtl"] .sidebar,
    html[dir="rtl"] .content {
        grid-column: auto;
    }
}

/* Professional SaaS shell refresh */
:root {
    --bg: #eef2f5;
    --surface: #ffffff;
    --surface-2: #f7f9fb;
    --surface-3: #edf2f6;
    --text: #17202a;
    --muted: #677481;
    --border: #dce5ea;
    --border-2: #edf1f4;
    --primary: #0b8f76;
    --primary-2: #086b59;
    --accent: #3157d5;
    --cyan: #0d94b8;
    --warn: #a96312;
    --danger: #c83d3d;
    --nav: #151b23;
    --nav-2: #202a36;
    --nav-3: #273445;
    --shadow-sm: 0 8px 22px rgba(22, 32, 42, .06);
    --shadow: 0 20px 50px rgba(22, 32, 42, .12);
    --radius: 8px;
}

body {
    background:
        linear-gradient(180deg, rgba(49, 87, 213, .06), transparent 340px),
        linear-gradient(90deg, rgba(11, 143, 118, .04), transparent 52%),
        var(--bg);
    font-family: "Segoe UI", Tahoma, Arial, sans-serif;
}

.app-layout {
    grid-template-columns: 288px minmax(0, 1fr);
}

.sidebar {
    display: flex;
    flex-direction: column;
    padding: 16px 12px;
    overflow: hidden;
    background:
        linear-gradient(180deg, rgba(255,255,255,.06), transparent 180px),
        linear-gradient(180deg, var(--nav), var(--nav-2));
    border: 0;
    box-shadow: 12px 0 34px rgba(20, 29, 39, .18);
}

.brand {
    flex: 0 0 auto;
    min-height: 72px;
    margin-bottom: 12px;
    padding: 12px;
    border-radius: 8px;
    border-color: rgba(255,255,255,.10);
    background: rgba(255,255,255,.065);
}

.brand-mark {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    background: linear-gradient(135deg, #ffffff, #dbeafe);
    color: #142033;
    box-shadow: inset 0 -1px 0 rgba(0,0,0,.08);
}

.brand strong {
    font-size: 15px;
}

.brand small {
    color: rgba(255,255,255,.66);
}

.language-switch {
    flex: 0 0 auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 7px;
    margin-bottom: 12px;
}

.language-switch a {
    min-height: 34px;
    padding: 0 8px;
    border-radius: 7px;
    background: rgba(255,255,255,.075);
    color: rgba(255,255,255,.86);
}

.sidebar-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 7px;
    margin: 0 0 12px;
    padding: 10px;
    border: 1px solid rgba(255,255,255,.09);
    border-radius: 8px;
    background: rgba(255,255,255,.045);
}

.sidebar-actions::before {
    content: "اختصارات المتجر";
    grid-column: 1 / -1;
    color: rgba(255,255,255,.58);
    font-size: 10px;
    font-weight: 900;
    letter-spacing: .02em;
    text-transform: uppercase;
}

.sidebar-actions a {
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 9px;
    border: 1px solid rgba(255,255,255,.10);
    border-radius: 7px;
    background: rgba(255,255,255,.075);
    color: rgba(255,255,255,.88);
    font-size: 12px;
    font-weight: 900;
    text-align: center;
}

.sidebar-actions a::before {
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-inline-end: 6px;
    border-radius: 6px;
    background: rgba(255,255,255,.10);
    color: #fff;
    font-size: 12px;
    line-height: 1;
}

.sidebar-actions a.primary {
    grid-column: 1 / -1;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #fff;
    box-shadow: 0 10px 24px rgba(15, 159, 132, .20);
}

.sidebar-actions a.primary::before {
    content: "+";
    background: rgba(255,255,255,.18);
}

.sidebar-actions a:not(.primary):nth-child(3)::before {
    content: "↧";
}

.sidebar-actions a:not(.primary):nth-child(4)::before {
    content: "□";
}

.sidebar-actions a:hover {
    text-decoration: none;
    background: rgba(255,255,255,.12);
}

.sidebar nav {
    flex: 1 1 auto;
    display: block;
    overflow-y: auto;
    padding: 4px 2px 8px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.22) transparent;
}

.sidebar nav::-webkit-scrollbar {
    width: 7px;
}

.sidebar nav::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: rgba(255,255,255,.22);
}

.nav-group {
    margin-bottom: 8px;
    border: 1px solid rgba(255,255,255,.075);
    border-radius: 8px;
    background: rgba(255,255,255,.035);
}

.nav-group summary {
    min-height: 38px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 0 11px;
    color: rgba(255,255,255,.72);
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .04em;
    text-transform: uppercase;
    cursor: pointer;
    list-style: none;
}

.nav-group summary::-webkit-details-marker {
    display: none;
}

.nav-group summary::after {
    content: "+";
    width: 21px;
    height: 21px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    background: rgba(255,255,255,.07);
    color: rgba(255,255,255,.78);
    font-size: 14px;
}

.nav-group[open] summary {
    color: #fff;
}

.nav-group[open] summary::after {
    content: "-";
    background: rgba(11, 143, 118, .22);
}

.nav-group > div {
    display: grid;
    gap: 3px;
    padding: 0 6px 7px;
}

.sidebar nav a,
.logout,
.nav-standalone {
    min-height: 36px;
    padding: 0 10px;
    border-radius: 7px;
    color: rgba(255,255,255,.74);
    font-size: 13px;
    font-weight: 750;
}

.sidebar nav a:hover,
.logout:hover {
    transform: none;
    background: rgba(255,255,255,.08);
    color: #fff;
}

.sidebar nav a.active {
    border-color: rgba(11, 143, 118, .42);
    background:
        linear-gradient(90deg, rgba(11, 143, 118, .26), rgba(49, 87, 213, .16));
    color: #fff;
    box-shadow: inset 3px 0 0 var(--primary);
}

.nav-standalone {
    margin-top: 8px;
    border: 1px solid rgba(255,255,255,.10) !important;
    background: rgba(255,255,255,.055);
}

.logout {
    flex: 0 0 auto;
    margin-top: 10px;
    justify-content: center;
    border: 1px solid rgba(200, 61, 61, .24);
    background: rgba(200, 61, 61, .11);
}

.content {
    width: min(1480px, calc(100% - 36px));
    margin: 18px auto 42px;
}

.topbar {
    min-height: 92px;
    margin-bottom: 18px;
    padding: 20px 22px;
    border-radius: 8px;
    border-color: rgba(220, 229, 234, .86);
    background:
        linear-gradient(135deg, rgba(255,255,255,.98), rgba(247,249,251,.92)),
        #fff;
}

.eyebrow {
    min-height: 24px;
    align-items: center;
    padding: 0 9px;
    border-radius: 999px;
    background: #e7f5f1;
    color: var(--primary-2);
}

.topbar h1 {
    margin-top: 6px;
    font-size: 28px;
    font-weight: 850;
}

.panel,
.notice,
.stats > div,
.table-wrap,
.login-card,
.admin-quick-card {
    border-radius: 8px;
}

.panel {
    padding: 18px;
    border-color: rgba(220, 229, 234, .88);
    box-shadow: var(--shadow-sm);
}

.section-title {
    padding-bottom: 13px;
    border-bottom: 1px solid var(--border-2);
}

.section-title h2,
.panel h3 {
    font-size: 18px;
    font-weight: 850;
}

.stats {
    gap: 14px;
}

.stats > div {
    padding: 17px 18px;
    background:
        linear-gradient(180deg, #ffffff, #f8fafb);
}

.stats > div::before {
    width: 3px;
    background: linear-gradient(180deg, var(--primary), var(--accent));
}

.stats strong {
    font-size: 28px;
    font-weight: 850;
}

.grid-form {
    gap: 14px;
}

label {
    color: #44505c;
    font-size: 12px;
    font-weight: 850;
}

input,
select,
textarea {
    border-radius: 7px;
    border-color: #d5e0e6;
    background: #fcfdfe;
}

input,
select {
    height: 40px;
}

.button {
    min-height: 38px;
    border-radius: 7px;
    font-size: 13px;
}

.button.secondary {
    background: #f8fafc;
}

.table-wrap {
    border-color: var(--border);
    width: 100%;
    min-width: 0;
    max-width: 100%;
    display: block;
    overflow-x: auto;
    contain: inline-size;
}

.panel {
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
}

.content {
    min-width: 0;
}

th {
    background: #f5f8fa;
    color: #5d6a76;
}

th,
td {
    padding: 11px 12px;
}

.badge {
    border-radius: 7px;
}

.thumb {
    width: 54px;
    height: 54px;
    object-fit: cover;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: var(--surface-2);
}

.preview-image {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-radius: 7px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    margin-bottom: 10px;
}

html[dir="rtl"] .app-layout {
    grid-template-columns: minmax(0, 1fr) 288px;
}

html[dir="rtl"] .sidebar {
    box-shadow: -12px 0 34px rgba(20, 29, 39, .18);
}

html[dir="rtl"] .sidebar nav a.active {
    box-shadow: inset -3px 0 0 var(--primary);
}

html[dir="rtl"] .nav-group summary::after {
    margin-inline-start: 0;
}

@media (max-width: 980px) {
    .app-layout,
    html[dir="rtl"] .app-layout {
        grid-template-columns: 1fr;
    }

    .sidebar {
        max-height: none;
        overflow: visible;
    }

    .sidebar nav {
        max-height: 420px;
    }

    .content {
        width: min(100% - 24px, 1480px);
    }
}

/* Version 4 dashboard polish */
:root {
    --page-bg: #eef3f6;
    --ink-strong: #101923;
    --panel-line: rgba(203, 213, 225, .78);
    --glass: rgba(255, 255, 255, .88);
}

body {
    background:
        linear-gradient(135deg, rgba(15, 159, 132, .08), transparent 360px),
        linear-gradient(225deg, rgba(36, 107, 254, .08), transparent 420px),
        var(--page-bg);
}

.app-layout {
    grid-template-columns: 296px minmax(0, 1fr);
}

.sidebar {
    padding: 16px 13px;
    background:
        linear-gradient(180deg, rgba(9, 18, 28, .98), rgba(15, 29, 43, .98)),
        var(--nav);
}

.brand {
    min-height: 72px;
    border-radius: 8px;
    background: linear-gradient(135deg, rgba(255,255,255,.11), rgba(255,255,255,.045));
}

.sidebar nav {
    max-height: calc(100vh - 160px);
    padding-inline-end: 3px;
    overflow-y: auto;
}

.nav-group {
    margin-bottom: 5px;
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 8px;
    background: rgba(255,255,255,.035);
}

.nav-group summary {
    min-height: 38px;
    padding: 0 10px;
}

.nav-group > div {
    padding: 0 7px 8px;
}

.sidebar nav a {
    position: relative;
    min-height: 34px;
    border: 1px solid transparent;
}

.sidebar nav a.active {
    background: linear-gradient(90deg, rgba(15,159,132,.34), rgba(36,107,254,.18));
    border-color: rgba(15,159,132,.36);
}

.content {
    width: min(1540px, calc(100% - 40px));
    margin-top: 20px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    min-height: 104px;
    padding: 22px 24px;
    border: 1px solid var(--panel-line);
    background:
        linear-gradient(135deg, rgba(255,255,255,.96), rgba(247,250,252,.88)),
        var(--glass);
    box-shadow: 0 16px 45px rgba(15, 23, 42, .08);
}

.topbar-actions,
.dashboard-actions {
    display: flex;
    gap: 9px;
    align-items: center;
    flex-wrap: wrap;
}

.dashboard-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 22px;
    margin-bottom: 16px;
    padding: 24px;
    border: 1px solid rgba(15, 159, 132, .18);
    border-radius: 8px;
    background:
        linear-gradient(135deg, rgba(15,159,132,.12), rgba(36,107,254,.10)),
        #fff;
    box-shadow: var(--shadow-sm);
}

.dashboard-hero h2 {
    margin-top: 8px;
    color: var(--ink-strong);
    font-size: 30px;
    line-height: 1.15;
}

.dashboard-hero p {
    max-width: 760px;
    margin-top: 8px;
    color: var(--muted);
}

.dashboard-stats > div {
    position: relative;
    min-height: 126px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border: 1px solid var(--panel-line);
    box-shadow: var(--shadow-sm);
}

.dashboard-stats small {
    margin-top: 6px;
    color: var(--muted);
    font-weight: 750;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 16px;
}

.dashboard-card {
    min-height: 220px;
}

.ops-steps {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    margin: 14px 0;
}

.ops-steps span {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #f8fbfc;
    color: var(--text);
    font-size: 12px;
    font-weight: 850;
    text-align: center;
}

.destination-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
    margin-top: 16px;
}

.destination-card {
    display: grid;
    gap: 5px;
    min-height: 126px;
    padding: 16px;
    border: 1px solid var(--panel-line);
    border-radius: 8px;
    background: linear-gradient(180deg, #fff, #f8fafc);
}

.destination-card.active {
    border-color: rgba(15,159,132,.55);
    box-shadow: inset 0 0 0 1px rgba(15,159,132,.22), var(--shadow-sm);
}

.destination-card span {
    color: var(--primary-2);
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
}

.destination-card strong {
    color: var(--ink-strong);
    font-size: 17px;
}

.destination-card small {
    color: var(--muted);
    font-weight: 750;
}

.destination-card a {
    margin-top: 4px;
    font-weight: 850;
}

.panel {
    border: 1px solid var(--panel-line);
    background: rgba(255,255,255,.94);
}

.grid-form {
    align-items: end;
}

select[name="destination_key"] {
    min-height: 44px;
    border-color: rgba(15,159,132,.35);
    background: #fff;
    font-weight: 850;
}

html[dir="rtl"] .topbar,
html[dir="rtl"] .dashboard-hero {
    direction: rtl;
}

html[dir="rtl"] .topbar-actions,
html[dir="rtl"] .dashboard-actions {
    justify-content: flex-start;
}

@media (max-width: 1100px) {
    .topbar,
    .dashboard-hero {
        align-items: flex-start;
        flex-direction: column;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .ops-steps {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* Platform admin console polish */
.admin-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 18px;
    align-items: stretch;
    margin-bottom: 18px;
    padding: 26px;
    border: 1px solid rgba(15, 159, 132, .16);
    border-radius: 8px;
    background:
        radial-gradient(circle at 10% 10%, rgba(15, 159, 132, .14), transparent 34%),
        linear-gradient(135deg, #fff, #eef7f5);
    box-shadow: 0 18px 55px rgba(16, 24, 40, .08);
}

.admin-hero h2 {
    margin: 8px 0 10px;
    font-size: clamp(30px, 4vw, 50px);
    line-height: 1.06;
    letter-spacing: 0;
}

.admin-hero p {
    max-width: 800px;
    color: var(--muted);
    line-height: 1.75;
}

.admin-card {
    display: grid;
    align-content: end;
    gap: 8px;
    min-height: 220px;
    padding: 22px;
    border-radius: 8px;
    background: linear-gradient(155deg, #0b1220, #1d2939);
    color: #fff;
}

.admin-card span,
.admin-card small {
    color: rgba(255,255,255,.68);
    font-weight: 800;
}

.admin-card strong {
    font-size: 26px;
    line-height: 1.15;
}

.admin-console-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-top: 18px;
}

.admin-console-grid a {
    min-height: 150px;
    display: grid;
    align-content: start;
    gap: 8px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
    text-decoration: none;
    box-shadow: 0 12px 34px rgba(16, 24, 40, .055);
}

.admin-console-grid a:hover {
    transform: translateY(-2px);
    border-color: rgba(15, 159, 132, .34);
    box-shadow: 0 18px 46px rgba(16, 24, 40, .09);
}

.admin-console-grid span {
    width: fit-content;
    padding: 5px 8px;
    border-radius: 7px;
    background: rgba(15, 159, 132, .10);
    color: var(--primary);
    font-size: 11px;
    font-weight: 950;
    text-transform: uppercase;
}

.admin-console-grid strong {
    font-size: 18px;
}

.admin-console-grid small {
    color: var(--muted);
    line-height: 1.55;
}

@media (max-width: 1180px) {
    .admin-console-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    .admin-hero,
    .admin-console-grid {
        grid-template-columns: 1fr;
    }
}

/* Final visual override layer */
:root {
    --line: var(--border);
    --ink: var(--text);
    --ink-strong: var(--text);
    --panel-line: var(--border);
}

html,
body {
    min-height: 100%;
}

body {
    color: var(--text);
    background-color: var(--bg);
}

.sidebar-actions::before,
.sidebar-actions a::before {
    content: none;
}

.sidebar-actions {
    align-items: stretch;
}

.sidebar-actions a {
    border: 1px solid rgba(255, 255, 255, .12);
    background: rgba(255, 255, 255, .06);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .03);
}

.sidebar-actions a.primary {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    box-shadow: 0 12px 30px rgba(15, 159, 132, .24);
}

.topbar,
.panel,
.notice,
.info-card,
.agent,
.agent-editor,
.mini-card,
.destination-card,
.admin-console-grid a,
.admin-card {
    box-shadow: var(--shadow-sm);
}

.topbar,
.panel,
.notice,
.stats > div,
.table-wrap,
.info-card,
.agent,
.agent-editor,
.mini-card,
.destination-card,
.admin-console-grid a {
    border: 1px solid var(--border);
    background: var(--surface);
}

.topbar {
    align-items: center;
    gap: 16px;
}

.topbar h1 {
    font-size: clamp(24px, 2vw, 30px);
    line-height: 1.15;
}

.topbar p,
.section-title p,
.panel p,
.admin-hero p {
    color: var(--muted);
    line-height: 1.7;
}

.section-title {
    align-items: center;
    gap: 14px;
}

.section-title h2,
.panel h3,
.admin-console-grid strong {
    letter-spacing: 0;
    line-height: 1.25;
}

.button,
.sidebar nav a,
.logout,
.language-switch a,
.admin-console-grid a,
.button-row a,
.button-row button,
.sticky-actions .button,
.compact-actions .button,
form .button {
    border-radius: 10px;
    font-weight: 800;
    letter-spacing: 0;
    transition: transform .15s ease, box-shadow .15s ease, background-color .15s ease, border-color .15s ease, color .15s ease;
}

.button {
    min-height: 42px;
    padding: 0 16px;
    border: 1px solid rgba(15, 159, 132, .2);
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    color: #fff;
    box-shadow: 0 10px 24px rgba(15, 159, 132, .2);
}

.button:hover,
.sidebar nav a:hover,
.logout:hover,
.admin-console-grid a:hover {
    transform: translateY(-1px);
}

.button.secondary,
.button.ghost {
    background: #f8fafc;
    border-color: var(--border);
    color: var(--text);
    box-shadow: 0 6px 18px rgba(15, 23, 42, .05);
}

.button.ghost {
    color: var(--primary-2);
}

.button.warning {
    background: #fff7e6;
    border-color: rgba(217, 119, 6, .18);
    color: #92400e;
}

.button.danger {
    background: #fff1f2;
    border-color: rgba(220, 38, 38, .16);
    color: #b91c1c;
}

.button-row,
.sticky-actions,
.compact-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.button-row {
    margin-top: 10px;
}

.sticky-actions {
    position: sticky;
    bottom: 0;
    z-index: 3;
    padding: 10px 0 0;
    background: linear-gradient(180deg, rgba(243, 246, 248, 0), rgba(243, 246, 248, .96) 24%);
}

.compact-actions {
    gap: 6px;
}

.compact-actions form {
    margin: 0;
}

.stats {
    gap: 14px;
}

.stats > div {
    padding: 18px;
    border-radius: 12px;
    background: linear-gradient(180deg, #ffffff, #f8fbfd);
}

.stats > div span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.stats > div strong {
    color: var(--text);
    font-size: 30px;
    line-height: 1.1;
}

.stats > div small {
    color: var(--soft);
}

.grid-form {
    gap: 16px;
}

label {
    color: #334155;
    font-size: 12px;
    font-weight: 800;
}

input,
select,
textarea {
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
    color: var(--text);
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, .03);
}

input:focus,
select:focus,
textarea:focus {
    border-color: rgba(15, 159, 132, .45);
    box-shadow: 0 0 0 3px rgba(15, 159, 132, .12);
    outline: none;
}

.mini-input {
    min-width: 80px;
    max-width: 110px;
}

.table-wrap {
    border-radius: 12px;
    overflow: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    background: #f6f8fb;
    color: #52606d;
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

td {
    color: var(--text);
}

tbody tr:hover td {
    background: #f8fbfd;
}

.badge {
    border-radius: 999px;
    padding: 4px 10px;
    font-weight: 800;
}

.badge.ok {
    background: rgba(15, 159, 132, .12);
    color: var(--primary-2);
}

.badge.warning,
.badge.warn {
    background: rgba(217, 119, 6, .12);
    color: #9a5800;
}

.badge.danger {
    background: rgba(220, 38, 38, .12);
    color: #b42318;
}

.thumb,
.preview-image {
    border-radius: 10px;
    border: 1px solid var(--border);
}

.admin-hero {
    border-radius: 14px;
}

.admin-console-grid {
    gap: 14px;
}

.admin-console-grid a {
    border-radius: 14px;
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}

.admin-console-grid span {
    border-radius: 999px;
}

html[dir="rtl"] .topbar,
html[dir="rtl"] .section-title,
html[dir="rtl"] .button-row,
html[dir="rtl"] .sticky-actions,
html[dir="rtl"] .compact-actions,
html[dir="rtl"] .admin-console-grid {
    direction: rtl;
}

html[dir="rtl"] .topbar-actions,
html[dir="rtl"] .button-row,
html[dir="rtl"] .sticky-actions,
html[dir="rtl"] .compact-actions {
    justify-content: flex-start;
}

html[dir="rtl"] .sidebar nav a.active {
    box-shadow: inset -3px 0 0 var(--primary);
}

@media (max-width: 980px) {
    .app-layout,
    html[dir="rtl"] .app-layout {
        grid-template-columns: 1fr;
    }

    .sidebar {
        max-height: none;
        overflow: visible;
    }

    .content {
        width: min(100% - 20px, 1480px);
        margin: 14px auto 28px;
    }

    .button-row,
    .sticky-actions,
    .compact-actions {
        width: 100%;
    }
}

/* Version 9 professional dashboard system */
:root {
    --bg: #eef3f7;
    --surface: #ffffff;
    --surface-2: #f7fafc;
    --surface-3: #edf4f7;
    --text: #111827;
    --muted: #64748b;
    --soft: #94a3b8;
    --border: #d8e1e8;
    --border-2: #edf2f5;
    --primary: #07866f;
    --primary-2: #055f52;
    --accent: #2563eb;
    --cyan: #0e7490;
    --warn: #b45309;
    --danger: #b91c1c;
    --nav: #0c1420;
    --nav-2: #121d2b;
    --shadow-sm: 0 8px 22px rgba(15, 23, 42, .06);
    --shadow: 0 20px 55px rgba(15, 23, 42, .11);
    --focus: 0 0 0 3px rgba(7, 134, 111, .14);
    --radius: 8px;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--bg);
}

body {
    min-height: 100vh;
    margin: 0;
    background:
        linear-gradient(180deg, rgba(255,255,255,.78), rgba(255,255,255,0) 260px),
        var(--bg);
    color: var(--text);
    font-family: "Segoe UI", Tahoma, Arial, sans-serif;
    font-size: 14px;
    letter-spacing: 0;
}

.app-layout {
    display: grid;
    grid-template-columns: 296px minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 16px 14px;
    overflow-y: auto;
    background: linear-gradient(180deg, var(--nav), var(--nav-2));
    border: 0;
    box-shadow: 16px 0 42px rgba(15, 23, 42, .18);
    scrollbar-width: thin;
}

.brand {
    min-height: 76px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border: 1px solid rgba(255,255,255,.09);
    border-radius: 8px;
    background: rgba(255,255,255,.055);
}

.brand strong {
    display: block;
    color: #f8fafc;
    font-size: 15px;
    line-height: 1.3;
}

.brand small {
    display: block;
    margin-top: 4px;
    color: rgba(226, 232, 240, .62);
    font-size: 12px;
    line-height: 1.4;
}

.brand-mark {
    width: 46px;
    height: 46px;
    flex: 0 0 46px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: #f8fafc;
    color: #0f172a;
    font-weight: 950;
    box-shadow: 0 12px 28px rgba(0,0,0,.16);
}

.language-switch {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin: 12px 0;
}

.language-switch a,
.sidebar-actions a {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 12px;
    border: 1px solid rgba(255,255,255,.09);
    border-radius: 8px;
    background: rgba(255,255,255,.045);
    color: rgba(248,250,252,.84);
    text-decoration: none;
    font-size: 12px;
    font-weight: 850;
    transition: background .16s ease, border-color .16s ease, color .16s ease, transform .16s ease;
}

.language-switch a:hover,
.sidebar-actions a:hover {
    background: rgba(255,255,255,.075);
    border-color: rgba(255,255,255,.16);
    color: #fff;
}

.sidebar-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 14px;
    padding: 10px;
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 8px;
    background: rgba(255,255,255,.035);
}

.sidebar-actions a.primary {
    grid-column: 1 / -1;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    border-color: transparent;
    color: #fff;
}

.nav-group {
    margin: 0 0 9px;
    border: 1px solid rgba(255,255,255,.07);
    border-radius: 8px;
    background: rgba(255,255,255,.026);
    overflow: hidden;
}

.nav-group summary {
    min-height: 40px;
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 0 12px;
    color: rgba(226,232,240,.72);
    font-size: 12px;
    font-weight: 950;
    cursor: pointer;
}

.nav-group summary::before {
    content: "+";
    width: 22px;
    height: 22px;
    display: inline-grid;
    place-items: center;
    border-radius: 7px;
    background: rgba(255,255,255,.06);
    color: rgba(255,255,255,.78);
    font-size: 14px;
}

.nav-group[open] summary::before {
    content: "-";
    background: rgba(7,134,111,.22);
    color: #d9fff5;
}

.nav-group summary::-webkit-details-marker {
    display: none;
}

.nav-group div {
    display: grid;
    gap: 4px;
    padding: 0 7px 9px;
}

.sidebar nav a,
.logout {
    min-height: 38px;
    display: flex;
    align-items: center;
    border-radius: 8px;
    padding: 0 11px;
    color: rgba(226,232,240,.72);
    text-decoration: none;
    font-size: 13px;
    font-weight: 800;
    border: 1px solid transparent;
    transition: background .16s ease, border-color .16s ease, color .16s ease, transform .16s ease;
}

.sidebar nav a:hover {
    background: rgba(255,255,255,.06);
    border-color: rgba(255,255,255,.09);
    color: #fff;
}

.sidebar nav a.active {
    background: rgba(7,134,111,.18);
    border-color: rgba(45,212,191,.18);
    color: #ecfeff;
    box-shadow: inset 3px 0 0 #2dd4bf;
}

html[dir="rtl"] .sidebar nav a.active {
    box-shadow: inset -3px 0 0 #2dd4bf;
}

.logout {
    justify-content: center;
    margin-top: 14px;
    border-color: rgba(248,113,113,.18);
    background: rgba(127,29,29,.20);
    color: #fecaca;
}

.content {
    width: min(1500px, calc(100% - 36px));
    margin: 18px auto 44px;
}

.topbar {
    position: sticky;
    top: 14px;
    z-index: 5;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 18px;
    align-items: center;
    margin-bottom: 18px;
    padding: 18px 20px;
    border: 1px solid rgba(216,225,232,.82);
    border-radius: 8px;
    background: rgba(255,255,255,.92);
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(14px);
}

.topbar .eyebrow {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 0 9px;
    border-radius: 999px;
    background: #e8f7f3;
    color: var(--primary-2);
    font-size: 11px;
    font-weight: 950;
}

.topbar h1 {
    margin: 8px 0 4px;
    color: #0f172a;
    font-size: 28px;
    line-height: 1.2;
    font-weight: 950;
}

.topbar p {
    margin: 0;
    color: var(--muted);
    line-height: 1.6;
}

.topbar-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}

.panel,
.notice,
.stats > div,
.info-card,
.agent,
.agent-editor,
.mini-card,
.destination-card,
.article-preview,
.map-node,
.map-edge {
    border-radius: 8px;
}

.panel {
    margin-bottom: 16px;
    padding: 18px;
    border: 1px solid rgba(216,225,232,.88);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.section-title {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: flex-start;
    margin-bottom: 16px;
    padding-bottom: 13px;
    border-bottom: 1px solid var(--border-2);
}

.section-title h2,
.panel h3 {
    margin: 0;
    color: #0f172a;
    font-size: 19px;
    line-height: 1.3;
    font-weight: 950;
}

.section-title p {
    margin: 5px 0 0;
    color: var(--muted);
    line-height: 1.55;
}

.stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 16px;
}

.stats > div {
    min-height: 112px;
    padding: 18px;
    border: 1px solid rgba(216,225,232,.9);
    background: linear-gradient(180deg, #fff, #f8fbfd);
    box-shadow: var(--shadow-sm);
}

.stats > div span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
}

.stats > div strong {
    display: block;
    margin-top: 7px;
    color: #0f172a;
    font-size: 30px;
    line-height: 1.1;
    font-weight: 950;
    overflow-wrap: anywhere;
}

.stats > div small {
    display: block;
    margin-top: 7px;
    color: var(--soft);
    line-height: 1.4;
}

.grid-form,
.form-row {
    gap: 14px;
}

.grid-form {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.grid-form .wide,
label.wide {
    grid-column: 1 / -1;
}

label {
    display: grid;
    gap: 7px;
    color: #334155;
    font-size: 12px;
    font-weight: 900;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid #cfdbe4;
    border-radius: 8px;
    background: #fff;
    color: var(--text);
    font: inherit;
    box-shadow: inset 0 1px 2px rgba(15,23,42,.035);
}

input,
select {
    min-height: 42px;
    padding: 0 12px;
}

textarea {
    min-height: 118px;
    padding: 11px 12px;
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    border-color: rgba(7,134,111,.55);
    outline: none;
    box-shadow: var(--focus);
}

.button,
button.button,
a.button {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 0 14px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: var(--primary);
    color: #fff;
    text-decoration: none;
    font-size: 13px;
    font-weight: 900;
    line-height: 1;
    cursor: pointer;
    transition: transform .14s ease, box-shadow .14s ease, background .14s ease, border-color .14s ease;
    white-space: nowrap;
}

.button:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 22px rgba(7,134,111,.16);
}

.button.secondary {
    background: #eef6f8;
    border-color: #d5e5ea;
    color: #0f4c5c;
}

.button.ghost {
    background: #fff;
    border-color: #d8e1e8;
    color: #334155;
}

.button.warning {
    background: #fff7ed;
    border-color: #fed7aa;
    color: #9a3412;
}

.button.danger {
    background: #fff1f2;
    border-color: #fecdd3;
    color: #b91c1c;
}

.button-row,
.sticky-actions,
.compact-actions,
.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.sticky-actions {
    position: sticky;
    bottom: 12px;
    z-index: 4;
    margin-top: 14px;
    padding: 10px;
    border: 1px solid rgba(216,225,232,.92);
    border-radius: 8px;
    background: rgba(255,255,255,.93);
    box-shadow: var(--shadow);
    backdrop-filter: blur(14px);
}

.bulk-toolbar {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    flex-wrap: wrap;
    margin: 14px 0;
    padding: 10px;
    border: 1px solid rgba(20, 184, 166, .22);
    border-radius: 8px;
    background: linear-gradient(135deg, rgba(20, 184, 166, .08), rgba(37, 99, 235, .06));
    box-shadow: var(--shadow-soft);
}

.bulk-toolbar .switch {
    margin-inline-end: auto;
}

html[dir="rtl"] .bulk-toolbar {
    justify-content: flex-end;
}

html[dir="rtl"] .bulk-toolbar .switch {
    margin-inline-end: 0;
    margin-inline-start: auto;
}

.table-wrap {
    border: 1px solid rgba(216,225,232,.92);
    border-radius: 8px;
    background: #fff;
    overflow: auto;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.75);
}

table {
    width: 100%;
    min-width: 960px;
    border-collapse: separate;
    border-spacing: 0;
}

th,
td {
    padding: 12px 13px;
    border-bottom: 1px solid var(--border-2);
    vertical-align: top;
    text-align: inherit;
}

th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #f6f9fb;
    color: #475569;
    font-size: 11px;
    font-weight: 950;
    text-transform: uppercase;
}

td {
    color: #1f2937;
    line-height: 1.48;
}

tbody tr:nth-child(even) td {
    background: #fcfdfe;
}

tbody tr:hover td {
    background: #f3faf8;
}

td small,
.muted {
    color: var(--muted);
}

.badge {
    min-height: 24px;
    display: inline-flex;
    align-items: center;
    padding: 3px 9px;
    border-radius: 999px;
    background: #edf2f7;
    color: #475569;
    font-size: 11px;
    font-weight: 900;
    line-height: 1;
}

.badge.ok {
    background: #dff8ef;
    color: #065f46;
}

.badge.warning,
.badge.warn {
    background: #fff4db;
    color: #92400e;
}

.badge.danger {
    background: #fee2e2;
    color: #991b1b;
}

.destination-grid,
.dashboard-grid,
.admin-console-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.destination-card,
.info-card,
.mini-card,
.agent {
    border: 1px solid rgba(216,225,232,.92);
    background: #fff;
    box-shadow: var(--shadow-sm);
}

.destination-card {
    display: grid;
    gap: 7px;
    padding: 15px;
}

.destination-card.active {
    border-color: rgba(7,134,111,.35);
    background: #f2fbf8;
}

.destination-card span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
}

.destination-card strong {
    color: #0f172a;
    font-size: 17px;
    line-height: 1.3;
}

.destination-card a {
    color: var(--accent);
    font-weight: 900;
    text-decoration: none;
}

.dashboard-card {
    min-height: 100%;
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 0;
}

.dashboard-card .section-title {
    display: block;
    margin-bottom: 0;
}

.dashboard-card .button-row {
    margin-top: auto;
}

.ops-steps {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.ops-steps span {
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 10px;
    border: 1px solid #d8e8e4;
    border-radius: 8px;
    background: #f2fbf8;
    color: #075e52;
    font-size: 12px;
    font-weight: 900;
    text-align: center;
}

.dashboard-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
    align-items: center;
}

html[dir="rtl"] .dashboard-actions {
    justify-content: flex-start;
}

.product-workspace {
    display: grid;
    gap: 12px;
}

.product-card {
    display: grid;
    grid-template-columns: 34px minmax(220px, 1.25fr) minmax(360px, 1.7fr) minmax(180px, .75fr) minmax(145px, .6fr) minmax(190px, .8fr);
    gap: 14px;
    align-items: start;
    padding: 14px;
    border: 1px solid rgba(216,225,232,.92);
    border-radius: 8px;
    background: #fff;
    box-shadow: var(--shadow-sm);
}

.product-card:hover {
    border-color: rgba(7,134,111,.28);
    box-shadow: 0 14px 34px rgba(15,23,42,.08);
}

.product-select {
    padding-top: 5px;
}

.product-select input {
    width: 18px;
    height: 18px;
    min-height: 18px;
}

.product-main {
    min-width: 0;
    display: grid;
    gap: 6px;
}

.product-main strong {
    color: #0f172a;
    font-size: 15px;
    line-height: 1.45;
    font-weight: 950;
    overflow-wrap: anywhere;
}

.product-main small {
    color: var(--muted);
    overflow-wrap: anywhere;
}

.product-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.product-meta span {
    min-height: 24px;
    display: inline-flex;
    align-items: center;
    padding: 0 8px;
    border-radius: 999px;
    background: #f1f5f9;
    color: #475569;
    font-size: 11px;
    font-weight: 850;
    max-width: 100%;
    overflow-wrap: anywhere;
}

.product-price-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
}

.product-price-grid > div {
    min-height: 76px;
    display: grid;
    align-content: center;
    gap: 5px;
    padding: 10px;
    border: 1px solid #e2eaf0;
    border-radius: 8px;
    background: #f8fbfd;
}

.product-price-grid span {
    color: var(--muted);
    font-size: 11px;
    font-weight: 900;
}

.product-price-grid strong {
    color: #0f172a;
    font-size: 14px;
    line-height: 1.3;
    font-weight: 950;
}

.product-price-grid small {
    color: var(--soft);
    font-size: 11px;
}

.product-price-grid .final {
    background: #eefbf7;
    border-color: #c9eadf;
}

.product-price-grid .final strong {
    color: #065f46;
    font-size: 16px;
}

.product-pricing-control .mini-stack {
    min-width: 0;
}

.product-pricing-control .mini-input {
    max-width: none;
    min-width: 0;
}

.product-statuses {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    align-items: center;
}

.product-statuses small {
    flex-basis: 100%;
    color: var(--muted);
    font-size: 11px;
    overflow-wrap: anywhere;
}

.product-actions {
    justify-content: flex-start;
}

.product-actions .button {
    min-height: 34px;
    padding-inline: 11px;
}

html[dir="rtl"] .product-actions {
    justify-content: flex-start;
}

input[type="checkbox"],
input[type="radio"] {
    width: 16px;
    height: 16px;
    min-height: 16px;
    padding: 0;
    margin: 0;
    box-shadow: none;
    accent-color: var(--primary);
}

.switch,
.compact-switch {
    width: fit-content;
    min-height: 28px;
    display: inline-flex !important;
    grid-template-columns: none !important;
    align-items: center;
    gap: 7px !important;
    padding: 0;
    color: #334155 !important;
    font-size: 12px;
    line-height: 1;
}

.product-pricing-control {
    padding: 10px;
    border: 1px solid #e2eaf0;
    border-radius: 8px;
    background: #f8fbfd;
}

.product-pricing-control .mini-stack {
    grid-template-columns: 1fr;
    gap: 7px;
}

.product-pricing-control label {
    font-size: 11px;
    color: #526174;
}

.product-pricing-control input[type="number"] {
    min-height: 34px;
    padding: 0 10px;
    border-radius: 7px;
    font-size: 12px;
    font-weight: 800;
}

.product-price-grid > div {
    min-height: 68px;
    padding: 9px;
}

.product-price-grid strong {
    font-size: 13px;
}

.product-price-grid .final strong {
    font-size: 15px;
}

.mini-input {
    min-width: 82px;
    max-width: 124px;
}

.mini-stack {
    display: grid;
    gap: 8px;
    min-width: 170px;
}

.mini-stack label {
    gap: 4px;
    font-size: 11px;
}

.compact-switch {
    min-height: 28px;
}

.ajax-loader {
    background: rgba(15,23,42,.52);
    backdrop-filter: blur(9px);
}

.ajax-loader > * {
    border-radius: 8px;
}

.notice {
    padding: 13px 15px;
    border: 1px solid rgba(37,99,235,.18);
    background: #eff6ff;
    color: #1e3a8a;
    box-shadow: var(--shadow-sm);
}

.dashboard-hero,
.admin-hero {
    border: 1px solid rgba(15,23,42,.12);
    border-radius: 8px;
    background: linear-gradient(135deg, #0f172a, #0f4c5c 58%, #065f46);
    box-shadow: var(--shadow);
}

.dashboard-hero h2,
.dashboard-hero p,
.dashboard-hero .eyebrow,
.admin-hero h2,
.admin-hero p {
    color: #fff;
}

html[dir="rtl"] body {
    text-align: right;
}

html[dir="rtl"] .topbar,
html[dir="rtl"] .section-title,
html[dir="rtl"] .button-row,
html[dir="rtl"] .sticky-actions,
html[dir="rtl"] .compact-actions,
html[dir="rtl"] .actions {
    direction: rtl;
}

html[dir="rtl"] .topbar-actions,
html[dir="rtl"] .button-row,
html[dir="rtl"] .sticky-actions,
html[dir="rtl"] .compact-actions,
html[dir="rtl"] .actions {
    justify-content: flex-start;
}

@media (max-width: 1180px) {
    .grid-form,
    .stats,
    .destination-grid,
    .dashboard-grid,
    .admin-console-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .topbar {
        grid-template-columns: 1fr;
    }

    .product-card {
        grid-template-columns: 34px minmax(0, 1fr);
    }

    .product-price-grid,
    .product-pricing-control,
    .product-statuses,
    .product-actions {
        grid-column: 2;
    }

    .product-price-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 860px) {
    .app-layout,
    html[dir="rtl"] .app-layout {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
        height: auto;
        max-height: none;
        border-radius: 0;
    }

    .content {
        width: min(100% - 18px, 1500px);
        margin: 12px auto 28px;
    }

    .topbar {
        position: static;
    }

    .grid-form,
    .stats,
    .destination-grid,
    .dashboard-grid,
    .admin-console-grid {
        grid-template-columns: 1fr;
    }

    .section-title {
        display: block;
    }

    .product-card {
        grid-template-columns: 1fr;
    }

    .product-select,
    .product-price-grid,
    .product-pricing-control,
    .product-statuses,
    .product-actions {
        grid-column: auto;
    }

    .product-price-grid {
        grid-template-columns: 1fr;
    }
}

/* Version 10 polished SaaS design audit */
:root {
    --bg: #edf2f6;
    --surface: #ffffff;
    --surface-2: #f8fafc;
    --surface-3: #eef5f7;
    --text: #0f172a;
    --muted: #64748b;
    --soft: #94a3b8;
    --border: #d7e1e8;
    --border-2: #ebf1f5;
    --primary: #07866f;
    --primary-2: #075e52;
    --accent: #2563eb;
    --warn: #b45309;
    --danger: #b91c1c;
    --nav: #0b1220;
    --nav-2: #121c2b;
    --shadow-sm: 0 8px 22px rgba(15, 23, 42, .055);
    --shadow: 0 22px 60px rgba(15, 23, 42, .12);
    --radius: 8px;
}

html[dir="rtl"] {
    direction: rtl;
}

body {
    font-family: "Inter", "Cairo", "Segoe UI", Tahoma, Arial, sans-serif !important;
    background:
        linear-gradient(180deg, rgba(255,255,255,.9), rgba(255,255,255,0) 280px),
        radial-gradient(circle at 12% 0%, rgba(37,99,235,.07), transparent 290px),
        radial-gradient(circle at 88% 5%, rgba(7,134,111,.07), transparent 310px),
        var(--bg) !important;
    color: var(--text);
}

html[dir="rtl"] body {
    font-family: "Cairo", "Inter", "Segoe UI", Tahoma, Arial, sans-serif !important;
    text-align: right;
}

.app-layout {
    grid-template-columns: 292px minmax(0, 1fr) !important;
    grid-template-areas: "sidebar content";
}

html[dir="rtl"] .app-layout {
    grid-template-columns: minmax(0, 1fr) 292px !important;
    grid-template-areas: "content sidebar" !important;
}

.sidebar {
    grid-area: sidebar;
}

.content {
    grid-area: content;
}

html[dir="rtl"] .sidebar {
    grid-area: sidebar !important;
    box-shadow: -16px 0 42px rgba(15, 23, 42, .18) !important;
}

html[dir="rtl"] .content {
    grid-area: content !important;
}

.sidebar {
    background:
        linear-gradient(180deg, rgba(255,255,255,.035), transparent 190px),
        linear-gradient(180deg, var(--nav), var(--nav-2)) !important;
}

.brand,
.language-switch a,
.sidebar-actions,
.nav-group,
.sidebar nav a,
.logout,
.topbar,
.panel,
.stats > div,
.destination-card,
.product-card,
.button,
input,
select,
textarea,
.table-wrap,
.notice {
    border-radius: 8px !important;
}

.brand {
    border-color: rgba(255,255,255,.10) !important;
    background: rgba(255,255,255,.06) !important;
}

.brand strong,
.sidebar nav a,
.nav-group summary,
.sidebar-actions a,
.language-switch a,
.logout {
    letter-spacing: 0;
}

.nav-group summary {
    justify-content: flex-start;
}

html[dir="rtl"] .nav-group summary {
    flex-direction: row;
}

.sidebar nav a.active {
    background: linear-gradient(90deg, rgba(7,134,111,.26), rgba(37,99,235,.16)) !important;
    border-color: rgba(45,212,191,.20) !important;
}

html[dir="rtl"] .sidebar nav a.active {
    box-shadow: inset -3px 0 0 #2dd4bf !important;
}

.content {
    width: min(1520px, calc(100% - 36px)) !important;
    margin: 18px auto 44px !important;
}

.topbar {
    top: 12px;
    min-height: 116px;
    padding: 20px 22px !important;
    border: 1px solid rgba(215,225,232,.9) !important;
    background: rgba(255,255,255,.94) !important;
    box-shadow: var(--shadow-sm) !important;
}

.topbar h1 {
    font-size: 30px !important;
    font-weight: 900 !important;
    letter-spacing: 0 !important;
}

html[dir="rtl"] .topbar h1 {
    font-weight: 900 !important;
}

.topbar p,
.section-title p {
    color: #667085 !important;
    line-height: 1.75;
}

.panel {
    padding: 18px !important;
    border: 1px solid rgba(215,225,232,.92) !important;
    background: rgba(255,255,255,.98) !important;
    box-shadow: var(--shadow-sm) !important;
}

.section-title {
    gap: 16px;
    margin-bottom: 16px !important;
}

.section-title h2 {
    font-size: 20px !important;
    font-weight: 900 !important;
    letter-spacing: 0 !important;
}

.stats {
    gap: 12px !important;
}

.stats > div {
    min-height: 96px !important;
    padding: 16px !important;
    border: 1px solid rgba(215,225,232,.9) !important;
    background: linear-gradient(180deg, #fff, #f8fbfd) !important;
}

.stats > div strong {
    font-size: 28px !important;
}

.grid-form {
    gap: 12px !important;
}

label {
    gap: 6px !important;
    color: #344054 !important;
    font-size: 12px !important;
    font-weight: 800 !important;
}

input,
select,
textarea {
    border-color: #cfdbe5 !important;
    background: #fff !important;
    color: #0f172a !important;
    font-family: inherit !important;
}

input,
select {
    min-height: 40px !important;
    padding: 0 11px !important;
}

textarea {
    padding: 10px 11px !important;
}

input[type="checkbox"],
input[type="radio"] {
    width: 16px !important;
    height: 16px !important;
    min-width: 16px !important;
    min-height: 16px !important;
    padding: 0 !important;
}

.button {
    min-height: 36px !important;
    padding: 0 13px !important;
    font-weight: 850 !important;
    box-shadow: none;
}

.button:hover {
    transform: translateY(-1px);
}

.table-wrap {
    border-color: rgba(215,225,232,.92) !important;
}

th {
    color: #475467 !important;
    font-size: 11px !important;
    letter-spacing: 0 !important;
}

td {
    font-size: 13px;
}

.badge {
    min-height: 22px !important;
    padding: 3px 8px !important;
    font-size: 11px !important;
}

.destination-grid {
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)) !important;
}

.destination-card {
    padding: 14px !important;
}

.product-workspace {
    gap: 12px !important;
}

.inline-card {
    display: grid !important;
    gap: 12px !important;
    padding: 18px !important;
    border: 1px solid rgba(203, 213, 225, 0.9) !important;
    border-radius: 14px !important;
    background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(248,250,252,.94)) !important;
    box-shadow: 0 10px 24px rgba(15,23,42,.05) !important;
}

.inline-card small {
    color: #64748b !important;
    line-height: 1.5 !important;
}

.product-card {
    grid-template-columns: 30px minmax(245px, 1.25fr) minmax(350px, 1.55fr) minmax(170px, .7fr) minmax(140px, .6fr) minmax(190px, .82fr) !important;
    align-items: stretch !important;
    padding: 16px !important;
    border-color: rgba(203,213,225,.95) !important;
    border-radius: 14px !important;
    background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%) !important;
}

html[dir="rtl"] .product-card {
    direction: rtl;
}

.product-main strong {
    font-size: 15px !important;
    font-weight: 900 !important;
}

.product-meta span {
    min-height: 23px !important;
    font-size: 11px !important;
}

.product-price-grid {
    grid-template-columns: repeat(4, minmax(74px, 1fr)) !important;
    gap: 7px !important;
}

.product-price-grid > div {
    min-height: 66px !important;
    padding: 8px !important;
    border-color: #dfe8ee !important;
    border-radius: 12px !important;
    background: #f8fbfd !important;
}

.product-price-grid strong {
    font-size: 13px !important;
}

.product-price-grid .final strong {
    font-size: 15px !important;
}

.product-pricing-control {
    padding: 9px !important;
    border-color: #dfe8ee !important;
    background: #f8fbfd !important;
}

.product-pricing-control .mini-stack {
    min-width: 0 !important;
    gap: 6px !important;
}

.product-pricing-control input[type="number"] {
    min-height: 32px !important;
    font-size: 12px !important;
}

.switch,
.compact-switch {
    min-height: 24px !important;
    font-size: 11px !important;
    font-weight: 800 !important;
}

.product-actions {
    align-content: start;
    gap: 7px !important;
}

.product-actions .button {
    min-height: 32px !important;
    padding-inline: 10px !important;
    font-size: 12px !important;
}

.sticky-actions {
    border-color: rgba(203,213,225,.95) !important;
    background: rgba(255,255,255,.95) !important;
}

section.panel > .section-title + .stats,
section.panel > .section-title + .grid-form,
section.panel > .section-title + .destination-grid,
section.panel > .section-title + form,
section.panel > form + .sticky-actions,
section.panel > .product-workspace {
    margin-top: 18px !important;
}

section.panel > .grid-form,
section.panel > .destination-grid,
section.panel > .product-workspace,
section.panel > form > .product-workspace {
    padding-top: 16px !important;
    border-top: 1px solid rgba(148, 163, 184, 0.18) !important;
}

@media (max-width: 1280px) {
    .product-card {
        grid-template-columns: 30px minmax(0, 1fr) !important;
    }

    .product-price-grid,
    .product-pricing-control,
    .product-statuses,
    .product-actions {
        grid-column: 2 !important;
    }

    .product-price-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
}

@media (max-width: 860px) {
    .app-layout,
    html[dir="rtl"] .app-layout {
        grid-template-columns: 1fr !important;
    }

    html[dir="rtl"] .sidebar,
    html[dir="rtl"] .content {
        grid-column: auto;
        grid-row: auto;
    }

    .sidebar {
        position: static !important;
        height: auto !important;
        box-shadow: none !important;
    }

    .product-card {
        grid-template-columns: 1fr !important;
    }

    .product-price-grid,
    .product-pricing-control,
    .product-statuses,
    .product-actions {
        grid-column: auto !important;
    }

    .product-price-grid {
        grid-template-columns: 1fr !important;
    }
}

/* Final RTL sidebar placement */
.app-layout {
    display: flex !important;
    flex-direction: row !important;
    align-items: stretch;
}

html[dir="rtl"] .app-layout {
    flex-direction: row-reverse !important;
}

.sidebar {
    flex: 0 0 292px !important;
    width: 292px !important;
}

.content {
    flex: 1 1 auto !important;
    min-width: 0;
}

html[dir="rtl"] .sidebar,
html[dir="rtl"] .content {
    direction: rtl;
}

.inline-card {
    display: grid;
    gap: 14px;
    padding: 18px;
    border: 1px solid rgba(148, 163, 184, 0.26);
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 250, 252, 0.92));
    box-shadow: 0 16px 34px rgba(15, 23, 42, 0.06);
}

.inline-card .button {
    justify-self: start;
}

html[dir="rtl"] .inline-card .button {
    justify-self: end;
}

@media (max-width: 860px) {
    .app-layout,
    html[dir="rtl"] .app-layout {
        display: block !important;
    }

    .sidebar {
        width: 100% !important;
    }
}

/* Final professional typography pass */
.content {
    font-size: 14px !important;
    line-height: 1.65 !important;
}

.topbar h1 {
    font-size: clamp(24px, 2vw, 34px) !important;
    line-height: 1.2 !important;
    font-weight: 900 !important;
    letter-spacing: 0 !important;
}

.topbar p,
.section-title p,
.muted {
    font-size: 13px !important;
    line-height: 1.7 !important;
    color: #64748b !important;
}

.section-title {
    gap: 8px !important;
    align-items: flex-start !important;
}

.section-title h2 {
    font-size: 22px !important;
    line-height: 1.3 !important;
    font-weight: 900 !important;
    letter-spacing: 0 !important;
}

.stats {
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)) !important;
    gap: 12px !important;
}

.stats > div {
    min-height: 104px !important;
    padding: 18px !important;
    border-radius: 14px !important;
    display: grid !important;
    align-content: center !important;
    gap: 7px !important;
    overflow: hidden !important;
}

.stats > div span {
    font-size: 12px !important;
    line-height: 1.3 !important;
    font-weight: 800 !important;
    color: #64748b !important;
}

.stats > div strong {
    font-size: clamp(20px, 1.45vw, 27px) !important;
    line-height: 1.18 !important;
    font-weight: 900 !important;
    letter-spacing: 0 !important;
    overflow-wrap: anywhere !important;
}

.stats > div small {
    font-size: 11px !important;
    line-height: 1.5 !important;
    color: #94a3b8 !important;
    overflow-wrap: anywhere !important;
}

.grid-form {
    gap: 16px !important;
    align-items: start !important;
}

.grid-form label,
.form-row label {
    gap: 7px !important;
    color: #334155 !important;
    font-size: 12px !important;
    line-height: 1.35 !important;
    font-weight: 800 !important;
}

input,
select,
textarea {
    font-size: 13px !important;
    line-height: 1.55 !important;
    font-weight: 600 !important;
    color: #0f172a !important;
}

input,
select {
    min-height: 38px !important;
}

textarea {
    min-height: 92px !important;
    resize: vertical !important;
}

textarea[name="content"] {
    min-height: 240px !important;
    font-size: 13px !important;
    line-height: 1.75 !important;
    font-family: "Cairo", "Inter", Arial, sans-serif !important;
    font-weight: 600 !important;
}

input[name="title"],
input[name="keyword"],
input[name="meta_title"] {
    font-size: 13px !important;
    font-weight: 700 !important;
}

input[name="slug"],
input[name*="id" i],
textarea[name*="json" i] {
    font-family: "Inter", Consolas, monospace !important;
    font-size: 12px !important;
    direction: ltr !important;
    text-align: left !important;
}

.article-preview h1 {
    font-size: 26px !important;
    line-height: 1.35 !important;
}

.article-preview h2 {
    font-size: 21px !important;
    line-height: 1.45 !important;
}

.article-preview h3 {
    font-size: 18px !important;
    line-height: 1.5 !important;
}

.article-preview p,
.article-preview li {
    font-size: 14px !important;
    line-height: 1.9 !important;
}

html[dir="rtl"] .grid-form label,
html[dir="rtl"] .form-row label,
html[dir="rtl"] .section-title,
html[dir="rtl"] .stats > div {
    text-align: right !important;
}

@media (max-width: 1280px) {
    .stats > div strong {
        font-size: 22px !important;
    }

    .section-title h2 {
        font-size: 20px !important;
    }
}

/* Compact detail stats: article/product detail pages should read like metadata, not KPI heroes */
.stats > div {
    min-height: 82px !important;
    padding: 14px 16px !important;
    gap: 5px !important;
}

.stats > div span {
    font-size: 11px !important;
    font-weight: 800 !important;
}

.stats > div strong {
    font-size: 18px !important;
    line-height: 1.35 !important;
    font-weight: 850 !important;
    max-width: 100% !important;
    overflow-wrap: anywhere !important;
}

.stats > div strong:is(:not(:empty)) {
    text-wrap: balance;
}

.stats > div small {
    font-size: 10.5px !important;
}

html[dir="rtl"] .stats > div strong {
    letter-spacing: 0 !important;
}

@media (min-width: 1180px) {
    .stats {
        grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)) !important;
    }
}

/* Page-specific compact states */
body.page-article .stats,
body.page-product .stats,
body.page-agent_testing .stats,
body.page-agents .agent-stats,
body.page-agent_testing .agent-stats {
    gap: 10px !important;
}

body.page-article .stats > div,
body.page-product .stats > div,
body.page-agent_testing .stats > div,
body.page-agents .agent-stats > div {
    min-height: 68px !important;
    padding: 12px 14px !important;
    border-radius: 12px !important;
    gap: 4px !important;
}

body.page-article .stats > div span,
body.page-product .stats > div span,
body.page-agent_testing .stats > div span,
body.page-agents .agent-stats span {
    font-size: 10.5px !important;
    line-height: 1.25 !important;
}

body.page-article .stats > div strong,
body.page-product .stats > div strong,
body.page-agent_testing .stats > div strong,
body.page-agents .agent-stats strong {
    font-size: 15px !important;
    line-height: 1.3 !important;
    font-weight: 850 !important;
}

body.page-article .stats > div small,
body.page-product .stats > div small,
body.page-agent_testing .stats > div small {
    font-size: 10px !important;
}

body.page-article .article-preview {
    padding: 18px !important;
}

body.page-article .article-preview h1 {
    font-size: 22px !important;
    line-height: 1.45 !important;
}

body.page-article .article-preview h2 {
    font-size: 18px !important;
}

body.page-article .article-preview h3 {
    font-size: 16px !important;
}

body.page-article .article-preview p,
body.page-article .article-preview li {
    font-size: 13px !important;
    line-height: 1.8 !important;
}

body.page-product .section-title h2,
body.page-agent_testing .section-title h2,
body.page-agents .section-title h2 {
    font-size: 19px !important;
}

body.page-agents .agent-stats {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)) !important;
}
