/*
 * PostfixAdmin AdminLTE 4 integration
 *
 * AdminLTE supplies the application shell and Bootstrap 5 presentation layer.
 * This bridge keeps PostfixAdmin's existing Bootstrap 3-era templates and
 * JavaScript widgets functional while presenting them consistently in AdminLTE.
 */
:root {
  --pfa-primary: #f97316;
  --pfa-primary-dark: #c2410c;
  --pfa-primary-soft: #fff7ed;
  --pfa-sidebar: #111827;
  --pfa-sidebar-muted: #9ca3af;
  --pfa-bg: #f4f6f9;
  --pfa-card-border: #e5e7eb;
  --pfa-text: #1f2937;
  --pfa-muted: #6b7280;
  --pfa-radius: .65rem;
  --pfa-shadow: 0 .35rem 1.25rem rgba(15, 23, 42, .08);
  --bs-primary: #f97316;
  --bs-primary-rgb: 249, 115, 22;
  --lte-sidebar-width: 260px;
}

html,
body {
  min-height: 100%;
}

body.pfa-adminlte-page,
body.pfa-auth-page {
  color: var(--pfa-text);
  font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
}

body.pfa-adminlte-page {
  background: var(--pfa-bg);
}

body.pfa-adminlte-page a {
  color: var(--pfa-primary-dark);
}

body.pfa-adminlte-page a:hover,
body.pfa-adminlte-page a:focus {
  color: #9a3412;
}

/* AdminLTE shell */
.app-header {
  min-height: 58px;
  border-bottom: 1px solid #e5e7eb;
  background: rgba(255, 255, 255, .98) !important;
  z-index: 1045;
}

.app-header .nav-link {
  color: #374151;
}

.pfa-sidebar-toggle {
  display: inline-flex !important;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  border-radius: .5rem;
  font-size: 18px;
}

.pfa-sidebar-toggle:hover,
.pfa-sidebar-toggle:focus {
  background: var(--pfa-primary-soft);
  color: var(--pfa-primary-dark) !important;
}

.pfa-header-section {
  display: inline-flex !important;
  align-items: center;
  gap: .55rem;
  font-weight: 700;
  color: #111827 !important;
}

.pfa-header-actions {
  min-width: 0;
  gap: .45rem;
}

.pfa-header-user {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  max-width: min(340px, 38vw);
  padding: .25rem .65rem .25rem .25rem;
  border: 1px solid #e5e7eb;
  border-radius: 999px;
  background: #f9fafb;
}

.pfa-header-avatar {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  margin-right: .5rem;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--pfa-primary), var(--pfa-primary-dark));
  color: #fff;
}

.pfa-header-username {
  display: block;
  min-width: 0;
  max-width: 250px;
  color: #374151;
  font-weight: 600;
}

.pfa-header-logout {
  display: inline-flex !important;
  align-items: center;
  gap: .4rem;
  padding: .55rem .75rem !important;
  border-radius: .5rem;
  color: #4b5563 !important;
}

.pfa-header-logout:hover,
.pfa-header-logout:focus {
  background: #fef2f2;
  color: #b91c1c !important;
}

.app-sidebar {
  width: var(--lte-sidebar-width);
  background: linear-gradient(180deg, #111827 0%, #0f172a 100%) !important;
}

.sidebar-brand {
  min-height: 58px;
  border-bottom: 1px solid rgba(255, 255, 255, .10);
}

.brand-link {
  min-width: 0;
  color: #fff !important;
  text-decoration: none !important;
}

.pfa-brand-image,
.pfa-brand-fallback {
  width: 34px !important;
  height: 34px !important;
  max-height: 34px !important;
  margin-inline-start: .35rem !important;
  margin-inline-end: .7rem !important;
  object-fit: contain;
  border-radius: .55rem;
  background: #fff;
  box-shadow: 0 .2rem .7rem rgba(0, 0, 0, .24);
}

.pfa-brand-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--pfa-primary), var(--pfa-primary-dark));
  color: #fff;
}

.brand-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-wrapper {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, .25) transparent;
}

.sidebar-menu .nav-header {
  margin-top: .7rem;
  padding: .55rem 1rem .35rem;
  color: var(--pfa-sidebar-muted);
  font-size: .7rem;
  font-weight: 800;
  letter-spacing: .08em;
}

