:root {
    color-scheme: light;
    --background: #f3f4f6;
    --surface: #ffffff;
    --surface-dark: #111827;
    --text: #111827;
    --muted: #6b7280;
    --border: #e5e7eb;
    --primary: #111827;
    --primary-hover: #1f2937;
    --danger-background: #fef2f2;
    --danger-border: #fecaca;
    --danger-text: #991b1b;
    --radius: 20px;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--background);
}

body {
    min-height: 100vh;
    margin: 0;
    background: var(--background);
    color: var(--text);
    font-family:
        Inter,
        ui-sans-serif,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
    -webkit-font-smoothing: antialiased;
}

button,
input {
    font: inherit;
}

.auth-page {
    background:
        radial-gradient(circle at top, #e5e7eb 0, transparent 44%),
        var(--background);
}

.auth-container {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding:
        max(24px, env(safe-area-inset-top))
        18px
        max(24px, env(safe-area-inset-bottom));
}

.auth-card {
    width: 100%;
    max-width: 440px;
    padding: 26px 22px;
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(229, 231, 235, 0.9);
    border-radius: 24px;
    box-shadow: 0 24px 70px rgba(17, 24, 39, 0.12);
}

.brand-icon {
    width: 54px;
    height: 54px;
    display: grid;
    place-items: center;
    margin-bottom: 22px;
    background: var(--surface-dark);
    color: #ffffff;
    border-radius: 17px;
    font-size: 17px;
    font-weight: 800;
    letter-spacing: 0.04em;
}

.auth-heading {
    margin-bottom: 24px;
}

.auth-heading h1,
.topbar h1,
.welcome-card h2,
.feature-card h2 {
    margin: 0;
}

.auth-heading h1 {
    margin-bottom: 8px;
    font-size: clamp(28px, 8vw, 36px);
    line-height: 1.1;
}

.auth-heading p:last-child {
    margin: 0;
    color: var(--muted);
    line-height: 1.6;
}

.eyebrow {
    margin: 0 0 6px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.13em;
}

.form-stack {
    display: grid;
    gap: 18px;
}

.form-group {
    display: grid;
    gap: 8px;
}

.form-group label {
    font-size: 14px;
    font-weight: 700;
}

.form-group input {
    width: 100%;
    min-height: 52px;
    padding: 13px 15px;
    background: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 14px;
    color: var(--text);
    outline: none;
    transition:
        border-color 0.15s ease,
        box-shadow 0.15s ease;
}

.form-group input:focus {
    border-color: #6b7280;
    box-shadow: 0 0 0 4px rgba(107, 114, 128, 0.13);
}

.password-field {
    position: relative;
}

.password-field input {
    padding-right: 72px;
}

.password-toggle {
    position: absolute;
    top: 50%;
    right: 8px;
    min-width: 56px;
    padding: 8px;
    transform: translateY(-50%);
    background: transparent;
    border: 0;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
}

.button {
    min-height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 11px 18px;
    border: 0;
    border-radius: 14px;
    font-weight: 800;
    text-decoration: none;
    cursor: pointer;
}

.button-primary {
    min-height: 54px;
    background: var(--primary);
    color: #ffffff;
}

.button-primary:hover {
    background: var(--primary-hover);
}

.button-secondary {
    background: #ffffff;
    color: var(--text);
    border: 1px solid var(--border);
}

.button-disabled {
    width: 100%;
    background: #e5e7eb;
    color: #9ca3af;
    cursor: not-allowed;
}

.alert {
    margin-bottom: 18px;
    padding: 13px 14px;
    border-radius: 13px;
    font-size: 14px;
    line-height: 1.5;
}

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

.privacy-note {
    margin: 22px 0 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.6;
    text-align: center;
}

.topbar {
    min-height: 78px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding:
        max(16px, env(safe-area-inset-top))
        18px
        14px;
    background: #ffffff;
    border-bottom: 1px solid var(--border);
}

.topbar h1 {
    font-size: 21px;
}

.dashboard-container {
    width: min(100% - 32px, 980px);
    margin: 0 auto;
    padding: 24px 0 50px;
}

.welcome-card,
.feature-card {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 8px 30px rgba(17, 24, 39, 0.05);
}

.welcome-card {
    display: grid;
    gap: 20px;
    margin-bottom: 18px;
    padding: 22px;
}

.welcome-card h2 {
    margin-top: 5px;
    font-size: 23px;
}

.record-count {
    padding: 17px;
    background: #f9fafb;
    border-radius: 16px;
}

.record-count strong,
.record-count span {
    display: block;
}

.record-count strong {
    margin-bottom: 4px;
    font-size: 28px;
}

.record-count span {
    color: var(--muted);
    font-size: 13px;
}

.feature-card {
    display: grid;
    gap: 20px;
    padding: 22px;
}

.feature-icon {
    width: 52px;
    height: 52px;
    display: grid;
    place-items: center;
    background: #f3f4f6;
    border-radius: 16px;
    font-size: 24px;
}

.feature-card h2 {
    margin-bottom: 9px;
    font-size: 22px;
}

.muted {
    margin: 0;
    color: var(--muted);
    line-height: 1.65;
}

@media (min-width: 700px) {
    .auth-card {
        padding: 34px;
    }

    .topbar {
        padding-left: 32px;
        padding-right: 32px;
    }

    .dashboard-container {
        padding-top: 34px;
    }

    .welcome-card {
        grid-template-columns: 1fr 220px;
        align-items: center;
        padding: 28px;
    }

    .feature-card {
        grid-template-columns: auto 1fr 230px;
        align-items: center;
        padding: 30px;
    }

    .button-disabled {
        width: auto;
    }
}

.batch-container {
    width: min(100% - 28px, 980px);
    margin: 0 auto;
    padding: 22px 0 150px;
}

.batch-upload-card {
    padding: 22px;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 8px 30px rgba(17, 24, 39, 0.05);
}

.batch-upload-card h2 {
    margin: 0 0 10px;
    font-size: 24px;
}

.batch-dropzone {
    min-height: 180px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 7px;
    margin-top: 22px;
    padding: 25px 18px;
    border: 2px dashed #d1d5db;
    border-radius: 18px;
    background: #f9fafb;
    text-align: center;
    cursor: pointer;
}

.batch-dropzone:hover {
    border-color: #9ca3af;
    background: #f3f4f6;
}

.batch-dropzone-icon {
    margin-bottom: 5px;
    font-size: 34px;
}

.batch-dropzone span:last-of-type {
    color: var(--muted);
    font-size: 13px;
}

.batch-dropzone input {
    display: none;
}

.batch-actions {
    display: grid;
    gap: 10px;
    margin-top: 18px;
}

.batch-main-status {
    min-height: 22px;
    margin: 15px 0 0;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.5;
}

.batch-summary {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-top: 16px;
}

.batch-summary div {
    padding: 16px;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 16px;
}

.batch-summary strong,
.batch-summary span {
    display: block;
}

.batch-summary strong {
    margin-bottom: 3px;
    font-size: 24px;
}

.batch-summary span {
    color: var(--muted);
    font-size: 12px;
}

.batch-list {
    display: grid;
    gap: 14px;
    margin-top: 16px;
}

.batch-item {
    overflow: hidden;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: 0 6px 22px rgba(17, 24, 39, 0.04);
}

.batch-item-preview {
    height: 190px;
    background: #e5e7eb;
}

.batch-item-preview img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
}

