:root {
  --red: #ec1c24;
  --gold: #e1ba47;
  --orange: #ea4a37;
  --dark: #333338;
  --gray: #6f7177;
  --light: #f6f6f6;
  --white: #fff;
  --gradient: linear-gradient(135deg, #ec1c24 0%, #ea4a37 45%, #e1ba47 100%);
  --radius: 8px;
  --shadow: 0 14px 34px rgba(51, 51, 56, .09);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
  font-family: "Inter", "IBM Plex Sans Arabic", sans-serif;
  color: var(--dark);
  background: var(--light);
}

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

.admin-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 18px;
  overflow-y: auto;
  background: var(--dark);
  color: var(--white);
}

.admin-sidebar img {
  width: 132px;
  padding: 8px;
  border-radius: var(--radius);
  background: var(--white);
}

.admin-sidebar nav,
.nav-group,
.sidebar-footer {
  display: grid;
  gap: 8px;
}

.admin-sidebar nav { gap: 16px; }
.sidebar-footer { margin-top: auto; }

.nav-group strong {
  color: rgba(255, 255, 255, .48);
  font-size: .72rem;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.admin-sidebar button,
.admin-sidebar a,
form button,
.button-link {
  min-height: 42px;
  border: 0;
  border-radius: var(--radius);
  padding: 0 14px;
  font-weight: 800;
  cursor: pointer;
}

.admin-sidebar button,
.admin-sidebar a {
  display: flex;
  align-items: center;
  color: rgba(255, 255, 255, .82);
  background: rgba(255, 255, 255, .08);
  text-align: start;
  text-decoration: none;
}

.admin-sidebar a.active {
  color: var(--dark);
  background: var(--gold);
}

.admin-main {
  min-width: 0;
  padding: 24px;
}

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

.admin-topbar p,
.section-titlebar p {
  margin: 0;
  color: var(--red);
  font-weight: 800;
}

.admin-topbar h1 {
  margin: 0;
  font-size: clamp(1.7rem, 3vw, 2.25rem);
}

.admin-section.active {
  display: grid;
  gap: 18px;
}

.section-titlebar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
}

.section-titlebar p {
  max-width: 760px;
  color: var(--gray);
  font-weight: 600;
}

.section-titlebar h2 {
  margin: 6px 0 0;
  font-size: clamp(1.35rem, 2.5vw, 1.85rem);
}

.title-actions,
.form-actions,
.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

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

.metric-grid article,
.panel {
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: var(--shadow);
}

.metric-grid article {
  padding: 22px;
  border-top: 5px solid var(--gold);
}

.metric-grid strong {
  display: block;
  color: var(--red);
  font-size: 2.2rem;
}

.metric-grid span,
.panel p,
td,
td span {
  color: var(--gray);
}

.panel { padding: 20px; }
.panel h2 { margin: 0 0 16px; }

.form-grid,
.inline-form,
.filter-bar {
  display: grid;
  gap: 14px;
}

.form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  max-width: 1040px;
}

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

.filter-bar {
  align-items: end;
  margin-bottom: 16px;
  padding: 14px;
  border: 1px solid rgba(51, 51, 56, .1);
  border-radius: var(--radius);
  background: #fffdf7;
}

label {
  display: grid;
  gap: 7px;
  font-weight: 800;
}

input, textarea, select {
  width: 100%;
  min-height: 44px;
  border: 1px solid rgba(51, 51, 56, .14);
  border-radius: var(--radius);
  padding: 10px 12px;
  color: var(--dark);
  background: var(--white);
}

textarea { resize: vertical; }

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

.check input,
fieldset input {
  width: auto;
  min-height: auto;
}

