/* ============================================================
   Afaq Al Hurriya — Press Platform UI
   Brand palette from afaqalhurriya.com (theme: modernee)
   RTL-first: all layout uses logical properties.
   ============================================================ */
:root {
    --c-primary: #0B6B38;
    --c-primary-hover: #08512A;
    --c-primary-soft: #e8f3ec;
    --c-secondary: #4EA961;
    --c-secondary-hover: #39934C;
    --c-secondary-soft: #ecf7ef;
    --c-accent: #DB5D53;
    --c-accent-hover: #CB4A40;
    --c-accent-soft: #fdecea;
    --c-amber: #b87514;
    --c-amber-soft: #fef3e2;
    --c-text-dark: #26243a;
    --c-text: #6f6c85;
    --c-text-light: #a3a0b5;
    --c-bg: #f2f2f7;
    --c-bg-card: #ffffff;
    --c-dark: #18162b;
    --c-dark-2: #221f3d;
    --c-border: #d8d6e4;
    --c-border-light: #eae9f1;
    --radius: 14px;
    --radius-sm: 9px;
    --shadow: 0 1px 2px rgba(24, 22, 43, .05), 0 8px 28px rgba(24, 22, 43, .07);
    --shadow-soft: 0 1px 3px rgba(24, 22, 43, .07);
    --sidebar-w: 240px;
}

* {
    box-sizing: border-box;
}

html {
    height: 100%;
}

body {
    margin: 0;
    font-family: 'Rubik', 'DM Sans', system-ui, -apple-system, 'Segoe UI', Tahoma, sans-serif;
    background: var(--c-bg);
    color: var(--c-text-dark);
    min-height: 100vh;
    line-height: 1.6;
    font-size: 15px;
}

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

a:hover {
    color: var(--c-primary-hover);
}

/* ============================================================
   App shell: fixed sidebar + main column
   ============================================================ */
.app {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    background: linear-gradient(180deg, var(--c-dark) 0%, var(--c-dark-2) 100%);
    color: #cfcde0;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    z-index: 20;
}

.sidebar .brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 26px 18px 22px;
    color: #fff;
    font-weight: 700;
    font-size: 15.5px;
    line-height: 1.3;
    border-bottom: 1px solid rgba(255, 255, 255, .07);
}

.sidebar .brand .brand-name {
    font-size: 17px;
    font-weight: 800;
    letter-spacing: .2px;
    color: #fff;
    text-align: center;
}

.sidebar .brand .logo {
    height: 72px;
    flex-shrink: 0;
    border-radius: 14px;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 18px;
    box-shadow: 0 6px 18px rgba(11, 107, 56, .3);
    overflow: hidden;
}

.sidebar .brand .logo img {
    height: 100%;
    width: auto;
    max-width: 200px;
    object-fit: contain;
    display: block;
}

.sidebar nav {
    flex: 1;
    padding: 14px 12px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    overflow-y: auto;
}

.sidebar nav a {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 13px;
    border-radius: 10px;
    color: #b6b3cc;
    font-size: 14px;
    font-weight: 500;
    transition: background .15s, color .15s;
}

.sidebar nav a svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    opacity: .8;
}

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

.sidebar nav a.active {
    color: #fff;
    background: var(--c-primary);
    box-shadow: 0 4px 14px rgba(11, 107, 56, .4);
}

.sidebar nav a.active svg {
    opacity: 1;
}

.sidebar .side-foot {
    padding: 14px 16px 18px;
    border-top: 1px solid rgba(255, 255, 255, .07);
}

.sidebar .userchip {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.sidebar .userchip .avatar {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, .12);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 15px;
}

.sidebar .userchip .uname {
    color: #fff;
    font-size: 13.5px;
    font-weight: 600;
    line-height: 1.25;
}

.sidebar .userchip .urole {
    color: var(--c-text-light);
    font-size: 11.5px;
}

.sidebar .side-foot form {
    margin: 0;
}

.sidebar .side-foot button {
    width: 100%;
    margin: 0;
    padding: 8px 12px;
    font-size: 13px;
    background: rgba(255, 255, 255, .07);
    color: #cfcde0;
    border: 1px solid rgba(255, 255, 255, .12);
    box-shadow: none;
}

.sidebar .side-foot button:hover {
    background: rgba(219, 93, 83, .85);
    border-color: transparent;
    color: #fff;
}