.batch-item-content {
    padding: 17px;
}

.batch-item-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.batch-item-number,
.batch-item-filename {
    display: block;
}

.batch-item-number {
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.batch-item-filename {
    max-width: 210px;
    overflow: hidden;
    font-size: 14px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.batch-file-meta {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 12px;
}

.batch-status-badge {
    flex: 0 0 auto;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
}

.batch-status-waiting {
    background: #f3f4f6;
    color: #4b5563;
}

.batch-status-processing {
    background: #eff6ff;
    color: #1d4ed8;
}

.batch-status-ready {
    background: #ecfdf5;
    color: #047857;
}

.batch-status-duplicate {
    background: #fffbeb;
    color: #b45309;
}

.batch-status-failed {
    background: #fef2f2;
    color: #b91c1c;
}

.batch-status-saved {
    background: #dcfce7;
    color: #166534;
}

.batch-item-message {
    margin-top: 14px;
    padding: 11px 12px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.5;
}

.batch-message-error {
    background: #fef2f2;
    color: #991b1b;
}

.batch-message-warning {
    background: #fffbeb;
    color: #92400e;
}

.batch-message-success {
    background: #ecfdf5;
    color: #065f46;
}

.batch-result-form {
    display: grid;
    gap: 13px;
    margin-top: 16px;
}

.batch-form-group {
    display: grid;
    gap: 6px;
}

.batch-form-group label {
    font-size: 13px;
    font-weight: 700;
}

.batch-form-group input {
    width: 100%;
    min-height: 48px;
    padding: 11px 13px;
    border: 1px solid #d1d5db;
    border-radius: 12px;
    background: #ffffff;
    color: var(--text);
}

.batch-form-group input:focus {
    border-color: #6b7280;
    outline: none;
    box-shadow: 0 0 0 4px rgba(107, 114, 128, 0.12);
}

.batch-form-group input:disabled {
    background: #f3f4f6;
    color: #6b7280;
}

.batch-include-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    font-weight: 700;
}

.batch-include-label input {
    width: 19px;
    height: 19px;
}

.batch-result-meta {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
}

.batch-save-bar {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 20;
    display: grid;
    gap: 13px;
    padding:
        15px
        16px
        max(15px, env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, 0.96);
    border-top: 1px solid var(--border);
    box-shadow: 0 -12px 35px rgba(17, 24, 39, 0.1);
    backdrop-filter: blur(14px);
}

.batch-save-bar strong,
.batch-save-bar span {
    display: block;
}

.batch-save-bar strong {
    margin-bottom: 3px;
    font-size: 14px;
}

.batch-save-bar span {
    color: var(--muted);
    font-size: 11px;
}

@media (min-width: 700px) {
    .batch-container {
        padding-top: 32px;
    }

    .batch-upload-card {
        padding: 30px;
    }

    .batch-actions {
        grid-template-columns: 1fr auto;
    }

    .batch-summary {
        grid-template-columns: repeat(4, 1fr);
    }

    .batch-item {
        display: grid;
        grid-template-columns: 230px 1fr;
    }

    .batch-item-preview {
        height: 100%;
        min-height: 270px;
    }

    .batch-item-content {
        padding: 22px;
    }

    .batch-item-filename {
        max-width: 420px;
    }

    .batch-result-form {
        grid-template-columns: 1fr 190px;
    }

    .batch-include-label,
    .batch-result-meta {
        grid-column: 1 / -1;
    }

    .batch-save-bar {
        grid-template-columns: 1fr auto;
        align-items: center;
        padding-right: max(28px, env(safe-area-inset-right));
        padding-left: max(28px, env(safe-area-inset-left));
    }
}

/* Pastikan elemen beratribut hidden benar-benar disembunyikan. */
[hidden] {
    display: none !important;
}

/* Tampilan tombol ketika belum dapat digunakan. */
.button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.alert-success {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #065f46;
}

.records-container {
    width: min(100% - 28px, 980px);
    margin: 0 auto;
    padding: 22px 0 60px;
}

.records-toolbar {
    padding: 22px;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 8px 30px rgba(17, 24, 39, 0.05);
}

.records-toolbar-heading {
    display: grid;
    gap: 18px;
}

.records-toolbar-heading h2 {
    margin: 0 0 8px;
    font-size: 25px;
}

.records-total {
    padding: 16px;
    background: #f9fafb;
    border-radius: 16px;
}

.records-total strong,
.records-total span {
    display: block;
}

.records-total strong {
    margin-bottom: 4px;
    font-size: 27px;
}

.records-total span {
    color: var(--muted);
    font-size: 12px;
}

.records-search-form {
    margin-top: 22px;
}

.records-search-grid {
    display: grid;
    gap: 15px;
}

.records-search-actions {
    display: grid;
    gap: 10px;
    margin-top: 16px;
}

.records-result-info {
    margin: 18px 3px 11px;
    color: var(--muted);
    font-size: 13px;
}

.records-list {
    display: grid;
    gap: 13px;
}

.record-card {
    display: grid;
    gap: 17px;
    padding: 19px;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: 0 6px 22px rgba(17, 24, 39, 0.04);
}

.record-number {
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.08em;
}

.record-name {
    margin: 0;
    font-size: 20px;
    line-height: 1.35;
    word-break: break-word;
}

.record-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 17px;
}

