/* ── Botões ───────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 18px;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  font-weight: 500;
  white-space: nowrap;
  transition: background var(--dur) var(--ease), box-shadow var(--dur) var(--ease), color var(--dur) var(--ease);
}
.btn:hover { text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.btn--primary { background: var(--brand); color: #fff; }
.btn--primary:hover { background: var(--brand-hover); }

.btn--ghost { background: transparent; border-color: var(--border); color: var(--text-muted); }
.btn--ghost:hover { background: var(--hover); color: var(--text); }

.btn--danger { color: var(--danger); }
.btn--danger:hover { background: var(--danger-soft); color: var(--danger); }

.btn--block { width: 100%; }

/* O "+ Novo" do Drive: pill com sombra e elevação no hover. */
.btn--new {
  width: 100%;
  height: 52px;
  justify-content: flex-start;
  gap: 12px;
  padding: 0 22px;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  box-shadow: var(--shadow-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.btn--new:hover { box-shadow: var(--shadow-2); background: var(--bg); }
.btn--new .icon { color: var(--brand); }

.icon-btn {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: var(--text-muted);
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.icon-btn:hover { background: var(--hover); color: var(--text); }

.segmented {
  display: inline-flex;
  padding: 2px;
  background: var(--surface-2);
  border-radius: var(--radius-pill);
}

.segmented__btn {
  display: grid;
  place-items: center;
  width: 34px;
  height: 32px;
  border-radius: var(--radius-pill);
  color: var(--text-muted);
}
.segmented__btn:hover { color: var(--text); }
.segmented__btn.is-active { background: var(--bg); color: var(--brand); box-shadow: var(--shadow-1); }

/* ── Campos ───────────────────────────────────────────────────────────── */

.field { display: flex; flex-direction: column; gap: 6px; }
.field--compact { flex: 1; min-width: 140px; }

.field--inline {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.field--inline .input { flex: 1; min-width: 200px; }

.field__label { font-size: 13px; font-weight: 500; color: var(--text-muted); }
.field__hint { font-size: 12px; color: var(--text-soft); }

.input,
.select {
  height: 42px;
  padding: 0 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.input:focus,
.select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.input::placeholder { color: var(--text-soft); }
.input--mono { font-family: var(--font-mono); font-size: 12.5px; }

.select { padding-right: 34px; cursor: pointer; }

/* ── Menus ────────────────────────────────────────────────────────────── */

.menu { position: relative; }
.menu--block { display: block; }

.menu__panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 60;
  min-width: 232px;
  padding: 6px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-3);
  animation: menu-in 120ms var(--ease);
}
.menu__panel--right { left: auto; right: 0; }

@keyframes menu-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: none; }
}

.menu__item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  height: 38px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  color: var(--text);
  text-align: left;
  font-size: 14px;
}
.menu__item:hover { background: var(--hover); text-decoration: none; }
.menu__item .icon { color: var(--text-muted); }
.menu__item--danger { color: var(--danger); }
.menu__item--danger .icon { color: var(--danger); }
.menu__item--danger:hover { background: var(--danger-soft); }

.menu__label {
  padding: 8px 12px 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-soft);
}

.menu__divider { margin: 6px 8px; }

