﻿:root {
  --bg: #f3f5f8;
  --surface: #ffffff;
  --surface-soft: #eef1f6;
  --text: #111923;
  --muted: #566173;
  --border: #d4dbe6;
  --accent: #0f7a4f;
  --accent-text: var(--accent);
  --accent-strong: #0c6240;
  --accent-soft: #eaf6ef;
  --success: #0f7a4f;
  --danger: #0f7a4f;
  --beta-bg: var(--accent);
  --beta-text: #ffffff;
  --breaking-bg: var(--beta-bg);
  --breaking-text: var(--beta-text);
  --breaking-clock-bg: #0b5a3a;
  --shadow: 0 12px 28px rgba(16, 29, 45, 0.12);
  --radius: 12px;
  --container: min(1180px, 94vw);
  --header-sticky-offset: 112px;
}

[data-theme="dark"] {
  --bg: #0f141d;
  --surface: #151d29;
  --surface-soft: #1c2636;
  --text: #ecf1f8;
  --muted: #b5c0d0;
  --border: #2d3a50;
  --accent: #004200;
  --accent-text: #42d48c;
  --accent-strong: #0b5a0b;
  --accent-soft: #1f3629;
  --success: var(--accent-text);
  --danger: var(--accent-text);
  --beta-bg: var(--accent);
  --beta-text: #ffffff;
  --breaking-bg: var(--beta-bg);
  --breaking-text: var(--beta-text);
  --breaking-clock-bg: #003300;
  --shadow: 0 14px 30px rgba(2, 6, 13, 0.5);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: "Almarai", Helvetica, Arial, sans-serif;
  line-height: 1.55;
  direction: rtl;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  display: block;
}

.container {
  width: var(--container);
  margin: 0 auto;
  max-width: 100%;
}

