/* ============================================================
   quickhost.my — design system
   Dark-first chrome, single-accent pink, Geist + Geist Mono.
   The hosted document keeps its own theme (themes.js); this
   stylesheet only dresses the tool around it.
   ============================================================ */

:root {
  --canvas: #0A0B0D;
  --surface-1: #131519;
  --surface-2: #1A1D23;
  --border: rgba(255, 255, 255, .08);
  --border-strong: rgba(255, 255, 255, .14);
  --text: #ECEDEE;
  --muted: #9BA1A8;
  --faint: #6B7280;
  --accent: #EC4899;
  --accent-hi: #F472B6;
  --accent-soft: rgba(236, 72, 153, .14);
  --success: #34D399;
  --error: #F87171;
  --amber: #F5A623;
  --on-accent: #ffffff;
  --ladder: inset 0 1px 0 rgba(255, 255, 255, .04);
  --overlay-shadow: 0 12px 40px rgba(0, 0, 0, .55), 0 2px 8px rgba(0, 0, 0, .4);
  --glow-1: radial-gradient(1100px 640px at 20% -4%, rgba(236, 72, 153, .36), transparent 64%);
  --glow-2: radial-gradient(1000px 660px at 104% 6%, rgba(124, 110, 232, .30), transparent 62%);
  --glow-3: radial-gradient(900px 540px at 18% 88%, rgba(250, 204, 21, .24), transparent 62%);
  --r-card: 12px;
  --r-ctrl: 8px;
  --r-pill: 9999px;
  --ease: cubic-bezier(.2, .6, .2, 1);
  --font-sans: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --font-mono: "Geist Mono", "SF Mono", Menlo, Consolas, monospace;
}

html[data-theme="light"] {
  --canvas: #FBFBFA;
  --surface-1: #FFFFFF;
  --surface-2: #F4F4F5;
  --border: rgba(0, 0, 0, .08);
  --border-strong: rgba(0, 0, 0, .14);
  --text: #18181B;
  --muted: #52525B;
  --faint: #A1A1AA;
  --accent: #DB2777;
  --accent-hi: #EC4899;
  --accent-soft: rgba(219, 39, 119, .10);
  --success: #059669;
  --error: #DC2626;
  --amber: #B45309;
  --on-accent: #ffffff;
  --ladder: inset 0 1px 0 rgba(255, 255, 255, .6);
  --overlay-shadow: 0 12px 40px rgba(0, 0, 0, .14), 0 2px 8px rgba(0, 0, 0, .08);
  --glow-1: radial-gradient(1100px 640px at 20% -4%, rgba(219, 39, 119, .26), transparent 64%);
  --glow-2: radial-gradient(1000px 660px at 104% 6%, rgba(124, 110, 232, .22), transparent 62%);
  --glow-3: radial-gradient(900px 540px at 18% 88%, rgba(234, 179, 8, .16), transparent 62%);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: var(--canvas);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  transition: background .25s var(--ease), color .25s var(--ease);
}

body {
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 0;
}
/* two slowly drifting glow layers — subtle ambient motion */
body::before,
body::after {
  content: "";
  position: fixed;
  inset: -25%;
  z-index: -1;
  pointer-events: none;
  will-change: transform;
}
body::before { background: var(--glow-1); animation: qh-drift-a 20s ease-in-out infinite alternate; }
body::after { background: var(--glow-2), var(--glow-3); animation: qh-drift-b 26s ease-in-out infinite alternate; }
@keyframes qh-drift-a {
  from { transform: translate3d(0, 0, 0) scale(1); opacity: .8; }
  to { transform: translate3d(11%, 7%, 0) scale(1.3); opacity: 1; }
}
@keyframes qh-drift-b {
  from { transform: translate3d(0, 0, 0) scale(1.2); opacity: 1; }
  to { transform: translate3d(-11%, 6%, 0) scale(1); opacity: .75; }
}
@media (prefers-reduced-motion: reduce) {
  body::before, body::after { animation: none; }
}

.mono { font-family: var(--font-mono); }
button { font-family: inherit; cursor: pointer; color: inherit; }
a { color: inherit; text-decoration: none; }
::selection { background: var(--accent-soft); }

