* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: #131316;
  color: #f2f2f5;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}
a { color: inherit; text-decoration: none; }
h1 { font-size: 22px; font-weight: 600; margin: 0; }
h2 { font-size: 17px; font-weight: 600; margin: 0 0 12px; }
.muted { color: #8e8e96; }
.small { font-size: 12px; }
.empty { padding: 48px 24px; text-align: center; }
.ok { color: #5DCAA5; }
.err { color: #F09595; }
.err-inline { color: #F09595; }

/* ---------- top bar / chrome ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px; gap: 16px;
  border-bottom: 1px solid #2a2a31;
  flex-wrap: wrap;
}
.topbar-left { display: flex; align-items: center; gap: 16px; min-width: 0; }
.topbar-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.brand-logo { height: 30px; display: block; }
.brand-name { font-weight: 600; font-size: 16px; }
.crumbs { display: flex; align-items: center; gap: 8px; font-size: 14px; flex-wrap: wrap; }
.crumbs a { color: #c9c9cf; }
.crumbs a:hover { color: #fff; text-decoration: underline; }
.crumbs span { color: #5a5a62; }
.crumbs a:last-child { color: #fff; }

.proj-banner {
  display: flex; align-items: center; gap: 18px;
  padding: 22px 24px; background: #1a1a1f; border-bottom: 1px solid #2a2a31;
}
.proj-banner p { margin: 2px 0 0; }
.proj-banner .proj-del { margin-left: auto; }

.page { padding: 24px; }
.flash {
  margin: 16px 24px 0; padding: 10px 16px;
  background: #1d2b25; border: 1px solid #1D9E75; border-radius: 8px;
  font-size: 14px; word-break: break-all;
}

/* ---------- buttons & forms ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: #26262c; color: #f2f2f5;
  border: 1px solid #3a3a42; border-radius: 8px;
  padding: 8px 14px; font-size: 13.5px; font-weight: 500;
  cursor: pointer; white-space: nowrap;
}
.btn:hover { background: #2e2e35; }
.btn-primary { background: #f2f2f5; color: #16161a; border-color: #f2f2f5; }
.btn-primary:hover { background: #ffffff; }
.btn-approve { background: #1D9E75; border-color: #1D9E75; color: #04342C; }
.btn-approve:hover { background: #25b486; }
.btn-changes { background: #26262c; border-color: #BA7517; color: #FAC775; }
.btn-changes:hover { background: #2e2e35; }
.btn.danger, .small-btn.danger { color: #F09595; border-color: #6b3030; }
.link-btn {
  background: none; border: none; padding: 0;
  color: #8e8e96; font-size: 12px; cursor: pointer; text-decoration: underline;
}
.link-btn:hover { color: #f2f2f5; }
.link-btn.danger { color: #F09595; }
.small-btn { padding: 5px 10px; font-size: 12px; }
.inline-form { display: inline; }

input[type=text], input[type=password], input[type=email], textarea, select {
  width: 100%; background: #131316; color: #f2f2f5;
  border: 1px solid #3a3a42; border-radius: 8px;
  padding: 9px 12px; font-size: 14px; font-family: inherit;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: #6e6e78; }
label { display: block; font-size: 13px; color: #c9c9cf; margin: 0 0 12px; }
label input, label textarea { margin-top: 5px; }
label.check { display: flex; align-items: center; gap: 8px; }
label.check input { width: auto; }
input[type=file] { color: #c9c9cf; font-size: 13px; margin: 8px 0; max-width: 100%; }

dialog {
  background: #1d1d23; color: #f2f2f5;
  border: 1px solid #3a3a42; border-radius: 12px;
  padding: 22px; width: min(440px, 92vw);
}
dialog.wide { width: min(680px, 94vw); }
dialog::backdrop { background: rgba(0, 0, 0, 0.6); }
.dlg-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }

/* ---------- auth ---------- */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-card {
  width: 360px; max-width: 100%; background: #1d1d23;
  border: 1px solid #2e2e35; border-radius: 14px; padding: 30px;
}
.auth-card h1 { font-size: 19px; margin-bottom: 6px; }
.auth-card form { margin-top: 16px; display: flex; flex-direction: column; gap: 12px; }
.auth-brand { margin-bottom: 18px; }
.auth-brand .brand-logo { height: 36px; }

/* ---------- cards grid ---------- */
.cards {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
.card {
  background: #1d1d23; border: 1px solid #2a2a31; border-radius: 10px;
  overflow: hidden; display: flex; flex-direction: column;
  transition: border-color 0.15s;
}
.card:hover { border-color: #4a4a54; }
.card-foot {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; border-top: 1px solid #2a2a31;
  font-size: 13px; color: #c9c9cf; background: #19191e;
}
.proj-card .proj-head { display: flex; align-items: center; gap: 12px; padding: 22px 16px; }
.proj-name { font-weight: 600; font-size: 16px; }
.proj-logo { width: 44px; height: 44px; object-fit: contain; border-radius: 8px; flex: none; }
.proj-logo.lg { width: 56px; height: 56px; }
.proj-initials {
  display: inline-flex; align-items: center; justify-content: center;
  background: #2c2c34; color: #c9c9cf; font-weight: 600; font-size: 15px;
}
.folder-card .folder-name { display: block; padding: 26px 16px; font-weight: 600; letter-spacing: 0.02em; }
.folder-card .folder-name:hover { color: #fff; }
.thumb { position: relative; aspect-ratio: 16/10; background: #101013; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-ph {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: #5a5a62; font-weight: 700; font-size: 18px; letter-spacing: 0.1em;
}
.thumb .pill { position: absolute; left: 8px; bottom: 8px; }
.file-meta { padding: 10px 14px 12px; display: flex; flex-direction: column; gap: 2px; }
.file-name { font-weight: 600; font-size: 14px; word-break: break-word; }
.file-stats { display: flex; gap: 12px; align-items: center; margin-top: 4px; }
.vbadge { margin-left: auto; border: 1px solid #3a3a42; border-radius: 4px; padding: 0 5px; font-size: 11px; }

/* ---------- status pills ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  border-radius: 999px; padding: 3px 10px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.pill .dot { width: 7px; height: 7px; border-radius: 50%; }
.st-review { background: rgba(239, 159, 39, 0.15); color: #FAC775; border: 1px solid rgba(239, 159, 39, 0.5); }
.st-review .dot { background: #EF9F27; }
.st-changes { background: rgba(226, 75, 74, 0.15); color: #F09595; border: 1px solid rgba(226, 75, 74, 0.5); }
.st-changes .dot { background: #E24B4A; }
.st-approved { background: rgba(29, 158, 117, 0.15); color: #5DCAA5; border: 1px solid rgba(29, 158, 117, 0.55); }
.st-approved .dot { background: #1D9E75; }

/* ---------- share dialog ---------- */
.share-new { display: flex; gap: 10px; margin-bottom: 16px; align-items: center; }
.share-new input[type=text] { flex: 1; width: auto; }
.share-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.share-table td { padding: 10px 8px; border-top: 1px solid #2a2a31; vertical-align: top; }
.share-url { color: #8e8e96; font-size: 12px; word-break: break-all; margin-top: 3px; }
.share-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.copy-url { text-decoration: underline; cursor: text; user-select: all; }

/* ---------- viewer ---------- */
.viewer { display: flex; flex-direction: column; height: 100vh; }
.v-top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 18px; border-bottom: 1px solid #2a2a31; flex-wrap: wrap;
}
.v-top-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.v-top-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.v-back { font-size: 26px; line-height: 1; color: #c9c9cf; padding: 0 6px; }
.v-back:hover { color: #fff; }
.v-title { font-weight: 600; font-size: 15px; word-break: break-word; }
.v-title .ext {
  font-size: 10px; color: #8e8e96; border: 1px solid #3a3a42;
  border-radius: 4px; padding: 1px 5px; vertical-align: 2px; margin-left: 4px;
}
.navarrow { padding: 0 4px; color: #c9c9cf; }
.navarrow:hover { color: #fff; }

.banner { padding: 10px 18px; font-size: 14px; font-weight: 500; }
.banner-approved { background: #11362a; color: #9FE1CB; border-bottom: 1px solid #1D9E75; }
.banner-changes { background: #3a201c; color: #F5C4B3; border-bottom: 1px solid #993C1D; }

.v-main { flex: 1; display: flex; min-height: 0; }
.v-stagewrap { flex: 1; display: flex; flex-direction: column; min-width: 0; padding: 14px; gap: 12px; }
.v-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ver-select, .status-select { width: auto; padding: 6px 10px; font-size: 13px; background: #1d1d23; }
.status-select.st-review { color: #FAC775; }
.status-select.st-changes { color: #F09595; }
.status-select.st-approved { color: #5DCAA5; }
.zoom-ctl {
  margin-left: auto; display: inline-flex; align-items: center; gap: 4px;
  background: #1d1d23; border: 1px solid #3a3a42; border-radius: 8px; padding: 3px 6px;
}
.zoom-ctl button {
  background: none; border: none; color: #c9c9cf; font-size: 16px;
  width: 26px; height: 26px; cursor: pointer; border-radius: 5px;
}
.zoom-ctl button:hover { background: #2e2e35; color: #fff; }
.zoom-ctl #zPct { font-size: 12px; color: #c9c9cf; min-width: 42px; text-align: center; }

.v-stage {
  flex: 1; position: relative; overflow: hidden;
  background: #0e0e11; border-radius: 10px; border: 1px solid #25252b;
  cursor: grab; touch-action: none;
}
.v-stage.grabbing { cursor: grabbing; }
.v-stage.pinning { cursor: crosshair; }
.v-canvas { position: absolute; top: 0; left: 0; transform-origin: 0 0; }
#art { display: block; user-select: none; -webkit-user-drag: none; max-width: none; }
.pdf-frame { width: 100%; height: 100%; border: none; background: #fff; }

.pin {
  position: absolute; width: 26px; height: 26px;
  transform: translate(-50%, -50%) scale(var(--inv, 1));
  background: #D85A30; border: 2px solid #fff; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; padding: 0; z-index: 5;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.55);
}
.pin span { color: #fff; font-size: 12px; font-weight: 700; }
.pin[hidden] { display: none; }
.pin-resolved { background: #4a4a54; opacity: 0.75; }
.pin-temp { background: #1D9E75; }
.pin.hl { outline: 3px solid rgba(216, 90, 48, 0.5); }

.decide-bar { display: flex; gap: 10px; }
.decide-bar .btn { flex: 1; justify-content: center; padding: 12px; font-size: 14.5px; }

/* ---------- comments sidebar ---------- */
.v-side {
  width: 320px; flex: none; border-left: 1px solid #2a2a31;
  display: flex; flex-direction: column; min-height: 0; background: #18181d;
}
.side-head { padding: 14px 16px 0; }
.tabs { display: flex; gap: 14px; border-bottom: 1px solid #2a2a31; margin-top: 8px; }
.tab {
  background: none; border: none; color: #8e8e96; font-size: 13px;
  padding: 0 0 8px; cursor: pointer; border-bottom: 2px solid transparent;
}
.tab.active { color: #fff; border-bottom-color: #fff; }
.c-list { flex: 1; overflow-y: auto; padding: 12px 16px; display: flex; flex-direction: column; gap: 10px; }
.c-item { background: #1f1f25; border-radius: 9px; padding: 10px 12px; transition: outline-color 0.3s; }
.c-item.hl { outline: 2px solid #D85A30; }
.c-item[data-resolved="1"] { opacity: 0.65; }
.c-head { display: flex; align-items: center; gap: 8px; }
.c-pin {
  width: 18px; height: 18px; flex: none; background: #D85A30; border-radius: 50%;
  color: #fff; font-size: 10px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
}
.c-author { font-weight: 600; font-size: 13px; }
.c-author.studio { color: #9FC9F1; }
.c-body { margin: 6px 0 4px; font-size: 13px; color: #d9d9de; word-break: break-word; }
.c-actions { display: flex; gap: 12px; }
.c-reply { margin: 10px 0 0 14px; padding: 8px 10px; background: #25252c; border-radius: 7px; }
.c-reply .c-body { margin: 4px 0 0; }

.composer { padding: 12px 16px 16px; border-top: 1px solid #2a2a31; display: flex; flex-direction: column; gap: 8px; }
.composer textarea { resize: vertical; }
.composer-actions { display: flex; gap: 8px; justify-content: flex-end; }
.pin-btn.active { border-color: #D85A30; color: #F0997B; }
.reply-note, .pin-note { font-size: 12px; color: #9FE1CB; }
.reply-note { color: #9FC9F1; }

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .v-main { flex-direction: column; overflow-y: auto; }
  .viewer { height: auto; min-height: 100vh; }
  .v-stagewrap { min-height: 60vh; }
  .v-stage { min-height: 45vh; }
  .v-side { width: 100%; border-left: none; border-top: 1px solid #2a2a31; }
  .c-list { max-height: 320px; }
  .page { padding: 16px; }
  .topbar, .proj-banner { padding: 12px 16px; }
}
