/* ==========================================================================
   FLEXO by Multisac — Portal de Aprovação de Imagens
   ========================================================================== */

:root {
  --green: #1fa85c;
  --green-dark: #178a4b;
  --green-darker: #0f6e3b;
  --green-soft: #e8f7ee;
  --green-soft-2: #d4f0df;

  --ink: #1b2430;
  --ink-2: #48566a;
  --muted: #8a97a8;
  --line: #e7ebf0;
  --bg: #f4f6f9;
  --card: #ffffff;

  --amber: #f4a72c;
  --amber-soft: #fdf1dd;
  --red: #e5484d;
  --red-soft: #fcecec;
  --blue: #2f7de1;
  --blue-soft: #e6f0fc;

  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 8px 24px rgba(16, 24, 40, .06);
  --shadow-lg: 0 12px 40px rgba(16, 24, 40, .14);
  --font: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; }
a { color: inherit; }
[hidden] { display: none !important; }

/* ---------- Utilities ---------- */
.hidden { display: none !important; }
.spacer { flex: 1; }

/* ==========================================================================
   LOGIN
   ========================================================================== */
.login {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  min-height: 100vh;
}
.login__brandside {
  background: linear-gradient(160deg, #f3faf5 0%, #e4f5ea 60%, #d5efdf 100%);
  padding: 56px 60px;
  display: flex;
  flex-direction: column;
}
.brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-weight: 800;
  letter-spacing: .5px;
}
.brand__logo {
  font-size: 30px;
  color: var(--ink);
  font-weight: 800;
}
.brand__logo .x { color: var(--green); }
.brand__by { font-size: 12px; color: var(--muted); font-weight: 600; letter-spacing: 1px; }

.login__tagline {
  margin-top: 60px;
  font-size: 30px;
  line-height: 1.25;
  font-weight: 700;
  color: var(--ink);
  max-width: 360px;
}
.login__tagline .accent { color: var(--green); }

.login__art {
  margin-top: auto;
  display: flex;
  justify-content: center;
}
.pouch {
  width: 200px; height: 250px;
  background: linear-gradient(150deg, #2b2f36, #12151a);
  border-radius: 16px 16px 8px 8px;
  box-shadow: var(--shadow-lg);
  position: relative;
  display: flex; align-items: center; justify-content: center;
  transform: rotate(-4deg);
}
.pouch::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 26px;
  background: repeating-linear-gradient(90deg, #3a3f47 0 6px, #2b2f36 6px 12px);
  border-radius: 16px 16px 0 0;
}
.pouch__m { color: #fff; font-size: 62px; font-weight: 800; }

.login__formside {
  display: flex; align-items: center; justify-content: center;
  padding: 40px;
}
.login__card {
  width: 100%; max-width: 380px;
}
.login__welcome { font-size: 24px; font-weight: 700; margin: 0 0 4px; text-align: center; }
.login__sub { color: var(--muted); text-align: center; margin: 0 0 28px; font-size: 14px; }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--ink-2); }
.field input, .field select, .field textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 14px;
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px var(--green-soft);
}

.login__row {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 13px; margin: 4px 0 20px;
}
.login__row label { display: flex; align-items: center; gap: 7px; color: var(--ink-2); cursor: pointer; }
.login__row a { color: var(--green); text-decoration: none; font-weight: 600; }

