@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
    --app-red: #E30613;
    --app-red-deep: #B30510;
    --ink-900: #1f2f41;
    --ink-700: #4d5b6c;
    --surface: rgba(255, 255, 255, 0.92);
    --surface-line: rgba(33, 48, 67, 0.08);
    --card-shadow: 0 14px 40px rgba(24, 39, 75, 0.08);
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    min-height: 100%;
}

html {
    overflow-y: scroll;
    scrollbar-gutter: stable;
}

body {
    font-family: 'Plus Jakarta Sans', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: var(--ink-900);
    background:
        radial-gradient(circle at top left, rgba(227, 6, 19, 0.10), transparent 34%),
        radial-gradient(circle at bottom right, rgba(17, 24, 39, 0.07), transparent 32%),
        linear-gradient(180deg, #f6f8fb 0%, #f2f5f8 100%),
        #f4f6f8;
}

a {
    color: inherit;
}

.header {
    background: linear-gradient(135deg, var(--app-red) 0%, var(--app-red-deep) 100%);
    color: #fff;
    padding: 20px 0;
    box-shadow: 0 8px 24px rgba(179, 5, 16, 0.18);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content,
.container {
    width: min(1200px, calc(100% - 32px));
    margin: 0 auto;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.24);
}

.nav-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 138px;
    padding: 10px 16px;
    border-radius: 999px;
    border: 1px solid transparent;
    background: transparent;
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    font-weight: 700;
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.nav-pill i {
    font-size: 14px;
}

.nav-pill:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.nav-pill.is-active {
    background: #ffffff;
    color: #b30510;
    border-color: rgba(255, 255, 255, 0.85);
    box-shadow: 0 8px 20px rgba(94, 3, 11, 0.22);
}

.nav-pill:focus-visible {
    outline: 3px solid rgba(255, 255, 255, 0.45);
    outline-offset: 2px;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 14px;
}

.logo-icon {
    width: 52px;
    height: 52px;
    display: grid;
    place-items: center;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.28);
    font-size: 24px;
}

.logo-text h1 {
    margin: 0;
    font-size: 28px;
    line-height: 1;
}

.tagline {
    margin: 4px 0 0;
    font-size: 13px;
    opacity: 0.92;
}

.header-badge,
.rfid-indicator {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border-radius: 999px;
    padding: 10px 16px;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.25);
}

.container {
    padding: 28px 0 40px;
}

.control-card {
    position: relative;
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--surface-line);
    box-shadow: var(--card-shadow);
    border-radius: 24px;
    padding: 24px;
    margin-bottom: 18px;
    display: grid;
    gap: 14px;
}

.control-card::after {
    content: '';
    position: absolute;
    right: -48px;
    top: -48px;
    width: 180px;
    height: 180px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(227, 6, 19, 0.12), rgba(227, 6, 19, 0.00) 70%);
    pointer-events: none;
}

.control-card h2 {
    margin: 0;
    font-size: 36px;
    line-height: 1.08;
    letter-spacing: -0.03em;
}

.control-note {
    margin: 8px 0 0;
    color: #5f6d7e;
    font-size: 16px;
    line-height: 1.55;
    max-width: 920px;
}

.capture-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 12px;
    margin-top: 14px;
}

.capture-controls label {
    display: grid;
    gap: 6px;
    font-size: 13px;
    color: #4d5b6c;
    font-weight: 600;
}

.capture-controls select,
.capture-controls input {
    border: 1px solid #d6deea;
    border-radius: 12px;
    padding: 10px 12px;
    min-width: 130px;
}

