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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

header {
    text-align: center;
    margin-bottom: 2rem;
}

header h1 {
    font-size: 1.8rem;
    font-style: italic;
    color: #333;
    margin-bottom: 0.25rem;
}

header .subtitle {
    color: #c00;
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 0;
    margin-bottom: 0;
}

.tab {
    flex: 1;
    padding: 0.75rem 1rem;
    border: none;
    background: #e8e8e8;
    color: #666;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.tab:first-child {
    border-radius: 12px 0 0 0;
}

.tab:last-child {
    border-radius: 0 12px 0 0;
}

.tab.active {
    background: #fff;
    color: #333;
    box-shadow: 0 -2px 0 #c00 inset;
}

.tab:hover:not(.active) {
    background: #ddd;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

form {
    background: #fff;
    border-radius: 0 0 12px 12px;
    padding: 2rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem 1.5rem;
    margin-bottom: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group.full-width {
    margin-top: 1rem;
}

label {
    font-weight: 600;
    font-size: 0.85rem;
    color: #555;
    margin-bottom: 0.3rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

input[type="text"],
input[type="date"],
select,
textarea {
    padding: 0.6rem 0.8rem;
    border: 1.5px solid #ddd;
    border-radius: 6px;
    font-size: 0.95rem;
    font-family: inherit;
    transition: border-color 0.2s;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #c00;
}

textarea {
    resize: vertical;
}

.upload-sections {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.upload-section h3 {
    font-size: 1rem;
    margin-bottom: 0.15rem;
}

.upload-section .help-text {
    font-size: 0.8rem;
    color: #888;
    margin-bottom: 0.5rem;
}

.drop-zone {
    border: 2px dashed #ccc;
    border-radius: 8px;
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    position: relative;
    min-height: 100px;
}

.drop-zone:hover,
.drop-zone.drag-over {
    border-color: #c00;
    background: #fff5f5;
}

.drop-zone.has-files {
    border-style: solid;
    border-color: #4caf50;
    background: #f8fff8;
}

.drop-zone.selected-zone {
    border-color: #c00;
    box-shadow: 0 0 0 2px rgba(204, 0, 0, 0.15);
}

.drop-zone.selected-zone.has-files {
    border-color: #4caf50;
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.15);
}

.drop-zone:focus {
    outline: none;
}

.paste-target-label {
    position: absolute;
    top: 6px;
    right: 8px;
    background: #c00;
    color: white;
    font-size: 0.65rem;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 3px;
    letter-spacing: 0.3px;
    pointer-events: none;
}

.drop-zone.has-files .paste-target-label {
    background: #4caf50;
}

@keyframes paste-confirm {
    0% { box-shadow: 0 0 0 2px rgba(204, 0, 0, 0.15); }
    50% { box-shadow: 0 0 0 4px rgba(76, 175, 80, 0.4); }
    100% { box-shadow: 0 0 0 2px rgba(204, 0, 0, 0.15); }
}

.drop-zone.paste-flash {
    animation: paste-confirm 0.6s ease;
}

.drop-zone-prompt {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    color: #888;
    font-size: 0.9rem;
}

.drop-zone-prompt .icon {
    font-size: 1.5rem;
}

.drop-zone-prompt .or {
    font-size: 0.75rem;
    color: #aaa;
}

.browse-btn {
    background: #eee;
    border: 1px solid #ccc;
    padding: 0.3rem 0.8rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: background 0.2s;
}

.browse-btn:hover {
    background: #ddd;
}

.file-input {
    display: none;
}

.preview-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.preview-item {
    position: relative;
    width: 100px;
    height: 80px;
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid #ddd;
}

.preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.preview-file {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: #f0f7f0;
    border: 1px solid #4caf50;
    border-radius: 4px;
    font-size: 0.85rem;
    color: #333;
    margin-top: 0.5rem;
}

.preview-file .file-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.preview-item .remove-btn {
    position: absolute;
    top: 2px;
    right: 2px;
    background: rgba(200,0,0,0.8);
    color: white;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.submit-btn {
    display: block;
    width: 100%;
    padding: 0.9rem;
    background: #c00;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    margin-top: 1rem;
}

.submit-btn:hover {
    background: #a00;
}

.submit-btn:disabled {
    background: #999;
    cursor: not-allowed;
}

.btn-loading {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-loading::before {
    content: "";
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

#result {
    background: #fff;
    border-radius: 12px;
    padding: 2rem;
    margin-top: 2rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

#result h2 {
    margin-bottom: 1rem;
    color: #4caf50;
}

#docLink a {
    display: inline-block;
    padding: 0.6rem 1.2rem;
    background: #4285f4;
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 600;
    margin-bottom: 1rem;
}

#docLink a:hover {
    background: #3367d6;
}

.report-sections {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.report-section {
    border: 1px solid #eee;
    border-bottom: none;
    padding: 1rem 1.25rem;
    background: #fafafa;
}

.report-section:first-child {
    border-radius: 6px 6px 0 0;
}

.report-section:last-child {
    border-bottom: 1px solid #eee;
    border-radius: 0 0 6px 6px;
}

.report-section .section-label {
    color: #c00;
    font-weight: 700;
    font-size: 0.8rem;
    margin-bottom: 0.4rem;
    display: block;
}

.section-text {
    font-size: 0.9rem;
    line-height: 1.7;
    white-space: pre-wrap;
    outline: none;
    padding: 0.5rem;
    border-radius: 4px;
    border: 1px solid transparent;
    transition: border-color 0.2s, background 0.2s;
    cursor: text;
}

.section-text:hover {
    border-color: #ddd;
    background: #fff;
}

.section-text:focus {
    border-color: #c00;
    background: #fff;
    box-shadow: 0 0 0 2px rgba(204, 0, 0, 0.1);
}

.section-revise {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
    align-items: center;
}

.revise-input {
    flex: 1;
    padding: 0.4rem 0.6rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.8rem;
    font-family: inherit;
}

.revise-input:focus {
    outline: none;
    border-color: #c00;
}

.revise-btn-small {
    padding: 0.4rem 0.75rem;
    background: #555;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s;
}

.revise-btn-small:hover {
    background: #333;
}

.revise-btn-small:disabled {
    background: #999;
    cursor: not-allowed;
}

.update-doc-btn {
    flex: 1;
    padding: 0.7rem;
    background: #4285f4;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.update-doc-btn:hover {
    background: #3367d6;
}

.update-doc-btn:disabled {
    background: #999;
    cursor: not-allowed;
}

.update-doc-btn.full-width {
    display: block;
    width: 100%;
    margin-top: 1.5rem;
    padding: 0.8rem;
    font-size: 1rem;
}

.doc-link-btn {
    display: inline-block;
    padding: 0.6rem 1.2rem;
    background: #4285f4;
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 600;
    margin-bottom: 1rem;
}

.doc-link-btn:hover {
    background: #3367d6;
}

@keyframes revised-highlight {
    0% { background: #fff9c4; }
    100% { background: transparent; }
}

.revised-flash {
    animation: revised-highlight 1s ease;
}

.error-msg {
    background: #fff0f0;
    border: 1px solid #fcc;
    color: #c00;
    padding: 1rem;
    border-radius: 6px;
    margin-top: 1rem;
}

/* Login page */
.login-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
}

.login-card {
    background: #fff;
    border-radius: 12px;
    padding: 2.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    text-align: center;
    max-width: 400px;
}

.login-desc {
    color: #666;
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
    line-height: 1.5;
}

.google-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.7rem 1.5rem;
    background: #fff;
    border: 2px solid #ddd;
    border-radius: 6px;
    color: #333;
    text-decoration: none;
    font-size: 1rem;
    font-weight: 500;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.google-btn:hover {
    border-color: #4285f4;
    box-shadow: 0 2px 6px rgba(66,133,244,0.2);
}

/* User bar */
.user-bar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
    font-size: 0.8rem;
}

.user-name {
    color: #888;
}

.logout-link {
    color: #c00;
    text-decoration: none;
    font-weight: 500;
}

.logout-link:hover {
    text-decoration: underline;
}

@media (max-width: 600px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
}