.breaking-bar {
  background: var(--beta-bg, var(--accent));
  color: var(--beta-text, #ffffff);
  border-bottom: 1px solid color-mix(in srgb, var(--beta-text, #ffffff), transparent 86%);
  position: sticky;
  top: 0;
  z-index: 130;
}

.breaking-bar-shell {
  direction: ltr;
  width: 100%;
  max-width: 100%;
  margin: 0;
  position: relative;
  height: 36px;
  display: flex;
  align-items: center;
  overflow: hidden;
  --breaking-clock-width: 90px;
}

.breaking-bar-clock {
  position: absolute;
  top: 0;
  right: 0;
  width: var(--breaking-clock-width);
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.2px;
  direction: ltr;
  unicode-bidi: isolate;
  background: var(--breaking-clock-bg, var(--beta-bg, var(--accent)));
  color: var(--beta-text, #fff);
  box-shadow: -2px 0 10px rgba(0, 0, 0, 0.3);
}

.breaking-bar-clock::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 1px;
  height: 100%;
  background: #d93232;
  transform: scaleX(1.1);
  transform-origin: left center;
  pointer-events: none;
}

.breaking-bar-mask {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  margin-right: var(--breaking-clock-width);
  flex: 1 1 auto;
}

.breaking-bar-track {
  position: absolute;
  top: 50%;
  left: 0;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  opacity: 1;
  transform: translate3d(0, -50%, 0);
  will-change: transform;
}

.breaking-segment {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  flex: 0 0 auto;
}

.breaking-bar-item {
  display: inline-flex;
  align-items: center;
  line-height: 36px;
  font-size: 15px;
  font-weight: 500;
  direction: rtl;
  unicode-bidi: plaintext;
  white-space: nowrap;
  padding: 0 10px;
}

.breaking-bar-divider {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  min-width: 24px;
  height: 36px;
}

.breaking-bar-divider img {
  width: 20px;
  height: 20px;
  display: block;
  object-fit: contain;
}

.breaking-newsline.is-paused .breaking-bar-track {
  pointer-events: none;
}

@media (max-width: 700px) {
  .breaking-bar-shell {
    --breaking-clock-width: 82px;
  }

  .breaking-bar-clock,
  .breaking-bar-item {
    font-size: 15px;
  }
}

.breaking-bar-dismiss {
  display: none;
}

.breaking-bar-close {
  display: none;
}

.breaking-bar-close-icon {
  display: none;
}

.breaking-bar-tag,
.breaking-bar-text {
  display: none;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 90;
  background: color-mix(in srgb, var(--surface), transparent 12%);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.header-top {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  row-gap: 10px;
}

.brand {
  display: inline-flex;
  align-items: center;
  flex-direction: row;
  gap: 12px;
  flex: 0 1 auto;
  min-width: 0;
  white-space: nowrap;
}

.brand-logo {
  order: 1;
  width: clamp(110px, 14vw, 180px);
  height: auto;
  object-fit: contain;
  flex-shrink: 0;
}

.brand-tag {
  order: 2;
  color: var(--muted);
  font-size: 0.92rem;
  letter-spacing: 0.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: nowrap;
  flex: 0 0 auto;
  gap: 10px;
}

.admin-tools-menu {
  position: relative;
  z-index: 125;
}

.admin-tools-toggle {
  min-height: 42px;
}

.admin-tools-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  left: auto;
  min-width: 220px;
  max-width: min(320px, calc(100vw - 12px));
  display: none;
  flex-direction: column;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 8px;
}

.admin-tools-dropdown.open {
  display: flex;
}

.admin-tools-dropdown .btn {
  width: 100%;
  justify-content: center;
}

.btn,
button,
input[type="submit"] {
  font: inherit;
}

.btn {
  border: 1px solid var(--border);
  color: var(--text);
  background: var(--surface);
  border-radius: 10px;
  padding: 8px 13px;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn:hover {
  background: var(--surface-soft);
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}

.btn-danger {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn-danger:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}

.btn-link {
  border: 1px solid transparent;
  padding: 6px 9px;
}

.btn-link:hover {
  background: var(--surface-soft);
  border-color: var(--border);
}

.theme-toggle {
  width: auto;
  min-width: 58px;
  height: 42px;
  padding: 0 10px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.theme-toggle:disabled {
  opacity: 0.75;
  cursor: not-allowed;
}

.top-nav {
  border-top: 1px solid var(--border);
}

.top-nav-shell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 0;
  min-width: 0;
}

.top-nav-scroll {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  min-width: 0;
  flex: 1 1 auto;
  scrollbar-width: thin;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
}

.top-nav a {
  flex: 0 0 auto;
  white-space: nowrap;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid transparent;
}

.top-nav a:hover,
.top-nav a.active {
  color: var(--text);
  background: var(--surface-soft);
  border-color: var(--border);
}

.top-nav .community-nav-link {
  flex: 0 0 auto;
  background: color-mix(in srgb, var(--accent), var(--surface) 82%);
  border-color: color-mix(in srgb, var(--accent), var(--border) 35%);
  color: var(--accent-text);
  font-weight: 800;
}

.top-nav .community-nav-link:hover,
.top-nav .community-nav-link.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border);
}

.account-menu {
  position: relative;
  z-index: 120;
}

.account-toggle {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 9px 4px 5px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.account-toggle span {
  color: inherit;
  font-weight: 600;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-dropdown {
  position: absolute;
  left: 0;
  right: auto;
  top: calc(100% + 8px);
  width: 220px;
  max-width: min(300px, calc(100vw - 12px));
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 8px;
  display: none;
}

.account-dropdown.open {
  display: block;
}

.account-dropdown a,
.account-dropdown form button {
  display: block;
  width: 100%;
  text-align: start;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  border-radius: 8px;
  padding: 9px 10px;
  cursor: pointer;
}

.account-dropdown a:hover,
.account-dropdown form button:hover {
  background: var(--surface-soft);
  border-color: var(--border);
}

.flash {
  margin: 14px auto 0;
  width: var(--container);
  border-radius: 10px;
  padding: 12px 14px;
  font-weight: 600;
  border: 1px solid var(--border);
}

.flash-success {
  color: var(--success);
  border-color: color-mix(in srgb, var(--success), var(--border) 45%);
  background: color-mix(in srgb, var(--success), var(--surface) 92%);
}

.flash-error {
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger), var(--border) 45%);
  background: color-mix(in srgb, var(--danger), var(--surface) 92%);
}

.main-layout {
  width: var(--container);
  margin: 18px auto 36px;
}

.hero-news {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.featured-card {
  overflow: hidden;
  position: relative;
  --featured-image-height: 350px;
}

.featured-card img {
  height: var(--featured-image-height);
  width: 100%;
  object-fit: cover;
}

.featured-slider-viewport {
  overflow: hidden;
  width: 100%;
  max-width: 100%;
  direction: ltr;
  position: relative;
  isolation: isolate;
  contain: paint;
}

.featured-slider-track {
  display: flex;
  width: 100%;
  transform: translate3d(0, 0, 0);
  transition: transform 650ms cubic-bezier(0.445, 0.05, 0.55, 0.95);
  will-change: transform;
  direction: ltr;
}

.featured-slider-track.no-transition {
  transition: none !important;
}

.featured-slide {
  flex: 0 0 100%;
  max-width: 100%;
  min-width: 100%;
  direction: rtl;
  text-align: right;
  overflow: hidden;
}

.featured-slider-arrow {
  position: absolute;
  top: var(--featured-image-height);
  transform: translateY(-50%);
  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--border), var(--surface) 20%);
  background: color-mix(in srgb, var(--surface), transparent 8%);
  color: var(--text);
  font-size: 0;
  line-height: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 6;
}

.featured-slider-arrow-icon {
  width: 10px;
  height: 10px;
  display: block;
  border-top: 2px solid currentColor;
  border-right: 2px solid currentColor;
}

.featured-slider-arrow:hover {
  background: color-mix(in srgb, var(--surface-soft), transparent 0%);
}

.featured-slider-arrow:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent), transparent 50%);
  outline-offset: 2px;
}

