:root {
    --primary-color: #2b2e4a; /* 深いネイビー: 信頼感 */
    --accent-color: #4a90e2;  /* アクセントブルー: アクション */
    --text-color: #333333;
    --sub-text-color: #666666;
    --border-color: #e0e0e0;
    --bg-color: #f9f9f9;
    --white: #ffffff;
    --error-color: #e74c3c;
    --spacing-unit: 16px;
}

body {
    font-family: 'Noto Sans JP', -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--text-color);
    background-color: var(--bg-color);
    line-height: 1.6;
    margin: 0;
    -webkit-font-smoothing: antialiased;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 40px 20px;
}

/* Header */
.simple-header {
    text-align: left;
    margin-bottom: 40px;
}

.brand-name {
    font-size: 20px;
    font-weight: 700;
    margin: 0 0 30px 0;
    color: var(--primary-color);
    letter-spacing: 0.05em;
}

/* Progress Bar (Minimal) */
.step-nav {
    margin-bottom: 40px;
}
.progressbar {
    display: flex;
    justify-content: space-between;
    list-style: none;
    padding: 0;
    margin: 0;
    position: relative;
}
.progressbar li {
    font-size: 12px;
    color: #ccc;
    position: relative;
    font-weight: 500;
}
.progressbar li.active {
    color: var(--primary-color);
    font-weight: 700;
}
/* ステップ間のライン */
.progressbar::before {
    content: '';
    position: absolute;
    top: 24px;
    left: 0;
    width: 100%;
    height: 1px;
    background: #eee;
    z-index: -1;
}
.progressbar li::after {
    content: ''; /* ドット */
    display: block;
    width: 8px;
    height: 8px;
    background: #eee;
    border-radius: 50%;
    margin-top: 8px;
    margin-left: auto;
    margin-right: auto;
    transition: background 0.3s;
}
.progressbar li.active::after {
    background: var(--accent-color);
    transform: scale(1.2);
}

/* Sections */
.form-step {
    display: none;
    animation: slideIn 0.4s ease-out;
}
.form-step.active {
    display: block;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.section-header {
    margin-bottom: 30px;
}
h2 {
    font-size: 24px;
    margin: 0 0 10px 0;
    font-weight: 500;
}
.section-desc {
    color: var(--sub-text-color);
    font-size: 14px;
    margin: 0;
}

/* Form Groups & Cards */
.form-group-block {
    background: var(--white);
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.03); /* 非常に繊細な影 */
    margin-bottom: 30px;
}
h3 {
    font-size: 16px;
    margin: 0 0 20px 0;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
    color: var(--primary-color);
}

/* Grid Layout */
.grid-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}
.grid-item.full { grid-column: span 2; }
.grid-item.double { grid-column: span 2; }
@media (min-width: 600px) {
    .grid-item.double { grid-column: span 1.5; }
}

/* Inputs */
.field-label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: var(--sub-text-color);
    margin-bottom: 8px;
}
.req-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    background-color: var(--error-color);
    border-radius: 50%;
    margin-left: 4px;
    vertical-align: middle;
}

.simple-input {
    width: 100%;
    padding: 12px 0;
    border: none;
    border-bottom: 1px solid var(--border-color); /* 下線のみ */
    font-size: 16px;
    border-radius: 0;
    background: transparent;
    transition: border-color 0.3s;
    box-sizing: border-box;
}
.simple-input:focus {
    outline: none;
    border-bottom-color: var(--accent-color);
}
.simple-input.large-text {
    font-size: 18px;
    font-weight: 500;
}
.simple-input.bg-gray {
    background-color: #fcfcfc;
    padding-left: 10px;
    border-bottom: none;
    border-radius: 4px;
}
.align-right { text-align: right; }

/* Radio & Checkbox (Pill Style) */
.radio-pill-group, .checkbox-simple-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.radio-pill-group label, .checkbox-simple-group label {
    cursor: pointer;
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 14px;
    color: var(--sub-text-color);
    transition: all 0.2s;
    display: flex;
    align-items: center;
}
.radio-pill-group input, .checkbox-simple-group input {
    display: none; /* デフォルトのラジオボタンを消す */
}
.radio-pill-group label:has(input:checked),
.checkbox-simple-group label:has(input:checked) {
    background-color: var(--primary-color);
    color: var(--white);
    border-color: var(--primary-color);
}

/* Money List Table Layout */
.money-list {
    display: grid;
    gap: 15px;
}
.money-row {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr;
    gap: 15px;
    align-items: center;
}
.money-row.header {
    font-size: 12px;
    color: var(--sub-text-color);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 5px;
}

