/* ═══════════════════════════════════════════════════════════════
   2PI Manager Drive — Design System  |  Dark Theme
   Primary: #38d0d3  |  Tipografia: Manrope + JetBrains Mono
   ═══════════════════════════════════════════════════════════════ */

/* ── Tokens ─────────────────────────────────────────────────── */
:root {
  /* Brand */
  --primary:        #38d0d3;
  --primary-dark:   #26b0b3;
  --primary-light:  rgba(56, 208, 211, 0.12);
  --primary-glow:   rgba(56, 208, 211, 0.20);

  /* Backgrounds */
  --bg:             #0c0e14;
  --bg-secondary:   #11141d;
  --surface:        #161921;
  --surface-2:      #1c1f2b;

  /* Borders */
  --border:         rgba(255,255,255,.07);
  --border-strong:  rgba(255,255,255,.13);
  --border-focus:   #38d0d3;

  /* Typography */
  --text:           #dde2f0;
  --text-muted:     #576070;
  --text-subtle:    #8892a4;

  /* Semantic */
  --green:          #34d399;
  --green-bg:       rgba(52, 211, 153, .10);
  --amber:          #fbbf24;
  --amber-bg:       rgba(251, 191, 36, .08);
  --red:            #f87171;
  --red-bg:         rgba(248, 113, 113, .10);
  --yellow:         #fbbf24;

  /* Radius */
  --radius-sm:  6px;
  --radius:     10px;
  --radius-lg:  14px;

  /* Shadows — deep on dark */
  --shadow-sm:  0 1px 4px rgba(0,0,0,.45);
  --shadow:     0 4px 20px rgba(0,0,0,.55), 0 1px 6px rgba(0,0,0,.35);
  --shadow-lg:  0 12px 40px rgba(0,0,0,.70), 0 2px 10px rgba(0,0,0,.45);

  /* Layout */
  --topbar-h:        58px;
  --sidebar-w:       220px;
  --sidebar-coll-w:  54px;
}

/* ── Reset ───────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Manrope', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img, svg { display: block; max-width: 100%; }
code, kbd, .mono { font-family: 'JetBrains Mono', monospace; }

/* ── Topbar ──────────────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .65rem 1.5rem;
  background: rgba(12, 14, 20, .92);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

.topbar__brand {
  display: flex;
  align-items: center;
  gap: .6rem;
  text-decoration: none;
  color: var(--text);
  flex-shrink: 0;
}
.topbar__brand img {
  width: 36px;
  height: 36px;
  object-fit: contain;
  flex-shrink: 0;
}
.topbar__brand-label { line-height: 1.15; }
.topbar__brand-label strong {
  display: block;
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text);
}
.topbar__brand-label span {
  display: block;
  font-size: .63rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--primary);
}

.topbar__nav {
  display: flex;
  align-items: center;
  gap: .2rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: .3rem .55rem;
}
.topbar__nav .nav-sep { color: var(--border-strong); font-size: .85rem; padding: 0 .1rem; user-select: none; }
.nav-link {
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: .28rem .7rem;
  border-radius: 999px;
  transition: color .15s, background .15s;
  text-decoration: none;
  letter-spacing: .01em;
}
.nav-link:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.nav-link.active { color: var(--primary); background: var(--primary-light); font-weight: 700; }

.topbar__right {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-shrink: 0;
}
.user-avatar {
  width: 34px; height: 34px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #0c0e14;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .72rem; font-weight: 800;
  flex-shrink: 0;
  box-shadow: 0 0 0 2px var(--primary-glow);
}
.btn-logout {
  display: flex; align-items: center; gap: .35rem;
  font-size: .8rem; font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  transition: color .15s;
}
.btn-logout:hover { color: var(--red); text-decoration: none; }

/* ── Sidebar ─────────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-w);
  padding-top: var(--topbar-h);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 90;
  overflow-y: auto;
  overflow-x: hidden;
  transition: transform .25s cubic-bezier(.4,0,.2,1), width .25s cubic-bezier(.4,0,.2,1), box-shadow .25s;
}

.sidebar__user {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .9rem .85rem .75rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.sidebar__user-info {
  overflow: hidden;
  min-width: 0;
  max-width: 160px;
  opacity: 1;
  transition: max-width .25s cubic-bezier(.4,0,.2,1), opacity .18s;
}
.sidebar__user-name {
  display: block;
  font-size: .82rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar__user-role {
  display: block;
  font-size: .68rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
}

.sidebar__nav {
  flex: 1;
  padding: .6rem .5rem;
  display: flex;
  flex-direction: column;
  gap: .05rem;
}
.sidebar__label {
  overflow: hidden;
  white-space: nowrap;
  max-width: 160px;
  opacity: 1;
  transition: max-width .25s cubic-bezier(.4,0,.2,1), opacity .18s;
}
.sidebar__group-label {
  font-size: .63rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: .65rem .7rem .25rem;
  margin-top: .15rem;
  opacity: .7;
}
.sidebar__link {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .52rem .75rem;
  border-radius: var(--radius-sm);
  font-size: .83rem;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  transition: background .13s, color .13s;
}
.sidebar__link svg { flex-shrink: 0; opacity: .65; transition: opacity .13s; }
.sidebar__link:hover { background: rgba(255,255,255,.04); color: var(--text); text-decoration: none; }
.sidebar__link:hover svg { opacity: 1; }
.sidebar__link.active { background: var(--primary-light); color: var(--primary); }
.sidebar__link.active svg { opacity: 1; }

.sidebar__footer {
  padding: .5rem .5rem .75rem;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.sidebar__logout {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .52rem .75rem;
  border-radius: var(--radius-sm);
  font-size: .83rem;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  transition: background .13s, color .13s;
}
.sidebar__logout svg { flex-shrink: 0; opacity: .65; transition: opacity .13s; }
.sidebar__logout:hover { background: var(--red-bg); color: var(--red); text-decoration: none; }
.sidebar__logout:hover svg { opacity: 1; }

/* ── Botão toggle sidebar ────────────────────────────────────── */
.sidebar__toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: .45rem;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  border-radius: var(--radius);
  transition: background .13s, color .13s;
  margin-bottom: .3rem;
}
.sidebar__toggle:hover { background: rgba(255,255,255,.05); color: var(--text); }
.sidebar__toggle svg { transition: transform .25s cubic-bezier(.4,0,.2,1); flex-shrink: 0; }

