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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Hiragino Sans", "Noto Sans JP", sans-serif;
    background: #f5f7fa;
    color: #333;
    line-height: 1.6;
    padding: 2rem 1rem;
}

.container {
    max-width: 640px;
    margin: 0 auto;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    padding: 2rem;
}

.container-small {
    max-width: 420px;
}

.container-wide {
    max-width: 1280px;
}

h1 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: #1a1a1a;
    border-bottom: 2px solid #4a90d9;
    padding-bottom: 0.5rem;
}

.lead {
    margin-bottom: 1.5rem;
    color: #666;
}

/* Form */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.4rem;
    font-size: 0.95rem;
}

.required {
    color: #e53e3e;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="tel"],
.form-group input[type="password"],
.form-group textarea {
    width: 100%;
    padding: 0.6rem 0.8rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #4a90d9;
    box-shadow: 0 0 0 3px rgba(74, 144, 217, 0.15);
}

.form-group textarea {
    resize: vertical;
}

/* Buttons */
.form-actions {
    margin-top: 1.5rem;
    display: flex;
    gap: 0.75rem;
    justify-content: center;
}

.btn {
    display: inline-block;
    padding: 0.65rem 1.8rem;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    transition: background-color 0.2s;
}

.btn-primary {
    background: #4a90d9;
    color: #fff;
}

.btn-primary:hover {
    background: #357abd;
}

.btn-secondary {
    background: #e2e8f0;
    color: #333;
}

.btn-secondary:hover {
    background: #cbd5e0;
}

.btn-small {
    padding: 0.4rem 1rem;
    font-size: 0.85rem;
}

/* Errors */
.errors {
    background: #fff5f5;
    border: 1px solid #fc8181;
    border-radius: 4px;
    padding: 0.8rem 1rem;
    margin-bottom: 1.25rem;
    color: #c53030;
}

.errors ul {
    list-style: disc;
    padding-left: 1.2rem;
}

/* Confirm table */
.confirm-table {
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
}

.confirm-row {
    display: flex;
    border-bottom: 1px solid #e2e8f0;
}

.confirm-row:last-child {
    border-bottom: none;
}

.confirm-label {
    flex: 0 0 160px;
    background: #f7fafc;
    padding: 0.75rem 1rem;
    font-weight: 600;
    font-size: 0.9rem;
}

.confirm-value {
    flex: 1;
    padding: 0.75rem 1rem;
    word-break: break-word;
}

/* Complete */
.complete-message {
    text-align: center;
    padding: 2rem 0;
    color: #555;
}

.complete-message p {
    margin-bottom: 0.5rem;
}

/* Admin */
.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.admin-header h1 {
    margin-bottom: 0;
    border-bottom: none;
    padding-bottom: 0;
}

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

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

thead th {
    background: #4a90d9;
    color: #fff;
    padding: 0.6rem 0.8rem;
    text-align: left;
    white-space: nowrap;
}

tbody td {
    padding: 0.6rem 0.8rem;
    border-bottom: 1px solid #e2e8f0;
    vertical-align: top;
}

tbody tr:hover {
    background: #f7fafc;
}

.message-cell {
    min-width: 300px;
    max-width: 480px;
    word-break: break-word;
    white-space: pre-line;
}

.nowrap {
    white-space: nowrap;
}

.empty-message {
    text-align: center;
    padding: 2rem;
    color: #999;
}

/* Settings */
.success {
    background: #f0fff4;
    border: 1px solid #68d391;
    border-radius: 4px;
    padding: 0.8rem 1rem;
    margin-bottom: 1.25rem;
    color: #276749;
}

.blocked-form {
    margin-bottom: 1.5rem;
}

.input-row {
    display: flex;
    gap: 0.5rem;
}

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

.input-row input:focus {
    outline: none;
    border-color: #4a90d9;
    box-shadow: 0 0 0 3px rgba(74, 144, 217, 0.15);
}

.btn-danger {
    background: #e53e3e;
    color: #fff;
}

.btn-danger:hover {
    background: #c53030;
}

/* Checkbox group */
.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.2rem;
    padding: 0.6rem 0;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: normal;
    font-size: 0.95rem;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 1.1rem;
    height: 1.1rem;
    cursor: pointer;
}

