/* =====================================================================
   Power BI · Losung Express
   Sistema visual baseado no Microsoft Fluent Design.
   Tipografia Segoe UI, tokens neutros do Fluent, profundidade em
   camadas e o laranja da marca como cor de destaque.
   ===================================================================== */

:root {
  --font: "Segoe UI", -apple-system, BlinkMacSystemFont, "Segoe UI Web (West European)",
          system-ui, Roboto, "Helvetica Neue", sans-serif;
  --font-mono: "Cascadia Mono", "Consolas", "Courier New", monospace;

  /* Neutros Fluent */
  --n-white:   #ffffff;
  --n-2:       #faf9f8;
  --n-4:       #f3f2f1;
  --n-6:       #edebe9;
  --n-8:       #e1dfdd;
  --n-20:      #d2d0ce;
  --n-30:      #c8c6c4;
  --n-60:      #a19f9d;
  --n-90:      #605e5c;
  --n-130:     #323130;
  --n-160:     #201f1e;

  /* Marca */
  --brand:        #e2620f;
  --brand-hover:  #c4540c;
  --brand-press:  #a44608;
  --brand-tint:   #fdf1e7;
  --brand-border: #f6cdaa;

  /* Semânticos */
  --ok:        #0f7b0f;
  --ok-bg:     #f1faf1;
  --ok-border: #9fd89f;
  --warn:      #855a00;
  --warn-bg:   #fff9f0;
  --warn-border: #f2d9a8;
  --err:       #a4262c;
  --err-bg:    #fdf3f4;
  --err-border: #eeacb2;

  /* Profundidade Fluent */
  --depth-2:  0 1px 2px rgba(0,0,0,.09), 0 .3px .9px rgba(0,0,0,.07);
  --depth-4:  0 2px 4px rgba(0,0,0,.10), 0 .5px 1.2px rgba(0,0,0,.07);
  --depth-8:  0 4px 8px rgba(0,0,0,.10), 0 1px 2px rgba(0,0,0,.07);
  --depth-16: 0 8px 16px rgba(0,0,0,.11), 0 2px 4px rgba(0,0,0,.07);
  --depth-64: 0 25px 50px rgba(0,0,0,.14), 0 4px 10px rgba(0,0,0,.08);

  --r-sm: 4px;
  --r-md: 6px;
  --r-lg: 8px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  color: var(--n-160);
  background: var(--n-2);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, p { margin: 0; }
a { color: inherit; }

/* garante que o atributo [hidden] vença regras de display do próprio CSS */
[hidden] { display: none !important; }

:focus-visible {
  outline: 2px solid var(--n-160);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

/* =========================================================
   Barra superior
   ========================================================= */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 52px;
  padding: 0 20px;
  background: var(--n-white);
  border-bottom: 1px solid var(--n-8);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.company-logo {
  height: 26px;
  width: auto;
  display: block;
  flex-shrink: 0;
}

.brand-divider {
  width: 1px;
  height: 20px;
  background: var(--n-20);
  flex-shrink: 0;
}

.product-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--n-160);
  white-space: nowrap;
}

.product-tag {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .02em;
  color: var(--brand);
  background: var(--brand-tint);
  border: 1px solid var(--brand-border);
  border-radius: var(--r-sm);
  padding: 2px 7px;
  white-space: nowrap;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.user-pill__name {
  font-size: 13px;
  font-weight: 600;
  color: var(--n-130);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

.topbar-action {
  font-size: 13px;
  font-weight: 600;
  color: var(--n-90);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: var(--r-sm);
  white-space: nowrap;
  transition: background .1s ease, color .1s ease;
}
.topbar-action:hover { background: var(--n-4); color: var(--n-160); }
.topbar-action:active { background: var(--n-6); }

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  flex-shrink: 0;
  user-select: none;
}
.avatar--sm { width: 26px; height: 26px; font-size: 11px; }

/* =========================================================
   Layout de página
   ========================================================= */
.page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 24px 64px;
  animation: rise .24s cubic-bezier(.1,.9,.2,1) both;
}
.page--narrow { max-width: 640px; }

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

.page-heading { margin-bottom: 20px; }
.page-heading h1 {
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -.01em;
  color: var(--n-160);
}
.page-heading p {
  margin-top: 4px;
  font-size: 13.5px;
  color: var(--n-90);
}

.section + .section { margin-top: 40px; }

/* =========================================================
   Métricas (cartões resumo)
   ========================================================= */
.metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 32px;
}