.featured-slider-arrow-next {
  right: 10px;
}

.featured-slider-arrow-next .featured-slider-arrow-icon {
  transform: rotate(45deg);
}

.featured-slider-arrow-prev {
  left: 10px;
}

.featured-slider-arrow-prev .featured-slider-arrow-icon {
  transform: rotate(-135deg);
}

.featured-slider.is-single .featured-slider-arrow {
  display: none;
}

.featured-content {
  padding: 18px 18px 20px;
}

.category-badge {
  display: inline-block;
  color: var(--accent-text);
  font-weight: 700;
  font-size: 0.85rem;
  margin-bottom: 8px;
}

h1,
h2,
h3 {
  line-height: 1.2;
  margin: 0 0 8px;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.meta {
  color: var(--muted);
  font-size: 0.91rem;
}

.summary {
  color: var(--muted);
  margin: 8px 0 0;
}

.side-headlines {
  display: grid;
  gap: 12px;
}

.headline-row {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 10px;
  padding: 10px;
}

.headline-row img {
  width: 100%;
  height: 78px;
  object-fit: cover;
  border-radius: 8px;
}

.section-title {
  margin: 30px 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.news-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.news-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.news-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 24px rgba(16, 29, 45, 0.16);
}

.news-card img {
  width: 100%;
  height: 165px;
  object-fit: cover;
}

.news-card-body {
  padding: 12px;
}

.news-card h3 {
  margin-bottom: 7px;
  font-size: 1.08rem;
}

.admin-inline-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.admin-inline-actions form {
  margin: 0;
}

.article-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 18px;
}

.article-main {
  padding: 20px;
}

.detail-head {
  margin-bottom: 8px;
}

.detail-head-content {
  min-width: 0;
  width: 100%;
}

.detail-head-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  margin-bottom: 8px;
  width: fit-content;
}

.detail-head-row .meta {
  margin: 0;
}

.detail-head-content h1 {
  margin-top: 0;
}

.share-wrap {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  overflow: visible;
}

.share-btn {
  border: 1px solid transparent;
  border-radius: 999px;
  width: 36px;
  height: 36px;
  padding: 0;
  margin: 0;
  background: transparent;
  color: var(--accent-text);
  display: inline-grid;
  place-items: center;
  overflow: visible;
  cursor: pointer;
  transition: border-color 0.18s ease, background-color 0.18s ease, color 0.18s ease, transform 0.08s ease, opacity 0.18s ease;
  flex: 0 0 auto;
}