/* ── Sidebar colapsada (desktop only) ───────────────────────── */
@media (min-width: 769px) {
  .sidebar.is-collapsed { width: var(--sidebar-coll-w); }

  .sidebar.is-collapsed .sidebar__user-info,
  .sidebar.is-collapsed .sidebar__label {
    max-width: 0;
    opacity: 0;
    pointer-events: none;
  }

  .sidebar.is-collapsed .sidebar__group-label {
    opacity: 0;
    height: 0;
    overflow: hidden;
    padding: 0;
    margin: 0;
    pointer-events: none;
    transition: opacity .15s, height .2s, padding .2s, margin .2s;
  }

  .sidebar.is-collapsed .sidebar__user {
    justify-content: center;
    padding-left: .4rem;
    padding-right: .4rem;
  }
  /* oculta a setinha de perfil */
  .sidebar.is-collapsed .sidebar__user > svg:last-of-type {
    opacity: 0;
    width: 0;
    overflow: hidden;
    transition: opacity .15s, width .2s;
  }

  .sidebar.is-collapsed .sidebar__nav { padding: .5rem .2rem; }

  .sidebar.is-collapsed .sidebar__link,
  .sidebar.is-collapsed .sidebar__logout {
    justify-content: center;
    padding-left: .2rem;
    padding-right: .2rem;
  }

  .sidebar.is-collapsed .sidebar__footer { padding: .5rem .2rem .75rem; }

  .sidebar.is-collapsed .sidebar__toggle svg { transform: rotate(180deg); }

  .page.sidebar-is-collapsed { margin-left: var(--sidebar-coll-w); }
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 89;
  backdrop-filter: blur(2px);
}

.hamburger {
  display: none;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: .45rem;
  border-radius: var(--radius-sm);
  transition: color .13s, background .13s;
  flex-shrink: 0;
  line-height: 0;
}
.hamburger:hover { color: var(--text); background: rgba(255,255,255,.06); }

/* ── Layout principal ────────────────────────────────────────── */
.page {
  margin-left: var(--sidebar-w);
  padding: 2rem 1.5rem;
}
.page-header { margin-bottom: 1.75rem; }
.page-header h1 { font-size: 1.6rem; font-weight: 700; }
.page-header p  { color: var(--text-muted); margin-top: .25rem; font-size: .9rem; }

