/* Scrybert Controller — overrides only. Bootstrap 5.3.8 does the rest.
   No Sass: the deploy pipeline runs no build step, so this is plain CSS on top of the
   pre-built file. Class names are semantic and prefixed ctl- so a restyle later is a
   search for one prefix, not an archaeology dig. */

:root {
  --ctl-bg: #101010;
  --ctl-panel: #171717;
  --ctl-line: #2a2a2a;
  --ctl-live: #3fb950;
  --ctl-draft: #d2a24c;
  --ctl-rail-w: 260px;
}

body { background: var(--ctl-bg); }

.ctl-hidden { display: none !important; }

.ctl-brand { font-size: 1.15rem; font-weight: 650; letter-spacing: -0.01em; margin: 0; }
.ctl-brand__sub { font-weight: 400; color: var(--bs-secondary-color); }

/* ---------- screens ---------- */
.ctl-screen { min-height: 100vh; }
.ctl-screen--centered { display: grid; place-items: center; padding: 2rem 1rem; }

.ctl-login-card {
  width: 100%; max-width: 380px; background: var(--ctl-panel);
  border: 1px solid var(--ctl-line); padding: 2rem;
}
.ctl-login__hint { color: var(--bs-secondary-color); font-size: .875rem; margin: .35rem 0 1.5rem; }
.ctl-alert { font-size: .85rem; padding: .6rem .8rem; }

/* ---------- top bar ---------- */
.ctl-topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: .7rem 1.1rem;
  background: var(--ctl-panel); border-bottom: 1px solid var(--ctl-line);
}
.ctl-topbar__right { display: flex; align-items: center; gap: .6rem; }
.ctl-topbar__email { color: var(--bs-secondary-color); font-size: .82rem; }
.ctl-role-badge { background: #24303f; color: #9ec5fe; font-weight: 500; }

/* ---------- layout ---------- */
.ctl-body { display: grid; grid-template-columns: var(--ctl-rail-w) 1fr; min-height: calc(100vh - 53px); }

.ctl-rail {
  background: var(--ctl-panel); border-right: 1px solid var(--ctl-line);
  padding: 1rem .75rem; display: flex; flex-direction: column;
}
.ctl-rail__heading {
  font-size: .7rem; text-transform: uppercase; letter-spacing: .09em;
  color: var(--bs-secondary-color); padding: 0 .5rem .6rem;
}
.ctl-rail__list { list-style: none; margin: 0; padding: 0; flex: 1; }

.ctl-core-item {
  width: 100%; text-align: left; background: transparent; color: inherit;
  border: 1px solid transparent; padding: .55rem .6rem; margin-bottom: .15rem;
  display: flex; align-items: center; gap: .5rem; cursor: pointer;
}
.ctl-core-item:hover { background: #1f1f1f; }
.ctl-core-item.is-active { background: #232323; border-color: var(--ctl-line); }
.ctl-core-item.is-nested { padding-left: 1.6rem; }
.ctl-core-item__name { flex: 1; font-size: .9rem; }
.ctl-core-item__sub { display: block; font-size: .72rem; color: var(--bs-secondary-color); }

.ctl-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.ctl-dot--live { background: var(--ctl-live); }
.ctl-dot--draft { background: var(--ctl-draft); }

.ctl-rail__foot { border-top: 1px solid var(--ctl-line); padding-top: .7rem; margin-top: .7rem; }
.ctl-legend { font-size: .72rem; color: var(--bs-secondary-color); display: flex;
              align-items: center; gap: .4rem; padding: .12rem .5rem; }

/* ---------- editor ---------- */
.ctl-main { padding: 1.25rem 1.5rem 4rem; overflow-x: hidden; }
.ctl-empty { color: var(--bs-secondary-color); display: grid; place-items: center; height: 60vh; }

.ctl-editor__head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 1rem; padding-bottom: .9rem; border-bottom: 1px solid var(--ctl-line); margin-bottom: 1rem;
}
.ctl-editor__title { font-size: 1.25rem; font-weight: 650; margin: 0; }
.ctl-editor__meta { font-size: .78rem; color: var(--bs-secondary-color); margin-top: .2rem; }
.ctl-editor__actions { display: flex; gap: .45rem; flex: none; }

.ctl-status { font-size: .8rem; color: var(--bs-secondary-color); margin-bottom: .8rem; }
.ctl-status.is-ok { color: var(--ctl-live); }
.ctl-status.is-bad { color: #ff7b72; }

.ctl-fields { display: flex; flex-direction: column; gap: 1.1rem; max-width: 1000px; }

.ctl-field { background: var(--ctl-panel); border: 1px solid var(--ctl-line); }
.ctl-field__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: .5rem .75rem; border-bottom: 1px solid var(--ctl-line);
}
.ctl-field__name { font-size: .84rem; font-weight: 600; }
.ctl-field__key { font-size: .72rem; color: var(--bs-secondary-color); font-family: var(--bs-font-monospace); }
.ctl-field__editor {
  width: 100%; background: #0d0d0d; color: #e6e6e6; border: 0; resize: vertical;
  padding: .75rem; font-family: var(--bs-font-monospace); font-size: .82rem;
  line-height: 1.5; min-height: 90px;
}
.ctl-field__editor:focus { outline: 2px solid #2f5fa8; outline-offset: -2px; }
.ctl-field.is-saving .ctl-field__key::after { content: " saving…"; color: var(--ctl-draft); }
.ctl-field.is-saved .ctl-field__key::after { content: " saved"; color: var(--ctl-live); }

/* ---------- modals ---------- */
.ctl-modal__hint { font-size: .82rem; color: var(--bs-secondary-color); }
.ctl-preview {
  background: #0d0d0d; border: 1px solid var(--ctl-line); padding: .9rem;
  font-size: .78rem; line-height: 1.5; white-space: pre-wrap; word-break: break-word;
  max-height: 60vh; overflow: auto; margin: 0;
}
.ctl-key { word-break: break-all; font-size: .85rem; }

@media (max-width: 820px) {
  .ctl-body { grid-template-columns: 1fr; }
  .ctl-rail { border-right: 0; border-bottom: 1px solid var(--ctl-line); }
  .ctl-editor__head { flex-direction: column; }
}