.share-btn:hover {
  border-color: color-mix(in srgb, var(--accent), transparent 60%);
  background: color-mix(in srgb, var(--accent), transparent 88%);
}

.share-btn:active {
  transform: translateY(1px);
}

.share-btn svg {
  width: 18px;
  height: 18px;
  display: block;
  margin: 0;
}

.share-btn-text {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.share-feedback {
  position: absolute;
  right: calc(100% + 10px);
  left: auto;
  top: 50%;
  transform: translateY(-50%);
  min-width: 160px;
  max-width: 220px;
  text-align: right;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--accent-text);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s ease, visibility 0.35s ease;
  pointer-events: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  z-index: 3;
}

.share-wrap.show-feedback .share-feedback {
  opacity: 1;
  visibility: visible;
}

.share-btn.is-busy {
  opacity: 0.72;
  pointer-events: none;
}

.article-main .main-image {
  width: 100%;
  height: min(430px, 50vw);
  object-fit: cover;
  border-radius: 10px;
  margin: 14px 0;
}

.article-content {
  font-size: 1.03rem;
  overflow-wrap: anywhere;
}

.article-content p {
  margin: 0 0 14px;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.article-content figure {
  margin: 14px auto;
  max-width: min(760px, 100%);
}

.article-content figure[data-align="left"] {
  float: left;
  margin: 6px 18px 8px 0;
}

.article-content figure[data-align="right"] {
  float: right;
  margin: 6px 0 8px 18px;
}

.article-content figure[data-align="center"] {
  float: none;
  margin: 16px auto;
  text-align: center;
}

.article-content img {
  width: 100%;
  max-width: 100%;
  height: auto;
  border-radius: 10px;
  box-shadow: 0 10px 24px rgba(16, 29, 45, 0.18);
}

.article-content::after {
  content: "";
  display: block;
  clear: both;
}

.article-side {
  padding: 16px;
  position: sticky;
  top: var(--header-sticky-offset);
  height: fit-content;
}

.article-side h3 {
  margin-bottom: 10px;
  font-size: 1.08rem;
}

.article-side-news {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.article-side-news .recent-list li {
  gap: 6px;
}

.article-side-news .recent-list a {
  line-height: 1.4;
  font-size: 0.95rem;
}

.form-layout {
  width: min(760px, 94vw);
  margin: 24px auto 40px;
  padding: 24px;
  box-shadow: var(--shadow);
}

label {
  display: block;
  font-weight: 700;
  margin: 12px 0 6px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
textarea,
select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 11px;
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--accent), var(--border) 35%);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent), transparent 80%);
}

textarea {
  min-height: 120px;
  resize: vertical;
}

.helper {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.55;
}

.auth-switch {
  margin-top: 12px;
  color: var(--muted);
}

.auth-switch a {
  color: var(--accent-text);
  font-weight: 700;
}

.admin-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
}

.admin-grid > .card {
  min-width: 0;
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  border-bottom: 1px solid var(--border);
  padding: 10px 8px;
  text-align: start;
  vertical-align: middle;
}

.table th {
  color: var(--muted);
  font-size: 0.85rem;
  letter-spacing: 0.2px;
}

.table-scroll {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table-users {
  min-width: 760px;
}

.table-users th,
.table-users td {
  white-space: nowrap;
}

.user-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 180px;
}

.pill {
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 0.82rem;
  font-weight: 700;
}

.pill-admin {
  color: #fff;
  background: var(--accent);
}

.pill-user {
  color: var(--muted);
  background: var(--surface-soft);
}

.editor-wrap {
  padding: 14px;
}

.editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 10px;
}

.editor-toolbar button,
.editor-toolbar select,
.editor-toolbar input[type="range"] {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 8px;
  background: var(--surface);
  color: var(--text);
}

.editor-toolbar input[type="range"] {
  padding: 0;
}

.editor {
  min-height: 320px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  background: color-mix(in srgb, var(--surface), var(--surface-soft) 22%);
  position: relative;
  direction: rtl;
  text-align: right;
}