.sidebar-menu .nav-link {
  display: flex;
  align-items: center;
  min-height: 42px;
  margin: .12rem .65rem;
  padding: .62rem .75rem;
  border-radius: .5rem;
  color: #d1d5db !important;
}

.sidebar-menu .nav-link p {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: normal;
  line-height: 1.22;
}

.sidebar-menu .nav-icon {
  position: static;
  display: inline-flex !important;
  flex: 0 0 1.55rem;
  align-items: center;
  justify-content: center;
  width: 1.55rem !important;
  margin: 0 .55rem 0 0 !important;
  color: #9ca3af;
  text-align: center;
  font-size: 14px !important;
  line-height: 1 !important;
}

.sidebar-menu .nav-link:hover,
.sidebar-menu .nav-link:focus {
  background: rgba(255, 255, 255, .08);
  color: #fff !important;
}

.sidebar-menu .nav-link:hover .nav-icon,
.sidebar-menu .nav-link:focus .nav-icon {
  color: #fdba74;
}

.sidebar-menu .nav-link.active {
  background: linear-gradient(135deg, var(--pfa-primary), var(--pfa-primary-dark)) !important;
  color: #fff !important;
  box-shadow: 0 .35rem .9rem rgba(194, 65, 12, .28);
}

.sidebar-menu .nav-link.active .nav-icon {
  color: #fff;
}

.app-main {
  background:
    radial-gradient(circle at 100% 0, rgba(249, 115, 22, .08), transparent 25rem),
    var(--pfa-bg);
}

.app-content-header {
  padding-top: 1.25rem;
  padding-bottom: .9rem;
  border-bottom: 0;
}

.pfa-page-heading {
  position: relative;
  display: flex;
  min-height: 88px;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  padding: 1rem 1.15rem 1rem 1.35rem;
  overflow: hidden;
  border: 1px solid #e2e8f0;
  border-radius: .75rem;
  background: linear-gradient(135deg, #fff 0%, #fff 68%, #fff7ed 100%);
  box-shadow: 0 .3rem 1rem rgba(15, 23, 42, .07);
}

.pfa-page-heading::before {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 4px;
  background: linear-gradient(180deg, var(--pfa-primary), var(--pfa-primary-dark));
  content: "";
}

.pfa-page-heading-main {
  min-width: 0;
}

.pfa-page-kicker {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  margin-bottom: .25rem;
  color: var(--pfa-primary-dark);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.pfa-page-title {
  color: #111827;
  font-size: 1.7rem;
  font-weight: 700;
}

.pfa-breadcrumb-nav {
  flex: 0 0 auto;
}

.breadcrumb.pfa-breadcrumb {
  --bs-breadcrumb-divider: "";
  --bs-breadcrumb-divider-color: #94a3b8;
  --bs-breadcrumb-item-active-color: #475569;
  display: inline-flex;
  align-items: center;
  margin: 0;
  padding: .28rem;
  border: 1px solid #e2e8f0;
  border-radius: .65rem;
  background: rgba(248, 250, 252, .92);
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, .03);
}

.pfa-breadcrumb .breadcrumb-item {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}

.pfa-breadcrumb .breadcrumb-item + .breadcrumb-item::before {
  padding: 0 .45rem;
  color: #94a3b8;
  content: "›";
  font-size: 1.05rem;
  line-height: 1;
}

.pfa-breadcrumb-home,
.pfa-breadcrumb-current {
  display: inline-flex;
  align-items: center;
  gap: .38rem;
  padding: .38rem .62rem;
  border-radius: .42rem;
  font-weight: 700;
  line-height: 1.2;
}

.pfa-breadcrumb-home {
  color: #475569 !important;
  text-decoration: none;
  transition: background-color .15s ease, color .15s ease;
}

.pfa-breadcrumb-home:hover,
.pfa-breadcrumb-home:focus {
  background: var(--pfa-primary-soft);
  color: var(--pfa-primary-dark) !important;
}

.pfa-breadcrumb-current {
  background: #fff;
  color: #475569;
  box-shadow: 0 1px 3px rgba(15, 23, 42, .08);
}

.pfa-content-container {
  padding-bottom: 1.5rem;
}

.pfa-app-footer {
  border-top: 1px solid #e5e7eb;
  background: #fff;
  color: #6b7280;
}

/* Cards and legacy panels */
.card,
.panel,
.well,
#edit_form,
#spam_form,
#spam_score_form,
#main_menu {
  margin-bottom: 1.25rem;
  border: 1px solid var(--pfa-card-border) !important;
  border-radius: var(--pfa-radius) !important;
  background: #fff !important;
  box-shadow: var(--pfa-shadow) !important;
  overflow: hidden;
}