/* ── Splash Screen ───────────────────────────────────────────── */
#splash {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: radial-gradient(ellipse at 60% 10%, rgba(56,208,211,.12) 0%, transparent 55%),
              radial-gradient(ellipse at 15% 90%, rgba(56,208,211,.07) 0%, transparent 50%),
              var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  transition: opacity .5s ease, visibility .5s ease;
}
#splash.is-out {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.splash__logo {
  animation: splashPop .75s cubic-bezier(.34,1.56,.64,1) both;
}
.splash__logo img {
  width: 30vmin;
  height: 30vmin;
  object-fit: contain;
  filter: drop-shadow(0 0 4vmin rgba(56,208,211,.6));
  animation: splashGlow 1.4s ease-in-out .6s infinite alternate;
}
@keyframes splashPop {
  from { opacity: 0; transform: scale(.55); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes splashUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes splashGlow {
  from { filter: drop-shadow(0 0 16px rgba(56,208,211,.35)); }
  to   { filter: drop-shadow(0 0 40px rgba(56,208,211,.85)); }
}

/* ── Auth page ───────────────────────────────────────────────── */
.auth-page {
  background: radial-gradient(ellipse at 60% 0%, rgba(56,208,211,.08) 0%, transparent 60%),
              radial-gradient(ellipse at 10% 90%, rgba(56,208,211,.05) 0%, transparent 50%),
              var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem 1rem;
}

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 2.5rem 2.25rem;
  width: 100%;
  max-width: 420px;
}

.auth-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: .55rem;
  margin-bottom: 2rem;
}
.auth-brand__icon {
  width: 72px; height: 72px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.auth-brand__icon img {
  width: 72px; height: 72px;
  object-fit: contain;
  filter: drop-shadow(0 0 12px rgba(56,208,211,.4));
}
.auth-brand__label { line-height: 1.2; }
.auth-brand__label strong {
  display: block;
  font-size: .8rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text);
}
.auth-brand__label span {
  display: block;
  font-size: .7rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--primary);
}

.auth-title    { font-size: 1.45rem; font-weight: 700; margin-bottom: .4rem; color: var(--text); text-align: center; }
.auth-subtitle { font-size: .88rem; color: var(--text-muted); margin-bottom: 1.5rem; text-align: center; }

.auth-form { display: flex; flex-direction: column; gap: 1rem; }

.auth-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: -.25rem;
}

.link-muted { font-size: .83rem; color: var(--primary); font-weight: 600; }

/* ── Form fields ─────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: .4rem; }

.label {
  font-size: .83rem;
  font-weight: 600;
  color: var(--text-subtle);
}

.input {
  width: 100%;
  padding: .65rem .9rem;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: .9rem;
  color: var(--text);
  background: var(--bg-secondary);
  transition: border-color .15s, box-shadow .15s;
  outline: none;
}
.input::placeholder { color: var(--text-muted); opacity: .7; }
.input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}
.input.is-error { border-color: var(--red); }

select.input {
  cursor: pointer; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24'%3E%3Cpath fill='%2356606e' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .75rem center;
  padding-right: 2.5rem;
}

textarea.input { resize: vertical; min-height: 80px; }

/* Alias .form-input → .input */
.form-input {
  width: 100%;
  padding: .65rem .9rem;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: .9rem;
  color: var(--text);
  background: var(--bg-secondary);
  transition: border-color .15s, box-shadow .15s;
  outline: none;
}
.form-input::placeholder { color: var(--text-muted); opacity: .7; }
.form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}
textarea.form-input { resize: vertical; min-height: 80px; }

/* Checkbox customizado */
.checkbox-wrap {
  display: flex; align-items: center; gap: .5rem;
  cursor: pointer; font-size: .83rem; font-weight: 500; user-select: none;
}
.checkbox-input { position: absolute; opacity: 0; width: 0; height: 0; }
.checkbox-mark {
  width: 16px; height: 16px;
  border: 1.5px solid var(--border-strong);
  border-radius: 4px;
  background: var(--bg-secondary);
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: all .15s;
}
.checkbox-input:checked + .checkbox-mark {
  background: var(--primary); border-color: var(--primary);
}
.checkbox-input:checked + .checkbox-mark::after {
  content: '';
  width: 9px; height: 5px;
  border-left: 2px solid #0c0e14;
  border-bottom: 2px solid #0c0e14;
  transform: rotate(-45deg) translateY(-1px);
  display: block;
}

