:root {
    --bg-0: #f5f2eb;
    --bg-1: #efe5d3;
    --ink-0: #252017;
    --ink-1: #4d4331;
    --line: #d8cdb9;
    --panel: rgba(255, 252, 246, 0.86);
    --sun: #d95f39;
    --teal: #0e8a89;
    --gold: #b38236;
    --ok: #1e8a61;
    --warn: #b26a1f;
    --err: #b53838;
    --shadow: 0 18px 40px rgba(94, 71, 36, 0.15);
    --workspace-sidebar-width: clamp(240px, 20vw, 320px);
    --workspace-header-height: 82px;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
}

body {
    min-height: 100vh;
    font-family: "Zen Kaku Gothic New", sans-serif;
    color: var(--ink-0);
    background:
        radial-gradient(1200px 600px at -8% -8%, rgba(217, 95, 57, 0.25), transparent 58%),
        radial-gradient(1000px 600px at 110% -10%, rgba(14, 138, 137, 0.2), transparent 62%),
        linear-gradient(180deg, var(--bg-0), var(--bg-1));
}

.backdrop {
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(120deg, transparent 0%, rgba(255, 255, 255, 0.4) 46%, transparent 62%),
        radial-gradient(circle at 90% 90%, rgba(179, 130, 54, 0.14), transparent 32%);
    z-index: -2;
}

.grain {
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image: radial-gradient(rgba(31, 22, 9, 0.12) 0.45px, transparent 0.45px);
    background-size: 3px 3px;
    opacity: 0.18;
    z-index: -1;
}

.layout {
    width: min(1180px, 95vw);
    margin: 36px auto 56px;
    display: grid;
    gap: 22px;
}

.workspace-topbar {
    position: fixed;
    top: 0;
    left: calc(var(--workspace-sidebar-width) + 16px);
    right: 16px;
    z-index: 24;
    width: auto;
    margin: 0;
    border: 1px solid var(--line);
    border-radius: 0 0 16px 16px;
    padding: 14px 16px;
    background: rgba(255, 252, 246, 0.9);
    box-shadow: var(--shadow);
}

.workspace-topbar h2 {
    margin: 0;
    font-family: "Zen Old Mincho", serif;
    font-size: 24px;
}

.portal-topbar {
    width: min(1160px, 96vw);
    margin: 18px auto 0;
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 14px 16px;
    background: rgba(255, 252, 246, 0.9);
    box-shadow: var(--shadow);
}

.portal-topbar h2 {
    margin: 0;
    font-family: "Zen Old Mincho", serif;
    font-size: 24px;
}

.portal-main {
    padding-top: 22px;
}

.workspace-shell {
    width: 100%;
    margin: 0;
    display: block;
}

.workspace-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 26;
    width: var(--workspace-sidebar-width);
    height: 100vh;
    border: 1px solid var(--line);
    border-radius: 0 20px 20px 0;
    background: var(--panel);
    backdrop-filter: blur(5px);
    box-shadow: var(--shadow);
    padding: 16px 14px 14px;
    display: grid;
    gap: 14px;
    overflow: hidden;
    align-content: start;
}

.sidebar-nav {
    display: grid;
    gap: 8px;
}

.sidebar-link {
    text-decoration: none;
    color: #3f3527;
    border: 1px solid #d9ceb9;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.82);
    padding: 10px 12px;
    font-size: 14px;
    font-weight: 600;
}

.sidebar-link:hover {
    border-color: #ce5330;
    color: #7d3a26;
}

.sidebar-link.active {
    border-color: #ce5330;
    color: #7d3a26;
    background: rgba(255, 239, 229, 0.92);
}

.sidebar-actions {
    display: grid;
    gap: 8px;
}

.sidebar-actions .btn-secondary {
    text-decoration: none;
    text-align: center;
}

.sidebar-session {
    display: grid;
    gap: 8px;
}

.workspace-main.layout {
    width: min(1180px, calc(100vw - var(--workspace-sidebar-width) - 40px));
    margin: calc(var(--workspace-header-height) + 16px) 16px 48px calc(var(--workspace-sidebar-width) + 20px);
}

.workspace-main section[id] {
    scroll-margin-top: calc(var(--workspace-header-height) + 20px);
}

.app-bar {
    width: min(1180px, 95vw);
    margin: 24px auto 0;
}

.app-bar-inner {
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 14px 16px;
    background: rgba(255, 252, 246, 0.9);
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: center;
    flex-wrap: wrap;
}

.app-bar-inner h2 {
    margin: 0;
    font-family: "Zen Old Mincho", serif;
    font-size: 22px;
}

