
:root {
    --brand-900: #0b1d33;
    --brand-800: #102945;
    --brand-700: #15385f;
    --brand-600: #1d568e;
    --primary: #1785f5;
    --primary-dark: #0b6bcc;
    --primary-soft: #eaf4ff;
    --success: #13a56a;
    --success-soft: #e8f8f1;
    --warning: #d99a00;
    --warning-soft: #fff5d9;
    --danger: #d44949;
    --danger-soft: #fff0f0;
    --info: #4b6b8c;
    --page-bg: #f4f7fb;
    --surface: #ffffff;
    --surface-2: #f8fafc;
    --border: #e6ebf2;
    --border-strong: #d8e0ea;
    --text: #172033;
    --text-soft: #657184;
    --text-muted: #8b95a4;
    --shadow-sm: 0 3px 12px rgba(16, 34, 58, .05);
    --shadow-md: 0 12px 35px rgba(20, 45, 75, .08);
    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 18px;
    --radius-xl: 24px;
}

html,
body {
    margin: 0;
    min-height: 100%;
    direction: rtl;
    background: var(--page-bg);
    color: var(--text);
    font-family: "Vazirmatn", Tahoma, Arial, sans-serif;
}

body {
    min-height: 100vh;
    overflow-x: hidden;
}

*,
*::before,
*::after {
    box-sizing: border-box;
    font-family: inherit;
}

button,
input,
select,
textarea {
    font: inherit;
}

button,
a,
input,
select,
textarea {
    -webkit-tap-highlight-color: transparent;
}

a {
    color: inherit;
    text-decoration: none;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 3px solid rgba(23, 133, 245, .18);
    outline-offset: 2px;
}

::selection {
    background: rgba(23, 133, 245, .18);
    color: var(--text);
}

/* -----------------------------
   Application Shell
   ----------------------------- */

.page {
    display: flex;
    flex-direction: row-reverse;
    min-height: 100vh;
    background: var(--page-bg);
}

.sidebar {
    width: 276px;
    min-width: 276px;
    min-height: 100vh;
    background: linear-gradient(180deg, var(--brand-900) 0%, #102642 58%, #133a60 100%);
    color: #fff;
    box-shadow: -8px 0 28px rgba(11, 29, 51, .08);
    position: relative;
    z-index: 20;
}

.sidebar::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: radial-gradient(circle at 20% 12%, rgba(42, 145, 255, .18), transparent 34%);
}

main {
    flex: 1;
    min-width: 0;
    background: var(--page-bg);
}

.top-row {
    min-height: 76px;
    padding: 12px 30px;
    background: rgba(255, 255, 255, .88);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    display: flex;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 15;
}

.top-row-inner,
.top-row > .top-row-inner {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.topbar-context {
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
}

.topbar-context strong {
    color: var(--text);
    font-weight: 700;
}

.user-area {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text);
}

.user-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #2aa5ff, #176cc9);
    color: #fff;
    font-size: 13px;
    font-weight: 800;
    box-shadow: 0 8px 18px rgba(23, 133, 245, .24);
}

.user-identity {
    display: flex;
    flex-direction: column;
    gap: 2px;
    line-height: 1.35;
}

.user-name {
    color: var(--text);
    font-size: 13px;
    font-weight: 700;
}

.user-role {
    display: inline-flex;
    width: fit-content;
    align-items: center;
    padding: 3px 9px;
    border-radius: 999px;
    background: #eef5ff;
    color: #3d6a97;
    font-size: 11px;
    font-weight: 600;
}

.logout-btn {
    border: 1px solid #f2d7d7;
    background: #fff8f8;
    color: #c44545;
    border-radius: 10px;
    padding: 8px 12px;
    cursor: pointer;
    transition: .2s ease;
}

.logout-btn:hover {
    background: #fff0f0;
    border-color: #ebc4c4;
    transform: translateY(-1px);
}

.content {
    width: 100%;
    max-width: 1540px;
    margin: 0 auto;
    padding: 30px;
}

/* -----------------------------
   Sidebar / Navigation
   ----------------------------- */

.navbar {
    padding: 0;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    margin: 0;
    padding: 25px 24px 20px;
    color: #fff;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -.3px;
}

.nav-brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 13px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #2aa5ff, #1769c6);
    box-shadow: 0 10px 24px rgba(10, 104, 193, .30);
}

.nav-brand-mark svg {
    width: 22px;
    height: 22px;
    stroke: #fff;
}

.nav-brand-copy {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.nav-brand-copy small {
    margin-top: 4px;
    color: rgba(255, 255, 255, .62);
    font-size: 10px;
    font-weight: 500;
}

.nav-scrollable {
    padding: 8px 12px 20px;
    position: relative;
    z-index: 1;
}

.nav-section-title {
    margin: 18px 12px 8px;
    color: rgba(255, 255, 255, .42);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .4px;
}

.nav-item {
    margin: 5px 0;
}

.nav-link {
    position: relative;
    display: flex;
    align-items: center;
    gap: 11px;
    width: 100%;
    min-height: 48px;
    padding: 11px 13px;
    border-radius: 12px;
    color: rgba(255, 255, 255, .72);
    font-size: 13px;
    font-weight: 600;
    transition: background .2s ease, color .2s ease, transform .2s ease;
}

.nav-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, .07);
    transform: translateX(-2px);
}

.nav-link.active {
    color: #fff;
    background: linear-gradient(90deg, rgba(42, 165, 255, .24), rgba(42, 165, 255, .10));
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .07);
}

.nav-link.active::after {
    content: "";
    position: absolute;
    right: 0;
    top: 9px;
    bottom: 9px;
    width: 3px;
    border-radius: 10px;
    background: #2aa5ff;
}

.nav-icon {
    width: 21px;
    height: 21px;
    flex: 0 0 21px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: currentColor;
}

.nav-icon svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
}

.navbar-toggler {
    display: none;
}

/* -----------------------------
   Generic Page Header
   ----------------------------- */

.page-header,
.users-header,
.categories-header,
.news-editor-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 22px;
}

.page-header h1,
.users-header h1,
.categories-header h1,
.news-editor-header h1 {
    margin: 0;
    color: var(--text);
    font-size: clamp(24px, 3vw, 30px);
    font-weight: 800;
    letter-spacing: -.45px;
}

.page-header p,
.users-header p,
.categories-header p,
.news-editor-header p {
    margin: 7px 0 0;
    color: var(--text-soft);
    font-size: 13px;
    line-height: 1.8;
}

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

.dashboard-new-news-btn,
.news-btn,
.users-btn,
.category-btn {
    border: 0;
    border-radius: 11px;
    min-height: 42px;
    padding: 10px 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    white-space: nowrap;
    font-size: 12px;
    font-weight: 700;
    transition: transform .18s ease, box-shadow .18s ease, background .18s ease, border-color .18s ease;
}

.dashboard-new-news-btn,
.news-btn-primary,
.users-btn-primary,
.category-btn-primary {
    background: linear-gradient(135deg, var(--primary), #0e72d4);
    color: #fff;
    box-shadow: 0 8px 18px rgba(23, 133, 245, .20);
}

.dashboard-new-news-btn:hover,
.news-btn-primary:hover:not(:disabled),
.users-btn-primary:hover:not(:disabled),
.category-btn-primary:hover:not(:disabled) {
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 12px 24px rgba(23, 133, 245, .26);
}

.news-btn-submit {
    background: linear-gradient(135deg, #20ad78, #11915f);
    color: #fff;
    box-shadow: 0 8px 18px rgba(19, 165, 106, .20);
}

.news-btn-submit:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 12px 24px rgba(19, 165, 106, .25);
}

.news-btn-cancel,
.users-btn-cancel,
.category-btn-cancel {
    background: #f4f7fa;
    color: #5f6c7d;
    border: 1px solid var(--border);
}

.users-btn-secondary {
    background: #eef7ff;
    color: #146cc1;
    border: 1px solid #d7e9fb;
}

.news-btn-cancel:hover,
.users-btn-cancel:hover,
.users-btn-secondary:hover,
.category-btn-cancel:hover {
    background: #eef2f6;
    transform: translateY(-1px);
}

button:disabled,
.news-btn:disabled,
.users-btn:disabled,
.category-btn:disabled {
    opacity: .55;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* -----------------------------
   Dashboard
   ----------------------------- */

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

.stat-card {
    position: relative;
    min-height: 130px;
    overflow: hidden;
    padding: 21px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: transform .2s ease, box-shadow .2s ease;
}

.stat-card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), #70b7ff);
}