/* ── Botões ──────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .65rem 1.25rem;
  border: none; border-radius: var(--radius-sm);
  font-family: inherit; font-size: .88rem; font-weight: 700;
  cursor: pointer;
  transition: background .15s, box-shadow .15s, opacity .15s, color .15s;
  text-decoration: none;
  white-space: nowrap;
  letter-spacing: .01em;
}
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn--primary {
  background: var(--primary);
  color: #0c0e14;
  box-shadow: 0 0 16px var(--primary-glow);
}
.btn--primary:hover:not(:disabled) {
  background: var(--primary-dark);
  text-decoration: none;
  color: #0c0e14;
  box-shadow: 0 0 24px var(--primary-glow);
}
.btn--secondary {
  background: var(--surface-2);
  color: var(--text);
  border: 1.5px solid var(--border-strong);
}
.btn--secondary:hover:not(:disabled) { background: var(--surface); text-decoration: none; color: var(--text); }
.btn--ghost { background: transparent; color: var(--text-muted); }
.btn--ghost:hover:not(:disabled) { background: var(--surface-2); color: var(--text); text-decoration: none; }
.btn--danger { background: var(--red); color: #fff; }
.btn--danger:hover:not(:disabled) { background: #ef4444; text-decoration: none; }
.btn--sm { padding: .38rem .8rem; font-size: .78rem; }
.btn--block { width: 100%; }
.btn.is-loading { pointer-events: none; opacity: .6; }

/* ── Alertas ─────────────────────────────────────────────────── */
.alert {
  padding: .7rem 1rem;
  border-radius: var(--radius-sm);
  font-size: .86rem;
  font-weight: 500;
  border-left: 3px solid transparent;
}
.alert--error   { background: var(--red-bg);   border-color: var(--red);   color: var(--red); }
.alert--success { background: var(--green-bg); border-color: var(--green); color: var(--green); }
.alert--warn    { background: var(--amber-bg); border-color: var(--amber); color: var(--amber); }

/* ── Cards ───────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card__body { padding: 1.25rem 1.5rem; }
.card-body  { padding: 1.25rem 1.5rem; }
.card-title { font-size: 1rem; font-weight: 700; margin-bottom: .25rem; }

/* ── Badges de status ────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .22rem .7rem;
  border-radius: 999px;
  font-size: .73rem; font-weight: 700;
  white-space: nowrap;
  letter-spacing: .02em;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.badge--approved { background: var(--green-bg); color: var(--green); }
.badge--pending  { background: var(--amber-bg); color: var(--amber); }
.badge--changes  { background: var(--red-bg);   color: var(--red); }
.badge--draft    { background: rgba(255,255,255,.04); color: var(--text-muted); border: 1px solid var(--border-strong); }

/* ── Tabelas ─────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.table th, .table td {
  padding: .65rem 1rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
}
.table th {
  font-size: .75rem; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .05em;
  background: var(--bg-secondary);
}
.table tr:hover td { background: var(--surface-2); }

/* ── Toasts ──────────────────────────────────────────────────── */
#toast-root {
  position: fixed; bottom: 1.5rem; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: .5rem;
  z-index: 9999; pointer-events: none;
  width: 340px;
}
.toast {
  display: flex; align-items: flex-start; gap: .7rem;
  padding: .9rem 1rem;
  border-radius: var(--radius);
  font-size: .855rem; font-weight: 500; line-height: 1.45;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-left: 3px solid transparent;
  box-shadow: var(--shadow-lg);
  opacity: 0; transform: translateY(10px);
  transition: opacity .22s, transform .22s;
  pointer-events: auto;
  word-break: break-word;
  width: 100%;
}
.toast.show { opacity: 1; transform: translateX(0); }
.toast__icon { flex-shrink: 0; margin-top: 1px; }
.toast__msg  { flex: 1; color: var(--text); }
.toast-success { border-left-color: var(--green); }
.toast-success .toast__icon { color: var(--green); }
.toast-error   { border-left-color: var(--red); }
.toast-error   .toast__icon { color: var(--red); }
.toast-warn    { border-left-color: var(--amber); }
.toast-warn    .toast__icon { color: var(--amber); }
.toast-info    { border-left-color: var(--primary); }
.toast-info    .toast__icon { color: var(--primary); }

