*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: #0f172a;
  background: #f1f5f9;
}
h1, h2, h3 { margin: 0 0 .4em; line-height: 1.25; }
a { color: var(--primary); }

/* ------------------------------------------------------------------ chrome */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 0 20px; height: 56px;
  background: var(--nav-bg); color: var(--nav-text);
}
.brand { display: flex; align-items: center; gap: 10px;
  color: inherit; text-decoration: none; font-weight: 600; }
.brand img { height: 26px; width: auto; }
.topbar-right { display: flex; align-items: center; gap: 14px; font-size: 13px; }
.who { display: flex; align-items: center; gap: 8px; opacity: .9; }
.who em { font-style: normal; opacity: .65; }

.wrap { max-width: 1100px; margin: 0 auto; padding: 32px 20px 64px; }
.page-title { font-size: 24px; margin-bottom: 20px; }

/* ------------------------------------------------------------------ buttons */
.btn {
  display: inline-block; padding: 9px 16px; border-radius: 8px;
  border: 1px solid #cbd5e1; background: #fff; color: #0f172a;
  font: inherit; font-size: 14px; cursor: pointer; text-decoration: none;
}
.btn:hover { border-color: #94a3b8; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-quiet { background: transparent; border-color: transparent; color: inherit; opacity: .85; }
.btn-quiet:hover { opacity: 1; border-color: transparent; }
.btn-block { display: block; width: 100%; }
.link { background: none; border: 0; padding: 0; color: var(--primary);
  font: inherit; font-size: 13px; cursor: pointer; text-decoration: underline; }

/* ------------------------------------------------------------------- login */
.login-body { background: #0f172a; }
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: 100%; max-width: 380px; background: #fff;
  border-radius: 14px; padding: 32px; box-shadow: 0 18px 48px rgba(0,0,0,.35); }
.login-logo { height: 34px; margin-bottom: 18px; }
.login-card h1 { font-size: 21px; }
.login-card .sub { margin: 0 0 20px; color: #64748b; font-size: 14px; }
.login-card label { display: block; font-size: 13px; font-weight: 600;
  margin: 14px 0 5px; }
.login-card input {
  width: 100%; padding: 10px 12px; font: inherit;
  border: 1px solid #cbd5e1; border-radius: 8px; background: #fff;
}
.login-card input:focus { outline: 2px solid var(--primary); outline-offset: 1px;
  border-color: var(--primary); }
.login-card button { margin-top: 22px; }
.login-card .foot { margin: 18px 0 0; font-size: 12px; color: #94a3b8;
  text-align: center; }
.alert { background: #fef2f2; border: 1px solid #fecaca; color: #b91c1c;
  padding: 10px 12px; border-radius: 8px; font-size: 13px; margin: 0 0 4px; }

/* ------------------------------------------------------------------- cards */
.grid { display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.card { display: block; background: #fff; border: 1px solid #e2e8f0;
  border-radius: 12px; padding: 18px; text-decoration: none; color: inherit;
  transition: border-color .12s, transform .12s, box-shadow .12s; }
.card:hover { border-color: var(--primary); transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(15,23,42,.07); }
.card-head { display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 10px; }
.card h2 { font-size: 17px; }
.card-sub { margin: 0; color: #64748b; font-size: 13px; }
.card-foot { display: flex; justify-content: space-between; align-items: center;
  margin-top: 16px; font-size: 12px; color: #64748b; }

.stage { font-size: 11px; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; padding: 3px 8px; border-radius: 999px; }
.stage-review { background: #fef3c7; color: #92400e; }
.stage-signed { background: #dcfce7; color: #166534; }
.tag { font-size: 11px; background: #e2e8f0; color: #475569;
  padding: 3px 8px; border-radius: 999px; }
.tag-admin { background: var(--primary); color: #fff; }
.pill { background: #e0f2fe; color: #075985; padding: 2px 8px; border-radius: 999px; }
.ok { color: #16a34a; font-weight: 600; }
.muted { color: #94a3b8; }

.empty { background: #fff; border: 1px dashed #cbd5e1; border-radius: 12px;
  padding: 48px 24px; text-align: center; color: #64748b; }
.empty h2 { font-size: 18px; color: #0f172a; }

/* ------------------------------------------------------------------ viewer */
.viewer-body { background: #e2e8f0; }
.viewer { padding: 0; }
.viewer-bar { display: flex; justify-content: space-between; align-items: center;
  gap: 16px; padding: 14px 20px; background: #fff; border-bottom: 1px solid #cbd5e1;
  flex-wrap: wrap; }
.vb-left { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.vb-left h1 { font-size: 17px; margin: 0; }
.back { font-size: 13px; text-decoration: none; color: #64748b; }
.back:hover { color: var(--primary); }
#version-select { font: inherit; font-size: 13px; padding: 5px 8px;
  border: 1px solid #cbd5e1; border-radius: 7px; background: #fff; }

.devices { display: flex; border: 1px solid #cbd5e1; border-radius: 8px;
  overflow: hidden; }
.dev { padding: 6px 12px; font: inherit; font-size: 13px; border: 0;
  background: #fff; cursor: pointer; border-right: 1px solid #e2e8f0; }
.dev:last-child { border-right: 0; }
.dev.active { background: var(--primary); color: #fff; }

.banner { padding: 10px 20px; font-size: 13px; }
.banner-ok { background: #dcfce7; color: #166534; border-bottom: 1px solid #bbf7d0; }

.viewer-split { display: grid; grid-template-columns: 1fr 340px;
  align-items: start; min-height: calc(100vh - 56px - 57px); }
.stage-pane { padding: 24px; }
.frame-holder { margin: 0 auto; background: #fff; border-radius: 10px;
  box-shadow: 0 4px 20px rgba(15,23,42,.12); overflow: hidden;
  transition: max-width .18s ease; }
.frame-holder.is-device { border: 8px solid #0f172a; border-radius: 26px; }
#design-frame { display: block; width: 100%; height: calc(100vh - 200px);
  border: 0; background: #fff; }
.hint { text-align: center; font-size: 12px; color: #64748b; margin: 12px 0 0; }

.side { background: #fff; border-left: 1px solid #cbd5e1; padding: 20px;
  align-self: stretch; }
.side-head { display: flex; justify-content: space-between; align-items: baseline; }
.side-head h2 { font-size: 15px; }

.composer { border: 1px solid var(--primary); border-radius: 10px;
  padding: 12px; margin-bottom: 12px; background: #f8fafc; }
.composer.hidden, .hidden { display: none; }
.composer-anchor { display: flex; justify-content: space-between; gap: 8px;
  font-size: 12px; font-weight: 600; color: #0369a1; margin-bottom: 8px; }
.composer textarea, .signoff-box textarea {
  width: 100%; font: inherit; font-size: 14px; padding: 8px 10px;
  border: 1px solid #cbd5e1; border-radius: 8px; resize: vertical; }
.composer-actions { display: flex; gap: 8px; margin-top: 8px; }
.composer-error { color: #b91c1c; font-size: 12px; margin: 8px 0 0; }

.comments { list-style: none; margin: 16px 0 0; padding: 0; }
.no-comments { color: #94a3b8; font-size: 13px; padding: 12px 0; }
.comment { border-top: 1px solid #e2e8f0; padding: 12px 0; }
.comment.is-resolved { opacity: .55; }
.comment.is-resolved .comment-body { text-decoration: line-through; }
.comment-head { display: flex; justify-content: space-between; gap: 8px;
  font-size: 12px; }
.comment-anchor { font-size: 11px; font-weight: 600; color: #0369a1;
  background: #e0f2fe; display: inline-block; padding: 2px 7px;
  border-radius: 999px; margin: 6px 0; cursor: pointer; }
.flag-change { font-size: 11px; color: #92400e; background: #fef3c7;
  display: inline-block; padding: 2px 7px; border-radius: 999px; margin: 4px 0; }
.comment-body { margin: 4px 0 8px; font-size: 14px; white-space: pre-wrap;
  overflow-wrap: anywhere; }
.comment-actions { display: flex; gap: 10px; align-items: center; font-size: 12px; }

.signoff-box { margin-top: 24px; padding-top: 18px; border-top: 2px solid #e2e8f0; }
.signoff-box h3 { font-size: 14px; }
.signoff-box p { font-size: 12px; color: #64748b; margin: 0 0 10px; }
.signoff-box button { margin-top: 10px; }

@media (max-width: 900px) {
  .viewer-split { grid-template-columns: 1fr; }
  .side { border-left: 0; border-top: 1px solid #cbd5e1; }
  #design-frame { height: 70vh; }
}
