:root {
  --bg: #07141c;
  --bg-2: #0d1e28;
  --bg-3: #132833;
  --line: #1f3a46;
  --text: #e7f6f8;
  --muted: #8fb3bb;
  --accent: #2ad4e0;
  --accent-2: #1298a8;
  --ok: #3dd68c;
  --warn: #f5c14c;
  --danger: #ef7a6b;
  --glow: 0 0 24px rgba(42, 212, 224, .18);
  font-family: "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
button, input, select { font: inherit; }
.hidden { display: none !important; }

.gate {
  min-height: 100%;
  display: grid;
  place-items: center;
  background:
    radial-gradient(900px 420px at 50% -10%, rgba(42,212,224,.16), transparent 55%),
    var(--bg);
}
.gate-card, .hero-panel, .admin section {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--glow);
}
.gate-card { width: min(420px, 92vw); padding: 36px 32px 28px; text-align: center; }
.logo { width: 88px; height: 88px; border-radius: 50%; }
.logo-sm { width: 36px; height: 36px; border-radius: 50%; }
.pro-pill {
  display: inline-block; margin-top: 10px;
  padding: 2px 8px; border-radius: 999px;
  background: linear-gradient(90deg, #2ad4e0, #7af0c0);
  color: #042026; font-size: 11px; font-weight: 800; letter-spacing: .12em;
}
h1 { margin: 10px 0 6px; font-size: 28px; }
.lede, .muted, .hint { color: var(--muted); line-height: 1.5; }
.stack { display: grid; gap: 10px; text-align: left; margin-top: 18px; }
label { display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
input, select {
  background: var(--bg-3); border: 1px solid var(--line); color: var(--text);
  border-radius: 8px; padding: 8px 10px;
}
.primary, .ghost, .tool, .menu-link, .avatar-btn {
  border: 1px solid var(--line);
  background: var(--bg-3);
  color: var(--text);
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
}
.primary { background: linear-gradient(180deg, #1bb8c6, #0e7e8c); border-color: transparent; font-weight: 700; }

#app-shell { height: 100%; display: flex; flex-direction: column; }
.appbar {
  display: flex; align-items: center; gap: 16px;
  padding: 8px 14px; background: #061017; border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.product { font-weight: 700; }
.product span { color: var(--accent); }
.menu { display: flex; gap: 6px; flex: 1; }
.menu-link.active { border-color: var(--accent); color: var(--accent); }
.profile { position: relative; }
.avatar-btn { display: flex; align-items: center; gap: 8px; }
.avatar {
  width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center; font-size: 12px; font-weight: 700;
  background: #13454d; color: var(--accent);
}
.menu-pop {
  position: absolute; right: 0; top: 42px; width: 220px;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px;
  padding: 8px; z-index: 20; display: grid;
}
.menu-pop button { background: transparent; border: 0; color: var(--text); text-align: left; padding: 8px; border-radius: 6px; cursor: pointer; }
.menu-role { font-size: 11px; color: var(--muted); padding: 4px 8px 8px; }

.home { padding: 28px; overflow: auto; }
.hero-panel { max-width: 720px; margin: 24px auto; padding: 28px; display: grid; gap: 16px; }
.drop {
  display: grid; gap: 6px; place-items: center;
  border: 1.5px dashed var(--line); border-radius: 12px; padding: 36px 16px;
  cursor: pointer; background: #0b222b;
}
.drop:hover, .drop.over { border-color: var(--accent); }
.home-actions { display: flex; gap: 8px; }

.admin { padding: 20px; overflow: auto; }
.admin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.admin section { padding: 16px; }
.table { margin-top: 14px; display: grid; gap: 8px; }
.row {
  display: grid; grid-template-columns: 1.1fr .8fr .7fr auto; gap: 8px; align-items: center;
  background: #0b222b; border: 1px solid var(--line); border-radius: 8px; padding: 8px; font-size: 13px;
}
.role-card { border: 1px solid var(--line); border-radius: 10px; padding: 10px; margin-bottom: 10px; background: #0b222b; }
.checks { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-top: 8px; font-size: 12px; color: var(--muted); }

.studio { height: 100%; display: flex; flex-direction: column; min-height: 0; }
.ribbon {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; background: var(--bg-2); border-bottom: 1px solid var(--line);
}
.doc-chip { min-width: 160px; }
.doc-chip strong { display: block; font-size: 13px; }
.doc-chip span { color: var(--muted); font-size: 11px; }
.tools { display: flex; align-items: center; gap: 4px; flex: 1; flex-wrap: wrap; justify-content: center; }
.tool.active { background: #164954; border-color: var(--accent); color: var(--accent); }
.tool.icon { width: 32px; padding: 8px 0; }
.sep { width: 1px; height: 22px; background: var(--line); margin: 0 6px; }
.zoom-label { font-size: 12px; color: var(--muted); min-width: 48px; text-align: center; }
.actions { display: flex; gap: 6px; }

.workspace { flex: 1; display: grid; grid-template-columns: 168px 1fr 280px; min-height: 0; }
.thumbs { background: #061017; border-right: 1px solid var(--line); overflow: auto; padding: 10px; }
.thumb {
  background: #0b222b; border: 1px solid var(--line); border-radius: 8px;
  padding: 6px; margin-bottom: 10px; cursor: pointer; color: var(--muted); font-size: 11px; text-align: center;
}
.thumb.active { border-color: var(--accent); color: var(--text); box-shadow: var(--glow); }
.thumb canvas { width: 100%; height: auto; display: block; border-radius: 4px; margin-bottom: 6px; background: white; }

.stage {
  overflow: auto;
  background-color: #08151c;
  display: grid; place-items: start center; padding: 28px;
}
.page-wrap { position: relative; box-shadow: 0 16px 50px rgba(0,0,0,.45); background: white; }
#page-canvas { display: block; }
.overlay { position: absolute; inset: 0; }

.block {
  position: absolute; border: 1px solid transparent; color: transparent;
  caret-color: #1298a8; overflow: visible; white-space: pre; line-height: 1.15;
  padding: 0; margin: 0; background: transparent; outline: none;
  pointer-events: none; z-index: 2; border-radius: 2px;
}
.studio.mode-edit .block { pointer-events: auto; cursor: text; }
.studio.mode-edit .block:hover { box-shadow: inset 0 0 0 1px rgba(42,212,224,.6); background: rgba(42,212,224,.08); }
.studio.mode-edit .block.active,
.studio.mode-edit .block:focus {
  z-index: 5; background: #fff; color: #111;
  box-shadow: 0 0 0 2px #1298a8, 0 8px 18px rgba(15,23,42,.18);
}
.studio.mode-edit .block.dirty { background: #f3fff8; color: #111; box-shadow: inset 0 -2px 0 #16a34a; }
.studio.mode-edit .block.dirty::after {
  content: "Edited"; position: absolute; top: -11px; right: -2px;
  background: #16a34a; color: #fff; font-size: 8px; font-weight: 700;
  letter-spacing: .04em; text-transform: uppercase; line-height: 1;
  padding: 2px 4px; border-radius: 2px; pointer-events: none;
}
.image-box { position: absolute; border: 1px dashed transparent; cursor: grab; pointer-events: none; z-index: 1; }
.studio.mode-image .image-box { pointer-events: auto; border-color: #7ad0ff; background: rgba(122,208,255,.12); }
.annot-box { position: absolute; pointer-events: none; }
.annot-box.highlight { background: rgba(255, 230, 80, .35); }
.annot-box.note { background: #f5c14c; width: 14px; height: 14px; border-radius: 2px; }
.drag-rect { position: absolute; border: 1px solid #f5c14c; background: rgba(245,193,76,.2); pointer-events: none; }
.check { display: flex !important; flex-direction: row !important; align-items: center; gap: 8px; color: var(--text) !important; }

.props { background: var(--bg-2); border-left: 1px solid var(--line); padding: 16px; overflow: auto; }
.props h2 { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0 0 10px; }
.status { margin-top: 16px; font-size: 12px; color: var(--ok); min-height: 1.4em; }
.status.warn { color: var(--warn); }
.status.err { color: var(--danger); }

dialog { border: 1px solid var(--line); border-radius: 14px; background: var(--bg-2); color: var(--text); width: min(420px, 92vw); padding: 0; }
dialog::backdrop { background: rgba(0,0,0,.55); }
#dialog-form { padding: 18px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
@media (max-width: 1100px) {
  .workspace { grid-template-columns: 132px 1fr 220px; }
  .admin-grid { grid-template-columns: 1fr; }
}