/* ── Utilitários ─────────────────────────────────────────────── */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
.text-muted { color: var(--text-muted); }
.text-sm    { font-size: .85rem; }
.font-mono  { font-family: 'JetBrains Mono', monospace; }
.flex       { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: .5rem; }
.gap-3 { gap: .75rem; }
.gap-4 { gap: 1rem; }
.mt-1 { margin-top: .25rem; }
.mt-2 { margin-top: .5rem; }
.mt-4 { margin-top: 1rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.w-full { width: 100%; }

/* ── Filtros/Tabs ────────────────────────────────────────────── */
.tabs {
  display: flex; gap: .25rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
}
.tab {
  padding: .55rem 1rem;
  font-size: .85rem; font-weight: 600;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
  transition: color .15s, border-color .15s;
  text-decoration: none;
  background: none; border-top: none; border-left: none; border-right: none;
  font-family: inherit;
}
.tab:hover { color: var(--text); text-decoration: none; }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ── Grade de entregas (área cliente) ────────────────────────── */
.delivery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.25rem;
}
.delivery-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 1.25rem;
  cursor: pointer;
  transition: box-shadow .15s, transform .1s, border-color .15s;
  text-decoration: none; color: inherit;
  display: block;
}
.delivery-card:hover {
  box-shadow: var(--shadow), 0 0 0 1px var(--primary-light);
  border-color: rgba(56,208,211,.2);
  transform: translateY(-1px);
  text-decoration: none; color: inherit;
}
.delivery-card__header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: .75rem; }
.delivery-card__icon { font-size: 2rem; }
.delivery-card__title { font-size: .95rem; font-weight: 700; margin-bottom: .25rem; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; word-break: break-all; }
.delivery-card__desc  { font-size: .82rem; color: var(--text-muted); line-height: 1.45; }
.delivery-card__meta  { display: flex; align-items: center; justify-content: space-between; margin-top: .85rem; font-size: .78rem; color: var(--text-muted); }
.delivery-card__bar   { height: 4px; border-radius: 2px; background: var(--border); margin-top: .5rem; overflow: hidden; }
.delivery-card__bar-fill { height: 100%; border-radius: 2px; transition: width .3s; }

/* ── Árvore de pastas (admin) ────────────────────────────────── */
#drive-tree { max-height: 58vh; overflow-y: auto; overflow-x: hidden; }

.drive-tree { list-style: none; padding: 0; margin: 0; }
.drive-tree li { padding: 0; }
.folder-node {
  display: flex; align-items: center; gap: .45rem;
  padding: .4rem .65rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: .855rem;
  color: var(--text);
  transition: background .1s;
  user-select: none;
}
.folder-node:hover { background: var(--surface-2); }
.folder-node.selected { background: var(--primary-light); color: var(--primary); font-weight: 600; }
.folder-node__arrow   { font-size: .7rem; color: var(--text-muted); width: .9rem; text-align: center; flex-shrink: 0; cursor: pointer; }
.folder-node__icon    { flex-shrink: 0; color: var(--primary); opacity: .85; }
.folder-node__name    { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder-node__gid     { font-size: .68rem; color: var(--text-muted); flex-shrink: 0; }
.folder-node__count   { margin-left: auto; font-size: .72rem; color: var(--text-muted); font-family: 'JetBrains Mono', monospace; }
.folder-node__actions { display: none; align-items: center; gap: .15rem; flex-shrink: 0; margin-left: .35rem; }
.folder-node:hover .folder-node__actions { display: flex; }
.folder-action-btn {
  background: none; border: none; padding: .2rem; border-radius: 4px;
  cursor: pointer; color: var(--text-muted); line-height: 1;
  display: flex; align-items: center;
}
.folder-action-btn:hover { background: var(--surface-2); }
.folder-btn-delete:hover { color: var(--red); }
.drive-tree ul { list-style: none; padding-left: 1.1rem; border-left: 1px solid var(--border); margin-left: .85rem; margin-top: .1rem; }

/* ── Painel de Permissões Admin ──────────────────────────────── */
.perm-layout {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 1.25rem;
  align-items: start;
}
@media (max-width: 860px) { .perm-layout { grid-template-columns: 1fr; } }

.perm-tree-panel { overflow: hidden; }
.perm-tree-header {
  display: flex; align-items: center; gap: .5rem;
  padding: .65rem 1rem;
  font-size: .7rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  background: var(--bg-secondary);
}

.perm-rights-panel { overflow: hidden; }
.perm-rights-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  gap: 1rem;
}
.perm-rights-actions {
  display: flex; align-items: center; justify-content: flex-end; gap: .75rem;
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
  background: var(--bg-secondary);
}

