/* === revai 共通スタイル (file-masking ベース) === */

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

body {
    font-family: "Hiragino Kaku Gothic ProN", "Noto Sans JP", sans-serif;
    background: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

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

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

/* ----- ヘッダー ----- */

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

.site-header h1 {
    font-size: 1.4rem;
}

.site-header h1 a {
    color: #333;
    text-decoration: none;
}

.header-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-email {
    color: #666;
    font-size: 0.85rem;
}

/* ----- フラッシュ ----- */

.flash-messages {
    margin-bottom: 1.5rem;
}

.flash {
    border-radius: 6px;
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.flash.flash-info {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1e40af;
}

.flash.flash-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

/* ----- カード ----- */

.card {
    background: #fff;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    margin-bottom: 1rem;
}

.card h2 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.card p.muted {
    color: #666;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

/* ----- ボタン ----- */

.btn {
    display: inline-block;
    flex-shrink: 0;
    padding: 0.55rem 1.2rem;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.15s;
    font-family: inherit;
}

.btn-primary {
    background: #2563eb;
    color: #fff;
}

.btn-primary:hover {
    background: #1d4ed8;
}

/* 送信中など操作を受け付けない状態 */
.btn:disabled,
.btn-small:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-primary:disabled:hover {
    background: #2563eb;
}

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

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

.btn-danger {
    background: #fff;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

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

.btn-small {
    padding: 0.3rem 0.7rem;
    font-size: 0.8rem;
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    color: #333;
    /* 幅の狭いテーブル列などでラベルが改行されないように */
    white-space: nowrap;
}

.btn-small:hover {
    background: #e5e7eb;
}

/* btn-small と同じサイズのまま危険操作を示す（並びで高さが揃うようにする） */
.btn-small-danger {
    background: #fff;
    border-color: #fecaca;
    color: #b91c1c;
}

.btn-small-danger:hover {
    background: #fef2f2;
}

/* ----- フォーム ----- */

.form-row {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.85rem;
    color: #555;
}

input[type="email"],
input[type="password"],
input[type="text"],
select,
textarea {
    width: 100%;
    padding: 0.55rem 0.7rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.9rem;
    font-family: inherit;
    background: #fff;
    color: #333;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

input[type="file"] {
    width: 100%;
    padding: 0.5rem;
    border: 2px dashed #cbd5e1;
    border-radius: 6px;
    cursor: pointer;
    background: #f9fafb;
}

.form-actions {
    margin-top: 1.5rem;
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

.form-actions.form-actions-full .btn {
    width: 100%;
}

/* ----- ログイン ----- */

.login-wrap {
    max-width: 380px;
    margin: 4rem auto;
    padding: 0 1rem;
}

.login-wrap h1 {
    text-align: center;
    font-size: 1.6rem;
    margin-bottom: 1.5rem;
    color: #111;
}

.login-card {
    background: #fff;
    border-radius: 8px;
    padding: 1.75rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.login-footer {
    text-align: center;
    color: #888;
    font-size: 0.75rem;
    margin-top: 1.5rem;
}

/* ----- ジョブリスト (home) ----- */

.upload-zone {
    background: #fff;
    border: 2px dashed #cbd5e1;
    border-radius: 8px;
    padding: 2rem 1.5rem;
    text-align: center;
    margin-bottom: 1.5rem;
}

.upload-zone p.hint {
    color: #666;
    font-size: 0.85rem;
    margin-top: 0.5rem;
}

.section-heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.section-heading h2 {
    font-size: 1rem;
    color: #444;
}

.section-heading .count {
    color: #888;
    font-size: 0.85rem;
}

.job-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.9rem 1.2rem;
    border-bottom: 1px solid #eef0f3;
    text-decoration: none;
    color: #333;
    transition: background 0.15s;
}

.job-item:last-child {
    border-bottom: none;
}

.job-item:hover {
    background: #f9fafb;
}

.job-item .job-title {
    font-weight: 600;
    margin-bottom: 0.15rem;
}

.job-item .job-meta {
    font-size: 0.8rem;
    color: #888;
}

.job-item .job-arrow {
    color: #cbd5e1;
}

.empty-state {
    padding: 2rem 1rem;
    text-align: center;
    color: #888;
    font-size: 0.9rem;
}

/* ----- サブナビ (ジョブ配下) ----- */

.subnav {
    display: flex;
    gap: 0.25rem;
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 1.25rem;
}

.subnav a {
    padding: 0.55rem 1rem;
    font-size: 0.88rem;
    color: #6b7280;
    text-decoration: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}

.subnav a:hover {
    color: #111;
}

.subnav a.active {
    color: #2563eb;
    border-bottom-color: #2563eb;
    font-weight: 600;
}

.breadcrumb {
    font-size: 0.85rem;
    color: #6b7280;
    margin-bottom: 0.5rem;
}

.breadcrumb a {
    color: #2563eb;
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

.job-title-row h1 {
    font-size: 1.25rem;
    margin-bottom: 0.25rem;
}

.job-title-row .job-meta {
    color: #888;
    font-size: 0.8rem;
    margin-bottom: 1rem;
}

/* ----- 対応表 ----- */

.toolbar-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}

.toolbar-row .filters {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

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

table.data-table {
    width: 100%;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    border-collapse: collapse;
    font-size: 0.88rem;
}

table.data-table th {
    text-align: left;
    background: #f9fafb;
    color: #6b7280;
    font-weight: 600;
    font-size: 0.78rem;
    padding: 0.6rem 0.9rem;
    border-bottom: 1px solid #eef0f3;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

table.data-table td {
    padding: 0.6rem 0.9rem;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}

table.data-table tr:last-child td {
    border-bottom: none;
}

table.data-table tr:hover td {
    background: #f9fafb;
}

.mono {
    font-family: "SF Mono", "Menlo", "Consolas", monospace;
    font-size: 0.82rem;
}

.cat-badge {
    display: inline-block;
    padding: 0.1rem 0.5rem;
    font-size: 0.72rem;
    border-radius: 4px;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    color: #374151;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.note-text {
    color: #6b7280;
    font-size: 0.8rem;
}

.help-note {
    color: #6b7280;
    font-size: 0.78rem;
    margin-top: 0.75rem;
}

/* ----- アンマスキング ----- */

.unmask-upload {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 1rem;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
    align-items: center;
}
.upload-slot {
    display: flex;
    flex-direction: column;
}
.upload-label {
    display: block;
    border: 2px dashed #cbd5e1;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}
.upload-label:hover {
    border-color: #6366f1;
    background: #eef2ff;
}
.upload-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: #1f2937;
}
.upload-desc {
    font-size: 0.75rem;
    color: #6b7280;
    margin-top: 0.15rem;
}
.upload-optional {
    color: #9ca3af;
    font-weight: 400;
    font-size: 0.75rem;
}
.upload-label input[type=file] {
    display: block;
    margin-top: 0.4rem;
    font-size: 0.8rem;
}
.upload-filename {
    margin-top: 0.3rem;
    font-size: 0.72rem;
    color: #6b7280;
    word-break: break-all;
}
.upload-action {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.4rem;
}

/* ----- アンマスク PDF プレビュー ----- */
.unmask-preview {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    padding: 0.75rem 1rem 1rem;
    margin-bottom: 1rem;
}
.preview-toolbar {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.75rem;
    font-size: 0.85rem;
    color: #374151;
}
.toolbar-sep {
    color: #d1d5db;
    padding: 0 0.2rem;
}
.preview-pair {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}
.preview-pane {
    display: flex;
    flex-direction: column;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    overflow: hidden;
}
.preview-pane-header {
    background: #f3f4f6;
    color: #374151;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0.4rem 0.6rem;
    border-bottom: 1px solid #e5e7eb;
}
.preview-image-wrap {
    background: #f9fafb;
    overflow: auto;
    max-height: 75vh;
    text-align: center;
    padding: 0.5rem;
}
.preview-image-wrap img {
    max-width: 100%;
    height: auto;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

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

.split-pair .pane {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    padding: 1rem;
}

.pane-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.78rem;
    color: #6b7280;
    margin-bottom: 0.5rem;
}

.pane textarea {
    border: none;
    padding: 0;
    resize: vertical;
    min-height: 14rem;
    background: transparent;
}

.pane textarea:focus {
    box-shadow: none;
}

.pane pre {
    font-family: "Hiragino Kaku Gothic ProN", "Noto Sans JP", sans-serif;
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 0.9rem;
}

.check-report {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
}

.check-report h3 {
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
}

.check-list li {
    list-style: none;
    margin: 0.4rem 0;
    display: flex;
    gap: 0.5rem;
    align-items: flex-start;
    font-size: 0.88rem;
}

.check-list .ok { color: #16a34a; }
.check-list .warn { color: #b45309; }
.check-list .err  { color: #b91c1c; }

/* ----- ログ ----- */

.action-badge {
    display: inline-block;
    padding: 0.1rem 0.5rem;
    font-size: 0.72rem;
    font-weight: 600;
    border-radius: 4px;
    color: #fff;
}

.action-badge.upload         { background: #6366f1; }
.action-badge.mask           { background: #2563eb; }
.action-badge.unmask         { background: #16a34a; }
.action-badge.export         { background: #475569; }
.action-badge.edit_mapping   { background: #f59e0b; color: #1f2937; }

/* ----- モーダル (Alpine.js 駆動) ----- */

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
    padding: 1rem;
}

.modal-card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    max-width: 420px;
    width: 100%;
    padding: 1.5rem;
}

.modal-card h3 {
    font-size: 1.05rem;
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-card .close {
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    font-size: 1.1rem;
}

.modal-card .help-box {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 0.6rem 0.75rem;
    margin-bottom: 0.75rem;
    font-size: 0.78rem;
    color: #475569;
    line-height: 1.45;
}

/* ----- 設定ページ ----- */

.settings-section {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1rem;
}

.settings-section h2 {
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6b7280;
    margin-bottom: 0.75rem;
}

.settings-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.9rem;
}

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

.settings-row .label {
    font-weight: 500;
}

.settings-row .desc,
.settings-section > .desc {
    color: #6b7280;
    font-size: 0.78rem;
}

.account-line {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.account-line .avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #2563eb;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.1rem;
}

.account-line .uid {
    color: #94a3b8;
    font-size: 0.72rem;
    font-family: "SF Mono", "Menlo", monospace;
}

/* === revai 拡張: ステータスバッジ === */

.badge {
    display: inline-block;
    padding: 0.1rem 0.5rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
    color: #fff;
    letter-spacing: 0.02em;
}

.badge-uploaded  { background: #6b7280; }
.badge-detected  { background: #6366f1; }
.badge-masked    { background: #2563eb; }
.badge-unmasked  { background: #16a34a; }

.warning-banner {
    background: rgba(180, 84, 26, 0.08);
    border: 1px solid rgba(180, 84, 26, 0.35);
    color: #B4541A;
    padding: 0.6rem 0.8rem;
    border-radius: 6px;
    margin-bottom: 0.6rem;
    font-size: 0.9rem;
}
