:root {
    --md-sys-color-primary: #bb86fc;
    --md-sys-color-on-primary: #000000;
    --md-sys-color-primary-container: #3700b3;
    --md-sys-color-on-primary-container: #e1e1e1;

    --md-sys-color-secondary: #03dac6;
    --md-sys-color-on-secondary: #000000;
    --md-sys-color-secondary-container: #018786;
    --md-sys-color-on-secondary-container: #e1e1e1;

    --md-sys-color-tertiary: #cf6679;
    --md-sys-color-on-tertiary: #000000;
    --md-sys-color-tertiary-container: #b00020;
    --md-sys-color-on-tertiary-container: #e1e1e1;

    --md-sys-color-background: #0a0a0a;
    --md-sys-color-on-background: #e1e1e1;

    --md-sys-color-surface: #121212;
    --md-sys-color-on-surface: #e1e1e1;
    --md-sys-color-surface-variant: #1e1e1e;
    --md-sys-color-on-surface-variant: #b0b0b0;

    --md-sys-color-outline: #2a2a2a;
    --md-sys-color-outline-variant: #1f1f1f;

    --md-sys-color-error: #cf6679;
    --md-sys-color-on-error: #000000;
    --md-sys-color-error-container: #8c1d1d;
    --md-sys-color-on-error-container: #e1e1e1;

    --md-sys-color-success: #10b981;
    --md-sys-color-warning: #f59e0b;

    --accent-cyan: #90d5ff;
    --accent-amber: #ffb000;
    --accent-green: #c5e1a5;
    --accent-purple: #b39ddb;

    --md-font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    --md-font-weight-light: 300;
    --md-font-weight-regular: 400;
    --md-font-weight-medium: 500;
    --md-font-weight-semibold: 600;
    --md-font-weight-bold: 700;

    --md-shape-extra-small: 4px;
    --md-shape-small: 8px;
    --md-shape-medium: 12px;
    --md-shape-large: 16px;
    --md-shape-extra-large: 28px;

    --md-elevation-1: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
    --md-elevation-2: 0 3px 6px rgba(0,0,0,0.15), 0 2px 4px rgba(0,0,0,0.12);
    --md-elevation-3: 0 10px 20px rgba(0,0,0,0.15), 0 3px 6px rgba(0,0,0,0.10);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--md-sys-color-background);
    color: var(--md-sys-color-on-background);
    font-family: var(--md-font-family);
    font-weight: var(--md-font-weight-regular);
    line-height: 1.5;
    overflow-x: hidden;
}

#app {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    padding-bottom: 40px;
}

header {
    padding: 16px 16px 0;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    background-color: var(--md-sys-color-surface);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
}

.header-info {
    display: flex;
    flex-direction: column;
}

.logo-v3 {
    font-size: 1.75rem;
    font-weight: var(--md-font-weight-bold);
    color: var(--md-sys-color-primary);
    letter-spacing: 0;
}

.sys-id {
    font-size: 0.75rem;
    color: var(--md-sys-color-on-surface-variant);
    margin-top: 4px;
    font-weight: var(--md-font-weight-regular);
}

.status-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    background: var(--md-sys-color-success);
    border-radius: 50%;
    margin-right: 4px;
}

.card {
    background: var(--md-sys-color-surface);
    border-radius: var(--md-shape-large);
    padding: 16px;
    margin: 12px 16px;
    border: 1px solid var(--md-sys-color-outline);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
    transition: box-shadow 0.2s ease;
}

.section-label {
    font-size: 0.85rem;
    color: var(--md-sys-color-primary);
    letter-spacing: 0.5px;
    margin: 24px 16px 8px;
    font-weight: var(--md-font-weight-semibold);
    text-transform: uppercase;
}

/* Profile Card */
.profile-card {
    display: flex;
    align-items: center;
    gap: 16px;
}

.avatar-hex {
    width: 56px;
    height: 56px;
    background: var(--md-sys-color-primary-container);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: var(--md-sys-color-primary);
    border: none;
    box-shadow: var(--md-elevation-1);
}

