/* Visual escuro, ao estilo do HST ERP. */
:root {
  --bg: #0b0c0f;
  --panel: #15171c;
  --panel-2: #1c1f26;
  --line: #2a2e37;
  --text: #e6e8ec;
  --muted: #8b93a1;
  --accent: #e25c5c;            /* principal: vermelho com a mesma luz/força do azul antigo (#409eff) */
  --accent-rgb: 226, 92, 92;
  --accent-2: #e0a95c;          /* secundária: dourado suave, combina com o vermelho */
  --good: #3fb950;
  --bad: #f07f7f;               /* valores negativos: vermelho mais claro, para não se confundir com botões */
}
/* cores do Element Plus (botões, menu, seleções, tags) no mesmo vermelho */
html.dark {
  --el-color-primary: #e25c5c;
  --el-color-primary-light-3: #a34545;
  --el-color-primary-light-5: #733434;
  --el-color-primary-light-7: #472424;
  --el-color-primary-light-8: #361d1d;
  --el-color-primary-light-9: #241616;
  --el-color-primary-dark-2: #e87d7d;
  --el-color-danger: #f07f7f;
  --el-color-danger-light-3: #b35e5e;
  --el-color-danger-light-5: #7d4242;
  --el-color-danger-light-7: #4a2828;
  --el-color-danger-light-8: #3a2020;
  --el-color-danger-light-9: #2a1818;
  --el-color-danger-dark-2: #f39999;
  --el-color-warning: #e0a95c;
  --el-color-warning-light-3: #a37c45;
  --el-color-warning-light-5: #735834;
  --el-color-warning-light-7: #473724;
  --el-color-warning-light-8: #362a1d;
  --el-color-warning-light-9: #241e16;
  --el-color-warning-dark-2: #e7bd80;
}
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; font-size: 13px; }
.shell { height: 100vh; }

.aside { background: #0f1115; border-right: 1px solid var(--line); transition: width .2s; overflow: hidden; }
.logo { height: 52px; display: flex; align-items: center; gap: 10px; padding: 0 16px; cursor: pointer;
  border-bottom: 1px solid var(--line); }
.logo-badge { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; font-weight: 800; border-radius: 6px;
  padding: 4px 6px; font-size: 13px; letter-spacing: .5px; }
.logo-text { font-weight: 700; letter-spacing: .6px; white-space: nowrap; }
.store-pick { padding: 12px 14px 10px; border-bottom: 1px solid var(--line); }
.store-pick-label { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .6px; margin-bottom: 6px; }
.store-select { width: 100%; }
.store-api { float: right; font-size: 11px; margin-left: 10px; }
.store-api.on { color: var(--good); }
.store-api.off { color: var(--muted); }
.store-head { display: flex; align-items: center; justify-content: space-between; max-width: 900px; }
.menu { border-right: none !important; background: transparent !important; }
.menu .el-menu-item { height: 46px; color: var(--text); }
.menu .el-menu-item.is-active { background: var(--accent) !important; color: #fff !important; border-radius: 6px; margin: 2px 8px; }
.menu .el-menu-item.sub-item { padding-left: 40px !important; height: 38px; font-size: 12.5px; }   /* por baixo do Supplier */
.menu-badge { margin-left: 8px; }
.menu-badge .el-badge__content { border: none; }

.topbar { height: 52px; display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--line); background: #0f1115; }
.crumb { font-size: 14px; }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.clock { color: var(--muted); font-size: 12px; }
.main { background: var(--bg); padding: 18px 20px; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-bottom: 14px; }
.card { background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--accent-2);
  border-radius: 8px; padding: 14px 16px; }
.card.good { border-left-color: var(--good); }
.card.bad { border-left-color: var(--bad); }
.card-label { color: var(--muted); font-size: 12px; }
.card-value { font-size: 24px; font-weight: 700; margin: 6px 0 4px; }
.card.good .card-value { color: var(--good); }
.card.bad .card-value { color: var(--bad); }
.card-sub { color: var(--muted); font-size: 12px; }
.card-pct { font-size: 14px; font-weight: 600; margin-left: 6px; opacity: .85; }

.section-title { font-size: 14px; font-weight: 600; margin: 18px 0 10px; color: var(--text); }
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.note { margin-bottom: 14px; }
.tbl { width: 100%; }
.mt { margin-top: 12px; }
.ml { margin-left: 6px; }
.pos { color: var(--good); }
.neg { color: var(--bad); }
.muted { color: var(--muted); }
.unassigned { color: var(--accent-2); font-size: 11px; }
.today-dot { color: var(--accent-2); font-size: 11px; }
.expand { padding: 8px 18px; line-height: 1.8; }
.edit-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.hint { color: var(--muted); margin-left: 10px; font-size: 12px; }
.form { max-width: 900px; }

.heat-wrap { overflow-x: auto; }
.heat { border-collapse: collapse; width: 100%; font-size: 12px; }
.heat th, .heat td { border: 1px solid var(--line); padding: 6px 4px; text-align: center; min-width: 30px; }
.heat th { background: var(--panel-2); color: var(--muted); font-weight: 500; }
.heat .dcol { text-align: left; white-space: nowrap; padding: 6px 10px; }
.heat .tot { font-weight: 600; white-space: nowrap; padding: 6px 10px; }
.heat .reset { outline: 2px solid var(--accent-2); outline-offset: -2px; }
.heat .hk-row th { background: #14161b; color: #6b7380; font-size: 11px; }
.heat .hk-row sup { color: var(--accent-2); font-size: 9px; margin-left: 1px; }

/* ================================================================ telemóvel */
.crumb { display: flex; align-items: center; gap: 6px; min-width: 0; }
.nav-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, .55); z-index: 1999; }
.bottom-nav { display: none; }

