:root {
    --pl-bg: #f6f7fb;
    --pl-surface: #ffffff;
    --pl-surface-2: rgba(255, 255, 255, 0.85);

    --pl-text: #111827;
    --pl-muted: #6b7280;

    --pl-border: rgba(17, 24, 39, 0.10);

    --pl-accent: #C96A4A;
    --pl-accent-2: #b75e41;
    --pl-warning: #f4b740;

    --pl-radius-lg: 18px;
    --pl-radius-md: 14px;

    --pl-shadow: 0 10px 28px rgba(17, 24, 39, 0.10);
    --pl-shadow-soft: 0 6px 18px rgba(17, 24, 39, 0.08);

    --pl-focus: 0 0 0 4px rgba(201, 106, 74, 0.22);
}

html, body {
    height: 100%;
}

.app-body {
    min-height: 100%;
    background: var(--pl-bg);
    color: var(--pl-text);
    font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text",
    "Segoe UI", Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
}

/* container layout */
.app-container {
    max-width: 820px;
    margin: 0 auto;
    padding: 18px 18px 32px;

    display: flex;
    flex-direction: column;

    height: 100%;
    min-height: 0;
}

.app-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 2px 14px;
}

.app-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    letter-spacing: -0.02em;
    text-decoration: none;
    color: var(--pl-text);
    font-size: 18px;
}

.app-brand-logo {
    height: 26px;
    width: auto;
    display: block;
}

.app-brand-text {
    line-height: 1;
}

.app-topnav {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.app-navlink,
.app-navbutton {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 34px;
    padding: 0 12px;
    border-radius: 999px;
    text-decoration: none;
    font-size: 13px;
    color: var(--pl-text);
    background: transparent;
    border: 1px solid transparent;
}

.app-navlink:hover {
    background: rgba(17, 24, 39, 0.06);
    color: var(--pl-text);
}

.app-navbutton {
    background: rgba(17, 24, 39, 0.06);
    border: 1px solid rgba(17, 24, 39, 0.08);
}

.app-navbutton:hover {
    background: rgba(17, 24, 39, 0.10);
}

.app-main {
    padding-top: 6px;
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

/* Card */
.card, .app-card {
    border: 1px solid var(--pl-border) !important;
    border-radius: var(--pl-radius-lg) !important;
    box-shadow: var(--pl-shadow-soft) !important;
    background: var(--pl-surface) !important;
}

.card-body {
    padding: 22px !important;
}

/* Typography */
h1, h2, h3 {
    letter-spacing: -0.02em;
}

.text-muted {
    color: var(--pl-muted) !important;
}

/* Buttons */
.btn {
    border-radius: 12px !important;
    font-weight: 600 !important;
}

.btn-primary, .btn-success {
    background: var(--pl-accent) !important;
    border-color: var(--pl-accent) !important;
    color: #fff !important;
}

.btn-primary:hover, .btn-success:hover {
    background: var(--pl-accent-2) !important;
    border-color: var(--pl-accent-2) !important;
}

.btn-warning {
    background: var(--pl-warning) !important;
    border-color: var(--pl-warning) !important;
    color: #1f2937 !important;
}

.btn-secondary {
    background: rgba(17, 24, 39, 0.08) !important;
    border-color: rgba(17, 24, 39, 0.10) !important;
    color: var(--pl-text) !important;
}

.btn-secondary:hover {
    background: rgba(17, 24, 39, 0.12) !important;
}

/* Focus ring */
.btn:focus,
.btn:focus-visible,
.form-control:focus,
.form-select:focus,
.nav-link:focus,
.nav-link:focus-visible,
.app-navlink:focus,
.app-navbutton:focus {
    box-shadow: var(--pl-focus) !important;
    outline: none !important;
}

/* Inputs */
.form-control, .form-select {
    border-radius: 12px !important;
    border: 1px solid rgba(17, 24, 39, 0.12) !important;
    background-color: var(--pl-surface) !important;
}

.form-text {
    color: var(--pl-muted) !important;
}

/* Alerts */
.alert {
    border-radius: var(--pl-radius-md) !important;
    border: 1px solid rgba(17, 24, 39, 0.10) !important;
    box-shadow: none !important;
}

.alert-success {
    background: rgba(201, 106, 74, 0.12) !important;
    border-color: rgba(201, 106, 74, 0.22) !important;
    color: var(--pl-text) !important;
}

.alert-info {
    background: rgba(59, 130, 246, 0.10) !important;
    border-color: rgba(59, 130, 246, 0.20) !important;
    color: var(--pl-text) !important;
}

/* Tabs */
.nav-tabs {
    border-bottom: 0 !important;
    gap: 8px;
}

.nav-tabs .nav-link {
    border: 0 !important;
    border-radius: 999px !important;
    padding: 8px 12px !important;
    background: rgba(17, 24, 39, 0.06);
    color: var(--pl-text);
    font-weight: 600;
    font-size: 13px;
}

.nav-tabs .nav-link.active {
    background: rgba(201, 106, 74, 0.14) !important;
    color: var(--pl-text) !important;
}

/* List */
.list-group-item {
    border: 1px solid rgba(17, 24, 39, 0.08) !important;
    border-radius: 14px !important;
    margin-bottom: 10px;
    box-shadow: none !important;
}

/* Dropdown */
.app-dropdown {
    border-radius: 14px;
    border: 1px solid rgba(17, 24, 39, 0.10);
    box-shadow: var(--pl-shadow-soft);
    padding: 8px;
}

.app-dropdown .dropdown-item {
    border-radius: 10px;
    padding: 10px 10px;
    font-weight: 600;
}

.app-dropdown .dropdown-item:hover {
    background: rgba(17, 24, 39, 0.06);
}

/* Gear button */
.app-iconbtn {
    appearance: none;
    -webkit-appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 36px;
    width: 36px;
    border-radius: 999px;
    border: 0 !important;
    background: rgba(17, 24, 39, 0.06);
    color: rgba(17, 24, 39, 0.82);
    padding: 0;
    margin: 0;
    line-height: 1;
    box-shadow: none;
}

.app-iconbtn:hover {
    background: rgba(17, 24, 39, 0.10);
}

.app-iconbtn:focus, .app-iconbtn:focus-visible {
    box-shadow: var(--pl-focus) !important;
    outline: none !important;
}

.app-iconbtn::after, .app-iconbtn.dropdown-toggle::after {
    display: none !important;
    content: none !important;
}

.app-iconbtn svg {
    display: block;
    width: 18px;
    height: 18px;
}

.app-iconbtn svg path {
    stroke: currentColor;
}

.app-gear {
    width: 18px;
    height: 18px;
    display: block;
    shape-rendering: geometricPrecision;
}

/* OTP */
.otp-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 10px;
    max-width: 360px;
}

.otp-cell {
    width: 100%;
    height: 52px;
    text-align: center;
    font-size: 18px;
    font-weight: 700;
    border-radius: 14px;
    border: 1px solid rgba(17, 24, 39, 0.12);
    background: var(--pl-surface);
    padding: 0;
}

.otp-cell:focus {
    box-shadow: var(--pl-focus) !important;
    outline: none !important;
}

.btn:active,
.btn.active {
    transform: translateY(0.5px);
}

/* Reserve space for server + JS flash messages so layout doesn't jump */
.pl-messages-slot {
    min-height: 80px; /* enough for one alert line */
    margin-bottom: 6px;
}

/* Home footer (used only on public home template) */
.pl-home-footer {
    margin-top: 14px;
    padding-top: 10px;
    padding-bottom: 6px;
}

.pl-home-footer-inner {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--pl-muted);
}