.editor.is-empty::before {
  content: attr(data-placeholder);
  position: absolute;
  top: 12px;
  right: 12px;
  left: 12px;
  color: color-mix(in srgb, var(--muted), transparent 34%);
  line-height: 1.55;
  text-align: right;
  direction: rtl;
  white-space: pre-wrap;
  pointer-events: none;
}

.editor:focus {
  outline: 2px solid color-mix(in srgb, var(--accent), transparent 65%);
}

.editor figure {
  margin: 12px auto;
}

.editor figure[data-align="left"] {
  float: left;
  margin: 6px 16px 8px 0;
}

.editor figure[data-align="right"] {
  float: right;
  margin: 6px 0 8px 16px;
}

.editor figure[data-align="center"] {
  margin: 14px auto;
  text-align: center;
}

.editor img {
  max-width: 100%;
  border-radius: 8px;
  cursor: pointer;
}

.editor img.selected-image {
  outline: 3px solid color-mix(in srgb, var(--accent), transparent 45%);
}

.editor::after {
  content: "";
  display: block;
  clear: both;
}

.editor-guide {
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.9rem;
}

.danger-zone {
  margin-top: 26px;
  border-top: 1px solid color-mix(in srgb, var(--accent), var(--border) 55%);
  padding-top: 18px;
}

/* Account settings (no structure changes; purely presentational polish) */
.form-layout h1 {
  margin: 0 0 8px;
  font-size: clamp(1.55rem, 2.2vw, 2.05rem);
  letter-spacing: 0.2px;
}

.form-layout > .meta {
  margin: 0 0 18px;
  max-width: 60ch;
}

.form-layout h2 {
  margin-top: 8px;
  font-size: 1.25rem;
}

.form-layout form {
  display: grid;
  gap: 4px;
}

.ai-drafts-layout {
  width: min(1080px, 96vw);
  margin-top: 16px;
}

.ai-settings-grid,
.ai-source-add-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
  margin-top: 10px;
}

.ai-settings-grid .btn,
.ai-source-add-grid .btn {
  width: fit-content;
  min-width: 180px;
}

.ai-inline-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.ai-inline-check input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
}

.ai-table td,
.ai-table th {
  vertical-align: top;
}

.ai-inline-edit {
  display: grid;
  grid-template-columns: repeat(6, minmax(110px, 1fr));
  gap: 6px;
  align-items: center;
}

.ai-inline-edit input {
  min-width: 90px;
  padding: 6px 8px;
}

.ai-live-status {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  background: color-mix(in srgb, var(--surface-soft), transparent 10%);
}

.ai-url-cell {
  max-width: 420px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-json {
  margin: 8px 0 0;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-soft);
  color: var(--text);
  overflow: auto;
  max-height: 280px;
  max-width: 100%;
  direction: ltr;
  text-align: left;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.article-side .ai-url-cell {
  max-width: 100%;
  white-space: normal;
  text-overflow: clip;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.breaking-bar ~ .site-header {
  top: 36px;
}

.breaking-slot-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0 10px;
}

.breaking-slot-btn {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  padding: 10px 11px;
  text-align: start;
  display: grid;
  gap: 4px;
  cursor: pointer;
  transition: border-color 0.16s ease, background-color 0.16s ease, transform 0.16s ease;
}

.breaking-slot-btn:hover {
  background: var(--surface-soft);
  border-color: color-mix(in srgb, var(--accent), var(--border) 35%);
}

.breaking-slot-btn.is-active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent), var(--surface) 88%);
}

.breaking-slot-title {
  font-weight: 800;
  font-size: 0.95rem;
}

.breaking-slot-preview {
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.45;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.breaking-slot-empty {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

.form-layout label {
  margin: 14px 0 6px;
}

.form-layout label[style*="align-items:center"] {
  margin-top: 16px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface), var(--surface-soft) 24%);
}

.form-layout label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent-text);
  flex: 0 0 auto;
}

.form-layout button.btn-primary,
.form-layout button.btn-danger {
  min-height: 44px;
  padding-inline: 18px;
  border-radius: 12px;
}

.danger-zone .meta {
  max-width: 60ch;
}