.metric {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 168px;
  padding: 14px 18px;
  background: var(--n-white);
  border: 1px solid var(--n-8);
  border-left: 3px solid var(--brand);
  border-radius: var(--r-md);
  box-shadow: var(--depth-2);
}
.metric__value {
  font-size: 24px;
  font-weight: 600;
  line-height: 1.1;
  color: var(--n-160);
}
.metric__label {
  font-size: 12px;
  color: var(--n-90);
}

/* =========================================================
   Command bar
   ========================================================= */
.command-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.command-bar__title {
  font-size: 17px;
  font-weight: 600;
  color: var(--n-160);
}

/* =========================================================
   Botões
   ========================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 34px;
  padding: 0 16px;
  font-family: var(--font);
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background .1s ease, border-color .1s ease, color .1s ease;
}
.btn__icon { width: 15px; height: 15px; flex-shrink: 0; }

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

.btn--secondary {
  background: var(--n-white);
  border-color: var(--n-30);
  color: var(--n-160);
}
.btn--secondary:hover { background: var(--n-4); border-color: var(--n-60); }
.btn--secondary:active { background: var(--n-6); }

.btn--block { width: 100%; height: 38px; }

/* =========================================================
   Barras de mensagem (MessageBar do Fluent)
   ========================================================= */
.message-bar {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid;
  border-radius: var(--r-sm);
  font-size: 13px;
  margin-bottom: 16px;
  text-align: left;
  transition: opacity .3s ease, transform .3s ease;
}
.message-bar__icon { width: 16px; height: 16px; flex-shrink: 0; margin-top: 1px; }
.message-bar--success { background: var(--ok-bg);   border-color: var(--ok-border);   color: var(--ok); }
.message-bar--error   { background: var(--err-bg);  border-color: var(--err-border);  color: var(--err); }
.message-bar--warning { background: var(--warn-bg); border-color: var(--warn-border); color: var(--warn); }
.message-bar--block { margin-bottom: 0; }
.flash-fade-out { opacity: 0; transform: translateY(-4px); }

/* =========================================================
   Listas (DetailsList do Fluent) — grid, não table
   ========================================================= */
.list {
  background: var(--n-white);
  border: 1px solid var(--n-8);
  border-radius: var(--r-md);
  box-shadow: var(--depth-2);
  overflow: hidden;
}

.list__head,
.list__row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px 160px;
  align-items: center;
  gap: 16px;
  padding: 0 18px;
}

.list__head--users,
.list__row--users {
  grid-template-columns: minmax(0, 1.1fr) 150px minmax(0, 1.6fr) 160px;
}

.list__head {
  height: 40px;
  background: var(--n-2);
  border-bottom: 1px solid var(--n-8);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--n-90);
}

.list__row {
  min-height: 52px;
  padding-top: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--n-6);
  transition: background .1s ease;
}
.list__row:last-child { border-bottom: none; }
.list__row:hover { background: var(--n-2); }

.col { min-width: 0; }

.col--name {
  display: flex;
  align-items: center;
  gap: 10px;
}

.row-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--n-160);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: var(--r-sm);
  flex-shrink: 0;
}
.row-icon svg { width: 17px; height: 17px; }
.row-icon--panel { background: var(--brand-tint); color: var(--brand); }

.col--access {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.col--actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
}
.col--actions form { margin: 0; display: flex; }

.link-action {
  background: none;
  border: none;
  padding: 0;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  color: var(--brand-hover);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
.link-action:hover { text-decoration: underline; }
.link-action--danger { color: var(--err); }

.list__empty {
  padding: 40px 24px;
  text-align: center;
}
.list__empty-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--n-130);
}
.list__empty-text {
  margin-top: 4px;
  font-size: 13px;
  color: var(--n-90);
}

code {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--n-4);
  border: 1px solid var(--n-8);
  border-radius: 3px;
  padding: 2px 6px;
  color: var(--n-130);
  white-space: nowrap;
}

/* =========================================================
   Badges e chips
   ========================================================= */
.badge {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 9px;
  border-radius: 11px;
  border: 1px solid;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}
.badge--ok      { color: var(--ok);   background: var(--ok-bg);  border-color: var(--ok-border); }
.badge--pending { color: var(--n-90); background: var(--n-4);    border-color: var(--n-20); }

.chip {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 9px;
  border-radius: var(--r-sm);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--brand-hover);
  background: var(--brand-tint);
  border: 1px solid var(--brand-border);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* =========================================================
   Tiles (grade de painéis do usuário)
   ========================================================= */