.user-list { max-height: 420px; overflow-y: auto; position: relative; transition: opacity .15s; }
.user-list.is-loading { opacity: .4; pointer-events: none; }
.user-list.is-loading::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(56,208,211,.04) 50%, transparent 100%);
  background-size: 200% 100%;
  animation: shimmer 1.2s ease-in-out infinite;
}
@keyframes shimmer {
  0%   { background-position: 200% center; }
  100% { background-position: -200% center; }
}
.user-row {
  display: flex; align-items: center; gap: .75rem;
  padding: .65rem 1.25rem;
  border-bottom: 1px solid var(--border);
  transition: background .1s;
}
.user-row:last-child { border-bottom: none; }
.user-row:hover { background: var(--surface-2); }
.user-row.granted { background: var(--primary-light); }
.user-row__avatar {
  width: 32px; height: 32px; flex-shrink: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #0c0e14;
  display: flex; align-items: center; justify-content: center;
  font-size: .72rem; font-weight: 800;
}
.user-row__info { flex: 1; min-width: 0; }
.user-row__name  { display: block; font-size: .85rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.user-row__email { display: block; font-size: .75rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── Modal / Dialog ──────────────────────────────────────────── */
.modal {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg); padding: 0;
  box-shadow: var(--shadow-lg);
  max-width: 480px; width: 90%;
  background: var(--surface);
  color: var(--text);
}
.modal::backdrop { background: rgba(0,0,0,.65); backdrop-filter: blur(4px); }
.modal__box { display: flex; flex-direction: column; }
.modal__header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  font-size: .95rem; font-weight: 700;
}
.modal__body    { padding: 1.25rem; display: flex; flex-direction: column; gap: .85rem; }
.modal__footer  {
  display: flex; justify-content: flex-end; gap: .75rem;
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
  background: var(--bg-secondary);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ── Confirm dialog ──────────────────────────────────────────── */
.confirm-dlg { max-width: 360px; }

/* ── Área do cliente: lista de arquivos ──────────────────────── */
.file-row { display: flex; align-items: center; gap: .75rem; padding: .65rem 1.25rem; border-bottom: 1px solid var(--border); transition: background .1s; }
.file-row:last-child { border-bottom: none; }
.file-row:hover { background: var(--surface-2); }
.file-row__icon { flex-shrink: 0; width: 20px; display: flex; align-items: center; justify-content: center; color: var(--text-muted); }
.file-row__name { flex: 1; font-size: .88rem; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.file-row__meta { font-size: .78rem; color: var(--text-muted); flex-shrink: 0; min-width: 80px; text-align: right; }
.file-row__actions { display: flex; gap: .4rem; flex-shrink: 0; }

/* ── Zona de upload (cliente) ────────────────────────────────── */
.upload-zone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 2rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  display: flex; flex-direction: column; align-items: center;
}
.upload-zone:hover,
.upload-zone--over {
  border-color: var(--primary);
  background: var(--primary-light);
}

/* ── Responsivo ──────────────────────────────────────────────── */
@media (max-width: 768px) {
  .topbar__nav { display: none; }
  .topbar-logout { display: none; }
  .hamburger { display: flex; align-items: center; justify-content: center; }
  .sidebar { transform: translateX(-100%); }
  .sidebar.is-open { transform: translateX(0); box-shadow: var(--shadow-lg); }
  .sidebar-overlay.is-open { display: block; }
  .page { padding: 1.25rem 1rem; margin-left: 0; }
  .auth-card { padding: 1.75rem 1.25rem; }
  .delivery-grid { grid-template-columns: 1fr; }
  .file-card-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
}

/* ── Timeline de aprovação ───────────────────────────────────── */
.timeline { display: flex; flex-direction: column; }
.timeline-item {
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: .75rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}
.timeline-item:last-child { border-bottom: none; }
.timeline-item__icon {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1.5px solid var(--border-strong);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  color: var(--text-muted);
}
.timeline-item--approved .timeline-item__icon { background: var(--green-bg); border-color: var(--green); color: var(--green); }
.timeline-item--changes  .timeline-item__icon { background: var(--red-bg);   border-color: var(--red);   color: var(--red); }
.timeline-item__header {
  display: flex; align-items: center; gap: .5rem;
  flex-wrap: wrap;
  margin-bottom: .3rem;
}
.timeline-item__message {
  font-size: .875rem; line-height: 1.6; margin: 0;
  color: var(--text);
}
.timeline-item--approved { background: rgba(52,211,153,.04); }
.timeline-item--changes  { background: rgba(248,113,113,.04); }

/* ── Thumbnails de arquivos ──────────────────────────────────── */
.file-thumb {
  width: 52px; height: 40px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  flex-shrink: 0;
  display: block;
}
.file-row__icon--thumb { width: 52px; flex-shrink: 0; }

/* ── Abas de status (área cliente) ──────────────────────────── */
.status-tabs {
  display: flex;
  gap: .35rem;
  flex-wrap: wrap;
}
.status-tab {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .35rem .85rem;
  border-radius: 9999px;
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface);
  border: 1.5px solid var(--border-strong);
  text-decoration: none;
  transition: border-color .13s, color .13s, background .13s;
  white-space: nowrap;
}
.status-tab:hover { border-color: var(--primary); color: var(--primary); text-decoration: none; }
.status-tab--active { background: var(--primary); border-color: var(--primary); color: #0c0e14; }
.status-tab--active:hover { color: #0c0e14; }
.status-tab__count {
  background: rgba(0,0,0,.2);
  color: inherit;
  border-radius: 9999px;
  padding: 0 .45rem;
  font-size: .72rem;
  font-weight: 700;
  min-width: 18px;
  text-align: center;
}
.status-tab:not(.status-tab--active) .status-tab__count {
  background: var(--surface-2);
  color: var(--text-muted);
}

/* ── Cards de arquivo (cliente/index) ────────────────────────── */
.delivery-card--file {
  display: flex;
  flex-direction: column;
  gap: .55rem;
}
.delivery-card--file .delivery-card__icon {
  font-size: 1rem;
  margin-bottom: .1rem;
  display: flex;
  align-items: center;
}
.delivery-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: .55rem;
  border-top: 1px solid var(--border);
  font-size: .78rem;
}
.delivery-card__action {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  font-size: .78rem;
  font-weight: 700;
  color: var(--primary);
}

/* ── Preview iframe (approval) ───────────────────────────────── */
.preview-frame {
  width: 100%;
  height: 70vh;
  min-height: 480px;
  border: none;
  border-radius: var(--radius);
  background: var(--bg-secondary);
  display: block;
}
.approval-layout {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 1.25rem;
  align-items: start;
}
@media (max-width: 900px) {
  .approval-layout { grid-template-columns: 1fr; }
  .preview-frame { height: 55vw; min-height: 280px; }
}

/* ── Cards de arquivo (folder view) ─────────────────────────── */
.file-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
}
.file-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: box-shadow .15s, border-color .15s, transform .1s;
  cursor: pointer;
}
.file-card:hover {
  box-shadow: var(--shadow);
  border-color: rgba(56,208,211,.2);
  transform: translateY(-1px);
}
.file-card__preview {
  position: relative;
  aspect-ratio: 9 / 16;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}