.app-nav {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.session-badge {
    border: 1px solid #ccbda5;
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 12px;
    background: rgba(255, 255, 255, 0.82);
    color: #4e4538;
}

.session-badge strong {
    color: #7d3a26;
}

.auth-layout {
    min-height: 100vh;
    width: min(560px, 92vw);
    margin: 0 auto;
    display: grid;
    align-content: center;
}

.auth-panel {
    border: 1px solid var(--line);
    border-radius: 20px;
    padding: 28px;
    background: linear-gradient(120deg, rgba(255, 251, 243, 0.92), rgba(244, 236, 222, 0.86));
    box-shadow: var(--shadow);
}

.auth-panel h1 {
    margin: 0;
    line-height: 1.08;
    font-family: "Zen Old Mincho", serif;
    font-size: clamp(36px, 6vw, 56px);
    color: #2a2114;
}

.auth-panel h1 span {
    color: var(--teal);
}

.auth-form {
    margin-top: 18px;
}

.auth-note {
    margin: 8px 0 0;
    font-size: 12px;
    color: var(--ink-1);
}

body.signin-body {
    min-height: 100vh;
    background: #fff5ed;
}

.signin-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(300px, 48%) minmax(440px, 52%);
    width: 100%;
    overflow-x: hidden;
}

.signin-brand-pane {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px;
    overflow: hidden;
    background:
        radial-gradient(120% 70% at 20% 15%, rgba(255, 236, 218, 0.38), transparent 50%),
        radial-gradient(120% 75% at 86% 80%, rgba(255, 189, 142, 0.34), transparent 56%),
        linear-gradient(136deg, #f28a3f 0%, #ef7a3a 48%, #ea6e2d 100%);
}

.signin-brand-pane::before,
.signin-brand-pane::after {
    content: "";
    position: absolute;
    border-radius: 999px;
    pointer-events: none;
}

.signin-brand-pane::before {
    width: 520px;
    height: 520px;
    background: rgba(255, 255, 255, 0.13);
    top: -220px;
    left: -140px;
}

.signin-brand-pane::after {
    width: 430px;
    height: 430px;
    background: rgba(255, 214, 174, 0.18);
    bottom: -180px;
    right: -120px;
}

.signin-brand-content {
    position: relative;
    z-index: 1;
    max-width: 460px;
    color: #fffaf4;
}

.signin-kicker {
    margin: 0 0 14px;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    font-size: 12px;
    font-weight: 700;
    opacity: 0.88;
}

.signin-brand-title {
    margin: 0;
    line-height: 0.93;
    font-size: clamp(54px, 8vw, 106px);
    font-family: "Zen Old Mincho", serif;
    font-weight: 700;
}

.signin-brand-copy {
    margin: 18px 0 0;
    max-width: 340px;
    font-size: 15px;
    line-height: 1.65;
    color: rgba(255, 248, 237, 0.94);
}

.signin-form-pane {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(24px, 4vw, 52px) clamp(16px, 3vw, 36px);
    background:
        radial-gradient(100% 90% at 100% 0%, rgba(255, 215, 175, 0.28), transparent 56%),
        linear-gradient(180deg, #fffaf5 0%, #fff4ea 100%);
}

.signin-card {
    width: min(640px, 100%);
    max-width: 640px;
    border-radius: 26px;
    border: 1px solid #efdcc7;
    padding: clamp(22px, 3vw, 34px);
    background: rgba(255, 252, 248, 0.94);
    box-shadow: 0 24px 52px rgba(170, 108, 51, 0.17);
}

.signin-float-up {
    opacity: 0;
    transform: translateY(34px);
    animation: signin-float-up 0.72s cubic-bezier(0.22, 0.88, 0.31, 1) forwards;
}

.signin-title {
    margin: 6px 0 0;
    font-family: "Zen Old Mincho", serif;
    font-size: clamp(30px, 3vw, 40px);
    line-height: 1.18;
    color: #312317;
}

.signin-card .lead {
    margin: 12px 0 0;
    max-width: 560px;
    color: #705a45;
}

.signin-card .auth-form {
    margin-top: 16px;
}

.signin-card .field label {
    font-size: 13px;
    color: #6c553f;
    font-weight: 600;
}

.signin-card input {
    border-radius: 16px;
    border-color: #e7d6c0;
    background: #fffefd;
    padding: 13px 14px;
}

.signin-card input::placeholder {
    color: #b5a896;
}

.signin-card input:focus {
    border-color: #ea7c34;
    box-shadow: 0 0 0 3px rgba(234, 124, 52, 0.16);
}

.signin-card .consent-block {
    margin-top: 14px;
    border-color: #efdac2;
    background: rgba(255, 247, 237, 0.92);
}

.signin-card .consent-copy {
    color: #6f5a45;
}

.signin-card .consent-check {
    color: #4a3a2c;
}

.signin-card .status {
    border: 1px solid rgba(199, 159, 119, 0.24);
}

.signin-btn,
.signin-sub-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    text-align: center;
    text-decoration: none;
}

.signin-btn {
    border-radius: 999px;
    min-height: 46px;
    padding: 12px 18px;
}

.btn-secondary.signin-btn {
    border-radius: 999px;
    min-height: 46px;
    padding: 12px 18px;
}

.signin-sub-btn {
    border-radius: 999px;
    min-height: 44px;
}

#social-signin-list:not([hidden]) {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
}

