:root {
    --bg: #edf2f8;
    --bg-soft: #f7f9fc;
    --card: rgba(255, 255, 255, 0.95);
    --card-strong: #ffffff;
    --line: #d6dfeb;
    --line-soft: #e7edf5;
    --line-strong: #c8d4e4;
    --text: #152947;
    --text-soft: #5f738d;
    --text-faint: #7f90a8;
    --primary: #0f315d;
    --primary-strong: #0b2749;
    --gold: #b88d2f;
    --gold-soft: rgba(184, 141, 47, 0.12);
    --success: #157347;
    --success-soft: rgba(21, 115, 71, 0.1);
    --danger: #b42339;
    --radius-xl: 30px;
    --radius-lg: 22px;
    --radius-md: 18px;
    --radius-sm: 14px;
    --shadow: 0 24px 60px rgba(16, 37, 67, 0.08);
    --shadow-soft: 0 14px 30px rgba(16, 37, 67, 0.06);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    min-height: 100vh;
    font-family: 'Inter', system-ui, sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(15, 49, 93, 0.09), transparent 24%),
        radial-gradient(circle at bottom right, rgba(184, 141, 47, 0.08), transparent 22%),
        linear-gradient(180deg, #f6f9fc 0%, #edf2f8 100%);
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
strong { font-weight: 700; }
code {
    background: rgba(15, 49, 93, 0.06);
    border-radius: 10px;
    padding: 2px 8px;
}

.page-shell {
    width: min(100%, 980px);
    margin: 0 auto;
    padding: 22px 18px 34px;
}

.site-header,
.main-card,
.success-card {
    background: var(--card);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.72);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow);
}

.site-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    padding: 20px 22px;
    margin-bottom: 18px;
}

.brand-wrap,
.card-brand,
.success-brand {
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 0;
}

.brand-badge,
.success-brand-logo,
.meta-logo {
    border-radius: 22px;
    background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(247,250,253,0.95));
    border: 1px solid var(--line-soft);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.85);
    flex: 0 0 auto;
}

.brand-badge {
    width: 78px;
    height: 78px;
    padding: 8px;
}

.brand-logo-real img,
.meta-logo img,
.success-brand-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.brand-copy h1,
.card-brand-copy h1,
.success-copy h2,
.message-card h2 {
    margin: 0;
    line-height: 1.12;
}

.brand-copy h1,
.card-brand-copy h1 {
    font-size: clamp(1.16rem, 1.9vw, 1.72rem);
}

.eyebrow,
.section-label,
.meta-label,
.intro-note {
    margin: 0;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.eyebrow,
.section-label,
.meta-label {
    color: var(--primary);
}

.subhead,
.public-hero p,
.signature-head small,
.muted,
.card-intro-copy p,
.success-copy p,
.message-card p {
    color: var(--text-soft);
}

.subhead,
.card-intro-copy p,
.public-hero p,
.success-copy p,
.message-card p {
    margin: 6px 0 0;
    line-height: 1.72;
}

.datetime-pill,
.header-meta-chip {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    background: rgba(255,255,255,0.76);
    border: 1px solid var(--line-soft);
    border-radius: 999px;
    padding: 10px 16px;
    min-height: 50px;
}

.datetime-date,
.datetime-time,
.meta-date,
.meta-time {
    white-space: nowrap;
}

.datetime-time {
    padding-left: 12px;
    border-left: 1px solid var(--line-soft);
    color: var(--primary);
}

.flash {
    margin-bottom: 18px;
    padding: 14px 16px;
    border-radius: 16px;
    font-weight: 600;
    border: 1px solid transparent;
    box-shadow: var(--shadow-soft);
}

.flash.success {
    background: rgba(21,115,71,0.08);
    border-color: rgba(21,115,71,0.14);
    color: #16613f;
}

.flash.error {
    background: rgba(180,35,57,0.08);
    border-color: rgba(180,35,57,0.14);
    color: #8f2033;
}

.single-form-layout,
.center-wrap {
    display: block;
}

.main-card,
.success-card {
    padding: 28px;
}

.form-only-card {
    position: relative;
    overflow: hidden;
}

.form-only-card::before {
    content: '';
    position: absolute;
    inset: 0 auto auto 0;
    width: 100%;
    height: 5px;
    background: linear-gradient(90deg, var(--primary) 0%, var(--gold) 100%);
}

.premium-card {
    background:
        linear-gradient(180deg, rgba(255,255,255,0.98), rgba(251,253,255,0.94));
}

.premium-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    margin-bottom: 18px;
}