.danger-zone input#confirmation {
  background: color-mix(in srgb, var(--surface), var(--accent-soft) 18%);
}

@media (max-width: 700px) {
  .form-layout {
    padding: 16px;
    margin: 16px auto 28px;
  }

  .ai-drafts-layout {
    width: min(1080px, 98vw);
  }

  .breaking-slot-grid {
    grid-template-columns: 1fr;
  }

  .form-layout > .meta {
    margin-bottom: 14px;
  }

  .form-layout label[style*="align-items:center"] {
    padding: 10px;
  }

  .ai-settings-grid,
  .ai-source-add-grid,
  .ai-inline-edit {
    grid-template-columns: 1fr;
  }
}

.site-footer {
  margin-top: auto;
  background: color-mix(in srgb, var(--surface), transparent 6%);
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.91rem;
  padding: 10px 0;
}

.site-footer .footer-inner {
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  min-width: 0;
}

.footer-icon {
  width: 28px;
  height: 28px;
  padding: 3px;
  box-sizing: border-box;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-soft);
}

.footer-brand-text {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
}

.footer-name {
  color: var(--text);
  font-weight: 800;
  font-size: 0.95rem;
  line-height: 1.05;
}

.footer-tag {
  color: var(--muted);
  font-weight: 800;
  font-size: 0.86rem;
  line-height: 1.1;
  text-align: center;
}

.footer-links {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
}

.footer-links a {
  color: var(--muted);
  font-weight: 800;
  font-size: 0.82rem;
  padding: 6px 8px;
  border-radius: 999px;
}

.footer-links a:hover {
  color: var(--accent-text);
  background: color-mix(in srgb, var(--accent), transparent 88%);
}

.footer-copy {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
}

@media (max-width: 700px) {
  .site-footer .footer-inner {
    justify-content: center;
  }

  .footer-copy {
    width: 100%;
    text-align: center;
  }
}

.info-page {
  padding: 22px 22px 18px;
}

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

.info-hero-main {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
}

.info-icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface-soft);
}

.info-page h1 {
  margin: 0;
}

.info-page .meta {
  margin: 6px 0 0;
  max-width: 76ch;
}

.info-page .article-content {
  margin-top: 10px;
}

.info-page .article-content h2 {
  margin-top: 20px;
}

.info-page .article-content ul {
  padding-inline-start: 18px;
}

@media (max-width: 700px) {
  .info-page {
    padding: 18px 16px 14px;
  }
}

.community-layout .section-title {
  align-items: flex-start;
}

.community-feed-page .section-title {
  align-items: center;
}

.community-feed {
  display: grid;
  gap: 14px;
}

.community-loadmore {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.community-loadmore .btn {
  min-width: 180px;
}


.community-card {
  padding: 14px;
}

.community-feed-page .community-card {
  padding: 14px;
  border-radius: 4px;
  box-shadow: none;
}

.community-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.community-card-head h2,
.community-card-head h1 {
  margin-bottom: 6px;
}

.community-card-main {
  flex: 1 1 auto;
  min-width: 0;
}

.community-card-main h2 {
  margin: 0;
  font-size: clamp(1rem, 1.45vw, 1.45rem);
  line-height: 1.4;
}

.community-card-main h2 a {
  color: var(--text);
}

.community-kicker {
  margin: 0 0 8px;
  color: var(--accent-text);
  font-size: clamp(0.92rem, 1.2vw, 1.22rem);
  font-weight: 800;
  line-height: 1;
}

.community-thumb {
  order: -1;
  flex: 0 0 auto;
  width: clamp(82px, 9vw, 128px);
  max-width: 26%;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--accent), var(--border) 55%);
  background: var(--surface-soft);
}

.community-thumb img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.community-preview {
  margin: 12px 0 0;
  color: var(--text);
  line-height: 1.7;
  white-space: pre-wrap;
}

.community-feed-page .community-preview {
  color: var(--muted);
  line-height: 1.65;
}

.clamp-4 {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
}

.community-readmore {
  margin: 6px 0 0;
}

.community-readmore a {
  color: var(--accent-text);
  font-weight: 700;
}