.btn-save-setting {
    border: 0;
    border-radius: 12px;
    padding: 10px 14px;
    font-weight: 700;
    color: #fff;
    cursor: pointer;
    background: linear-gradient(135deg, #E30613, #B30510);
}

.login-empty-card {
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(33, 48, 67, 0.08);
    box-shadow: 0 14px 40px rgba(24, 39, 75, 0.08);
    border-radius: 22px;
    padding: 30px 20px;
    text-align: center;
    margin-bottom: 18px;
}

.login-empty-icon {
    width: 62px;
    height: 62px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    margin: 0 auto 12px;
    color: #fff;
    font-size: 24px;
    background: linear-gradient(135deg, #E30613, #FF4B55);
}

.tap-flow {
    margin-top: 2px;
    display: flex;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 10px;
}

.tap-flow span {
    padding: 8px 14px;
    border-radius: 999px;
    background: linear-gradient(180deg, #f6f8fc, #edf1f8);
    color: #344760;
    border: 1px solid #dce5f1;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.status-badges {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.badge {
    font-size: 12px;
    font-weight: 700;
    padding: 6px 12px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.badge-pulse {
    background: #eef8f1;
    color: #246a38;
    border: 1px solid #bcdcc7;
}

.badge-pulse i {
    animation: pulse 2s infinite;
}

.badge-outline {
    background: #f7f9fb;
    color: #526072;
    border: 1px solid #dce5f1;
}

.badge-unsaved {
    background: #fff8e1;
    color: #f57c00;
    border: 1px solid #ffe082;
    animation: pulse-soft 2s infinite;
}

@keyframes pulse-soft {
    0% { opacity: 1; }
    50% { opacity: 0.6; }
    100% { opacity: 1; }
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

.text-warning {
    color: #eab308;
    font-size: 11px;
    display: block;
    margin-top: 4px;
}

.text-error {
    color: #ef4444;
    font-size: 11px;
    display: block;
    margin-top: 4px;
}

.btn-edit-global {
    border: 0;
    border-radius: 12px;
    padding: 10px 16px;
    background: #f0f4f8;
    color: #344760;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: background 0.2s, transform 0.2s;
}

.btn-edit-global:hover {
    background: #e2e8f0;
    transform: translateY(-1px);
}

.history-user-banner {
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(33, 48, 67, 0.08);
    box-shadow: 0 14px 40px rgba(24, 39, 75, 0.08);
    border-radius: 16px;
    padding: 14px 16px;
    margin-bottom: 14px;
    display: flex;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

.cards {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
    margin-bottom: 26px;
}

.card,
.user-profile-card {
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(33, 48, 67, 0.08);
    box-shadow: 0 14px 40px rgba(24, 39, 75, 0.08);
}

.card {
    position: relative;
    display: flex;
    gap: 18px;
    align-items: center;
    padding: 24px;
    border-radius: 22px;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    inset: 0 auto 0 0;
    width: 5px;
    background: linear-gradient(180deg, #E30613, #FF4B55);
}

.card-icon {
    width: 62px;
    height: 62px;
    display: grid;
    place-items: center;
    border-radius: 18px;
    color: #fff;
    font-size: 24px;
    background: linear-gradient(135deg, #E30613, #FF4B55);
    box-shadow: 0 10px 24px rgba(227, 6, 19, 0.24);
    flex: 0 0 auto;
}

.card-content h3,
.section-title h2,
.ocr-title,
.edit-modal-header h3 {
    margin: 0;
}

.card-content h3 {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #6a7787;
}

.card-number {
    margin: 6px 0 0;
    font-size: 42px;
    line-height: 1;
    font-weight: 800;
    color: #E30613;
}

.card-label {
    display: inline-block;
    margin-top: 6px;
    color: #6a7787;
    font-size: 13px;
}

.section-title {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin: 20px 0 16px;
}

.title-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.title-left i {
    color: var(--app-red);
    font-size: 18px;
    background: rgba(227, 6, 19, 0.09);
    padding: 11px;
    border-radius: 14px;
}

.section-title h2 {
    font-size: 22px;
    line-height: 1.2;
}

.active-user-section {
    margin-top: 12px;
}

.user-profile-card {
    border-radius: 24px;
    overflow: hidden;
}

.profile-header {
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 18px;
    padding: 28px;
    background: linear-gradient(135deg, #E30613 0%, #B30510 100%);
    color: #fff;
}

.profile-header::after {
    content: '';
    position: absolute;
    right: -30px;
    top: -30px;
    width: 160px;
    height: 160px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.10);
}

.avatar {
    width: 70px;
    height: 70px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.4);
    background: rgba(255, 255, 255, 0.16);
    font-size: 30px;
    flex: 0 0 auto;
}

.profile-info,
.stat-info {
    position: relative;
    z-index: 1;
}

.profile-info {
    flex: 1;
    min-width: 220px;
}

.profile-info h3 {
    margin: 0 0 4px;
    font-size: 24px;
}

.user-id {
    margin: 0;
    font-size: 13px;
    opacity: 0.92;
}

.status-badge {
    position: relative;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    padding: 10px 16px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    flex: 0 0 auto;
}

.status-badge.active {
    background: rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.35);
}

.activity-stats {
    padding: 24px 28px 18px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    border-radius: 18px;
    background: #f7f9fb;
    border: 1px solid #e6ebf2;
}

.stat-item:hover {
    background: #fff;
    box-shadow: 0 8px 22px rgba(24, 39, 75, 0.08);
}

.stat-icon {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    color: #fff;
    flex: 0 0 auto;
}

.stat-icon.time { background: linear-gradient(135deg, #2f7dff, #1a57cb); }
.stat-icon.calories { background: linear-gradient(135deg, #ff6b4d, #c93f25); }
.stat-icon.distance { background: linear-gradient(135deg, #18b394, #0a7b67); }

.stat-info {
    min-width: 0;
}

.stat-label {
    display: block;
    font-size: 12px;
    color: #6a7787;
}

.stat-value {
    display: block;
    margin-top: 4px;
    font-size: 18px;
    font-weight: 700;
    color: #213043;
    word-break: break-word;
}

.btn-edit,
.btn-save,
.btn-cancel,
.edit-modal-close {
    border: 0;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.btn-edit {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: #E30613;
    color: #fff;
    box-shadow: 0 8px 16px rgba(227, 6, 19, 0.28);
    margin-left: auto;
    flex: 0 0 auto;
}

.btn-edit:disabled {
    background: #b9c1ce;
    box-shadow: none;
    cursor: not-allowed;
}

.btn-edit:hover,
.btn-save:hover,
.btn-cancel:hover,
.edit-modal-close:hover {
    transform: translateY(-1px);
}

.session-info {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 0 28px 24px;
}

.info-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 999px;
    background: #f7f9fb;
    color: #526072;
    border: 1px solid #e6ebf2;
}

.edited-badge {
    background: rgba(227, 6, 19, 0.08);
    color: #b30510;
    border-color: rgba(227, 6, 19, 0.15);
}

.ocr-section {
    margin: 0 28px 28px;
    padding: 20px;
    border-radius: 22px;
    background: #f7f9fb;
    border: 1px solid #e6ebf2;
}

.ocr-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 14px;
    align-items: center;
    margin-bottom: 16px;
}

.ocr-title {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
}

.ocr-raw {
    padding: 10px 14px;
    border-radius: 14px;
    background: #fff;
    border: 1px dashed #d7deea;
    color: #526072;
    word-break: break-word;
}

.ocr-status-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.ocr-loading {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 12px;
    background: #eef8f1;
    color: #246a38;
    border: 1px solid #bcdcc7;
    font-size: 12px;
    font-weight: 700;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.ocr-loading[data-state="processing"] {
    background: #fff5f5;
    color: #b30510;
    border-color: #f4c6ca;
}

.spinner {
    width: 12px;
    height: 12px;
    border: 2px solid #92c7a3;
    border-top-color: #2b7b41;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    animation-play-state: paused;
}

.ocr-loading[data-state="processing"] .spinner {
    border-color: #f5b6bd;
    border-top-color: #b30510;
    animation-play-state: running;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.ocr-images {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.capture-steps {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin-bottom: 12px;
}

.step-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 12px;
    background: #eef3fa;
    border: 1px solid #dde7f3;
}

.step-item strong {
    width: 22px;
    height: 22px;
    display: inline-grid;
    place-items: center;
    border-radius: 50%;
    background: #1f2937;
    color: #fff;
    font-size: 12px;
}

.step-item span {
    color: #4d5b6c;
    font-size: 12px;
    font-weight: 700;
}

.ocr-summary-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}

.ocr-summary-box {
    background: #fff;
    border: 1px solid #dfe6f1;
    border-radius: 14px;
    padding: 10px 12px;
}

.ocr-summary-box label {
    display: block;
    font-size: 12px;
    color: #6a7787;
}

.ocr-summary-box strong {
    display: block;
    margin-top: 3px;
    font-size: 20px;
    color: #243447;
}

.quick-save-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 28px 16px;
    flex-wrap: wrap;
}

.save-history-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.btn-save-history {
    border: 0 !important;
    border-radius: 12px;
    padding: 10px 16px;
    background: linear-gradient(135deg, #E30613, #B30510) !important;
    color: #fff !important;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 10px 20px rgba(227, 6, 19, 0.22);
    line-height: 1;
}

.btn-save-history:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.save-history-msg {
    font-size: 12px;
    color: #5a6778;
    font-weight: 600;
}

.capture-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(260px, 1fr));
    gap: 14px;
    margin-bottom: 16px;
}

.capture-grid .ocr-image-card {
    min-height: 0;
    aspect-ratio: 16 / 7;
    border-radius: 14px;
    border: 1px solid #d8e2ef;
    background: #f4f7fb;
}

.capture-grid .ocr-image-card img {
    min-height: 0;
}

.capture-caption {
    position: absolute;
    left: 10px;
    right: 10px;
    bottom: 10px;
    z-index: 1;
    padding: 8px 10px;
    border-radius: 10px;
    background: rgba(15, 23, 42, 0.62);
    color: #f8fafc;
    font-size: 12px;
    font-weight: 500;
}

.ocr-subtitle {
    margin: 10px 0 10px;
    font-size: 13px;
    font-weight: 700;
    color: #5a6778;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.ocr-debug {
    margin-top: 10px;
    border-top: 1px dashed #d6deea;
    padding-top: 10px;
}

.ocr-debug > summary {
    cursor: pointer;
    font-size: 13px;
    color: #5a6778;
    font-weight: 700;
}

.ocr-debug-grid {
    margin-top: 10px;
    gap: 10px;
}

.ocr-image-card {
    position: relative;
    overflow: hidden;
    min-height: 130px;
    border-radius: 18px;
    background: linear-gradient(180deg, #ffffff, #eef2f7);
    border: 1px solid #dfe6f1;
}

.ocr-image-label {
    position: absolute;
    left: 12px;
    top: 12px;
    z-index: 1;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(17, 24, 39, 0.72);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
}

.ocr-image-card img {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 130px;
    object-fit: cover;
}

.ocr-debug-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.ocr-debug-grid .ocr-image-card {
    min-height: 100px;
    border-radius: 12px;
}

.ocr-debug-grid .ocr-image-card img {
    min-height: 100px;
}

.ocr-image-card.no-image {
    display: grid;
    place-items: center;
    color: #7a8796;
    background: #eef3f8;
}

.ocr-image-card.no-image::after {
    content: 'Tidak ada gambar';
    font-weight: 600;
}

.ocr-image-card.no-image .capture-caption {
    display: none;
}

.ocr-image-card.no-image img {
    display: none;
}

.edit-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.48);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.edit-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.edit-modal {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) scale(0.96);
    width: min(420px, calc(100% - 32px));
    background: #fff;
    border-radius: 24px;
    box-shadow: 0 24px 80px rgba(15, 23, 42, 0.25);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 20;
}

.edit-modal.active {
    opacity: 1;
    pointer-events: auto;
    transform: translate(-50%, -50%) scale(1);
}

.edit-modal-header,
.edit-modal-body,
.edit-modal-footer {
    padding-left: 22px;
    padding-right: 22px;
}

.edit-modal-header {
    padding-top: 20px;
    padding-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    justify-content: space-between;
    border-bottom: 1px solid #eef2f6;
}

.edit-modal-header h3 {
    font-size: 20px;
}

.edit-modal-close {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: #f1f5f9;
    color: #526072;
}

.edit-modal-body {
    padding-top: 18px;
    padding-bottom: 18px;
}

.edit-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 700;
    color: #213043;
}

.edit-input {
    width: 100%;
    border: 1px solid #d6deea;
    border-radius: 14px;
    padding: 13px 14px;
    font-size: 15px;
    outline: none;
}

.edit-input:focus {
    border-color: #E30613;
    box-shadow: 0 0 0 4px rgba(227, 6, 19, 0.12);
}

.edit-modal-footer {
    padding-top: 0;
    padding-bottom: 22px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.btn-cancel,
.btn-save {
    padding: 11px 16px;
    border-radius: 14px;
    font-weight: 700;
}

.btn-cancel {
    background: #eef2f7;
    color: #304256;
}

.btn-save {
    background: linear-gradient(135deg, #E30613, #B30510);
    color: #fff;
    box-shadow: 0 10px 22px rgba(227, 6, 19, 0.20);
}

.footer {
    padding: 22px 16px 30px;
    text-align: center;
    color: #6a7787;
}

.footer p {
    margin: 0;
}

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

.summary-card,
.history-card {
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(33, 48, 67, 0.08);
    box-shadow: 0 14px 40px rgba(24, 39, 75, 0.08);
    border-radius: 24px;
}

.summary-card {
    padding: 22px;
    position: relative;
    overflow: hidden;
}

.summary-card::before {
    content: '';
    position: absolute;
    inset: 0 auto 0 0;
    width: 5px;
    background: linear-gradient(180deg, #E30613, #FF4B55);
}

.summary-label {
    display: inline-block;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #6a7787;
    margin-bottom: 8px;
}

.summary-value {
    font-size: 34px;
    font-weight: 800;
    color: #E30613;
    line-height: 1;
}

.summary-card p {
    margin: 10px 0 0;
    color: #6a7787;
}

.history-card {
    padding: 24px;
}

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

.history-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 760px;
}

.history-table th,
.history-table td {
    padding: 14px 12px;
    border-bottom: 1px solid #e6ebf2;
    text-align: left;
}

.history-table th {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #6a7787;
}

.history-table td {
    color: #213043;
    font-weight: 500;
}

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

.history-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.action-btn {
    border: 1px solid #d9e1ec;
    border-radius: 12px;
    padding: 8px 12px;
    background: #fff;
    color: #1f2f41;
    font-weight: 700;
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.action-btn i {
    font-size: 12px;
}

.action-btn.action-view {
    background: #eef2ff;
    border-color: #c7d2fe;
    color: #1f3b7a;
}

.action-btn.action-edit {
    background: #fff5f5;
    border-color: #f3c7cd;
    color: #b30510;
}

.action-btn.action-delete {
    background: #fef2f2;
    border-color: #fecaca;
    color: #b91c1c;
}

.action-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    box-shadow: none;
}

.status-chip {
    display: inline-flex;
    align-items: center;
    padding: 7px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

.badge-live {
    background: rgba(24, 179, 148, 0.12);
    color: #0a7b67;
}

.badge-edited {
    background: rgba(227, 6, 19, 0.10);
    color: #b30510;
}

.empty-state {
    padding: 30px 10px;
    text-align: center;
    color: #6a7787;
}

.empty-state i {
    font-size: 28px;
    margin-bottom: 10px;
    color: #E30613;
}

.history-note {
    margin-top: 16px;
    color: #6a7787;
    font-size: 13px;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.48);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 30;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.history-modal {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) scale(0.96);
    width: min(480px, calc(100% - 32px));
    background: #fff;
    border-radius: 24px;
    box-shadow: 0 28px 90px rgba(15, 23, 42, 0.25);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 31;
}

.history-modal-wide {
    width: min(640px, calc(100% - 32px));
    max-height: min(72vh, 640px);
    overflow: hidden;
}

.history-modal.active {
    opacity: 1;
    pointer-events: auto;
    transform: translate(-50%, -50%) scale(1);
}

.modal-header,
.modal-body,
.modal-footer {
    padding: 18px 22px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid #eef2f6;
}

.modal-title {
    margin: 0;
    font-size: 20px;
}

.modal-close {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    border: 0;
    background: #f1f5f9;
    color: #526072;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.modal-field {
    display: grid;
    gap: 8px;
    margin-bottom: 12px;
}

.modal-field label {
    font-weight: 700;
    color: #213043;
}

.modal-field input {
    width: 100%;
    border: 1px solid #d6deea;
    border-radius: 14px;
    padding: 12px 14px;
    font-size: 14px;
    outline: none;
}

.modal-field input:focus {
    border-color: #E30613;
    box-shadow: 0 0 0 4px rgba(227, 6, 19, 0.12);
}

.modal-text {
    margin: 0;
    color: #4d5b6c;
    line-height: 1.5;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.btn-danger {
    padding: 11px 16px;
    border-radius: 14px;
    border: 0;
    font-weight: 700;
    color: #fff;
    cursor: pointer;
    background: linear-gradient(135deg, #d11d2d, #a10f1c);
    box-shadow: 0 10px 22px rgba(209, 29, 45, 0.22);
}

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

.history-image-card {
    position: relative;
    border-radius: 16px;
    overflow: hidden;
    background: #f4f7fb;
    border: 1px solid #d8e2ef;
    min-height: 150px;
}

.history-image-card span {
    position: absolute;
    left: 10px;
    top: 10px;
    z-index: 1;
    background: rgba(17, 24, 39, 0.72);
    color: #fff;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}

.history-image-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.history-image-card.no-image {
    display: grid;
    place-items: center;
    color: #7a8796;
    font-weight: 600;
}

.history-image-card.no-image img {
    display: none;
}

.history-image-card.no-image::after {
    content: 'Tidak ada gambar';
}

@media (max-width: 960px) {
    .cards,
    .summary-grid,
    .activity-stats,
    .ocr-images,
    .capture-grid,
    .ocr-summary-row {
        grid-template-columns: 1fr;
    }

    .status-badge {
        margin-left: 0;
    }
}

@media (max-width: 900px) {
    .history-table {
        min-width: 0;
    }

    .history-table thead {
        display: none;
    }

    .history-table tbody,
    .history-table tr,
    .history-table td {
        display: block;
        width: 100%;
    }

    .history-table tr {
        padding: 14px;
        margin-bottom: 12px;
        border-radius: 18px;
        border: 1px solid #e6ebf2;
        background: #fff;
        box-shadow: 0 12px 28px rgba(24, 39, 75, 0.06);
    }

    .history-table tr.is-empty {
        padding: 0;
        border: 0;
        box-shadow: none;
        background: transparent;
    }

    .history-table td {
        padding: 8px 0;
        border-bottom: 0;
        display: flex;
        justify-content: space-between;
        gap: 16px;
    }

    .history-table td::before {
        content: attr(data-label);
        font-size: 11px;
        font-weight: 700;
        letter-spacing: 0.08em;
        text-transform: uppercase;
        color: #6a7787;
    }

    .history-table tr.is-empty td {
        display: block;
    }

    .history-table tr.is-empty td::before {
        content: '';
    }

    .actions-cell {
        min-width: 0;
    }

    .actions-cell .history-actions {
        justify-content: flex-start;
    }

    .history-image-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .header-content,
    .section-title,
    .ocr-header {
        align-items: flex-start;
    }

    .header-content {
        flex-direction: column;
    }

    .header-actions {
        width: 100%;
        justify-content: center;
        flex-wrap: nowrap;
    }

    .capture-controls {
        align-items: stretch;
    }

    .capture-controls label,
    .btn-save-setting {
        width: 100%;
    }

    .control-card {
        padding: 18px;
        border-radius: 20px;
    }

    .control-card h2 {
        font-size: 29px;
    }

    .control-note {
        font-size: 14px;
    }

    .tap-flow {
        gap: 8px;
    }

    .tap-flow span {
        font-size: 11px;
        padding: 8px 11px;
    }

    .status-inline {
        font-size: 12px;
        padding: 7px 10px;
    }

    .nav-pill {
        min-width: 0;
        flex: 1;
    }

    .card,
    .profile-header,
    .activity-stats,
    .quick-save-row,
    .session-info,
    .ocr-section {
        padding-left: 16px;
        padding-right: 16px;
    }

    .card-number {
        font-size: 34px;
    }

    .summary-value {
        font-size: 30px;
    }

    .section-title h2 {
        font-size: 20px;
    }
}

button:not(:disabled),
.nav-pill,
.btn-save-setting,
.btn-save-history,
.action-btn,
.btn-save,
.btn-cancel,
.btn-edit,
.btn-danger,
.modal-close {
    transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

button:not(:disabled):hover,
.nav-pill:hover,
.btn-save-setting:hover,
.btn-save-history:hover,
.action-btn:hover,
.btn-save:hover,
.btn-cancel:hover,
.btn-edit:hover,
.btn-danger:hover,
.modal-close:hover {
    transform: translateY(-1px);
    filter: brightness(1.02);
}

button:not(:disabled):active,
.nav-pill:active,
.btn-save-setting:active,
.btn-save-history:active,
.action-btn:active,
.btn-save:active,
.btn-cancel:active,
.btn-edit:active,
.btn-danger:active,
.modal-close:active {
    transform: translateY(1px) scale(0.99);
    box-shadow: none;
}

@media (max-width: 420px) {
    .control-card h2 {
        font-size: 24px;
    }

    .control-note {
        font-size: 13px;
    }

    .tap-flow span {
        width: 100%;
        text-align: center;
    }
}