/* ============ TOP BAR ============ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  padding: 0 24px;
  background: color-mix(in srgb, var(--canvas) 82%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}

.qh-wordmark {
  display: inline-flex;
  align-items: baseline;
  gap: .35em;
  font-weight: 600;
  font-size: 16px;
  letter-spacing: -.01em;
  user-select: none;
}
.qh-wordmark .q { color: var(--accent); }
.qh-wordmark .rest { color: var(--text); }

.topbar-right { display: flex; align-items: center; gap: 8px; }

.navlink {
  padding: 7px 12px;
  border-radius: var(--r-ctrl);
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  transition: color .16s var(--ease), background .16s var(--ease);
}
.navlink:hover { color: var(--text); background: var(--surface-2); }
.navlink.active { color: var(--text); }
.navlink[hidden] { display: none; }

.iconbtn {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  background: var(--surface-1);
  border-radius: var(--r-ctrl);
  color: var(--muted);
  font-size: 14px;
  transition: color .16s var(--ease), border-color .16s var(--ease), transform .16s var(--ease);
}
.iconbtn:hover { color: var(--text); border-color: var(--border-strong); transform: translateY(-1px); }

.topbar-auth { display: inline-flex; align-items: center; }

/* ---- auth control (lives in the top bar) ---- */
.auth-widget { display: inline-flex; align-items: center; position: relative; }

.auth-signin {
  display: inline-block;
  padding: 7px 14px;
  border-radius: var(--r-ctrl);
  font-size: 14px;
  font-weight: 600;
  background: var(--accent);
  color: var(--on-accent);
  transition: background .16s var(--ease), transform .16s var(--ease);
}
.auth-signin:hover { background: var(--accent-hi); transform: translateY(-1px); }

.auth-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--r-pill);
  border: 1px solid var(--border-strong);
  background: linear-gradient(135deg, var(--accent), var(--accent-hi));
  color: #fff;
  font-weight: 600;
  font-size: 13px;
  display: grid;
  place-items: center;
  padding: 0;
  transition: transform .16s var(--ease);
}
.auth-avatar:hover { transform: translateY(-1px); }

.auth-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 220px;
  background: var(--surface-1);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-ctrl);
  box-shadow: var(--overlay-shadow);
  overflow: hidden;
  z-index: 50;
}
.auth-menu[hidden] { display: none; }

.auth-menu-email {
  padding: 11px 14px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  word-break: break-all;
}

.auth-menu-item {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  padding: 10px 14px;
}
.auth-menu-item:hover { background: var(--surface-2); color: var(--accent); }

/* ============ LAYOUT ============ */
main {
  flex: 1;
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 40px 24px 96px;
  transition: max-width .22s var(--ease);
}
main.preview-open { max-width: 1120px; }
.workspace-main { max-width: 1120px; }

footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .6rem;
  text-align: center;
  color: var(--faint);
  font-size: 13px;
  padding: 2rem 1rem 2.5rem;
}
.footer-cli, .footer-tag { color: var(--muted); }
.footer-cli { transition: color .16s var(--ease); }
.footer-cli:hover { color: var(--accent); }
.footer-tag { opacity: .8; }

/* ============ HERO ============ */
header { text-align: center; margin-bottom: 22px; position: relative; }

header h1 {
  margin: 0 0 10px;
  font-size: 32px;
  font-weight: 600;
  letter-spacing: -.03em;
  line-height: 1.12;
}
header h1 .quick { color: var(--accent); }
.home-link { color: inherit; }

.tag {
  margin: 0;
  color: var(--muted);
  font-size: 16px;
}