.community-card-actions {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
}

.community-actions-right {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.community-actions-left {
  display: flex;
  justify-content: flex-end;
}

.community-date {
  margin: 0;
  font-size: clamp(1rem, 1.3vw, 1.26rem);
  font-weight: 800;
  color: color-mix(in srgb, var(--text), var(--muted) 48%);
  line-height: 1;
  letter-spacing: 0.3px;
}

.community-card-featured {
  border-radius: 14px;
  padding: 14px;
}

.community-feed-page .community-card-featured .community-preview {
  margin-top: 8px;
  font-size: 1rem;
  line-height: 1.5;
}

.community-feed-page .community-card-featured .community-readmore {
  margin-top: 8px;
}

.main-layout.community-detail-page {
  width: var(--container);
}

.community-detail-layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 22px;
  direction: ltr;
}

.community-side-panel,
.community-main-content {
  direction: rtl;
}

.community-side-panel {
  display: grid;
  gap: 14px;
  align-content: start;
}

.community-side-block {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 6px;
  padding: 12px;
}

.community-side-block h3 {
  margin-bottom: 10px;
  font-size: 1.02rem;
}

.recent-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.recent-list li {
  display: grid;
  gap: 4px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.recent-list li:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.recent-list a {
  font-weight: 700;
}

.recent-list li:nth-child(n + 5) {
  display: none;
}

.community-main-content {
  padding: 6px 0 0;
}

.community-main-content h1 {
  font-size: clamp(1.8rem, 2.8vw, 2.5rem);
}

.community-main-content .article-content {
  margin-top: 16px;
}

.detail-actions {
  margin-top: 18px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.community-rules ul {
  margin: 8px 0 10px;
  padding-inline-start: 18px;
}

.community-rules li {
  margin: 6px 0;
}

.vote-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface), var(--surface-soft) 35%);
  padding: 4px 6px;
}

.community-feed-page .vote-pill {
  background: var(--surface);
}

.vote-form {
  margin: 0;
}

