/* =========================================================
   ELABS PM — design system compartilhado (admin + cliente)
   ========================================================= */
:root {
  --bg:        #0f1115;
  --bg-soft:   #171a21;
  --panel:     #1d2129;
  --panel-2:   #242a33;
  --border:    #2c333d;
  --text:      #e7e9ee;
  --text-dim:  #9aa3b2;
  --text-mute: #6b7480;
  --accent:    #ff5e5b;
  --accent-2:  #ffb347;
  --ok:        #3ecf8e;
  --warn:      #ffb347;
  --danger:    #ff5e5b;
  --radius:    12px;
  --radius-sm: 8px;
  --shadow:    0 10px 30px rgba(0,0,0,0.35);
  --grid-line: rgba(255,255,255,0.035);
  --help-bg: rgba(23,26,33,.92);
  --border-hover: #3a424e;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-weight: 700; letter-spacing: -0.02em; margin: 0 0 .4em; }

/* ---------- Botões ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--panel-2); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 9px 16px; font-size: 14px; font-weight: 600;
  cursor: pointer; transition: .15s;
}
.btn:hover { background: var(--panel); border-color: var(--border-hover); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: #ff726f; border-color: #ff726f; }
.btn-ghost { background: transparent; }
.btn-sm { padding: 6px 11px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- Inputs ---------- */
input, textarea, select {
  width: 100%; background: var(--bg-soft); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px 12px; font-size: 14px; font-family: inherit;
}
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255,94,91,.15);
}
label { display: block; font-size: 13px; color: var(--text-dim); margin-bottom: 6px; font-weight: 600; }
.field { margin-bottom: 16px; }

/* ---------- Cards / painéis ---------- */
.panel {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
}
.card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 18px;
  transition: .15s; cursor: pointer;
}
.card:hover { border-color: var(--border-hover); transform: translateY(-1px); }

/* ---------- Layout admin ---------- */
.app-shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--bg-soft); border-right: 1px solid var(--border);
  padding: 20px 16px; display: flex; flex-direction: column;
}
.brand { font-size: 18px; font-weight: 800; letter-spacing: -.02em; margin-bottom: 24px; }
.brand .dot { color: var(--accent); }
.nav a {
  display: block; padding: 9px 12px; border-radius: var(--radius-sm);
  color: var(--text-dim); font-weight: 600; font-size: 14px; margin-bottom: 2px;
}
.nav a:hover, .nav a.active { background: var(--panel); color: var(--text); text-decoration: none; }
.main { padding: 28px 34px; overflow-y: auto; max-height: 100vh; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }

/* ---------- Utilidades ---------- */
.row { display: flex; gap: 12px; align-items: center; }
.between { justify-content: space-between; }
.grid { display: grid; gap: 14px; }
.grid-cards { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.muted { color: var(--text-mute); }
.dim { color: var(--text-dim); }
.small { font-size: 13px; }
.pill {
  display: inline-block; padding: 3px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 700; background: var(--panel-2); color: var(--text-dim);
  white-space: nowrap; flex-shrink: 0; /* não quebra linha nem espreme no flex */
}
.pill.ok { background: rgba(62,207,142,.15); color: var(--ok); }
.pill.warn { background: rgba(255,179,71,.15); color: var(--warn); }
.pill.pending { background: rgba(255,94,91,.13); color: var(--accent); }
.empty { text-align: center; color: var(--text-mute); padding: 48px 20px; }
.spacer { flex: 1; }
.hidden { display: none !important; }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-box { width: 100%; max-width: 360px; }
.login-box .brand { text-align: center; font-size: 24px; margin-bottom: 20px; }

/* ---------- Toast ---------- */
#toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: var(--panel-2); border: 1px solid var(--border); color: var(--text);
  padding: 11px 18px; border-radius: var(--radius-sm); box-shadow: var(--shadow);
  font-size: 14px; opacity: 0; pointer-events: none; transition: .2s; z-index: 9999;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(-4px); }
#toast.err { border-color: var(--danger); }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.55);
  display: grid; place-items: center; z-index: 500; padding: 20px;
}
.modal { width: 100%; max-width: 440px; }

/* ========================= Reviewer (player + comentários) ========================= */
.reviewer { display: grid; grid-template-columns: 1fr 360px; gap: 20px; align-items: start; }
@media (max-width: 900px) { .reviewer { grid-template-columns: 1fr; } }