.main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.wrap {
    width: 100%;
    max-width: 1340px;
    margin: 0 auto;
    padding: 28px 28px 48px;
}

/* Data-heavy screens (e.g. the articles list table) use a much wider container
   to make better use of large displays. */
.wrap.wide {
    max-width: 1760px;
}

/* Articles list table: keep every column on a SINGLE line and truncate any
   overflow with an ellipsis (…). Fixed layout so column widths are honored. */
.wrap.wide table {
    table-layout: fixed;
}

.wrap.wide table th,
.wrap.wide table td {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Column widths (title, author, category, language, status, views, updated, actions). */
.wrap.wide table th:nth-child(1) {
    width: 28%;
}

.wrap.wide table th:nth-child(2) {
    width: 12%;
}

.wrap.wide table th:nth-child(3) {
    width: 11%;
}

.wrap.wide table th:nth-child(4) {
    width: 8%;
}

.wrap.wide table th:nth-child(5) {
    width: 11%;
}

.wrap.wide table th:nth-child(6) {
    width: 8%;
}

.wrap.wide table th:nth-child(7) {
    width: 10%;
}

.wrap.wide table th:nth-child(8) {
    width: 12%;
}

/* The actions column holds icon buttons — don't clip them. */
.wrap.wide table th:last-child,
.wrap.wide table td:last-child {
    overflow: visible;
    white-space: nowrap;
}

/* Title cell: thumbnail + truncating link on one line. */
.wrap.wide .cell-title {
    overflow: hidden;
}

.wrap.wide .cell-title span {
    min-width: 0;
    overflow: hidden;
}

.wrap.wide .cell-title a {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ============================================================
   Cards
   ============================================================ */
.card {
    background: var(--c-bg-card);
    border: 1px solid var(--c-border-light);
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
    padding: 26px;
    margin-bottom: 22px;
}

.card h1 {
    margin: 0 0 6px;
    font-size: 22px;
    font-weight: 700;
}

.card h2 {
    font-size: 16.5px;
    margin: 0 0 14px;
    font-weight: 700;
}

/* Login page (no shell) */
body.auth {
    background:
        radial-gradient(900px 500px at 85% -10%, rgba(11, 107, 56, .26), transparent 60%),
        radial-gradient(700px 420px at 0% 110%, rgba(78, 169, 97, .14), transparent 60%),
        var(--c-dark);
}

.card.login {
    max-width: 430px;
    margin: 9vh auto;
    border: 0;
    box-shadow: 0 24px 70px rgba(0, 0, 0, .45);
    padding: 34px 32px;
}

/* Brand logo lockup at the top of the login / OTP card */
.auth-brand {
    text-align: center;
    margin-bottom: 18px;
}

.auth-brand img {
    height: 72px;
    width: auto;
    max-width: 80%;
    object-fit: contain;
}

/* Login card — centered, balanced lockup */
.card.login h1 {
    text-align: center;
    font-size: 21px;
    margin: 0 0 16px;
}

.card.login button[type=submit] {
    width: 100%;
    margin-top: 22px;
    padding: 12px 24px;
}

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

.card.login .small {
    white-space: nowrap;
}

.badge {
    display: inline-block;
    background: var(--c-primary-soft);
    color: var(--c-primary);
    font-size: 12px;
    font-weight: 600;
    padding: 4px 13px;
    border-radius: 99px;
    margin-bottom: 14px;
}

.muted {
    color: var(--c-text);
}

.small {
    font-size: 13px;
}

/* ============================================================
   Dashboard hero + stats
   ============================================================ */
.hero {
    background:
        radial-gradient(560px 240px at 88% -30%, rgba(255, 255, 255, .16), transparent 60%),
        linear-gradient(120deg, var(--c-primary) 0%, #0E8043 55%, #1FA45A 100%);
    color: #fff;
    border-radius: var(--radius);
    padding: 30px 30px 28px;
    margin-bottom: 22px;
    box-shadow: 0 14px 36px rgba(11, 107, 56, .32);
}

.hero h1 {
    margin: 0 0 4px;
    font-size: 24px;
    font-weight: 700;
}

.hero .sub {
    color: rgba(255, 255, 255, .82);
    font-size: 14px;
}

.hero .pill {
    background: rgba(255, 255, 255, .18);
    color: #fff;
}

/* Enterprise hero with inline KPIs */
.hero-rich {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: wrap;
}

.hero-rich .hero-main {
    min-width: 220px;
}

.hero-kpis {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
}

.hero-kpis .kpi {
    background: rgba(255, 255, 255, .14);
    border: 1px solid rgba(255, 255, 255, .2);
    border-radius: var(--radius-sm);
    padding: 12px 18px;
    min-width: 110px;
    text-align: center;
}

.hero-kpis .kpi-n {
    display: block;
    font-size: 26px;
    font-weight: 700;
    line-height: 1.1;
}

.hero-kpis .kpi-l {
    display: block;
    font-size: 12px;
    color: rgba(255, 255, 255, .82);
    margin-top: 2px;
}

/* Top-articles-by-views panel */
.toplist {
    display: flex;
    flex-direction: column;
}

.toprow {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 6px;
    border-bottom: 1px solid var(--c-border-light);
    color: var(--c-text-dark);
}

.toprow:last-child {
    border-bottom: 0;
}

.toprow:hover {
    color: var(--c-primary);
}

.toprank {
    flex: 0 0 auto;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--c-primary-soft);
    color: var(--c-primary);
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.topthumb {
    flex: 0 0 auto;
    width: 64px;
    height: 42px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    border: 1px solid var(--c-border-light);
    background: var(--c-border-light);
}

.toptitle {
    flex: 1 1 auto;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.topviews {
    flex: 0 0 auto;
    font-weight: 700;
    color: var(--c-text-dark);
    white-space: nowrap;
}

td.num {
    font-variant-numeric: tabular-nums;
}

/* Tabs (article list scopes) */
.tabs {
    display: flex;
    gap: 4px;
    margin: 4px 0 16px;
    border-bottom: 1px solid var(--c-border-light);
    flex-wrap: wrap;
}

.tabs a {
    padding: 9px 16px;
    font-size: 14px;
    font-weight: 600;
    color: var(--c-text);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color .15s, border-color .15s;
}

.tabs a:hover {
    color: var(--c-primary);
}

.tabs a.active {
    color: var(--c-primary);
    border-bottom-color: var(--c-primary);
}

.ro-note {
    margin: -8px 0 14px;
}

/* Article-list filter bar */
.filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin: 2px 0 16px;
}

.filters input[type=search],
.filters select {
    width: auto;
    min-width: 0;
    padding: 8px 12px;
    margin: 0;
}

.filters input[type=search] {
    flex: 1 1 200px;
    max-width: 320px;
}

.filters .btn {
    margin-top: 0;
}

.resline {
    margin: 0 0 12px;
}

/* Sortable table headers */
.th-sort a {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: inherit;
    font: inherit;
    text-transform: inherit;
    letter-spacing: inherit;
}

.th-sort a:hover,
.th-sort.sorted a {
    color: var(--c-primary);
}

.sort-ar {
    font-size: 9px;
    line-height: 1;
}

/* Icon-only buttons & links */
.row.qa .btn.icon,
.row.qa button.icon,
button.sm.icon,
.btn.sm.icon {
    padding: 5px 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0;
}

.btn.icon svg,
button.icon svg {
    display: block;
    width: 15px;
    height: 15px;
}

/* Pagination */
.pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 18px;
    flex-wrap: wrap;
}

.pager .btn.disabled {
    opacity: .45;
    pointer-events: none;
}

.pages {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.pg {
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    color: var(--c-text-dark);
}

a.pg:hover {
    background: var(--c-primary-soft);
    color: var(--c-primary);
}

.pg.cur {
    background: var(--c-primary);
    color: #fff;
}

.pg.gap {
    color: var(--c-text-light);
    pointer-events: none;
}

/* Dashboard charts row */
.dash-row {
    display: grid;
    grid-template-columns: 1.9fr 1fr;
    gap: 16px;
    margin-bottom: 22px;
    align-items: stretch;
}

.dash-row .card {
    margin: 0;
}

.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 6px;
}

.card-head h2 {
    margin: 0;
}

.pill.demo {
    background: var(--c-amber-soft);
    color: var(--c-amber);
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 99px;
}

.chart-card .areachart {
    width: 100%;
    height: auto;
    display: block;
    margin-top: 6px;
}

.chart-x {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
    color: var(--c-text-light);
    font-size: 11px;
    font-variant-numeric: tabular-nums;
}

.chart-x span {
    flex: 1 1 0;
    text-align: center;
}

.chart-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 150px;
    margin-top: 6px;
    padding: 14px 18px;
    color: var(--c-text-light);
    font-size: 13px;
    line-height: 1.7;
    background: var(--c-surface-2, #f6f7fb);
    border: 1px dashed var(--c-border);
    border-radius: 12px;
}

/* Donut + legend */
.donut-wrap {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.donut {
    width: 160px;
    height: 160px;
    flex: 0 0 auto;
}

.donut-total {
    font-size: 38px;
    font-weight: 700;
    fill: var(--c-text-dark);
}

.donut-sub {
    font-size: 13px;
    fill: var(--c-text);
}

.donut-legend {
    list-style: none;
    margin: 0;
    padding: 0;
    flex: 1 1 150px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.donut-legend li {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 13.5px;
    color: var(--c-text-dark);
}

.donut-legend .dot {
    width: 11px;
    height: 11px;
    border-radius: 3px;
    flex: 0 0 auto;
}

.donut-legend .lg-l {
    flex: 1 1 auto;
    color: var(--c-text);
}

.donut-legend b {
    font-variant-numeric: tabular-nums;
}

/* Secondary KPI strip */
.kpi-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 14px;
    margin-bottom: 22px;
}

.ks {
    background: var(--c-bg-card);
    border: 1px solid var(--c-border-light);
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ks-n {
    font-size: 26px;
    font-weight: 800;
    color: var(--c-primary);
    font-variant-numeric: tabular-nums;
}

.ks-l {
    font-size: 12.5px;
    color: var(--c-text);
    font-weight: 600;
}

/* Vertical bar chart */
.barchart {
    width: 100%;
    height: auto;
    display: block;
    margin-top: 6px;
}

.bar-val {
    font-size: 25px;
    font-weight: 700;
    fill: var(--c-text-dark);
    font-variant-numeric: tabular-nums;
}

/* Horizontal bars */
.hbars {
    list-style: none;
    margin: 6px 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 11px;
}

.hbars li {
    display: grid;
    grid-template-columns: minmax(70px, 34%) 1fr auto;
    align-items: center;
    gap: 10px;
}

.hb-l {
    font-size: 13.5px;
    color: var(--c-text-dark);
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hb-track {
    background: var(--c-border-light);
    border-radius: 99px;
    height: 10px;
    overflow: hidden;
}

.hb-fill {
    display: block;
    height: 100%;
    border-radius: 99px;
    min-width: 4px;
}

.hb-v {
    font-size: 13px;
    font-weight: 700;
    color: var(--c-text-dark);
    font-variant-numeric: tabular-nums;
    min-width: 36px;
    text-align: end;
}

/* Tag cloud */
.tagcloud {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
}

.tagchip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: var(--c-primary-soft);
    color: var(--c-primary);
    border-radius: 99px;
    padding: 5px 12px;
    font-size: 13px;
    font-weight: 600;
}

.tagchip b {
    background: var(--c-primary);
    color: #fff;
    border-radius: 99px;
    min-width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    padding: 0 5px;
}

/* Activity feed */
.feed {
    list-style: none;
    margin: 6px 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
}

.feed-item {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 9px 0;
    border-bottom: 1px solid var(--c-border-light);
}

.feed-item:last-child {
    border-bottom: 0;
}

.feed-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--c-secondary);
    flex: 0 0 auto;
}

.feed-main {
    flex: 1 1 auto;
    font-size: 13.5px;
    color: var(--c-text-dark);
}

.feed-time {
    font-size: 12px;
    color: var(--c-text-light);
    white-space: nowrap;
}

@media (max-width: 820px) {
    .dash-row {
        grid-template-columns: 1fr;
    }
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(215px, 1fr));
    gap: 16px;
    margin-bottom: 22px;
}

a.stat {
    display: block;
    color: inherit;
}

.stat {
    background: var(--c-bg-card);
    border: 1px solid var(--c-border-light);
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
    padding: 18px 20px;
    position: relative;
    overflow: hidden;
    transition: transform .15s, box-shadow .15s;
}

a.stat:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
    color: inherit;
}

