/* ===== Aprovação de Pedidos — HTML/CSS/JS puro (fiel ao Claude Design) ===== */

:root {
  --color-primary: oklch(0.52 0.14 250);
  --color-primary-hover: oklch(0.46 0.14 250);
  --color-primary-dark: oklch(0.4 0.13 250);
  --color-primary-darker: oklch(0.27 0.1 250);

  --color-danger: oklch(0.5 0.18 25);
  --color-danger-text: oklch(0.4 0.15 25);
  --color-danger-bg: oklch(0.97 0.03 25);
  --color-danger-border: oklch(0.85 0.08 25);

  --color-success: oklch(0.55 0.14 145);
  --color-warning: oklch(0.62 0.16 55);

  --color-page-bg: oklch(0.97 0.005 250);

  --color-text: #1d2d3e;
  --color-text-secondary: #334;
  --color-muted: #5b738b;
  --color-border: #d3d9df;
  --color-divider: #eceef1;
  --color-divider-light: #f1f3f5;
  --color-bg-subtle: #f7f8f9;
  --color-bg-subtler: #fbfcfd;
  --color-footer-bg: #243648;
  --color-neutral-dot: #9aa7b3;
  --color-chip-bg: #eef4fb;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  color: var(--color-text);
  background: var(--color-page-bg);
  -webkit-font-smoothing: antialiased;
}