.rv-main { min-width: 0; }
.rv-player { background: #000; border-radius: var(--radius); overflow: hidden; margin-bottom: 14px; }
.rv-video, .rv-video-wrap iframe { width: 100%; aspect-ratio: 16/9; display: block; border: 0; }
.rv-video-wrap { position: relative; }
.rv-audio { width: 100%; display: block; }
.rv-player:has(.rv-audio) { background: var(--panel); padding: 18px; }
.rv-link-card { background: var(--panel); padding: 28px; text-align: center; border-radius: var(--radius); }

/* composer */
.rv-composer { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; }
.rv-composer textarea { border: none; background: transparent; padding: 4px; resize: vertical; }
.rv-composer textarea:focus { box-shadow: none; }
.rv-composer-bar { display: flex; align-items: center; gap: 12px; margin-top: 6px; }
.rv-pin { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--text-dim); margin: 0; cursor: pointer; }
.rv-pin input { width: auto; }
.rv-pin b { color: var(--accent-2); }

/* lista */
.rv-side { background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; position: sticky; top: 20px; }
.rv-side-head { padding: 12px 16px; font-weight: 700; border-bottom: 1px solid var(--border); }
.rv-comments { max-height: 70vh; overflow-y: auto; padding: 8px; }
.rv-comment { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 11px 12px; margin-bottom: 8px; }
.rv-c-head { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; flex-wrap: wrap; }
.rv-author { font-weight: 700; font-size: 13px; }
.rv-author.is-admin { color: var(--accent); }
.rv-role { font-size: 11px; color: var(--text-mute); text-transform: uppercase; letter-spacing: .04em; }
.rv-tc { background: rgba(255,179,71,.15); color: var(--accent-2); border: none; border-radius: 5px; padding: 2px 8px; font-size: 12px; font-weight: 700; cursor: pointer; font-family: inherit; }
.rv-tc:hover { background: rgba(255,179,71,.3); }
.rv-body { font-size: 14px; white-space: pre-wrap; word-break: break-word; }
.rv-reply-btn { background: none; border: none; color: var(--text-mute); font-size: 12px; cursor: pointer; padding: 4px 0 0; }
.rv-reply-btn:hover { color: var(--text); }
.rv-replies { margin-top: 6px; }
.rv-reply { border-left: 2px solid var(--border); padding: 6px 0 2px 10px; margin-top: 6px; }
.rv-reply-box { display: flex; gap: 6px; margin-top: 8px; }
.rv-reply-box textarea { flex: 1; min-height: 34px; }
.rv-att { display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; margin-right: 6px; font-size: 13px; padding: 5px 9px; background: var(--panel-2); border-radius: 6px; }
.rv-att img { max-width: 120px; max-height: 90px; border-radius: 4px; display: block; }
.rv-att-media { display: block; width: 100%; margin-top: 8px; }