.search-row { margin-bottom: 16px; }

.input-affix { position: relative; display: block; }
.input-affix--search { max-width: 320px; }

.search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--n-60);
  pointer-events: none;
}

.search-input {
  width: 100%;
  height: 34px;
  padding: 0 12px 0 34px;
  font-family: var(--font);
  font-size: 13.5px;
  color: var(--n-160);
  background: var(--n-white);
  border: 1px solid var(--n-30);
  border-radius: var(--r-sm);
  transition: border-color .1s ease, box-shadow .1s ease;
}
.search-input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: inset 0 -2px 0 -1px var(--brand);
}

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(248px, 1fr));
  gap: 14px;
}

.tile {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
  background: var(--n-white);
  border: 1px solid var(--n-8);
  border-radius: var(--r-lg);
  box-shadow: var(--depth-2);
  text-decoration: none;
  color: var(--n-160);
  transition: box-shadow .16s ease, transform .16s ease, border-color .16s ease;
}
.tile:hover {
  box-shadow: var(--depth-16);
  transform: translateY(-2px);
  border-color: var(--brand-border);
}
.tile:hover .tile__cta { color: var(--brand-hover); }
.tile:hover .tile__cta svg { transform: translateX(3px); }

.tile__thumb {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 76px;
  border-radius: var(--r-md);
  background: linear-gradient(160deg, var(--brand-tint), #fff8f2);
  border: 1px solid var(--brand-border);
  color: var(--brand);
}
.tile__thumb svg { width: 46px; height: 46px; }

.tile__body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tile__name {
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--n-160);
}
.tile__meta { font-size: 12px; color: var(--n-90); }

.tile__cta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: auto;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--n-90);
  transition: color .16s ease;
}
.tile__cta svg { width: 14px; height: 14px; transition: transform .16s ease; }

/* =========================================================
   Estado vazio
   ========================================================= */
.empty-state {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 56px 24px;
  background: var(--n-white);
  border: 1px dashed var(--n-20);
  border-radius: var(--r-lg);
  text-align: center;
}
.empty-state--inline { margin-top: 14px; padding: 36px 24px; }
.empty-state__art { width: 64px; height: 64px; color: var(--n-60); margin-bottom: 6px; }
.empty-state__title { font-size: 15px; font-weight: 600; color: var(--n-130); }
.empty-state__text { font-size: 13px; color: var(--n-90); max-width: 380px; }

/* =========================================================
   Área do relatório
   ========================================================= */
.report-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 24px;
  height: 48px;
  background: var(--n-white);
  border-bottom: 1px solid var(--n-8);
  overflow: hidden;
}
.report-bar__divider { width: 1px; height: 20px; background: var(--n-20); flex-shrink: 0; }
.report-bar__title {
  font-size: 15px;
  font-weight: 600;
  color: var(--n-160);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  font-weight: 600;
  color: var(--n-90);
  text-decoration: none;
  padding: 5px 9px 5px 6px;
  border-radius: var(--r-sm);
  white-space: nowrap;
  transition: background .1s ease, color .1s ease;
}
.back-link svg { width: 15px; height: 15px; }
.back-link:hover { background: var(--n-4); color: var(--n-160); }
.back-link--page { margin-bottom: 12px; margin-left: -6px; }

.report-area {
  padding: 16px 24px 24px;
  animation: rise .24s cubic-bezier(.1,.9,.2,1) both;
}

.frame-container { position: relative; }

.report-frame {
  display: block;
  width: 100%;
  height: calc(100vh - 148px);
  min-height: 460px;
  border: 1px solid var(--n-8);
  border-radius: var(--r-lg);
  background: var(--n-white);
  box-shadow: var(--depth-4);
}

.frame-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: var(--n-white);
  border: 1px solid var(--n-8);
  border-radius: var(--r-lg);
  font-size: 13px;
  color: var(--n-90);
  transition: opacity .3s ease;
  z-index: 2;
}
.frame-loading-hidden { opacity: 0; pointer-events: none; }

.spinner {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2.5px solid var(--n-8);
  border-top-color: var(--brand);
  animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* =========================================================
   Cartões e formulários
   ========================================================= */
.card {
  background: var(--n-white);
  border: 1px solid var(--n-8);
  border-radius: var(--r-lg);
  box-shadow: var(--depth-4);
}
.card--form { padding: 26px; }

.field { margin-bottom: 18px; }
.field:last-of-type { margin-bottom: 22px; }

.field > label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--n-160);
  margin-bottom: 6px;
}

