/* ============================================================================
 * MartFlow / mARTdesign Interface for PostfixAdmin 4.0.x
 * ----------------------------------------------------------------------------
 * Full-bleed workspace architecture ported from MartFlow (Creme & Carbono):
 *   - Edge-to-edge topbar (h-14) + full-bleed page header + clean workspace
 *   - No redundant nested Bootstrap cards
 *   - Self-hosted Geomanist (400..700, text), Comfortaa (300..700, titles) and Inter (fallback) — CSP 'self' safe
 *   - Official mARTdesign SVG logos & Carbono quadrant pattern on login
 * ============================================================================ */

/* ----------------------------------------------------------------------------
 * 1. Self-hosted Typography (Geomanist 400..700 + Comfortaa 300..700 + Inter fallback)
 * ---------------------------------------------------------------------------- */
/* Geomanist (atipo): brand text face. 400 Regular, 500 Book, 600 Medium,
 * 700 Bold. The files are NOT in git (commercial font, public repository):
 * they are copied to the server at deploy time; without them Inter takes over.
 * Neither font has the arrows (U+2190, U+2192): those come from the system font. */
@font-face {
  font-family: "Geomanist";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/geomanist-400.woff2") format("woff2");
}

@font-face {
  font-family: "Geomanist";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../fonts/geomanist-500.woff2") format("woff2");
}

@font-face {
  font-family: "Geomanist";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/geomanist-600.woff2") format("woff2");
}