.signin-card h3 {
    margin: 18px 0 8px;
    font-size: 18px;
    color: #3f2f20;
}

.signin-card .actions.full {
    margin-top: 8px;
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

#user-signin-form .actions.full {
    grid-column: 1 / -1;
}

@keyframes signin-float-up {
    from {
        opacity: 0;
        transform: translateY(34px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.consent-block {
    margin-top: 18px;
    border: 1px solid #d8ccb7;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.78);
    padding: 14px;
}

.consent-block h3 {
    margin: 0 0 8px;
    font-size: 16px;
}

.consent-copy {
    margin: 0 0 12px;
    color: #625640;
    font-size: 13px;
}

.consent-check {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 10px 0 0;
    color: #3f3527;
    line-height: 1.5;
}

.consent-check input[type="checkbox"] {
    margin-top: 2px;
    flex: 0 0 auto;
}

.consent-required,
.consent-optional {
    margin-left: 6px;
    font-size: 11px;
}

.consent-required {
    color: var(--sun);
}

.consent-optional {
    color: var(--teal);
}

.mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

#admin-mfa-qr {
    display: block;
    width: 220px;
    height: 220px;
    margin: 0 0 12px;
    background: #ffffff;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

#admin-mfa-qr[hidden] {
    display: none;
}

.hero {
    border: 1px solid var(--line);
    border-radius: 20px;
    padding: 26px 30px;
    background: linear-gradient(120deg, rgba(255, 251, 243, 0.92), rgba(244, 236, 222, 0.86));
    box-shadow: var(--shadow);
}

.chip {
    display: inline-block;
    margin: 0 0 10px;
    padding: 4px 12px;
    border-radius: 999px;
    border: 1px solid rgba(217, 95, 57, 0.35);
    color: #8a3f23;
    background: rgba(217, 95, 57, 0.08);
    font-size: 12px;
    letter-spacing: 0.06em;
}

.hero h1 {
    margin: 0;
    line-height: 1.04;
    font-family: "Zen Old Mincho", serif;
    font-size: clamp(34px, 5.1vw, 58px);
    color: #2a2114;
}

.hero h1 span {
    color: var(--teal);
}

.lead {
    margin: 14px 0 0;
    max-width: 820px;
    color: var(--ink-1);
}

.panel {
    border: 1px solid var(--line);
    border-radius: 20px;
    background: var(--panel);
    backdrop-filter: blur(5px);
    box-shadow: var(--shadow);
    padding: 22px;
}

.panel-head {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 16px;
    margin-bottom: 14px;
}

.panel-head h2 {
    margin: 0;
    font-family: "Zen Old Mincho", serif;
    font-size: 28px;
}

.panel-head p {
    margin: 0;
    color: var(--ink-1);
    font-size: 13px;
}

.consent-panel-head {
    align-items: start;
}

.consent-panel-head-copy {
    min-width: 0;
}

.consent-summary-dates {
    margin-top: 4px;
    font-size: 12px;
    line-height: 1.5;
}

.consent-panel-toggle {
    flex: 0 0 auto;
    white-space: nowrap;
    border: 0;
    background: transparent;
    color: #7d3a26;
    font: inherit;
    font-size: 13px;
    text-decoration: underline;
    cursor: pointer;
    padding: 0;
}

#user-consent-panel.consent-panel-closed .consent-block {
    display: none;
}

.panel-head code {
    color: #7d3a26;
}

.json-viewer {
    display: grid;
    gap: 10px;
    min-width: 0;
}

.json-viewer-toolbar {
    display: flex;
    justify-content: flex-end;
}

.json-table-view {
    min-width: 0;
    overflow-x: auto;
}

.json-details {
    min-width: 260px;
}

.json-details summary {
    cursor: pointer;
    color: #5a503f;
    font-weight: 700;
    margin-bottom: 6px;
}

.json-table {
    width: 100%;
    border-collapse: collapse;
    background: rgba(255, 255, 255, 0.68);
    font-size: 13px;
}

.json-table th,
.json-table td {
    border: 1px solid #d9ceb9;
    padding: 8px;
    text-align: left;
    vertical-align: top;
    overflow-wrap: anywhere;
}

.json-table th {
    width: 28%;
    color: #5a503f;
    background: rgba(238, 229, 212, 0.72);
}

.json-primitive,
.json-empty {
    white-space: pre-wrap;
}

.json-null,
.json-empty {
    color: #846f55;
    font-style: italic;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.field.full {
    grid-column: 1 / -1;
}

.field.checkbox {
    justify-content: end;
}

.field label {
    font-size: 13px;
    color: #5a503f;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid #cfc0a8;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.82);
    color: #2f281c;
    padding: 10px 12px;
    font: inherit;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--sun);
    box-shadow: 0 0 0 3px rgba(217, 95, 57, 0.16);
}

input[type="checkbox"] {
    width: 20px;
    height: 20px;
    align-self: flex-start;
    accent-color: var(--sun);
}

.source-switch {
    display: inline-flex;
    border: 1px solid #cfc0a8;
    border-radius: 999px;
    padding: 4px;
    background: rgba(255, 255, 255, 0.8);
}

.mode-btn {
    border: none;
    border-radius: 999px;
    padding: 8px 16px;
    background: transparent;
    color: #5f5340;
    font-weight: 700;
    cursor: pointer;
}

.mode-btn.active {
    background: linear-gradient(120deg, #ce5330, #de8444);
    color: #fff;
}

.hidden {
    display: none !important;
}

.field-help {
    margin: 8px 0 0;
    font-size: 12px;
    color: #7a684d;
}

.field-help.warn {
    color: #8d3e23;
    font-weight: 600;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 4px;
}

.btn-primary,
.btn-secondary {
    border-radius: 12px;
    padding: 10px 16px;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.btn-primary {
    border: none;
    background: linear-gradient(120deg, #ce5330, #df8b45);
    color: #fff;
    box-shadow: 0 10px 18px rgba(193, 90, 47, 0.25);
}

.btn-primary:hover {
    transform: translateY(-1px);
}

.btn-primary:disabled,
.btn-secondary:disabled {
    cursor: not-allowed;
    opacity: 0.6;
    transform: none;
    box-shadow: none;
}

.btn-primary.is-loading {
    position: relative;
    padding-left: 44px;
}

.btn-primary.is-loading::before {
    content: "";
    position: absolute;
    left: 16px;
    top: 50%;
    width: 16px;
    height: 16px;
    margin-top: -8px;
    border: 2px solid rgba(255, 255, 255, 0.45);
    border-top-color: #fff;
    border-radius: 50%;
    animation: eval-spin 0.8s linear infinite;
}

.btn-secondary {
    border: 1px solid #ccbda5;
    background: rgba(255, 255, 255, 0.82);
    color: #4e4538;
}

.status {
    margin: 14px 0 2px;
    font-size: 13px;
    padding: 10px 12px;
    border-radius: 12px;
}

.status.idle {
    background: rgba(186, 171, 144, 0.2);
    color: #625640;
}

.status.ok {
    background: rgba(33, 145, 97, 0.16);
    color: #1f724f;
}

.status.warn {
    background: rgba(194, 119, 45, 0.15);
    color: #7e4b1a;
}

.status.err {
    background: rgba(190, 67, 67, 0.14);
    color: #7c2f2f;
}

.eval-busy-overlay {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(37, 32, 23, 0.34);
    z-index: 1200;
}

.eval-busy-overlay.is-active {
    display: flex;
}

.eval-busy-box {
    min-width: min(460px, 92vw);
    max-width: min(520px, 92vw);
    border: 1px solid #dccab1;
    border-radius: 16px;
    background: rgba(255, 252, 246, 0.96);
    box-shadow: var(--shadow);
    padding: 18px 18px 16px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.eval-busy-spinner {
    flex: 0 0 24px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 3px solid rgba(217, 95, 57, 0.26);
    border-top-color: #d95f39;
    animation: eval-spin 0.85s linear infinite;
}

.eval-busy-text {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #4a3e2f;
}

.eval-busy-progress {
    flex: 1 1 100%;
    margin-top: 4px;
}

.eval-busy-progress-track {
    width: 100%;
    height: 8px;
    border-radius: 999px;
    background: rgba(217, 95, 57, 0.16);
    overflow: hidden;
}

.eval-busy-progress-fill {
    height: 100%;
    width: 0%;
    border-radius: 999px;
    background: #d95f39;
    transition: width 0.4s ease;
}

.eval-busy-progress-label {
    margin: 8px 0 0;
    font-size: 12.5px;
    font-weight: 600;
    color: #6a5c46;
}

/* 詳細表示モーダル(汎用コンポーネント。管理画面の「クリックで詳細」系で共用可)。
   .eval-busy-overlay と同様に既定非表示、.is-open 付与で表示する。 */
.modal-overlay {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(37, 32, 23, 0.46);
    z-index: 2200;
}

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

.modal-box {
    width: min(760px, 100%);
    max-height: min(86vh, 900px);
    border: 1px solid var(--line);
    border-radius: 20px;
    background: var(--panel);
    backdrop-filter: blur(6px);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--line);
    flex: 0 0 auto;
}

.modal-head h3 {
    margin: 0;
    font-family: "Zen Old Mincho", serif;
    font-size: 22px;
}

.modal-close {
    border: none;
    background: transparent;
    color: var(--ink-1);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    padding: 2px 10px;
    border-radius: 8px;
}

.modal-close:hover,
.modal-close:focus-visible {
    background: rgba(217, 95, 57, 0.14);
    color: var(--sun);
}

.modal-body {
    padding: 18px 20px 22px;
    overflow-y: auto;
}

body.modal-open {
    overflow: hidden;
}

@media (max-width: 768px) {
    .modal-overlay {
        padding: 0;
    }

    .modal-box {
        width: 100%;
        max-width: 100%;
        max-height: 100vh;
        height: 100%;
        border-radius: 0;
    }
}

.active-jobs {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 12px;
}

.active-jobs[hidden] {
    display: none;
}

.active-job-item {
    border: 1px solid #e6d8bf;
    border-radius: 12px;
    background: rgba(255, 251, 244, 0.9);
    padding: 12px 14px;
}

.active-job-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.active-job-badge {
    flex: 0 0 auto;
    font-size: 11.5px;
    font-weight: 700;
    color: #fff;
    background: #d95f39;
    border-radius: 999px;
    padding: 2px 10px;
}

.active-job-failed {
    border-color: #d8a3a3;
    background: rgba(250, 240, 238, 0.92);
}

.active-job-badge-failed {
    background: #b3382e;
}

.active-job-title {
    font-size: 13px;
    font-weight: 600;
    color: #4a3e2f;
}

.active-job-track {
    width: 100%;
    height: 8px;
    border-radius: 999px;
    background: rgba(217, 95, 57, 0.16);
    overflow: hidden;
}

.active-job-fill {
    height: 100%;
    width: 0%;
    border-radius: 999px;
    background: #d95f39;
    transition: width 0.4s ease;
}

.active-job-label {
    margin: 8px 0 0;
    font-size: 12.5px;
    font-weight: 600;
    color: #6a5c46;
}

/* fire-and-forget UX: 開始トースト（画面右上・約5秒で自動消滅）
   完了/失敗の再訪通知(.job-notice-region)と同じ右上固定のため、通知regionを
   優先表示させる目的でトーストregionをその下(84px)へオフセットして重なりを避ける。 */
.job-toast-region {
    position: fixed;
    top: 84px;
    right: 18px;
    z-index: 1900;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: min(360px, 90vw);
    pointer-events: none;
}

.job-toast {
    pointer-events: auto;
    background: var(--panel);
    border: 1px solid var(--line);
    border-left: 4px solid var(--sun);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 12px 16px;
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.job-toast-hide {
    opacity: 0;
    transform: translateY(-8px);
}

.job-toast-text {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--ink-1);
    line-height: 1.5;
}

/* fire-and-forget UX: 再訪時の完了/失敗通知（画面右上・手動で閉じるまで残る） */
.job-notice-region {
    position: fixed;
    top: 18px;
    right: 18px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: min(360px, 90vw);
}

.job-notice {
    position: relative;
    background: var(--panel);
    border: 1px solid var(--line);
    border-left: 4px solid var(--ok);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 12px 32px 12px 16px;
}

.job-notice-failed {
    border-left-color: var(--err);
}

/* T-1: 一覧窓/purgeで消えたpendingの控えめ通知(成功/失敗トーンより主張を弱める) */
.job-notice-info {
    border-left-color: var(--line);
}

.job-notice-clickable {
    cursor: pointer;
}

.job-notice-text {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--ink-1);
    line-height: 1.5;
}

.job-notice-close {
    position: absolute;
    top: 6px;
    right: 8px;
    border: none;
    background: transparent;
    color: var(--ink-1);
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    padding: 4px;
}

.report-box {
    margin: 16px 0;
    border: 1px solid #e6d8bf;
    border-radius: 14px;
    background: rgba(255, 251, 244, 0.9);
    padding: 14px 16px;
}

.report-toggle {
    width: 100%;
}

.report-body {
    margin-top: 12px;
    white-space: pre-wrap;
    line-height: 1.75;
    font-size: 14px;
    color: #4a3e2f;
}

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

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.kpi-card {
    border: 1px solid #d8ccb7;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.78);
    padding: 12px;
}

.kpi-label {
    margin: 0;
    font-size: 12px;
    color: #705f46;
}

.kpi-value {
    margin: 6px 0 0;
    font-size: clamp(24px, 3vw, 32px);
    font-weight: 700;
    color: #2a2217;
}

.kpi-value.small {
    font-size: 13px;
    line-height: 1.35;
    word-break: break-all;
}

.viz-grid {
    display: grid;
    grid-template-columns: 1.3fr 1fr;
    gap: 14px;
    margin-bottom: 14px;
}

.chart-card,
.meta-card,
.advice-box,
.ai-summary-box,
.feedback-box,
.growth-box,
.growth-detail-box,
.trend-card,
.history-box {
    border: 1px solid #d8ccb7;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.8);
    padding: 12px 14px;
}

.chart-card h3,
.meta-card h3,
.advice-box h3,
.ai-summary-box h3,
.feedback-box h3,
.growth-box h3,
.history-box h3 {
    margin: 0 0 10px;
    font-size: 16px;
}

.meta-card h4,
.advice-box h4,
.ai-summary-box h4,
.growth-detail-box h4,
.trend-card h4 {
    margin: 10px 0 6px;
    font-size: 13px;
    color: #745f3f;
}

.growth-caption {
    margin: 0 0 12px;
    color: #665942;
    font-size: 13px;
}

.growth-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 12px;
}

.growth-stat {
    border: 1px solid #d8ccb7;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.84);
    padding: 12px;
}

.growth-stat-label {
    margin: 0;
    font-size: 12px;
    color: #705f46;
}

.growth-stat-value {
    margin: 6px 0 0;
    font-size: 22px;
    font-weight: 700;
    color: #2a2217;
}

.growth-stat-value.up {
    color: var(--ok);
}

.growth-stat-value.down {
    color: var(--err);
}

.growth-stat-value.neutral {
    color: var(--ink-1);
}

.trend-card {
    margin-bottom: 12px;
}

.trend-chart {
    min-height: 172px;
    display: flex;
    align-items: flex-end;
}

.trend-empty {
    color: #6f624e;
    font-size: 13px;
}

.trend-bars {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(52px, 1fr));
    gap: 10px;
    align-items: end;
}

.trend-point {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.trend-score {
    font-size: 12px;
    font-weight: 700;
    color: #7d3a26;
}

.trend-bar-shell {
    width: 100%;
    max-width: 48px;
    height: 120px;
    border-radius: 14px;
    padding: 6px;
    display: flex;
    align-items: flex-end;
    background: linear-gradient(180deg, rgba(14, 138, 137, 0.12), rgba(217, 95, 57, 0.08));
    border: 1px solid rgba(216, 204, 183, 0.9);
}

.trend-bar {
    width: 100%;
    min-height: 10px;
    border-radius: 10px;
    background: linear-gradient(180deg, #0e8a89, #d95f39);
}

.trend-point.is-latest .trend-bar {
    background: linear-gradient(180deg, #d95f39, #efab54);
}

.trend-date,
.trend-meta {
    font-size: 11px;
    color: #6a5d47;
    text-align: center;
}

.growth-details {
    margin-bottom: 0;
}

#radar-chart {
    width: 100%;
    max-height: 360px;
    display: block;
}

.axis-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 14px;
}

.axis-card {
    border: 1px solid #d8ccb7;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.82);
    padding: 12px;
}

.axis-top {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 8px;
}

.axis-top h4 {
    margin: 0;
    font-size: 15px;
}

.axis-score {
    font-weight: 700;
    color: #954424;
}

.clean-list {
    margin: 0;
    padding-left: 18px;
    color: #493f31;
    font-size: 13px;
}

.clean-list li {
    margin-bottom: 3px;
}

.ai-summary-text {
    margin: 0 0 10px;
    color: #4b3f30;
    font-size: 13px;
    line-height: 1.6;
}

.ai-summary-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 10px;
    color: #5f5038;
    font-size: 13px;
}

.ai-summary-grid p {
    margin: 0;
}

.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 14px;
}