/* lista de arquivos no projeto */
.file-row { display: flex; align-items: center; gap: 14px; padding: 12px 14px; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 8px; }
.file-row .grow { flex: 1; min-width: 0; cursor: pointer; }
.file-row h4 { margin: 0 0 2px; }
.src-badge { font-size: 11px; padding: 2px 7px; border-radius: 5px; background: var(--panel-2); color: var(--text-dim); font-weight: 700; }
.share-box { background: var(--bg-soft); border: 1px dashed var(--border); border-radius: 8px; padding: 10px 12px; font-size: 13px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.share-box code { background: var(--panel-2); padding: 3px 8px; border-radius: 5px; font-size: 13px; }

/* ========================= Anexos no composer ========================= */
.rv-icon-btn { background: var(--panel-2); border: 1px solid var(--border); border-radius: 6px; width: 30px; height: 30px; cursor: pointer; font-size: 15px; display: inline-flex; align-items: center; justify-content: center; }
.rv-icon-btn:hover { border-color: #3a424e; }
.rv-attach-list { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 2px; }
.rv-attach-list:empty { display: none; }
.rv-chip { background: var(--panel-2); border: 1px solid var(--border); border-radius: 6px; padding: 4px 9px; font-size: 12px; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rv-chip b { cursor: pointer; color: var(--text-mute); margin-left: 4px; }
.rv-chip b:hover { color: var(--danger); }

/* ========================= Portal do cliente ========================= */
.rv-page { min-height: 100vh; display: flex; flex-direction: column; }
.rv-topbar { display: flex; align-items: center; gap: 16px; padding: 14px 24px; border-bottom: 1px solid var(--border); background: var(--bg-soft); position: sticky; top: 0; z-index: 10; }
.rv-topbar .brand { margin-bottom: 0; } /* .brand tem margem pro layout da sidebar; aqui não */
.rv-file-title { font-weight: 700; font-size: 16px; flex: 1; }
.rv-page-body { padding: 24px; max-width: 1400px; width: 100%; margin: 0 auto; }

/* ========================= Moodboard (canvas) ========================= */
.main.mb-full { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.mb-topbar { display: flex; align-items: center; gap: 14px; padding: 12px 20px; border-bottom: 1px solid var(--border); background: var(--bg-soft); flex-shrink: 0; }
.mb-topbar h1 { font-size: 17px; margin: 0; }
.mb-editor-root { flex: 1; min-height: 0; position: relative; }

.mb-viewport { width: 100%; height: 100%; position: relative; overflow: hidden; outline: none; background: var(--bg); }
.mb-canvas {
  width: 10000px; height: 10000px; position: absolute; transform-origin: 0 0;
  background-image:
    linear-gradient(to right, var(--grid-line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-line) 1px, transparent 1px);
  background-size: 40px 40px;
}
.mb-svg { position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 1; overflow: visible; }

.mb-card {
  position: absolute; width: 300px; min-height: 140px; min-width: 240px;
  background: var(--panel); border-radius: 12px; border: 2px solid var(--border);
  box-shadow: 0 10px 26px rgba(0,0,0,.4);
  display: flex; flex-direction: column; resize: both; overflow: hidden; z-index: 10;
}
.mb-card:hover { z-index: 11; box-shadow: 0 14px 34px rgba(0,0,0,.55); }

.mb-node {
  position: absolute; right: -7px; top: 50%; transform: translateY(-50%);
  width: 14px; height: 14px; background: #6b7480; border-radius: 50%;
  cursor: crosshair; box-shadow: 0 0 0 3px var(--panel); z-index: 20;
}
.mb-card:hover .mb-node { background: var(--accent); transform: translateY(-50%) scale(1.2); }

.mb-head {
  padding: 9px 12px; cursor: grab; display: flex; align-items: center; gap: 8px;
  border-bottom: 1px solid rgba(0,0,0,.25);
}
.mb-head:active { cursor: grabbing; }
.mb-title {
  font-weight: 700; font-size: 13px; flex: 1; color: #fff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  text-shadow: 0 1px 3px rgba(0,0,0,.4); outline: none;
}
.mb-title[contenteditable="true"] { white-space: normal; border: 1px dashed rgba(255,255,255,.5); cursor: text; }
.mb-color {
  -webkit-appearance: none; appearance: none; border: none; width: 20px; height: 20px;
  border-radius: 50%; cursor: pointer; padding: 0; background: transparent; flex-shrink: 0;
}
.mb-color::-webkit-color-swatch-wrapper { padding: 0; }
.mb-color::-webkit-color-swatch { border: 2px solid rgba(255,255,255,.7); border-radius: 50%; }
.mb-del {
  background: transparent; border: none; color: rgba(255,255,255,.75); font-size: 18px;
  font-weight: bold; cursor: pointer; padding: 0 2px; flex-shrink: 0;
}
.mb-del:hover { color: #fff; }

.mb-body { padding: 13px; flex: 1; font-size: 14px; line-height: 1.5; outline: none; overflow-y: auto; }
.mb-media { padding: 12px; display: flex; flex-direction: column; gap: 9px; flex: 1; overflow-y: auto; }
.mb-media img, .mb-media video, .mb-media iframe {
  width: 100%; height: auto; max-height: 100%; object-fit: contain; border-radius: 6px; background: #000;
}
.mb-media iframe { aspect-ratio: 16/9; border: none; }
.mb-media audio { width: 100%; height: 38px; flex-shrink: 0; }
.mb-note { font-size: 12.5px; color: var(--text-dim); outline: none; padding: 7px 9px; background: var(--bg-soft); border-radius: 6px; }
.mb-missing { padding: 18px; background: rgba(255,94,91,.12); color: var(--accent); border-radius: 6px; text-align: center; font-size: 13px; }
.mb-slicer { display: flex; gap: 10px; background: var(--bg-soft); padding: 7px 9px; border-radius: 6px; font-size: 12px; align-items: center; }
.mb-slicer label { display: flex; align-items: center; gap: 5px; margin: 0; font-size: 11px; }
.mb-slicer input { width: 54px; padding: 3px 6px; font-size: 12px; }

.mb-help {
  position: absolute; bottom: 14px; left: 14px; z-index: 100;
  background: var(--help-bg); border: 1px solid var(--border); border-radius: 9px;
  padding: 8px 13px; font-size: 12px; color: var(--text-dim); max-width: 520px;
}
.mb-help b { color: var(--text); }
.mb-status { color: var(--accent-2); margin-left: 6px; }

/* ========================= Tema claro ========================= */
:root[data-theme="light"] {
  --bg:        #f2f3f5;
  --bg-soft:   #ffffff;
  --panel:     #ffffff;
  --panel-2:   #e9ebee;
  --border:    #d8dce2;
  --border-hover: #b9c0ca;
  --text:      #22262e;
  --text-dim:  #5a6472;
  --text-mute: #8b95a4;
  --accent-2:  #d97e00;
  --ok:        #1d9e66;
  --warn:      #b97b12;
  --shadow:    0 10px 30px rgba(0,0,0,0.12);
  --grid-line: rgba(0,0,0,0.05);
  --help-bg:   rgba(255,255,255,.93);
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]):not([data-theme="light"]) {
    --bg:        #f2f3f5;
    --bg-soft:   #ffffff;
    --panel:     #ffffff;
    --panel-2:   #e9ebee;
    --border:    #d8dce2;
    --border-hover: #b9c0ca;
    --text:      #22262e;
    --text-dim:  #5a6472;
    --text-mute: #8b95a4;
    --accent-2:  #d97e00;
    --ok:        #1d9e66;
    --warn:      #b97b12;
    --shadow:    0 10px 30px rgba(0,0,0,0.12);
    --grid-line: rgba(0,0,0,0.05);
    --help-bg:   rgba(255,255,255,.93);
  }
}

/* ========================= Notificações / reordenação / edição ========================= */
.notif-item { padding: 10px 12px; border-radius: 8px; cursor: pointer; margin-bottom: 4px; background: var(--panel-2); }
.notif-item:hover { background: var(--bg-soft); }
.notif-item.read { opacity: .55; }
.ord { display: inline-flex; gap: 2px; }
.ord-btn {
  background: var(--panel-2); border: 1px solid var(--border); color: var(--text-dim);
  border-radius: 5px; width: 22px; height: 22px; font-size: 12px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; padding: 0;
}
.ord-btn:hover { color: var(--text); border-color: var(--border-hover); }
.rv-actions { display: flex; gap: 10px; margin-top: 4px; }
.rv-edit-box textarea { width: 100%; margin-top: 6px; }
.rv-approve-bar { display: flex; gap: 10px; padding: 14px 24px 0; max-width: 1400px; margin: 0 auto; width: 100%; }
.rv-approve-bar:empty { display: none; }

/* ========================= Sino de notificações ========================= */
.brand-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.brand-row .brand { margin-bottom: 0; }
.bell {
  display: inline-flex; align-items: center; gap: 5px;
  background: transparent; border: none;
  cursor: pointer; padding: 5px 7px; border-radius: 8px; line-height: 0;
  color: var(--text-dim);   /* ícone monocromático, segue o tema */
}
.bell:hover { background: var(--panel); color: var(--text); }
.bell-badge {
  background: var(--accent); color: #fff; font-size: 10px; font-weight: 800;
  border-radius: 999px; padding: 2px 6px; min-width: 17px; text-align: center;
  line-height: 1.2;
}
.sidebar { position: relative; }
.notif-dd {
  position: absolute; top: 58px; left: 12px; width: 330px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow); z-index: 600; overflow: hidden;
}
.notif-dd-list { max-height: 55vh; overflow-y: auto; padding: 6px; }
.notif-dd-foot { display: flex; border-top: 1px solid var(--border); }
.notif-dd-foot button {
  flex: 1; background: transparent; border: none; padding: 10px;
  color: var(--text-dim); cursor: pointer; font-weight: 600; font-size: 13px;
}
.notif-dd-foot button:hover { color: var(--text); background: var(--panel-2); }
.notif-dd-foot button + button { border-left: 1px solid var(--border); }

/* ========================= Cores de cliente/projeto ========================= */
.swatch-row { display: flex; gap: 7px; flex-wrap: wrap; align-items: center; }
.swatch {
  width: 26px; height: 26px; border-radius: 50%; border: 2px solid transparent;
  cursor: pointer; padding: 0; flex-shrink: 0;
}
.swatch.sel { border-color: var(--text); box-shadow: 0 0 0 2px var(--bg-soft); }
.swatch.none {
  background: var(--panel-2); color: var(--text-mute); font-size: 14px;
  line-height: 1; border: 2px dashed var(--border);
}
.swatch-row input[type="color"] {
  -webkit-appearance: none; appearance: none;
  width: 26px; height: 26px; padding: 0; border-radius: 50%;
  border: 2px dashed var(--border); background: transparent; cursor: pointer; flex-shrink: 0;
}
.swatch-row input[type="color"]::-webkit-color-swatch-wrapper { padding: 2px; }
.swatch-row input[type="color"]::-webkit-color-swatch { border: none; border-radius: 50%; }
.color-dot {
  display: inline-block; width: 13px; height: 13px; border-radius: 50%;
  margin-right: 8px; flex-shrink: 0;
}

/* Card totalmente colorido (cor do cliente/projeto) */
.card[data-colored] h3 { color: inherit; }
.card[data-colored] .dim,
.card[data-colored] .muted,
.card[data-colored] .small { color: inherit; opacity: .85; }
.card[data-colored] .pill,
.card[data-colored] .src-badge { background: rgba(0,0,0,.22); color: inherit; }
.card[data-colored] .ord-btn { background: rgba(0,0,0,.18); border-color: transparent; color: inherit; }
.card[data-colored]:hover { filter: brightness(1.07); transform: translateY(-1px); }