fieldset {
  grid-column: 1 / -1;
  border: 1px solid rgba(51, 51, 56, .14);
  border-radius: var(--radius);
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

form button,
.primary-link {
  color: var(--white);
  background: var(--gradient);
}

.button-link {
  display: inline-flex;
  align-items: center;
  color: var(--dark);
  background: var(--light);
  text-decoration: none;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

th, td {
  padding: 13px;
  border-bottom: 1px solid rgba(51, 51, 56, .09);
  text-align: start;
  vertical-align: top;
}

th {
  color: var(--dark);
  background: #fff7e1;
}

td span { font-size: .88rem; }

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px;
  border-radius: var(--radius);
  background: #fff8e7;
}

.tabs button {
  min-height: 40px;
  color: var(--dark);
  background: var(--white);
  border: 1px solid rgba(51, 51, 56, .1);
}

.tabs button.active {
  color: var(--white);
  background: var(--gradient);
}

.tab-panel {
  display: none;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 18px;
  border: 1px solid rgba(51, 51, 56, .1);
  border-radius: var(--radius);
  background: #fff;
}

.tab-panel.active { display: grid; }

.compact-form {
  display: grid;
  gap: 8px;
  min-width: 220px;
}

.wide,
.field-preview,
.image-edit,
.image-row,
.image-edit-grid {
  grid-column: 1 / -1;
}

.field-preview img,
.image-row img,
.image-edit img,
.thumb {
  width: 120px;
  height: 90px;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid rgba(51, 51, 56, .12);
}

.thumb {
  width: 74px;
  height: 54px;
}

.admin-repeat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}

.repeat-card {
  display: grid;
  gap: 12px;
  min-width: 0;
  padding: 16px;
  border: 1px solid rgba(51, 51, 56, .12);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .78);
}

.repeat-card legend {
  padding: 0 8px;
  color: #ec1c24;
  font-weight: 900;
}

.image-row,
.image-edit-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.image-row figure,
.image-edit {
  margin: 0;
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid rgba(51, 51, 56, .1);
  border-radius: var(--radius);
  background: #fffdf7;
}

.image-row figcaption {
  max-width: 180px;
  color: var(--gray);
  font-size: .78rem;
  word-break: break-word;
}

.icon-pill,
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 9px;
  border-radius: var(--radius);
  background: var(--light);
  color: var(--gray);
  font-size: .78rem;
  font-weight: 800;
}

.badge.ok {
  color: #116149;
  background: #ddf8ee;
}

.badge.muted {
  color: var(--gray);
  background: var(--light);
}

.danger {
  color: var(--white) !important;
  background: var(--red) !important;
}

@media (max-width: 980px) {
  body { grid-template-columns: 1fr; }
  .admin-sidebar { position: static; height: auto; }
  .metric-grid,
  .form-grid,
  .inline-form,
  .filter-bar,
  .tab-panel,
  .image-edit-grid {
    grid-template-columns: 1fr;
  }
  .section-titlebar {
    align-items: stretch;
    flex-direction: column;
  }
}

.login-shell {
  display: grid;
  place-items: center;
  grid-template-columns: 1fr;
  min-height: 100vh;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(236, 28, 36, .16), transparent 34%),
    linear-gradient(315deg, rgba(225, 186, 71, .18), transparent 38%),
    #f7f7f8;
}

.login-card {
  width: min(920px, 100%);
  display: grid;
  grid-template-columns: .95fr 1.05fr;
  overflow: hidden;
  border: 1px solid rgba(51, 51, 56, .08);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 24px 62px rgba(32, 33, 38, .16);
}

.login-brand,
.login-form {
  padding: clamp(26px, 4vw, 44px);
}