.panel {
  position: relative;
}

.card-header,
.panel-heading {
  padding: 1rem 1.25rem !important;
  border: 0 !important;
  border-bottom: 1px solid var(--pfa-card-border) !important;
  border-radius: 0 !important;
  background: #fff !important;
  color: #111827 !important;
}

.card-header h1,
.card-header h2,
.card-header h3,
.card-header h4,
.panel-heading h1,
.panel-heading h2,
.panel-heading h3,
.panel-heading h4 {
  margin: 0;
  color: #111827;
  font-weight: 700;
}

.card-body,
.panel-body,
.content-wrapper,
.well {
  padding: 1.25rem !important;
}

.panel-footer,
.card-footer {
  padding: .9rem 1.25rem !important;
  border: 0 !important;
  border-top: 1px solid var(--pfa-card-border) !important;
  background: #f9fafb !important;
}

.card-outline.card-primary,
.panel-primary {
  border-top: 3px solid var(--pfa-primary) !important;
}

.pfa-card-subtitle {
  margin: .3rem 0 0;
  color: var(--pfa-muted);
}

/* Dashboard */
.pfa-dashboard-intro {
  position: relative;
  overflow: hidden;
  border-top: 3px solid var(--pfa-primary) !important;
}

.pfa-dashboard-intro::after {
  content: "";
  position: absolute;
  right: -55px;
  top: -70px;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: rgba(249, 115, 22, .08);
  pointer-events: none;
}

.pfa-dashboard-intro .card-body {
  position: relative;
  z-index: 1;
}

.pfa-quick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.pfa-quick-card {
  display: flex;
  min-height: 150px;
  flex-direction: column;
  justify-content: space-between;
  padding: 1.1rem;
  border: 1px solid var(--pfa-card-border);
  border-radius: var(--pfa-radius);
  background: #fff;
  box-shadow: 0 .2rem .8rem rgba(15, 23, 42, .06);
  color: var(--pfa-text) !important;
  text-decoration: none !important;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}

.pfa-quick-card:hover,
.pfa-quick-card:focus {
  transform: translateY(-2px);
  border-color: #fed7aa;
  box-shadow: 0 .6rem 1.2rem rgba(15, 23, 42, .10);
}

.pfa-quick-icon {
  width: 46px;
  height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: .65rem;
  background: var(--pfa-primary-soft);
  color: var(--pfa-primary-dark);
  font-size: 20px;
}

.pfa-quick-card h3 {
  margin: .85rem 0 .3rem;
  color: #111827;
  font-size: 1.05rem;
  font-weight: 700;
}

.pfa-quick-card p {
  margin: 0;
  color: var(--pfa-muted);
  line-height: 1.45;
}

.pfa-quick-link {
  margin-top: .85rem;
  color: var(--pfa-primary-dark);
  font-weight: 700;
}

/* Forms */
label,
.control-label {
  color: #374151;
  font-weight: 600;
}

.form-control,
select.form-control,
textarea.form-control,
input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"] {
  min-height: 38px;
  border: 1px solid #d1d5db;
  border-radius: .45rem;
  background-color: #fff;
  color: #111827;
  box-shadow: none;
}

textarea.form-control {
  min-height: 110px;
}

.form-control:focus,
select.form-control:focus,
textarea.form-control:focus,
input[type="text"]:focus,
input[type="password"]:focus,
input[type="email"]:focus,
input[type="number"]:focus {
  border-color: #fb923c;
  outline: 0;
  box-shadow: 0 0 0 .2rem rgba(249, 115, 22, .16);
}