.file-card__preview img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.file-card__preview-icon {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}
.file-card__badge {
  position: absolute;
  bottom: .5rem;
  left: .5rem;
}
.file-card__play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,.35);
}
.file-card__body {
  padding: .75rem .9rem .5rem;
  flex: 1;
}
.file-card__name {
  font-size: .83rem;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  word-break: break-all;
  line-height: 1.4;
  margin-bottom: .3rem;
}
.file-card__meta {
  font-size: .72rem;
  color: var(--text-muted);
}
.file-card__actions {
  padding: .55rem .9rem .75rem;
  display: flex;
  gap: .4rem;
  border-top: 1px solid var(--border);
  margin-top: .5rem;
}

/* Subfolder strip */
.subfolder-strip {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
  margin-bottom: 1.25rem;
}
.subfolder-chip {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .4rem .85rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .82rem;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  transition: border-color .13s, background .13s;
}
.subfolder-chip:hover {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
  text-decoration: none;
}

/* ── Barra de pesquisa ───────────────────────────────────────── */
.search-wrap {
  position: relative;
}
.search-wrap svg {
  position: absolute;
  left: .75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  flex-shrink: 0;
}
.search-wrap input {
  width: 100%;
  padding: .58rem .9rem .58rem 2.3rem;
  background: var(--surface);
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius);
  color: var(--text);
  font-size: .875rem;
  font-family: inherit;
  outline: none;
  transition: border-color .15s;
}
.search-wrap input:focus { border-color: var(--primary); }
.search-wrap input::placeholder { color: var(--text-muted); }
.search-wrap input::-webkit-search-cancel-button { cursor: pointer; }