.premium-brand {
    gap: 18px;
}

.premium-brand-badge {
    width: 88px;
    height: 88px;
    padding: 10px;
}

.premium-brand-copy .eyebrow {
    margin-bottom: 8px;
}

.premium-meta-chip {
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    border-radius: 24px;
    min-width: 220px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.7);
}

.premium-meta-logo,
.success-brand-logo {
    width: 54px;
    height: 54px;
    padding: 8px;
}

.premium-meta-datetime {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.meta-date {
    font-weight: 700;
    color: var(--text);
}

.meta-time {
    color: var(--primary);
    font-weight: 800;
    letter-spacing: 0.03em;
}

.premium-intro-copy {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    padding: 0 0 22px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--line-soft);
}

.premium-intro-copy p {
    margin: 0;
    font-size: 1.04rem;
}

.intro-note {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(15, 49, 93, 0.06);
    color: var(--primary);
    white-space: nowrap;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.full-width { grid-column: 1 / -1; }

label {
    display: flex;
    flex-direction: column;
    gap: 9px;
}

label span,
.signature-head span {
    font-size: 13px;
    font-weight: 700;
}

.field-block span::after {
    content: '';
}

input,
select,
textarea,
button {
    font: inherit;
}

input,
select,
textarea {
    width: 100%;
    padding: 15px 16px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.96);
    color: var(--text);
    outline: none;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease, background 0.18s ease;
    -webkit-appearance: none;
    appearance: none;
}

select {
    background-image: linear-gradient(45deg, transparent 50%, var(--text-soft) 50%), linear-gradient(135deg, var(--text-soft) 50%, transparent 50%);
    background-position: calc(100% - 22px) calc(50% - 3px), calc(100% - 16px) calc(50% - 3px);
    background-size: 6px 6px, 6px 6px;
    background-repeat: no-repeat;
    padding-right: 46px;
}

input::placeholder,
textarea::placeholder {
    color: #8a97aa;
}

input:focus,
select:focus,
textarea:focus {
    border-color: rgba(15, 49, 93, 0.42);
    box-shadow: 0 0 0 4px rgba(15, 49, 93, 0.08);
    transform: translateY(-1px);
    background: #fff;
}

.premium-form label {
    padding: 16px;
    border-radius: 20px;
    background: linear-gradient(180deg, rgba(249,252,255,0.84), rgba(255,255,255,0.98));
    border: 1px solid var(--line-soft);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.82);
}

.premium-form label:focus-within {
    border-color: rgba(15, 49, 93, 0.18);
    box-shadow: 0 14px 32px rgba(15, 49, 93, 0.06), inset 0 1px 0 rgba(255,255,255,0.86);
}

.signature-section-minimal {
    padding: 0;
    border: 1px solid var(--line-soft);
    border-radius: 22px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.97);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.82);
}

.signature-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 16px 18px;
    background: linear-gradient(180deg, rgba(248,250,252,0.95), rgba(244,247,251,0.95));
    border-bottom: 1px solid var(--line-soft);
}

.signature-head small {
    display: block;
    margin-top: 4px;
}

#signature-pad {
    display: block;
    width: 100%;
    height: 240px;
    background:
        linear-gradient(180deg, rgba(255,255,255,1), rgba(251,253,255,0.98));
}