.form-horizontal .form-group {
  margin-right: 0;
  margin-left: 0;
  padding: .15rem 0 .9rem;
  border-bottom: 1px solid #f1f5f9;
}

.form-horizontal .form-group:last-child {
  border-bottom: 0;
}

.help-block,
.form-text {
  margin-top: .35rem;
  color: #6b7280;
  font-size: .86rem;
}

.has-error .form-control {
  border-color: #dc2626;
}

.has-error .help-block,
.has-error .control-label {
  color: #b91c1c;
}

.checkbox label,
.radio label {
  font-weight: 500;
}

.input-group-addon {
  border-color: #d1d5db;
  background: #f9fafb;
  color: #4b5563;
}

#domainsList {
  margin: 0;
  padding: .75rem;
  list-style: none;
  border: 1px solid #d1d5db;
  border-radius: .45rem;
  background: #f9fafb;
}

#domainsList li {
  padding: .25rem .35rem;
  border-radius: .3rem;
}

#domainsList li:hover {
  background: #fff7ed;
}

/* Buttons */
.btn {
  min-height: 38px;
  padding: .5rem .85rem;
  border-radius: .45rem;
  font-size: .94rem;
  font-weight: 600;
  line-height: 1.25;
  vertical-align: middle;
  box-shadow: none !important;
}

.btn-lg {
  min-height: 46px;
  padding: .65rem 1.1rem;
  font-size: 1rem;
}

.btn-primary,
.btn-primary:focus {
  border-color: var(--pfa-primary) !important;
  background: var(--pfa-primary) !important;
  color: #fff !important;
}

.btn-primary:hover,
.btn-primary:active,
.btn-primary.active {
  border-color: var(--pfa-primary-dark) !important;
  background: var(--pfa-primary-dark) !important;
  color: #fff !important;
}

.btn-default,
.btn-secondary {
  border-color: #d1d5db !important;
  background: #fff !important;
  color: #374151 !important;
}

.btn-default:hover,
.btn-secondary:hover {
  border-color: #9ca3af !important;
  background: #f9fafb !important;
  color: #111827 !important;
}

.btn-warning {
  border-color: #f59e0b !important;
  background: #f59e0b !important;
  color: #111827 !important;
}

.btn-danger {
  color: #fff !important;
}

.btn-block {
  display: block;
  width: 100%;
}

.btn-toolbar,
.pfa-table-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: .5rem;
}

.btn-toolbar .btn-group,
.pfa-table-actions .btn {
  margin: 0 !important;
}

/* Tables */
.table-responsive,
.pfa-table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table {
  width: 100%;
  margin-bottom: 0;
  color: #374151;
  vertical-align: middle;
}

.table > thead > tr > th,
.table > tbody > tr > th,
.table > tfoot > tr > th,
.table > thead > tr > td,
.table > tbody > tr > td,
.table > tfoot > tr > td {
  padding: .75rem .8rem;
  border-top: 1px solid #e5e7eb;
  vertical-align: middle;
}

.table > thead > tr > th {
  border-bottom: 1px solid #d1d5db;
  background: #f8fafc;
  color: #4b5563;
  font-size: .76rem;
  font-weight: 800;
  letter-spacing: .035em;
  text-transform: uppercase;
  white-space: nowrap;
}

.table-hover > tbody > tr:hover > * {
  background: #fffaf5;
}

.table .btn {
  margin: .12rem;
  padding: .45rem .68rem;
  font-size: .92rem;
  line-height: 1.25;
  white-space: nowrap;
}

.table .btn .glyphicon {
  font-size: .9em;
}

#admin_table,
#mailbox_table,
#alias_table,
#alias_domain_table,
#log_table,
#spam_table {
  min-width: 720px;
}

.pfa-list-card .panel-heading,
.pfa-list-card .card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
}

.pfa-table-footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .75rem;
}

.pfa-table-nav {
  color: #6b7280;
}

.pfa-table-nav a,
.pfa-table-nav span {
  display: inline-block;
  margin: .1rem;
  padding: .35rem .55rem;
  border: 1px solid #e5e7eb;
  border-radius: .35rem;
  background: #fff;
}

.pfa-table-nav span.active,
.pfa-table-nav a.active {
  border-color: var(--pfa-primary);
  background: var(--pfa-primary);
  color: #fff;
}