.feedback-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.review-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.sep {
    border: 0;
    border-top: 1px solid #d9ccb6;
    margin: 14px 0;
}

.history-list {
    display: grid;
    gap: 8px;
}

.split-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 14px;
}

.compact-kpi-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-bottom: 10px;
}

.analytics-filter-grid {
    align-items: end;
    margin-bottom: 10px;
}

.analytics-filter-grid .actions {
    margin-top: 0;
    align-items: end;
}

.analytics-list-grid {
    margin-top: 10px;
}

.analytics-list-grid .history-box {
    min-height: 170px;
}

.json-preview {
    margin: 6px 0 0;
    border: 1px solid #d9ceb9;
    border-radius: 10px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.78);
    color: #2f281c;
    font-size: 12px;
    line-height: 1.55;
    max-height: 260px;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

.chat-log {
    border: 1px solid #d9ceb9;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.76);
    min-height: 240px;
    max-height: 420px;
    overflow-y: auto;
    padding: 10px;
    display: grid;
    gap: 8px;
    margin-bottom: 12px;
}

.chat-bubble {
    border-radius: 12px;
    padding: 9px 10px;
    border: 1px solid #d8ccb7;
    max-width: 92%;
}

.chat-bubble.user {
    background: rgba(242, 201, 159, 0.32);
    justify-self: end;
}