.stat-card:nth-child(2)::before { background: linear-gradient(90deg, #d6a30d, #f1ce64); }
.stat-card:nth-child(3)::before { background: linear-gradient(90deg, #19a66b, #69d6a8); }
.stat-card:nth-child(4)::before { background: linear-gradient(90deg, #577fe7, #8baaf5); }
.stat-card:nth-child(5)::before { background: linear-gradient(90deg, #d74e59, #ee959c); }

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-card span {
    display: block;
    margin-bottom: 13px;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
}

.stat-card strong {
    display: block;
    color: var(--text);
    font-size: 32px;
    line-height: 1;
    font-weight: 800;
}

.quick-card {
    margin-top: 18px;
    padding: 22px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.quick-card h2 {
    margin: 0;
    color: var(--text);
    font-size: 17px;
    font-weight: 800;
}

.quick-card p {
    margin: 16px 0 0;
    color: var(--text-soft);
    font-size: 13px;
    line-height: 2;
}

.workflow {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 18px;
}

.workflow span {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 7px 12px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface-2);
    color: #3e4d60;
    font-size: 11px;
    font-weight: 700;
}

.workflow b {
    color: #9aa6b5;
    font-size: 16px;
}

/* -----------------------------
   Filters / News list
   ----------------------------- */

.filter-bar {
    margin-bottom: 18px;
    padding: 13px;
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.news-table-wrap,
.users-table-card,
.category-table-card {
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.news-table-wrap {
    overflow-x: auto;
}

.news-table,
.users-table,
.category-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    min-width: 860px;
}

.news-table th,
.users-table th,
.category-table th {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    background: #fbfcfe;
    color: #6d7887;
    font-size: 11px;
    font-weight: 700;
    text-align: right;
    white-space: nowrap;
}

.news-table td,
.users-table td,
.category-table td {
    padding: 15px 16px;
    border-bottom: 1px solid #edf1f5;
    color: #465366;
    font-size: 12px;
    text-align: right;
    vertical-align: middle;
}

.news-table tbody tr:last-child td,
.users-table tbody tr:last-child td,
.category-table tbody tr:last-child td {
    border-bottom: 0;
}

.news-table tbody tr:hover td,
.users-table tbody tr:hover td,
.category-table tbody tr:hover td {
    background: #fbfdff;
}

.news-table td strong,
.users-table td strong,
.category-table td strong {
    display: block;
    color: var(--text);
    font-size: 12px;
    font-weight: 700;
}

.news-table td small {
    display: block;
    margin-top: 4px;
    color: var(--text-muted);
    direction: ltr;
    text-align: right;
    font-size: 10px;
}

.actions,
.users-actions,
.category-actions {
    white-space: nowrap;
}

.status,
.category-status,
.users-status,
.users-role-badge,
.users-current-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: fit-content;
    min-height: 28px;
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
}

.status.draft,
.news-editor-status.status-draft {
    background: #edf1f5;
    color: #5f6d7d;
}

.status.pending,
.news-editor-status.status-pending {
    background: var(--warning-soft);
    color: #9a6d00;
}

.status.approved,
.news-editor-status.status-approved {
    background: var(--success-soft);
    color: #14734d;
}

.status.published,
.news-editor-status.status-published {
    background: #e7f1ff;
    color: #315fa4;
}

.status.rejected,
.news-editor-status.status-rejected {
    background: var(--danger-soft);
    color: #b63737;
}

.status-default,
.news-editor-status.status-default {
    background: #f0f2f5;
    color: #646d79;
}

.actions .mud-button-root {
    min-width: auto;
    margin: 2px;
}

.empty-state {
    padding: 62px 28px;
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, .7);
    color: var(--text-muted);
    text-align: center;
    font-size: 13px;
}

/* -----------------------------
   News Editor
   ----------------------------- */

.news-editor-page,
.users-page,
.categories-page {
    width: 100%;
    max-width: 1320px;
    margin: 0 auto;
    direction: rtl;
}

.news-editor-breadcrumb,
.users-breadcrumb,
.categories-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 9px;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 500;
}

.news-editor-breadcrumb span,
.users-breadcrumb span,
.categories-breadcrumb span {
    color: #b2bac5;
}

.news-editor-status-box {
    min-width: 154px;
    padding: 12px 15px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    text-align: center;
}

.news-editor-status-label {
    display: block;
    margin-bottom: 7px;
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 600;
}

.news-editor-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 104px;
    padding: 7px 11px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 800;
}

.news-editor-alert,
.users-alert,
.category-alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 13px 15px;
    margin-bottom: 16px;
    border-radius: var(--radius-md);
    font-size: 12px;
    line-height: 1.9;
}

.news-editor-alert-error,
.users-alert-error,
.category-alert-error {
    color: #9d3030;
    background: var(--danger-soft);
    border: 1px solid #f2d2d2;
}

.news-editor-alert-success,
.users-alert-success,
.category-alert-success {
    color: #176f4b;
    background: var(--success-soft);
    border: 1px solid #cdebdd;
}

.news-editor-alert strong {
    display: block;
    margin-bottom: 2px;
    font-weight: 800;
}

.alert-icon,
.users-alert-icon,
.category-alert > span:first-child {
    display: inline-flex;
    width: 23px;
    height: 23px;
    flex: 0 0 23px;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: currentColor;
    color: #fff;
    font-size: 11px;
    font-weight: 800;
}

.news-editor-card,
.users-editor-card,
.category-editor-card {
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
}

.news-editor-section {
    padding: 28px;
    border-bottom: 1px solid #edf1f5;
}

.news-editor-section:last-of-type {
    border-bottom: 0;
}

.news-editor-section-title {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 23px;
}

.section-number {
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 11px;
    background: var(--primary-soft);
    color: #0e6cc6;
    font-size: 12px;
    font-weight: 800;
}

.news-editor-section-title h2,
.users-editor-header h2,
.category-editor-header h2,
.users-table-header h2,
.category-table-header h2 {
    margin: 0;
    color: var(--text);
    font-size: 16px;
    font-weight: 800;
}

.news-editor-section-title p,
.users-editor-header p,
.category-editor-header p {
    margin: 4px 0 0;
    color: var(--text-muted);
    font-size: 11px;
}

.news-editor-grid,
.users-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

.news-field,
.users-field,
.category-field {
    min-width: 0;
}

.news-field-full,
.users-field-full {
    grid-column: 1 / -1;
}

.news-field label,
.users-field label,
.category-field label {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 8px;
    color: #465367;
    font-size: 11px;
    font-weight: 700;
}

.news-field label span,
.users-field label span,
.category-field label span {
    color: var(--danger);
}

.news-field input,
.news-field select,
.news-field textarea,
.users-field input,
.users-field select,
.category-field input,
.category-field textarea {
    width: 100%;
    border: 1px solid var(--border-strong);
    border-radius: 11px;
    background: #fbfcfe;
    color: var(--text);
    padding: 11px 13px;
    font-size: 12px;
    outline: 0;
    transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

.news-field input,
.users-field input,
.category-field input {
    min-height: 45px;
}

.news-field textarea,
.category-field textarea {
    min-height: 116px;
    resize: vertical;
    line-height: 1.95;
}

.news-field textarea.news-content-textarea {
    min-height: 330px;
    line-height: 2.05;
}

.news-field input:focus,
.news-field select:focus,
.news-field textarea:focus,
.users-field input:focus,
.users-field select:focus,
.category-field input:focus,
.category-field textarea:focus {
    border-color: #7ab7f2;
    background: #fff;
    box-shadow: 0 0 0 4px rgba(23, 133, 245, .10);
}

.news-field input:disabled,
.news-field select:disabled,
.news-field textarea:disabled,
.users-field input:disabled,
.users-field select:disabled {
    color: #7d8796;
    background: #f0f3f6;
    cursor: not-allowed;
}

.news-field input::placeholder,
.news-field textarea::placeholder,
.users-field input::placeholder,
.category-field input::placeholder,
.category-field textarea::placeholder {
    color: #a1aab6;
}

.news-field > small,
.users-field small {
    display: block;
    margin-top: 6px;
    color: var(--text-muted);
    font-size: 10px;
    line-height: 1.8;
}

.news-field-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 6px;
}

.news-field-footer small {
    color: var(--text-muted);
    font-size: 10px;
}

.news-field-footer span {
    color: #6e7a8b;
    font-size: 10px;
    font-weight: 600;
}

.news-rejection-box,
.news-readonly-box {
    margin: 0 28px 20px;
    padding: 16px 18px;
    border-radius: var(--radius-md);
}

.news-rejection-box {
    display: flex;
    gap: 12px;
    background: var(--danger-soft);
    border: 1px solid #f2d5d5;
    color: #963939;
}

.news-rejection-icon {
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: rgba(212, 73, 73, .12);
    color: #b53a3a;
    font-size: 13px;
    font-weight: 800;
}

.news-rejection-box strong {
    display: block;
    margin-bottom: 4px;
    font-size: 12px;
}

.news-rejection-box p {
    margin: 0;
    line-height: 1.9;
    font-size: 11px;
}

.news-rejection-box small {
    display: block;
    margin-top: 5px;
    font-size: 10px;
    color: #ad6464;
}

.news-readonly-box {
    background: #f7f9fb;
    border: 1px dashed var(--border-strong);
    color: var(--text-soft);
    font-size: 11px;
}

.news-editor-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 28px;
    background: #fbfcfe;
    border-top: 1px solid #edf1f5;
}

.news-editor-actions-left,
.users-form-actions,
.category-form-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 9px;
}

.news-editor-loading,
.users-loading,
.category-loading {
    min-height: 280px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: var(--text-soft);
    font-size: 12px;
}

.news-editor-spinner,
.users-spinner,
.category-spinner,
.button-spinner,
.users-button-spinner,
.category-button-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(23, 133, 245, .18);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: nextnews-spin .8s linear infinite;
    display: inline-block;
}

.button-spinner,
.users-button-spinner,
.category-button-spinner {
    width: 15px;
    height: 15px;
    border-width: 2px;
    border-color: rgba(255, 255, 255, .45);
    border-top-color: #fff;
}

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

/* -----------------------------
   Users
   ----------------------------- */

.users-table-card,
.category-table-card {
    margin-top: 18px;
}

.users-editor-card,
.category-editor-card {
    margin-bottom: 18px;
    overflow: hidden;
}

.users-editor-header,
.category-editor-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 21px 24px;
    border-bottom: 1px solid var(--border);
    background: #fbfcfe;
}

.users-form-grid {
    padding: 24px;
}

.users-close-btn,
.category-close-btn {
    width: 36px;
    height: 36px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
    color: #728093;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    transition: .18s ease;
}

.users-close-btn:hover,
.category-close-btn:hover {
    background: #f2f5f8;
    transform: rotate(3deg);
}

.users-form-actions {
    padding: 18px 24px;
    border-top: 1px solid var(--border);
    background: #fbfcfe;
}

.users-table-header,
.category-table-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
}

.users-table-header > div,
.category-table-header > div {
    display: flex;
    align-items: center;
    gap: 10px;
}

.users-table-header span,
.category-table-header span {
    padding: 4px 9px;
    border-radius: 999px;
    background: #eef3f7;
    color: #748090;
    font-size: 9px;
    font-weight: 700;
}

.users-table-wrap,
.category-table-wrap {
    overflow-x: auto;
}

.users-current-badge {
    min-height: 22px;
    margin-top: 5px;
    background: var(--primary-soft);
    color: #1f6fba;
    font-size: 9px;
}

.users-role-list {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.users-role-badge {
    min-height: 23px;
    background: #f0f3f8;
    color: #5d6a7a;
    font-size: 9px;
}

.users-status-active,
.category-status-active {
    background: var(--success-soft);
    color: #16734c;
}

.users-status-inactive,
.category-status-inactive {
    background: #eef1f4;
    color: #6c7581;
}

.users-status-locked {
    margin-right: 5px;
    background: var(--danger-soft);
    color: #b63c3c;
}

.users-action-btn,
.category-action-btn {
    min-height: 34px;
    padding: 7px 10px;
    margin: 2px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: #fff;
    color: #536275;
    cursor: pointer;
    font-size: 10px;
    font-weight: 700;
    transition: .18s ease;
}

.users-action-btn:hover:not(:disabled),
.category-action-btn:hover:not(:disabled) {
    background: #f4f8fc;
    border-color: #c9d9e8;
    color: #196ab6;
    transform: translateY(-1px);
}

.users-access-denied,
.category-access-denied,
.news-access-denied {
    max-width: 600px;
    margin: 50px auto;
    padding: 38px 30px;
    text-align: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
}

.users-denied-icon,
.category-denied-icon,
.news-access-denied-icon {
    width: 54px;
    height: 54px;
    margin: 0 auto 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
    background: var(--danger-soft);
    color: var(--danger);
    font-size: 18px;
    font-weight: 800;
}

.users-access-denied h2,
.category-access-denied h2,
.news-access-denied h2 {
    margin: 0;
    color: var(--text);
    font-size: 18px;
    font-weight: 800;
}

.users-access-denied p,
.category-access-denied p,
.news-access-denied p {
    margin: 8px 0 20px;
    color: var(--text-soft);
    font-size: 12px;
    line-height: 1.9;
}

/* -----------------------------
   Categories
   ----------------------------- */

.category-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 20px;
    padding: 24px;
}

.category-form-actions {
    padding: 18px 24px;
    border-top: 1px solid var(--border);
    background: #fbfcfe;
}

/* -----------------------------
   Login
   ----------------------------- */

.auth-shell {
    width: 100%;
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 28px;
    background:
        radial-gradient(circle at 12% 12%, rgba(42, 165, 255, .18), transparent 30%),
        radial-gradient(circle at 86% 86%, rgba(23, 87, 145, .16), transparent 26%),
        #eff4f9;
}

.login-card {
    width: min(460px, 100%);
    margin: 0 auto;
    padding: 34px;
    justify-self: center;
    align-self: center;
    background: rgba(255, 255, 255, .96);
    border: 1px solid rgba(255, 255, 255, .75);
    border-radius: 25px;
    box-shadow: 0 25px 70px rgba(15, 38, 63, .14);
}

.login-card::before {
    content: "";
    display: block;
    width: 54px;
    height: 5px;
    margin: 0 auto 22px;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--primary), #68b6ff);
}

