:root {
    --bg: #0f1117;
    --surface: #181c27;
    --surface2: #1e2336;
    --border: #2a3050;
    --border2: #3a4570;
    --accent: #e8a020;
    --accent2: #f0c060;
    --accent-dim: rgba(232,160,32,0.12);
    --accent-glow: rgba(232,160,32,0.25);
    --text: #e8eaf0;
    --text2: #8a90a8;
    --text3: #5a607a;
    --green: #2ecc71;
    --green-dim: rgba(46,204,113,0.12);
    --red: #e74c3c;
    --red-dim: rgba(231,76,60,0.12);
    --blue: #3498db;
    --blue-dim: rgba(52,152,219,0.12);
    --orange: #e67e22;
    --orange-dim: rgba(230,126,34,0.12);
    --radius: 8px;
    --radius-lg: 14px;
    --shadow: 0 4px 24px rgba(0,0,0,0.4);
    --shadow-lg: 0 8px 48px rgba(0,0,0,0.6);
    --font-main: 'Lato', sans-serif;
    --font-display: 'Syne', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
  }

  * { margin:0; padding:0; box-sizing:border-box; }
  html, body { height:100%; }
  body {
    font-family: var(--font-main);
    background: var(--bg);
    color: var(--text);
    display: flex;
    height: 100vh;
    overflow: hidden;
  }

  /* ─── SIDEBAR ─── */
  #sidebar {
    width: 220px;
    min-width: 220px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 100;
  }
  .sidebar-brand {
    padding: 22px 20px 18px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: flex-start;
    gap: 4px;
  }
  .brand-logo-img {
    width: 26px;
    height: 24px;
    flex-shrink: 0;
    margin-top: 2px;
  }
  .brand-logo {
    font-family: var(--font-display);
    font-size: 17px;
    font-weight: 800;
    color: var(--accent);
    line-height: 1.1;
    letter-spacing: -0.3px;
  }
  .brand-sub {
    font-size: 10px;
    color: var(--text3);
    margin-top: 4px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
  }
  .sidebar-nav {
    flex: 1;
    padding: 14px 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow-y: auto;
  }
  .nav-section-label {
    font-size: 9px;
    font-weight: 700;
    color: var(--text3);
    letter-spacing: 1.2px;
    text-transform: uppercase;
    padding: 10px 10px 4px;
    margin-top: 6px;
  }
  .nav-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 13px;
    color: var(--text2);
    transition: all 0.15s;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-family: var(--font-main);
  }
  .nav-btn:hover { background: var(--surface2); color: var(--text); }
  .nav-btn.active { background: var(--accent-dim); color: var(--accent); border: 1px solid var(--accent-glow); }
  .nav-btn .icon { font-size: 16px; width: 20px; text-align: center; }
  .nav-btn .badge {
    margin-left: auto;
    background: var(--accent);
    color: #000;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 10px;
    font-family: var(--font-mono);
  }
  .sidebar-footer {
    padding: 14px;
    border-top: 1px solid var(--border);
    font-size: 11px;
    color: var(--text3);
    line-height: 1.5;
  }

  /* ─── MAIN ─── */
  #main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  .topbar {
    height: 52px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 22px;
    gap: 16px;
    flex-shrink: 0;
  }
  .topbar-title {
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    flex: 1;
  }
  .topbar-actions { display: flex; gap: 8px; }
  .btn {
    padding: 7px 16px;
    border-radius: var(--radius);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    font-family: var(--font-main);
    transition: all 0.15s;
    display: flex;
    align-items: center;
    gap: 6px;
  }
  .btn-primary { background: var(--accent); color: #000; }
  .btn-primary:hover { background: var(--accent2); }
  .btn-ghost { background: transparent; color: var(--text2); border: 1px solid var(--border); }
  .btn-ghost:hover { border-color: var(--border2); color: var(--text); }
  .btn-danger { background: var(--red-dim); color: var(--red); border: 1px solid var(--red-dim); }
  .btn-danger:hover { background: var(--red); color: #fff; }
  .btn-success { background: var(--green-dim); color: var(--green); border: 1px solid var(--green-dim); }
  .btn-success:hover { background: var(--green); color: #fff; }
  .btn-sm { padding: 5px 11px; font-size: 11px; }

  /* ─── PAGE CONTENT ─── */
  .page { display: none; flex: 1; overflow: hidden; flex-direction: column; }
  .page.active { display: flex; }
  .page-body { flex: 1; overflow-y: auto; padding: 22px; }

  /* ─── DASHBOARD ─── */
  .kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 22px;
  }
  .kpi-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    position: relative;
    overflow: hidden;
  }
  .kpi-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--kpi-color, var(--accent));
  }
  .kpi-label { font-size: 11px; color: var(--text3); text-transform: uppercase; letter-spacing: 0.8px; margin-bottom: 8px; }
  .kpi-value { font-family: var(--font-mono); font-size: 26px; font-weight: 600; color: var(--text); }
  .kpi-sub { font-size: 11px; color: var(--text3); margin-top: 5px; }
  .kpi-icon { position: absolute; right: 16px; top: 16px; font-size: 28px; opacity: 0.15; }

  .dash-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
  .dash-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
  }
  .dash-card-title {
    font-family: var(--font-display);
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  /* ─── TABLE ─── */
  .table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
  .table-header {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
  }
  .table-title { font-family: var(--font-display); font-size: 14px; font-weight: 700; flex: 1; }
  .search-input {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 7px 12px;
    color: var(--text);
    font-size: 12px;
    font-family: var(--font-main);
    width: 200px;
    outline: none;
    transition: border-color 0.15s;
  }
  .search-input:focus { border-color: var(--accent); }
  .search-input::placeholder { color: var(--text3); }
  table { width: 100%; border-collapse: collapse; }
  th {
    background: var(--bg);
    padding: 10px 16px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text3);
    text-align: left;
    border-bottom: 1px solid var(--border);
  }
  td {
    padding: 11px 16px;
    font-size: 13px;
    color: var(--text);
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
  }
  tr:last-child td { border-bottom: none; }
  tr:hover td { background: var(--surface2); }

  /* ─── STATUS BADGES ─── */
  .badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 9px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    font-family: var(--font-mono);
  }
  .badge::before { content: '●'; font-size: 8px; }
  .badge-rascunho { background: var(--surface2); color: var(--text3); }
  .badge-enviado { background: var(--blue-dim); color: var(--blue); }
  .badge-aprovado { background: var(--green-dim); color: var(--green); }
  .badge-adjudicado { background: rgba(232,160,32,0.18); color: var(--accent); }
  .badge-execucao { background: var(--orange-dim); color: var(--orange); }
  .badge-concluido { background: var(--green-dim); color: var(--green); }
  .badge-faturado { background: rgba(130,80,255,0.15); color: #a06cf0; }
  .badge-cancelado { background: var(--red-dim); color: var(--red); }

  /* ─── PIPELINE ─── */
  .pipeline {
    display: flex;
    gap: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 18px;
  }
  .pipe-stage {
    flex: 1;
    padding: 12px 14px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.15s;
    position: relative;
  }
  .pipe-stage:last-child { border-right: none; }
  .pipe-stage:hover { background: var(--surface2); }
  .pipe-stage.active-stage { background: var(--accent-dim); }
  .pipe-stage.active-stage::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 2px;
    background: var(--accent);
  }
  .pipe-name { font-size: 11px; font-weight: 700; color: var(--text2); text-transform: uppercase; letter-spacing: 0.5px; }
  .pipe-count { font-family: var(--font-mono); font-size: 22px; font-weight: 600; color: var(--text); margin-top: 4px; }
  .pipe-val { font-size: 11px; color: var(--text3); font-family: var(--font-mono); }

  /* ─── FORM ─── */
  .form-grid { display: grid; gap: 14px; }
  .form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
  .form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
  .form-group { display: flex; flex-direction: column; gap: 5px; }
  .form-label { font-size: 11px; font-weight: 700; color: var(--text3); text-transform: uppercase; letter-spacing: 0.5px; }
  .form-control {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 9px 12px;
    color: var(--text);
    font-size: 13px;
    font-family: var(--font-main);
    outline: none;
    transition: border-color 0.15s;
  }
  .form-control:focus { border-color: var(--accent); }
  .form-control::placeholder { color: var(--text3); }
  select.form-control { cursor: pointer; }
  textarea.form-control { resize: vertical; min-height: 70px; }
  .form-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    margin-bottom: 14px;
  }
  .form-section-title {
    font-family: var(--font-display);
    font-size: 13px;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 8px;
  }

  /* ─── LINHAS DE ARTIGOS ─── */
  .items-table-wrap { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; margin-bottom: 10px; }
  .items-table { width: 100%; border-collapse: collapse; }
  .items-table th { background: var(--bg); padding: 8px 12px; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.7px; color: var(--text3); border-bottom: 1px solid var(--border); }
  .items-table td { padding: 6px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
  .items-table tr:last-child td { border-bottom: none; }
  .items-table .form-control { padding: 6px 9px; font-size: 12px; }
  .item-ref { width: 100px; }
  .item-desc { min-width: 180px; }
  .item-qty { width: 70px; }
  .item-unit { width: 70px; }
  .item-price { width: 100px; }
  .item-iva { width: 70px; }
  .item-total { width: 90px; font-family: var(--font-mono); font-size: 12px; color: var(--accent); text-align: right; }
  .item-del { width: 36px; text-align: center; }
  .del-btn { background: none; border: none; color: var(--red); font-size: 16px; cursor: pointer; opacity: 0.5; transition: opacity 0.15s; padding: 2px 6px; border-radius: 4px; }
  .del-btn:hover { opacity: 1; background: var(--red-dim); }

  /* ─── TOTAIS ─── */
  .totals-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px 22px;
    min-width: 280px;
  }
  .totals-row { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
  .totals-row:last-child { border-bottom: none; }
  .totals-row.total-final { padding-top: 10px; margin-top: 4px; }
  .totals-row .label { color: var(--text2); }
  .totals-row .val { font-family: var(--font-mono); color: var(--text); }
  .totals-row.total-final .label { font-size: 15px; font-weight: 700; color: var(--text); }
  .totals-row.total-final .val { font-size: 20px; font-weight: 700; color: var(--accent); }
  .totals-bottom { display: flex; justify-content: flex-end; margin-top: 10px; }

  /* ─── MODAL ─── */
  .modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.75);
    z-index: 999;
    align-items: center;
    justify-content: center;
  }
  .modal-overlay.open { display: flex; }
  .modal {
    background: var(--surface);
    border: 1px solid var(--border2);
    border-radius: var(--radius-lg);
    padding: 28px 30px;
    width: 520px;
    max-width: 95vw;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
  }
  .modal-title { font-family: var(--font-display); font-size: 17px; font-weight: 800; color: var(--text); margin-bottom: 20px; }
  .modal-footer { display: flex; gap: 8px; justify-content: flex-end; margin-top: 22px; }

  /* ─── RESPONSIVO (TABLET/TELEMÓVEL) ─── */
  .btn-menu-erp{
    display:none;align-items:center;justify-content:center;
    width:36px;height:36px;flex-shrink:0;
    background:none;border:1px solid var(--border);border-radius:var(--radius);
    color:var(--text);cursor:pointer;font-size:16px;
  }
  .sidebar-backdrop{
    display:none;position:fixed;inset:0;background:rgba(0,0,0,.55);z-index:99;
  }
  .sidebar-backdrop.visivel{display:block;}
  @media(max-width:860px){
    .btn-menu-erp{display:flex;}
    #sidebar{
      position:fixed;top:0;left:0;bottom:0;width:250px;min-width:250px;
      transform:translateX(-100%);transition:transform .25s ease;
      box-shadow:24px 0 48px rgba(0,0,0,.5);
    }
    #sidebar.aberto{transform:translateX(0);}
    .topbar-title{font-size:14px;}
    .topbar{padding:0 14px;gap:10px;}
    .page-body{padding:16px;}
    .table-wrap, .items-table-wrap{overflow-x:auto;-webkit-overflow-scrolling:touch;}
    .table-wrap table, .items-table-wrap table{min-width:640px;}
  }
  @media(max-width:560px){
    .topbar-actions .btn{padding:7px 10px;font-size:11px;}
  }

  /* ─── VOLTAR AO TOPO ─── */
  .btn-topo-erp{
    position:fixed;z-index:200;right:26px;bottom:26px;
    display:flex;align-items:center;justify-content:center;
    width:44px;height:44px;border-radius:50%;
    background:var(--surface);border:1px solid var(--border);
    color:var(--accent);font-size:17px;line-height:1;cursor:pointer;
    box-shadow:var(--shadow-lg);
    transform:translateY(12px);opacity:0;pointer-events:none;
    transition:opacity .25s ease, transform .25s ease, border-color .2s ease;
  }
  .btn-topo-erp.visivel{opacity:1;pointer-events:auto;transform:translateY(0);}
  .btn-topo-erp:hover{border-color:var(--accent);}

  /* ─── TOAST ─── */
  #toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--surface2);
    border: 1px solid var(--border2);
    border-left: 3px solid var(--accent);
    padding: 12px 18px;
    border-radius: var(--radius);
    font-size: 13px;
    color: var(--text);
    z-index: 9999;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.25s;
    pointer-events: none;
  }
  #toast.show { opacity: 1; transform: translateY(0); }

  /* ─── PRINT (A4 otimizado) ─── */
  @page { size: A4; margin: 14mm 12mm; }
  @media print {
    body { background: #fff; color: #000; }
    #sidebar, .topbar, .no-print { display: none !important; }
    #main { overflow: visible; }
    .page-body { overflow: visible; padding: 0; }
    #page-preview { display: block !important; }
    #preview-content { box-shadow: none; border: none; width: auto; min-height: 0; margin: 0; padding: 0; }
    .prev-header, .prev-parties, .prev-desc-box, .prev-totals, .prev-sig, .prev-notes { page-break-inside: avoid; }
    .prev-table tr { page-break-inside: avoid; }
    .prev-table thead { display: table-header-group; }
  }

  /* ─── MISC ─── */
  .mono { font-family: var(--font-mono); }
  .text-accent { color: var(--accent); }
  .text-muted { color: var(--text3); }
  .divider { border: none; border-top: 1px solid var(--border); margin: 14px 0; }
  .flex { display: flex; }
  .flex-col { flex-direction: column; }
  .gap-8 { gap: 8px; }
  .gap-14 { gap: 14px; }
  .items-center { align-items: center; }
  .justify-between { justify-content: space-between; }
  .mt-14 { margin-top: 14px; }
  .chip {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-family: var(--font-mono);
    background: var(--accent-dim);
    color: var(--accent);
    border: 1px solid var(--accent-glow);
  }

  /* ─── PREVIEW PDF ─── */
  #preview-content {
    background: #fff;
    color: #222;
    width: 794px;
    min-height: 1123px;
    margin: 0 auto;
    padding: 40px 50px;
    box-shadow: var(--shadow-lg);
    border-radius: 4px;
    font-family: 'Lato', sans-serif;
    font-size: 12px;
    line-height: 1.5;
  }
  .prev-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 28px;
    padding-bottom: 20px;
    border-bottom: 2px solid #1a2744;
  }
  .prev-brand-row { display: flex; align-items: flex-start; gap: 5px; }
  .prev-brand-logo { width: 34px; height: 31px; flex-shrink: 0; margin-top: 2px; }
  .prev-brand-name { font-size: 18px; font-weight: 800; color: #1a2744; line-height: 1.2; }
  .prev-brand-type { font-size: 10px; color: #888; text-transform: uppercase; letter-spacing: 1px; margin-top: 2px; }
  .prev-brand-details { font-size: 10px; color: #555; margin-top: 8px; line-height: 1.7; }
  .prev-doc-badge {
    text-align: right;
  }
  .prev-doc-type { font-size: 22px; font-weight: 800; color: #e8a020; text-transform: uppercase; }
  .prev-doc-num { font-size: 14px; font-weight: 700; color: #1a2744; font-family: 'JetBrains Mono', monospace; }
  .prev-doc-date { font-size: 11px; color: #888; margin-top: 4px; }
  .prev-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-bottom: 22px; }
  .prev-party-box { background: #f8f9fc; border: 1px solid #e0e4ef; border-radius: 6px; padding: 14px 16px; }
  .prev-party-label { font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: #888; margin-bottom: 6px; }
  .prev-party-name { font-size: 14px; font-weight: 700; color: #1a2744; }
  .prev-party-detail { font-size: 11px; color: #555; line-height: 1.7; margin-top: 3px; }
  .prev-desc-box { background: #fffbf2; border: 1px solid #f0d090; border-radius: 6px; padding: 12px 16px; margin-bottom: 18px; }
  .prev-desc-label { font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: #888; margin-bottom: 4px; }
  .prev-desc-text { font-size: 12px; color: #333; }
  .prev-table { width: 100%; border-collapse: collapse; margin-bottom: 16px; }
  .prev-table th { background: #1a2744; color: #fff; padding: 9px 12px; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; text-align: left; }
  .prev-table td { padding: 9px 12px; border-bottom: 1px solid #eaedf5; font-size: 11px; color: #333; }
  .prev-table tr:nth-child(even) td { background: #f8f9fc; }
  .prev-table .num { text-align: right; font-family: 'JetBrains Mono', monospace; }
  .prev-totals { margin-left: auto; width: 260px; }
  .prev-total-row { display: flex; justify-content: space-between; padding: 5px 0; border-bottom: 1px solid #eaedf5; font-size: 12px; }
  .prev-total-row.final { padding-top: 9px; font-weight: 800; font-size: 15px; color: #1a2744; border-bottom: 2px solid #1a2744; }
  .prev-total-row.final .pval { color: #e8a020; }
  .prev-notes { margin-top: 20px; padding: 12px 16px; background: #f0f4ff; border-left: 3px solid #1a2744; border-radius: 0 4px 4px 0; }
  .prev-notes-label { font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: #888; margin-bottom: 4px; }
  .prev-notes-text { font-size: 11px; color: #444; }
  .prev-footer {
    margin-top: 32px;
    padding-top: 14px;
    border-top: 1px solid #e0e4ef;
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    color: #aaa;
  }
  .prev-sig { margin-top: 36px; display: flex; justify-content: space-between; }
  .prev-sig-line { text-align: center; }
  .prev-sig-bar { width: 180px; border-top: 1px solid #333; margin-bottom: 5px; }
  .prev-sig-label { font-size: 10px; color: #666; }

  /* scrollbar */
  ::-webkit-scrollbar { width: 6px; height: 6px; }
  ::-webkit-scrollbar-track { background: transparent; }
  ::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }

/* Estilos que estavam escritos nas etiquetas */
.u-mur-1 { font-family:var(--font-mono) !important; color:var(--accent) !important; font-size:12px !important; margin-bottom:4px !important; }
.u-mur-2 { margin-top:6px !important; }
.u-mur-3 { margin-bottom:18px !important; }
.u-mur-4 { flex:0 0 auto !important; }
.u-mur-5 { max-width:150px !important; }
.u-mur-6 { width:170px !important; }
.u-mur-7 { width:190px !important; }
.u-mur-8 { --kpi-color:var(--accent) !important; }
.u-mur-9 { --kpi-color:var(--green) !important; }
.u-mur-10 { --kpi-color:var(--blue) !important; }
.u-mur-11 { --kpi-color:var(--orange) !important; }
.u-mur-12 { font-size:11px !important; color:var(--text3) !important; font-weight:400 !important; }
.u-mur-13 { display:flex !important; flex-direction:column !important; gap:8px !important; }
.u-mur-14 { width:150px !important; }
.u-mur-15 { display:flex !important; gap:14px !important; flex-wrap:wrap !important; }
.u-mur-16 { --kpi-color:var(--red) !important; }
.u-mur-17 { margin-top:16px !important; }
.u-mur-18 { border-top:1px solid var(--border) !important; }
.u-mur-19 { flex:1 !important; }
.u-mur-20 { background:var(--bg) !important; }
.u-mur-21 { flex:1 !important; font-family:var(--font-display) !important; font-size:14px !important; font-weight:700 !important; }
.u-mur-22 { display:grid !important; grid-template-columns:1fr 300px !important; gap:16px !important; align-items:start !important; }
.u-mur-23 { color:var(--accent) !important; }
.u-mur-24 { display:flex !important; gap:8px !important; margin-top:8px !important; }
.u-mur-25 { position:sticky !important; top:0 !important; }
.u-mur-26 { font-family:var(--font-display) !important; font-size:13px !important; font-weight:800 !important; color:var(--accent) !important; margin-bottom:14px !important; padding-bottom:10px !important; border-bottom:1px solid var(--border) !important; }
.u-mur-27 { display:flex !important; align-items:center !important; gap:6px !important; }
.u-mur-28 { width:48px !important; background:var(--bg) !important; border:1px solid var(--border) !important; border-radius:4px !important; padding:3px 6px !important; color:var(--text) !important; font-family:var(--font-mono) !important; font-size:12px !important; outline:none !important; }
.u-mur-29 { color:var(--accent) !important; font-size:20px !important; font-weight:700 !important; }
.u-mur-30 { margin-top:10px !important; padding-top:10px !important; border-top:1px dashed var(--border) !important; }
.u-mur-31 { font-size:10px !important; color:var(--text3) !important; margin-top:4px !important; }
.u-mur-32 { margin-top:10px !important; display:flex !important; flex-direction:column !important; gap:8px !important; }
.u-mur-33 { width:100% !important; }
.u-mur-34 { cursor:pointer !important; }
.u-mur-35 { color:var(--text3) !important; text-align:center !important; padding:20px !important; }
.u-mur-36 { display:flex !important; align-items:center !important; gap:10px !important; }
.u-mur-37 { width:100px !important; font-size:11px !important; color:var(--text2) !important; }
.u-mur-38 { flex:1 !important; background:var(--surface2) !important; border-radius:4px !important; height:8px !important; overflow:hidden !important; }
.u-mur-39 { font-family:var(--font-mono) !important; font-size:12px !important; color:var(--text) !important; min-width:20px !important; }
.u-mur-40 { color:var(--text3) !important; font-size:13px !important; }
.u-mur-41 { color:var(--text3) !important; text-align:center !important; padding:30px !important; }
.u-mur-42 { max-width:200px !important; overflow:hidden !important; text-overflow:ellipsis !important; white-space:nowrap !important; }
.u-mur-43 { display:flex !important; gap:4px !important; }
.u-mur-44 { font-size:11px !important; color:var(--text3) !important; }
.u-mur-45 { text-align:center !important; min-width:80px !important; }
.u-mur-46 { font-family:var(--font-mono) !important; font-size:22px !important; font-weight:700 !important; color:var(--accent) !important; }
.u-mur-47 { font-size:11px !important; color:var(--text3) !important; margin-top:4px !important; }
.u-mur-48 { margin-top:8px !important; }
.u-mur-49 { background:#1a2744 !important; color:#fff !important; padding:3px 10px !important; border-radius:4px !important; font-size:10px !important; font-weight:700 !important; }
.u-mur-50 { font-size:12px !important; font-weight:400 !important; }
.u-mur-51 { font-weight:700 !important; font-size:13px !important; }
.u-mur-52 { width:70px !important; }
.u-mur-53 { width:50px !important; }
.u-mur-54 { width:40px !important; }
.u-mur-55 { width:80px !important; }
.u-mur-56 { font-family:monospace !important; font-size:10px !important; }
.u-mur-57 { font-weight:700 !important; }
.u-mur-58 { display:flex !important; justify-content:flex-end !important; margin-top:8px !important; }
@media (max-width: 600px) { .btn { min-height: 38px; } }
.demo-autoria { margin-top: 8px; font-size: 10.5px; line-height: 1.45; color: var(--text3); }

/* Rodapé legal do demo */
.demo-legal a { color: inherit; text-decoration: underline; }
.demo-legal { display: inline-block; margin-top: 6px; }

/* Telemóvel (auditoria 25/11): nada cortado nem fora do ecrã */
@media (max-width: 600px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .kpi-icon { display: none; }
  .pipeline { flex-wrap: wrap; }
  .pipe-stage { flex: 1 1 50%; min-width: 0; border-bottom: 1px solid var(--border); }
  .dash-row, .u-mur-22, .form-row, .form-row-3 { grid-template-columns: 1fr !important; }
  .table-header { flex-wrap: wrap; gap: 8px; }
  .u-mur-5, .u-mur-6, .u-mur-7, .table-header .form-group, .table-header input, .table-header select { width: 100% !important; max-width: none !important; }
  .dash-card { min-width: 0; overflow-x: auto; }
}
/* Aviso de demonstração visível em qualquer ecrã */
.faixa-demo { background: #1A1A2E; color: #F4F0F9; font-size: 12.5px; text-align: center; padding: 8px 14px; line-height: 1.4; }
.faixa-demo a { color: #C9A6E0; font-weight: 600; text-decoration: underline; display: inline-block; padding: 6px 4px; }
/* Tablet: a barra de filtros passa para a linha seguinte em vez de sair do ecrã */
@media (max-width: 1100px) { .table-header { flex-wrap: wrap; gap: 8px; } }
/* Tablet e telemóvel (2.ª auditoria): números legíveis, ícones fora do texto, título do editor compacto */
@media (max-width: 1100px) {
  .kpi-icon { display: none; }
  .kpi-value { white-space: nowrap; font-size: 22px; }
  table td:first-child { white-space: nowrap; }
}
@media (max-width: 600px) {
  .topbar-title { font-size: 13px; line-height: 1.25; }
  .btn-topo-erp { bottom: 16px; right: 16px; width: 38px; height: 38px; }
  .page-body { padding-bottom: 70px; }
}
/* Direitos na faixa só quando o menu lateral está escondido */
.faixa-direitos { display: none; }
@media (max-width: 1023px) { .faixa-direitos { display: inline; } }
/* Editor no telemóvel: título numa linha própria, por cima dos botões */
@media (max-width: 600px) {
  #page-editor .u-mur-18.topbar { flex-wrap: wrap; height: auto; padding-top: 10px; padding-bottom: 10px; row-gap: 8px; }
  #page-editor .u-mur-21 { order: -1; flex: 1 1 100% !important; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}