@font-face {
  font-family: "Geomanist";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/geomanist-700.woff2") format("woff2");
}

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 300 800;
  font-display: swap;
  src: url("../fonts/inter-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 300 800;
  font-display: swap;
  src: url("../fonts/inter-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Comfortaa";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url("../fonts/comfortaa-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Comfortaa";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url("../fonts/comfortaa-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ----------------------------------------------------------------------------
 * 2. MartFlow Palette Tokens (Creme Light + Carbono Deep Dark)
 * ---------------------------------------------------------------------------- */
:root,
[data-theme="creme"] {
  --mf-page: #eceae0;
  --mf-header: #e8e4d8;
  --mf-panel: #dedad0;
  --mf-surface: #ffffff;
  --mf-surface-subtle: #faf9f5;
  --mf-table-head: #f3f0e4;
  --mf-input-bg: #f3f0e4;
  --mf-input-on-white: #faf9f5;
  --mf-row-hover: #f3f0e4;
  --mf-ghost-hover: #f0ede4;
  --mf-btn-sec-bg: #dedad0;
  --mf-btn-sec-hover: #d0ccc0;
  --mf-border: #d4cfbf;
  --mf-border-subtle: #e8e4d8;
  --mf-divide: #f0ede4;

  --mf-text: #1a1a1a;
  --mf-text-body: #5a5040;
  --mf-text-muted: #8a8070;
  --mf-text-label: #a09880;

  --mf-accent: #f5471f;
  --mf-accent-hover: #d83c16;
  --mf-accent-secondary: #f47721;
  --mf-accent-soft: rgba(245, 71, 31, 0.10);
  --mf-accent-border: rgba(245, 71, 31, 0.25);
  --mf-accent-text: #a83010;

  --mf-green: #16a34a;
  --mf-green-text: #15803d;
  --mf-green-soft: rgba(22, 163, 74, 0.11);
  --mf-green-border: rgba(22, 163, 74, 0.28);

  --mf-amber: #d97706;
  --mf-amber-text: #b45309;
  --mf-amber-soft: rgba(217, 119, 6, 0.12);
  --mf-amber-border: rgba(217, 119, 6, 0.30);

  --mf-red: #dc2626;
  --mf-red-text: #b91c1c;
  --mf-red-soft: #fef2f2;
  --mf-red-border: #fecaca;

  --mf-shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.08), 0 1px 2px -1px rgba(0, 0, 0, 0.06);
  --mf-shadow-dropdown: 0 12px 28px -4px rgba(26, 26, 26, 0.14);
  --mf-font-sans: "Geomanist", "Inter", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --mf-font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  color-scheme: light;
}

[data-theme="carbono"] {
  --mf-page: #0d0d0d;
  --mf-header: #161616;
  --mf-panel: #1a1a1a;
  --mf-surface: #1a1a1a;
  --mf-surface-subtle: #141414;
  --mf-table-head: #141414;
  --mf-input-bg: #161616;
  --mf-input-on-white: #141414;
  --mf-row-hover: #252525;
  --mf-ghost-hover: #252525;
  --mf-btn-sec-bg: #1e1e1e;
  --mf-btn-sec-hover: #282828;
  --mf-border: #2a2a2a;
  --mf-border-subtle: #2a2a2a;
  --mf-divide: #2a2a2a;

  --mf-text: #fcf9e0;
  --mf-text-body: #a09880;
  --mf-text-muted: #8a8070;
  --mf-text-label: #a09880;

  --mf-accent: #f5471f;
  --mf-accent-hover: #d83c16;
  --mf-accent-secondary: #f47721;
  --mf-accent-soft: rgba(245, 71, 31, 0.14);
  --mf-accent-border: rgba(245, 71, 31, 0.32);
  --mf-accent-text: #ff6a3d;

  --mf-green: #22c55e;
  --mf-green-text: #86efac;
  --mf-green-soft: rgba(21, 128, 61, 0.16);
  --mf-green-border: rgba(21, 128, 61, 0.36);

  --mf-amber: #f59e0b;
  --mf-amber-text: #fbbf24;
  --mf-amber-soft: rgba(245, 158, 11, 0.15);
  --mf-amber-border: rgba(245, 158, 11, 0.35);

  --mf-red: #ef4444;
  --mf-red-text: #f87171;
  --mf-red-soft: rgba(220, 38, 38, 0.14);
  --mf-red-border: rgba(220, 38, 38, 0.34);

  --mf-shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.35);
  --mf-shadow-dropdown: 0 16px 36px -4px rgba(0, 0, 0, 0.6);
  color-scheme: dark;
}

/* ----------------------------------------------------------------------------
 * 3. Base Reset & Full-bleed App Shell
 * ---------------------------------------------------------------------------- */
html {
  background-color: var(--mf-page);
  height: 100%;
}

body {
  background-color: var(--mf-page);
  color: var(--mf-text-body);
  font-family: var(--mf-font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color 0.2s ease, color 0.2s ease;
}

/* Strip legacy Bootstrap 3 gradients & text shadows */
.btn,
.navbar,
.panel,
.panel-heading,
.panel-footer,
.dropdown-menu,
.alert,
.well {
  background-image: none !important;
  text-shadow: none !important;
}

a {
  color: var(--mf-accent);
  transition: color 150ms ease;
}

a:hover,
a:focus {
  color: var(--mf-accent-hover);
}

:focus-visible {
  outline: 2px solid var(--mf-accent);
  outline-offset: 2px;
}

/* Main full-bleed app canvas */
.mf-main {
  flex: 1 0 auto;
  width: 100%;
  display: flex;
  flex-direction: column;
  padding-top: 56px;
}

.mf-content {
  width: 100%;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

@media (max-width: 767px) {
  .mf-content {
    padding: 16px;
  }
}

/* Custom thin MartFlow scrollbars */
.mf-scrollbar,
.domain-list-scroll,
.table-responsive {
  scrollbar-width: thin;
  scrollbar-color: var(--mf-border) transparent;
}

/* ----------------------------------------------------------------------------
 * 4. MartFlow Topbar (h-14 / 56px full-bleed, synced with Creme & Carbono)
 * ---------------------------------------------------------------------------- */
.mf-topbar.navbar-default {
  background-color: var(--mf-header) !important;
  border: 0;
  border-bottom: 1px solid var(--mf-border);
  box-shadow: none;
  min-height: 56px;
  height: 56px;
  margin-bottom: 0;
  z-index: 1030;
}

.mf-topbar .container-fluid {
  width: 100%;
  padding-left: 24px;
  padding-right: 24px;
  min-height: 56px;
}

.mf-topbar .navbar-header {
  display: flex;
  align-items: center;
  height: 56px;
}

.mf-topbar .navbar-brand {
  order: -1;
  margin-left: 0 !important;
  height: 56px;
  padding: 10px 18px 10px 0 !important;
  display: flex;
  align-items: center;
}

.mf-topbar .navbar-brand img {
  height: 30px;
  width: auto;
  display: block;
}

/* Auto-swap positive logo (Creme) and negative logo (Carbono) */
.mf-logo-neg { display: none !important; }
[data-theme="carbono"] .mf-logo-pos { display: none !important; }
[data-theme="carbono"] .mf-logo-neg { display: block !important; }

.mf-topbar .navbar-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-top: 0;
  margin-bottom: 0;
}

.mf-topbar .navbar-nav > li > a,
.mf-topbar .navbar-nav > li > a.btn.navbar-btn {
  font-family: var(--mf-font-sans);
  font-size: 13px;
  font-weight: 500;
  color: var(--mf-text-body) !important;
  background-color: transparent !important;
  border: 0 !important;
  border-radius: 8px !important;
  margin: 10px 1px !important;
  padding: 7px 11px !important;
  line-height: 20px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: background-color 150ms ease, color 150ms ease;
}

.mf-topbar .navbar-nav > li > a:hover,
.mf-topbar .navbar-nav > li > a:focus,
.mf-topbar .navbar-nav > li.open > a,
.mf-topbar .navbar-nav > li.open > a:hover,
.mf-topbar .navbar-nav > li.open > a:focus {
  background-color: var(--mf-ghost-hover) !important;
  color: var(--mf-text) !important;
}

.mf-topbar .navbar-nav > li > a .caret {
  opacity: 0.55;
  margin-left: 2px;
}

.mf-topbar .dropdown-menu {
  background-color: var(--mf-surface);
  border: 1px solid var(--mf-border);
  border-radius: 12px !important;
  box-shadow: var(--mf-shadow-dropdown);
  padding: 6px;
  min-width: 210px;
  margin-top: 4px;
}

.mf-topbar .dropdown-menu > li > a {
  color: var(--mf-text-body);
  font-size: 13px;
  font-weight: 500;
  padding: 8px 12px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background-color 140ms ease, color 140ms ease;
}

.mf-topbar .dropdown-menu > li > a:hover,
.mf-topbar .dropdown-menu > li > a:focus {
  background-color: var(--mf-row-hover);
  color: var(--mf-text);
}

/* Right utility cluster (theme toggle + logout ghost buttons) */
.mf-topbar-utils {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 56px;
}

.mf-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 8px;
  border: 1px solid transparent;
  background-color: transparent;
  color: var(--mf-text-body);
  text-decoration: none !important;
  cursor: pointer;
  transition: background-color 150ms ease, color 150ms ease, border-color 150ms ease;
}

.mf-icon-btn:hover,
.mf-icon-btn:focus {
  background-color: var(--mf-ghost-hover);
  color: var(--mf-text);
}

.mf-icon-btn--logout:hover {
  background-color: var(--mf-red-soft);
  color: var(--mf-red-text);
}

.mf-icon-btn svg,
.mf-btn-primary svg,
.mf-btn-secondary svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

.mf-theme-icon-sun { display: none; }
[data-theme="carbono"] .mf-theme-icon-moon { display: none; }
[data-theme="carbono"] .mf-theme-icon-sun { display: block; }

.mf-topbar .navbar-toggle {
  border-color: var(--mf-border);
  border-radius: 8px;
  margin-left: auto;
}

.mf-topbar .navbar-toggle .icon-bar {
  background-color: var(--mf-text-body);
}

/* The full superadmin menu needs ~1000 px on one line: below 1100 px it collapses
   into the hamburger (Bootstrap only does that below 768 px, so 768–1099 is forced here) */
@media (min-width: 768px) and (max-width: 1099px) {
  .mf-topbar .navbar-header {
    float: none;
  }
  .mf-topbar .navbar-toggle {
    display: block;
  }
  .mf-topbar .navbar-collapse.collapse {
    display: none !important;
  }
  .mf-topbar .navbar-collapse.collapse.in,
  .mf-topbar .navbar-collapse.collapsing {
    display: block !important;
    max-height: calc(100vh - 56px);
    overflow-y: auto !important;
  }
  .mf-topbar .navbar-nav,
  .mf-topbar .navbar-right {
    float: none !important;
    margin: 0;
  }
  .mf-topbar .navbar-nav > li {
    float: none;
  }
  .mf-topbar .navbar-nav .open .dropdown-menu {
    position: static;
    float: none;
    width: auto;
    margin-top: 0;
    box-shadow: none;
  }
  .container-fluid > .navbar-header,
  .container-fluid > .navbar-collapse {
    margin-left: 0;
    margin-right: 0;
  }
}

@media (max-width: 1099px) {
  .mf-topbar.navbar-default { height: auto; }
  .mf-topbar .navbar-collapse {
    background-color: var(--mf-header);
    border-top: 1px solid var(--mf-border);
    padding-bottom: 10px;
  }
  .mf-topbar .navbar-nav {
    display: block;
  }
  .mf-topbar .navbar-nav > li > a,
  .mf-topbar .navbar-nav > li > a.btn.navbar-btn {
    margin: 2px 0 !important;
    width: 100%;
    justify-content: flex-start;
  }
  .mf-topbar-utils {
    height: auto;
    padding: 8px 0 4px 0;
  }
}

/* ----------------------------------------------------------------------------
 * 5. MartFlow Full-bleed Page Sub-Header & Tab Strip
 * ---------------------------------------------------------------------------- */
.mf-page-header {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 24px;
  background-color: var(--mf-header);
  border-bottom: 1px solid var(--mf-border);
}

.mf-page-header-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.mf-eyebrow {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--mf-text-label);
  margin: 0;
  line-height: 1.4;
}

.mf-eyebrow a {
  color: var(--mf-text-label);
  text-decoration: none;
}

.mf-eyebrow a:hover {
  color: var(--mf-accent);
}

.mf-page-title {
  font-family: var(--mf-font-display);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--mf-text);
  margin: 0;
  line-height: 1.2;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.mf-page-header-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.mf-header-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

/* MartFlow Tab Strip (from parametros.html) */
.mf-tab-strip {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 24px;
  background-color: var(--mf-panel);
  border-bottom: 1px solid var(--mf-border);
}

.mf-tabs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.mf-tab,
.mf-tab-active {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 12.5px;
  text-decoration: none !important;
  white-space: nowrap;
  transition: background-color 150ms ease, color 150ms ease, box-shadow 150ms ease;
}

.mf-tab {
  color: var(--mf-text-body);
  font-weight: 500;
}

.mf-tab:hover {
  background-color: rgba(212, 207, 191, 0.55);
  color: var(--mf-text);
}

[data-theme="carbono"] .mf-tab:hover {
  background-color: #141414;
  color: var(--mf-text);
}

.mf-tab-active {
  background-color: var(--mf-surface);
  color: var(--mf-accent);
  font-weight: 700;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

[data-theme="carbono"] .mf-tab-active {
  background-color: #252525;
}

/* Section bar when list.tpl is embedded inside /virtual */
.mf-section-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.mf-section-heading {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--mf-text);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ----------------------------------------------------------------------------
 * 6. MartFlow Buttons, Badges & Inputs
 * ---------------------------------------------------------------------------- */
.mf-btn-primary,
.btn.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 10px !important;
  border: 0 !important;
  background-color: var(--mf-accent) !important;
  color: #ffffff !important;
  font-family: var(--mf-font-sans);
  font-size: 13.5px;
  font-weight: 600;
  line-height: 20px;
  text-decoration: none !important;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(245, 71, 31, 0.25);
  transition: background-color 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

.mf-btn-primary:hover,
.mf-btn-primary:focus,
.btn.btn-primary:hover,
.btn.btn-primary:focus {
  background-color: var(--mf-accent-hover) !important;
  color: #ffffff !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(245, 71, 31, 0.38);
}

.mf-btn-secondary,
.btn.btn-default,
.btn.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: 10px !important;
  border: 1px solid var(--mf-border) !important;
  background-color: var(--mf-btn-sec-bg) !important;
  color: var(--mf-text-body) !important;
  font-family: var(--mf-font-sans);
  font-size: 13px;
  font-weight: 600;
  line-height: 20px;
  text-decoration: none !important;
  cursor: pointer;
  transition: background-color 150ms ease, color 150ms ease, border-color 150ms ease;
}

.mf-btn-secondary:hover,
.mf-btn-secondary:focus,
.btn.btn-default:hover,
.btn.btn-default:focus,
.btn.btn-secondary:hover,
.btn.btn-secondary:focus {
  background-color: var(--mf-btn-sec-hover) !important;
  color: var(--mf-text) !important;
}

.btn.btn-danger {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: 10px !important;
  border: 0 !important;
  background-color: var(--mf-red) !important;
  color: #ffffff !important;
  font-weight: 600;
}

/* Badges (exact MartFlow .mf-badge & .mf-badge-solid) */
.mf-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
  background-color: var(--mf-accent-soft);
  color: var(--mf-text); /* orange 11 px text on the soft accent was 2.5:1 */
  white-space: nowrap;
}