.chat-bubble.assistant {
    background: rgba(255, 255, 255, 0.9);
    justify-self: start;
}

.chat-role {
    margin: 0;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: #6a4a2b;
}

.chat-content {
    margin: 6px 0 0;
    white-space: pre-wrap;
    line-height: 1.5;
}

.history-item {
    border: 1px solid #d9ceb9;
    border-radius: 10px;
    padding: 9px 10px;
    background: rgba(255, 255, 255, 0.8);
    font-size: 13px;
}

.history-item strong {
    color: #65311e;
}

/* aside(右側スコアチップ等)指定時のみ適用される拡張レイアウト。既存 .history-item は変更しない。 */
.history-item--with-aside {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.history-item-main {
    flex: 1 1 auto;
    min-width: 0;
}

.history-item-aside {
    flex: 0 0 auto;
    display: flex;
    gap: 8px;
}

.history-score-chips {
    display: flex;
    gap: 8px;
}

.history-score-chip {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 56px;
    padding: 4px 8px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--panel);
}

.history-score-chip-label {
    font-size: 10px;
    letter-spacing: 0.03em;
    color: #705f46;
}

.history-score-chip-value {
    margin-top: 2px;
    font-size: 15px;
    font-weight: 700;
    color: #954424;
}

@media (max-width: 768px) {
    .history-item--with-aside {
        flex-direction: column;
        align-items: stretch;
    }

    .history-item-aside {
        justify-content: flex-start;
    }
}