/* "works with your agent" — overlapping logo chips */
.hero-agents {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 22px;
}
.agent-chips { display: inline-flex; }
.agent-chip {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  margin-left: -9px;
  background: var(--surface-1);
  border: 1px solid var(--border-strong);
  box-shadow: var(--ladder), 0 2px 6px rgba(0, 0, 0, .18);
  color: var(--muted);
  transition: transform .2s var(--ease), margin-left .2s var(--ease), color .18s var(--ease), border-color .18s var(--ease);
}
.agent-chip:first-child { margin-left: 0; }
.agent-chip i {
  width: 15px;
  height: 15px;
  display: block;
  background: currentColor;
  -webkit-mask: var(--logo) center / contain no-repeat;
  mask: var(--logo) center / contain no-repeat;
}
.agent-chips:hover .agent-chip { margin-left: 4px; }
.agent-chips:hover .agent-chip:first-child { margin-left: 0; }
.agent-chip:hover {
  color: var(--text);
  border-color: var(--text);
  transform: translateY(-3px);
  z-index: 1;
}
.agent-label { font-size: 13px; color: var(--faint); }

/* benefits strip — quiet, below the composer */
.benefits { margin: 40px 0 0; text-align: center; }
.benefits-head {
  margin: 0 0 20px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .01em;
  color: var(--muted);
}
.benefits-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px 18px;
  text-align: left;
}
.benefit { display: flex; flex-direction: column; gap: 7px; }
.benefit-ico { width: 20px; height: 20px; color: var(--accent); opacity: .85; }
.benefit-ico svg { width: 100%; height: 100%; display: block; }
.benefit-title { font-size: 13.5px; font-weight: 600; color: var(--text); }
.benefit-sub { font-size: 12.5px; line-height: 1.4; color: var(--faint); }
@media (max-width: 680px) { .benefits-grid { grid-template-columns: repeat(2, 1fr); } }

/* a single soft accent glow sits behind the hero/composer */
.hero-glow {
  position: absolute;
  left: 50%;
  top: -30px;
  transform: translateX(-50%);
  width: 620px;
  max-width: 100%;
  height: 320px;
  pointer-events: none;
  z-index: -1;
  background: radial-gradient(ellipse at center, var(--accent-soft) 0%, transparent 68%);
  filter: blur(10px);
}

/* ============ CARD + TOOLBAR (was .window/.titlebar) ============ */
.window {
  position: relative;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  box-shadow: var(--ladder);
  overflow: hidden;
}

.titlebar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: .75rem;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.dots { display: none; }

.titlebar-title {
  text-align: center;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--faint);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.titlebar-actions { display: flex; align-items: center; gap: .5rem; }
.titlebar-spacer { width: 1px; }

/* type picker (pill dropdown, lives in the composer toolbar) */
.picker-wrap { position: relative; display: inline-flex; }

.type-picker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px 6px 12px;
  border-radius: var(--r-pill);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  transition: border-color .16s var(--ease);
}
.type-picker:hover { border-color: var(--border-strong); }
.type-picker .chev { color: var(--faint); font-size: 10px; transition: transform .16s var(--ease); }
.type-picker[aria-expanded="true"] .chev { transform: rotate(180deg); }
#type-label { color: var(--accent); font-weight: 600; }

.type-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 150px;
  z-index: 30;
  list-style: none;
  margin: 0;
  padding: 4px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-ctrl);
  box-shadow: var(--overlay-shadow);
}
.type-menu[hidden] { display: none; }
.type-menu li {
  padding: 7px 10px;
  border-radius: 6px;
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
}
.type-menu li:hover { background: var(--surface-1); color: var(--text); }
.type-menu li[aria-selected="true"] { color: var(--text); }

.preview-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: var(--r-ctrl);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  transition: color .16s var(--ease), border-color .16s var(--ease);
}
.preview-toggle:hover { color: var(--text); border-color: var(--border-strong); }
.preview-toggle[aria-expanded="true"] { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
.preview-toggle-chev { font-size: 10px; transition: transform .2s var(--ease); display: inline-block; }
.preview-toggle[aria-expanded="true"] .preview-toggle-chev { transform: rotate(90deg); }

.workspace-link {
  padding: 6px 10px;
  border-radius: var(--r-ctrl);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}
.workspace-link:hover { color: var(--text); border-color: var(--border-strong); }
.workspace-link[hidden] { display: none; }

/* ============ SLIDES HINT ============ */
.hintbar {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--accent-soft);
  font-size: 13px;
  color: var(--text);
}
.hintbar[hidden] { display: none; }
.hintbar span { flex: 1; }
.hintbar button {
  padding: 5px 11px;
  border-radius: var(--r-ctrl);
  border: 1px solid var(--border-strong);
  background: var(--surface-1);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 500;
}
.hintbar button:hover { border-color: var(--accent); color: var(--accent); }