.mf-badge-solid {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 600;
  background-color: var(--mf-panel);
  color: var(--mf-text-body);
  white-space: nowrap;
}

[data-theme="carbono"] .mf-badge-solid {
  background-color: #141414;
  border: 1px solid #2a2a2a;
}

/* Inputs & Selects (exact MartFlow .mf-input / .mf-select) */
.mf-input,
.mf-select,
.form-control {
  background-color: var(--mf-input-bg);
  border: 1px solid var(--mf-border);
  border-radius: 12px !important;
  color: var(--mf-text);
  font-family: var(--mf-font-sans);
  font-size: 13.5px;
  padding: 9px 14px;
  height: 40px;
  box-shadow: none !important;
  transition: border-color 150ms ease, box-shadow 150ms ease, background-color 150ms ease;
}

.mf-form-sheet .form-control,
.panel-body .form-control {
  background-color: var(--mf-input-on-white);
}

textarea.form-control,
select[multiple].form-control {
  height: auto;
  min-height: 110px;
}

.mf-input:focus,
.mf-select:focus,
.form-control:focus {
  border-color: var(--mf-accent) !important;
  box-shadow: 0 0 0 2px rgba(245, 71, 31, 0.22) !important;
  outline: none;
}

.mf-input::placeholder,
.form-control::placeholder {
  color: var(--mf-text-label);
}

/* Inline search / select in page header */
.mf-header-control form {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.mf-header-control #q {
  width: 280px;
  max-width: 100%;
}

@media (max-width: 767px) {
  .mf-page-header-actions,
  .mf-header-control,
  .mf-header-control form {
    width: 100%;
  }

  .mf-header-control #q,
  .mf-header-control form .form-control {
    flex: 1 1 auto;
    min-width: 0;
    width: auto;
  }

  /* 44 px touch targets, like the filter bar */
  .mf-header-control .form-control,
  .mf-header-control select,
  .mf-header-control button {
    min-height: 44px;
    height: 44px;
  }

  .mf-page-header-actions .mf-btn-primary,
  .mf-page-header-actions .mf-btn-secondary {
    min-height: 44px;
  }
}

.mf-header-control .form-control,
.mf-header-control select {
  height: 36px;
  padding: 6px 12px;
  border-radius: 10px !important;
  background-color: var(--mf-surface);
  border: 1px solid var(--mf-border);
  color: var(--mf-text);
  font-size: 13px;
  min-width: 170px;
}

[data-theme="carbono"] .mf-header-control .form-control,
[data-theme="carbono"] .mf-header-control select {
  background-color: #1a1a1a;
}

.mf-search-inline input.form-control {
  width: 210px;
  min-width: 150px;
}

/* ----------------------------------------------------------------------------
 * 7. Full-bleed MartFlow Flash Strips & MOTD
 * ---------------------------------------------------------------------------- */
.mf-flash-success,
.mf-flash-error,
.mf-flash-motd {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 24px;
  font-size: 13px;
  font-weight: 500;
}

.mf-flash-success {
  color: var(--mf-green-text);
  background-color: #f0fdf4;
  border-bottom: 1px solid #bbf7d0;
}

[data-theme="carbono"] .mf-flash-success {
  background-color: rgba(21, 128, 61, 0.12);
  border-bottom-color: rgba(21, 128, 61, 0.32);
}

.mf-flash-error {
  color: var(--mf-red-text);
  background-color: var(--mf-red-soft);
  border-bottom: 1px solid var(--mf-red-border);
}