.brand {
    color: var(--brand-900);
    text-align: center;
    font-size: 28px;
    font-weight: 900;
    letter-spacing: -.4px;
}

.brand-subtitle {
    margin: 5px 0 26px;
    color: var(--text-muted);
    text-align: center;
    font-size: 11px;
    font-weight: 500;
}

.login-card h1 {
    margin: 0 0 7px;
    color: var(--text);
    text-align: right;
    font-size: 21px;
    font-weight: 800;
}

.login-help {
    margin: 0 0 20px;
    color: var(--text-soft);
    font-size: 12px;
    line-height: 1.9;
}

.login-error {
    margin: 10px 0;
    padding: 11px 13px;
    border: 1px solid #f1d3d3;
    border-radius: 11px;
    background: var(--danger-soft);
    color: #aa3636;
    font-size: 11px;
    line-height: 1.8;
}

/* MudBlazor global visual tuning */

.mud-button-root,
.mud-input-control,
.mud-input,
.mud-select,
.mud-paper,
.mud-typography,
.mud-alert {
    font-family: "Vazirmatn", Tahoma, Arial, sans-serif !important;
}

.mud-button-root {
    border-radius: 10px !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    min-height: 40px;
}

.mud-button-filled.mud-button-filled-primary {
    background: linear-gradient(135deg, var(--primary), #0e72d4) !important;
    box-shadow: 0 8px 18px rgba(23, 133, 245, .18) !important;
}

.mud-button-outlined {
    border-color: var(--border-strong) !important;
}

.mud-input-outlined-border {
    border-radius: 11px !important;
}

.mud-input-control {
    margin-top: 0 !important;
}

.mud-select-input {
    font-size: 12px !important;
}

.mud-alert {
    border-radius: 12px !important;
}

/* Blazor error */

#blazor-error-ui {
    display: none;
    position: fixed;
    inset: auto 0 0;
    z-index: 1000;
    padding: 12px 18px;
    border-top: 1px solid #f1d5a2;
    background: #fff9e9;
    color: #6d5316;
    box-shadow: 0 -8px 24px rgba(43, 52, 63, .10);
    font-size: 12px;
}

#blazor-error-ui .reload {
    margin-right: 12px;
    color: #176cc3;
    font-weight: 700;
}

#blazor-error-ui .dismiss {
    position: absolute;
    left: 12px;
    top: 9px;
    cursor: pointer;
}

