/* Dârülilm — editorial desk */

body.editor-route {
  --editor-ink: #1e2822;
  --editor-muted: #687167;
  --editor-green: #254638;
  --editor-green-deep: #18372b;
  --editor-gold: #9b7731;
  --editor-gold-soft: #d8bd79;
  --editor-ivory: #f6f1e7;
  --editor-paper: #fffdf8;
  --editor-source: #f0eadc;
  --editor-line: #ddd4c3;
  --editor-line-strong: #cbbd9f;
  --editor-danger: #9a4037;
  --editor-success: #35694c;
  color-scheme: light;
  color: var(--editor-ink);
  background: var(--editor-ivory);
}

body.editor-route .atmosphere {
  background: var(--editor-ivory);
  opacity: 1;
}

body.editor-route::after {
  display: none;
}

body.editor-route .topbar {
  background: rgba(255, 253, 248, 0.95);
  border-bottom-color: var(--editor-line-strong);
  box-shadow: 0 4px 22px rgba(52, 48, 36, 0.06);
}

body.editor-route .brand,
body.editor-route .brand:hover {
  color: var(--editor-ink);
}

body.editor-route .brand-seal,
body.editor-route .brand-mark {
  color: var(--editor-green);
}

body.editor-route .brand-title {
  color: var(--editor-muted);
}

body.editor-route .nav a,
body.editor-route .nav a:hover {
  color: var(--editor-green);
}

body.editor-route .nav a[aria-current="page"] {
  color: var(--editor-gold);
}

body.editor-route .site-foot {
  border-top-color: var(--editor-line);
  color: var(--editor-muted);
}

body.editor-route .site-foot .promise,
body.editor-route .site-foot .source,
body.editor-route .site-foot-heading,
body.editor-route .site-foot-note {
  color: var(--editor-muted);
}

body.editor-route .site-foot-nav a {
  color: var(--editor-green);
}

.editor-topbar-user {
  display: inline-flex;
  max-width: 12rem;
  align-items: center;
  gap: 0.35rem;
  overflow: hidden;
  color: var(--editor-muted);
  font-family: var(--font-ui);
  font-size: 0.77rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.editor-topbar-user::before {
  width: 0.38rem;
  height: 0.38rem;
  border-radius: 50%;
  background: var(--editor-success);
  content: "";
}

.editor-topbar-logout {
  min-height: 40px;
  padding: 0.35rem 0.55rem;
  border: 0;
  color: var(--editor-muted);
  background: transparent;
  font-family: var(--font-ui);
  font-size: 0.73rem;
  letter-spacing: 0.04em;
}

.editor-topbar-logout:hover {
  color: var(--editor-danger);
}

.editor-view {
  width: 100%;
}

.editor-shell {
  max-width: 1320px;
  margin: 0 auto;
  padding: clamp(1.25rem, 2.5vw, 2.2rem) 0 clamp(4rem, 8vw, 7rem);
}

.editor-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: clamp(1.1rem, 2vw, 1.55rem);
}

.editor-heading-copy {
  max-width: 50rem;
}

.editor-kicker,
.editor-label,
.editor-panel-kicker,
.editor-meta,
.editor-caption,
.editor-status,
.editor-wordcount,
.editor-source-link,
.editor-history-meta,
.editor-empty-note,
.editor-auth-note,
.editor-conflict-note,
.editor-media-hint {
  font-family: var(--font-ui);
}

.editor-kicker,
.editor-panel-kicker {
  margin-bottom: 0.45rem;
  color: var(--editor-gold);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  line-height: 1.3;
  text-transform: uppercase;
}

.editor-heading h1 {
  margin: 0;
  color: var(--editor-green-deep);
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 4vw, 3.25rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 0.98;
}

.editor-heading-subtitle {
  margin-top: 0.7rem;
  color: var(--editor-muted);
  font-size: 1.04rem;
}