.login-brand {
  color: #fff;
  background:
    linear-gradient(145deg, rgba(236, 28, 36, .28), transparent 44%),
    linear-gradient(135deg, #333338, #202126);
}

.login-brand img {
  width: 150px;
  padding: 8px;
  border-radius: var(--radius);
  background: #fff;
}

.login-brand p,
.login-form p {
  color: var(--gold);
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.login-brand h1,
.login-form h2 {
  margin: 10px 0 0;
}

.login-form {
  display: grid;
  gap: 16px;
}

.login-error {
  margin: 0;
  color: var(--red) !important;
}

.control-center {
  display: grid;
  gap: 18px;
  margin-bottom: 18px;
  border-color: rgba(225, 186, 71, .34);
}

.control-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  padding: 18px;
  border-radius: var(--radius);
  color: #fff;
  background:
    linear-gradient(145deg, rgba(236, 28, 36, .24), transparent 46%),
    linear-gradient(135deg, #333338, #202126);
}

.control-head p {
  margin: 0 0 6px;
  color: var(--gold);
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.control-head h2 {
  margin: 0;
  color: #fff;
}

.control-head span {
  color: rgba(255,255,255,.72);
  font-weight: 700;
}

.control-form {
  display: grid;
  gap: 12px;
}

.control-form details {
  border: 1px solid rgba(51, 51, 56, .1);
  border-radius: var(--radius);
  background: #fff;
  overflow: hidden;
}

.control-form summary {
  cursor: pointer;
  padding: 15px 18px;
  color: var(--dark);
  background: #fff8e7;
  font-weight: 900;
}

.control-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 18px;
}

.control-grid textarea {
  min-height: 96px;
}

.control-grid .field-preview img {
  width: 180px;
  height: 110px;
}

@media (max-width: 760px) {
  .login-card {
    grid-template-columns: 1fr;
  }

  .control-head {
    align-items: start;
    flex-direction: column;
  }

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

@media (max-width: 640px) {
  .admin-main { padding: 16px; }
  .admin-topbar { margin-bottom: 16px; }
  .panel,
  .tab-panel { padding: 14px; }
  .admin-sidebar img { width: 118px; }
}

/* Creative Production polish for CMS: modern, calm, and operational. */
body {
  background:
    linear-gradient(135deg, rgba(236, 28, 36, .04), transparent 28%),
    linear-gradient(180deg, #f8f8f9, #efeff1);
}

.admin-sidebar {
  background:
    linear-gradient(180deg, rgba(236, 28, 36, .18), transparent 22%),
    linear-gradient(145deg, #333338, #202126);
  box-shadow: 12px 0 34px rgba(32, 33, 38, .16);
}

.admin-sidebar img {
  box-shadow: 0 10px 24px rgba(0,0,0,.18);
}

.nav-group {
  padding: 10px;
  border: 1px solid rgba(255,255,255,.06);
  border-radius: var(--radius);
  background: rgba(255,255,255,.035);
}

.admin-sidebar a,
.admin-sidebar button {
  transition: background .2s ease, color .2s ease, transform .2s ease;
}

.admin-sidebar a:hover,
.admin-sidebar button:hover {
  transform: translateX(3px);
  background: rgba(255,255,255,.13);
}

.admin-sidebar a.active {
  box-shadow: 0 10px 22px rgba(225, 186, 71, .18);
}

.admin-main {
  position: relative;
}

.admin-main::before {
  content: "";
  position: fixed;
  z-index: -1;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(51, 51, 56, .045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(51, 51, 56, .045) 1px, transparent 1px);
  background-size: 68px 68px;
}

.admin-topbar {
  padding: 18px 20px;
  border: 1px solid rgba(51, 51, 56, .08);
  border-radius: var(--radius);
  background: rgba(255,255,255,.82);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.admin-topbar p {
  color: var(--red);
  letter-spacing: .08em;
  text-transform: uppercase;
  font-size: .76rem;
}

.section-titlebar {
  padding: 18px 20px;
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(225, 186, 71, .18), rgba(255,255,255,.84)),
    #fff;
  border: 1px solid rgba(225, 186, 71, .26);
  box-shadow: var(--shadow);
}

.panel {
  border: 1px solid rgba(51, 51, 56, .08);
}

.metric-grid article,
.panel {
  transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
}

.metric-grid article:hover,
.panel:hover {
  border-color: rgba(225, 186, 71, .3);
  box-shadow: 0 18px 42px rgba(33,33,38,.11);
}

.metric-grid article {
  position: relative;
  overflow: hidden;
}

.metric-grid article::after {
  content: "";
  position: absolute;
  inset: auto 18px 16px 18px;
  height: 3px;
  border-radius: 999px;
  background: var(--gradient);
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--red);
  box-shadow: 0 0 0 4px rgba(236, 28, 36, .08);
}

table {
  overflow: hidden;
  border-radius: var(--radius);
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  font-size: .78rem;
  letter-spacing: .04em;
  text-transform: uppercase;
}

tbody tr {
  background: #fff;
  transition: background .18s ease;
}

tbody tr:hover {
  background: #fffdf7;
}

.tabs {
  position: sticky;
  top: 14px;
  z-index: 2;
  border: 1px solid rgba(225, 186, 71, .28);
}

.tab-panel {
  box-shadow: inset 0 1px 0 rgba(255,255,255,.75);
}

.button-link,
form button {
  transition: transform .2s ease, box-shadow .2s ease, background .2s ease;
}

.button-link:hover,
form button:hover {
  transform: translateY(-2px);
}

.primary-link,
form button {
  box-shadow: 0 10px 22px rgba(236, 28, 36, .16);
}

.danger {
  box-shadow: none !important;
}

@media (max-width: 980px) {
  .admin-sidebar {
    box-shadow: 0 12px 28px rgba(32, 33, 38, .16);
  }

  .nav-group {
    padding: 8px;
  }

  .tabs {
    position: static;
  }
}