.btn {
  border: none; border-radius: var(--radius-sm);
  padding: 12px 18px; font-size: 14px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: background .15s, transform .05s, box-shadow .15s;
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--green); color: #fff; }
.btn--primary:hover { background: var(--green-dark); }
.btn--block { width: 100%; }
.btn--ghost { background: #fff; border: 1px solid var(--line); color: var(--ink); }
.btn--ghost:hover { background: #f7f9fb; }
.btn--danger { background: #fff; border: 1px solid var(--red); color: var(--red); }
.btn--danger:hover { background: var(--red-soft); }
.btn--approve { background: var(--green); color: #fff; }
.btn--approve:hover { background: var(--green-dark); }
.btn--sm { padding: 8px 14px; font-size: 13px; }

.login__divider {
  text-align: center; color: var(--muted); font-size: 12px;
  margin: 18px 0; position: relative;
}
.login__divider::before, .login__divider::after {
  content: ""; position: absolute; top: 50%; width: 38%; height: 1px; background: var(--line);
}
.login__divider::before { left: 0; }
.login__divider::after { right: 0; }

.btn--ms { width: 100%; }
.login__hint {
  margin-top: 22px; font-size: 12px; color: var(--muted);
  background: var(--bg); border: 1px dashed var(--line);
  border-radius: var(--radius-sm); padding: 12px 14px; line-height: 1.6;
}
.login__hint b { color: var(--ink-2); }
.login__hint code {
  background: #fff; border: 1px solid var(--line); border-radius: 5px;
  padding: 1px 6px; font-size: 11.5px; cursor: pointer;
}
.login__foot { text-align: center; color: var(--muted); font-size: 11px; margin-top: 28px; }
.login__switch { text-align: center; font-size: 13px; color: var(--ink-2); margin-top: 16px; }
.login__switch a { color: var(--green); font-weight: 600; text-decoration: none; margin-left: 5px; }
.mode-badge { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .3px; padding: 3px 10px; border-radius: 20px; }
.mode-badge.demo { background: var(--amber-soft); color: #c67f0c; }
.mode-badge.secure { background: var(--green-soft); color: var(--green-darker); }
.app-loading { display: grid; place-items: center; min-height: 100vh; color: var(--muted); font-size: 15px; }

/* ---------- Backoffice ---------- */
.botable { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.botable thead th { text-align: left; padding: 12px 18px; color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .3px; border-bottom: 1px solid var(--line); }
.botable tbody td { padding: 12px 18px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.botable tbody tr:last-child td { border-bottom: none; }
.botable tbody tr:hover { background: var(--bg); }
.botable .ta-r { text-align: right; white-space: nowrap; }
.botable .ta-r .btn { margin-left: 6px; }
.bo-user { display: flex; align-items: center; gap: 10px; }
.bo-user b { font-size: 13.5px; display: block; }
.bo-user span { font-size: 12px; color: var(--muted); }
.bo-code { background: var(--bg); border: 1px solid var(--line); border-radius: 5px; padding: 2px 8px; font-size: 12px; font-weight: 700; color: var(--green-darker); }
.botable .muted { color: var(--muted); }
.bo-switch { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--ink-2); margin-top: 6px; cursor: pointer; }
.field-hint { display: block; font-size: 12px; color: var(--muted); margin-top: 6px; line-height: 1.4; }
.role-pill--admin { background: #ede9fe; color: #6d28d9; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.login__error {
  color: var(--red); font-size: 13px; margin: -6px 0 14px; min-height: 18px; font-weight: 500;
}

/* ==========================================================================
   APP SHELL
   ========================================================================== */
.app { display: grid; grid-template-columns: 244px 1fr; min-height: 100vh; }

.sidebar {
  background: #fff; border-right: 1px solid var(--line);
  padding: 22px 16px; display: flex; flex-direction: column; gap: 4px;
  position: sticky; top: 0; height: 100vh;
}
.sidebar__brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 20px; }
.sidebar__brand .mark {
  width: 30px; height: 30px; border-radius: 8px; background: var(--green);
  color: #fff; font-weight: 800; display: grid; place-items: center; font-size: 17px;
}
.sidebar__brand b { font-size: 16px; letter-spacing: .3px; }

.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px; border-radius: var(--radius-sm);
  color: var(--ink-2); font-size: 14px; font-weight: 500;
  border: none; background: none; width: 100%; text-align: left;
  transition: background .12s, color .12s;
}
.nav-item:hover { background: var(--bg); color: var(--ink); }
.nav-item.active { background: var(--green-soft); color: var(--green-darker); font-weight: 600; }
.nav-item .ico { width: 18px; height: 18px; flex: none; }
.nav-item .badge {
  margin-left: auto; background: var(--green); color: #fff;
  font-size: 11px; font-weight: 700; border-radius: 20px; padding: 1px 8px;
}
.nav-item.active .badge { background: var(--green-dark); }

.sidebar__user {
  margin-top: auto; display: flex; align-items: center; gap: 10px;
  padding: 12px 10px; border-top: 1px solid var(--line);
}
.avatar {
  width: 36px; height: 36px; border-radius: 50%; flex: none;
  background: linear-gradient(135deg, var(--green), var(--green-darker));
  color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 14px;
}
.sidebar__user .who { line-height: 1.2; min-width: 0; }
.sidebar__user .who b { font-size: 13.5px; display: block; }
.sidebar__user .who span { font-size: 12px; color: var(--muted); }
.sidebar__user button {
  margin-left: auto; background: none; border: none; color: var(--muted);
  font-size: 12px; font-weight: 600;
}
.sidebar__user button:hover { color: var(--red); }

/* ---------- Main ---------- */
.main { padding: 26px 32px 60px; overflow: auto; }
.topbar { display: flex; align-items: center; gap: 16px; margin-bottom: 6px; }
.search {
  flex: 1; max-width: 420px; position: relative;
}
.search input {
  width: 100%; padding: 10px 14px 10px 38px;
  border: 1px solid var(--line); border-radius: 22px; background: #fff; font-size: 13.5px;
}
.search svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.topbar__actions { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.icon-btn { position: relative; background: #fff; border: 1px solid var(--line); border-radius: 50%; width: 40px; height: 40px; display: grid; place-items: center; color: var(--ink-2); }
.icon-btn .dot { position: absolute; top: 6px; right: 6px; background: var(--red); color: #fff; font-size: 10px; font-weight: 700; border-radius: 10px; min-width: 16px; height: 16px; display: grid; place-items: center; padding: 0 3px; }
.menu-toggle { display: none; }

.hello { font-size: 26px; font-weight: 800; margin: 18px 0 2px; }
.hello .wave { font-size: 22px; }
.subhead { color: var(--muted); margin: 0 0 22px; font-size: 14px; }

.role-pill {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12px; font-weight: 700; letter-spacing: .3px;
  padding: 4px 12px; border-radius: 20px; margin-left: 10px; vertical-align: middle;
}
.role-pill--forn { background: var(--blue-soft); color: var(--blue); }
.role-pill--cli { background: var(--green-soft); color: var(--green-darker); }

/* ---------- Stat cards ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 26px; }
.stat {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow);
}
.stat__top { display: flex; align-items: flex-start; justify-content: space-between; }
.stat__num { font-size: 30px; font-weight: 800; line-height: 1; }
.stat__ico { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; }
.stat__ico.amber { background: var(--amber-soft); color: var(--amber); }
.stat__ico.green { background: var(--green-soft); color: var(--green); }
.stat__ico.red { background: var(--red-soft); color: var(--red); }
.stat__ico.blue { background: var(--blue-soft); color: var(--blue); }
.stat__label { color: var(--ink-2); font-size: 13.5px; margin-top: 10px; font-weight: 500; }
.stat__link { color: var(--green); font-size: 12.5px; font-weight: 600; margin-top: 8px; display: inline-block; cursor: pointer; }

/* ---------- Panels ---------- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel__head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.panel__head h3 { margin: 0; font-size: 15.5px; }
.panel__head a { color: var(--green); font-size: 12.5px; font-weight: 600; cursor: pointer; }
.panel__body { padding: 8px 10px; }

.arte-row {
  display: flex; align-items: center; gap: 14px; padding: 12px 12px; border-radius: 10px; cursor: pointer;
  transition: background .12s;
}
.arte-row:hover { background: var(--bg); }
.arte-thumb {
  width: 46px; height: 46px; border-radius: 10px; flex: none;
  background-size: cover; background-position: center; border: 1px solid var(--line);
}
.arte-row .meta { min-width: 0; flex: 1; }
.arte-row .meta b { font-size: 14px; display: block; }
.arte-row .meta span { font-size: 12.5px; color: var(--muted); }
.arte-row .side { text-align: right; }
.arte-row .side .time { font-size: 12px; color: var(--muted); display: block; margin-bottom: 5px; }

.tag { font-size: 11.5px; font-weight: 700; padding: 3px 10px; border-radius: 20px; white-space: nowrap; }
.tag--wait { background: var(--amber-soft); color: #c67f0c; }
.tag--ok { background: var(--green-soft); color: var(--green-darker); }
.tag--no { background: var(--red-soft); color: var(--red); }
.tag--prod { background: var(--blue-soft); color: var(--blue); }

/* ---------- Projects table ---------- */
.card-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; }
.projcard {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden; cursor: pointer; transition: transform .12s, box-shadow .12s;
}
.projcard:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.projcard__img { height: 150px; background-size: cover; background-position: center; position: relative; }
.projcard__img .tag { position: absolute; top: 10px; right: 10px; }
.projcard__body { padding: 14px 16px; }
.projcard__body b { font-size: 15px; }
.projcard__body .cli { color: var(--muted); font-size: 13px; margin-top: 2px; }
.projcard__foot { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; font-size: 12px; color: var(--muted); }

.section-title { font-size: 18px; font-weight: 700; margin: 4px 0 18px; display: flex; align-items: center; gap: 12px; }
.section-title .count { background: var(--bg); color: var(--ink-2); font-size: 12px; font-weight: 700; padding: 2px 10px; border-radius: 20px; }

.filters { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--line); background: #fff; color: var(--ink-2);
  padding: 7px 14px; border-radius: 20px; font-size: 13px; font-weight: 500;
}
.chip.active { background: var(--green); color: #fff; border-color: var(--green); }

.empty {
  text-align: center; color: var(--muted); padding: 60px 20px; font-size: 14px;
  border: 1px dashed var(--line); border-radius: var(--radius); background: #fff;
}

/* ---------- Uploader ---------- */
.uploader {
  border: 2px dashed var(--green-soft-2); border-radius: var(--radius);
  background: var(--green-soft); padding: 30px; text-align: center; cursor: pointer;
  transition: background .12s, border-color .12s;
}
.uploader:hover { background: #ddf3e5; border-color: var(--green); }
.uploader.drag { background: #d0efdb; border-color: var(--green); }
.uploader svg { color: var(--green); }
.uploader b { display: block; margin-top: 8px; font-size: 15px; }
.uploader span { color: var(--ink-2); font-size: 13px; }

/* ==========================================================================
   APPROVAL DETAIL
   ========================================================================== */
.detail { display: grid; grid-template-columns: 1fr 360px; gap: 20px; align-items: start; }
.viewer { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.viewer__bar { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.viewer__bar b { font-size: 16px; }
.viewer__ver { background: var(--bg); border: 1px solid var(--line); font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 20px; color: var(--ink-2); }
.viewer__stage {
  background: #f0f2f5; padding: 26px; display: grid; place-items: center; min-height: 420px;
}
.viewer__stage img { max-width: 100%; max-height: 520px; border-radius: 8px; box-shadow: var(--shadow-lg); }
.viewer__foot { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-top: 1px solid var(--line); }

.side-panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); display: flex; flex-direction: column; max-height: 640px; }
.side-panel__tabs { display: flex; border-bottom: 1px solid var(--line); }
.side-panel__tabs button {
  flex: 1; padding: 14px; background: none; border: none; font-size: 13.5px; font-weight: 600;
  color: var(--muted); border-bottom: 2px solid transparent;
}
.side-panel__tabs button.active { color: var(--green-darker); border-bottom-color: var(--green); }
.side-panel__body { padding: 16px 18px; overflow: auto; flex: 1; }

.comment { display: flex; gap: 10px; margin-bottom: 18px; }
.comment .avatar { width: 32px; height: 32px; font-size: 12px; }
.comment .body b { font-size: 13.5px; }
.comment .body .txt { font-size: 13.5px; color: var(--ink-2); margin: 3px 0; line-height: 1.5; }
.comment .body .time { font-size: 11.5px; color: var(--muted); }

.comment-box { border-top: 1px solid var(--line); padding: 12px; display: flex; gap: 8px; }
.comment-box input { flex: 1; border: 1px solid var(--line); border-radius: 22px; padding: 10px 14px; font-size: 13.5px; }
.comment-box button { background: var(--green); border: none; color: #fff; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; flex: none; }

.info-row { display: flex; justify-content: space-between; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.info-row:last-child { border-bottom: none; }
.info-row span { color: var(--muted); }
.info-row b { font-weight: 600; }

.back-link { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); font-size: 13.5px; font-weight: 600; background: none; border: none; margin-bottom: 16px; }
.back-link:hover { color: var(--green); }

/* ---------- Toast ---------- */
.toast-wrap { position: fixed; bottom: 24px; right: 24px; display: flex; flex-direction: column; gap: 10px; z-index: 1000; }
.toast {
  background: var(--ink); color: #fff; padding: 13px 18px; border-radius: 10px;
  font-size: 13.5px; box-shadow: var(--shadow-lg); display: flex; align-items: center; gap: 10px;
  animation: slidein .25s ease;
}
.toast.ok { background: var(--green-dark); }
.toast.no { background: var(--red); }
@keyframes slidein { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- Modal ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(16,24,40,.45); display: grid; place-items: center; z-index: 900; padding: 20px; }
.modal { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow-lg); width: 100%; max-width: 460px; padding: 24px; }
.modal h3 { margin: 0 0 4px; font-size: 18px; }
.modal p { color: var(--muted); font-size: 13.5px; margin: 0 0 18px; }
.modal__actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
  .detail { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .login { grid-template-columns: 1fr; }
  .login__brandside { display: none; }
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 100; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: none; }
  .menu-toggle { display: grid; }
  .main { padding: 20px; }
  .stats { grid-template-columns: 1fr; }
}