.menu__header { display: flex; align-items: center; gap: 12px; padding: 10px 12px; }
.menu__identity { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.menu__identity strong { font-size: 14px; }
.menu__identity span { font-size: 12.5px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; }

/* ── Badges e avisos ──────────────────────────────────────────────────── */

.badge {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 10px;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  width: fit-content;
}
.badge--brand { background: var(--brand-soft); color: var(--brand); }
.badge--soft { background: var(--surface-2); color: var(--text-soft); }
.badge--ok { background: var(--ok-soft); color: var(--ok); }
.badge--warn { background: var(--warn-soft); color: #a97210; }
.badge--danger { background: var(--danger-soft); color: var(--danger); }

.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius);
  font-size: 13.5px;
  line-height: 1.45;
}
.alert--danger { background: var(--danger-soft); color: var(--danger); }
.alert--ok { background: var(--ok-soft); color: var(--ok); }
.alert--warn { background: var(--warn-soft); color: #a97210; }

/* ── Toasts ───────────────────────────────────────────────────────────── */

.toast-stack {
  position: fixed;
  left: 24px;
  bottom: 24px;
  z-index: 120;
  display: flex;
  flex-direction: column-reverse;
  gap: 10px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 280px;
  max-width: 420px;
  padding: 12px 14px;
  background: #1c2430;
  color: #f2f5f9;
  border-radius: var(--radius);
  box-shadow: var(--shadow-3);
  pointer-events: auto;
  animation: toast-in 200ms var(--ease);
}
.toast.is-leaving { animation: toast-out 160ms var(--ease) forwards; }
.toast__text { flex: 1; font-size: 13.5px; }
.toast__action {
  color: #8ab4ff;
  font-weight: 600;
  font-size: 13.5px;
  padding: 4px 8px;
  border-radius: 6px;
}
.toast__action:hover { background: rgba(255, 255, 255, .08); }
.toast--danger { background: #4a1d1a; }
.toast--ok .toast__icon { color: #6fe0ac; }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}
@keyframes toast-out {
  to { opacity: 0; transform: translateY(8px); }
}

/* ── Modais ───────────────────────────────────────────────────────────── */

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
}
.modal[hidden] { display: none; }

.modal__scrim { position: absolute; inset: 0; background: rgba(20, 26, 34, .42); }

.modal__box {
  position: relative;
  width: min(560px, 100%);
  max-height: min(86dvh, 760px);
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-3);
  animation: modal-in 180ms var(--ease);
  overflow: hidden;
}
.modal__box--sm { width: min(420px, 100%); }

@keyframes modal-in {
  from { opacity: 0; transform: translateY(12px) scale(.98); }
  to { opacity: 1; transform: none; }
}

.modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}
.modal__title { font-size: 17px; }

.modal__body { padding: 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 20px; }
.modal__foot { display: flex; justify-content: flex-end; gap: 8px; padding-top: 4px; }
.modal__error { color: var(--danger); font-size: 13px; }

/* ── Tabelas ──────────────────────────────────────────────────────────── */

.table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: auto;
}

.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th,
.table td { padding: 12px 16px; text-align: left; vertical-align: middle; }
.table thead th {
  position: sticky;
  top: 0;
  background: var(--surface);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table tbody tr { border-bottom: 1px solid var(--border); }
.table tbody tr:last-child { border-bottom: 0; }
.table tbody tr:hover { background: var(--hover); }
.table__muted { color: var(--text-muted); font-size: 12.5px; }
.table__actions { width: 56px; text-align: right; }

.table__identity { display: flex; align-items: center; gap: 12px; }
.table__identity strong { display: block; font-weight: 600; }

.usage-cell { display: flex; flex-direction: column; gap: 5px; min-width: 160px; }
.usage-cell__bar { height: 5px; border-radius: var(--radius-pill); background: var(--surface-2); overflow: hidden; }
.usage-cell__fill { display: block; height: 100%; width: 0; background: var(--brand); border-radius: inherit; }

.tabs { display: inline-flex; gap: 2px; padding: 3px; background: var(--surface-2); border-radius: var(--radius-pill); }
.tabs__item {
  padding: 7px 16px;
  border-radius: var(--radius-pill);
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 500;
}
.tabs__item:hover { color: var(--text); text-decoration: none; }
.tabs__item.is-active { background: var(--bg); color: var(--brand); box-shadow: var(--shadow-1); }

.panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
}
.panel__title { font-size: 15px; }

.filters { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }

.pager { display: flex; align-items: center; justify-content: center; gap: 16px; margin-top: 16px; }
.pager__info { font-size: 13px; color: var(--text-muted); }

.settings-form { display: flex; flex-direction: column; gap: 20px; max-width: 720px; }
.settings-form__foot { display: flex; gap: 10px; }

/* ── Diversos ─────────────────────────────────────────────────────────── */

.spinner {
  display: block;
  width: 26px;
  height: 26px;
  border: 2.5px solid var(--border);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--hover) 37%, var(--surface-2) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.2s ease-in-out infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 72px 24px;
  text-align: center;
}
.empty__art {
  display: grid;
  place-items: center;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--text-soft);
  margin-bottom: 6px;
}
.empty__title { font-size: 17px; }
.empty__text { color: var(--text-muted); max-width: 42ch; }