.mf-flash-motd {
  color: var(--mf-amber-text);
  background-color: var(--mf-amber-soft);
  border-bottom: 1px solid var(--mf-amber-border);
  font-weight: 600;
}

.mf-flash-success ul,
.mf-flash-error ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* Every notice: close button (44 px target) and a short exit; "auto" notices leave after 5 s */
.mf-flash {
  position: relative;
  min-height: 44px;
  padding-right: 60px;
  transition: opacity 200ms ease, transform 200ms ease;
}

.mf-flash--leaving {
  opacity: 0;
  transform: translateY(-6px);
}

.mf-flash-close {
  position: absolute;
  top: 50%;
  right: 8px;
  width: 44px;
  height: 44px;
  margin-top: -22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: inherit;
  opacity: 0.8;
  cursor: pointer;
  transition: opacity 150ms ease, background-color 150ms ease;
}

.mf-flash-close:hover,
.mf-flash-close:focus-visible {
  opacity: 1;
  background-color: rgba(26, 26, 26, 0.07);
}

[data-theme="carbono"] .mf-flash-close:hover,
[data-theme="carbono"] .mf-flash-close:focus-visible {
  background-color: rgba(252, 249, 224, 0.09);
}

.mf-flash-close svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

.mf-flash-stack {
  position: fixed;
  top: 56px;
  left: 0;
  right: 0;
  z-index: 1020;
  /* Opaque base: the notice colors are translucent and the stack floats over the page */
  background-color: var(--mf-page);
  box-shadow: 0 10px 24px -12px rgba(26, 26, 26, 0.28);
}

.mf-flash-stack--footer {
  position: sticky;
  top: auto;
  bottom: 0;
  z-index: 2;
  box-shadow: 0 -10px 24px -14px rgba(26, 26, 26, 0.28);
}

/* Login pages have no title bar: the notice sits on top of the footer */
body.page-login .mf-flash,
body.page-login-mfa .mf-flash,
body.page-password-recover .mf-flash,
body.page-password-change .mf-flash {
  z-index: 1;
  border-bottom: 0;
  border-top: 1px solid var(--mf-border);
}

body.page-login .mf-flash-error,
body.page-login-mfa .mf-flash-error,
body.page-password-recover .mf-flash-error,
body.page-password-change .mf-flash-error {
  border-top-color: var(--mf-red-border);
}

body.page-login .mf-flash--leaving,
body.page-login-mfa .mf-flash--leaving,
body.page-password-recover .mf-flash--leaving,
body.page-password-change .mf-flash--leaving {
  transform: translateY(6px);
}

/* Search filter chips strip */
.mf-search-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--mf-text-body);
}

.mf-search-chips a {
  font-weight: 600;
  color: var(--mf-accent);
  text-decoration: none;
}

/* ----------------------------------------------------------------------------
 * 8. MartFlow Datatables (.mf-table-wrapper — clean, rounded-2xl, zero scroll)
 * ---------------------------------------------------------------------------- */
.mf-table-wrapper {
  width: 100%;
  overflow: hidden;
  border-radius: 16px;
  border: 1px solid var(--mf-border-subtle);
  background-color: var(--mf-surface);
  box-shadow: var(--mf-shadow-sm);
}

.mf-table-scroll,
.domain-list-scroll,
.mf-table-wrapper > .table-responsive {
  display: block;
  width: 100%;
  overflow-x: auto;
  border: 0;
  margin: 0;
  -webkit-overflow-scrolling: touch;
}

.domain-list-scroll > #admin_table {
  min-width: 0 !important;
  width: 100%;
}

#admin_table,
#mailbox_table,
#log_table,
.mf-table {
  width: 100%;
  margin-bottom: 0;
  border-collapse: collapse;
  font-size: 13.5px;
  background-color: transparent;
}

#admin_table > thead > tr > th,
#mailbox_table > thead > tr > th,
#log_table > thead > tr > th,
.mf-table > thead > tr > th {
  background-color: var(--mf-table-head);
  color: var(--mf-text-label);
  font-family: var(--mf-font-sans);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  border-top: 0;
  border-bottom: 1px solid var(--mf-border-subtle);
  padding: 12px 12px;
  vertical-align: middle;
  white-space: normal !important;
  line-height: 1.3;
}

#admin_table > tbody > tr > td,
#mailbox_table > tbody > tr > td,
#log_table > tbody > tr > td,
.mf-table > tbody > tr > td {
  padding: 12px 12px;
  vertical-align: middle;
  border-top: 1px solid var(--mf-divide);
  color: var(--mf-text);
  transition: background-color 140ms ease;
}

#admin_table > tbody > tr:first-child > td,
#mailbox_table > tbody > tr:first-child > td,
#log_table > tbody > tr:first-child > td,
.mf-table > tbody > tr:first-child > td {
  border-top: 0;
}

#admin_table > tbody > tr:hover > td,
#mailbox_table > tbody > tr:hover > td,
#log_table > tbody > tr:hover > td,
.mf-table > tbody > tr:hover > td {
  background-color: var(--mf-row-hover);
}

#admin_table td a:not(.pfa-action-btn):not(.btn),
#mailbox_table td a:not(.pfa-action-btn):not(.btn) {
  color: var(--mf-text);
  font-weight: 600;
  text-decoration: none;
}

#admin_table td a:not(.pfa-action-btn):not(.btn):hover,
#admin_table td a:not(.pfa-action-btn):not(.btn):focus,
#mailbox_table td a:not(.pfa-action-btn):not(.btn):hover,
#mailbox_table td a:not(.pfa-action-btn):not(.btn):focus {
  color: var(--mf-text);
  text-decoration: underline;
  text-decoration-color: var(--mf-accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

/* Domain column widths — balanced for desktop without forced horizontal scroll */
#admin_table th.list-col-domain,
#admin_table td.list-col-domain { min-width: 170px; word-break: break-word; }

#admin_table th.list-col-description,
#admin_table td.list-col-description { min-width: 100px; max-width: 240px; color: var(--mf-text-body); }

#admin_table th.list-col-aliases_quot,
#admin_table td.list-col-aliases_quot,
#admin_table th.list-col-mailboxes_quot,
#admin_table td.list-col-mailboxes_quot { width: 110px; text-align: center; white-space: nowrap; }

#admin_table th.list-col-total_quot,
#admin_table td.list-col-total_quot { width: 126px; text-align: center; white-space: nowrap; }

#admin_table th.list-col-maxquota,
#admin_table td.list-col-maxquota,
#admin_table th.list-col-max_domain_msg_mailsize,
#admin_table td.list-col-max_domain_msg_mailsize { width: 82px; text-align: center; font-variant-numeric: tabular-nums; }

#admin_table th.list-col-transport,
#admin_table td.list-col-transport,
#admin_table th.list-col-backupmx,
#admin_table td.list-col-backupmx,
#admin_table th.list-col-sendonly,
#admin_table td.list-col-sendonly,
#admin_table th.list-col-password_expiry,
#admin_table td.list-col-password_expiry { width: 72px; text-align: center; color: var(--mf-text-body); }

/* Headers keep the label colour of the other headers; only the cells are body text */
#admin_table > thead > tr > th.list-col-description,
#admin_table > thead > tr > th.list-col-transport,
#admin_table > thead > tr > th.list-col-backupmx,
#admin_table > thead > tr > th.list-col-sendonly,
#admin_table > thead > tr > th.list-col-password_expiry { color: var(--mf-text-label); }

#admin_table th.list-col-active,
#admin_table td.list-col-active,
#mailbox_table th.list-col-active,
#mailbox_table td.list-col-active { width: 56px; text-align: center; white-space: nowrap; }

#admin_table th.list-col-modified,
#admin_table td.list-col-modified {
  width: 96px;
  text-align: center;
  white-space: nowrap;
}