.stat::before {
    content: '';
    position: absolute;
    inset-inline-start: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--stat-c, var(--c-primary));
}

.stat .ico {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--stat-soft, var(--c-primary-soft));
    color: var(--stat-c, var(--c-primary));
    margin-bottom: 10px;
}

.stat .ico svg {
    width: 19px;
    height: 19px;
}

.stat .n {
    font-size: 28px;
    font-weight: 700;
    line-height: 1.1;
    color: var(--c-text-dark);
}

.stat .l {
    font-size: 13px;
    color: var(--c-text);
    margin-top: 2px;
}

.stat.s-draft {
    --stat-c: var(--c-primary);
    --stat-soft: var(--c-primary-soft);
}

.stat.s-pending_approval {
    --stat-c: var(--c-amber);
    --stat-soft: var(--c-amber-soft);
}

.stat.s-pending_publish {
    --stat-c: var(--c-accent);
    --stat-soft: var(--c-accent-soft);
}

.stat.s-published {
    --stat-c: var(--c-secondary);
    --stat-soft: var(--c-secondary-soft);
}

/* ============================================================
   Forms
   ============================================================ */
label {
    display: block;
    margin: 15px 0 5px;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--c-text-dark);
}

input[type=text],
input[type=email],
input[type=password],
input[type=tel],
select,
textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--c-border);
    border-radius: var(--radius-sm);
    font: inherit;
    background: #fff;
    color: var(--c-text-dark);
    transition: border-color .15s, box-shadow .15s;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--c-primary);
    box-shadow: 0 0 0 3px rgba(11, 107, 56, .15);
}

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