.editor-heading-note {
  max-width: 17rem;
  color: var(--editor-muted);
  font-family: var(--font-ui);
  font-size: 0.78rem;
  line-height: 1.5;
  text-align: right;
}

.editor-heading-note::before {
  display: inline-block;
  width: 2.2rem;
  margin: 0 0.45rem 0.22rem 0;
  border-top: 1px solid var(--editor-gold);
  content: "";
  vertical-align: middle;
}

.editor-toolbar {
  display: grid;
  grid-template-columns: minmax(16rem, 1fr) minmax(16rem, 1.7fr);
  align-items: start;
  gap: 1.2rem;
  margin-bottom: 1.4rem;
  padding: 1rem;
  border: 1px solid var(--editor-line);
  border-radius: 9px;
  background: rgba(255, 253, 248, 0.72);
}

.editor-field {
  display: grid;
  gap: 0.42rem;
}

.editor-label {
  color: var(--editor-muted);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.editor-input,
.editor-select,
.editor-login-input {
  width: 100%;
  min-height: 44px;
  padding: 0.63rem 0.75rem;
  border: 1px solid var(--editor-line-strong);
  border-radius: 6px;
  color: var(--editor-ink);
  background: var(--editor-paper);
  font-family: var(--font-ui);
  font-size: 0.92rem;
}

.editor-input::placeholder,
.editor-login-input::placeholder {
  color: #92988f;
}

.editor-select {
  appearance: auto;
}

.editor-input:focus,
.editor-select:focus,
.editor-login-input:focus,
.editor-textarea:focus {
  border-color: var(--editor-gold);
  box-shadow: 0 0 0 3px rgba(155, 119, 49, 0.13);
  outline: none;
}

.editor-unit-summary {
  align-self: end;
  min-height: 44px;
  padding: 0.58rem 0.75rem;
  border-left: 2px solid var(--editor-gold-soft);
  color: var(--editor-muted);
  font-family: var(--font-ui);
  font-size: 0.8rem;
  line-height: 1.45;
}

.editor-unit-summary strong {
  display: block;
  color: var(--editor-green-deep);
  font-size: 0.9rem;
  font-weight: 600;
}

.editor-scenes {
  margin-bottom: 1.5rem;
}

.editor-scenes-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.65rem;
}

.editor-scenes-heading h2 {
  color: var(--editor-green-deep);
  font-family: var(--font-display);
  font-size: 1.65rem;
  font-weight: 600;
}

.editor-scenes-count {
  color: var(--editor-muted);
  font-family: var(--font-ui);
  font-size: 0.76rem;
}

.editor-scene-tabs {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding: 0.25rem 0 0.5rem;
  scrollbar-width: thin;
}

.editor-scene-tab {
  display: inline-flex;
  min-height: 44px;
  flex: 0 0 auto;
  align-items: center;
  gap: 0.45rem;
  padding: 0.62rem 0.83rem;
  border: 1px solid var(--editor-line);
  border-radius: 6px;
  color: var(--editor-muted);
  background: rgba(255, 253, 248, 0.52);
  font-family: var(--font-ui);
  font-size: 0.82rem;
  text-align: left;
}

.editor-scene-tab:hover,
.editor-scene-tab[aria-selected="true"] {
  border-color: var(--editor-gold);
  color: var(--editor-green-deep);
  background: #fffaf0;
}

.editor-scene-tab[aria-selected="true"] {
  box-shadow: inset 0 -2px 0 var(--editor-gold);
}

.editor-scene-tab-status {
  width: 0.42rem;
  height: 0.42rem;
  flex: none;
  border-radius: 50%;
  background: var(--editor-success);
}

.editor-scene-tab-status.is-draft {
  background: var(--editor-gold);
}

.editor-scene-title {
  margin: 0 0 1rem;
  color: var(--editor-green-deep);
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 3.2vw, 2.7rem);
  font-weight: 600;
  line-height: 1.08;
}

.editor-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: start;
  gap: clamp(1.1rem, 2.4vw, 2rem);
}