[hidden] { display: none !important; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #d3d9df; border-radius: 4px; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

button { font-family: inherit; cursor: pointer; }
input, textarea { font-family: inherit; }
a { text-decoration: none; }

.spacer { flex: 1; }
.muted { color: var(--color-muted); font-size: 13px; }
.link { font-size: 13px; color: var(--color-primary); cursor: pointer; }

/* ---- Botões ---- */
.btn {
  border: none;
  border-radius: 7px;
  font-size: 13.5px;
  font-weight: 600;
  padding: 9px 16px;
  cursor: pointer;
}
.btn--block { width: 100%; height: 44px; font-size: 14.5px; }
.btn--primary { background: var(--color-primary); color: #fff; }
.btn--primary:hover { background: var(--color-primary-hover); }
.btn--success { background: var(--color-success); color: #fff; }
.btn--danger { background: var(--color-danger); color: #fff; }
.btn--danger:disabled { opacity: 0.5; cursor: not-allowed; }
.btn--outline { background: #fff; color: var(--color-text-secondary); border: 1px solid var(--color-border); }
.btn--ghost-dark { background: none; color: #fff; border: 1px solid rgba(255, 255, 255, 0.3); }
.icon-btn {
  border: none;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-size: 15px;
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.25); }

/* ===== Login ===== */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 45%, var(--color-primary-darker) 100%);
}
.login-card {
  width: 100%;
  max-width: 400px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 24px 70px rgba(6, 33, 59, 0.45);
  padding: 32px 28px;
  animation: fadeIn 0.3s ease;
}
.login-card__brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 6px;
}
.login-card__logo {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-card__logo span {
  width: 12px;
  height: 12px;
  border: 2px solid #fff;
  border-radius: 3px;
}
.login-card__brand-text { font-size: 15px; font-weight: 700; color: var(--color-text); }
.login-card__title { margin: 2px 0 0; font-size: 22px; font-weight: 700; color: var(--color-text); text-align: center; }
.login-card__subtitle { margin: 4px 0 0; font-size: 13px; color: var(--color-muted); text-align: center; }

.login-error {
  margin-top: 20px;
  padding: 10px 12px;
  background: var(--color-danger-bg);
  border: 1px solid var(--color-danger-border);
  border-radius: 8px;
  color: var(--color-danger-text);
  font-size: 13px;
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.login-field { margin-top: 24px; display: flex; flex-direction: column; gap: 6px; }
.login-field label { font-size: 12.5px; font-weight: 600; color: var(--color-text-secondary); }
.login-field input {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font-size: 14px;
  outline: none;
}
#loginButton { margin-top: 22px; }

/* ===== Shell bar ===== */
.shellbar {
  background: var(--color-primary);
  color: #fff;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.shellbar__title { font-size: 17px; font-weight: 700; flex-shrink: 0; }
.avatar-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: #fff;
  color: var(--color-primary-dark);
  font-weight: 700;
  font-size: 12.5px;
}

/* ===== User menu ===== */
.menu-backdrop { position: fixed; inset: 0; z-index: 40; }
.user-menu {
  position: fixed;
  top: 56px;
  right: 24px;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 10px 34px rgba(20, 30, 45, 0.22);
  width: 200px;
  z-index: 50;
  overflow: hidden;
  animation: fadeIn 0.15s ease;
}
.user-menu__item { padding: 12px 16px; font-size: 13.5px; color: var(--color-text-secondary); cursor: pointer; }
.user-menu__item:hover { background: #f5f6f7; }
.user-menu__item--danger { color: var(--color-danger); font-weight: 600; }
.user-menu__item--danger:hover { background: #fdf2f2; }
.user-menu__divider { height: 1px; background: var(--color-divider); }

/* ===== Search bar ===== */
.search-bar {
  background: #fff;
  border-bottom: 1px solid var(--color-divider);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.search-bar input {
  width: 340px;
  max-width: 60vw;
  padding: 9px 12px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font-size: 13.5px;
  outline: none;
}
.search-bar__summary { font-size: 13px; color: var(--color-muted); }

/* ===== Painel (título + abas + selecionar todos) ===== */
.page-panel { background: #fff; }
.page-title { padding: 20px 24px 0; }
.page-title h1 { margin: 0; font-size: 22px; font-weight: 700; color: var(--color-text); }

.tabs {
  padding: 14px 24px 0;
  display: flex;
  gap: 28px;
  border-bottom: 1px solid #d9d9d9;
}
.tab {
  padding-bottom: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 7px;
  border-bottom: 2.5px solid transparent;
  background: none;
  border-left: none;
  border-right: none;
  border-top: none;
  font-family: inherit;
}
.tab.is-active { border-bottom-color: var(--color-primary); }
.tab__label { font-size: 14px; font-weight: 500; color: var(--color-muted); }
.tab.is-active .tab__label { font-weight: 700; color: var(--color-text); }
.tab__count {
  font-size: 11.5px;
  font-weight: 700;
  color: #fff;
  padding: 1px 7px;
  border-radius: 10px;
}
.tab__count--pending { background: var(--color-warning); }
.tab__count--approved { background: var(--color-success); }
.tab__count--rejected { background: var(--color-danger); }

.select-bar {
  background: var(--color-bg-subtler);
  padding: 10px 24px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--color-divider);
}
.select-bar input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; }
.select-bar__label { font-size: 13.5px; color: var(--color-text-secondary); cursor: pointer; }

/* ===== Cards ===== */
.cards-grid {
  flex: 1;
  padding: 16px 20px 32px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 16px;
  align-items: start;
}
.cards-grid__empty { grid-column: 1 / -1; text-align: center; padding: 60px 20px; color: var(--color-muted); font-size: 14px; }

.card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 0 0 1px rgba(34, 54, 73, 0.06), 0 2px 6px rgba(34, 54, 73, 0.08);
  overflow: hidden;
  border-top: 3px solid transparent;
}
.card--pending { border-top-color: var(--color-warning); }
.card--approved { border-top-color: var(--color-success); }
.card--rejected { border-top-color: var(--color-danger); }

.card__head {
  padding: 14px 16px 8px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.card__head-left { display: flex; align-items: flex-start; gap: 8px; }
.card__checkbox { width: 16px; height: 16px; margin-top: 3px; cursor: pointer; }
.card__order-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.card__number { font-size: 15px; font-weight: 700; color: var(--color-primary); }
.card__status { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 5px; color: #fff; }
.card__status--pending { background: var(--color-warning); }
.card__status--approved { background: var(--color-success); }
.card__status--rejected { background: var(--color-danger); }
.card__supplier { font-size: 13.5px; font-weight: 600; color: var(--color-text); margin-top: 2px; }
.card__total-label { font-size: 11.5px; color: var(--color-muted); text-align: right; }
.card__total-value { font-size: 16.5px; font-weight: 700; color: var(--color-text); text-align: right; white-space: nowrap; }

.card__meta { padding: 0 16px 10px; display: flex; flex-wrap: wrap; gap: 6px 24px; }
.card__meta-label { font-size: 11px; color: var(--color-muted); }
.card__meta-value { font-size: 13px; color: var(--color-text-secondary); }

.card__comments { margin: 0 16px 10px; padding: 8px 10px; background: var(--color-bg-subtle); border-radius: 8px; }
.card__comments-label { font-size: 11px; color: var(--color-muted); margin-bottom: 2px; }
.card__comments-text { font-size: 13px; color: var(--color-text-secondary); white-space: pre-wrap; overflow-wrap: anywhere; }

.card__items { margin: 0 16px 10px; border: 1px solid var(--color-divider); border-radius: 8px; overflow: hidden; }
.card__items-head, .card__items-row {
  display: grid;
  grid-template-columns: 1fr 46px 70px 76px;
  gap: 8px;
  padding: 6px 10px;
  font-size: 12.5px;
}
.card__items-head { background: var(--color-bg-subtle); font-size: 11px; color: var(--color-muted); font-weight: 600; }
.card__items-row { color: var(--color-text-secondary); border-top: 1px solid var(--color-divider-light); }
.card__items-row .num { text-align: right; }
.card__items-row .num--total { font-weight: 600; }
.card__items-row .material { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.card__attachments { padding: 0 16px 10px; display: flex; flex-wrap: wrap; gap: 6px; }
.card__attachment-chip { font-size: 12px; color: var(--color-primary); background: var(--color-chip-bg); padding: 4px 10px; border-radius: 6px; text-decoration: none; cursor: pointer; }
.card__attachment-chip:hover { text-decoration: underline; }

.card__actions { border-top: 1px solid var(--color-divider-light); padding: 8px 16px; display: flex; align-items: center; gap: 8px; }
.card__actions .btn--history { border: none; background: none; color: var(--color-muted); font-size: 13px; padding: 6px 4px; }

/* ===== Rodapé de aprovação em massa ===== */
.bulk-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--color-footer-bg);
  color: #fff;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 14px;
  z-index: 30;
}
.bulk-footer span { font-weight: 600; font-size: 13.5px; }
.bulk-footer__total { color: #c3ccd6; font-weight: 400 !important; }

/* ===== Diálogos ===== */
.dialog-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 30, 45, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  animation: fadeIn 0.15s ease;
}
.dialog {
  width: 420px;
  max-width: 90vw;
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}
.dialog--history { width: 460px; max-height: 80vh; overflow: auto; }
.dialog h3 { margin: 0 0 4px; font-size: 17px; color: var(--color-text); }
.dialog__subtitle { margin: 0 0 16px; font-size: 13px; color: var(--color-muted); }
.dialog__label { font-size: 12.5px; font-weight: 600; color: var(--color-text-secondary); display: block; margin-bottom: 6px; }
.dialog textarea {
  width: 100%;
  height: 90px;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font-size: 13.5px;
  outline: none;
  resize: none;
  font-family: inherit;
}
.dialog__hint { font-size: 12px; color: var(--color-muted); margin-top: 6px; }
.dialog__hint--error { color: var(--color-danger); }

.dialog__actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.dialog__header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.dialog__header .icon-btn { background: none; color: var(--color-muted); font-size: 18px; width: auto; height: auto; border-radius: 0; }

.history-list { display: flex; flex-direction: column; }
.history-entry { padding: 10px 0; border-top: 1px solid var(--color-divider-light); display: flex; gap: 10px; }
.history-entry__dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 5px; flex-shrink: 0; background: var(--color-neutral-dot); }
.history-entry__dot.status-approved { background: var(--color-success); }
.history-entry__dot.status-rejected { background: var(--color-danger); }
.history-entry__action { font-size: 13.5px; font-weight: 600; color: var(--color-text); }
.history-entry__date { font-size: 12px; color: var(--color-muted); margin-top: 1px; }
.history-entry__comment { font-size: 13px; color: var(--color-text-secondary); margin-top: 4px; }
.history-entry__error { font-size: 13px; color: var(--color-danger-text); margin-top: 4px; font-weight: 600; }

/* ===== Toast ===== */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: var(--color-text);
  color: #fff;
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
  z-index: 200;
  max-width: 80%;
  animation: fadeIn 0.2s ease;
}

/* Destaque do deep link vindo de uma notificação (NOTIF-10) */
.card--deeplink {
  box-shadow: 0 0 0 2px var(--color-primary), 0 4px 10px 0 rgba(10, 110, 209, 0.35);
  transition: box-shadow 0.3s ease;
}