/* ── Grid de usuários ────────────────────────────────────────── */
.users-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}
.user-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: border-color .15s, box-shadow .15s, transform .1s;
}
.user-card:hover {
  border-color: rgba(56,208,211,.18);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}
.user-card[hidden] { display: none; }

.user-card__top {
  display: flex;
  align-items: flex-start;
  gap: .9rem;
  padding: 1.15rem 1.1rem .8rem;
}
.user-card__avatar {
  width: 58px; height: 58px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #0c0e14;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem; font-weight: 800;
  flex-shrink: 0;
  overflow: hidden;
  border: 2.5px solid var(--primary-glow);
}
.user-card__avatar img {
  width: 100%; height: 100%;
  object-fit: cover; display: block;
}
.user-card__name {
  font-size: .9rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.35;
  display: flex;
  align-items: baseline;
  gap: .4rem;
  flex-wrap: wrap;
}
.user-card__you {
  font-size: .68rem;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-light);
  border-radius: 999px;
  padding: .05rem .45rem;
  letter-spacing: .01em;
}
.user-card__email {
  font-size: .75rem;
  color: var(--text-muted);
  margin-top: .2rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.user-card__badges {
  display: flex; gap: .35rem;
  margin-top: .55rem;
  flex-wrap: wrap;
}
.user-card__meta {
  display: flex; align-items: center; gap: .4rem;
  padding: .5rem 1.1rem;
  border-top: 1px solid var(--border);
  font-size: .72rem;
  color: var(--text-muted);
}
.user-card__actions {
  display: flex; gap: .4rem;
  padding: .65rem .9rem .85rem;
  margin-top: auto;
}

/* ── Perfil do usuário ───────────────────────────────────────── */
.profile-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 1.5rem;
  align-items: start;
}
@media (max-width: 640px) {
  .profile-layout { grid-template-columns: 1fr; }
}

.profile-avatar-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 1.5rem 1.25rem 1.25rem;
}

.profile-avatar-wrapper {
  position: relative;
  cursor: pointer;
  border-radius: 50%;
  display: inline-block;
  margin-bottom: .85rem;
}
.profile-avatar {
  width: 108px; height: 108px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  display: flex; align-items: center; justify-content: center;
  font-size: 2.1rem; font-weight: 800; color: #0c0e14;
  overflow: hidden;
  border: 3px solid var(--primary-glow);
  transition: border-color .15s;
  user-select: none;
  position: relative;
}
.profile-avatar img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  position: absolute; inset: 0;
}
.profile-avatar-overlay {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: rgba(0,0,0,.58);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .3rem;
  color: #fff;
  font-size: .75rem;
  font-weight: 600;
  opacity: 0;
  transition: opacity .18s;
}
.profile-avatar-wrapper:hover .profile-avatar-overlay { opacity: 1; }
.profile-avatar-wrapper:hover .profile-avatar { border-color: var(--primary); }

.profile-avatar-spinner {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: rgba(0,0,0,.65);
  display: flex; align-items: center; justify-content: center;
  color: var(--primary);
}

/* avatar com foto no topbar/sidebar */
.topbar-avatar-img,
img.sidebar__user-avatar-img {
  width: 34px; height: 34px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--primary-glow);
  flex-shrink: 0;
}

/* sidebar__user quando é link */
a.sidebar__user {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .9rem .85rem .75rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  color: var(--text);
}
a.sidebar__user:hover { background: rgba(255,255,255,.03); text-decoration: none; }

/* ── Scrollbar (Webkit) ──────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