.primary-button,
.ghost-button,
.link-button {
    appearance: none;
    border: none;
    cursor: pointer;
    font-weight: 700;
    border-radius: 16px;
    transition: transform 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.primary-button:hover,
.ghost-button:hover {
    transform: translateY(-1px);
}

.primary-button {
    background: linear-gradient(180deg, var(--primary), var(--primary-strong));
    color: #fff;
    padding: 15px 24px;
    box-shadow: 0 14px 28px rgba(15, 49, 93, 0.18);
}

.primary-button:focus-visible,
.ghost-button:focus-visible,
.link-button:focus-visible {
    outline: 3px solid rgba(15, 49, 93, 0.18);
    outline-offset: 2px;
}

.large-button {
    min-width: 240px;
}

.ghost-button {
    background: #fff;
    color: var(--primary);
    border: 1px solid var(--line);
    padding: 11px 14px;
}

.form-actions {
    display: flex;
    gap: 14px;
}

.form-actions.center,
.single-action-row {
    justify-content: center;
}

.premium-action-row {
    padding-top: 4px;
}

.center-wrap {
    display: flex;
    justify-content: center;
}

.centered-card {
    width: min(100%, 760px);
}

.success-card {
    text-align: center;
}

.success-icon {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    background: var(--success-soft);
    color: var(--success);
    font-size: 30px;
    font-weight: 800;
}

.muted-icon {
    background: rgba(15,49,93,0.08);
    color: var(--primary);
}

.premium-success {
    text-align: left;
}

.success-brand {
    padding-bottom: 20px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--line-soft);
}

.success-copy {
    flex: 1;
}

.success-copy p {
    max-width: 560px;
}

.success-state {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.success-state .success-icon {
    margin: 0;
    width: 46px;
    height: 46px;
    font-size: 22px;
}

.receipt-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-top: 20px;
    text-align: left;
}

.receipt-grid > div {
    padding: 16px;
    background: rgba(249, 251, 253, 0.96);
    border: 1px solid var(--line-soft);
    border-radius: 18px;
}

.receipt-grid span {
    display: block;
    margin-bottom: 8px;
    color: var(--text-soft);
    font-size: 13px;
}

.signature-preview-wrap {
    margin-top: 24px;
    text-align: left;
}

.signature-preview {
    width: min(100%, 360px);
    margin: 12px 0 0;
    border-radius: 18px;
    border: 1px solid var(--line-soft);
    background: #fff;
}

.site-footer {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 8px 6px;
    font-size: 14px;
}