@media (max-width: 1180px) {
    .sidebar {
        width: 248px;
        min-width: 248px;
    }

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

@media (max-width: 900px) {
    .page {
        display: block;
    }

    .sidebar {
        width: 100%;
        min-width: 0;
        min-height: auto;
        position: relative;
    }

    .navbar-brand {
        padding: 16px 18px 12px;
    }

    .nav-scrollable {
        display: flex;
        align-items: center;
        overflow-x: auto;
        gap: 4px;
        padding: 4px 10px 12px;
        scrollbar-width: thin;
    }

    .nav-section-title {
        display: none;
    }

    .nav-item {
        min-width: max-content;
        margin: 0;
    }

    .nav-link {
        width: auto;
        min-height: 42px;
        padding: 9px 11px;
    }

    .nav-link.active::after {
        right: 8px;
        left: 8px;
        top: auto;
        bottom: 3px;
        width: auto;
        height: 2px;
    }

    .top-row {
        position: relative;
        padding: 12px 18px;
    }

    .content {
        padding: 22px 18px;
    }

    .page-header,
    .users-header,
    .categories-header,
    .news-editor-header {
        align-items: flex-start;
        flex-direction: column;
    }

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

    .news-editor-grid,
    .users-form-grid,
    .category-form {
        grid-template-columns: 1fr;
    }

    .news-field-full,
    .users-field-full {
        grid-column: auto;
    }
}

@media (max-width: 640px) {
    .top-row {
        min-height: 72px;
    }

    .top-row .topbar-context {
        display: none;
    }

    .user-area {
        width: 100%;
        justify-content: space-between;
        margin-right: 0;
    }

    .content {
        padding: 18px 12px 30px;
    }

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

    .page-header h1,
    .users-header h1,
    .categories-header h1,
    .news-editor-header h1 {
        font-size: 23px;
    }

    .quick-card,
    .news-editor-section {
        padding: 20px;
    }

    .news-editor-actions {
        align-items: stretch;
        flex-direction: column;
        padding: 16px 20px;
    }

    .news-editor-actions-left {
        width: 100%;
    }

    .news-editor-actions-left .news-btn,
    .news-editor-actions > .news-btn {
        flex: 1;
    }

    .news-rejection-box,
    .news-readonly-box {
        margin-right: 20px;
        margin-left: 20px;
    }

    .users-editor-header,
    .category-editor-header,
    .users-table-header,
    .category-table-header {
        padding: 17px;
    }

    .users-form-grid,
    .category-form {
        padding: 18px;
    }

    .users-form-actions,
    .category-form-actions {
        padding: 14px 18px;
    }

    .login-card {
        padding: 25px 20px;
        border-radius: 20px;
    }
}

/* =========================================================
   RTL / Persian UI refinement
   ========================================================= */

html,
body,
#blazor-error-ui,
.mud-typography-root,
.mud-input,
.mud-input-label,
.mud-input-slot,
.mud-select,
.mud-select-input,
.mud-button-root,
.mud-menu,
.mud-list-item,
.mud-popover,
.mud-dialog,
.mud-snackbar {
    direction: rtl;
    font-family: "Vazirmatn", Tahoma, Arial, sans-serif !important;
}

main,
.content,
.page-header,
.filter-bar,
.news-editor-page,
.users-page,
.categories-page,
.news-table-wrap,
.users-table-card,
.category-table-card,
.auth-shell {
    direction: rtl;
}

/* ---------- Unified buttons ---------- */

button,
a,
.mud-button-root,
.dashboard-new-news-btn,
.news-btn,
.users-btn,
.category-btn,
.users-action-btn,
.category-action-btn,
.logout-btn {
    font-family: "Vazirmatn", Tahoma, Arial, sans-serif !important;
    text-align: center;
    vertical-align: middle;
}

.dashboard-new-news-btn,
.news-btn,
.users-btn,
.category-btn,
.logout-btn {
    position: relative;
    min-height: 44px;
    padding: 10px 17px;
    border-radius: 11px;
    line-height: 1.2;
    letter-spacing: 0;
    white-space: nowrap;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.dashboard-new-news-btn > *,
.news-btn > *,
.users-btn > *,
.category-btn > *,
.mud-button-root > * {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1.2;
}

/* MudBlazor buttons used on News list / Login */
.mud-button-root {
    min-height: 42px;
    padding: 9px 16px !important;
    border-radius: 11px !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    line-height: 1.2 !important;
    letter-spacing: 0 !important;
    text-transform: none !important;
    box-shadow: none;
}

.mud-button-filled.mud-button-filled-primary {
    background: linear-gradient(135deg, var(--primary), #0e72d4) !important;
    color: #fff !important;
    box-shadow: 0 8px 18px rgba(23, 133, 245, .18) !important;
}

.mud-button-filled.mud-button-filled-primary:hover {
    background: linear-gradient(135deg, #1680eb, #0c68c1) !important;
    box-shadow: 0 11px 22px rgba(23, 133, 245, .23) !important;
    transform: translateY(-1px);
}

.mud-button-outlined {
    border: 1px solid var(--border-strong) !important;
    color: #4f6073 !important;
    background: #fff !important;
}

.mud-button-outlined:hover {
    border-color: #a9c7e3 !important;
    background: #f8fbff !important;
}

.mud-button-text {
    min-height: 34px;
    padding: 7px 10px !important;
    border-radius: 9px !important;
}

.mud-button-text:hover {
    background: #f1f6fb !important;
}

/* ---------- Consistent native select / combo-box ---------- */

select {
    direction: rtl;
    text-align: right;
    text-align-last: right;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    min-height: 46px;
    width: 100%;
    padding: 11px 14px 11px 42px !important;
    border: 1px solid var(--border-strong) !important;
    border-radius: 11px !important;
    background-color: #fbfcfe;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236b7788' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 14px center;
    background-size: 15px;
    color: var(--text) !important;
    font-size: 12px !important;
    line-height: 1.4;
    cursor: pointer;
    outline: none;
    transition: border-color .18s ease, box-shadow .18s ease, background-color .18s ease, transform .18s ease;
}

select:hover:not(:disabled) {
    border-color: #b6cce0 !important;
    background-color: #fff;
}

select:focus {
    border-color: #79b4ef !important;
    background-color: #fff;
    box-shadow: 0 0 0 4px rgba(23, 133, 245, .10) !important;
}

select:disabled {
    opacity: .72;
    background-color: #f0f3f6;
    cursor: not-allowed;
}

select option {
    direction: rtl;
    text-align: right;
    font-family: "Vazirmatn", Tahoma, Arial, sans-serif;
    padding: 8px;
}

/* News filter combo box */
.filter-bar {
    direction: rtl;
    flex-wrap: wrap;
    justify-content: flex-start;
}

.filter-bar > .mud-select {
    width: 240px;
    max-width: 100%;
}

.filter-bar .mud-input-control {
    margin: 0 !important;
}

.filter-bar .mud-input-control-root {
    min-height: 52px;
}

.filter-bar .mud-input-outlined-border {
    border-radius: 11px !important;
    border-color: var(--border-strong) !important;
}

.filter-bar .mud-input-control:hover .mud-input-outlined-border {
    border-color: #b6cce0 !important;
}

.filter-bar .mud-input-control.mud-input-control-focused .mud-input-outlined-border {
    border-color: #79b4ef !important;
    box-shadow: 0 0 0 4px rgba(23, 133, 245, .10);
}

.filter-bar .mud-input-label {
    font-size: 11px !important;
    font-weight: 700 !important;
    right: 14px;
    left: auto;
    transform-origin: right top !important;
}

.filter-bar .mud-input-slot,
.filter-bar .mud-select-input {
    text-align: right !important;
    direction: rtl !important;
    font-size: 12px !important;
    padding-right: 2px !important;
}

.filter-bar .mud-select .mud-input-slot {
    padding-left: 28px !important;
}

/* Mud select popup */
.mud-popover .mud-list,
.mud-popover .mud-list-item,
.mud-popover .mud-menu-item {
    direction: rtl;
    text-align: right;
    font-family: "Vazirmatn", Tahoma, Arial, sans-serif !important;
}

.mud-popover .mud-list-item {
    min-height: 42px;
    justify-content: flex-start;
    border-radius: 8px;
    margin: 2px 4px;
    font-size: 12px !important;
}

.mud-popover .mud-list-item:hover {
    background: #f2f7fc;
}

/* ---------- Better action buttons in tables ---------- */

.actions,
.users-actions,
.category-actions {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 5px;
    white-space: normal;
}

.actions .mud-button-root {
    min-width: 68px;
    min-height: 34px;
    padding: 6px 10px !important;
    margin: 0 !important;
    border: 1px solid #e3e9ef;
    background: #fff;
    color: #526274;
    font-size: 10px !important;
}

.actions .mud-button-root:hover {
    background: #f5f9fd;
    border-color: #c8dced;
}

.users-action-btn,
.category-action-btn {
    min-width: 72px;
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1.2;
    text-align: center;
    margin: 0;
}

/* ---------- Form action alignment ---------- */

.news-editor-actions,
.users-form-actions,
.category-form-actions {
    direction: rtl;
}

.news-editor-actions-left,
.users-form-actions,
.category-form-actions {
    align-items: center;
}

/* ---------- Sidebar RTL polish ---------- */

.sidebar {
    direction: rtl;
    box-shadow: -8px 0 28px rgba(11, 29, 51, .08);
}

.navbar-brand,
.nav-link,
.nav-section-title {
    direction: rtl;
}

.nav-link {
    justify-content: flex-start;
}

.nav-link.active::after {
    right: 0;
    left: auto;
}

.nav-link:hover {
    transform: translateX(-2px);
}

/* ---------- Topbar follows RTL reading order ---------- */

.top-row-inner {
    direction: rtl;
}

.user-area {
    direction: rtl;
}

.topbar-context {
    direction: rtl;
    text-align: right;
}

/* ---------- Better labels / inputs ---------- */

input,
textarea,
select {
    direction: rtl;
    text-align: right;
}

input[type="email"] {
    direction: ltr;
    text-align: left;
}

input[type="tel"] {
    direction: ltr;
    text-align: left;
}

/* ---------- Login / MudBlazor field alignment ---------- */

.login-card .mud-input-control,
.login-card .mud-input,
.login-card .mud-input-slot,
.login-card .mud-input-label {
    direction: rtl !important;
}

.login-card .mud-input-slot {
    text-align: right !important;
}

.login-card .mud-input-label {
    right: 14px !important;
    left: auto !important;
    transform-origin: right top !important;
}

.login-card .mud-input-outlined-border {
    border-radius: 11px !important;
}

.login-card .mud-button-root {
    width: 100%;
    min-height: 48px;
    margin-top: 6px;
    font-size: 13px !important;
}

/* ---------- Responsive RTL sidebar ---------- */

@media (max-width: 1024px) {
    .page {
        display: block;
    }

    .sidebar {
        position: fixed;
        top: 0;
        right: 0;
        left: auto;
        width: 270px;
        min-width: 270px;
        height: 100vh;
        transform: translateX(0);
    }

    main {
        margin-right: 270px;
        margin-left: 0;
    }

    .top-row {
        position: sticky;
    }
}

@media (max-width: 760px) {
    .sidebar {
        width: 82px;
        min-width: 82px;
    }

    main {
        margin-right: 82px;
    }

    .navbar-brand {
        justify-content: center;
        padding: 18px 10px;
    }

    .nav-brand-copy,
    .nav-section-title,
    .nav-link:not(.active) {
        /* icon-first compact navigation still keeps RTL shell */
    }

    .nav-brand-copy {
        display: none;
    }

    .nav-link {
        justify-content: center;
        padding: 11px 8px;
    }

    .nav-link .nav-icon {
        margin: 0;
    }

    .top-row {
        padding: 10px 16px;
    }

    .content {
        padding: 20px 14px 30px;
    }
}


/* =========================================================
   Final RTL shell + News filter polish
   ========================================================= */

.page {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) 276px !important;
    direction: ltr !important;
    min-height: 100vh;
}

.page > main {
    grid-column: 1 !important;
    min-width: 0;
    direction: rtl !important;
}

.page > .sidebar {
    grid-column: 2 !important;
    grid-row: 1 !important;
    width: 276px !important;
    min-width: 276px !important;
    height: auto;
    min-height: 100vh;
    direction: rtl !important;
    position: relative;
    right: auto;
    left: auto;
}

.content,
.top-row,
.top-row-inner {
    direction: rtl !important;
}

/* Modern news filtering: native select avoids MudSelect popover positioning issues. */
.news-filter-card {
    display: grid;
    grid-template-columns: minmax(210px, .55fr) minmax(0, 1.45fr);
    align-items: center;
    gap: 24px;
    margin-bottom: 20px;
    padding: 16px 18px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    direction: rtl;
}

.news-filter-heading {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.news-filter-icon {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: var(--primary-soft);
    color: #1674d0;
}

.news-filter-icon svg {
    width: 20px;
    height: 20px;
}

.news-filter-heading > div:last-child {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.news-filter-heading strong {
    color: var(--text);
    font-size: 13px;
    font-weight: 800;
}

.news-filter-heading span {
    color: var(--text-muted);
    font-size: 10px;
    line-height: 1.7;
}

.news-filter-controls {
    display: flex;
    align-items: end;
    justify-content: flex-start;
    gap: 10px;
    min-width: 0;
}

.news-filter-field {
    width: min(300px, 100%);
    min-width: 0;
}

.news-filter-field label {
    display: block;
    margin: 0 0 7px;
    color: #4a586b;
    font-size: 10px;
    font-weight: 700;
}

select.news-filter-select {
    min-height: 42px !important;
    width: 100% !important;
    padding: 9px 13px 9px 38px !important;
    border-radius: 10px !important;
    background-color: #fbfcfe !important;
    font-size: 11px !important;
}

select.news-filter-select:focus {
    background-color: #fff !important;
}

.news-filter-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
}

.news-filter-apply,
.news-filter-reset {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 9px 14px;
    border-radius: 10px;
    border: 1px solid transparent;
    font-family: "Vazirmatn", Tahoma, Arial, sans-serif;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
    cursor: pointer;
    transition: .18s ease;
}

.news-filter-apply svg,
.news-filter-reset svg {
    width: 15px;
    height: 15px;
    flex: 0 0 15px;
}

.news-filter-apply {
    background: linear-gradient(135deg, var(--primary), #0e72d4);
    color: #fff;
    box-shadow: 0 7px 16px rgba(23, 133, 245, .18);
}

.news-filter-apply:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 10px 20px rgba(23, 133, 245, .23);
}

.news-filter-reset {
    background: #fff;
    border-color: #e0e6ed;
    color: #617083;
}

.news-filter-reset:hover:not(:disabled) {
    background: #f7f9fb;
    border-color: #cad5e0;
    color: #405166;
    transform: translateY(-1px);
}

.news-filter-apply:disabled,
.news-filter-reset:disabled {
    opacity: .55;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

@media (max-width: 1180px) {
    .news-filter-card {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .news-filter-controls {
        width: 100%;
    }

    .news-filter-field {
        flex: 1 1 260px;
    }
}

@media (max-width: 1024px) {
    .page {
        display: block !important;
        direction: rtl !important;
    }

    .page > .sidebar {
        position: fixed !important;
        top: 0;
        right: 0 !important;
        left: auto !important;
        width: 270px !important;
        min-width: 270px !important;
        height: 100vh;
        min-height: 100vh;
        z-index: 30;
    }

    .page > main {
        margin-right: 270px;
        margin-left: 0;
    }
}

@media (max-width: 760px) {
    .news-filter-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .news-filter-field {
        width: 100%;
    }

    .news-filter-actions {
        width: 100%;
    }

    .news-filter-apply,
    .news-filter-reset {
        flex: 1 1 0;
    }

    .page > .sidebar {
        width: 82px !important;
        min-width: 82px !important;
    }

    .page > main {
        margin-right: 82px;
    }
}

/* =========================================================
   ADMIN UI FINAL POLISH
   ========================================================= */

:root {
    --ui-radius: 14px;
    --ui-radius-sm: 10px;
    --ui-border: #e4eaf1;
    --ui-text: #182230;
    --ui-muted: #718096;
    --ui-primary: #1677e8;
    --ui-primary-dark: #0d63c8;
}

.page-eyebrow {
    display: inline-flex;
    align-items: center;
    margin-bottom: 7px;
    color: var(--ui-primary);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .15px;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 22px;
}

.page-header h1 {
    margin: 0;
    color: var(--ui-text);
    font-size: 26px;
    font-weight: 850;
    letter-spacing: -.35px;
}

.page-header p {
    margin: 7px 0 0;
    color: var(--ui-muted);
    font-size: 12px;
}

.ui-btn {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    border: 1px solid transparent;
    border-radius: 10px;
    padding: 9px 15px;
    white-space: nowrap;
    line-height: 1.1;
    text-align: center;
    font-size: 12px;
    font-weight: 750;
    cursor: pointer;
    transition: transform .18s ease, box-shadow .18s ease, background .18s ease, border-color .18s ease;
}

.ui-btn:hover:not(:disabled) {
    transform: translateY(-1px);
}

.ui-btn:disabled {
    opacity: .55;
    cursor: not-allowed;
    transform: none;
}

.ui-btn-icon {
    font-size: 16px;
    line-height: 1;
}

.ui-btn-primary {
    background: linear-gradient(135deg, #2088f4, #0d6fd4);
    color: #fff;
    box-shadow: 0 8px 18px rgba(22, 119, 232, .17);
}

.ui-btn-primary:hover:not(:disabled) {
    box-shadow: 0 11px 22px rgba(22, 119, 232, .22);
}

.ui-btn-light {
    background: #fff;
    border-color: #dfe6ee;
    color: #526174;
}

.ui-btn-light:hover:not(:disabled) {
    background: #f7f9fb;
    border-color: #ccd7e3;
}

.ui-btn-danger {
    background: #d74747;
    color: #fff;
    box-shadow: 0 8px 18px rgba(215, 71, 71, .16);
}

.ui-alert {
    min-height: 48px;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 18px;
    padding: 11px 14px;
    border-radius: 12px;
    font-size: 12px;
}

.ui-alert-success {
    background: #edf9f3;
    border: 1px solid #cfeedd;
    color: #27734e;
}

.ui-alert-error {
    background: #fff2f2;
    border: 1px solid #f4d2d2;
    color: #a83f3f;
}

.ui-alert-icon {
    width: 26px;
    height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 26px;
    border-radius: 8px;
    background: rgba(255,255,255,.7);
    font-weight: 900;
}

.ui-alert-close {
    margin-inline-start: auto;
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: inherit;
    cursor: pointer;
    font-size: 17px;
}

.ui-alert-close:hover {
    background: rgba(0,0,0,.05);
}

.news-filter-card {
    grid-template-columns: 1fr;
    gap: 18px;
    padding: 19px 20px;
}

.news-filter-heading {
    padding-bottom: 14px;
    border-bottom: 1px solid #edf1f5;
}

.news-filter-heading strong {
    font-size: 14px;
}

.news-filter-heading span {
    font-size: 11px;
}

.news-filter-controls-wide {
    display: grid;
    grid-template-columns: minmax(250px, 1.3fr) minmax(190px, .7fr) auto;
    align-items: end;
    gap: 12px;
}

.news-filter-search-field {
    width: auto;
}

.filter-input-wrap {
    position: relative;
}

.filter-input-wrap > svg {
    position: absolute;
    right: 12px;
    top: 50%;
    width: 17px;
    height: 17px;
    transform: translateY(-50%);
    color: #8290a1;
    pointer-events: none;
}

.news-filter-input,
.news-filter-select,
.table-search input {
    width: 100%;
    min-height: 42px;
    border: 1px solid #dce4ed;
    border-radius: 10px;
    background: #fbfcfe;
    color: var(--ui-text);
    font-size: 11px;
    transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

.news-filter-input {
    padding: 9px 38px 9px 13px;
}

.news-filter-input:focus,
.news-filter-select:focus,
.table-search input:focus {
    border-color: #78b3ef;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(22, 119, 232, .09);
    outline: none;
}

.news-filter-select {
    appearance: none;
    padding: 9px 13px 9px 38px;
    background-image: linear-gradient(45deg, transparent 50%, #75869a 50%), linear-gradient(135deg, #75869a 50%, transparent 50%);
    background-position: calc(100% - 18px) 18px, calc(100% - 13px) 18px;
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
}

.news-filter-actions {
    align-items: stretch;
}

.news-filter-actions .ui-btn {
    min-width: 116px;
}

.list-toolbar {
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 18px 0 10px;
    padding: 0 4px;
    color: var(--ui-muted);
    font-size: 11px;
}

.list-toolbar > div:first-child {
    display: inline-flex;
    align-items: baseline;
    gap: 5px;
}

.list-toolbar strong {
    color: var(--ui-text);
    font-size: 17px;
}

.list-toolbar-meta {
    color: #8792a1;
}

.news-table-wrap,
.users-table-wrap,
.category-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--ui-border);
    border-radius: 16px;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.news-table,
.users-table,
.category-table {
    width: 100%;
    min-width: 860px;
    border-collapse: collapse;
    direction: rtl;
}

.news-table thead th,
.users-table thead th,
.category-table thead th {
    padding: 14px 16px;
    background: #f8fafc;
    border-bottom: 1px solid #e8edf3;
    color: #667386;
    font-size: 10px;
    font-weight: 800;
    white-space: nowrap;
}

.news-table tbody td,
.users-table tbody td,
.category-table tbody td {
    padding: 14px 16px;
    border-bottom: 1px solid #edf1f5;
    color: #465365;
    font-size: 11px;
    vertical-align: middle;
}

.news-table tbody tr:last-child td,
.users-table tbody tr:last-child td,
.category-table tbody tr:last-child td {
    border-bottom: 0;
}

.news-table tbody tr:hover,
.users-table tbody tr:hover,
.category-table tbody tr:hover {
    background: #fbfdff;
}

.news-row-title {
    display: block;
    max-width: 420px;
    color: var(--ui-text);
    font-size: 12px;
    line-height: 1.7;
}

.news-row-slug {
    display: block;
    margin-top: 2px;
    color: #98a3b0;
    direction: ltr;
    text-align: right;
    font-size: 9px;
}

.table-muted {
    color: #69788b;
}

.table-actions-head {
    width: 260px;
}

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

.news-action-btn {
    min-width: 62px;
    min-height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 9px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: #f5f7fa;
    color: #506073;
    font-family: inherit;
    font-size: 10px;
    font-weight: 750;
    line-height: 1.2;
    cursor: pointer;
    text-decoration: none;
    transition: .16s ease;
}

.news-action-btn:hover {
    transform: translateY(-1px);
}

.news-action-edit { background: #eef5ff; color: #2d68a2; border-color: #dae8f8; }
.news-action-primary { background: #edf5ff; color: #1766b4; border-color: #d9e9fa; }
.news-action-success { background: #ecf8f1; color: #267750; border-color: #d3ecde; }
.news-action-warning { background: #fff7e5; color: #9a6a10; border-color: #f4e5bc; }
.news-action-danger { background: #fff0f0; color: #b84c4c; border-color: #f4d6d6; }

.ui-loading-card,
.ui-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 250px;
    padding: 30px;
    border: 1px solid var(--ui-border);
    border-radius: 16px;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    color: var(--ui-muted);
    text-align: center;
}

.ui-spinner {
    width: 34px;
    height: 34px;
    margin-bottom: 12px;
    border: 3px solid #dbe7f4;
    border-top-color: var(--ui-primary);
    border-radius: 50%;
    animation: ui-spin .8s linear infinite;
}

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

.ui-empty-icon {
    width: 48px;
    height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
    border-radius: 14px;
    background: #f1f5f9;
    color: #8390a0;
    font-size: 21px;
}

.ui-empty-state h3 {
    margin: 0;
    color: var(--ui-text);
    font-size: 15px;
}

.ui-empty-state p {
    margin: 7px 0 16px;
    color: #8591a0;
    font-size: 11px;
}

.ui-empty-state-table {
    min-height: 190px;
    border: 0;
    box-shadow: none;
    border-radius: 0 0 16px 16px;
}

.pagination-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 14px;
}

.pagination-pages {
    display: flex;
    align-items: center;
    gap: 5px;
    direction: ltr;
}

.pagination-btn,
.pagination-page {
    min-width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 9px;
    border: 1px solid #dfe6ee;
    border-radius: 8px;
    background: #fff;
    color: #647387;
    font-family: inherit;
    font-size: 10px;
    font-weight: 700;
    cursor: pointer;
}

.pagination-page.active {
    background: var(--ui-primary);
    border-color: var(--ui-primary);
    color: #fff;
}

.pagination-btn:disabled,
.pagination-page:disabled {
    opacity: .45;
    cursor: not-allowed;
}

.confirm-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(9, 18, 31, .46);
    backdrop-filter: blur(4px);
}

.confirm-dialog {
    width: min(440px, 100%);
    padding: 26px;
    border: 1px solid #e6ebf1;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 24px 80px rgba(11, 29, 51, .18);
    text-align: center;
}

.confirm-icon {
    width: 48px;
    height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
    border-radius: 14px;
    font-size: 20px;
    font-weight: 900;
}

.confirm-icon-danger {
    background: #fff0f0;
    color: #c94949;
}

.confirm-dialog h2 {
    margin: 0;
    color: var(--ui-text);
    font-size: 18px;
}

.confirm-dialog p {
    margin: 9px 0 20px;
    color: #6e7b8c;
    font-size: 12px;
    line-height: 2;
}

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

.confirm-actions .ui-btn {
    min-width: 115px;
}

.table-tools {
    display: flex;
    align-items: center;
    gap: 10px;
}

.table-search {
    width: min(340px, 100%);
    position: relative;
}

.table-search > span {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #8794a5;
    pointer-events: none;
    font-size: 16px;
}

.table-search input {
    padding: 9px 36px 9px 12px;
    min-height: 38px;
}

.pagination-bar + * {
    margin-bottom: 0;
}

/* Make the RTL shell explicit: main content left, sidebar right. */
.page {
    grid-template-columns: minmax(0, 1fr) 276px !important;
    direction: ltr !important;
}

.page > main {
    grid-column: 1 !important;
    grid-row: 1 !important;
}

.page > .sidebar {
    grid-column: 2 !important;
    grid-row: 1 !important;
}

@media (max-width: 1180px) {
    .news-filter-controls-wide {
        grid-template-columns: 1fr 1fr;
    }

    .news-filter-actions {
        grid-column: 1 / -1;
    }
}

@media (max-width: 820px) {
    .page-header {
        align-items: stretch;
        flex-direction: column;
    }

    .page-header .ui-btn {
        align-self: flex-start;
    }

    .news-filter-controls-wide {
        grid-template-columns: 1fr;
    }

    .news-filter-actions {
        grid-column: auto;
    }

    .news-filter-actions .ui-btn {
        flex: 1 1 0;
    }

    .users-table-header,
    .category-table-header {
        align-items: stretch !important;
        flex-direction: column !important;
    }

    .table-search {
        width: 100%;
    }
}

@media (max-width: 760px) {
    .content {
        padding: 18px 12px 26px;
    }

    .page-header h1 {
        font-size: 22px;
    }

    .list-toolbar {
        align-items: flex-start;
        flex-direction: column;
        gap: 4px;
    }

    .actions {
        min-width: 225px;
    }

    .confirm-actions {
        flex-direction: column;
    }

    .confirm-actions .ui-btn {
        width: 100%;
    }
}

/* =============================
   Public News Website
   ============================= */

.public-container {
    width: min(1280px, calc(100% - 40px));
    margin: 0 auto;
}

.public-home { padding: 30px 0 0; }

.public-hero {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 24px;
    align-items: stretch;
}

.public-hero-copy {
    min-height: 430px;
    padding: 52px;
    border: 1px solid var(--border);
    border-radius: 24px;
    background: radial-gradient(circle at 20% 20%, rgba(42,165,255,.16), transparent 36%), linear-gradient(145deg,#fff,#f2f7fd);
    box-shadow: var(--shadow-md);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.public-eyebrow,
.public-section-kicker {
    color: var(--primary-dark);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .3px;
}

.public-hero-copy h1 {
    margin: 15px 0 14px;
    max-width: 650px;
    font-size: clamp(32px, 4vw, 52px);
    line-height: 1.3;
    letter-spacing: -.8px;
}

.public-hero-copy p {
    margin: 0;
    max-width: 620px;
    color: var(--text-soft);
    font-size: 15px;
    line-height: 2;
}

.public-hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 24px;
}

.public-primary-btn,
.public-secondary-btn,
.public-reset-btn {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 11px;
    padding: 0 17px;
    border: 1px solid transparent;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
    transition: .18s ease;
    white-space: nowrap;
}

.public-primary-btn {
    background: linear-gradient(135deg,#1785f5,#0e6dce);
    color: #fff;
    box-shadow: 0 10px 20px rgba(23,133,245,.18);
}

.public-primary-btn:hover { transform: translateY(-1px); color: #fff; }

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

.public-secondary-btn:hover { background: var(--surface-2); }

.public-reset-btn {
    background: #fff8f8;
    border-color: #f1d1d1;
    color: #c24c4c;
}

.public-reset-btn:hover { background: #fff0f0; }

.public-featured-card { min-height: 430px; display: block; }

.public-featured-media {
    position: relative;
    min-height: 430px;
    border-radius: 24px;
    overflow: hidden;
    background: linear-gradient(145deg,#17385d,#0a1e34);
    background-size: cover;
    background-position: center;
    box-shadow: var(--shadow-md);
}

.public-featured-media:not(.has-image)::before {
    content: "N";
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    font-size: 120px;
    font-weight: 900;
    color: rgba(255,255,255,.08);
}

.public-featured-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(7,23,40,.08) 15%, rgba(7,23,40,.9) 100%);
}

.public-featured-content {
    position: absolute;
    inset: auto 0 0;
    padding: 28px;
    color: #fff;
}

.public-featured-meta,
.public-news-meta,
.public-detail-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-muted);
    font-size: 11px;
}

.public-featured-meta { color: rgba(255,255,255,.72); }
.public-featured-meta span:first-child { color: #fff; font-weight: 700; }

.public-featured-content h2 {
    margin: 10px 0 8px;
    max-width: 760px;
    font-size: clamp(22px, 3vw, 34px);
    line-height: 1.5;
}

.public-featured-content p {
    margin: 0;
    max-width: 760px;
    color: rgba(255,255,255,.78);
    font-size: 13px;
    line-height: 1.9;
}

.public-section { padding: 70px 0 0; }

.public-section-heading {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 20px;
    margin-bottom: 22px;
}

.public-section-heading h2 {
    margin: 7px 0 0;
    font-size: 24px;
}

.public-text-link {
    color: var(--primary-dark);
    font-size: 12px;
    font-weight: 800;
}

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

.public-news-card {
    min-width: 0;
    border: 1px solid var(--border);
    border-radius: 17px;
    background: var(--surface);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}

.public-news-card:hover {
    transform: translateY(-3px);
    border-color: #d7e5f4;
    box-shadow: 0 18px 36px rgba(20,45,75,.10);
}

.public-news-thumb {
    height: 205px;
    background: linear-gradient(145deg,#163552,#285e84);
    background-position: center;
    background-size: cover;
    display: grid;
    place-items: center;
    overflow: hidden;
}

.public-news-thumb:not(.has-image) { background: linear-gradient(145deg,#112d49,#1f527b); }
.public-thumb-placeholder { color: rgba(255,255,255,.15); font-size: 72px; font-weight: 900; }

.public-news-card-body { padding: 17px; }
.public-news-meta span:first-child { color: var(--primary-dark); font-weight: 800; }

.public-news-card h3 {
    margin: 10px 0 8px;
    color: var(--text);
    font-size: 16px;
    line-height: 1.75;
}

.public-news-card p {
    margin: 0;
    color: var(--text-soft);
    font-size: 12px;
    line-height: 1.9;
}

.public-read-more {
    display: inline-flex;
    margin-top: 13px;
    color: var(--primary-dark);
    font-size: 11px;
    font-weight: 800;
}

.public-page-intro {
    padding: 42px 0 24px;
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 20px;
}

.public-page-intro h1 {
    margin: 8px 0;
    font-size: 34px;
}

.public-page-intro p {
    margin: 0;
    color: var(--text-soft);
    font-size: 13px;
}

.public-filter-card {
    margin-bottom: 24px;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: #fff;
    box-shadow: var(--shadow-sm);
    display: grid;
    grid-template-columns: 1.4fr 1fr auto auto;
    gap: 12px;
    align-items: end;
}

.public-filter-field { display:flex; flex-direction:column; gap:7px; }
.public-filter-field label { font-size:11px; font-weight:700; color:var(--text-soft); }
.public-filter-field input,
.public-filter-field select {
    height: 44px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: #fbfdff;
    color: var(--text);
    padding: 0 12px;
    outline: 0;
}
.public-filter-field input:focus,
.public-filter-field select:focus { border-color:#abd3fa; box-shadow:0 0 0 3px rgba(23,133,245,.10); }

.public-news-grid-list { padding-bottom: 30px; }

.public-pagination {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 20px;
}

.public-pagination button {
    min-width: 38px;
    height: 38px;
    padding: 0 11px;
    border: 1px solid var(--border);
    background: #fff;
    border-radius: 10px;
    color: var(--text-soft);
    cursor: pointer;
}

.public-pagination button.active { background: var(--brand-900); color:#fff; border-color:var(--brand-900); }
.public-pagination button:disabled { opacity:.4; cursor:not-allowed; }

.public-detail-page { padding: 44px 0 0; }
.public-detail-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 6px;
}
.public-detail-meta span {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 4px 11px;
    border-radius: 999px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text-soft);
    font-size: 11px;
    font-weight: 700;
}
.public-detail-meta span:first-child {
    color: var(--primary-dark);
    background: var(--primary-soft);
    border-color: transparent;
}
.public-detail-title { max-width: 1000px; margin: 12px 0 14px; font-size: clamp(30px, 4vw, 48px); line-height: 1.45; }
.public-detail-summary { max-width: 940px; margin: 0; color: var(--text-soft); font-size: 16px; line-height: 2; }

.public-detail-cover {
    min-height: 430px;
    margin-top: 28px;
    border-radius: 22px;
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
    box-shadow: var(--shadow-md);
}

.public-detail-content {
    max-width: 920px;
    margin: 38px auto 0;
    color: #263247;
    font-size: 15px;
    line-height: 2.25;
}

.public-detail-content img { max-width:100%; height:auto; border-radius:14px; }
.public-detail-content h2,
.public-detail-content h3 { margin-top: 32px; line-height:1.5; }
.public-detail-content a { color:var(--primary-dark); text-decoration:underline; }

.public-related-section { padding: 74px 0 0; }

.public-empty-state {
    width: min(720px, calc(100% - 40px));
    margin: 80px auto;
    padding: 44px;
    text-align: center;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 22px;
    box-shadow: var(--shadow-sm);
}
.public-empty-state.compact { margin-top: 24px; }
.public-empty-icon {
    width: 66px;
    height: 66px;
    margin: 0 auto 18px;
    display:grid;
    place-items:center;
    border-radius: 18px;
    background: var(--primary-soft);
    color: var(--primary-dark);
    font-size: 21px;
    font-weight: 900;
}
.public-empty-state h1,
.public-empty-state h2 { margin: 0 0 10px; }
.public-empty-state p { margin:0 0 20px; color:var(--text-soft); line-height:1.9; }

.public-skeleton { border-radius: 20px; background:linear-gradient(90deg,#edf2f7 25%,#f7f9fb 37%,#edf2f7 63%); background-size:400% 100%; animation: publicSkeleton 1.4s ease infinite; }
.public-loading-grid { width:min(1280px,calc(100% - 40px)); margin:0 auto; display:grid; grid-template-columns:1fr 1.2fr; gap:24px; }
.public-skeleton-hero { height:430px; }
.public-skeleton-list { height:430px; }
.public-detail-loading { padding-top:50px; }
.public-skeleton-title { height:70px; width:75%; }
.public-skeleton-article { height:560px; margin-top:24px; }
@keyframes publicSkeleton { 0%{background-position:100% 0} 100%{background-position:-100% 0} }

@media (max-width: 980px) {
    .public-hero,
    .public-loading-grid { grid-template-columns: 1fr; }
    .public-news-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .public-filter-card { grid-template-columns: 1fr 1fr; }
    .public-detail-cover { min-height: 340px; }
}

@media (max-width: 640px) {
    .public-container { width: calc(100% - 24px); }
    .public-home { padding-top: 18px; }
    .public-hero-copy { padding: 30px 24px; min-height: auto; }
    .public-featured-media, .public-featured-card { min-height: 360px; }
    .public-news-grid { grid-template-columns: 1fr; }
    .public-filter-card { grid-template-columns: 1fr; }
    .public-page-intro { flex-direction: column; align-items: flex-start; }
    .public-page-intro h1 { font-size: 28px; }
    .public-detail-cover { min-height: 250px; }
    .public-detail-title { font-size: 28px; }
}


/* =========================================================
   Login / Dashboard action refinements
   ========================================================= */

.login-card {
    margin-inline: auto;
    text-align: right;
}

.login-submit-btn,
.login-public-news-btn {
    width: 100%;
    min-height: 48px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    font-family: "Vazirmatn", Tahoma, Arial, sans-serif;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}

.login-submit-btn {
    margin-top: 8px;
    border: 0;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    cursor: pointer;
    box-shadow: 0 10px 24px rgba(23, 105, 198, .20);
}

.login-submit-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 14px 28px rgba(23, 105, 198, .26);
}

.login-submit-btn:disabled {
    opacity: .6;
    cursor: not-allowed;
}

.login-public-news-btn {
    margin-top: 10px;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--brand-900);
}

.login-public-news-btn:hover {
    background: var(--primary-soft);
    color: var(--primary-dark);
    transform: translateY(-1px);
}

.dashboard-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.dashboard-news-page-btn,
.dashboard-new-news-btn {
    min-height: 46px;
    padding: 0 17px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-sizing: border-box;
    font-family: "Vazirmatn", Tahoma, Arial, sans-serif;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    text-decoration: none;
    white-space: nowrap;
}

.dashboard-news-page-btn {
    border: 1px solid var(--border);
    background: #fff;
    color: var(--brand-900);
}

.dashboard-news-page-btn:hover {
    background: var(--primary-soft);
    color: var(--primary-dark);
}

@media (max-width: 700px) {
    .dashboard-header-actions {
        width: 100%;
    }

    .dashboard-header-actions a {
        flex: 1 1 100%;
    }
}

/* ================= PUBLIC SEO / ARTICLE DETAILS ================= */
.public-breadcrumb {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 9px;
    margin: 0 0 24px;
    padding: 9px 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface-2);
    color: var(--text-soft);
    font-size: 12px;
    line-height: 1.7;
}

.public-breadcrumb a {
    color: var(--primary-dark);
    text-decoration: none;
    font-weight: 800;
    transition: color .18s ease;
}

.public-breadcrumb a:hover {
    color: var(--brand-900);
    text-decoration: none;
}

.public-breadcrumb span {
    opacity: .7;
}

.public-breadcrumb span:last-child {
    color: var(--text);
    font-weight: 700;
}

.public-detail-page {
    max-width: 1040px;
}

.public-detail-content {
    font-size: 18px;
    line-height: 2.25;
    color: var(--text);
}

.public-detail-content p {
    margin: 0 0 22px;
}

.public-detail-content blockquote {
    margin: 28px 0;
    padding: 18px 22px;
    border-right: 4px solid var(--primary-dark);
    background: var(--surface-2);
    border-radius: 14px;
    color: var(--text-soft);
}

.public-detail-content ul,
.public-detail-content ol {
    padding-right: 24px;
    margin-bottom: 22px;
}


/* ================= LOGIN CENTERED CONTENT ================= */
.login-card {
    text-align: center;
}

.login-card h1,
.login-help,
.login-error {
    text-align: center;
}

.login-card .mud-input-control,
.login-card .mud-input,
.login-card .mud-input-slot {
    text-align: center !important;
}

.login-card .mud-input-input {
    text-align: center !important;
}

.login-card .mud-input-label {
    right: 0 !important;
    left: 0 !important;
    width: 100%;
    text-align: center !important;
    transform-origin: center top !important;
}

.login-card .mud-input-label.mud-input-label-input {
    right: 50% !important;
    left: auto !important;
    width: auto;
    transform: translateX(50%);
}

.login-card .mud-input-label.mud-input-label-shrink {
    right: 12px !important;
    left: 12px !important;
    width: auto;
    transform: translateY(-24px) !important;
    text-align: center !important;
}

.status.inactive {
    background: #f1f3f5;
    color: #6b7280;
    border: 1px solid #d9dee5;
}


/* ================= LOGIN FORM - CENTERED NATIVE FIELDS ================= */
.login-card {
    text-align: center;
}

.login-card h1,
.login-help,
.login-error {
    text-align: center;
}

.login-field {
    width: 100%;
    margin: 0 0 14px;
    text-align: center;
}

.login-field label {
    display: block;
    margin: 0 0 7px;
    color: var(--text-soft);
    font-size: 12px;
    font-weight: 700;
    text-align: center;
}

.login-field input {
    width: 100%;
    min-height: 48px;
    box-sizing: border-box;
    padding: 0 14px;
    border: 1px solid var(--border-strong);
    border-radius: 12px;
    background: #fff;
    color: var(--text);
    outline: none;
    font-family: "Vazirmatn", Tahoma, Arial, sans-serif;
    font-size: 13px;
    text-align: center;
    direction: rtl;
    transition: border-color .18s ease, box-shadow .18s ease;
}

.login-field input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(42, 129, 214, .10);
}

.login-field input::placeholder {
    color: #9aa5b1;
    text-align: center;
}

.status.inactive {
    background: #f1f3f5;
    color: #626b77;
    border: 1px solid #d9dee5;
}

/* ==============================
   News image upload
   ============================== */
.news-image-upload-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: 22px;
    align-items: start;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: #f8fafc;
}

.news-image-upload-controls {
    min-width: 0;
}

.news-image-upload-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.news-file-button {
    position: relative;
    overflow: hidden;
}

.news-file-button.disabled {
    pointer-events: none;
    opacity: .55;
}

.news-image-input-hidden {
    position: absolute !important;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.news-image-input {
    display: none;
}

.news-btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 17px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
    color: var(--text);
    cursor: pointer;
}

.news-btn-danger-light {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 17px;
    border: 1px solid #f2caca;
    border-radius: 10px;
    background: #fff5f5;
    color: #b63737;
    cursor: pointer;
}

.news-image-selected {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 10px;
    padding: 11px 13px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #fff;
    font-size: 12px;
}

.news-image-selected strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.news-image-selected span {
    flex: 0 0 auto;
    color: var(--text-muted);
}

.news-image-preview-wrap {
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.news-image-preview-label {
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 800;
}

.news-image-preview {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    border-radius: 14px;
    border: 1px solid #e2e8f0;
    background: #eaf0f6;
}

@media (max-width: 820px) {
    .news-image-upload-card {
        grid-template-columns: 1fr;
    }
}


.news-editor-published-note {
    margin-bottom: 14px;
    padding: 12px 14px;
    border: 1px solid #bfdbfe;
    background: #eff6ff;
    color: #1e40af;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.9;
}

.news-image-upload-progress{margin-top:10px;padding:10px 12px;border-radius:10px;background:#eef6ff;color:#175cd3;font-size:13px;text-align:center}

/* Persian + Gregorian publication date styling */
.public-date-dual {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    direction: ltr;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    letter-spacing: .1px;
}

.public-date-dual b {
    font-size: 10px;
    opacity: .65;
}

.public-featured-meta .public-date-dual {
    color: rgba(255,255,255,.78);
}

.public-news-meta .public-date-dual {
    color: var(--text-muted);
    font-weight: 600;
}

.public-detail-dates {
    display: inline-flex !important;
    align-items: center;
    gap: 10px;
    min-height: 38px !important;
    padding: 6px 13px !important;
    border-radius: 11px !important;
    background: #f7faff !important;
    border: 1px solid #e2eaf3 !important;
    color: var(--text-soft) !important;
    box-shadow: 0 3px 12px rgba(20,45,75,.04);
}

.public-detail-date-label {
    display: inline-flex !important;
    align-items: center;
    min-height: auto !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    color: var(--primary-dark) !important;
    font-size: 11px !important;
    font-weight: 800 !important;
    white-space: nowrap;
}

.public-detail-date-value {
    display: inline-flex !important;
    align-items: center;
    gap: 9px;
    min-height: auto !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    color: var(--text) !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    direction: ltr;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.public-detail-date-value b {
    color: #9aa9b9;
    font-size: 10px;
}

.public-related-section .public-date-dual {
    font-size: 10px;
}

@media (max-width: 640px) {
    .public-date-dual {
        gap: 4px;
        font-size: 9px;
    }

    .public-detail-dates {
        width: 100%;
        justify-content: space-between;
        gap: 8px;
    }

    .public-detail-date-value {
        font-size: 10px !important;
        gap: 6px;
    }
}


/* =========================================================
   Public Home - Popular News / View Count
   ========================================================= */

.public-home-news-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 24px;
    align-items: start;
}

.public-home-news-layout > .public-news-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.public-popular-panel {
    position: relative;
    top: auto;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: #fff;
    box-shadow: var(--shadow-sm);
    padding: 18px;
}

.public-popular-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
}

.public-popular-heading h2 {
    margin: 6px 0 0;
    font-size: 20px;
}

.public-popular-icon {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: var(--primary-soft);
    color: var(--primary-dark);
    font-size: 18px;
    font-weight: 900;
}

.public-popular-list {
    display: flex;
    flex-direction: column;
}

.public-popular-item {
    display: grid;
    grid-template-columns: 26px 72px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    padding: 14px 0;
    border-bottom: 1px solid #edf1f5;
}

.public-popular-item:last-child { border-bottom: 0; padding-bottom: 3px; }

.public-popular-rank {
    color: #a7b2bf;
    font-size: 12px;
    font-weight: 900;
    direction: ltr;
}

.public-popular-thumb {
    width: 72px;
    height: 62px;
    border-radius: 11px;
    overflow: hidden;
    background: linear-gradient(145deg,#163552,#285e84);
    background-position: center;
    background-size: cover;
    display: grid;
    place-items: center;
}

.public-popular-thumb:not(.has-image) { background: linear-gradient(145deg,#112d49,#1f527b); }
.public-popular-thumb span { color: rgba(255,255,255,.18); font-size: 27px; font-weight: 900; }

.public-popular-body { min-width: 0; }

.public-popular-body h3 {
    margin: 0 0 7px;
    color: var(--text);
    font-size: 12px;
    line-height: 1.8;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
}

.public-popular-meta {
    display: flex;
    align-items: center;
    gap: 5px;
    color: var(--text-muted);
    font-size: 10px;
    white-space: nowrap;
}

.public-popular-meta span:first-child {
    color: var(--primary-dark);
    font-weight: 800;
}

.public-popular-item:hover .public-popular-body h3 { color: var(--primary-dark); }

.public-detail-views {
    display: inline-flex !important;
    align-items: center !important;
    gap: 7px;
    color: var(--primary-dark) !important;
    background: var(--primary-soft) !important;
    border-color: transparent !important;
}

.public-detail-views-icon {
    padding: 0 !important;
    min-height: 0 !important;
    border: 0 !important;
    background: transparent !important;
    color: inherit !important;
    font-size: 12px !important;
}

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

    .public-popular-panel {
        position: static;
    }

    .public-home-news-layout > .public-news-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .public-home-news-layout > .public-news-grid {
        grid-template-columns: 1fr;
    }

    .public-popular-panel { padding: 15px; }
    .public-popular-item { grid-template-columns: 24px 68px minmax(0,1fr); }
    .public-popular-thumb { width: 68px; height: 58px; }
}

/* Contact / feedback public pages */
.public-inner-page {
    padding: 64px 0 90px;
}

.public-page-heading {
    max-width: 780px;
    margin: 0 auto 34px;
    text-align: center;
}

.public-page-heading h1 {
    margin: 8px 0 12px;
    font-size: clamp(30px, 4vw, 46px);
    color: var(--brand-900);
}

.public-page-heading p {
    margin: 0;
    color: var(--text-muted);
    line-height: 2;
}

.public-contact-grid {
    max-width: 900px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

.public-contact-card {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 28px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: #fff;
    box-shadow: var(--shadow-sm);
}

.public-contact-icon {
    width: 52px;
    height: 52px;
    flex: 0 0 52px;
    display: grid;
    place-items: center;
    border-radius: 15px;
    background: rgba(25, 82, 125, .08);
    color: var(--primary-dark);
    font-size: 24px;
}

.public-contact-card div:last-child {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.public-contact-card span {
    color: var(--text-muted);
    font-size: 13px;
}

.public-contact-card a {
    color: var(--brand-900);
    font-size: 18px;
    font-weight: 800;
}

.public-contact-actions,
.public-form-actions {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin-top: 28px;
}

.public-primary-btn,
.public-secondary-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 0 22px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 800;
    text-decoration: none;
    cursor: pointer;
}

.public-primary-btn {
    border: 1px solid var(--primary-dark);
    background: var(--primary-dark);
    color: #fff;
}

.public-secondary-btn {
    border: 1px solid var(--border);
    background: #fff;
    color: var(--brand-900);
}

.public-feedback-container {
    max-width: 980px;
}

.public-feedback-form {
    padding: 30px;
    border: 1px solid var(--border);
    border-radius: 22px;
    background: #fff;
    box-shadow: var(--shadow-sm);
}

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

.public-form-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.public-form-field-full { grid-column: 1 / -1; }

.public-form-field label {
    color: var(--brand-900);
    font-size: 13px;
    font-weight: 800;
}

.public-form-field label small {
    color: var(--text-muted);
    font-weight: 500;
}

.public-form-field input,
.public-form-field textarea {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid var(--border);
    border-radius: 12px;
    outline: 0;
    padding: 12px 14px;
    background: #fbfcfd;
    color: var(--text);
    font: inherit;
}

.public-form-field input:focus,
.public-form-field textarea:focus {
    border-color: var(--primary-dark);
    box-shadow: 0 0 0 3px rgba(25, 82, 125, .08);
}

.public-form-field textarea { resize: vertical; min-height: 160px; }

.validation-message,
.validation-errors {
    color: #b42318;
    font-size: 12px;
}

.validation-errors {
    margin: 0 0 18px;
    padding: 12px 16px;
    border-radius: 12px;
    background: #fff1f0;
}

.public-feedback-success,
.public-feedback-error {
    max-width: 760px;
    margin: 0 auto;
    border-radius: 18px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.public-feedback-success {
    background: #eefaf3;
    border: 1px solid #ccebd8;
    color: #155b36;
    text-align: center;
}

.public-feedback-success a { color: inherit; font-weight: 800; margin-top: 8px; }

.public-feedback-error {
    margin-top: 20px;
    background: #fff1f0;
    border: 1px solid #f2c7c3;
    color: #9f1d18;
}

/* Contact messages admin */
.admin-page { padding: 30px; }
.admin-page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 24px;
}
.admin-eyebrow { color: var(--primary-dark); font-size: 12px; font-weight: 800; margin-bottom: 5px; }
.admin-page-header h1 { margin: 0; color: var(--brand-900); font-size: 28px; }
.admin-page-header p { margin: 7px 0 0; color: var(--text-muted); }
.admin-secondary-btn {
    display: inline-flex; align-items: center; justify-content: center;
    min-height: 42px; padding: 0 16px; border: 1px solid var(--border);
    border-radius: 10px; background: #fff; color: var(--brand-900); text-decoration: none; font-weight: 700;
}
.admin-alert { padding: 13px 16px; border-radius: 12px; margin-bottom: 18px; }
.admin-alert-success { background: #eefaf3; color: #155b36; }
.admin-alert-error { background: #fff1f0; color: #9f1d18; }
.admin-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 16px; background: #fff; }
.admin-data-table { width: 100%; border-collapse: collapse; min-width: 1050px; }
.admin-data-table th, .admin-data-table td { padding: 13px 14px; border-bottom: 1px solid var(--border); text-align: right; vertical-align: top; font-size: 13px; }
.admin-data-table th { background: #f8fafc; color: var(--brand-900); font-weight: 800; white-space: nowrap; }
.contact-status-overview {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}
.contact-status-card {
    position: relative;
    min-height: 118px;
    padding: 18px 18px 16px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: #fff;
    box-shadow: var(--shadow-sm);
    text-align: right;
    cursor: pointer;
    transition: .18s ease;
    color: var(--brand-900);
}
.contact-status-card:hover, .contact-status-card.active {
    transform: translateY(-2px);
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
}
.contact-status-card.active::after {
    content: "";
    position: absolute;
    right: 16px;
    left: 16px;
    bottom: 0;
    height: 3px;
    border-radius: 3px 3px 0 0;
    background: var(--primary);
}
.contact-status-card-title { display: block; font-size: 13px; font-weight: 800; margin-bottom: 8px; }
.contact-status-card strong { display: block; font-size: 30px; line-height: 1; margin-bottom: 7px; }
.contact-status-card > span:last-child { color: var(--text-muted); font-size: 11px; }
.contact-status-card-new strong { color: #2563eb; }
.contact-status-card-progress strong { color: #b7791f; }
.contact-status-card-reviewed strong { color: #198754; }
.contact-status-toolbar {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    margin-bottom: 10px; padding: 0 4px;
}
.contact-status-toolbar-title { font-weight: 800; color: var(--brand-900); }
.contact-status-toolbar-result { margin-right: 8px; color: var(--text-muted); font-size: 12px; }
.contact-clear-filter {
    border: 0; background: transparent; color: var(--primary-dark); font-weight: 800; cursor: pointer;
}
.contact-message-cell { max-width: 360px; min-width: 260px; white-space: pre-wrap; line-height: 1.8; }
.contact-status-control {
    display: inline-flex; align-items: center; gap: 7px; min-width: 150px;
    padding: 3px 5px 3px 8px; border: 1px solid var(--border); border-radius: 10px;
    background: #fff;
}
.contact-status-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 8px; }
.contact-status-control.is-new { border-color: #bfdbfe; background: #eff6ff; }
.contact-status-control.is-new .contact-status-dot { background: #2563eb; }
.contact-status-control.is-progress { border-color: #f6d58a; background: #fff8e6; }
.contact-status-control.is-progress .contact-status-dot { background: #d69e2e; }
.contact-status-control.is-reviewed { border-color: #b7e4c7; background: #effaf3; }
.contact-status-control.is-reviewed .contact-status-dot { background: #198754; }
.contact-status-select {
    min-width: 128px; padding: 7px 8px; border: 0; outline: 0;
    background: transparent; color: var(--brand-900); font-weight: 700; cursor: pointer;
}
.admin-empty { text-align: center !important; color: var(--text-muted); padding: 40px !important; }

@media (max-width: 760px) {
    .public-inner-page { padding: 42px 0 65px; }
    .public-contact-grid, .public-form-grid { grid-template-columns: 1fr; }
    .public-form-field-full { grid-column: auto; }
    .public-feedback-form { padding: 20px; }
    .public-contact-actions, .public-form-actions { flex-direction: column; align-items: stretch; }
    .public-primary-btn, .public-secondary-btn { width: 100%; }
    .admin-page { padding: 20px 14px; }
    .admin-page-header { flex-direction: column; }
    .contact-status-overview { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .contact-status-toolbar { align-items: flex-start; }
}

@media (max-width: 480px) {
    .contact-status-overview { grid-template-columns: 1fr; }
    .contact-status-card { min-height: 96px; }
    .contact-status-toolbar { flex-direction: column; }
}

/* NextNews brand icon on login */
.login-brand-logo {
    width: 92px;
    height: 92px;
    margin: 0 auto 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-brand-logo img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* NextNews v2 - tags and rich text editor */
.public-home-sidebar { display:flex; flex-direction:column; gap:18px; min-width:0; }
.public-tags-panel { border:1px solid var(--border); border-radius:20px; background:#fff; box-shadow:var(--shadow-sm); padding:18px; }
.public-tags-heading { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:15px; }
.public-tags-heading h2 { margin:3px 0 0; font-size:19px; }
.public-tags-icon { width:36px; height:36px; border-radius:11px; display:grid; place-items:center; background:#eef6fb; color:var(--primary); font-weight:900; font-size:19px; }
.public-tags-list { display:flex; flex-wrap:wrap; gap:8px; }
.public-tag-chip { display:inline-flex; align-items:center; padding:7px 11px; border-radius:999px; border:1px solid #d8e6ef; background:#f8fbfd; color:#31556e; text-decoration:none; font-size:13px; font-weight:700; transition:.18s ease; }
.public-tag-chip:hover { background:#eef6fb; border-color:#bcd5e4; color:var(--primary-dark); transform:translateY(-1px); }
.public-detail-tags { display:flex; flex-wrap:wrap; align-items:center; gap:8px; margin-top:24px; padding-top:18px; border-top:1px solid var(--border); }
.public-detail-tags-label { color:#687b89; font-size:14px; font-weight:700; margin-left:3px; }

.news-tags-multiselect { min-height:125px; padding:10px 12px; }
.news-tags-multiselect option { padding:7px 9px; }
.news-selected-tags { display:flex; flex-wrap:wrap; gap:7px; margin-top:10px; }
.news-selected-tag { display:inline-flex; padding:5px 9px; border-radius:999px; background:#eef6fb; color:#245a7a; font-size:12px; font-weight:800; }
.news-rich-editor { border:1px solid #d7e1e8; border-radius:14px; overflow:hidden; background:#fff; box-shadow:0 2px 8px rgba(20,50,70,.04); }
.news-rich-editor-disabled { background:#f7f9fa; }
.news-rich-toolbar { display:flex; align-items:center; flex-wrap:wrap; gap:5px; padding:8px; border-bottom:1px solid #e2e9ee; background:#f7fafc; }
.news-rich-toolbar button { min-width:36px; height:34px; padding:0 9px; border:1px solid #d5e0e7; border-radius:8px; background:#fff; color:#315368; cursor:pointer; font-family:inherit; font-weight:700; }
.news-rich-toolbar button:hover:not(:disabled) { background:#eef6fb; border-color:#b9d3e3; }
.news-rich-toolbar button:disabled { opacity:.45; cursor:not-allowed; }
.news-rich-toolbar span { width:1px; height:24px; background:#d9e2e8; margin:0 3px; }
.news-content-editor { min-height:320px; padding:16px; outline:none; line-height:2; text-align:right; direction:rtl; }
.news-rich-editor-disabled .news-content-editor { cursor:default; }
.news-content-editor:focus { box-shadow:inset 0 0 0 2px rgba(44,122,170,.08); }
.news-content-editor h2 { font-size:23px; margin:18px 0 9px; }
.news-content-editor p { margin:0 0 12px; }
.news-content-editor ul, .news-content-editor ol { padding-right:26px; margin:10px 0 14px; }
.category-news-count { color:#275d7a; font-variant-numeric:tabular-nums; }

@media (max-width: 980px) {
    .public-home-sidebar { display:grid; grid-template-columns:1fr 1fr; }
}
@media (max-width: 640px) {
    .public-home-sidebar { display:flex; }
    .news-rich-toolbar { gap:4px; }
    .news-rich-toolbar button { min-width:32px; padding:0 7px; }
    .news-content-editor { min-height:260px; }
}


/* Tag home-page management */
.category-form { display:grid; grid-template-columns:minmax(0,1.5fr) minmax(180px,.7fr) minmax(240px,1fr); gap:16px; }
.category-field-toggle { display:flex; flex-direction:column; gap:8px; }
.tag-home-toggle { display:flex; align-items:center; gap:10px; min-height:42px; cursor:pointer; color:#31556e; }
.tag-home-toggle input { display:none; }
.tag-home-toggle span { width:42px; height:24px; border-radius:999px; background:#d9e2e8; position:relative; transition:.2s; }
.tag-home-toggle span:after { content:""; width:18px; height:18px; border-radius:50%; background:#fff; position:absolute; top:3px; right:3px; box-shadow:0 1px 3px rgba(0,0,0,.15); transition:.2s; }
.tag-home-toggle input:checked + span { background:var(--primary); }
.tag-home-toggle input:checked + span:after { right:21px; }
.tag-home-btn { border:1px solid #d8e6ef; background:#f8fbfd; color:#627684; border-radius:999px; padding:7px 11px; font-size:12px; font-weight:800; cursor:pointer; }
.tag-home-btn.is-on { background:#edf9f2; border-color:#b9e1c7; color:#237343; }
.tag-home-disabled { color:#9aa8b1; font-size:12px; }
.tag-news-count { display:inline-flex; min-width:34px; justify-content:center; padding:4px 9px; border-radius:999px; background:#eef6fb; color:#31556e; font-weight:800; }
.tag-order { font-weight:800; color:#647887; }
@media (max-width: 1000px) { .category-form { grid-template-columns:1fr 1fr; } .category-field-toggle { grid-column:1 / -1; } }
@media (max-width: 700px) { .category-form { grid-template-columns:1fr; } .category-field-toggle { grid-column:auto; } }


/* Final mobile/public layout corrections */
.public-shell,
.public-shell *,
.public-shell *::before,
.public-shell *::after {
    box-sizing: border-box;
}

.public-container {
    width: min(1280px, calc(100% - 40px));
    max-width: 100%;
    margin-inline: auto;
}

.public-detail-page {
    width: min(1040px, calc(100% - 40px));
    max-width: 100%;
}

.public-detail-cover {
    width: 100%;
    max-width: 100%;
}

.public-detail-content,
.public-detail-content * {
    max-width: 100%;
}

.public-news-grid,
.public-home-news-layout,
.public-home-sidebar {
    min-width: 0;
}

@media (max-width: 760px) {
    .public-container,
    .public-detail-page {
        width: calc(100% - 20px);
    }

    .public-detail-cover {
        min-height: 210px;
        width: 100%;
    }

    .public-related-section {
        width: 100%;
    }

    .public-related-section .public-news-grid {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .public-container,
    .public-detail-page {
        width: calc(100% - 16px);
    }

    .public-detail-cover {
        min-height: 190px;
        border-radius: 14px;
    }
}

/* Mobile final alignment fixes */
@media (max-width: 760px) {
    .public-detail-page {
        width: 100% !important;
        max-width: 100% !important;
        margin-inline: 0 !important;
        padding-inline: 12px !important;
    }

    .public-detail-page > .public-detail-cover,
    .public-detail-page > .public-detail-content,
    .public-detail-page > .public-detail-summary,
    .public-detail-page > .public-detail-title,
    .public-detail-page > .public-detail-meta,
    .public-detail-page > .public-breadcrumb,
    .public-detail-page > .public-detail-tags,
    .public-detail-page > .public-related-section {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
    }

    .public-detail-cover {
        display: block;
        width: 100% !important;
        max-width: 100% !important;
        margin-inline: 0 !important;
    }

    .public-related-section .public-news-grid {
        width: 100% !important;
        max-width: 100% !important;
        grid-template-columns: minmax(0, 1fr) !important;
    }

    .public-related-section .public-news-card {
        width: 100% !important;
        min-width: 0 !important;
    }
}

@media (max-width: 480px) {
    .public-detail-page {
        padding-inline: 10px !important;
    }

    .public-related-section .public-news-card,
    .public-related-section .public-news-thumb,
    .public-related-section .public-news-card-body {
        min-width: 0 !important;
        max-width: 100% !important;
    }
}

/* News detail metadata - mobile overflow fix */
@media (max-width: 760px) {
    .public-detail-meta {
        width: 100%;
        min-width: 0;
        align-items: stretch;
        flex-direction: column;
        gap: 7px;
    }

    .public-detail-meta > .public-detail-category,
    .public-detail-meta > .public-detail-dates,
    .public-detail-meta > .public-detail-views {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box;
    }

    .public-detail-dates {
        display: flex !important;
        flex-wrap: wrap !important;
        justify-content: flex-start !important;
        align-items: center !important;
        gap: 5px 8px !important;
        white-space: normal !important;
        overflow: hidden;
    }

    .public-detail-date-label {
        white-space: nowrap !important;
        flex: 0 0 auto;
    }

    .public-detail-date-value {
        display: flex !important;
        flex-wrap: wrap !important;
        min-width: 0 !important;
        white-space: normal !important;
        overflow-wrap: anywhere;
        word-break: break-word;
        gap: 4px 7px !important;
        direction: ltr;
    }

    .public-detail-date-value > span {
        white-space: nowrap;
    }

    .public-detail-views {
        justify-content: flex-start !important;
    }
}

@media (max-width: 420px) {
    .public-detail-dates {
        align-items: flex-start !important;
        flex-direction: column !important;
        gap: 4px !important;
    }

    .public-detail-date-value {
        width: 100%;
        justify-content: flex-start;
    }
}