.field input[type="text"],
.field input[type="url"],
.field input[type="password"] {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  font-family: var(--font);
  font-size: 14px;
  color: var(--n-160);
  background: var(--n-white);
  border: 1px solid var(--n-30);
  border-radius: var(--r-sm);
  transition: border-color .1s ease, box-shadow .1s ease;
}
.field input::placeholder { color: var(--n-60); }
.field input:hover:not(:disabled) { border-color: var(--n-60); }
.field input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: inset 0 -2px 0 -1px var(--brand);
}
.field input:disabled {
  background: var(--n-4);
  color: var(--n-60);
  border-color: var(--n-8);
  cursor: not-allowed;
}

.field__hint {
  margin-top: 5px;
  font-size: 12px;
  color: var(--n-90);
}
.field__hint strong { font-weight: 600; color: var(--n-130); }

.input-affix input { padding-right: 40px; }

.affix-btn {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  background: none;
  border: none;
  border-radius: var(--r-sm);
  color: var(--n-90);
  cursor: pointer;
  transition: background .1s ease, color .1s ease;
}
.affix-btn svg { width: 17px; height: 17px; }
.affix-btn:hover { background: var(--n-4); color: var(--n-160); }
.affix-btn.is-visible { color: var(--brand); }

.checkbox-list {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--n-30);
  border-radius: var(--r-sm);
  max-height: 240px;
  overflow-y: auto;
  background: var(--n-white);
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 13px;
  cursor: pointer;
  border-bottom: 1px solid var(--n-6);
  transition: background .1s ease;
}
.checkbox-item:last-child { border-bottom: none; }
.checkbox-item:hover { background: var(--n-2); }

.checkbox-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--brand);
  flex-shrink: 0;
  cursor: pointer;
}
.checkbox-item__label {
  font-size: 13.5px;
  color: var(--n-160);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.form-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  padding-top: 4px;
}

/* =========================================================
   Autenticação
   ========================================================= */
.body--auth {
  background:
    radial-gradient(1100px 520px at 50% -8%, #fff 0%, rgba(255,255,255,0) 62%),
    linear-gradient(180deg, var(--n-2) 0%, var(--n-4) 100%);
}

.auth-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 32px 20px;
}

.auth-card {
  width: 100%;
  max-width: 396px;
  padding: 38px 40px 30px;
  background: var(--n-white);
  border: 1px solid var(--n-8);
  border-radius: var(--r-lg);
  box-shadow: var(--depth-64);
  animation: rise .28s cubic-bezier(.1,.9,.2,1) both;
}
.auth-card--error { text-align: center; }

.auth-logo { display: block; height: 46px; width: auto; margin: 0 auto; }

.auth-product {
  margin-top: 8px;
  text-align: center;
  font-size: 15px;
  font-weight: 600;
  color: var(--n-130);
}
.pb-accent { color: var(--brand); }

.auth-title {
  margin-top: 22px;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -.01em;
  color: var(--n-160);
}
.auth-card--error .auth-title { margin-top: 4px; }

.auth-subtitle {
  margin: 5px 0 22px;
  font-size: 13px;
  color: var(--n-90);
}

.auth-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--n-6);
  font-size: 11.5px;
  color: var(--n-90);
  text-align: center;
}
.auth-note__icon { width: 13px; height: 13px; flex-shrink: 0; color: var(--n-60); }

.auth-footer {
  font-size: 11.5px;
  color: var(--n-60);
}

.error-code {
  margin-top: 20px;
  font-size: 44px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -.02em;
  color: var(--brand);
}
.auth-card--error .btn { margin-top: 6px; }

/* =========================================================
   Responsivo
   ========================================================= */
@media (max-width: 860px) {
  .list__head { display: none; }

  .list__row,
  .list__row--users {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 16px 18px;
  }
  .col--actions { justify-content: flex-start; }
  .report-frame { height: calc(100vh - 190px); }
}

@media (max-width: 560px) {
  .topbar { padding: 0 14px; }
  .product-tag { display: none; }
  .user-pill__name { display: none; }
  .page { padding: 20px 14px 48px; }
  .report-area { padding: 12px 14px 18px; }
  .report-bar { padding: 0 14px; }
  .card--form { padding: 20px; }
  .auth-card { padding: 30px 24px 24px; }
  .tiles { grid-template-columns: 1fr; }
  .metrics { width: 100%; }
  .metric { flex: 1 1 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}
