:root {
  --bg:     #ecebe8;
  --panel:  #ffffff;
  --stage:  #e7e6e2;
  --ink:    #2a2926;
  --muted:  #918e88;
  --faint:  #b4b1aa;
  --line:   #e4e2dd;
  --tint:   #f5f4f1;
  --accent: #436074;
  --dark:   #32312e;
}

* { box-sizing: border-box; }

html, body { height: 100%; margin: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Helvetica, Arial, sans-serif;
  font-size: 14px;
  color: var(--ink);
  background: var(--bg);
  display: flex;
  flex-direction: column;
}

code {
  font-family: "SFMono-Regular", Consolas, Menlo, monospace;
  font-size: 0.9em;
  background: var(--tint);
  padding: 1px 4px;
  border-radius: 2px;
}

/* topbar */
.topbar {
  flex: 0 0 auto;
  padding: 14px 20px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.topbar__title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.about-link {
  font: inherit;
  font-size: 12.5px;
  color: var(--accent);
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
}
.about-link:hover { color: var(--ink); }

/* layout */
.layout {
  flex: 1 1 auto;
  display: flex;
  min-height: 0;
}

/* sidebar */
.sidebar {
  flex: 0 0 290px;
  background: var(--panel);
  border-right: 1px solid var(--line);
  overflow-y: auto;
}
.sidebar__head { padding: 13px 16px 7px; }
.sidebar__head span {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--faint);
}

.list { list-style: none; margin: 0; padding: 0; }
.list__item {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.list__item:hover { background: var(--tint); }
.list__item.is-active {
  background: var(--tint);
  box-shadow: inset 2px 0 0 var(--accent);
}
.list__name { font-size: 13.5px; font-weight: 600; }
.list__subject {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* status badge */
.badge {
  align-self: flex-start;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 6px;
  border-radius: 3px;
}
.badge--draft    { background: #eceae5; color: #7a766e; }
.badge--review   { background: #f1e7cf; color: #846728; }
.badge--approved { background: #dde8de; color: #4a6b4f; }

/* preview */
.preview {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.preview__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.controls {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 16px;
}

.toggle {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
}
.toggle button {
  font: inherit;
  font-size: 12.5px;
  padding: 5px 12px;
  border: 0;
  background: var(--panel);
  color: var(--muted);
  cursor: pointer;
}
.toggle button + button { border-left: 1px solid var(--line); }
.toggle button.is-active { background: var(--dark); color: #fff; }

.link {
  font-size: 12.5px;
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
}
.link:hover { text-decoration: underline; }

/* stage */
.preview__stage {
  flex: 1 1 auto;
  overflow-y: auto;
  background: var(--stage);
  padding: 28px 20px;
}
.frame {
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  transition: width 0.12s ease;
}
.frame--mobile { width: 375px; }
.frame iframe {
  display: block;
  width: 100%;
  border: 0;
  min-height: 300px;
  overflow: hidden;
}

.empty {
  max-width: 340px;
  margin: 64px auto;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

/* intro modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(20, 19, 17, 0.55);
}
.modal[hidden] { display: none; }
.modal__box {
  width: 100%;
  max-width: 460px;
  padding: 26px 30px 24px;
  background: var(--panel);
  border-radius: 4px;
  box-shadow: 0 12px 44px rgba(0, 0, 0, 0.28);
}
.modal__title {
  margin: 0 0 14px;
  font-size: 16px;
  font-weight: 600;
}
.modal__box p {
  margin: 0 0 12px;
  font-size: 13px;
  line-height: 1.65;
}
.modal__box p:last-of-type { color: var(--muted); }
.modal__close {
  margin-top: 6px;
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  color: #fff;
  background: var(--dark);
  border: 0;
  border-radius: 4px;
  padding: 9px 18px;
  cursor: pointer;
}
.modal__close:hover { background: #000; }