/* Settings section title */
.settings-section-title {
    font-size: 1.2rem;
    margin-top: 2rem;
    margin-bottom: 1rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid #e2e8f0;
    color: #1a1a1a;
}

.settings-section-title:first-of-type {
    margin-top: 0;
}

/* File upload */
.form-group input[type="file"] {
    width: 100%;
    padding: 0.6rem 0;
    font-size: 1rem;
    font-family: inherit;
}

.file-hint {
    margin-top: 0.3rem;
    font-size: 0.85rem;
    color: #888;
}

.image-note {
    margin-bottom: 0.4rem;
    font-size: 0.85rem;
    color: #4a90d9;
}

.image-preview {
    max-width: 100%;
    max-height: 300px;
    margin-top: 0.5rem;
    border-radius: 4px;
    border: 1px solid #e2e8f0;
}

.admin-thumbnail {
    max-width: 80px;
    max-height: 60px;
    border-radius: 3px;
    border: 1px solid #e2e8f0;
    vertical-align: middle;
}

/* Admin tabs */
.admin-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 1.25rem;
    border-bottom: 2px solid #e2e8f0;
}

.admin-tab {
    display: inline-block;
    padding: 0.6rem 1.5rem;
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    color: #666;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color 0.2s, border-color 0.2s;
}

.admin-tab:hover {
    color: #4a90d9;
}

.admin-tab.active {
    color: #4a90d9;
    border-bottom-color: #4a90d9;
}

/* Action links */
.action-link {
    color: #e53e3e;
    text-decoration: none;
    font-size: 0.85rem;
    white-space: nowrap;
}

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

/* Bulk actions & read status */
.bulk-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.row-read {
    background: #f0f0f0 !important;
    color: #999;
}

.row-read:hover {
    background: #e8e8e8 !important;
}

.row-read a {
    color: #999;
}

th.check-col,
td.check-col {
    width: 40px;
    text-align: center;
}

th.check-col input,
td.check-col input {
    width: 1.1rem;
    height: 1.1rem;
    cursor: pointer;
}

/* Pagination */
.pagination-info {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 0.75rem;
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.25rem;
    margin-top: 1.25rem;
    flex-wrap: wrap;
}

.pagination a,
.pagination .current,
.pagination .disabled,
.pagination .dots {
    display: inline-block;
    padding: 0.4rem 0.75rem;
    font-size: 0.9rem;
    border-radius: 4px;
    text-decoration: none;
}

.pagination a {
    color: #4a90d9;
    border: 1px solid #e2e8f0;
}

.pagination a:hover {
    background: #edf2f7;
    border-color: #4a90d9;
}

.pagination .current {
    background: #4a90d9;
    color: #fff;
    font-weight: 600;
    border: 1px solid #4a90d9;
}

.pagination .disabled {
    color: #a0aec0;
    border: 1px solid #e2e8f0;
    cursor: default;
}

.pagination .dots {
    border: none;
    color: #999;
}

/* Modal */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-overlay.is-visible {
    display: flex;
}

.modal-box {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
    padding: 2rem;
    max-width: 420px;
    width: 90%;
    animation: modalIn 0.2s ease-out;
}

@keyframes modalIn {
    from { opacity: 0; transform: translateY(-16px); }
    to { opacity: 1; transform: translateY(0); }
}

.modal-message {
    font-size: 0.95rem;
    color: #333;
    line-height: 1.7;
    margin-bottom: 1.5rem;
    text-align: center;
}

.modal-actions {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
}

/* Responsive */
@media (max-width: 600px) {
    body {
        padding: 1rem 0.5rem;
    }

    .container {
        padding: 1.25rem;
    }

    .confirm-row {
        flex-direction: column;
    }

    .confirm-label {
        flex: none;
    }

    .form-actions {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }
}
