* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    height: 100%;
}

body {
    font-family: Arial, sans-serif;
    background: #f5f7fb;
    color: #1f2937;
    overflow: auto;
}

.container {
    width: 90%;
    max-width: 1400px;
    margin: 0 auto;
}

.topbar {
    background: #ffffff;
    border-bottom: 1px solid #e5e7eb;
    padding: 20px 0;
    margin-bottom: 30px;
}

.logo {
    font-size: 28px;
    font-weight: 700;
}

.page-content {
    min-height: calc(100vh - 110px);
    padding-bottom: 20px;
}

.card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}

.page-title {
    font-size: 32px;
    margin-bottom: 20px;
}

.text-muted {
    color: #6b7280;
}

.app-main {
    display: grid;
    grid-template-columns: 240px 360px minmax(0, 1fr);
    gap: 20px;
    align-items: start;
}

.panel {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 18px;
    padding: 20px;
    min-width: 0;
}

.app-main > .panel:first-child {
    position: sticky;
    top: 20px;
}

.app-main > .panel:nth-child(2) {
    max-height: calc(100vh - 170px);
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-gutter: stable;
}

.app-main > .panel:nth-child(3) {
    max-height: none;
    overflow: visible;
}

.sidebar-link {
    display: block;
    padding: 12px 14px;
    border-radius: 12px;
    color: #1f2937;
    text-decoration: none;
    margin-bottom: 8px;
    font-weight: 600;
}

.sidebar-link:hover {
    background: #f3f4f6;
}

.sidebar-link.active {
    background: #e9eefb;
}

.receipt-item {
    display: block;
    padding: 14px;
    border-radius: 14px;
    text-decoration: none;
    color: #1f2937;
    border: 1px solid transparent;
    margin-bottom: 12px;
}

.receipt-item:hover {
    background: #f9fafb;
    border-color: #e5e7eb;
}

.receipt-item.active {
    background: #eef2ff;
    border-color: #c7d2fe;
}

.receipt-subject {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 6px;
}

.receipt-meta {
    font-size: 14px;
    color: #6b7280;
    margin-bottom: 6px;
}

.receipt-preview {
    font-size: 15px;
    color: #374151;
}

.preview-title {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 10px;
    word-break: break-word;
}

.preview-meta {
    color: #6b7280;
    margin-bottom: 20px;
    word-break: break-word;
}

.empty-state {
    color: #6b7280;
    font-size: 16px;
}

.receipt-item,
.receipt-preview,
.receipt-meta,
.receipt-subject {
    word-break: break-word;
}

.panel iframe,
.panel img,
.panel table,
.panel div {
    max-width: 100%;
}

@media (max-width: 1100px) {
    .app-main {
        grid-template-columns: 1fr;
    }

    .app-main > .panel:first-child {
        position: static;
    }

    .app-main > .panel:nth-child(2),
    .app-main > .panel:nth-child(3) {
        max-height: none;
        overflow: visible;
    }
}