.editor-panel {
  min-width: 0;
  border: 1px solid var(--editor-line);
  border-radius: 10px;
  background: var(--editor-paper);
  box-shadow: 0 12px 34px rgba(78, 67, 47, 0.06);
}

.editor-panel-source {
  background: var(--editor-source);
}

.editor-panel-source > summary {
  cursor: pointer;
  list-style: none;
}

.editor-panel-source > summary::-webkit-details-marker {
  display: none;
}

.editor-panel-source > summary::after {
  display: none;
  width: 0.55rem;
  height: 0.55rem;
  margin: 0.35rem 0.1rem 0 0.6rem;
  border-right: 1px solid var(--editor-gold);
  border-bottom: 1px solid var(--editor-gold);
  content: "";
  transform: rotate(45deg);
  transition: transform var(--motion) ease;
}

.editor-panel-source:not([open]) > summary::after {
  transform: rotate(-45deg);
}

.editor-panel-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.05rem 1.2rem 0.9rem;
  border-bottom: 1px solid var(--editor-line);
}

.editor-panel-header h2 {
  color: var(--editor-green-deep);
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 600;
  line-height: 1.05;
}

.editor-panel-meta {
  max-width: 48%;
  color: var(--editor-muted);
  font-family: var(--font-ui);
  font-size: 0.72rem;
  line-height: 1.4;
  text-align: right;
}

.editor-source-link {
  display: flex;
  width: max-content;
  min-height: 40px;
  align-items: center;
  margin-top: 0.45rem;
  color: var(--editor-green);
  font-size: 0.73rem;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

.editor-source-body {
  padding: 1.2rem clamp(1.1rem, 3vw, 1.8rem) 1.65rem;
  color: #344137;
  font-family: var(--font-body);
  font-size: clamp(1.03rem, 1.5vw, 1.16rem);
  line-height: 1.78;
}

.editor-source-body p {
  margin: 0 0 1.1rem;
}

.editor-source-body p:last-child {
  margin-bottom: 0;
}

.editor-source-body > .editor-btn {
  margin-top: 1.2rem;
}

.editor-edit-panel {
  position: relative;
}

.editor-textarea-wrap {
  padding: 1.2rem clamp(1.1rem, 3vw, 1.8rem) 0;
}

.editor-textarea {
  display: block;
  width: 100%;
  min-height: clamp(280px, 38vh, 480px);
  resize: vertical;
  padding: 0.1rem 0;
  border: 0;
  color: var(--editor-ink);
  background: transparent;
  font-family: var(--font-body);
  font-size: clamp(1.05rem, 1.55vw, 1.2rem);
  line-height: 1.7;
}

.editor-textarea::selection {
  background: rgba(155, 119, 49, 0.26);
  color: var(--editor-ink);
}

.editor-edit-footer {
  display: grid;
  gap: 0.8rem;
  margin-top: 0.5rem;
  padding: 1rem clamp(1.1rem, 3vw, 1.8rem) 1.2rem;
  border-top: 1px solid var(--editor-line);
}

.editor-edit-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
}

.editor-wordcount,
.editor-caption {
  color: var(--editor-muted);
  font-size: 0.76rem;
}

.editor-caption {
  font-style: italic;
}