.profile-details h2 {
    font-size: 1.4rem;
    font-weight: var(--md-font-weight-bold);
    color: var(--md-sys-color-on-surface);
}

.profile-details .sub-label {
    font-size: 0.75rem;
    color: var(--md-sys-color-on-surface-variant);
    text-transform: uppercase;
    font-weight: var(--md-font-weight-medium);
}

.location-label {
    font-size: 0.85rem;
    color: var(--md-sys-color-on-surface-variant);
    display: flex;
    align-items: center;
    gap: 4px;
}

.badge-active {
    margin-left: auto;
    background: rgba(56, 142, 60, 0.1);
    color: var(--md-sys-color-success);
    border: 1px solid var(--md-sys-color-success);
    font-size: 0.65rem;
    padding: 4px 8px;
    border-radius: var(--md-shape-small);
    text-transform: uppercase;
    font-weight: var(--md-font-weight-medium);
}

/* Biometrics Stream */
.biometrics-main {
    margin-bottom: 12px;
}

.large-value {
    font-size: 2.2rem;
    font-weight: var(--md-font-weight-semibold);
    color: var(--md-sys-color-secondary);
}

.stream-label {
    font-size: 0.85rem;
    color: var(--md-sys-color-on-surface-variant);
    display: flex;
    justify-content: space-between;
    font-weight: var(--md-font-weight-medium);
}

.live-feed-text {
    color: var(--md-sys-color-warning);
    font-weight: var(--md-font-weight-semibold);
    font-size: 0.75rem;
}

.data-list {
    margin: 12px 16px;
    border: none;
    box-shadow: var(--md-elevation-1);
    border-radius: var(--md-shape-large);
    background: var(--md-sys-color-surface);
}

.list-item {
    display: flex;
    padding: 16px;
    border-bottom: 1px solid var(--md-sys-color-surface-variant);
    align-items: center;
}

.list-item:last-child {
    border-bottom: none;
}

.item-num {
    font-size: 0.8rem;
    color: var(--md-sys-color-primary);
    margin-right: 16px;
    font-weight: var(--md-font-weight-bold);
}

.item-main {
    flex: 1;
}

.item-title {
    font-size: 0.95rem;
    font-weight: var(--md-font-weight-medium);
    color: var(--md-sys-color-on-surface);
}

.item-subtitle {
    font-size: 0.75rem;
    color: var(--md-sys-color-on-surface-variant);
    margin-top: 4px;
}

.item-val {
    color: var(--md-sys-color-secondary);
    font-weight: var(--md-font-weight-semibold);
    font-size: 0.95rem;
}

