:root {
  /* Paleta alinhada ao site www.barroswedding.com.br */
  --areia: #e8e1d6;
  --surface: #f5f1eb;
  --carvao: #1e1e1e;
  --cinza-quente: #6e6a63;
  --verde-olivia: #6b6f4e;
  --por-do-sol: #d67a3a;
  --madeira: #8b5e3c;
  --terracota: #c76f4e;
  --bg: var(--areia);
  --bg-elevated: var(--surface);
  --bg-card: var(--surface);
  --border: rgba(30, 30, 30, 0.12);
  --text: var(--carvao);
  --muted: var(--cinza-quente);
  --accent: var(--verde-olivia);
  --accent-warm: var(--por-do-sol);
  --accent-dim: #556b4f;
  --danger: var(--terracota);
  --success: #556b4f;
  --radius: 6px;
  --sidebar: 252px;
  font-family: Inter, system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

.brand-mark {
  font-size: clamp(1.35rem, 4vw, 1.75rem);
  font-weight: 100;
  letter-spacing: -0.03em;
  text-transform: none;
  color: var(--text);
}
.brand-lockup {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  margin: 0 0 0.35rem;
}
.brand-lockup--center {
  align-items: center;
  margin-bottom: 0.5rem;
}
.brand-lockup-name {
  font-family: Inter, "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-weight: 100;
  font-size: clamp(1.85rem, 5vw, 2.35rem);
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--text);
}
.brand-lockup--center .brand-lockup-name {
  font-size: clamp(2.75rem, 14vw, 3.75rem);
}
.brand-lockup-tag {
  font-size: 0.65rem;
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: 0.22em;
  text-transform: lowercase;
  color: var(--muted);
}
.role-pill {
  display: inline-block;
  margin: 0 0 0.75rem;
  padding: 0.35rem 0.75rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--accent-fg, #fff);
  background: var(--accent, #4a5d3f);
  border-radius: 999px;
}
.role-tag {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent, #4a5d3f);
  background: rgba(74, 93, 63, 0.12);
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  vertical-align: middle;
}

.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: var(--bg);
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: 0 8px 32px rgba(30, 30, 30, 0.06);
}
.login-card h1 { margin: 0.5rem 0 0; font-size: 1.75rem; font-weight: 500; }
.sub { color: var(--muted); font-size: 0.9rem; margin: 0.35rem 0 1.25rem; }

