:root {
    --pp-bg: #f4f6fb;
    --pp-surface: #ffffff;
    --pp-surface-soft: #f9fafc;
    --pp-border: #e2e8f0;
    --pp-border-strong: #cbd5f5;
    --pp-text: #0f172a;
    --pp-muted: #6b7280;
    --pp-primary: #2563eb;
    --pp-radius-lg: 1.5rem;
    --pp-radius: 1rem;
    --pp-radius-sm: 0.65rem;
    --pp-shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
    --pp-shadow-soft: 0 12px 24px rgba(15, 23, 42, 0.05);
}

@media (prefers-color-scheme: dark) {
    :root {
        --pp-bg: #0b1120;
        --pp-surface: #11182c;
        --pp-surface-soft: #172340;
        --pp-border: #1f2a44;
        --pp-border-strong: #3b4870;
        --pp-text: #e2e8f0;
        --pp-muted: #94a3b8;
        --pp-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
        --pp-shadow-soft: 0 12px 24px rgba(0, 0, 0, 0.35);
    }
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Inter", "SF Pro Display", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    line-height: 1.6;
    color: var(--pp-text);
    background-color: var(--pp-bg);
    background-image: linear-gradient(135deg, rgba(37, 99, 235, 0.06), rgba(79, 70, 229, 0.03));
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--pp-primary);
    text-decoration: none;
}

a:hover {
    color: #1d4ed8;
}

img {
    max-width: 100%;
    display: block;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.app-body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

body.menu-open {
    overflow: hidden;
}

.app-shell {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.app-header {
    position: relative;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 1rem clamp(1.5rem, 4vw, 3rem);
    background: var(--pp-surface);
    box-shadow: var(--pp-shadow-soft);
    border-bottom: 1px solid var(--pp-border);
    z-index: 20;
}

.app-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.app-logo {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 600;
    color: var(--pp-text);
}

.app-logo-mark {
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 0.9rem;
    border: 1px solid var(--pp-border);
    background: var(--pp-surface-soft);
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.12);
    padding: 0.25rem;
    display: block;
    object-fit: cover;
}

.app-logo-text {
    font-size: 1.1rem;
    letter-spacing: 0.02em;
    font-weight: 700;
}

.nav-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    border-radius: var(--pp-radius-sm);
    border: 1px solid var(--pp-border);
    background: linear-gradient(135deg, var(--pp-surface-soft), var(--pp-surface));
    cursor: pointer;
    padding: 0;
    transition: background 0.2s ease, border 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 10px 20px rgba(15, 23, 42, 0.08);
}

.nav-toggle-bar {
    display: block;
    width: 22px;
    height: 2px;
    margin: 4px 0;
    background: var(--pp-text);
    border-radius: 999px;
    transition: transform 0.2s ease, opacity 0.2s ease, background 0.2s ease;
}

.nav-toggle:hover {
    border-color: var(--pp-primary);
    box-shadow: 0 14px 28px rgba(37, 99, 235, 0.15);
}

.nav-toggle.is-active {
    background: var(--pp-primary);
    border-color: var(--pp-primary);
    box-shadow: 0 18px 32px rgba(37, 99, 235, 0.25);
}

.nav-toggle.is-active .nav-toggle-bar {
    background: #fff;
}

.nav-toggle.is-active .nav-toggle-bar:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
}

.nav-toggle.is-active .nav-toggle-bar:nth-child(2) {
    opacity: 0;
}

.nav-toggle.is-active .nav-toggle-bar:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
}

.app-header-panels {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-left: auto;
}

.app-nav ul {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    gap: 1.25rem;
}