/* ============ COMPOSER ============ */
.composer-body {
  position: relative;
  display: grid;
  grid-template-columns: 1fr;
  transition: grid-template-columns .25s var(--ease);
  background: var(--surface-1);
}
main.preview-open .composer-body { grid-template-columns: 1fr 1fr; }

#content {
  display: block;
  width: 100%;
  min-height: 320px;
  min-width: 0;
  border: 0;
  outline: 0;
  resize: vertical;
  background: transparent;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13.5px;
  line-height: 1.7;
  padding: 20px 22px;
}
#content::placeholder { color: var(--faint); }
#content.drag {
  outline: 2px solid color-mix(in srgb, var(--accent) 55%, var(--border));
  outline-offset: -8px;
  background: var(--accent-soft);
}

.composer-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  padding: 24px;
  pointer-events: none;
  color: var(--muted);
}
.composer-empty[hidden] { display: none; }
.composer-empty .dz-glyph {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background: var(--accent-soft);
  color: var(--accent);
  margin-bottom: 4px;
}
.composer-empty .dz-title { font-size: 15px; font-weight: 500; color: var(--text); }
.composer-empty .dz-sub { font-size: 12.5px; color: var(--faint); }
.composer-empty button {
  pointer-events: auto;
  background: transparent;
  border: 0;
  padding: 0;
  font: inherit;
  color: var(--accent);
  font-weight: 500;
  cursor: pointer;
}
.composer-empty button:hover { color: var(--accent-hi); }

.preview-pane {
  display: none;
  position: relative;
  border-left: 1px solid var(--border);
  background: var(--surface-1);
  min-width: 0;
}
main.preview-open .preview-pane { display: flex; flex-direction: column; }
.preview-pane[hidden] { display: none; }

.preview-bar {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  display: flex;
  gap: 6px;
}
.preview-icon-btn {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  border: 1px solid var(--border-strong);
  background: color-mix(in srgb, var(--surface-1) 86%, transparent);
  backdrop-filter: blur(6px);
  color: var(--text);
  font-size: 14px;
}
.preview-icon-btn:hover { background: var(--surface-2); }

#preview-frame {
  flex: 1;
  width: 100%;
  min-height: 320px;
  border: 0;
  background: #fff;
  display: block;
}

/* ============ SETTINGS ============ */
.settings {
  padding: 18px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface-1);
  display: grid;
  gap: 14px;
}

.row {
  display: grid;
  grid-template-columns: 96px 1fr;
  align-items: center;
  gap: 16px;
}
.row[hidden] { display: none; }

.row-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--faint);
}

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

.chip {
  padding: 6px 13px;
  border-radius: var(--r-pill);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  transition: color .14s var(--ease), border-color .14s var(--ease), background .14s var(--ease);
}
.chip:hover { color: var(--text); border-color: var(--border-strong); }

#expiry .chip.active,
#comments-toggle .chip.active,
#download-toggle .chip.active {
  background: var(--accent);
  color: var(--on-accent);
  border-color: var(--accent);
}