.hp-field {
    position: absolute;
    left: -9999px;
    top: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.message-card p {
    max-width: 520px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.7;
}

@media (max-width: 860px) {
    .site-header,
    .premium-topbar,
    .premium-intro-copy,
    .signature-head,
    .site-footer,
    .success-brand {
        flex-direction: column;
        align-items: flex-start;
    }

    .header-side,
    .premium-meta-chip {
        width: 100%;
    }

    .premium-meta-chip {
        justify-content: flex-start;
    }

    .form-grid,
    .receipt-grid,
    .admin-summary-grid {
        grid-template-columns: 1fr;
    }

    .main-card,
    .success-card {
        padding: 22px;
    }

    .intro-note {
        white-space: normal;
    }
}

@media (max-width: 560px) {
    body {
        background:
            radial-gradient(circle at top left, rgba(15, 49, 93, 0.08), transparent 34%),
            linear-gradient(180deg, #f7f9fc 0%, #eef3f8 100%);
    }

    .page-shell {
        padding: 12px 12px 24px;
    }

    .site-header,
    .main-card,
    .success-card {
        border-radius: 22px;
    }

    .main-card,
    .success-card {
        padding: 18px;
    }

    .brand-wrap,
    .premium-brand,
    .success-brand {
        gap: 12px;
    }

    .brand-badge,
    .premium-brand-badge {
        width: 64px;
        height: 64px;
        border-radius: 18px;
        padding: 8px;
    }

    .premium-meta-logo,
    .success-brand-logo {
        width: 46px;
        height: 46px;
        border-radius: 16px;
        padding: 6px;
    }

    .card-brand-copy h1,
    .brand-copy h1,
    .success-copy h2,
    .message-card h2 {
        font-size: 1.45rem;
    }

    .premium-intro-copy {
        gap: 12px;
        padding-bottom: 18px;
        margin-bottom: 20px;
    }

    .premium-intro-copy p,
    .subhead,
    .success-copy p,
    .message-card p {
        font-size: 0.98rem;
        line-height: 1.66;
    }

    .premium-form label {
        padding: 14px;
        border-radius: 18px;
    }

    .datetime-pill,
    .premium-meta-chip {
        width: 100%;
        border-radius: 18px;
    }

    .datetime-pill {
        justify-content: space-between;
        flex-wrap: wrap;
    }

    .datetime-time {
        padding-left: 0;
        border-left: none;
    }

    .premium-meta-chip {
        gap: 10px;
        padding: 12px;
    }

    .signature-head {
        padding: 14px;
    }

    #signature-pad {
        height: 200px;
    }

    .form-actions,
    .premium-action-row {
        width: 100%;
    }

    .primary-button,
    .ghost-button,
    .link-button,
    .large-button {
        width: 100%;
        min-width: 0;
        text-align: center;
    }

    .site-footer {
        font-size: 13px;
        padding-top: 16px;
    }

    .admin-toolbar,
    .footer-admin-link {
        width: 100%;
    }

    .admin-summary-grid {
        grid-template-columns: 1fr;
    }

    .admin-table th,
    .admin-table td {
        padding: 12px 14px;
    }
}


.ghost-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.footer-admin-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 999px;
    border: 1px solid var(--line-soft);
    background: rgba(255,255,255,0.78);
    color: var(--primary);
    font-weight: 700;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.footer-admin-link:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-soft);
    border-color: rgba(15, 49, 93, 0.18);
}

.admin-login-wrap {
    padding-top: 18px;
}

.admin-login-card {
    text-align: left;
}

.login-brand-row {
    align-items: center;
}

.admin-login-form {
    grid-template-columns: 1fr;
}

.admin-login-actions {
    flex-wrap: wrap;
}

.admin-panel-card {
    overflow: hidden;
}

.admin-topbar {
    margin-bottom: 22px;
}

.admin-toolbar {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.admin-summary-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 22px;
}

.summary-tile {
    padding: 18px;
    border-radius: 20px;
    border: 1px solid var(--line-soft);
    background: linear-gradient(180deg, rgba(249,252,255,0.94), rgba(255,255,255,0.98));
}

.summary-tile span {
    display: block;
    color: var(--text-soft);
    margin-bottom: 10px;
    font-size: 13px;
}

.summary-tile strong {
    font-size: 1.6rem;
    line-height: 1;
}

.admin-table-wrap {
    border: 1px solid var(--line-soft);
    border-radius: 22px;
    overflow: hidden;
    background: rgba(255,255,255,0.96);
}

.admin-table-scroll {
    overflow: auto;
}

.admin-table {
    width: 100%;
    min-width: 1140px;
    border-collapse: collapse;
}

.admin-table th,
.admin-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--line-soft);
    text-align: left;
    vertical-align: top;
    font-size: 14px;
}

.admin-table th {
    background: rgba(247,250,253,0.98);
    color: var(--primary);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    position: sticky;
    top: 0;
}

.admin-table tbody tr:hover {
    background: rgba(15, 49, 93, 0.03);
}

.status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 7px 10px;
    border-radius: 999px;
    background: rgba(15, 49, 93, 0.08);
    color: var(--primary);
    font-weight: 700;
    white-space: nowrap;
}

.empty-state-box {
    padding: 28px;
}

.empty-state-box h2 {
    margin: 8px 0;
}

.empty-state-box p:last-child {
    margin-bottom: 0;
}

/* Premium admin table refresh */
.summary-primary {
    background: linear-gradient(180deg, rgba(15,49,93,0.98), rgba(11,39,73,0.98));
    border-color: rgba(15,49,93,0.16);
    color: #fff;
    box-shadow: 0 18px 34px rgba(15, 49, 93, 0.18);
}