.reveal {
    opacity: 0;
    transform: translateY(10px);
    animation: reveal 0.55s ease forwards;
}

.delay-1 {
    animation-delay: 0.08s;
}

.delay-2 {
    animation-delay: 0.14s;
}

@keyframes reveal {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 768px) {
    .signin-shell {
        grid-template-columns: 1fr;
    }

    .signin-brand-pane {
        min-height: 34vh;
        padding: 38px 26px;
        align-items: flex-end;
        justify-content: flex-start;
    }

    .signin-brand-title {
        font-size: clamp(44px, 13vw, 72px);
    }

    .signin-brand-copy {
        max-width: 100%;
        margin-top: 10px;
    }

    .signin-form-pane {
        padding: 26px 16px 34px;
    }

    .signin-card {
        width: min(720px, 100%);
    }

    .kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .growth-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .viz-grid {
        grid-template-columns: 1fr;
    }

    .axis-grid {
        grid-template-columns: 1fr;
    }

    .two-col {
        grid-template-columns: 1fr;
    }

    .feedback-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .review-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .split-grid {
        grid-template-columns: 1fr;
    }

    .compact-kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .workspace-topbar {
        position: static;
        left: auto;
        right: auto;
        z-index: auto;
        width: min(1160px, 96vw);
        margin: 18px auto 0;
        border-radius: 16px;
    }

    .workspace-shell {
        grid-template-columns: 1fr;
        width: min(1160px, 96vw);
        margin: 10px auto 48px;
        display: grid;
    }

    .workspace-sidebar {
        position: static;
        width: auto;
        height: auto;
        border-radius: 20px;
        overflow: visible;
    }

    .sidebar-actions {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .workspace-main.layout {
        width: 100%;
        margin: 0;
    }
}

/* --- CA self-check result (user view) --- */
.selfcheck-meta {
    margin: 4px 0 0;
    color: #6a5d47;
    font-size: 13px;
}

.selfcheck-root {
    display: grid;
    gap: 14px;
    margin-bottom: 16px;
}

.selfcheck-summary {
    margin: 0;
    padding: 10px 12px;
    border: 1px solid #d8ccb7;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.78);
    color: #3d3426;
    font-size: 14px;
    font-weight: 600;
}

.selfcheck-summary-scored {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 10px;
}

.selfcheck-summary-label {
    font-weight: 700;
}

.selfcheck-summary-aux {
    font-size: 12px;
    font-weight: 500;
    color: #6f624e;
}

.selfcheck-legacy {
    border: 1px solid #d8ccb7;
    border-radius: 14px;
    background: rgba(255, 252, 246, 0.9);
    padding: 14px 16px;
}

.selfcheck-legacy-title {
    margin: 0 0 6px;
    font-size: 15px;
    font-weight: 700;
    color: #7d3a26;
}

.selfcheck-legacy-body {
    margin: 0;
    color: #5f5038;
    font-size: 13px;
    line-height: 1.55;
}

.selfcheck-area {
    border: 1px solid #d8ccb7;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.82);
    padding: 12px 14px;
}

.selfcheck-area-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 8px;
    margin-bottom: 8px;
}