.pw-input,
.expiry-custom-input {
  width: 100%;
  max-width: 320px;
  padding: 8px 12px;
  border-radius: var(--r-ctrl);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13.5px;
  outline: 0;
  transition: border-color .16s var(--ease), box-shadow .16s var(--ease);
}
.pw-input::placeholder { color: var(--faint); }
.pw-input:focus,
.expiry-custom-input:focus {
  border-color: color-mix(in srgb, var(--accent) 50%, var(--border));
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.expiry-custom-input { max-width: 160px; }
.expiry-custom-input[hidden] { display: none; }
.expiry-custom-input.invalid { border-color: var(--error); }

/* theme chips preview their own look, on a clean dark control */
#themes .chip {
  border-radius: var(--r-ctrl);
  border: 1px solid var(--border-strong);
}
#themes .chip[data-theme="clean"]     { background: #fff; color: #1a1a1a; font-family: var(--font-sans); }
#themes .chip[data-theme="paper"]     { background: #f7f1e3; color: #2d1f0f; font-family: "Iowan Old Style", Palatino, Georgia, serif; }
#themes .chip[data-theme="dark"]      { background: #0a0a0a; color: #e4e4e7; font-family: var(--font-sans); }
#themes .chip[data-theme="terminal"]  { background: #000; color: #00ff41; font-family: var(--font-mono); text-transform: uppercase; }
#themes .chip[data-theme="retro"]     { background: #fff; color: #ec4899; font-family: "Silkscreen", system-ui, sans-serif; }
#themes .chip[data-theme="black"]     { background: #191919; color: #fff; font-family: var(--font-sans); }
#themes .chip[data-theme="white"]     { background: #fff; color: #222; font-family: var(--font-sans); }
#themes .chip[data-theme="moon"]      { background: #002b36; color: #93a1a1; font-family: var(--font-sans); }
#themes .chip[data-theme="solarized"] { background: #fdf6e3; color: #586e75; font-family: var(--font-sans); }
#themes .chip.active {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.chip-custom {
  border-style: dashed !important;
  color: var(--muted);
}
.chip-custom.active { border-style: solid !important; color: var(--text); outline: none; }

/* tweak popover */
.tweak-popover {
  position: fixed;
  z-index: 100;
  min-width: 280px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  background: var(--surface-1);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-card);
  box-shadow: var(--overlay-shadow);
}
.tweak-popover[hidden] { display: none; }
.tweak-popover-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tweak-popover-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--faint);
  min-width: 42px;
}
#fonts .chip[data-font="sans"]    { font-family: var(--font-sans); }
#fonts .chip[data-font="serif"]   { font-family: "Iowan Old Style", Palatino, Georgia, serif; }
#fonts .chip[data-font="mono"]    { font-family: var(--font-mono); }
#fonts .chip[data-font="display"] { font-family: "Silkscreen", system-ui, sans-serif; }
#fonts .chip.active { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }

.color-slots { display: flex; gap: 8px; }
.color-slot {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px 6px 8px;
  border-radius: var(--r-ctrl);
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-family: var(--font-mono);
  font-size: 12.5px;
  cursor: pointer;
}
.color-slot:hover { border-color: var(--border-strong); }
.color-slot input[type=color] { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; border: 0; padding: 0; }
.color-slot .swatch {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: 1px solid var(--border-strong);
  flex-shrink: 0;
  background:
    linear-gradient(45deg, #888 25%, transparent 25%),
    linear-gradient(-45deg, #888 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #888 75%),
    linear-gradient(-45deg, transparent 75%, #888 75%);
  background-size: 6px 6px;
  background-position: 0 0, 0 3px, 3px -3px, -3px 0;
}
.color-slot[data-set="true"] .swatch { background-image: none; }
.color-slot[data-set="false"] .slot-name { color: var(--faint); }

.tweak-reset {
  align-self: flex-end;
  background: transparent;
  border: 0;
  color: var(--muted);
  font-size: 12.5px;
}
.tweak-reset:hover { color: var(--accent); }
.tweak-reset[hidden] { display: none; }

/* ============ ACTIONS BAR ============ */
.actions-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface-1);
}

#submit {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 24px;
  border: 0;
  border-radius: var(--r-ctrl);
  background: var(--accent);
  color: var(--on-accent);
  font-size: 14px;
  font-weight: 600;
  transition: background .16s var(--ease), transform .16s var(--ease), box-shadow .16s var(--ease);
}
#submit:hover:not(:disabled) { background: var(--accent-hi); transform: translateY(-1px); box-shadow: 0 6px 18px var(--accent-soft); }
#submit:disabled { opacity: .5; cursor: not-allowed; }

.hint { margin: 0; color: var(--faint); font-size: 13px; display: flex; align-items: center; gap: 6px; }
kbd {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 2px 6px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface-2);
}