.password-field {
  position: relative;
  display: flex;
  align-items: stretch;
}
.password-field input {
  flex: 1;
  padding-right: 2.75rem;
}
.password-toggle {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.password-toggle:hover { color: var(--text); background: rgba(30, 30, 30, 0.05); }
.password-toggle .hidden { display: none; }

.login-form {
  margin: 0;
}
.login-forgot-wrap {
  margin: 0.35rem 0 1rem;
  text-align: right;
}
.link-btn {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-size: 0.85rem;
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.link-btn:hover { opacity: 0.85; }

.shell {
  min-height: 100vh;
  background: var(--bg);
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 100;
  width: var(--sidebar);
  height: 100vh;
  height: 100dvh;
  overflow-x: hidden;
  overflow-y: auto;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 1.5rem 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  box-shadow: 2px 0 16px rgba(30, 30, 30, 0.04);
}

@media (max-width: 800px) {
  .sidebar {
    position: relative;
    width: 100%;
    height: auto;
    max-height: none;
    box-shadow: none;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .nav { flex-direction: row; flex-wrap: wrap; width: 100%; }
}
.sidebar-tag { color: var(--muted); font-size: 0.75rem; margin: 0 0 1rem; }
.nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-item {
  text-align: left;
  background: transparent;
  border: none;
  color: var(--muted);
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.92rem;
}
.nav-item:hover { background: rgba(107, 111, 78, 0.08); color: var(--text); }
.nav-item.active {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}
.sidebar-out { margin-top: auto; }

.main {
  margin-left: var(--sidebar);
  min-height: 100vh;
  padding: 1.75rem 2rem 3rem;
  max-width: calc(1100px + var(--sidebar));
  background: var(--bg);
}

@media (max-width: 800px) {
  .main {
    margin-left: 0;
    max-width: none;
  }
}
.main-head h1 { margin: 0; font-size: 1.5rem; font-weight: 500; }
.main-head .sub { margin-top: 0.35rem; }

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
}
.card-title { font-size: 1rem; margin: 0 0 1rem; font-weight: 600; }

label { display: block; font-size: 0.8rem; color: var(--muted); margin-bottom: 0.35rem; }
input, select {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  font-size: 0.95rem;
}
input:focus, select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.field-row { margin-bottom: 0.75rem; }
.field-row.split {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem;
  align-items: end;
}

.btn {
  cursor: pointer;
  border: none;
  border-radius: 8px;
  padding: 0.6rem 1rem;
  font-size: 0.9rem;
  font-weight: 600;
}
.btn-block { width: 100%; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { filter: brightness(1.06); }
.btn-ghost { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 0.35rem 0.6rem; font-size: 0.78rem; }

.pill-row { display: flex; gap: 0.5rem; margin-bottom: 1rem; }
.pill {
  padding: 0.45rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.pill.active { border-color: var(--accent); background: var(--accent); color: #fff; }

.drop {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 1.75rem 1rem;
  text-align: center;
  color: var(--muted);
  cursor: pointer;
  margin: 0.75rem 0;
}
.drop.drag { border-color: var(--accent); background: rgba(107, 111, 78, 0.08); }
.hint { font-size: 0.8rem; color: var(--muted); margin: 0.25rem 0 0; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: 0.65rem;
}
.sortable-grid .thumb {
  cursor: grab;
}
.sortable-grid .thumb.dragging {
  opacity: 0.45;
  cursor: grabbing;
}
.sortable-grid .thumb.drag-over {
  outline: 2px dashed var(--accent);
  outline-offset: -2px;
}
.thumb {
  position: relative;
  aspect-ratio: 3/4;
  border-radius: 8px;
  overflow: hidden;
  background: rgba(30, 30, 30, 0.06);
  border: 1px solid var(--border);
}
.thumb .drag-handle {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 2;
  width: 1.65rem;
  height: 1.65rem;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
  font-size: 0.85rem;
  line-height: 1;
  cursor: grab;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}
.thumb .drag-handle:active {
  cursor: grabbing;
}
.thumb img, .thumb video { width: 100%; height: 100%; object-fit: cover; }
.thumb .badge.badge-draft {
  background: var(--por-do-sol);
  color: #fff;
}
.thumb .badge {
  position: absolute;
  top: 6px; left: 6px;
  font-size: 0.62rem;
  background: rgba(0,0,0,.75);
  padding: 2px 6px;
  border-radius: 4px;
}
.thumb .actions {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  display: flex;
  gap: 4px;
  padding: 6px;
  background: linear-gradient(transparent, rgba(0,0,0,.9));
  justify-content: center;
  flex-wrap: wrap;
}

.cover-list { display: flex; flex-direction: column; gap: 1rem; }
.cover-row {
  display: grid;
  grid-template-columns: 140px 1fr auto;
  gap: 1rem;
  align-items: center;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
}
.cover-row:last-child { border-bottom: none; }
.cover-preview {
  position: relative;
  aspect-ratio: 16/10;
  border-radius: 8px;
  overflow: hidden;
  background: rgba(30, 30, 30, 0.06);
  border: 1px solid var(--border);
}
.cover-preview--auto {
  border-style: dashed;
  opacity: 0.92;
}
.cover-preview img { width: 100%; height: 100%; object-fit: cover; }
.cover-auto-tag {
  position: absolute;
  bottom: 6px;
  left: 6px;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--muted);
}
.cover-list-intro {
  margin: 0 0 0.75rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}
.cover-label h3 { margin: 0; font-size: 0.95rem; }
.cover-label p { margin: 0.25rem 0 0; font-size: 0.8rem; color: var(--muted); }

.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
}
.stat-card .num { font-size: 1.75rem; font-weight: 600; color: var(--accent); }
.stat-card .lbl { font-size: 0.8rem; color: var(--muted); margin-top: 0.25rem; }

.stats-toolbar { margin-bottom: 1rem; max-width: 220px; }
.table-wrap { overflow-x: auto; }
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
table.data th, table.data td {
  text-align: left;
  padding: 0.5rem 0.65rem;
  border-bottom: 1px solid var(--border);
}
table.data th { color: var(--muted); font-weight: 500; }

.msg { font-size: 0.88rem; margin-top: 0.5rem; }
.msg.err { color: var(--danger); }
.msg.ok { color: var(--success); }
.msg.warn { color: var(--accent); }
.sidebar-user.clickable { cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(30, 30, 30, 0.45);
}
.modal-box {
  position: relative;
  width: 100%;
  max-width: 720px;
  max-height: 85vh;
  overflow: auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
}
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}
.modal-head h2 { margin: 0; font-size: 1.1rem; }
.picker-grid .thumb { cursor: pointer; }
.picker-grid .thumb:hover { outline: 2px solid var(--accent); }
.picker-grid .thumb--picker .actions {
  justify-content: center;
}
.picker-grid .thumb--picker .actions .btn-primary {
  width: 100%;
}

.sidebar-user { margin: 0.5rem 0 0; padding: 0 0.5rem; font-size: 0.78rem; }
.user-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
}
.perm-legend { margin: 0; padding-left: 1.1rem; color: var(--muted); font-size: 0.88rem; }
.perm-legend li { margin-bottom: 0.35rem; }

.card-subtitle {
  margin: 1.25rem 0 0.35rem;
  font-size: 1rem;
  font-weight: 500;
}
.user-form-actions { margin-top: 1rem; }

.perm-matrix { margin-top: 0.5rem; }
.perm-matrix th.perm-col-allow,
.perm-matrix td.perm-col-allow {
  width: 5.5rem;
  text-align: center;
  vertical-align: middle;
}
.perm-matrix td.perm-name {
  width: 8.5rem;
  font-weight: 500;
  vertical-align: top;
  padding-top: 0.85rem;
}
.perm-matrix td.perm-desc {
  color: var(--text);
  font-size: 0.88rem;
  line-height: 1.5;
  vertical-align: top;
  padding-top: 0.75rem;
}
.perm-matrix tbody tr:hover { background: rgba(107, 111, 78, 0.05); }
.perm-allow-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0.35rem;
}
.perm-allow-label input[type="checkbox"] {
  width: 1.15rem;
  height: 1.15rem;
  accent-color: var(--accent);
  cursor: pointer;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.user-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1rem 0.75rem;
  margin-bottom: 1rem;
}
.user-card:last-child { margin-bottom: 0; }
.user-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}
.user-card-meta strong { font-size: 1rem; }
.user-card-actions { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; }
.user-card-status {
  font-size: 0.85rem;
  color: var(--muted);
  margin-right: 0.5rem;
}