.app-nav a {
    color: var(--pp-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.08em;
}

.app-nav a:hover {
    color: var(--pp-primary);
}

.header-actions {
    min-height: 2.5rem;
    display: flex;
    align-items: center;
}

.app-main {
    flex: 1;
    display: flex;
    padding: 2rem clamp(1.5rem, 4vw, 3.5rem) 4rem;
}

.main-card {
    background: var(--pp-surface);
    border-radius: var(--pp-radius-lg);
    border: 1px solid var(--pp-border);
    box-shadow: var(--pp-shadow);
    width: min(1200px, 100%);
    margin: 0 auto;
    padding: clamp(1.5rem, 3vw, 2.75rem);
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.content-header {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--pp-border);
}

.content-header .title {
    margin: 0;
    font-size: clamp(1.6rem, 3vw, 2.3rem);
    font-weight: 700;
    color: var(--pp-text);
}

.page-actions {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    min-height: 2.5rem;
    align-items: center;
}

.page-actions--header {
    justify-content: flex-end;
}

.page-actions--inline {
    justify-content: flex-end;
}

.app-flashes {
    width: min(1200px, 100%);
    margin: 1.5rem auto 0;
    padding: 0 clamp(1.5rem, 4vw, 3.5rem);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.flash-message {
    border-radius: var(--pp-radius-sm);
    border: 1px solid var(--pp-border);
    box-shadow: var(--pp-shadow-soft);
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.flash-badge {
    font-size: 0.7rem;
    letter-spacing: 0.12em;
    font-weight: 700;
    color: var(--pp-muted);
}

.flash-text {
    font-weight: 500;
}

.content-body {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    color: var(--pp-text);
}

.content-footer {
    padding-top: 1.25rem;
    border-top: 1px solid var(--pp-border);
    color: var(--pp-muted);
    font-size: 0.95rem;
}

.btn {
    border-radius: var(--pp-radius-sm);
    font-weight: 600;
    letter-spacing: 0.02em;
    padding: 0.65rem 1.25rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 16px rgba(37, 99, 235, 0.15);
}

form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

label {
    font-weight: 600;
    color: var(--pp-text);
    font-size: 0.95rem;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="search"],
input[type="tel"],
select,
textarea {
    width: 100%;
    border-radius: var(--pp-radius-sm);
    border: 1px solid var(--pp-border-strong);
    background: var(--pp-surface-soft);
    padding: 0.85rem 1rem;
    font-family: inherit;
    font-size: 1rem;
    transition: border 0.2s ease, box-shadow 0.2s ease;
}

textarea {
    min-height: 140px;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--pp-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.form-row {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.profile-form {
    width: 100%;
}

.form-grid {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.inline-pair {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.form-field--address {
    position: relative;
}

.address-suggestions {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 0.25rem);
    background: var(--pp-surface);
    border: 1px solid var(--pp-border);
    border-radius: var(--pp-radius-sm);
    box-shadow: var(--pp-shadow-soft);
    z-index: 10;
    display: none;
    max-height: 240px;
    overflow-y: auto;
}

.address-suggestions.is-visible {
    display: block;
}

.address-suggestions__list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.address-suggestions__item {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.25);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    transition: background 0.15s ease;
}

.address-suggestions__item:last-child {
    border-bottom: none;
}

.address-suggestions__item:hover,
.address-suggestions__item.is-active {
    background: rgba(37, 99, 235, 0.08);
}

.address-suggestions__label {
    font-weight: 600;
    color: var(--pp-text);
}

.address-suggestions__context {
    font-size: 0.85rem;
    color: var(--pp-muted);
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.95rem;
}

thead {
    background: var(--pp-surface-soft);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.8rem;
}

th,
td {
    padding: 0.9rem 1rem;
    border-bottom: 1px solid var(--pp-border);
}

tbody tr:hover {
    background: rgba(37, 99, 235, 0.04);
}

.card {
    border: 1px solid var(--pp-border);
    border-radius: var(--pp-radius);
    padding: 1.5rem;
    background: var(--pp-surface);
    box-shadow: var(--pp-shadow-soft);
}

.auth-section {
    width: 100%;
    display: flex;
    justify-content: center;
}

.auth-card {
    width: min(540px, 100%);
    background: var(--pp-surface);
    border-radius: var(--pp-radius-lg);
    border: 1px solid var(--pp-border);
    box-shadow: var(--pp-shadow);
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.auth-header {
    text-align: center;
}

.auth-header h1,
.auth-header h2 {
    margin: 0;
    font-size: 2rem;
}

.auth-alert {
    border-radius: var(--pp-radius-sm);
    padding: 0.75rem 1rem;
    background: rgba(220, 38, 38, 0.1);
    color: #991b1b;
    border: 1px solid rgba(220, 38, 38, 0.3);
    font-weight: 600;
}

.auth-session {
    font-size: 0.95rem;
    color: var(--pp-muted);
}

.auth-content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    color: var(--pp-muted);
    font-size: 0.95rem;
}

.auth-field {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.auth-label {
    font-weight: 600;
    color: var(--pp-text);
}

.auth-input {
    border: 1px solid var(--pp-border);
    border-radius: var(--pp-radius);
    padding: 0.9rem 1rem;
    background: var(--pp-surface-soft);
}

.auth-input:focus {
    border-color: var(--pp-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.auth-button {
    margin-top: 0.5rem;
    border: none;
    border-radius: var(--pp-radius);
    background: var(--pp-primary);
    color: #fff;
    font-weight: 600;
    padding: 0.95rem;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.auth-button:hover {
    background: #1d4ed8;
    transform: translateY(-1px);
}

.auth-helper,
.auth-footer {
    font-size: 0.9rem;
    color: var(--pp-muted);
    text-align: center;
}

.auth-error {
    font-size: 0.85rem;
    color: #b91c1c;
    font-weight: 600;
}

.directory {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.directory-header {
    max-width: 720px;
}

.directory-intro {
    margin: 0;
    color: var(--pp-muted);
    font-size: 1rem;
}

.directory-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.25rem;
}

.directory-card {
    border: 1px solid var(--pp-border);
    border-radius: var(--pp-radius);
    padding: 1.5rem;
    background: var(--pp-surface);
    box-shadow: var(--pp-shadow-soft);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.directory-card-header {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.directory-avatar {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--pp-primary), #7c3aed);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
}

.directory-name {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--pp-text);
}

.directory-meta-line {
    margin: 0.15rem 0 0;
    font-size: 0.85rem;
    color: var(--pp-muted);
}

.directory-info {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.directory-info-item {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.directory-info-label {
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--pp-muted);
}

.directory-info-value {
    font-weight: 600;
    color: var(--pp-text);
    word-break: break-word;
}

.directory-info-value:hover {
    color: var(--pp-primary);
}

.directory-info-note {
    margin: 0;
    color: var(--pp-text);
    line-height: 1.5;
}

.directory-empty {
    border: 1px dashed var(--pp-border);
    border-radius: var(--pp-radius);
    padding: 2rem;
    text-align: center;
    color: var(--pp-muted);
}

.app-main:focus-visible,
.nav-toggle:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
.btn:focus-visible,
.auth-button:focus-visible {
    outline: 2px solid var(--pp-primary);
    outline-offset: 2px;
}

@media (max-width: 991.98px) {
    .nav-toggle {
        display: inline-flex;
    }

    .app-header {
        flex-wrap: wrap;
        padding-bottom: 0.75rem;
    }

    .app-header-panels {
        width: 100%;
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
        padding-top: 1rem;
        border-top: 1px solid var(--pp-border);
        display: none;
    }

    .app-header-panels.is-open,
    body.menu-open .app-header-panels {
        display: flex;
    }

    .app-nav ul {
        flex-direction: column;
        width: 100%;
        gap: 0.5rem;
    }

    .page-actions--header {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
    }

    .page-actions--inline {
        width: 100%;
        justify-content: flex-start;
    }
}

@media (max-width: 767.98px) {
    .main-card {
        padding: 1.5rem;
    }

    .content-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .app-main {
        padding: 1.5rem 1rem 3rem;
    }

    .app-flashes {
        padding: 0 1rem;
    }
}