button,
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    margin-top: 18px;
    padding: 10px 24px;
    border: 0;
    border-radius: var(--radius-sm);
    background: var(--c-primary);
    color: #fff;
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s, box-shadow .15s, transform .1s;
    box-shadow: 0 2px 8px rgba(11, 107, 56, .3);
}

button:hover,
.btn:hover {
    background: var(--c-primary-hover);
    color: #fff;
}

button:active,
.btn:active {
    transform: translateY(1px);
}

button.ghost,
.btn.ghost {
    background: #fff;
    color: var(--c-text-dark);
    border: 1.5px solid var(--c-border);
    box-shadow: none;
}

button.ghost:hover,
.btn.ghost:hover {
    border-color: var(--c-primary);
    color: var(--c-primary);
    background: var(--c-primary-soft);
}

button.green,
.btn.green {
    background: var(--c-secondary);
    box-shadow: 0 2px 8px rgba(78, 169, 97, .3);
}

button.green:hover,
.btn.green:hover {
    background: var(--c-secondary-hover);
}

button.red,
.btn.red {
    background: var(--c-accent);
    box-shadow: 0 2px 8px rgba(219, 93, 83, .3);
}

button.red:hover,
.btn.red:hover {
    background: var(--c-accent-hover);
}

button.yellow,
.btn.yellow {
    background: #f4b400;
    color: #3a2f00;
    box-shadow: 0 2px 8px rgba(244, 180, 0, .3);
}