.shell.mobile { min-height: 100vh; height: auto; }
.shell.mobile .aside {
  position: fixed; left: 0; top: 0; bottom: 0; z-index: 2000; overflow-y: auto;
  transform: translateX(-105%); transition: transform .2s ease; box-shadow: 4px 0 24px rgba(0, 0, 0, .5);
  padding-bottom: env(safe-area-inset-bottom);
}
.shell.mobile .aside.open { transform: none; }
.shell.mobile .menu .el-menu-item { height: 48px; font-size: 15px; }
.shell.mobile .menu .el-menu-item.sub-item { height: 42px; font-size: 14px; }
.nav-user { padding: 14px 16px 24px; border-top: 1px solid var(--line); line-height: 1.8; font-size: 12px; }
.nav-user-row { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; font-size: 14px; color: var(--text); }

.shell.mobile .topbar { position: sticky; top: 0; z-index: 100; height: 54px; padding: 0 10px 0 4px;
  padding-top: env(safe-area-inset-top); }
.shell.mobile .crumb { font-size: 16px; font-weight: 600; overflow: hidden; white-space: nowrap; }
.shell.mobile .crumb-store { font-size: 12px; font-weight: 400; overflow: hidden; text-overflow: ellipsis; }
.shell.mobile .burger { padding: 8px; margin: 0; color: var(--text); }
.shell.mobile .main { padding: 12px 12px calc(76px + env(safe-area-inset-bottom)); overflow: visible; }

.shell.mobile .cards { grid-template-columns: 1fr 1fr; gap: 10px; }
.shell.mobile .card { padding: 11px 12px; }
.shell.mobile .card-value { font-size: 20px; }
.shell.mobile .card-sub { font-size: 11px; }
.shell.mobile .section-title { font-size: 15px; margin: 16px 0 8px; }
.shell.mobile .note { font-size: 12px; }
.shell.mobile .toolbar { gap: 8px; }
.shell.mobile .el-radio-button__inner { padding: 8px 12px; }

/* formulários: campos na largura toda (os estilos inline de largura são para o computador) */
.shell.mobile .form { max-width: 100%; }
.shell.mobile .form .el-input, .shell.mobile .form .el-select { width: 100% !important; }
.shell.mobile .form .hint { display: block; margin: 4px 0 0; }
.shell.mobile .store-head { flex-wrap: wrap; gap: 8px; }
/* tabelas que ficam como tabela no telemóvel: deslizam para o lado dentro do ecrã */
.shell.mobile .el-table { font-size: 12px; }
.shell.mobile input, .shell.mobile textarea { font-size: 16px; }   /* evita o zoom automático do iPhone */

/* barra de baixo */
.shell.mobile .bottom-nav {
  display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 150;
  background: #0f1115; border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 0 7px;
  color: var(--muted); font-size: 11px; position: relative; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.bottom-nav a .el-icon { font-size: 21px; }
.bottom-nav a.on { color: var(--accent); }
.bn-badge { position: absolute; top: 3px; left: 50%; margin-left: 6px; background: var(--accent); color: #fff;
  font-size: 10px; border-radius: 9px; padding: 1px 5px; font-weight: 700; }

/* listas em cartões (substituem as tabelas largas no telemóvel) */
.m-list { display: flex; flex-direction: column; gap: 9px; }
.m-card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; }
.m-card.m-alert { border-left: 3px solid var(--bad); }
.m-card.m-total { border-left: 3px solid var(--accent-2); }
.m-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.m-row + .m-row { margin-top: 4px; }
.m-row.muted, .m-sub.muted { font-size: 12px; }
.m-big { font-size: 17px; }
.m-sub { margin-top: 6px; line-height: 1.45; word-break: break-word; }
.m-clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; color: var(--muted); }
.m-ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.m-quote { white-space: pre-wrap; background: var(--panel-2); border-radius: 6px; padding: 8px 9px; font-size: 12.5px;
  max-height: 180px; overflow: auto; }
.m-detail { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); display: flex; flex-direction: column; gap: 5px; }
.m-why { margin-top: 6px; font-size: 12px; line-height: 1.5; }
.m-form { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.m-inline { display: flex; gap: 8px; }
.m-full { width: 100%; margin-top: 8px; }
.m-actions { display: flex; gap: 8px; margin-top: 10px; }
.m-actions .el-button { flex: 1; height: 38px; }

/* conversa com o supplier em estilo chat */
.chat { display: flex; flex-direction: column; gap: 6px; }
.bubble { max-width: 86%; padding: 7px 10px 8px; border-radius: 10px; font-size: 13.5px; line-height: 1.4; }
.bubble.them { align-self: flex-start; background: var(--panel-2); border-top-left-radius: 3px; }
.bubble.me { align-self: flex-end; background: #3a2222; border-top-right-radius: 3px; }
.bubble-meta { font-size: 10.5px; color: var(--muted); margin-bottom: 2px; }
.bubble-text { white-space: pre-wrap; word-break: break-word; }