#admin_table td.list-col-modified {
  color: var(--mf-text-muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 1300px) {
  .domain-list-scroll > #admin_table .list-col-modified { display: table-cell; }
  .domain-list-scroll > #admin_table { min-width: 0 !important; }
}
@media (max-width: 1200px) {
  .domain-list-scroll > #admin_table .list-col-backupmx { display: table-cell; }
  .domain-list-scroll > #admin_table { min-width: 0 !important; }
}
@media (max-width: 1120px) {
  .domain-list-scroll > #admin_table .list-col-transport { display: table-cell; }
  .domain-list-scroll > #admin_table { min-width: 0 !important; }
}

#admin_table th.list-col-action,
#admin_table td.list-col-action,
#mailbox_table th.list-col-action,
#mailbox_table td.list-col-action {
  width: 40px;
  min-width: 40px;
  padding-left: 4px;
  padding-right: 4px;
  text-align: center;
  white-space: nowrap;
}

#admin_table td.list-col-action form,
#mailbox_table td.list-col-action form {
  display: inline-block;
  margin: 0;
}

#mailbox_table td.list-col-spacer {
  width: 0;
  padding: 0 !important;
}

/* ----------------------------------------------------------------------------
 * 9. MartFlow Ghost Action Icon Buttons (entidades.html aesthetic)
 * ---------------------------------------------------------------------------- */
.pfa-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 8px;
  border: 1px solid transparent;
  background-color: transparent;
  text-decoration: none !important;
  cursor: pointer;
  line-height: 1;
  transition: background-color 150ms ease, color 150ms ease, border-color 150ms ease;
}

.pfa-action-btn .pfa-icon {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  display: block;
  pointer-events: none;
}

/* Active ON (Habilitado) — Verde suave sempre legivel como indicador de status */
.pfa-btn-active-on {
  background-color: var(--mf-green-soft);
  color: var(--mf-green-text);
}
.pfa-btn-active-on:hover,
.pfa-btn-active-on:focus {
  background-color: var(--mf-green);
  color: #ffffff;
}

/* Active OFF (Desabilitado) — Cinza neutro */
.pfa-btn-active-off {
  background-color: var(--mf-row-hover);
  color: var(--mf-text-muted);
}
.pfa-btn-active-off:hover,
.pfa-btn-active-off:focus {
  background-color: var(--mf-text-body);
  color: var(--mf-surface);
}

/* Edit (Editar) — Ghost limpo com ambar semantico */
.pfa-btn-edit {
  color: var(--mf-amber-text);
}
.pfa-btn-edit:hover,
.pfa-btn-edit:focus {
  background-color: var(--mf-amber-soft);
  color: var(--mf-amber);
}

/* Alias (Encaminhamento) — Ghost limpo neutro/contraste */
.pfa-btn-alias {
  color: var(--mf-text-muted);
}
.pfa-btn-alias:hover,
.pfa-btn-alias:focus {
  background-color: var(--mf-ghost-hover);
  color: var(--mf-text);
}

/* Delete (Excluir) — Ghost limpo com vermelho semantico */
.pfa-btn-delete {
  color: var(--mf-red-text);
  opacity: 0.78;
}
.pfa-btn-delete:hover,
.pfa-btn-delete:focus {
  opacity: 1;
  background-color: var(--mf-red-soft);
  color: var(--mf-red);
}

/* Vacation (Ferias) */
.pfa-btn-vacation-on {
  background-color: var(--mf-accent-soft);
  color: var(--mf-accent);
}
.pfa-btn-vacation-on:hover {
  background-color: var(--mf-accent);
  color: #ffffff;
}
.pfa-btn-vacation-off {
  color: var(--mf-text-muted);
}
.pfa-btn-vacation-off:hover {
  background-color: var(--mf-ghost-hover);
  color: var(--mf-text);
}

/* ----------------------------------------------------------------------------
 * 10. Clean MartFlow Quota Pills (strong fill visibility in Creme & Carbono)
 * ---------------------------------------------------------------------------- */
.quota_bar {
  position: relative;
  display: inline-block;
  box-sizing: border-box;
  min-width: 96px;
  max-width: 132px;
  width: 100%;
  height: 24px;
  overflow: hidden;
  background-color: #ebe7da;
  border: 1px solid var(--mf-border);
  border-radius: 8px;
  line-height: 22px;
  text-align: center;
  vertical-align: middle;
  white-space: nowrap;
}

[data-theme="carbono"] .quota_bar {
  background-color: #141414;
  border-color: #2a2a2a;
}

.quota_fill {
  position: absolute;
  z-index: 1;
  top: 0;
  bottom: 0;
  left: 0;
  max-width: 100%;
  background-image: none !important;
  transition: width 200ms ease;
}

.quota_low { background-color: rgba(22, 163, 74, 0.34) !important; border-right: 2px solid var(--mf-green); }
.quota_mid { background-color: rgba(217, 119, 6, 0.36) !important; border-right: 2px solid var(--mf-amber); }
.quota_high { background-color: rgba(220, 38, 38, 0.34) !important; border-right: 2px solid var(--mf-red); }

[data-theme="carbono"] .quota_low { background-color: rgba(34, 197, 94, 0.34) !important; }
[data-theme="carbono"] .quota_mid { background-color: rgba(245, 158, 11, 0.36) !important; }
[data-theme="carbono"] .quota_high { background-color: rgba(239, 68, 68, 0.38) !important; }

.quota_label {
  position: relative;
  z-index: 2;
  display: block;
  height: 22px;
  padding: 0 7px;
  font-size: 11.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--mf-text);
  cursor: default;
}