button.yellow:hover,
.btn.yellow:hover {
    background: #d99e00;
}

button.sm,
.btn.sm {
    padding: 6px 14px;
    font-size: 13px;
    margin-top: 0;
}

.error {
    background: var(--c-accent-soft);
    color: var(--c-accent-hover);
    border: 1px solid #f5c6c0;
    padding: 11px 15px;
    border-radius: var(--radius-sm);
    margin: 12px 0;
    font-size: 14px;
}

.notice {
    background: var(--c-secondary-soft);
    color: var(--c-secondary-hover);
    border: 1px solid #c8e6cf;
    padding: 11px 15px;
    border-radius: var(--radius-sm);
    margin: 12px 0;
    font-size: 14px;
}

/* ============================================================
   Tables
   ============================================================ */
.tablewrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

th,
td {
    padding: 11px 13px;
    border-bottom: 1px solid var(--c-border-light);
    text-align: start;
    vertical-align: middle;
}

th {
    color: var(--c-text);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .4px;
    background: #fafafd;
    border-bottom: 1.5px solid var(--c-border-light);
    white-space: nowrap;
}

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

tr:hover td {
    background: #f8f8fc;
}

td a {
    font-weight: 600;
}

/* ============================================================
   Pills
   ============================================================ */
.pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 12px;
    border-radius: 99px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.pill::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.pill.draft {
    background: var(--c-primary-soft);
    color: var(--c-primary);
}

.pill.pending_approval {
    background: var(--c-amber-soft);
    color: var(--c-amber);
}

.pill.pending_publish {
    background: var(--c-accent-soft);
    color: var(--c-accent-hover);
}

.pill.published,
.pill.on {
    background: var(--c-secondary-soft);
    color: var(--c-secondary-hover);
}

.pill.off {
    background: var(--c-accent-soft);
    color: var(--c-accent-hover);
}