.error { margin: 0; color: var(--error); font-size: 13px; font-family: var(--font-mono); }

/* ============ RESULT ============ */
.result-body { padding: 36px 32px 40px; text-align: center; }

.success-banner {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 0 0 22px;
  padding: 5px 12px;
  border-radius: var(--r-pill);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--success);
  background: color-mix(in srgb, var(--success) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--success) 30%, transparent);
}
.success-banner::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--success) 55%, transparent); }
  70% { box-shadow: 0 0 0 8px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

.lock-badge { margin: -8px 0 16px; font-family: var(--font-mono); font-size: 13px; color: var(--muted); }
.lock-badge[hidden] { display: none; }

.link-box {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--border);
  border-radius: var(--r-ctrl);
  overflow: hidden;
  background: var(--surface-2);
}
.link-box a {
  flex: 1;
  min-width: 0;
  padding: 12px 14px;
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--text);
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.link-box button,
#copy-pw {
  border: 0;
  border-left: 1px solid var(--border);
  background: var(--accent);
  color: var(--on-accent);
  font-size: 13px;
  font-weight: 600;
  padding: 0 18px;
  transition: background .16s var(--ease);
}
.link-box button:hover, #copy-pw:hover { background: var(--accent-hi); }

.pw-display {
  display: flex;
  align-items: stretch;
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-ctrl);
  overflow: hidden;
  background: var(--surface-2);
}
.pw-display[hidden] { display: none; }
.pw-display-label {
  display: inline-flex;
  align-items: center;
  padding: 0 14px;
  border-right: 1px solid var(--border);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--faint);
}
#result-pw {
  flex: 1;
  min-width: 0;
  border: 0;
  padding: 12px 14px;
  background: transparent;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 14px;
  outline: 0;
}

.aux-link {
  display: inline-block;
  margin: 12px auto 0;
  background: transparent;
  border: 0;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
}
.aux-link:hover { color: var(--accent); }
.aux-link[hidden] { display: none; }

.expiry-note { margin: 18px 0; color: var(--muted); font-size: 13px; }
.expiry-note .mono { color: var(--text); }

#qr { display: flex; justify-content: center; padding: 8px 0 22px; }
#qr svg {
  width: 132px;
  height: 132px;
  padding: 10px;
  background: #fff;
  border-radius: 10px;
}

.actions { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.actions a, .actions button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 16px;
  border: 1px solid var(--border);
  border-radius: var(--r-ctrl);
  background: var(--surface-2);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  transition: border-color .16s var(--ease), transform .16s var(--ease);
}
.actions a:hover, .actions button:hover { border-color: var(--border-strong); transform: translateY(-1px); }

/* claim prompt — "save to your docs?" */
.claim {
  margin-top: 28px;
  padding-top: 26px;
  border-top: 1px solid var(--border);
  display: grid;
  gap: 10px;
  justify-items: center;
}
.claim[hidden] { display: none; }
.claim-title { font-size: 16px; font-weight: 600; }
.claim-sub { font-size: 13px; color: var(--muted); margin-top: -4px; }

/* ============ INVITE PANEL ============ */
.invite-panel {
  margin: 0 0 16px;
  padding: 14px 16px;
  border-radius: var(--r-ctrl);
  border: 1px solid var(--border);
  background: var(--surface-2);
  text-align: left;
}
.invite-panel[hidden] { display: none; }
.invite-label { margin: 0 0 8px; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.invite-form { display: flex; border: 1px solid var(--border); border-radius: var(--r-ctrl); overflow: hidden; background: var(--surface-1); }
.invite-input { flex: 1; min-width: 0; border: 0; padding: 9px 12px; background: transparent; color: var(--text); font-family: var(--font-mono); font-size: 13.5px; outline: 0; }
.invite-btn { border: 0; border-left: 1px solid var(--border); background: var(--accent); color: var(--on-accent); font-size: 12.5px; font-weight: 600; padding: 0 14px; }
.invite-btn:hover { background: var(--accent-hi); }
.invite-btn:disabled { opacity: .6; cursor: default; }
.invite-msg { margin: 9px 0 0; font-family: var(--font-mono); font-size: 12.5px; color: var(--muted); }
.invite-msg[hidden] { display: none; }
.invite-msg[data-kind="err"] { color: var(--error); }
.invite-msg[data-kind="ok"] { color: var(--success); }
.invite-list { list-style: none; margin: 9px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.invite-chip { font-family: var(--font-mono); font-size: 12.5px; color: var(--text); background: var(--surface-1); border: 1px solid var(--border); border-radius: 6px; padding: 3px 8px; }
.doc-invite { margin-top: 12px; }

/* ============ DASHBOARD ============ */
.workspace-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-1);
}
.workspace-toolbar[hidden] { display: none; }