/* Search and filters */
.pfa-search-form {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--pfa-card-border);
  background: #f9fafb;
}

.pfa-domain-form,
.pfa-search-form {
  margin: 0;
}

.pfa-domain-form {
  width: 100%;
  max-width: 360px;
}

.pfa-select-control,
.pfa-search-control {
  position: relative;
  width: 100%;
}

.pfa-search-control {
  max-width: 430px;
}

.pfa-domain-select,
.pfa-search-input {
  width: 100% !important;
}

.pfa-domain-select {
  min-height: 42px;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding: .6rem 2.65rem .6rem .8rem !important;
  cursor: pointer;
  font-size: .95rem !important;
  font-weight: 500;
  line-height: 1.35;
}

.pfa-domain-select option {
  font-size: .95rem;
}

.pfa-select-icon,
.pfa-search-icon {
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: auto;
  margin: 0;
  transform: none;
  pointer-events: none;
  color: #9ca3af;
  line-height: 1;
}

.pfa-select-icon {
  right: .75rem;
}

.pfa-search-icon {
  left: .7rem;
}

.pfa-search-input {
  min-height: 42px;
  padding-left: 2.35rem !important;
  font-size: .95rem !important;
}

.pfa-search-wrapper,
.pfa-search-wrapper .pfa-search-form,
.pfa-search-wrapper .pfa-search-control {
  width: 100%;
  max-width: none;
}

.pfa-overview-controls {
  align-items: center;
}

.pfa-overview-controls > [class*="col-"] {
  display: flex;
  align-items: center;
}

.pfa-overview-controls .pfa-search-form {
  padding: 0;
  border: 0;
  background: transparent;
}

.searchparams {
  padding: .75rem 1.25rem;
  border-bottom: 1px solid #e5e7eb;
  background: #fff7ed;
}

.searchparams p {
  margin: 0;
}

.searchparams span {
  display: inline-block;
  margin: .15rem .25rem .15rem 0;
  padding: .25rem .45rem;
  border-radius: .35rem;
  background: #ffedd5;
}

/* Virtual list tabs and status */
.pfa-overview-toolbar,
.pfa-overview-tabs,
.pfa-status-legend {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .5rem;
}

.pfa-overview-tabs a,
.pfa-overview-tabs span.active {
  display: inline-flex;
  align-items: center;
  padding: .45rem .7rem;
  border-radius: .4rem;
  text-decoration: none;
}

.pfa-overview-tabs span.active {
  background: var(--pfa-primary);
  color: #fff;
}

.pfa-status-legend {
  margin-bottom: 1.25rem;
  padding: .9rem 1rem;
  border: 1px solid #e5e7eb;
  border-radius: .55rem;
  background: #fff;
}

.pfa-status-item {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
}

.pfa-status-swatch {
  min-width: 18px;
  min-height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: .2rem;
}

/* Alerts and empty states */
.alert {
  border: 0;
  border-radius: .55rem;
  box-shadow: 0 .2rem .7rem rgba(15, 23, 42, .06);
}

.alert-info {
  background: #e0f2fe;
  color: #075985;
}

.alert-success,
.message.bg-success {
  background: #dcfce7 !important;
  color: #166534 !important;
}

.alert-danger,
.message.bg-danger {
  background: #fee2e2 !important;
  color: #991b1b !important;
}

.message {
  margin-bottom: 1rem;
  padding: .75rem 1rem;
  border-radius: .45rem;
}

.message p {
  margin: 0;
}

.pfa-empty-state {
  padding: 2.5rem 1.25rem !important;
  text-align: center;
}

/* Login and password recovery */
body.pfa-auth-page {
  display: flex;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background:
    radial-gradient(circle at 12% 10%, rgba(249, 115, 22, .22), transparent 28rem),
    linear-gradient(135deg, #111827 0%, #1f2937 54%, #7c2d12 100%) !important;
}

.pfa-auth-shell {
  width: 100%;
}

.pfa-login-box {
  width: min(430px, 100%);
  margin: 0 auto;
}

.pfa-login-logo {
  margin-bottom: 1rem;
}

.pfa-login-logo a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .75rem;
  color: #fff;
  font-size: 1.45rem;
  font-weight: 700;
  text-decoration: none;
}