.vote-btn {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
  font-size: 0.95rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.vote-btn:hover {
  border-color: var(--border);
  background: var(--surface-soft);
}

.vote-btn.active {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

.vote-score {
  min-width: 44px;
  text-align: center;
  font-weight: 800;
  color: var(--text);
}

@media (min-width: 1200px) {
  .community-feed-page {
    width: min(920px, 78vw);
  }
}

@media (min-width: 1650px) {
  .recent-list li:nth-child(5) {
    display: grid;
  }
}

@media (max-width: 1280px) {
  .recent-list li:nth-child(n + 4) {
    display: none;
  }
}

.stack-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ad-slot-wrap {
  margin: 16px 0 20px;
  padding: 12px;
  background: color-mix(in srgb, var(--surface), var(--surface-soft) 14%);
  overflow: hidden;
}

.ad-slot-label {
  color: var(--muted);
  font-size: 0.78rem;
  margin-bottom: 8px;
}

.ad-slot-wrap .ad-slot-embed {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 90px;
  max-height: 160px;
}

.ad-slot-wrap.ad-slot-footer {
  margin: 8px 0 14px;
}

.ad-slot-wrap.ad-slot-footer .ad-slot-embed {
  min-height: 72px;
  max-height: 110px;
}

[dir="rtl"] .article-content figure[data-align="left"] {
  float: right;
  margin: 6px 0 8px 18px;
}

[dir="rtl"] .article-content figure[data-align="right"] {
  float: left;
  margin: 6px 18px 8px 0;
}

[dir="rtl"] .editor figure[data-align="left"] {
  float: right;
  margin: 6px 0 8px 16px;
}

[dir="rtl"] .editor figure[data-align="right"] {
  float: left;
  margin: 6px 16px 8px 0;
}

@media (max-width: 980px) {
  .hero-news {
    grid-template-columns: 1fr;
  }

  .article-layout,
  .admin-grid,
  .community-detail-layout {
    grid-template-columns: 1fr;
    direction: rtl;
  }

  .article-side {
    position: static;
  }
}

@media (max-width: 920px) {
  .header-top {
    min-height: auto;
    padding: 8px 0 10px;
    align-items: center;
  }

  .header-actions-user {
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .brand-logo {
    width: clamp(100px, 26vw, 150px);
  }

  .brand-tag {
    font-size: 0.9rem;
    max-width: 52vw;
    white-space: nowrap;
    text-align: right;
  }

  .header-actions .btn,
  .header-actions .theme-toggle,
  .header-actions .account-toggle {
    min-height: 42px;
    padding-inline: 12px;
    font-size: 0.98rem;
  }

  .header-actions .account-menu {
    display: block;
  }

  .admin-tools-dropdown {
    right: 0;
    left: auto;
  }
}

@media (max-width: 700px) {
  .brand-logo {
    width: clamp(100px, 30vw, 140px);
  }

  .brand-tag {
    font-size: 0.86rem;
    max-width: 48vw;
    white-space: nowrap;
  }

  .account-toggle span {
    display: none;
  }

  .header-actions .btn,
  .header-actions .theme-toggle,
  .header-actions .account-toggle {
    min-height: 44px;
    justify-content: center;
    padding-inline: 12px;
    font-size: 1rem;
  }

  .header-actions .account-toggle {
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: 999px;
    justify-content: center;
  }

  .admin-tools-toggle {
    min-height: 44px;
  }

  .admin-tools-dropdown {
    width: min(260px, calc(100vw - 12px));
    max-width: calc(100vw - 12px);
    right: 0;
    left: auto;
  }

  .top-nav-shell {
    gap: 6px;
    min-width: 0;
    overflow: hidden;
  }

  .top-nav-scroll {
    width: 100%;
    min-width: 0;
    overflow-x: auto;
  }

  .top-nav .community-nav-link {
    position: relative;
    inset: auto;
    z-index: 1;
    box-shadow: none;
  }

  .article-main {
    padding: 14px;
    width: 100%;
    max-width: 100%;
    margin: 0;
  }

  .detail-head {
    gap: 10px;
  }

  .share-btn {
    width: 36px;
    height: 36px;
  }

  .share-feedback {
    display: none;
  }

  .container,
  .main-layout,
  .flash {
    width: 100%;
    max-width: 100%;
    margin-inline: auto;
    padding-inline: 8px;
  }

  .article-layout {
    display: block;
    width: 100%;
    max-width: 100%;
    padding-inline: 0;
  }

  .card {
    max-width: 100%;
  }

  .article-main .main-image {
    width: 100%;
    max-width: 100%;
    height: auto;
    max-height: 280px;
    object-fit: cover;
  }

  .article-content,
  .article-content * {
    max-width: 100%;
  }

  .article-content figure,
  .article-content img {
    width: 100% !important;
    max-width: 100% !important;
    margin-inline: 0 !important;
  }

  .article-content figure[data-align="left"],
  .article-content figure[data-align="right"] {
    float: none;
    margin: 12px auto;
  }

  .article-content img {
    box-shadow: none;
  }

  .account-dropdown {
    width: min(260px, calc(100vw - 12px));
    max-width: calc(100vw - 12px);
    left: 0;
    right: auto;
  }

  .news-grid {
    grid-template-columns: 1fr;
  }

  .headline-row {
    grid-template-columns: 86px 1fr;
  }

  .featured-slider-arrow {
    width: 34px;
    height: 34px;
    font-size: 18px;
  }

  .community-card-head {
    flex-direction: column;
    align-items: stretch;
  }

  .community-feed-page .community-card-head {
    flex-direction: row;
    align-items: flex-start;
    gap: 10px;
  }

  .community-feed-page .community-card-main {
    flex: 1 1 auto;
    min-width: 0;
  }

  .community-feed-page .community-thumb {
    flex: 0 0 auto;
    align-self: flex-start;
  }

  .community-kicker {
    font-size: 0.95rem;
  }

  .community-card-main h2 {
    font-size: clamp(1rem, 5.6vw, 1.26rem);
  }

  .community-thumb {
    width: min(118px, 34vw);
    max-width: 34vw;
  }

  .community-date {
    font-size: 1rem;
  }

  .recent-list li:nth-child(n + 3) {
    display: none;
  }
}