.pill.cat {
    background: #eef0f4;
    color: #50506a;
}

/* Two-column form row (language + category) */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-row label {
    margin-top: 0;
}

@media (max-width: 560px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

/* ============================================================
   Misc layout helpers
   ============================================================ */
.facts {
    list-style: none;
    padding: 14px 18px;
    margin: 16px 0;
    background: #fafafd;
    border: 1px solid var(--c-border-light);
    border-radius: var(--radius-sm);
}

.facts li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 7px 0;
    border-bottom: 1px solid var(--c-border-light);
    font-size: 13.5px;
}

.facts li:last-child {
    border-bottom: 0;
}

.facts li span {
    color: var(--c-text);
}

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

.row.qa {
    gap: 6px;
}

.row.qa form {
    margin: 0;
}

.row.qa .btn.sm,
.row.qa button.sm {
    padding: 4px 11px;
    font-size: 12px;
    white-space: nowrap;
}

.spread {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

/* Header action buttons (e.g. sync categories + new article): keep them the
   same size and perfectly aligned, regardless of filled vs ghost style. */
.head-actions form {
    margin: 0;
    display: inline-flex;
}

.head-actions .btn,
.head-actions button {
    margin-top: 0;
}

/* Match the filled button's box height to the ghost button's 1.5px border so
   both header buttons are exactly the same height (truly symmetric). */
.head-actions .btn:not(.ghost) {
    border: 1.5px solid transparent;
}

.qr {
    display: block;
    margin: 16px auto;
    width: 260px;
    height: 260px;
    border-radius: var(--radius-sm);
}

.prewrap {
    white-space: pre-wrap;
    word-break: break-word;
}

code {
    background: #f0eff7;
    padding: 1px 7px;
    border-radius: 5px;
    font-size: 13px;
}

/* ============================================================
   Word-style editor (TinyMCE, self-hosted)
   ============================================================ */
.tox-tinymce {
    border: 1.5px solid var(--c-border) !important;
    border-radius: var(--radius-sm) !important;
    box-shadow: var(--shadow-soft);
    margin-top: 4px;
}

.tox .tox-toolbar,
.tox .tox-toolbar__primary,
.tox .tox-menubar {
    background: #fbfbfe !important;
}

.tox .tox-edit-area {
    background: #fff;
}

/* Read-only article view — same "document page" look */
.article-body {
    background: #fff;
    border: 1px solid var(--c-border-light);
    border-radius: 3px;
    box-shadow: 0 2px 6px rgba(24, 22, 43, .08), 0 14px 36px rgba(24, 22, 43, .08);
    max-width: 820px;
    margin: 18px auto;
    padding: 56px 64px;
    line-height: 2;
    font-size: 16.5px;
}

.article-body img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
}

.article-body blockquote {
    border-inline-start: 4px solid var(--c-primary);
    margin-inline-start: 0;
    padding: 6px 16px;
    color: var(--c-text);
    background: #f8f7fd;
}

/* ============================================================
   Hierarchy tree (dashboard)
   ============================================================ */
.tree-root {
    margin-top: 8px;
}

.tree-super {
    margin-bottom: 14px;
}

.tree-admins {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px;
}

.tree-admin {
    border: 1px solid var(--c-border-light);
    border-inline-start: 4px solid var(--c-primary);
    border-radius: 11px;
    padding: 13px 15px;
    background: #fbfbfd;
}

.tree-writers {
    margin-top: 8px;
    padding-inline-start: 16px;
    border-inline-start: 2px dashed var(--c-border);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.tree-person {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 14px;
}

.tree-person.inactive a {
    color: var(--c-text-light);
    text-decoration: line-through;
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 880px) {
    .app {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
        position: static;
        flex-direction: row;
        align-items: center;
        flex-wrap: wrap;
        padding: 4px 8px;
    }

    .sidebar .brand {
        border-bottom: 0;
        padding: 10px 12px;
        font-size: 14px;
    }

    .sidebar .brand .logo {
        width: 30px;
        height: 30px;
        font-size: 14px;
    }

    .sidebar nav {
        flex-direction: row;
        flex-wrap: wrap;
        padding: 6px 8px;
        overflow: visible;
    }

    .sidebar nav a {
        padding: 7px 11px;
        font-size: 13px;
    }

    .sidebar nav a svg {
        display: none;
    }

    .sidebar .side-foot {
        border-top: 0;
        padding: 8px 12px;
        display: flex;
        align-items: center;
        gap: 10px;
    }

    .sidebar .userchip {
        margin-bottom: 0;
    }

    .sidebar .userchip .urole {
        display: none;
    }

    .wrap {
        padding: 18px 14px 40px;
    }

    .card {
        padding: 18px;
    }

    .article-body {
        padding: 26px 20px;
    }

    .hero {
        padding: 22px 20px;
    }
}

/* ============================================================
   Featured image picker + thumbnails
   ============================================================ */
.featimg {
    margin: 15px 0 5px;
}

.featimg .field-label {
    display: block;
    margin-bottom: 6px;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--c-text-dark);
}