.pl-home-footer-link {
    color: var(--pl-muted);
    text-decoration: none;
    font-weight: 600;
}

.pl-home-footer-link:hover {
    text-decoration: underline;
}

.pl-home-footer-sep {
    opacity: 0.7;
}

/* Layout: keep footer at bottom when page content is short */
.app-content {
    flex: 1 1 auto;
    min-height: 0;

    display: flex;
    flex-direction: column;
}

.pl-home-footer {
    margin-top: auto; /* pushes footer to bottom of .app-main */
}

/* Home public page layout: vertical cards */
.pl-home-stack {
    display: flex;
    flex-direction: column;
    gap: 14px;
    max-width: 560px;   /* визуально как на скрине: компактный центр */
    margin: 0 auto;     /* центрируем */
}

/* Optional: remove reserved top space (messages slot) on selected pages */
.app-body.pl-tight-top .pl-messages-slot {
  min-height: 0 !important;
  margin-bottom: 0 !important;
}

/* Mobile-only variant (keep desktop spacing) */
@media (max-width: 767.98px) {
  .app-body.pl-tight-top-mobile .pl-messages-slot {
    min-height: 0 !important;
    margin-bottom: 0 !important;
  }
}

/* Mobile-only: show messages slot as overlay toast (doesn't push content) */
@media (max-width: 520px) {
  .app-body.pl-toast-mobile .pl-messages-slot {
    position: fixed;
    z-index: 5000;

    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 36px);
    max-width: 820px;

    top: 68px;

    min-height: 0 !important;
    margin-bottom: 0 !important;

    pointer-events: none;
  }

  .app-body.pl-toast-mobile .pl-messages-slot > .mb-3 {
    margin-bottom: 0 !important;
  }

  .app-body.pl-toast-mobile .pl-messages-slot .alert {
    pointer-events: auto;
    box-shadow: var(--pl-shadow-soft);

    /* IMPORTANT: fully opaque */
    background: var(--pl-surface) !important;
    border-color: rgba(17, 24, 39, 0.12) !important;
    color: var(--pl-text) !important;

    margin-bottom: 8px !important;
  }

  /* Optional: subtle type accents */
  .app-body.pl-toast-mobile .pl-messages-slot .alert-success {
    border-left: 4px solid var(--pl-accent) !important;
  }
  .app-body.pl-toast-mobile .pl-messages-slot .alert-info {
    border-left: 4px solid rgba(59, 130, 246, 0.85) !important;
  }
  .app-body.pl-toast-mobile .pl-messages-slot .alert-warning {
    border-left: 4px solid var(--pl-warning) !important;
  }
  .app-body.pl-toast-mobile .pl-messages-slot .alert-danger {
    border-left: 4px solid rgba(239, 68, 68, 0.9) !important;
  }
}

/* Footer inside .app-content: push to bottom when page is short */
.app-content .app-footer {
  margin-top: auto;       /* прижимает футер к низу, если есть свободное место */
  padding-top: 14px;      /* зазор от последней карточки */
  padding-bottom: 6px;    /* чуть воздуха снизу */
}

@media (max-width: 520px) {
  .app-content .app-footer {
    padding-top: 18px;
    padding-bottom: 10px;
  }
}