.record-details div {
    padding: 12px;
    background: #f9fafb;
    border-radius: 13px;
}

.record-details span,
.record-details strong {
    display: block;
}

.record-details span {
    margin-bottom: 5px;
    color: var(--muted);
    font-size: 11px;
}

.record-details strong {
    font-size: 13px;
}

.record-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 9px;
}

.record-actions form {
    margin: 0;
}

.record-actions .button {
    width: 100%;
}

.button-small {
    min-height: 44px;
    padding: 9px 14px;
}

.button-danger {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
}

.button-danger:hover {
    background: #fee2e2;
}

.records-empty {
    margin-top: 17px;
    padding: 45px 22px;
    text-align: center;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.records-empty-icon {
    margin-bottom: 12px;
    font-size: 35px;
}

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

.records-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 22px;
}

.pagination-button {
    min-width: 43px;
    height: 43px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text);
    font-weight: 700;
    text-decoration: none;
}

.pagination-active {
    background: var(--primary);
    border-color: var(--primary);
    color: #ffffff;
}

.edit-record-container {
    width: min(100% - 28px, 620px);
    margin: 0 auto;
    padding: 24px 0 60px;
}

.edit-record-card {
    padding: 22px;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 8px 30px rgba(17, 24, 39, 0.05);
}

.edit-record-card h2 {
    margin: 0 0 9px;
    font-size: 25px;
}

.edit-record-alert {
    margin-top: 20px;
}

.edit-record-card form {
    margin-top: 22px;
}

.edit-record-actions {
    display: grid;
    gap: 10px;
}

@media (min-width: 700px) {
    .records-container {
        padding-top: 32px;
    }

    .records-toolbar {
        padding: 28px;
    }

    .records-toolbar-heading {
        grid-template-columns: 1fr 210px;
        align-items: center;
    }

    .records-search-grid {
        grid-template-columns: 1fr 240px;
    }

    .records-search-actions {
        grid-template-columns: auto auto;
        justify-content: start;
    }

    .record-card {
        grid-template-columns: 1fr auto;
        align-items: center;
        padding: 22px;
    }

    .record-actions {
        width: 190px;
    }

    .edit-record-card {
        padding: 30px;
    }

    .edit-record-actions {
        grid-template-columns: 1fr auto;
    }
}