.home-hero .card-title { margin-bottom: 0.35rem; }
.home-site-link a { color: var(--accent); }
.home-quick {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.75rem;
}
.home-tile {
  display: block;
  width: 100%;
  text-align: left;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.home-tile:hover {
  border-color: var(--accent);
  background: rgba(107, 111, 78, 0.06);
}
.home-tile strong { display: block; font-size: 0.95rem; margin-bottom: 0.35rem; }
.home-tile span { font-size: 0.82rem; color: var(--muted); line-height: 1.4; }

.drop.disabled {
  opacity: 0.55;
  pointer-events: none;
  cursor: not-allowed;
}

.chart-wrap {
  overflow-x: auto;
  padding: 0.5rem 0 0.25rem;
}
.chart-bars {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  min-height: 200px;
  padding-bottom: 0.25rem;
}
.chart-col {
  flex: 1 1 0;
  min-width: 26px;
  max-width: 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
}
.chart-stack {
  width: 100%;
  height: 168px;
  display: flex;
  flex-direction: column-reverse;
  justify-content: flex-start;
  gap: 1px;
  border-radius: 4px 4px 0 0;
  background: rgba(30, 30, 30, 0.06);
}
.chart-seg {
  width: 100%;
  min-height: 2px;
  border-radius: 2px;
  transition: height 0.2s ease;
}
.chart-seg.image { background: var(--accent); }
.chart-seg.video { background: var(--madeira); }
.chart-label {
  font-size: 0.65rem;
  color: var(--muted);
  transform: rotate(-45deg);
  transform-origin: center;
  white-space: nowrap;
  margin-top: 0.5rem;
}
.chart-empty {
  color: var(--muted);
  font-size: 0.9rem;
  padding: 1rem 0;
}
.chart-legend {
  display: flex;
  gap: 1rem;
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
  color: var(--muted);
}
.chart-legend-item { display: inline-flex; align-items: center; gap: 0.35rem; }
.chart-legend .swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 2px;
}
.chart-legend .swatch.image { background: var(--accent); }
.chart-legend .swatch.video { background: var(--madeira); }

.storage-recent-thumb {
  width: 48px;
  height: 36px;
  object-fit: cover;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.2);
}
.nav-item.hidden-nav { display: none; }

.storage-banner {
  margin-bottom: 1rem;
}
#storage-detail > .storage-banner {
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  margin-bottom: 0.75rem;
  font-size: 0.88rem;
  border: 1px solid var(--border);
}
.storage-banner.ok { background: rgba(85, 107, 79, 0.12); border-color: var(--success); }
.storage-banner.warn { background: rgba(214, 122, 58, 0.12); border-color: var(--por-do-sol); color: var(--text); }
.storage-banner.danger { background: rgba(199, 111, 78, 0.15); border-color: var(--danger); }

.storage-r2-caption { margin: 0.25rem 0 0.75rem; }

.storage-meter {
  height: 10px;
  border-radius: 999px;
  background: rgba(30, 30, 30, 0.1);
  overflow: hidden;
  margin: 0.5rem 0 0.75rem;
}
.storage-meter > span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
  transition: width 0.2s;
}
.storage-meter.warn > span { background: var(--por-do-sol); }
.storage-meter.danger > span { background: var(--danger); }
.storage-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.65rem;
  margin-bottom: 0.75rem;
}