.pfa-login-brand-image {
  width: 45px;
  height: 45px;
  object-fit: contain;
  border-radius: .65rem;
  background: #fff;
  box-shadow: 0 .4rem 1rem rgba(0, 0, 0, .22);
}

.pfa-auth-card {
  border: 0 !important;
  box-shadow: 0 1rem 2.5rem rgba(0, 0, 0, .25) !important;
}

.pfa-auth-card .card-header {
  padding: 1.5rem 1.5rem .65rem !important;
  text-align: center;
}

.pfa-auth-card .card-body {
  padding: 1rem 1.5rem 1.5rem !important;
}

.pfa-auth-title {
  font-size: 1.35rem;
}

.pfa-auth-subtitle {
  margin: .45rem 0 0;
  color: #6b7280;
}

.pfa-auth-divider {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin: 1.1rem 0;
  color: #9ca3af;
}

.pfa-auth-divider::before,
.pfa-auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: #e5e7eb;
}

.pfa-auth-footer {
  margin-top: 1rem;
  color: rgba(255, 255, 255, .72) !important;
}

/* Bootstrap 3 compatibility details */
.pull-right {
  float: right !important;
}

.pull-left {
  float: left !important;
}

.clearfix::before,
.clearfix::after {
  display: table;
  content: " ";
}

.clearfix::after {
  clear: both;
}

.glyphicon {
  top: 0;
}

.dropdown-menu {
  padding: .45rem;
  border: 1px solid #e5e7eb;
  border-radius: .55rem;
  box-shadow: var(--pfa-shadow);
}

.dropdown-menu > li > a {
  display: block;
  padding: .5rem .7rem;
  border-radius: .35rem;
  color: #374151;
}

.dropdown-menu > li > a:hover,
.dropdown-menu > li > a:focus {
  background: var(--pfa-primary-soft);
  color: var(--pfa-primary-dark);
}

.modal-content {
  border: 1px solid #e5e7eb;
  border-radius: .65rem;
  box-shadow: 0 1rem 2.5rem rgba(15, 23, 42, .20);
}

.datetimepicker {
  z-index: 1060 !important;
}

/* Quota bars retained from PostfixAdmin */
.quota_bg {
  border-radius: .25rem;
  overflow: hidden;
}

/* Spam editor */
#spam_form .pfa-spam-rule-row,
#spam_score_form .pfa-spam-score-controls {
  display: flex;
  align-items: stretch;
  flex-wrap: nowrap;
  gap: .75rem;
  margin: 0;
}

#spam_form .pfa-spam-rule-row .type {
  flex: 0 0 190px;
}

#spam_form .pfa-spam-rule-row .email {
  flex: 1 1 320px;
  width: auto !important;
  min-width: 0;
}

#spam_form .pfa-spam-rule-row .buttons {
  display: flex;
  flex: 0 0 auto;
  align-items: stretch;
  gap: .5rem;
}

#spam_form .pfa-spam-rule-row .buttons .btn {
  min-width: 100px;
}

#spam_form .pfa-spam-rule-row .form-control,
#spam_form .pfa-spam-rule-row .btn,
#spam_score_form .pfa-spam-score-controls .form-control,
#spam_score_form .pfa-spam-score-controls .btn {
  height: 42px;
  min-height: 42px;
  margin: 0;
  font-size: .95rem;
  line-height: 1.25;
  box-sizing: border-box;
}

#spam_form .pfa-spam-rule-row select.form-control {
  width: 100%;
  padding-right: 2rem;
}

#spam_score_form .pfa-spam-score-form,
#spam_score_form .pfa-spam-score-reset-form {
  display: inline-block;
  margin: 0 .5rem 0 0;
  vertical-align: top;
}

#spam_score_form .pfa-spam-score-input {
  flex: 0 0 170px;
  width: 170px;
}

#spam_score_form .pfa-spam-score-controls .btn {
  min-width: 120px;
}

/* Responsive behaviour */
@media (max-width: 991.98px) {
  .pfa-page-title {
    font-size: 1.45rem;
  }

  .app-content-header {
    padding-top: 1rem;
  }
}