.featimg-preview {
    margin-bottom: 10px;
}

.featimg-preview[hidden] {
    display: none;
}

.featimg-preview img {
    max-width: 320px;
    max-height: 200px;
    width: auto;
    height: auto;
    border: 1px solid var(--c-border-light);
    border-radius: var(--radius-sm);
    object-fit: cover;
}

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

.featimg-pick {
    margin: 0;
    cursor: pointer;
}

.featimg-actions .featimg-remove[hidden] {
    display: none;
}

.featimg-status {
    color: var(--c-text);
}

.featimg-generate {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.featimg-generate svg {
    flex: 0 0 auto;
}

.artimgs {
    margin-top: 20px;
}

.artimgs-logo {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    font-weight: 500;
    cursor: pointer;
}

.featimg-actions .btn[disabled] {
    opacity: .5;
    cursor: not-allowed;
    pointer-events: none;
}

/* Media-library picker modal */
.media-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(24, 22, 43, .55);
}

.media-modal[hidden] {
    display: none;
}

.media-dialog {
    background: var(--c-surface, #fff);
    border-radius: var(--radius, 14px);
    width: min(880px, 100%);
    max-height: min(82vh, 760px);
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 18px;
    box-shadow: 0 24px 70px rgba(24, 22, 43, .35);
}

.media-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.media-search {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--c-border, #d8d6e6);
    border-radius: var(--radius-sm, 8px);
    font: inherit;
}

.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
    overflow-y: auto;
    padding: 2px;
    min-height: 120px;
}

.media-item {
    padding: 0;
    border: 2px solid transparent;
    border-radius: var(--radius-sm, 8px);
    background: var(--c-border-light, #f1f0f7);
    cursor: pointer;
    overflow: hidden;
    aspect-ratio: 4 / 3;
}

.media-item:hover,
.media-item:focus-visible {
    border-color: var(--c-primary);
    outline: none;
}

.media-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.media-foot {
    display: flex;
    justify-content: center;
}

/* AI article generator: prominent button + prompt modal */
.ai-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.ai-btn svg {
    display: block;
}

.ai-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(24, 22, 43, .55);
}

.ai-modal[hidden] {
    display: none;
}

.ai-dialog {
    background: var(--c-surface, #fff);
    border-radius: var(--radius, 14px);
    width: min(620px, 100%);
    max-height: min(88vh, 720px);
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 20px;
    box-shadow: 0 24px 70px rgba(24, 22, 43, .35);
}

.ai-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.ai-head h2 {
    margin: 0;
    font-size: 18px;
}

.ai-field {
    display: block;
    font-weight: 600;
    font-size: 13px;
}

.ai-field textarea,
.ai-field select {
    width: 100%;
    margin-top: 6px;
    font: inherit;
    font-weight: 400;
}

.ai-field textarea {
    min-height: 130px;
    resize: vertical;
    padding: 10px 12px;
    border: 1px solid var(--c-border, #d8d6e6);
    border-radius: var(--radius-sm, 8px);
    line-height: 1.7;
}

.ai-error {
    margin: 0;
}

.ai-foot {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 2px;
}

.ai-modal.busy .ai-dialog {
    cursor: progress;
}

.ai-modal.busy #ai-submit {
    opacity: .75;
}


.cell-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.cell-title .thumb {
    width: 56px;
    height: 40px;
    flex: 0 0 auto;
    object-fit: cover;
    border-radius: var(--radius-sm);
    border: 1px solid var(--c-border-light);
}

/* Article view featured image */
.article-featured {
    display: block;
    max-width: 820px;
    width: 100%;
    height: auto;
    margin: 0 auto 18px;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(24, 22, 43, .08), 0 14px 36px rgba(24, 22, 43, .08);
}