.selfcheck-area-head h3 {
    margin: 0;
    font-size: 16px;
}

.selfcheck-ok-summary {
    margin: 0;
    font-size: 12px;
    color: var(--ok);
    font-weight: 600;
    white-space: nowrap;
}

.selfcheck-score-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.35;
    color: #fff;
    background: #e07a2f;
    white-space: nowrap;
}

.selfcheck-area-empty {
    margin: 0;
    color: #6f624e;
    font-size: 13px;
}

.selfcheck-area-summary {
    margin: 0 0 10px;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid #dfd3be;
    background: rgba(255, 252, 246, 0.95);
}

.selfcheck-area-summary-good {
    border-left: 4px solid var(--ok);
}

.selfcheck-area-summary-improve {
    border-left: 4px solid var(--warn);
}

.selfcheck-area-summary-label {
    margin: 0 0 4px;
    font-size: 12px;
    font-weight: 700;
    color: #5a4c37;
}

.selfcheck-area-summary-body {
    margin: 0;
    font-size: 13px;
    line-height: 1.6;
    color: #4b3f30;
}

.selfcheck-item-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 10px;
}

.selfcheck-item {
    border: 1px solid rgba(216, 204, 183, 0.95);
    border-radius: 12px;
    padding: 10px 12px;
    background: rgba(255, 252, 246, 0.92);
}

