:root {
    --bg: #f5f4f9;
    --surface: #ffffff;
    --text: #1a1a2e;
    --muted: #6b6882;
    --accent: #6b21a8;
    --accent-dark: #4c1878;
    --accent-light: #ede9f8;
    --danger: #b3261e;
    --success: #1e7f3f;
    --border: #ddd6f3;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    background: radial-gradient(135deg, #ede9f8 0%, var(--bg) 50%, #eee8f6 100%);
    color: var(--text);
    min-height: 100vh;
}

.container {
    width: min(960px, 92vw);
    margin: 3rem auto;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 2rem;
    box-shadow: 0 16px 36px rgba(20, 30, 44, 0.08);
}

.wide {
    width: min(1200px, 95vw);
}

.hero h1 {
    margin-top: 0;
    line-height: 1.25;
}

.actions {
    margin-top: 1.25rem;
    display: flex;
    gap: 0.8rem;
    flex-wrap: wrap;
}

.form {
    display: grid;
    gap: 0.75rem;
}

label {
    font-weight: 600;
    margin-top: 0.4rem;
}

input,
textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.75rem 0.9rem;
    font-size: 1rem;
    color: var(--text);
    background: #fcfdff;
}

textarea {
    resize: vertical;
}

.btn {
    display: inline-block;
    border: none;
    border-radius: 10px;
    background: var(--accent);
    color: #fff;
    padding: 0.7rem 1.1rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.2s ease;
}

.btn:hover {
    background: var(--accent-dark);
}

.btn-outline {
    background: transparent;
    color: var(--accent);
    border: 1px solid var(--accent);
}

.btn-outline:hover {
    color: #fff;
}

.btn-danger {
    background: var(--danger);
    color: #fff;
    padding: 0.4rem 0.8rem;
    font-size: 0.88rem;
}

.btn-danger:hover {
    background: #8c1b15;
}

.form-panel {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.8rem 1rem;
    margin-top: 1rem;
}

.form-panel > summary {
    cursor: pointer;
    user-select: none;
    list-style: none;
    padding: 0.2rem 0;
}

.form-panel > summary::-webkit-details-marker {
    display: none;
}

.alert {
    border-radius: 10px;
    padding: 0.75rem 0.95rem;
    margin: 0.8rem 0;
    font-weight: 600;
}

.alert-error {
    background: #fdecea;
    color: var(--danger);
    border: 1px solid #f7c8c4;
}

.alert-success {
    background: #e9f8ee;
    color: var(--success);
    border: 1px solid #bde7cb;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1rem;
}

.subtle,
.small-text {
    color: var(--muted);
    font-size: 0.92rem;
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

th,
td {
    border-bottom: 1px solid var(--border);
    text-align: left;
    padding: 0.75rem;
    vertical-align: top;
}

th {
    background: #f5f2fc;
}

/* ── Policy document ── */

.container > .card + .card {
    margin-top: 1.5rem;
}

.policy-doc {
    margin-top: 1.5rem;
}

.policy-doc > h2 {
    margin-top: 0;
    font-size: 1.45rem;
    font-weight: 800;
    color: var(--accent-dark);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding-bottom: 0.6rem;
    border-bottom: 3px solid var(--accent);
    margin-bottom: 2rem;
}

.policy-doc-label {
    margin-top: 0;
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--accent-dark);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding-bottom: 0.5rem;
    border-bottom: 3px solid var(--accent);
    margin-bottom: 1.5rem;
}

.policy-quote {
    border-left: 5px solid var(--accent);
    margin: 1rem 0 1.5rem;
    padding: 0.85rem 1.3rem;
    background: var(--accent-light);
    border-radius: 0 10px 10px 0;
    font-style: italic;
    color: var(--accent-dark);
    font-size: 1.1rem;
    line-height: 1.7;
    font-weight: 500;
}

.policy-section {
    padding: 1.1rem 0;
    border-bottom: 1px solid rgba(107, 33, 168, 0.18);
    opacity: 0;
    transform: translateY(8px);
    animation: policyFadeIn 0.45s ease forwards;
}

.policy-section:nth-of-type(2) { animation-delay: 0.04s; }
.policy-section:nth-of-type(3) { animation-delay: 0.08s; }
.policy-section:nth-of-type(4) { animation-delay: 0.12s; }
.policy-section:nth-of-type(5) { animation-delay: 0.16s; }
.policy-section:nth-of-type(n+6) { animation-delay: 0.2s; }

.policy-section:first-of-type .policy-body::first-letter {
    font-size: 3.2rem;
    font-weight: 800;
    line-height: 1;
    float: left;
    margin: 0.05em 0.12em 0 0;
    color: var(--accent);
}

.policy-section:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.policy-section-title {
    margin: 0 0 0.55rem;
    font-size: 1.02rem;
    font-weight: 900;
    color: var(--accent);
    text-transform: none;
    letter-spacing: 0.01em;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.policy-section-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
    display: inline-block;
}

.policy-body {
    line-height: 1.68;
    font-size: 0.98rem;
    color: #111111;
    white-space: pre-wrap;
    margin: 0;
    text-align: justify;
    text-justify: inter-word;
    hyphens: auto;
}

.policy-quote {
    animation: quotePulseIn 0.55s ease-out both;
}

@keyframes policyFadeIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes quotePulseIn {
    from {
        opacity: 0;
        transform: scale(0.985);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@media (prefers-reduced-motion: reduce) {
    .policy-section,
    .policy-quote {
        animation: none;
        opacity: 1;
        transform: none;
    }
}

/* Outer wrapper for the top-level Read Policy details on dashboard */
details > summary {
    cursor: pointer;
    padding: 0.7rem 0.2rem;
    font-size: 0.97rem;
    list-style: none;
    user-select: none;
}

details > summary::-webkit-details-marker {
    display: none;
}

@media (max-width: 700px) {
    .card {
        padding: 1.2rem;
    }

    .topbar {
        flex-direction: column;
    }
}