.ws-search { position: relative; flex: 1; min-width: 180px; max-width: 280px; }
.ws-search .pw-input { max-width: none; padding-left: 32px; }
.ws-search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }

.ws-sort {
  appearance: none;
  -webkit-appearance: none;
  padding: 8px 32px 8px 12px;
  border-radius: var(--r-ctrl);
  border: 1px solid var(--border);
  background-color: var(--surface-2);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  background-size: 12px;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: border-color .16s var(--ease), box-shadow .16s var(--ease);
}
.ws-sort:hover { border-color: var(--border-strong); }
.ws-sort:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--accent) 50%, var(--border));
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.workspace-body { background: var(--surface-1); }
/* let card overflow menus escape the panel */
.workspace-main .window { overflow: visible; }

.doc-list {
  list-style: none;
  margin: 0;
  padding: 20px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.doc-card {
  position: relative;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  background: var(--surface-1);
  box-shadow: var(--ladder);
  cursor: pointer;
  transition: transform .16s var(--ease), border-color .16s var(--ease);
}
.doc-card:hover { transform: translateY(-2px); border-color: var(--border-strong); }
.doc-card:hover,
.doc-card:has(.card-menu:not([hidden])) { z-index: 10; }

.thumb {
  position: relative;
  height: 150px;
  overflow: hidden;
  border-radius: var(--r-card) var(--r-card) 0 0;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}

/* hover-revealed quick actions + overflow menu */
.card-actions {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 20;
  display: flex;
  gap: 6px;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity .16s var(--ease), transform .16s var(--ease);
}
.doc-card:hover .card-actions,
.doc-card:focus-within .card-actions,
.doc-card:has(.card-menu:not([hidden])) .card-actions { opacity: 1; transform: none; }
.card-act {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: color-mix(in srgb, var(--surface-1) 86%, transparent);
  backdrop-filter: blur(6px);
  color: var(--text);
  font-size: 14px;
  transition: background .14s var(--ease);
}
.card-act:hover { background: var(--surface-2); }
.card-menu-wrap { position: relative; }
.card-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 172px;
  z-index: 30;
  padding: 4px;
  background: var(--surface-1);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-ctrl);
  box-shadow: var(--overlay-shadow);
}
.card-menu[hidden] { display: none; }
.card-menu-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border: 0;
  background: transparent;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}
.card-menu-item:hover { background: var(--surface-2); }
.card-menu-sep { height: 1px; margin: 4px 6px; background: var(--border); }
.card-menu-danger { color: var(--error); }
.card-menu-danger:hover { background: color-mix(in srgb, var(--error) 14%, transparent); }
.thumb-glyph {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 2rem;
  color: var(--faint);
}
.thumb iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 1000px;
  height: 625px;
  border: 0;
  background: #fff;
  transform: scale(.28);
  transform-origin: top left;
  pointer-events: none;
}
.doc-card.expired .thumb { filter: grayscale(1); opacity: .45; }
.doc-card.expired .doc-title,
.doc-card.expired .doc-slug,
.doc-card.expired .doc-sub { color: var(--faint); }

