/* حصري تكنولوجيا — white + copper/orange */
:root {
  --bg: #ffffff;
  --text: #3b1f0e;
  --text-2: #6a2e14;
  --muted: #8a6a58;
  --primary: #d2693c;
  --primary-dark: #6a2e14;
  --link: #a14e22;
  --accent: #e8a067;
  --cream: #fce9d8;
  --cream-2: #fff6ef;
  --line: #f3dcc8;
  --green: #1f8a4c;
  --red: #c0392b;
  --amber: #b7791f;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(59, 31, 14, 0.04), 0 6px 20px rgba(59, 31, 14, 0.06);
  --font: 'IBM Plex Sans Arabic', system-ui, -apple-system, 'Segoe UI', Tahoma, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 16px; line-height: 1.75; }
a { color: var(--link); text-decoration: none; }
a:hover { color: var(--primary); }
img { max-width: 100%; height: auto; }
h1, h2, h3, h4 { line-height: 1.4; margin: 0 0 .5em; color: var(--text); }
.container { width: min(1180px, 100% - 32px); margin-inline: auto; }
.main { padding: 28px 0 56px; min-height: 60vh; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.red { color: var(--red); }
.center { text-align: center; }
.pre { white-space: pre-wrap; }
.hp { position: absolute; left: -9999px; opacity: 0; height: 0; }
.inline { display: inline; }

/* ---------- buttons & forms ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 20px; border-radius: 10px; border: 1.5px solid transparent; font: 600 15px var(--font); cursor: pointer; transition: .15s; text-decoration: none; white-space: nowrap; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-ghost { background: #fff; color: var(--text-2); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger { background: #fff; color: var(--red); border-color: #f1c4bd; }
.btn-danger:hover { background: var(--red); color: #fff; }
.btn-sm { padding: 6px 14px; font-size: 14px; }
.btn-block { width: 100%; margin-top: 8px; }
.linklike { background: none; border: 0; color: var(--link); font: inherit; cursor: pointer; padding: 0; }
.form { display: grid; gap: 14px; }
.form label { display: grid; gap: 6px; font-weight: 600; font-size: 14px; }
.form-inline { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); align-items: end; }
.form-inline .grow { grid-column: span 2; }
input, textarea, select { width: 100%; font: 400 15px var(--font); color: var(--text); background: #fff; border: 1.5px solid var(--line); border-radius: 10px; padding: 10px 12px; outline: none; transition: border-color .15s; }
input:focus, textarea:focus, select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(210, 105, 60, .12); }
.check { display: flex !important; align-items: center; gap: 8px; font-weight: 400 !important; }
.check input { width: auto; }
.notice { padding: 12px 16px; border-radius: 10px; background: var(--cream-2); border: 1px solid var(--line); margin-bottom: 16px; }
.notice-ok { background: #ecf8f1; border-color: #bfe5cf; color: #14532d; }
.notice-err { background: #fdf0ee; border-color: #f1c4bd; color: #7f1d1d; }

/* ---------- header ---------- */
.site-header { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.header-row { display: flex; align-items: center; gap: 20px; padding: 12px 0; }
.logo { display: flex; align-items: center; gap: 10px; color: var(--text); }
.logo:hover { color: var(--text); }
.logo-text { display: grid; font-size: 18px; line-height: 1.2; font-weight: 500; }
.logo-text b { color: var(--primary); font-weight: 700; }
.logo-text small { font-size: 11px; color: var(--muted); letter-spacing: 1px; direction: ltr; text-align: right; }
.search { flex: 1; max-width: 460px; margin-inline: auto; position: relative; }
.search input { padding-inline-end: 44px; background: var(--cream-2); border-color: transparent; border-radius: 999px; }
.search button { position: absolute; inset-inline-end: 6px; top: 50%; transform: translateY(-50%); background: var(--primary); color: #fff; border: 0; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; }
.cat-nav { border-top: 1px solid var(--line); }
.cat-row { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.cat-row a { padding: 10px 14px; color: var(--text-2); font-weight: 500; font-size: 15px; white-space: nowrap; border-bottom: 2.5px solid transparent; }
.cat-row a:hover { color: var(--primary); border-bottom-color: var(--primary); }

/* ---------- hero & home ---------- */
.hero { display: grid; grid-template-columns: 1.2fr 1fr; gap: 32px; align-items: center; padding: 36px 40px; margin-bottom: 32px; border-radius: 24px; background: radial-gradient(circle at 10% 20%, #fff 0, transparent 60%), linear-gradient(135deg, var(--cream) 0%, #fbd9bd 100%); position: relative; overflow: hidden; }
.hero::after { content: ''; position: absolute; inset: 0; background-image: linear-gradient(rgba(161, 78, 34, .07) 1px, transparent 1px), linear-gradient(90deg, rgba(161, 78, 34, .07) 1px, transparent 1px); background-size: 28px 28px; mask-image: linear-gradient(to left, #000, transparent 70%); pointer-events: none; }
.hero h1 { font-size: clamp(32px, 5vw, 52px); margin: 6px 0 8px; font-weight: 700; }
.hero p { font-size: 18px; color: var(--text-2); margin: 0; }
.accent { color: var(--primary); }
.eyebrow { display: inline-block; background: #fff; color: var(--primary); font-weight: 600; font-size: 13px; padding: 4px 12px; border-radius: 999px; }
.hero-chips { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-start; position: relative; z-index: 1; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px; background: var(--cream); color: var(--text-2); font-size: 13px; font-weight: 600; }
.chip:hover { background: var(--primary); color: #fff; }
.chip-lg { background: #fff; padding: 10px 16px; font-size: 15px; box-shadow: var(--shadow); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.layout-2 { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 36px; align-items: start; }
.section-title { font-size: 22px; margin: 32px 0 18px; display: flex; align-items: center; gap: 10px; }
.section-title::before { content: ''; width: 6px; height: 22px; border-radius: 3px; background: var(--primary); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 22px; }
.grid-3 { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.pager { display: flex; justify-content: space-between; margin-top: 28px; }

/* ---------- cards ---------- */
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; transition: .2s; }
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--accent); }
.card-cover { position: relative; display: block; aspect-ratio: 1200 / 630; background: var(--cream); overflow: hidden; }
.card-cover > img { width: 100%; height: 100%; object-fit: cover; }
.cover-fallback { width: 100%; height: 100%; display: grid; place-items: center; background: linear-gradient(135deg, var(--cream), #f8cfae); }
.chip-on-img { position: absolute; top: 10px; inset-inline-start: 10px; background: rgba(255, 255, 255, .95); }
.card-body { padding: 16px 18px 18px; display: flex; flex-direction: column; flex: 1; }
.card-body h3 { font-size: 18px; margin-bottom: 6px; }
.card-body h3 a { color: var(--text); }
.card-body h3 a:hover { color: var(--primary); }
.card-body p { margin: 0 0 12px; color: var(--muted); font-size: 14.5px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; margin-top: auto; }
.meta-author { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); font-weight: 600; }
.card-big { display: grid; grid-template-columns: 1.25fr 1fr; }
.card-big .card-cover { aspect-ratio: auto; min-height: 300px; }
.card-big .card-body { padding: 28px; justify-content: center; }
.card-big h3 { font-size: 26px; }
.card-big p { -webkit-line-clamp: 3; font-size: 16px; }
.avatar { border-radius: 50%; object-fit: cover; flex-shrink: 0; background: var(--cream); }
.avatar-letter { display: inline-grid; place-items: center; background: var(--primary); color: #fff; font-weight: 700; }
.empty { text-align: center; padding: 56px 20px; border: 2px dashed var(--line); border-radius: var(--radius); color: var(--muted); }

/* ---------- sidebar ---------- */
.sidebar { display: grid; gap: 22px; position: sticky; top: 130px; }
.box { border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; background: #fff; }
.box-title { font-size: 17px; margin-bottom: 12px; }
.popular { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.popular li { display: flex; gap: 12px; align-items: flex-start; }
.popular a { color: var(--text); font-weight: 500; font-size: 15px; line-height: 1.5; }
.popular a:hover { color: var(--primary); }
.rank { flex-shrink: 0; width: 28px; height: 28px; border-radius: 8px; background: var(--cream); color: var(--primary); display: grid; place-items: center; font-weight: 700; font-size: 14px; }
.box-follow { background: linear-gradient(135deg, var(--cream-2), var(--cream)); }
.box-follow p { margin: 0 0 12px; color: var(--text-2); font-size: 14px; }
.follow-btns { display: flex; gap: 8px; }

/* ---------- article ---------- */
.post { min-width: 0; }
.post > h1 { font-size: clamp(26px, 3.6vw, 38px); margin-top: 8px; }
.lead { font-size: 19px; color: var(--text-2); margin: 0 0 14px; }
.crumbs { display: flex; gap: 8px; font-size: 14px; color: var(--muted); }
.post-meta { margin: 0 0 22px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.post-cover { width: 100%; border-radius: var(--radius); margin-bottom: 24px; }
.prose { font-size: 18px; line-height: 1.95; overflow-wrap: anywhere; }
.prose h2 { font-size: 25px; margin: 1.6em 0 .6em; padding-inline-start: 14px; border-inline-start: 5px solid var(--primary); }
.prose h3 { font-size: 21px; margin: 1.4em 0 .5em; }
.prose p { margin: 0 0 1.1em; }
.prose a { text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 3px; }
.prose ul, .prose ol { padding-inline-start: 1.4em; margin: 0 0 1.2em; }
.prose li { margin-bottom: .4em; }
.prose ol { counter-reset: step; list-style: none; padding-inline-start: 0; }
.prose ol > li { counter-increment: step; position: relative; padding-inline-start: 46px; min-height: 34px; margin-bottom: .8em; }
.prose ol > li::before { content: counter(step); position: absolute; inset-inline-start: 0; top: 2px; width: 32px; height: 32px; border-radius: 10px; background: var(--primary); color: #fff; font-weight: 700; font-size: 16px; display: grid; place-items: center; }
.prose blockquote { margin: 1.4em 0; padding: 14px 18px; background: var(--cream-2); border-inline-start: 4px solid var(--accent); border-radius: 10px; color: var(--text-2); }
.prose blockquote p:last-child { margin: 0; }
.prose code { background: var(--cream); padding: 2px 7px; border-radius: 6px; font-size: .9em; direction: ltr; unicode-bidi: embed; }
.prose pre { background: var(--text); color: var(--cream); padding: 16px; border-radius: 12px; overflow-x: auto; direction: ltr; text-align: left; }
.prose pre code { background: none; padding: 0; color: inherit; }
.prose figure { margin: 1.6em 0; text-align: center; }
.prose figure img { border-radius: 12px; border: 1px solid var(--line); max-height: 720px; }
.prose figcaption { font-size: 14px; color: var(--muted); margin-top: 6px; }
.prose table { width: 100%; border-collapse: collapse; margin: 1.2em 0; font-size: 16px; }
.prose th, .prose td { border: 1px solid var(--line); padding: 8px 12px; }
.prose th { background: var(--cream); }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 2em 0; }
.static { max-width: 780px; margin-inline: auto; }
.ad { margin: 26px 0; min-height: 90px; text-align: center; }
.ad-placeholder { display: grid; place-items: center; border: 2px dashed var(--accent); border-radius: 12px; color: var(--link); background: var(--cream-2); font-size: 14px; }
.share { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 32px 0; padding: 14px 18px; border-radius: 12px; background: var(--cream-2); font-weight: 600; }
.share a, .share button { padding: 4px 12px; border-radius: 999px; background: #fff; border: 1px solid var(--line); font-size: 14px; }
.author-box { display: flex; gap: 18px; align-items: flex-start; padding: 22px; border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 32px; }
.author-box h3 { margin: 0 0 4px; }
.author-box p { margin: 0 0 8px; color: var(--text-2); }
.socials { display: flex; flex-wrap: wrap; gap: 10px; }
.socials-inline a { font-size: 14px; font-weight: 600; }
.page-head { margin-bottom: 24px; }
.page-head h1 { font-size: 30px; }

/* author profile */
.profile-hero { text-align: center; padding: 36px 20px; margin-bottom: 32px; border-radius: 24px; background: linear-gradient(135deg, var(--cream-2), var(--cream)); display: grid; justify-items: center; gap: 6px; }
.profile-hero h1 { margin: 8px 0 0; }
.profile-hero p { max-width: 520px; margin: 4px 0; color: var(--text-2); }
.profile-hero .avatar { border: 4px solid #fff; box-shadow: var(--shadow); }
.profile-stats { display: flex; gap: 32px; margin-top: 10px; }
.profile-stats div { display: grid; }
.profile-stats b { font-size: 24px; color: var(--primary); }

.center-page { text-align: center; padding: 60px 0; }
.big-404 { font-size: 110px; font-weight: 700; color: var(--accent); line-height: 1; }

/* ---------- footer ---------- */
.site-footer { background: var(--text); color: var(--cream); padding-top: 44px; }
.site-footer a { color: var(--cream); opacity: .85; display: block; padding: 3px 0; }
.site-footer a:hover { opacity: 1; color: var(--accent); }
.site-footer h4 { color: var(--accent); font-size: 16px; }
.site-footer p { opacity: .8; max-width: 360px; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 32px; }
.footer-brand { display: flex; align-items: center; gap: 10px; font-size: 20px; }
.site-footer .socials a { display: inline-block; border: 1px solid rgba(252, 233, 216, .3); padding: 4px 14px; border-radius: 999px; font-size: 14px; }
.footer-bottom { border-top: 1px solid rgba(252, 233, 216, .15); margin-top: 32px; padding: 18px 0; font-size: 14px; opacity: .7; }

/* ---------- auth ---------- */
.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: linear-gradient(135deg, var(--cream-2), var(--cream)); }
.auth-card { width: min(440px, 100%); background: #fff; padding: 32px; border-radius: 20px; box-shadow: var(--shadow); }
.auth-card .logo { margin-bottom: 20px; }
.auth-card h1 { font-size: 24px; margin-bottom: 4px; }
.auth-card > p { margin-top: 0; }

/* ---------- dashboard ---------- */
.dash-body { background: var(--cream-2); display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }
.nav-toggle, .burger { display: none; }
.dash-side { background: #fff; border-inline-end: 1px solid var(--line); padding: 20px 16px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.dash-brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-size: 17px; margin-bottom: 20px; }
.dash-brand b { color: var(--primary); }
.dash-user { display: grid; justify-items: center; gap: 8px; text-align: center; padding: 16px 0 20px; border-bottom: 1px solid var(--line); margin-bottom: 14px; font-weight: 600; }
.dash-user .avatar { border: 3px solid var(--cream); }
.dash-side nav { display: grid; gap: 4px; }
.dash-side nav a, .nav-btn { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 10px; color: var(--text-2); font-weight: 500; font-size: 15.5px; }
.nav-btn { width: 100%; background: none; border: 0; font-family: var(--font); cursor: pointer; }
.dash-side nav a:hover, .nav-btn:hover { background: var(--cream-2); color: var(--primary); }
.dash-side nav a.active { background: var(--cream); color: var(--primary); font-weight: 700; }
.dash-main { min-width: 0; }
.dash-top { display: flex; align-items: center; gap: 14px; padding: 16px 28px; background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.dash-top h1 { font-size: 20px; margin: 0; flex: 1; }
.dash-content { padding: 28px; display: grid; gap: 22px; max-width: 1200px; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.panel h3 { font-size: 17px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.panel-head h3 { margin: 0; }
.profile-panel { display: grid; justify-items: center; text-align: center; gap: 10px; }
.profile-panel h2 { margin: 0; font-size: 20px; }
.profile-panel .avatar { border: 4px solid var(--cream); }
.copy-box { width: min(440px, 100%); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.copy-row { display: flex; gap: 8px; margin-top: 6px; }
.copy-row input { font-size: 14px; }
.row-btns { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; display: grid; gap: 2px; }
.stat span { color: var(--muted); font-size: 14px; font-weight: 500; }
.stat b { font-size: 28px; color: var(--text); }
.stat small { color: var(--muted); }
.stat-hero { background: linear-gradient(135deg, var(--primary), var(--link)); border: 0; color: #fff; }
.stat-hero span, .stat-hero small { color: var(--cream); }
.stat-hero b { color: #fff; font-size: 34px; }
.chart { width: 100%; height: auto; max-height: 240px; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.table th { text-align: start; color: var(--muted); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table td a { font-weight: 600; }
.actions { white-space: nowrap; }
.actions a { margin-inline-end: 12px; }
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.badge-green { background: #e3f5ea; color: var(--green); }
.badge-amber { background: #fdf1dc; color: var(--amber); }
.badge-red { background: #fde6e3; color: var(--red); }
.badge-gray { background: #efe9e5; color: #6b5a50; }
.tabs { display: flex; gap: 6px; overflow-x: auto; border-bottom: 1px solid var(--line); }
.tabs a { padding: 10px 16px; color: var(--text-2); font-weight: 600; border-bottom: 3px solid transparent; white-space: nowrap; }
.tabs a.active { color: var(--primary); border-bottom-color: var(--primary); }
.review-form { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.review-form input { width: 150px; padding: 6px 10px; font-size: 13px; }
.msg-new { border-inline-start: 4px solid var(--primary); }

/* editor */
.editor-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 22px; align-items: start; }
.editor-main { display: grid; gap: 12px; }
.editor-side { display: grid; gap: 16px; position: sticky; top: 90px; }
.editor-side h3 { margin-bottom: 8px; }
.title-input { font-size: 24px; font-weight: 700; border: 0; padding: 6px 0; border-bottom: 2px solid var(--line); border-radius: 0; box-shadow: none !important; }
.toolbar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 8px; background: var(--cream-2); border-radius: 10px; }
.toolbar button, .tool-upload { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 5px 11px; font: 500 14px var(--font); color: var(--text-2); cursor: pointer; }
.toolbar button:hover, .tool-upload:hover { border-color: var(--primary); color: var(--primary); }
.tool-sep { flex: 1; }
.toolbar .tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.body-input { font-size: 16.5px; line-height: 1.9; min-height: 480px; resize: vertical; }
.preview { min-height: 480px; border: 1.5px dashed var(--line); border-radius: 10px; padding: 18px; }
.cover-preview { aspect-ratio: 1200 / 630; border-radius: 10px; background: var(--cream-2); display: grid; place-items: center; overflow: hidden; margin-bottom: 4px; }
.cover-preview img { width: 100%; height: 100%; object-fit: cover; }
.danger-zone { border-color: #f1c4bd; }

/* ---------- responsive ---------- */
@media (max-width: 960px) {
  .layout-2, .editor-grid { grid-template-columns: 1fr; }
  .sidebar, .editor-side { position: static; }
  .hero { grid-template-columns: 1fr; padding: 28px 22px; }
  .card-big { grid-template-columns: 1fr; }
  .card-big .card-cover { min-height: 0; aspect-ratio: 1200 / 630; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-grid > div:first-child { grid-column: 1 / -1; }
  .dash-body { grid-template-columns: 1fr; }
  .dash-side { position: fixed; inset-block: 0; inset-inline-start: 0; width: 270px; z-index: 50; transform: translateX(100%); transition: transform .2s; box-shadow: var(--shadow); }
  .nav-toggle:checked ~ .dash-side { transform: none; }
  .burger { display: block; font-size: 24px; cursor: pointer; color: var(--text-2); }
  .dash-content { padding: 16px; }
  .dash-top { padding: 12px 16px; }
}
@media (max-width: 640px) {
  .header-row { flex-wrap: wrap; gap: 10px; }
  .search { order: 3; max-width: none; flex-basis: 100%; }
  .header-actions { margin-inline-start: auto; }
  .prose { font-size: 17px; }
  .form-inline .grow { grid-column: auto; }
  .author-box { flex-direction: column; }
}