.quota_text_low { color: #14532d !important; }
.quota_text_mid { color: #78350f !important; }
.quota_text_high { color: #7f1d1d !important; }

[data-theme="carbono"] .quota_text_low { color: #dcfce7 !important; }
[data-theme="carbono"] .quota_text_mid { color: #fef3c7 !important; }
[data-theme="carbono"] .quota_text_high { color: #fee2e2 !important; }

.quota_no_border {
  min-width: 0;
  width: auto;
  height: auto;
  background: transparent;
  border: none;
  line-height: 1.4;
}

.quota_no_border .quota_label {
  height: auto;
  padding: 0;
  color: var(--mf-text-muted);
  font-weight: 500;
}

/* ----------------------------------------------------------------------------
 * 11. MartFlow Forms (cadastro-fornecedor.html inspired — airy, single surface)
 * ---------------------------------------------------------------------------- */
.mf-form-wrap {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
}

.mf-form-sheet {
  background-color: var(--mf-surface);
  border: 1px solid var(--mf-border);
  border-radius: 16px;
  box-shadow: var(--mf-shadow-sm);
  overflow: hidden;
}

.mf-form-sheet-body {
  padding: 28px 32px;
}

.mf-form-sheet-footer {
  padding: 16px 32px;
  background-color: var(--mf-surface-subtle);
  border-top: 1px solid var(--mf-border-subtle);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.mf-form-sheet .form-group {
  margin-bottom: 20px;
}

.mf-form-sheet .control-label {
  color: var(--mf-text);
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  padding-top: 9px;
}

/* User area forms (Bootstrap default was 14 px bold) */
.form-horizontal .control-label {
  font-size: 13px;
  font-weight: 600;
}

/* Checkboxes and radios in the brand accent, not the browser blue */
input[type="checkbox"],
input[type="radio"] {
  accent-color: var(--mf-accent);
}

.mf-form-sheet .help-block {
  color: var(--mf-text-muted);
  font-size: 12px;
  margin-top: 5px;
  margin-bottom: 0;
}

.mf-form-sheet .has-error .help-block {
  color: var(--mf-red-text);
  font-weight: 500;
}

.mf-form-sheet .has-error .form-control {
  border-color: var(--mf-red) !important;
}

.mf-form-sheet .form-control-static {
  color: var(--mf-text);
  font-weight: 600;
  padding-top: 9px;
}

@media (max-width: 767px) {
  .mf-form-sheet-body { padding: 20px; }
  .mf-form-sheet-footer { padding: 14px 20px; }
}

/* ----------------------------------------------------------------------------
 * 12. Dashboard (/main) — MartFlow Entity-list style quick navigation
 * ---------------------------------------------------------------------------- */
.mf-nav-list {
  display: flex;
  flex-direction: column;
}

.mf-nav-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  text-decoration: none !important;
  color: var(--mf-text);
  border-top: 1px solid var(--mf-divide);
  transition: background-color 150ms ease;
}

.mf-nav-row:first-child {
  border-top: 0;
}

.mf-nav-row:hover {
  background-color: var(--mf-row-hover);
}

.mf-nav-row-left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.mf-nav-tile {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background-color: var(--mf-table-head);
  color: var(--mf-text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background-color 150ms ease, color 150ms ease;
}

.mf-nav-row:hover .mf-nav-tile {
  background-color: var(--mf-accent-soft);
  color: var(--mf-accent);
}

.mf-nav-tile svg,
.mf-nav-arrow {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mf-nav-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--mf-text);
  line-height: 1.3;
}

.mf-nav-desc {
  font-size: 12.5px;
  color: var(--mf-text-muted);
  margin-top: 2px;
}

.mf-nav-arrow {
  color: var(--mf-text-label);
  flex-shrink: 0;
  transition: transform 150ms ease, color 150ms ease;
}

.mf-nav-row:hover .mf-nav-arrow {
  color: var(--mf-accent);
  transform: translateX(3px);
}

/* ----------------------------------------------------------------------------
 * 13. Viewlog pagination & status legend
 * ---------------------------------------------------------------------------- */
.mf-pagination-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.mf-status-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  font-size: 12px;
  color: var(--mf-text-muted);
}

.mf-status-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.searchresult {
  background-color: var(--mf-accent-soft);
  color: var(--mf-accent);
  padding: 0 3px;
  border-radius: 4px;
  font-weight: 600;
}

#log_table summary {
  cursor: pointer;
  color: var(--mf-accent);
  font-weight: 500;
}

/* ----------------------------------------------------------------------------
 * 14. Seamless MartFlow styling for secondary Bootstrap .panel templates
 *     (totp.tpl, app-passwords.tpl, totp-exceptions.tpl, vacation.tpl, users_*)
 * ---------------------------------------------------------------------------- */
.mf-main > .panel,
.mf-main > form > .panel {
  margin: 24px;
  background-color: var(--mf-surface);
  border: 1px solid var(--mf-border);
  border-radius: 16px !important;
  box-shadow: var(--mf-shadow-sm);
  overflow: hidden;
}

.panel-default > .panel-heading {
  background-color: var(--mf-surface-subtle);
  border-bottom: 1px solid var(--mf-border-subtle);
  color: var(--mf-text);
  padding: 16px 24px;
}

.panel-default > .panel-heading h4 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--mf-text);
}

.panel-body {
  background-color: var(--mf-surface);
  color: var(--mf-text);
  padding: 24px;
}

.panel-footer {
  background-color: var(--mf-surface-subtle);
  border-top: 1px solid var(--mf-border-subtle);
  padding: 14px 24px;
}

/* ----------------------------------------------------------------------------
 * 15. Login & Recovery — same frame as the Roundcube mARTdesign login (v2.11):
 *     page in the current theme (Creme / Carbono), static hex grid on the top-left,
 *     hex grid with the orange trace on the bottom-right, centered logo + eyebrow +
 *     title + card, no title bar, notices sitting on top of the footer.
 * ---------------------------------------------------------------------------- */
:root,
[data-theme="creme"] {
  --mf-pattern-line: #cbc6b5;
  --mf-auth-input: #f3f0e4;
  --mf-auth-card-shadow: 0 20px 44px -18px rgba(26, 26, 26, 0.22);
}

[data-theme="carbono"] {
  --mf-pattern-line: #404040;
  --mf-auth-input: #0d0d0d;
  --mf-auth-card-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.55);
}

body.page-login,
body.page-login-mfa,
body.page-password-recover,
body.page-password-change {
  position: relative;
  overflow-x: hidden;
}

/* Background stage (templates/auth_background.tpl) */
.pfa-auth-stage {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.pfa-auth-svg {
  position: absolute;
  height: 60%;
  width: auto;
  max-width: 68vw;
  display: block;
}

.pfa-auth-svg .l {
  fill: none;
  stroke: var(--mf-pattern-line);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.pfa-auth-svg .d {
  fill: var(--mf-pattern-line);
}

/* Orange trace: one dash per route, born at the first vertex, runs along the grid
   edges and shrinks into the last vertex; 5 routes in turn, 21 s cycle */
.pfa-auth-svg .a {
  fill: none;
  stroke: var(--mf-accent);
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
  stroke-dasharray: 30 200;
  stroke-dashoffset: 31;
}

.pfa-auth-svg .a-p1 { animation: pfa-hex-trace-1 21s linear infinite; }
.pfa-auth-svg .a-p2 { animation: pfa-hex-trace-2 21s linear infinite; }
.pfa-auth-svg .a-p3 { animation: pfa-hex-trace-3 21s linear infinite; }
.pfa-auth-svg .a-p4 { animation: pfa-hex-trace-4 21s linear infinite; }
.pfa-auth-svg .a-p5 { animation: pfa-hex-trace-5 21s linear infinite; }

.pfa-hex-grade {
  top: 0;
  left: 0;
  opacity: 0.9;
}

.pfa-hex-rede {
  right: 0;
  bottom: 0;
  opacity: 0.95;
}

@keyframes pfa-hex-trace-1 {
  0% { stroke-dashoffset: 31; }
  17.2%, 100% { stroke-dashoffset: -101; }
}

@keyframes pfa-hex-trace-2 {
  0%, 20% { stroke-dashoffset: 31; }
  37.2%, 100% { stroke-dashoffset: -101; }
}

@keyframes pfa-hex-trace-3 {
  0%, 40% { stroke-dashoffset: 31; }
  57.2%, 100% { stroke-dashoffset: -101; }
}

@keyframes pfa-hex-trace-4 {
  0%, 60% { stroke-dashoffset: 31; }
  77.2%, 100% { stroke-dashoffset: -101; }
}

@keyframes pfa-hex-trace-5 {
  0%, 80% { stroke-dashoffset: 31; }
  97.2%, 100% { stroke-dashoffset: -101; }
}

/* Reduced motion: no movement, one route already drawn (the stage is never empty) */
@media (prefers-reduced-motion: reduce) {
  .pfa-auth-svg .a-p1 {
    animation: none !important;
    stroke-dasharray: none !important;
    stroke-dashoffset: 0 !important;
  }

  .pfa-auth-svg .a:not(.a-p1) {
    display: none !important;
  }
}

body.page-login .mf-main,
body.page-login-mfa .mf-main,
body.page-password-recover .mf-main,
body.page-password-change .mf-main {
  position: relative;
  z-index: 1;
  justify-content: center;
  align-items: center;
  padding: 48px 16px 40px;
}

body.page-login .footer,
body.page-login-mfa .footer,
body.page-password-recover .footer,
body.page-password-change .footer {
  position: relative;
  z-index: 1;
}

div#login {
  max-width: 420px !important;
  width: 100%;
  margin: 0 auto;
  padding: 0;
}

div#login .pfa-login-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-bottom: 24px;
}

div#login .pfa-login-logo {
  height: 34px;
  width: auto;
  margin-bottom: 22px;
}