@media (max-width: 767.98px) {
  body.pfa-adminlte-page {
    font-size: 13px;
  }

  .app-header {
    min-height: 54px;
  }

  .pfa-header-user {
    max-width: 44vw;
  }

  .pfa-header-username {
    max-width: 30vw;
  }

  .pfa-page-heading {
    min-height: 0;
    align-items: flex-start;
    flex-direction: column;
    gap: .8rem;
    padding: 1rem 1rem 1rem 1.2rem;
  }

  .pfa-breadcrumb-nav,
  .breadcrumb.pfa-breadcrumb {
    width: 100%;
  }

  .breadcrumb.pfa-breadcrumb {
    justify-content: flex-start;
  }

  .card-body,
  .panel-body,
  .content-wrapper,
  .well {
    padding: 1rem !important;
  }

  .card-header,
  .panel-heading,
  .panel-footer,
  .card-footer {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }

  .form-horizontal .control-label {
    margin-bottom: .4rem;
    text-align: left !important;
  }

  .pfa-table-footer-inner,
  .btn-toolbar,
  .pfa-table-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .pfa-table-actions .btn,
  .btn-toolbar .btn,
  .btn-toolbar .btn-group {
    width: 100%;
  }

  #spam_form .pfa-spam-rule-row,
  #spam_score_form .pfa-spam-score-controls {
    align-items: stretch;
    flex-direction: column;
  }

  #spam_form .pfa-spam-rule-row .type,
  #spam_form .pfa-spam-rule-row .email,
  #spam_form .pfa-spam-rule-row .buttons,
  #spam_score_form .pfa-spam-score-input {
    display: flex;
    flex: 1 1 auto;
    width: 100% !important;
  }

  #spam_form .pfa-spam-rule-row .buttons {
    flex-direction: column;
  }

  #spam_form .pfa-spam-rule-row .btn,
  #spam_score_form .pfa-spam-score-controls .btn {
    width: 100%;
  }

  #spam_score_form .pfa-spam-score-form,
  #spam_score_form .pfa-spam-score-reset-form {
    display: block;
    width: 100%;
    margin: 0 0 .75rem;
  }
}

@media (max-width: 575.98px) {
  body.pfa-auth-page {
    padding: .75rem;
  }

  .pfa-login-logo a {
    font-size: 1.2rem;
  }

  .pfa-header-actions {
    gap: .15rem;
  }

  .pfa-header-logout {
    width: 38px;
    height: 38px;
    justify-content: center;
    padding: 0 !important;
  }

  .pfa-quick-grid {
    grid-template-columns: 1fr;
  }
}

@media print {
  .app-header,
  .app-sidebar,
  .app-footer,
  .breadcrumb,
  .btn,
  .pfa-page-kicker {
    display: none !important;
  }

  .app-main {
    margin: 0 !important;
  }

  .card,
  .panel {
    border: 1px solid #bbb !important;
    box-shadow: none !important;
  }
}

/* Bootstrap 3 JavaScript state compatibility when displayed through AdminLTE/Bootstrap 5 CSS. */
.fade.in {
  opacity: 1 !important;
}

.collapse.in {
  display: block !important;
}

.dropdown.open > .dropdown-menu,
.btn-group.open > .dropdown-menu {
  display: block !important;
}

.modal.in {
  display: block;
}

.modal.fade.in .modal-dialog,
.modal.in .modal-dialog {
  transform: translate(0, 0) !important;
}

.modal-backdrop.in {
  opacity: .5 !important;
}

.tooltip.in {
  opacity: .9 !important;
}

/* Readable, consistently centred action buttons on domain/mailbox list pages.
 * Keep this scoped away from #spam_table so the spam editor retains its
 * dedicated control sizing and layout. */
#admin_table .btn,
#mailbox_table .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  min-width: 72px;
  min-height: 40px;
  padding: .5rem .8rem;
  font-size: 1rem;
  line-height: 1;
  text-align: center;
  vertical-align: middle;
}

#admin_table .btn .glyphicon,
#mailbox_table .btn .glyphicon {
  position: static;
  top: auto;
  flex: 0 0 auto;
  line-height: 1;
}

#admin_table td form,
#mailbox_table td form {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
}