.editor-status {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.48rem;
  border-radius: 999px;
  color: var(--editor-muted);
  background: rgba(104, 113, 103, 0.1);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.editor-status.is-dirty {
  color: #80611f;
  background: rgba(216, 189, 121, 0.25);
}

.editor-status.is-success {
  color: var(--editor-success);
  background: rgba(53, 105, 76, 0.12);
}

.editor-status.is-error {
  color: var(--editor-danger);
  background: rgba(154, 64, 55, 0.1);
}

.editor-media-hint,
.editor-conflict-note {
  padding: 0.65rem 0.72rem;
  border-left: 2px solid var(--editor-gold);
  color: #79633c;
  background: #fbf4e4;
  font-size: 0.76rem;
  line-height: 1.45;
}

.editor-conflict-note {
  border-left-color: var(--editor-danger);
  color: var(--editor-danger);
  background: #fbefeb;
}

.editor-actions {
  position: sticky;
  bottom: 0.8rem;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
  padding-top: 0.1rem;
  background: linear-gradient(to bottom, rgba(255, 253, 248, 0), var(--editor-paper) 28%);
}

.editor-btn {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.66rem 0.95rem;
  border: 1px solid transparent;
  border-radius: 6px;
  font-family: var(--font-ui);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  line-height: 1.2;
  text-decoration: none;
  transition: background-color var(--motion) ease, border-color var(--motion) ease, color var(--motion) ease, opacity var(--motion) ease;
}

.editor-btn-primary {
  color: #fffdf7;
  background: var(--editor-green);
  border-color: var(--editor-green);
}

.editor-btn-primary:hover {
  color: #fffdf7;
  background: var(--editor-green-deep);
  border-color: var(--editor-green-deep);
}

.editor-btn-primary:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

.editor-btn-secondary {
  color: var(--editor-green);
  background: transparent;
  border-color: var(--editor-line-strong);
}

.editor-btn-secondary:hover {
  color: var(--editor-green-deep);
  border-color: var(--editor-gold);
  background: #fbf4e4;
}

.editor-btn-link {
  min-height: 44px;
  padding: 0.6rem 0.2rem;
  color: var(--editor-green);
  font-family: var(--font-ui);
  font-size: 0.77rem;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

.editor-history {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  justify-items: end;
  background: rgba(28, 35, 29, 0.28);
}

.editor-history[hidden] {
  display: none;
}

.editor-history-panel {
  display: flex;
  width: min(30rem, 100%);
  height: 100%;
  flex-direction: column;
  padding: 1.3rem;
  overflow: hidden;
  border-left: 1px solid var(--editor-line-strong);
  background: var(--editor-paper);
  box-shadow: -15px 0 42px rgba(48, 45, 32, 0.12);
}

.editor-history-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 0.75rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--editor-line);
}

.editor-history-head h2 {
  color: var(--editor-green-deep);
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 600;
  line-height: 1;
}

.editor-history-close {
  min-width: 44px;
  min-height: 44px;
  border: 1px solid var(--editor-line);
  border-radius: 6px;
  color: var(--editor-muted);
  background: transparent;
  font-family: var(--font-ui);
  font-size: 1.1rem;
}

.editor-history-list {
  display: grid;
  gap: 0.8rem;
  padding: 1rem 0;
  overflow-y: auto;
}

.editor-revision {
  padding: 0.85rem;
  border: 1px solid var(--editor-line);
  border-radius: 7px;
  background: #fffcf6;
}

.editor-revision-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.6rem;
}

.editor-revision-head strong {
  color: var(--editor-green-deep);
  font-family: var(--font-ui);
  font-size: 0.8rem;
}

.editor-history-meta {
  color: var(--editor-muted);
  font-size: 0.68rem;
}

.editor-revision-preview {
  display: -webkit-box;
  margin: 0.65rem 0;
  overflow: hidden;
  color: var(--editor-muted);
  font-family: var(--font-body);
  font-size: 0.86rem;
  line-height: 1.5;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
}

.editor-revision .editor-btn {
  width: 100%;
}

.editor-login-shell {
  display: grid;
  min-height: min(620px, calc(100vh - 10rem));
  place-items: center;
}

.editor-login-card {
  width: min(100%, 28rem);
  padding: clamp(1.5rem, 5vw, 2.6rem);
  border: 1px solid var(--editor-line);
  border-radius: 10px;
  background: var(--editor-paper);
  box-shadow: 0 20px 50px rgba(78, 67, 47, 0.09);
}

.editor-login-card h1 {
  margin: 0;
  color: var(--editor-green-deep);
  font-family: var(--font-display);
  font-size: 2.65rem;
  font-weight: 600;
  line-height: 1;
}