.selfcheck-item-ok {
    border-left: 4px solid var(--ok);
}

.selfcheck-item-ng {
    border-left: 4px solid var(--err);
}

.selfcheck-item-warn {
    border-left: 4px solid var(--warn);
}

.selfcheck-item-unset {
    border-left: 4px solid #8a7f6c;
}

.selfcheck-item-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 4px;
}

.selfcheck-item-name {
    font-size: 14px;
    color: #2a2217;
}

.selfcheck-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    min-width: 3.5em;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 700;
    text-align: center;
    letter-spacing: 0.02em;
}

.selfcheck-badge-ng {
    color: #fff;
    background: var(--err);
}

.selfcheck-badge-warn {
    color: #fff;
    background: var(--warn);
}

.selfcheck-badge-ok {
    color: #fff;
    background: #e07a2f;
}

.selfcheck-badge-unset {
    color: #fff;
    background: #8a7f6c;
}

.selfcheck-badge-na {
    color: #fff;
    background: #a3a0a0;
}

.selfcheck-item-viewpoint,
.selfcheck-item-advice,
.selfcheck-item-extra,
.selfcheck-item-pages {
    margin: 4px 0 0;
    font-size: 13px;
    line-height: 1.55;
    color: #4b3f30;
}

.selfcheck-item-viewpoint {
    color: #705f46;
}

.selfcheck-item-extra {
    font-size: 12px;
    color: #705f46;
}

.selfcheck-item-pages {
    font-size: 12px;
    font-weight: 600;
    color: #5a4e3c;
}

.selfcheck-score-v2 {
    margin: 0;
    padding: 10px 12px;
    border: 1px solid #d8ccb7;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.78);
}

.selfcheck-score-v2-total {
    margin: 0 0 6px;
    font-size: 14px;
    font-weight: 700;
    color: #3d3426;
}

.selfcheck-score-v2-areas {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 4px;
    font-size: 13px;
    color: #4b3f30;
}

.selfcheck-score-v2-penalty {
    margin: 6px 0 0;
    font-size: 12px;
    color: var(--err);
    font-weight: 600;
}

.survey-box,
.cv-cta-box {
    border: 1px solid #d8ccb7;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.8);
    padding: 12px 14px;
    margin-bottom: 14px;
}

.survey-box h3,
.cv-cta-box h3 {
    margin: 0 0 8px;
    font-size: 16px;
}

.survey-lead,
.cv-cta-lead {
    margin: 0 0 12px;
    color: #665942;
    font-size: 13px;
}

.survey-form {
    display: grid;
    gap: 12px;
}

.survey-q {
    margin: 0;
    padding: 10px 12px;
    border: 1px solid rgba(216, 204, 183, 0.95);
    border-radius: 12px;
    background: rgba(255, 252, 246, 0.7);
}

.survey-q legend {
    padding: 0 4px;
    font-size: 13px;
    font-weight: 600;
    color: #3d3426;
}

.survey-scale {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 14px;
    margin-top: 6px;
}

.survey-scale label {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    color: #4d4331;
    cursor: pointer;
}

.cv-cta-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.cv-cta-link:hover {
    filter: brightness(1.03);
}

@media (max-width: 640px) {
    .selfcheck-area-head {
        flex-wrap: wrap;
        align-items: center;
    }

    .survey-scale {
        gap: 8px 12px;
    }

    .signin-brand-pane {
        min-height: 30vh;
        padding: 26px 16px;
    }

    .signin-card {
        padding: 18px;
        border-radius: 20px;
    }

    .layout {
        width: min(1160px, 96vw);
        margin-top: 20px;
        margin-bottom: 24px;
    }

    .hero,
    .panel {
        padding: 14px;
    }

    .panel-head {
        flex-direction: column;
        align-items: flex-start;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .feedback-grid {
        grid-template-columns: 1fr;
    }

    .growth-grid {
        grid-template-columns: 1fr;
    }

    .review-grid {
        grid-template-columns: 1fr;
    }

    .compact-kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .app-bar {
        width: min(1160px, 96vw);
        margin-top: 12px;
    }

    .app-bar-inner {
        padding: 12px;
    }

    .app-bar-inner h2 {
        font-size: 18px;
    }

    .auth-panel {
        padding: 18px;
    }

    .workspace-topbar h2 {
        font-size: 20px;
    }

    .sidebar-actions {
        grid-template-columns: 1fr;
    }
}

.consent-check-doc input[disabled] + span {
    opacity: 0.72;
}

.consent-doc-help {
    margin-top: 6px;
    margin-left: 30px;
}

/* VPS does not offer URL diagnosis on the user screen; keep markup/JS for rollback. */
#user-evaluation-panel #mode-url-btn,
#user-evaluation-panel #url-source-row {
    display: none !important;
}