div#login .pfa-login-eyebrow {
  font-family: var(--mf-font-sans);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--mf-accent-text);
  margin: 0 0 12px 0;
}

div#login .pfa-login-title {
  font-family: var(--mf-font-display);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.25;
  color: var(--mf-text);
  margin: 0;
}

div#login .pfa-login-lead {
  max-width: 360px;
  margin: 10px 0 0 0;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--mf-text-body);
}

div#login .well {
  background-color: var(--mf-surface);
  border: 1px solid var(--mf-border);
  border-radius: 16px !important;
  padding: 28px;
  margin-bottom: 0;
  box-shadow: var(--mf-auth-card-shadow);
}

div#login label {
  color: var(--mf-text-body);
  font-size: 12.5px;
  font-weight: 600;
  margin-bottom: 6px;
}

div#login .form-control,
div#login select,
div#login select.flat {
  display: block;
  width: 100%;
  background-color: var(--mf-auth-input);
  border: 1px solid var(--mf-border);
  border-radius: 12px !important;
  color: var(--mf-text);
  height: 44px;
  padding: 9px 14px;
  font-family: var(--mf-font-sans);
  font-size: 13.5px;
  box-shadow: none !important;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

div#login .form-control:focus,
div#login select:focus,
div#login select.flat:focus {
  border-color: var(--mf-accent) !important;
  box-shadow: 0 0 0 2px rgba(245, 71, 31, 0.22) !important;
  outline: none;
}

div#login select option {
  background-color: var(--mf-surface);
  color: var(--mf-text);
}

[data-theme="carbono"] select option {
  background-color: #161616;
  color: #fcf9e0;
}

div#login .btn-primary.btn-lg {
  width: 100%;
  min-height: 46px;
  font-size: 14px;
  border-radius: 12px !important;
  margin-top: 6px;
}

div#login .reset-button {
  width: 100%;
  margin-left: 0;
}

div#login .reset-button .btn-default {
  width: 100%;
  background-color: var(--mf-btn-sec-bg) !important;
  border-color: var(--mf-border) !important;
  color: var(--mf-text-body) !important;
}

div#login .pfa-login-alt {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--mf-border);
  text-align: center;
  font-size: 13px;
}

/* Link on a light card: dark text, underline in the accent (AA without darkening the accent) */
div#login .pfa-login-alt a {
  color: var(--mf-text);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: var(--mf-accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

div#login .pfa-login-alt a:hover,
div#login .pfa-login-alt a:focus {
  color: var(--mf-text);
  text-decoration-thickness: 3px;
}

[data-theme="carbono"] div#login .pfa-login-alt a {
  color: var(--mf-accent-text);
  text-decoration: none;
}

[data-theme="carbono"] div#login .pfa-login-alt a:hover,
[data-theme="carbono"] div#login .pfa-login-alt a:focus {
  color: #fcf9e0;
  text-decoration: underline;
}

@media (max-width: 480px) {
  div#login .well {
    padding: 22px 18px;
  }

  div#login .pfa-login-title {
    font-size: 21px;
  }
}

/* ----------------------------------------------------------------------------
 * 16. Minimalist Full-bleed Footer (synced with Creme & Carbono)
 * ---------------------------------------------------------------------------- */
.footer {
  position: static;
  flex-shrink: 0;
  width: 100%;
  background-color: var(--mf-header);
  border-top: 1px solid var(--mf-border);
  color: var(--mf-text-muted);
  height: auto;
  line-height: 1.4;
  padding: 12px 24px;
  z-index: 1;
}

.pfa-footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
}

.pfa-footer-brand {
  display: inline-flex;
  align-items: center;
}

.pfa-footer-brand img {
  height: 22px;
  width: auto;
  display: block;
}

.pfa-footer-meta {
  font-size: 12px;
  color: var(--mf-text-body);
}

