/* ===================================
   請求書管理システム スタイルシート
   =================================== */

/* --- Reset & Base --- */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Hiragino Kaku Gothic ProN', 'Hiragino Sans', 'Meiryo', 'Noto Sans JP', sans-serif;
    background-color: #f0f2f5;
    color: #333;
    line-height: 1.7;
    font-size: 15px;
}

/* --- Layout --- */
.container {
    max-width: 820px;
    margin: 0 auto;
    padding: 24px 16px;
}

header {
    margin-bottom: 28px;
}

.procedure-card {
    background: #fff;
    padding: 18px 20px;
    border-radius: 10px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    margin: 0 0 18px;
}

.procedure-card h2 {
    margin-bottom: 10px;
    font-size: 1.05em;
}

.procedure-card ol {
    padding-left: 20px;
    color: #444;
    font-size: 0.95em;
}

.procedure-card a {
    color: #1a73e8;
    text-decoration: none;
}

.procedure-card a:hover {
    text-decoration: underline;
}

h1 {
    text-align: center;
    color: #2c3e50;
    font-size: 1.7em;
    border-bottom: 3px solid #3498db;
    padding-bottom: 12px;
    letter-spacing: 0.05em;
}

h2 {
    color: #2c3e50;
    margin-bottom: 16px;
    font-size: 1.2em;
    padding-left: 4px;
    border-left: 4px solid #3498db;
    padding-left: 10px;
}

footer {
    text-align: center;
    margin-top: 40px;
    padding-top: 16px;
    border-top: 1px solid #ddd;
    color: #999;
    font-size: 0.85em;
}

/* --- Flash Message --- */
.message {
    padding: 12px 18px;
    border-radius: 6px;
    margin-bottom: 24px;
    font-size: 0.95em;
    line-height: 1.5;
}

.message.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.message.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.message.info {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* --- Form Section --- */
.form-section {
    background: #fff;
    padding: 28px;
    border-radius: 10px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    margin-bottom: 32px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: bold;
    color: #555;
    font-size: 0.95em;
}

.form-group input[type="month"],
.form-group input[type="number"],
.form-group input[type="text"] {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 1em;
    font-family: inherit;
    transition: border-color 0.2s ease;
    background-color: #fafafa;
}

.form-group input:focus {
    border-color: #3498db;
    outline: none;
    background-color: #fff;
}

.form-group input::placeholder {
    color: #bbb;
}

/* Calculated billing amount */
.form-group.calculated {
    background: #eef6ff;
    padding: 14px 18px;
    border-radius: 6px;
    border-left: 4px solid #3498db;
}

.form-group.calculated label {
    margin-bottom: 4px;
    font-size: 0.88em;
    color: #666;
}

#billing_amount_display {
    font-size: 1.6em;
    font-weight: bold;
    color: #2c3e50;
    letter-spacing: 0.02em;
}

/* --- Buttons --- */
.btn {
    display: inline-block;
    padding: 10px 24px;
    border: none;
    border-radius: 6px;
    font-size: 1em;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.2s ease, transform 0.1s ease;
    line-height: 1.4;
}

.btn:hover {
    opacity: 0.92;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background-color: #3498db;
    color: #fff;
    width: 100%;
    font-size: 1.1em;
    padding: 13px;
    font-weight: bold;
    letter-spacing: 0.05em;
}

.btn-primary:hover {
    background-color: #2980b9;
}

.btn-small {
    padding: 5px 14px;
    font-size: 0.82em;
    border-radius: 4px;
}

.btn-download {
    background-color: #6c757d;
    color: #fff;
}

.btn-download:hover {
    background-color: #5a6268;
}

.btn-send {
    background-color: #28a745;
    color: #fff;
}

.btn-send:hover {
    background-color: #218838;
}

/* --- History Section --- */
.history-section {
    background: #fff;
    padding: 28px;
    border-radius: 10px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

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

table {
    width: 100%;
    border-collapse: collapse;
}

thead th {
    background: #f8f9fa;
    padding: 11px 12px;
    text-align: left;
    font-size: 0.88em;
    color: #555;
    border-bottom: 2px solid #dee2e6;
    white-space: nowrap;
}

tbody td {
    padding: 10px 12px;
    border-bottom: 1px solid #eee;
    vertical-align: middle;
}

tbody tr:hover {
    background-color: #f8f9fa;
}

.amount {
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-family: 'Consolas', 'Monaco', monospace;
    white-space: nowrap;
}

/* --- Badges --- */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.78em;
    font-weight: bold;
    white-space: nowrap;
}

.badge.sent {
    background-color: #d4edda;
    color: #155724;
}

.badge.unsent {
    background-color: #fff3cd;
    color: #856404;
}

.sent-date {
    display: block;
    font-size: 0.75em;
    color: #999;
    margin-top: 2px;
}

/* --- Actions column --- */
.actions {
    white-space: nowrap;
    display: flex;
    gap: 6px;
    align-items: center;
}

.inline-form {
    display: inline;
}

.no-data {
    text-align: center;
    color: #999;
    padding: 36px;
    font-size: 0.95em;
}

/* --- Responsive --- */
@media (max-width: 640px) {
    .container {
        padding: 12px 8px;
    }

    .form-section,
    .history-section {
        padding: 18px 14px;
    }

    h1 {
        font-size: 1.4em;
    }

    table {
        font-size: 0.82em;
    }

    thead th,
    tbody td {
        padding: 8px 6px;
    }

    .actions {
        flex-direction: column;
        gap: 4px;
    }

    .btn-small {
        width: 100%;
        text-align: center;
    }
}