/* Timeline */
.timeline {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.timeline-item {
    display: flex;
    gap: 16px;
}

.time-year {
    font-size: 0.85rem;
    color: var(--md-sys-color-secondary);
    font-weight: var(--md-font-weight-bold);
    min-width: 40px;
}

.time-line {
    width: 2px;
    background: var(--md-sys-color-outline-variant);
    position: relative;
}

.time-content {
    font-size: 0.9rem;
    padding-bottom: 8px;
    color: var(--md-sys-color-on-surface);
    font-weight: var(--md-font-weight-regular);
}

/* Footer Button */
.footer-actions {
    margin: 32px 16px;
}

.reinit-btn {
    width: 100%;
    padding: 16px;
    border-radius: var(--md-shape-large);
    background: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
    border: none;
    font-family: var(--md-font-family);
    font-weight: var(--md-font-weight-semibold);
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-transform: uppercase;
    cursor: pointer;
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

.reinit-btn:hover {
    background-color: #0a3a87;
    box-shadow: var(--md-elevation-2);
}

/* Form Styles */
.input-screen {
    padding: 24px 16px;
}

.input-field {
    background: var(--md-sys-color-surface);
    border: 2px solid var(--md-sys-color-outline-variant);
    border-radius: var(--md-shape-medium);
    color: var(--md-sys-color-on-surface);
    padding: 12px 16px;
    width: 100%;
    margin-top: 8px;
    font-family: var(--md-font-family);
    font-size: 0.95rem;
    transition: border-color 0.2s ease;
}

.input-field:focus {
    outline: none;
    border-color: var(--md-sys-color-primary);
    box-shadow: 0 0 0 3px rgba(13, 71, 161, 0.1);
}

.input-field::placeholder {
    color: var(--md-sys-color-on-surface-variant);
}

.btn-primary {
    background: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
    padding: 14px 24px;
    border-radius: var(--md-shape-large);
    border: none;
    font-weight: var(--md-font-weight-semibold);
    width: 100%;
    margin-top: 16px;
    text-transform: uppercase;
    font-family: var(--md-font-family);
    font-size: 0.95rem;
    cursor: pointer;
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

.btn-primary:hover {
    background-color: #0a3a87;
    box-shadow: var(--md-elevation-2);
}

.hidden { display: none !important; }

.stellar-card {
    background: var(--md-sys-color-surface);
    border: none;
    border-radius: var(--md-shape-large);
    padding: 16px;
    flex: 1;
    box-shadow: var(--md-elevation-1);
}

.stellar-title {
    font-size: 1.4rem;
    color: var(--md-sys-color-tertiary);
    font-weight: var(--md-font-weight-bold);
    text-transform: uppercase;
}

.badge-stone {
    background: var(--md-sys-color-surface-variant);
    font-size: 0.7rem;
    padding: 4px 8px;
    border-radius: var(--md-shape-small);
    color: var(--md-sys-color-on-surface-variant);
    border: 1px solid var(--md-sys-color-outline-variant);
    font-weight: var(--md-font-weight-medium);
}

/* Loading */
.loading-box {
    text-align: center;
    padding: 40px 20px;
}

.progress-bar {
    height: 4px;
    background: var(--md-sys-color-surface-variant);
    border-radius: 2px;
    margin: 20px 0;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--md-sys-color-primary);
    width: 0%;
    transition: width 0.2s;
}

/* Utilities */
.flex-row { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.pointer { cursor: pointer; }
.relative { position: relative; }
.display-block { display: block; }
.flex-1 { flex: 1; }
.gap-sm { gap: 8px; }
.margin-top-sm { margin-top: 8px; }
.margin-top-md { margin-top: 12px; }
.margin-bottom-md { margin-bottom: 12px; }
.margin-vertical-md { margin-top: 12px; margin-bottom: 12px; }
.margin-left-sm { margin-left: 8px; }
.padding-xs-rect { padding: 6px 12px; }
.color-purple { color: var(--accent-purple); }
.color-amber { color: var(--accent-amber); }
.font-weight-bold { font-weight: 700; }
.link-no-decor { color: inherit; text-decoration: none; }

.badge-purple {
    background: rgba(179, 157, 219, 0.1) !important;
    color: var(--accent-purple) !important;
}

.border-amber {
    border-color: var(--accent-amber) !important;
}

.divider {
    border: 0;
    border-top: 1px solid var(--border-color);
    margin: 16px 0;
}

.avatar-img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

/* Refined Timeline */
.time-line::after {
    content: '';
    position: absolute;
    top: 6px;
    left: -5px;
    width: 8px;
    height: 8px;
    background: var(--md-sys-color-primary);
    border-radius: 50%;
    box-shadow: 0 0 0 2px var(--md-sys-color-surface);
}

/* Fingerprint Placeholder */

/* Animations */
@keyframes pulse-warning {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

.live-feed-text::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    background: var(--md-sys-color-warning);
    border-radius: 50%;
    margin-right: 6px;
    animation: pulse-warning 1s infinite;
}

/* Timeline specific refinements */
.timeline-item {
    margin-bottom: 20px;
}

.time-content {
    font-size: 0.8rem;
    line-height: 1.4;
    color: var(--text-primary);
}

/* Section labels refinement */
.section-label {
    border-left: 3px solid var(--md-sys-color-primary);
    padding-left: 10px;
    background: linear-gradient(90deg, rgba(13, 71, 161, 0.05), transparent);
}

/* Custom scrollbar */

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: var(--md-sys-color-background);
}
::-webkit-scrollbar-thumb {
    background: var(--md-sys-color-outline-variant);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--md-sys-color-outline);
}

/* Collapsible Section Styles */
.collapsible-section {
    margin-bottom: 8px;
}

.section-content {
    transition: all 0.3s ease-in-out;
}

.toggle-arrow {
    font-size: 0.8rem;
    color: var(--md-sys-color-primary);
    transition: transform 0.2s ease;
}

/* PDF Export Polish */
@media print {
    body { background: #fff !important; color: #1b1b1f !important; }
    .card, .data-list { border-color: #ccc !important; background: #fff !important; color: #1b1b1f !important; box-shadow: none !important; }
    .reinit-btn, #settings-btn, .footer-actions { display: none !important; }
    .section-label { color: #0d47a1 !important; border-left-color: #0d47a1 !important; }
    .large-value, .item-val, .val, .time-year { color: #1565c0 !important; }
    .item-subtitle, .lbl, .sub-label { color: #666 !important; }
    header { box-shadow: none !important; }
}

/* Ensure sub-sections in results are readable */
.sub-toggle-arrow {
    font-size: 0.7rem;
    opacity: 0.7;
}

#results-section a:hover {
    color: var(--accent-amber);
    border-bottom-style: solid;
}

/* New classes for dark theme and to replace inline styles */
.settings-icon {
    cursor: pointer;
    background: transparent;
    border: none;
    padding: 8px;
    border-radius: 50%;
    color: var(--md-sys-color-on-surface);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s, transform 0.2s;
    outline: none;
}

.settings-icon:hover {
    background-color: var(--md-sys-color-surface-variant);
    transform: rotate(30deg);
}

.settings-icon svg {
    width: 22px;
    height: 22px;
}

.auth-header {
    margin-bottom: 16px;
    font-size: 0.8rem;
    color: var(--accent-cyan);
    font-weight: 700;
}

.form-field-wrapper {
    margin-bottom: 12px;
}

.btn-scan {
    background: var(--accent-amber) !important;
    color: #000 !important;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.modal-card {
    width: 85%;
    max-width: 360px;
    border: 1px solid var(--accent-cyan) !important;
}

.modal-title {
    color: var(--accent-cyan);
    font-size: 0.8rem;
    margin-bottom: 16px;
    text-transform: uppercase;
    font-weight: 700;
}

.btn-puter {
    margin-bottom: 16px;
}

.puter-info {
    margin-bottom: 16px;
}

.username-accent {
    color: var(--accent-green);
}

.modules-title {
    margin-bottom: 8px;
}

.modules-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.modal-actions {
    display: flex;
    gap: 8px;
    margin-top: 24px;
}

.btn-modal {
    margin: 0 !important;
    flex: 1;
}

.btn-cancel {
    background: var(--md-sys-color-surface-variant) !important;
    color: var(--md-sys-color-on-surface) !important;
}

.notification-toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--accent-green);
    color: #000;
    border: 2px solid #fff;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.8rem;
    z-index: 2000;
    box-shadow: 0 0 20px rgba(197, 225, 165, 0.3);
}

.border-subtle {
    border-color: var(--border-color) !important;
}

.opacity-low {
    opacity: 0.05;
}

.absolute-bottom-right {
    position: absolute;
    bottom: 0;
    right: 0;
}

.font-large-icon {
    font-size: 4rem;
}

.padding-sm-rect {
    padding: 8px 12px;
}

.font-size-sm {
    font-size: 0.8rem;
}

.font-size-xs {
    font-size: 0.75rem;
}

.link-dashed {
    border-bottom: 1px dashed var(--md-sys-color-outline);
}

.link-dashed-cyan {
    border-bottom: 1px dashed var(--accent-cyan);
}