/* Address Grid */
.address-grid {
    display: flex;
    gap: 10px;
}
.flex-grow { flex-grow: 1; }

/* Buttons */
.action-area {
    display: flex;
    justify-content: flex-end; /* 右寄せで推進力を表現 */
    gap: 15px;
    margin-top: 40px;
    align-items: center;
}
.btn-primary {
    background-color: var(--accent-color);
    color: white;
    border: none;
    padding: 12px 32px;
    font-size: 16px;
    border-radius: 4px; /* 少し角丸 */
    cursor: pointer;
    font-weight: 700;
    box-shadow: 0 4px 6px rgba(74, 144, 226, 0.2);
    transition: transform 0.1s;
}
.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 8px rgba(74, 144, 226, 0.3);
}
.btn-secondary {
    background: transparent;
    border: 1px solid var(--border-color);
    padding: 11px 24px;
    color: var(--sub-text-color);
    border-radius: 4px;
    cursor: pointer;
}
.btn-text {
    background: transparent;
    border: none;
    color: var(--sub-text-color);
    cursor: pointer;
    text-decoration: underline;
    margin-right: auto; /* 一時保存を左端へ */
    font-size: 14px;
}
.submit-btn {
    background-color: var(--primary-color);
    box-shadow: 0 4px 6px rgba(43, 46, 74, 0.2);
}

/* Footer */
.simple-footer {
    text-align: center;
    margin-top: 60px;
    color: #999;
    font-size: 12px;
}

/* --- Added for Responsiveness and Accessibility --- */

/* Focus Style for Accessibility */
.btn-primary:focus, .btn-secondary:focus, .btn-text:focus,
.radio-pill-group label:focus-within,
.checkbox-simple-group label:focus-within,
.simple-input:focus {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}
/* Adjust focus for bottom-border only inputs */
.simple-input:focus {
    outline-offset: 0;
}


/* Smartphone Layout Adjustments */
@media (max-width: 599px) {
    .container {
        padding: 20px 15px;
    }
    .form-group-block {
        padding: 20px;
    }
    .grid-row {
        grid-template-columns: 1fr; /* Force single column */
    }
    .grid-item.double {
        grid-column: span 1; /* Reset span on mobile */
    }
    .action-area {
        flex-direction: column; /* Stack buttons vertically */
        align-items: stretch;   /* Make buttons full-width */
    }
    .btn-primary, .btn-secondary, .btn-text {
        width: 100%;
        text-align: center;
        box-sizing: border-box;
    }
    .btn-text {
        margin-right: 0; /* Reset margin */
        order: 3;        /* Move 'Save' button to the bottom */
    }

    /* Adjust money table for mobile */
    .money-row {
        grid-template-columns: 1fr;
        gap: 8px;
        padding-bottom: 15px;
        border-bottom: 1px solid var(--border-color);
    }
    .money-row:last-child {
        border-bottom: none;
    }
    .money-row.header {
        display: none; /* Hide header on mobile */
    }
    .money-row label::before {
        /* Add labels for context, e.g., "税込金額: " */
        content: attr(for) ' (税込): ';
        font-weight: normal;
        color: var(--sub-text-color);
    }
      .money-row input[name$="_tax"] {
        display: none; /* Hide tax input for simplicity, or could be handled differently */
     }
}

/* ========================================
   Document Upload Styles
   ======================================== */
.upload-note {
    font-size: 13px;
    color: var(--sub-text-color);
    margin: -10px 0 20px 0;
}

.upload-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 16px;
}

.upload-slot {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.file-input {
    font-size: 14px;
    padding: 10px;
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: border-color 0.3s, background 0.3s;
}

.file-input:hover {
    border-color: var(--accent-color);
    background: rgba(74, 144, 226, 0.05);
}

.file-input:focus {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

.preview-container {
    min-height: 80px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fafafa;
    position: relative;
}

.preview-container img {
    max-width: 100%;
    max-height: 120px;
    object-fit: contain;
}

.preview-container .compressing-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 12px;
    color: var(--accent-color);
}

/* Mobile adjustments for upload grid */
@media (max-width: 599px) {
    .upload-grid {
        grid-template-columns: 1fr;
    }
}

/* ========================================
   Validation Error Styles
   ======================================== */
.error-message {
    display: block;
    color: var(--error-color);
    font-size: 12px;
    margin-top: 4px;
    animation: slideDown 0.2s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