.doc-meta { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px; min-width: 0; }
.doc-title-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.doc-title { display: block; font-size: 14.5px; font-weight: 600; letter-spacing: -.01em; flex: 1; min-width: 0; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-title:hover { text-decoration: underline; text-underline-offset: 2px; }
.doc-lock { font-size: 12px; color: var(--faint); flex-shrink: 0; }
.doc-slug { font-family: var(--font-mono); font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-sub { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--faint); flex-wrap: wrap; }
.doc-sub::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  flex-shrink: 0;
}
.doc-card.expired .doc-sub::before { background: var(--faint); }
.doc-type { text-transform: uppercase; letter-spacing: .04em; }
.doc-comments[hidden] { display: none; }
.doc-c-count { color: var(--muted); }
.doc-c-new {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: var(--r-pill);
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
  font-size: 11px;
}

.doc-expiry-edit { margin-top: 10px; }
.doc-expiry-edit[hidden] { display: none; }
.doc-expiry-edit .chip { font-size: 12px; padding: 5px 10px; }
.doc-expiry-edit .expiry-custom-input { max-width: 6rem; font-size: 12px; }
.doc-exp-msg { display: block; margin-top: 8px; font-family: var(--font-mono); font-size: 12px; color: var(--error); }
.doc-exp-msg[hidden] { display: none; }

.empty-state {
  padding: 64px 24px;
  text-align: center;
  color: var(--muted);
}
.empty-state[hidden] { display: none; }
.empty-state p { margin: 8px 0; }
.empty-state a { color: var(--accent); }
.empty-state a:hover { color: var(--accent-hi); }
.auth-btn.empty-cta { margin-top: 6px; }

/* ============ AUTH PAGE + MODAL ============ */
.auth-body { padding: 28px 28px 32px; }

.auth-lead { margin: 0 0 6px; font-size: 18px; font-weight: 600; }
.auth-sub { margin: 0; color: var(--muted); font-size: 14px; }

.auth-perks { list-style: none; margin: 22px 0 0; padding: 0; display: grid; gap: 16px; }
.auth-perk { display: flex; gap: 12px; align-items: flex-start; }
.auth-perk-glyph {
  flex: none;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 16px;
}
.auth-perk-text { font-size: 14px; line-height: 1.4; color: var(--muted); }
.auth-perk-text strong { display: block; margin-bottom: 2px; font-size: 14.5px; font-weight: 600; color: var(--text); }

.auth-note { margin: 18px 0 0; font-size: 13px; color: var(--faint); }

.auth-form { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 22px; }
.auth-input {
  flex: 1 1 220px;
  padding: 10px 14px;
  border-radius: var(--r-ctrl);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 14px;
  outline: 0;
  transition: border-color .16s var(--ease), box-shadow .16s var(--ease);
}
.auth-input:focus { border-color: color-mix(in srgb, var(--accent) 50%, var(--border)); box-shadow: 0 0 0 3px var(--accent-soft); }

.auth-btn {
  padding: 10px 20px;
  border: 0;
  border-radius: var(--r-ctrl);
  background: var(--accent);
  color: var(--on-accent);
  font-size: 14px;
  font-weight: 600;
  transition: background .16s var(--ease), transform .16s var(--ease);
}
.auth-btn:hover:not(:disabled) { background: var(--accent-hi); transform: translateY(-1px); }
.auth-btn:disabled { opacity: .5; cursor: not-allowed; }

.auth-error { margin: 14px 0 0; color: var(--error); font-size: 14px; min-height: 1.1em; }

.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(0, 0, 0, .6);
  backdrop-filter: blur(3px);
}
.auth-modal { width: 100%; max-width: 440px; }
.auth-modal-close {
  background: none;
  border: 0;
  font-size: 15px;
  line-height: 1;
  color: var(--muted);
  padding: 0 .25rem;
}
.auth-modal-close:hover { color: var(--text); }

/* ============ RESPONSIVE ============ */
@media (max-width: 720px) {
  main.preview-open { max-width: 760px; }
  main.preview-open .composer-body { grid-template-columns: 1fr; }
  main.preview-open .preview-pane { border-left: 0; border-top: 1px solid var(--border); }
  .row { grid-template-columns: 1fr; gap: 8px; }
  #submit { width: 100%; justify-content: center; }
  .topbar { padding: 0 16px; }
  main { padding: 28px 16px 80px; }
}