.editor-login-card > p:not(.editor-kicker):not(.editor-auth-error):not(.editor-auth-note) {
  margin-top: 0.7rem;
  color: var(--editor-muted);
}

.editor-login-form {
  display: grid;
  gap: 0.9rem;
  margin-top: 1.6rem;
}

.editor-login-form .editor-btn {
  width: 100%;
  margin-top: 0.3rem;
}

.editor-auth-error {
  margin-top: 1rem;
  padding: 0.65rem 0.75rem;
  border-left: 2px solid var(--editor-danger);
  color: var(--editor-danger);
  background: #fbefeb;
  font-family: var(--font-ui);
  font-size: 0.78rem;
  line-height: 1.45;
}

.editor-auth-note {
  margin-top: 1.2rem;
  color: var(--editor-muted);
  font-size: 0.74rem;
  line-height: 1.5;
}

.editor-loading,
.editor-empty {
  display: grid;
  min-height: 20rem;
  place-content: center;
  justify-items: center;
  gap: 0.75rem;
  color: var(--editor-muted);
  font-family: var(--font-ui);
  text-align: center;
}

.editor-loading-mark {
  width: 2rem;
  height: 2rem;
  border: 1px solid var(--editor-gold);
  transform: rotate(45deg);
}

.editor-empty p {
  max-width: 32rem;
}

.editor-error-card {
  max-width: 40rem;
  margin: 3rem auto;
  padding: 1.4rem;
  border: 1px solid #d8aaa2;
  border-radius: 8px;
  color: var(--editor-danger);
  background: #fff7f3;
  font-family: var(--font-ui);
}

.editor-error-card strong {
  display: block;
  margin-bottom: 0.35rem;
}

.editor-reload-current {
  margin-top: 0.55rem;
}

.editor-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

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

  .editor-heading-note {
    max-width: none;
    margin-top: 0.9rem;
    text-align: left;
  }

  .editor-toolbar {
    grid-template-columns: 1fr;
  }

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

  .editor-panel-source {
    order: 0;
  }

  .editor-edit-panel {
    order: 1;
  }
}

@media (max-width: 620px) {
  body.editor-route .topbar-inner {
    gap: 0.4rem;
  }

  body.editor-route .brand-title {
    display: none;
  }

  body.editor-route .nav {
    gap: 0;
  }

  body.editor-route .nav a {
    padding-inline: 0.38rem;
    font-size: 0.7rem;
  }

  .editor-topbar-user {
    max-width: 6.2rem;
    font-size: 0.68rem;
  }

  .editor-topbar-logout {
    padding-inline: 0.3rem;
    font-size: 0.67rem;
  }

  .editor-shell {
    padding-top: 1.5rem;
  }

  .editor-heading h1 {
    font-size: 2.8rem;
  }

  .editor-panel-header {
    display: block;
  }

  .editor-panel-source > summary {
    position: relative;
    display: block;
    padding-right: 2.2rem;
  }

  .editor-panel-source > summary::after {
    position: absolute;
    top: 1.15rem;
    right: 1.2rem;
    display: block;
    margin: 0;
  }

  .editor-panel-meta {
    max-width: none;
    margin-top: 0.45rem;
    text-align: left;
  }

  .editor-textarea {
    min-height: 480px;
  }

  .editor-edit-meta {
    align-items: flex-start;
    flex-direction: column;
  }

  .editor-actions {
    position: static;
    background: transparent;
  }

  .editor-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .editor-actions .editor-btn,
  .editor-actions .editor-btn-link {
    width: 100%;
    text-align: center;
  }

  .editor-history {
    align-items: end;
    justify-items: stretch;
  }

  .editor-history-panel {
    width: 100%;
    height: min(88vh, 48rem);
    border-top: 1px solid var(--editor-line-strong);
    border-left: 0;
    border-radius: 12px 12px 0 0;
  }
}
