:root {
  color-scheme: light;
  --bg: #f6f4ef;
  --panel: #ffffff;
  --panel-muted: #f2eee6;
  --text: #24211c;
  --muted: #756d60;
  --line: #ded6c7;
  --accent: #236c6a;
  --accent-strong: #154c4a;
  --danger: #b33131;
  --warning: #a56816;
  --success: #2f7650;
  --shadow: 0 14px 34px rgba(30, 26, 18, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

html[dir='rtl'] body {
  font-family:
    Tahoma, "Segoe UI", Arial, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    sans-serif;
}

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

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(246, 244, 239, 0.94);
  padding: 18px 28px;
  backdrop-filter: blur(12px);
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
}

h1 {
  font-size: 24px;
  line-height: 1.15;
}

h2 {
  font-size: 19px;
}

h3 {
  font-size: 15px;
}

main {
  padding: 24px 28px 44px;
}

.auth-block {
  display: flex;
  align-items: center;
  gap: 12px;
}

html[dir='rtl'] .auth-block {
  direction: ltr;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 800;
}

.status-pill.ready {
  border-color: rgba(47, 118, 80, 0.28);
  color: var(--success);
}

.status-pill.error {
  border-color: rgba(179, 49, 49, 0.28);
  color: var(--danger);
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.sign-in-panel {
  display: grid;
  grid-template-columns: minmax(240px, 360px) minmax(280px, 420px);
  gap: 24px;
  align-items: start;
  max-width: 860px;
  padding: 24px;
}

.sign-in-panel p {
  color: var(--muted);
  line-height: 1.55;
}

.hidden {
  display: none !important;
}

.workspace {
  display: grid;
  gap: 16px;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  border-bottom: 1px solid var(--line);
}

.tab {
  border: 1px solid transparent;
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  background: transparent;
  color: var(--muted);
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 800;
}

.tab.active {
  border-color: var(--line);
  background: var(--panel);
  color: var(--text);
}

.message {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 12px 14px;
  color: var(--muted);
  font-size: 13px;
  white-space: pre-wrap;
}

.message.error {
  border-color: rgba(179, 49, 49, 0.25);
  color: var(--danger);
}

.message.success {
  border-color: rgba(47, 118, 80, 0.25);
  color: var(--success);
}

.tab-panel {
  display: none;
}

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

.grid {
  display: grid;
  gap: 16px;
}

.grid.two {
  grid-template-columns: minmax(280px, 0.7fr) minmax(360px, 1fr);
}

.grid.three {
  grid-template-columns: repeat(3, minmax(260px, 1fr));
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.btn {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
  color: var(--text);
  padding: 8px 11px;
  font-size: 13px;
  font-weight: 800;
}

.btn.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.btn.danger {
  border-color: rgba(179, 49, 49, 0.35);
  color: var(--danger);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 14px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.list {
  display: grid;
  gap: 8px;
  max-height: 540px;
  overflow: auto;
  padding-right: 3px;
}

.list-item {
  display: grid;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fffdf8;
  padding: 9px 10px;
  text-align: left;
}

html[dir='rtl'] .list-item {
  text-align: right;
}

.list-item.active {
  border-color: var(--accent);
  box-shadow: inset 3px 0 0 var(--accent);
}

html[dir='rtl'] .list-item.active {
  box-shadow: inset -3px 0 0 var(--accent);
}

.list-item strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.meta {
  color: var(--muted);
  font-size: 12px;
}

.pill {
  display: inline-flex;
  width: max-content;
  border-radius: 999px;
  background: var(--panel-muted);
  padding: 3px 7px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.pill.published,
.pill.enabled {
  background: rgba(47, 118, 80, 0.12);
  color: var(--success);
}

.pill.archived,
.pill.disabled {
  background: rgba(179, 49, 49, 0.1);
  color: var(--danger);
}

.form {
  display: grid;
  gap: 11px;
}

.field {
  display: grid;
  gap: 5px;
}

.field label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--text);
  padding: 9px 10px;
  outline: none;
}

.field textarea {
  min-height: 88px;
  resize: vertical;
}

.field .json-input {
  min-height: 210px;
  font-family:
    "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 1.55;
  direction: ltr;
  text-align: left;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(35, 108, 106, 0.12);
}

.inline-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.table-wrap {
  max-height: 540px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
  font-size: 13px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 9px 10px;
  text-align: left;
  vertical-align: top;
}

html[dir='rtl'] th,
html[dir='rtl'] td {
  text-align: right;
}

th {
  position: sticky;
  top: 0;
  background: #fbfaf7;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.muted {
  color: var(--muted);
}

.import-card {
  margin-bottom: 16px;
}

.import-card .card-header {
  align-items: start;
}

.import-card p {
  margin: 6px 0 0;
  line-height: 1.55;
}

.question-tools {
  display: grid;
  gap: 9px;
  margin-bottom: 10px;
}

.advanced-fields {
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fffdf8;
  padding: 9px 10px;
}

.advanced-fields summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.advanced-fields[open] {
  display: grid;
  gap: 11px;
}

.advanced-fields[open] summary {
  margin-bottom: 2px;
}

.media-editor {
  display: grid;
  gap: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf7;
  padding: 12px;
}

.media-editor h4 {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.media-preview {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 8px;
}

.media-preview-image {
  width: 96px;
  height: 72px;
  border-radius: 6px;
  object-fit: cover;
  background: var(--panel-muted);
}

.media-preview-audio {
  width: 100%;
  min-width: 96px;
}

.media-preview .meta {
  overflow-wrap: anywhere;
}

@media (max-width: 980px) {
  .grid.two,
  .grid.three,
  .sign-in-panel {
    grid-template-columns: 1fr;
  }

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

  .media-preview {
    grid-template-columns: 1fr;
  }
}