.summary-primary span,
.summary-primary small,
.summary-primary strong {
    color: #fff;
}

.summary-tile small {
    display: block;
    margin-top: 10px;
    color: var(--text-faint);
    font-size: 12px;
}

.table-section-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 22px 24px 18px;
    border-bottom: 1px solid var(--line-soft);
    background: linear-gradient(180deg, rgba(249,252,255,0.98), rgba(255,255,255,0.98));
}

.table-section-head h2 {
    margin: 8px 0 8px;
    font-size: 1.28rem;
}

.table-section-head p:last-child {
    margin: 0;
    color: var(--text-soft);
    line-height: 1.66;
    max-width: 640px;
}

.table-head-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(15, 49, 93, 0.08);
    color: var(--primary);
    font-weight: 800;
    white-space: nowrap;
}

.premium-table-wrap {
    background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(250,252,255,0.98));
}

.premium-admin-table {
    min-width: 1080px;
}

.premium-admin-table tbody tr:nth-child(even) {
    background: rgba(248, 251, 255, 0.92);
}

.premium-admin-table tbody tr:hover {
    background: rgba(15, 49, 93, 0.045);
}

.premium-admin-table th {
    background: linear-gradient(180deg, #173a67, #102c52);
    color: #ffffff;
    letter-spacing: 0.1em;
    border-bottom-color: rgba(255,255,255,0.08);
}

.cell-no {
    width: 72px;
}

.row-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(15,49,93,0.1), rgba(15,49,93,0.06));
    color: var(--primary);
    font-weight: 800;
}

.person-cell {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    min-width: 250px;
}

.person-avatar {
    width: 44px;
    height: 44px;
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, rgba(15,49,93,0.12), rgba(184,141,47,0.16));
    color: var(--primary);
    font-weight: 800;
    letter-spacing: 0.06em;
    flex: 0 0 auto;
}

.person-meta strong,
.record-meta strong,
.info-block strong {
    display: block;
    line-height: 1.45;
}

.person-meta small,
.record-meta small,
.attendance-cell small,
.info-label {
    display: block;
    margin-top: 4px;
    color: var(--text-soft);
    line-height: 1.5;
}

.stack-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-width: 210px;
}

.mini-chip {
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(15, 49, 93, 0.08);
    color: var(--primary);
    font-weight: 700;
    line-height: 1;
}

.mini-chip.light {
    background: rgba(15, 49, 93, 0.04);
    color: var(--text);
    font-weight: 600;
}

.attendance-cell {
    min-width: 160px;
}

.status-badge.is-success {
    background: rgba(21, 115, 71, 0.12);
    color: var(--success);
}

.status-badge.is-warning {
    background: rgba(184, 141, 47, 0.16);
    color: #8a6406;
}

.status-badge.is-neutral {
    background: rgba(95, 115, 141, 0.14);
    color: #485b74;
}

.status-badge.is-info {
    background: rgba(21, 86, 140, 0.12);
    color: #15568c;
}

.compact-block {
    min-width: 130px;
}

.note-box {
    min-width: 180px;
    padding: 12px 14px;
    border-radius: 16px;
    background: rgba(247, 250, 253, 0.96);
    border: 1px solid var(--line-soft);
    color: var(--text);
    line-height: 1.6;
}

.record-meta {
    min-width: 156px;
}

@media (max-width: 860px) {
    .table-section-head {
        flex-direction: column;
        padding: 18px 18px 16px;
    }

    .table-head-badge {
        align-self: flex-start;
    }
}

@media (max-width: 560px) {
    .table-section-head h2 {
        font-size: 1.12rem;
    }

    .table-section-head p:last-child {
        font-size: 0.95rem;
    }

    .person-cell {
        min-width: 220px;
    }

    .stack-chips,
    .attendance-cell,
    .note-box,
    .record-meta {
        min-width: 0;
    }

    .row-number {
        width: 34px;
        height: 34px;
        border-radius: 12px;
    }
}