.pfa-footer-meta a {
  color: var(--mf-text);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: var(--mf-accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

.pfa-footer-meta a:hover,
.pfa-footer-meta a:focus {
  text-decoration-thickness: 3px;
}

[data-theme="carbono"] .pfa-footer-meta a {
  color: var(--mf-accent-text);
  text-decoration: none;
}

[data-theme="carbono"] .pfa-footer-meta a:hover,
[data-theme="carbono"] .pfa-footer-meta a:focus {
  color: var(--mf-text);
  text-decoration: underline;
}

.pfa-footer-sep {
  margin: 0 8px;
  opacity: 0.45;
}

/* ----------------------------------------------------------------------------
 * 17. Client-facing UI (25/11/2026): tab filters, table cards, forwarding
 *     column and admin domain badges
 * ---------------------------------------------------------------------------- */

/* Active tab: dark text with an accent bar (AA without darkening the accent) */
.mf-tab-active {
  color: var(--mf-text);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08), inset 0 -2px 0 var(--mf-accent);
}

[data-theme="carbono"] .mf-tab-active {
  color: var(--mf-text);
}

.mf-tab,
.mf-tab-active {
  gap: 8px;
  min-height: 36px;
}

.mf-tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  background-color: var(--mf-border-subtle);
  color: var(--mf-text-body);
}

.mf-tab-active .mf-tab-count {
  background-color: var(--mf-accent-soft);
  color: var(--mf-text);
}

[data-theme="carbono"] .mf-tab-count {
  background-color: #252525;
}

/* Filter bar: tabs on the left, domain + search on the right */
.mf-filter-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.mf-filter-controls form {
  margin: 0;
}

.mf-filter-domain .form-control,
.mf-filter-search .form-control {
  height: 36px;
  border-radius: 10px !important;
  background-color: var(--mf-surface);
  border: 1px solid var(--mf-border);
  color: var(--mf-text);
  font-size: 13px;
  box-shadow: none;
}

.mf-filter-domain .form-control {
  min-width: 200px;
  padding: 6px 12px;
}

.mf-filter-search {
  position: relative;
}

.mf-filter-search .form-control {
  width: 260px;
  padding: 6px 12px 6px 34px;
}

.mf-filter-search-icon {
  position: absolute;
  top: 50%;
  left: 11px;
  width: 16px;
  height: 16px;
  margin-top: -8px;
  fill: none;
  stroke: var(--mf-text-muted);
  stroke-width: 2;
  stroke-linecap: round;
  pointer-events: none;
}

.mf-filter-domain .form-control:focus,
.mf-filter-search .form-control:focus {
  border-color: var(--mf-accent);
  box-shadow: 0 0 0 2px rgba(245, 71, 31, 0.2);
  outline: none;
}

[data-theme="carbono"] .mf-filter-domain .form-control,
[data-theme="carbono"] .mf-filter-search .form-control {
  background-color: #141414;
}

@media (max-width: 767px) {
  .mf-filter-controls,
  .mf-filter-controls form,
  .mf-filter-domain .form-control,
  .mf-filter-search .form-control {
    width: 100%;
  }
}

/* Table card: title, count and actions in the card header */
.mf-table-card-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--mf-border-subtle);
  background-color: var(--mf-surface);
}

.mf-table-card-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-family: var(--mf-font-display);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--mf-text);
}

.mf-table-card-nav {
  padding: 10px 20px;
  border-bottom: 1px solid var(--mf-border-subtle);
}

.mf-table-card-nav:last-child {
  border-top: 1px solid var(--mf-border-subtle);
  border-bottom: 0;
}

.mf-table-empty {
  padding: 24px !important;
  color: var(--mf-text-muted);
}

/* Forwarding column of the e-mail table */
.list-col-forward {
  min-width: 220px;
}

.mf-forward-none {
  color: var(--mf-text-body);
}

.mf-forward-mode {
  display: block;
  margin-bottom: 2px;
  font-size: 12px;
  font-weight: 600;
  color: var(--mf-text-body);
}

.mf-forward-mode--only {
  color: var(--mf-text);
}

.mf-forward-dest {
  display: block;
  color: var(--mf-text);
  word-break: break-all;
}

/* Domain list: room for the longer quota / message-size headers
   (100px, not 120px, since the "send only" column: the table still fits the card down to 1264px) */
body.page-list-domain th.list-col-maxquota,
body.page-list-domain th.list-col-max_domain_msg_mailsize {
  min-width: 100px;
}

/* Admin list: managed domains as badges */
.mf-domain-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  max-width: 520px;
}

.mf-badge-super {
  display: inline-flex;
  align-items: center;
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  background-color: var(--mf-accent-soft);
  border: 1px solid var(--mf-accent-border);
  color: var(--mf-text);
}

/* Card title count: dark number (the orange badge text was 3.6:1) */
.mf-table-card-title .mf-badge {
  background-color: var(--mf-accent-soft);
  color: var(--mf-text);
}

/* "Esqueci minha senha": link under "Entrar", 44 px target */
div#login .pfa-login-forgot {
  margin-top: 6px;
  text-align: center;
}

div#login .pfa-login-forgot a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--mf-text);
  text-decoration: underline;
  text-decoration-color: var(--mf-accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

div#login .pfa-login-forgot a:hover,
div#login .pfa-login-forgot a:focus {
  text-decoration-thickness: 3px;
}

/* Phones: 44 px targets in the filter bar, tabs on one scrollable line, one gutter (16 px) */
@media (max-width: 767px) {
  .mf-page-header,
  .mf-tab-strip {
    padding-left: 16px;
    padding-right: 16px;
  }

  .mf-filter-bar .mf-tabs {
    flex-wrap: nowrap;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .mf-filter-bar .mf-tabs::-webkit-scrollbar {
    display: none;
  }

  .mf-filter-bar .mf-tab,
  .mf-filter-bar .mf-tab-active,
  .mf-filter-domain .form-control,
  .mf-filter-search .form-control {
    min-height: 44px;
    height: 44px;
  }

  .mf-topbar .container-fluid {
    padding-left: 16px;
    padding-right: 16px;
  }

  .mf-topbar .container-fluid > .navbar-header,
  .mf-topbar .container-fluid > .navbar-collapse {
    margin-left: 0;
    margin-right: 0;
  }
}

/* ----------------------------------------------------------------------------
 * 18. Brand typography: Comfortaa (300-700, never 800) only in titles.
 *     Everything else (text, subtitles, labels, badges, links, buttons, tabs,
 *     menu, table headers, inputs) uses Geomanist through --mf-font-sans.
 *     Both are served from public/fonts (section 1), no external requests;
 *     the Geomanist files are copied to the server, not kept in git.
 * ---------------------------------------------------------------------------- */
:root {
  --mf-font-display: "Comfortaa", "Geomanist", "Inter", ui-sans-serif, system-ui, -apple-system, sans-serif;
}

h1, h2, h3, h4, h5, h6,
.mf-page-title,
.mf-section-heading,
.mf-table-card-title,
.panel-title,
.modal-title {
  font-family: var(--mf-font-display);
}

/* Badges and counters are text, even inside a title */
.mf-badge,
.mf-badge-solid,
.mf-badge-super,
.mf-tab-count {
  font-family: var(--mf-font-sans);
}

/* Comfortaa tops out at 700 */
.mf-page-title {
  font-weight: 700;
  letter-spacing: -0.01em;
}

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