/* Strategy Analysis Web Application Styles */

/* Override Bootstrap's default .text-muted (~#6c757d, 4.83:1 on white — AA only)
 * with a darker slate that clears WCAG AAA (7:1) for the 50+ target audience. */
.text-muted {
    color: #475569 !important;
}

.hidden {
    display: none !important;
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
}

/* Card styling */
.card {
    border: none;
    border-radius: 0.5rem;
}

.card-title {
    color: #333;
    font-weight: 600;
}

/* Form styling */
.form-label {
    font-weight: 500;
    color: #555;
}

.form-control:focus {
    border-color: #0D9488;
    box-shadow: 0 0 0 0.2rem rgba(13, 148, 136, 0.15);
}

/* Bootstrap primary override — teal */
.btn-primary {
    background-color: #0D9488;
    border-color: #0D9488;
}
.btn-primary:hover {
    background-color: #0B7C72;
    border-color: #0B7C72;
}
.btn-primary:active, .btn-primary:focus {
    background-color: #0A6E65;
    border-color: #0A6E65;
    box-shadow: 0 0 0 0.2rem rgba(13, 148, 136, 0.25);
}
.btn-outline-primary {
    color: #0D9488;
    border-color: #0D9488;
}
.btn-outline-primary:hover {
    background-color: #0D9488;
    border-color: #0D9488;
    color: #fff;
}
.btn-outline-primary:active, .btn-outline-primary:focus {
    background-color: #0B7C72;
    border-color: #0B7C72;
    box-shadow: 0 0 0 0.2rem rgba(13, 148, 136, 0.25);
}
.text-primary {
    color: #0D9488 !important;
}
.spinner-border.text-primary {
    color: #0D9488 !important;
}

/* Button styling */
.btn-primary {
    font-weight: 500;
}

/* Alert styling */
.alert {
    border-radius: 0.375rem;
}

/* Footer styling */
.footer {
    margin-top: auto;
}

/* Navbar styling */
.navbar {
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
    position: relative;
    z-index: 1050;
}
.navbar-brand {
    font-weight: 600;
}
.brand-text {
    font-weight: 700;
    font-size: 1.1rem;
    color: #1e293b;
}
.navbar-nav .nav-link {
    font-size: 0.9rem;
    font-weight: 500;
    color: #475569;
    padding: 0.5rem 1rem;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color 0.15s, border-color 0.15s;
}
.navbar-nav .nav-link:hover {
    color: #0D9488;
}
.navbar-nav .nav-link.active {
    color: #0D9488;
    border-bottom-color: #0D9488;
}
.navbar-nav .nav-link .nav-icon {
    margin-right: 0.35rem;
}

/* Rendered advice markdown */
.advice-markdown {
    font-size: 0.9rem;
    color: #334155;
    line-height: 1.7;
}
.advice-markdown h1 {
    font-size: 1.63rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 1rem 0;
}
.advice-markdown h2 {
    font-size: 1.37rem;
    font-weight: 600;
    color: #334155;
    margin: 1.25rem 0 0.6rem 0;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid #f1f5f9;
}
.advice-markdown h3 {
    font-size: 1.24rem;
    font-weight: 600;
    color: #334155;
    margin: 1.25rem 0 0.5rem 0;
}
.advice-markdown h4 {
    font-size: 1.17rem;
    font-weight: 600;
    color: #475569;
    margin: 1rem 0 0.5rem 0;
}
.advice-markdown p {
    margin-bottom: 0.75rem;
}
.advice-markdown ul,
.advice-markdown ol {
    padding-left: 1.5rem;
    margin: 0 0 0.75rem 0;
}
.advice-markdown li {
    margin-bottom: 0.3rem;
}
.advice-markdown hr {
    border: none;
    border-top: 1px solid #e2e8f0;
    margin: 1.25rem 0;
}
.advice-markdown code {
    background: #f1f5f9;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-size: 0.85rem;
}
.advice-markdown pre {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 1rem;
    overflow-x: auto;
    margin-bottom: 0.75rem;
}
.advice-markdown pre code {
    background: none;
    padding: 0;
}
.advice-markdown blockquote {
    border-left: 3px solid #0D9488;
    padding: 0.5rem 1rem;
    margin: 0 0 0.75rem 0;
    background: #f8fafc;
    border-radius: 0 6px 6px 0;
}
.advice-markdown strong {
    font-weight: 700;
    color: #1e293b;
}

/* Responsive adjustments */
@media (max-width: 576px) {
    .card-body {
        padding: 1.5rem !important;
    }
}

/* ── Shared: loading indicator ── */
.loading {
    text-align: center;
    padding: 3rem;
    color: #475569;
}

/* ── Results and advice containers ── */
.results-container,
.advice-container {
    max-width: 800px;
    margin: 0 auto;
}

/* ── Page header text (results and advice pages) ── */
.results-container .page-header h1,
.advice-container .page-header h1 {
    font-size: 1.35rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 0.25rem 0;
}
.results-container .page-header p,
.advice-container .page-header p {
    font-size: 0.85rem;
    color: #475569;
    margin: 0 0 1.5rem 0;
}

/* ── Advice page: flex header ── */
.advice-container .page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* ── Content cards (results and advice) ── */
.results-card,
.advice-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 2rem;
    text-align: left;
}

/* ── Empty states ── */
.no-results,
.no-advice {
    text-align: center;
    padding: 3rem;
    color: #475569;
}
.no-results p,
.no-advice p {
    margin: 0.5rem 0;
}

/* ── Data input page ── */

/* Lock the page to the viewport so only the table-container scrolls
 * vertically. Without this, the page would also scroll (creating two
 * vertical scrollbars). Scoped via :has() so other pages keep their
 * normal min-height: 100vh layout. */
body:has(main.data-input-page) {
    height: 100vh;
    overflow: hidden;
}
main.data-input-page {
    display: flex;
    flex-direction: column;
    min-height: 0;
}
/* The table-container absorbs all leftover vertical space and scrolls
 * internally. min-height: 0 lets it shrink below its content height so the
 * flex algorithm can hand it a definite height. */
.data-input-page .table-container {
    flex: 1 1 0;
    min-height: 0;
    margin-bottom: 0.75rem;
}
.data-input-page .page-header,
.data-input-page .submit-area {
    flex: 0 0 auto;
}

.data-input-page .page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
    gap: 1rem;
}
.page-header-right {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    flex-shrink: 0;
}
.page-header-left h1 {
    font-size: 1.35rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 0.25rem 0;
}
.page-header-left p {
    font-size: 0.85rem;
    color: #475569;
    margin: 0;
}
.rating-legend {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    font-size: 0.8rem;
    color: #475569;
    white-space: nowrap;
}
.rating-legend-label {
    font-weight: 600;
    color: #475569;
}
.rating-legend-item {
    display: flex;
    align-items: center;
    gap: 4px;
}
.rating-legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
    border: 2px solid transparent;
}
.rating-legend-dot.outline {
    background: transparent;
}
.save-indicator {
    font-size: 0.8rem;
    min-height: 1.25rem;
    color: #475569;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}
.save-indicator.saving { color: #475569; }
.save-indicator.saved { color: #475569; }
.save-indicator.error { color: #dc3545; }
.save-indicator .save-icon {
    width: 14px;
    height: 14px;
}
.table-container {
    /* Scrolls both axes for the wide, tall rating matrix. The data-input
     * page locks its <main> to the viewport via a flex column layout
     * (.data-input-page below), so this container is the single vertical
     * scroller — the page itself does not scroll. Sticky <thead>/<th> and
     * sticky row-name cells pin against this container's scroll port. */
    overflow: auto;
    position: relative;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #fff;
}
.rating-table {
    width: 100%;
    border-collapse: collapse;
}
.rating-table th,
.rating-table td {
    border-bottom: 1px solid #f1f5f9;
    border-right: 1px solid #f1f5f9;
    padding: 0.6rem 0.75rem;
    text-align: center;
    vertical-align: middle;
}
.rating-table th {
    background-color: #f8fafc;
    position: sticky;
    top: 0;
    z-index: 2;
    font-size: 0.8rem;
    font-weight: 600;
    color: #475569;
    text-transform: none;
    white-space: nowrap;
    border-bottom: 2px solid #e2e8f0;
}
.rating-table th:last-child,
.rating-table td:last-child {
    border-right: none;
}
.rating-table .row-name-cell {
    /* Locked width: the actions-cell is sticky-pinned to the right edge of
     * this column (left: 200px), so if this cell were allowed to grow with
     * long project names, the delete button would slide over the input. The
     * input inside (flex:1, min-width:0) scrolls long text horizontally. */
    width: 200px;
    min-width: 200px;
    max-width: 200px;
    text-align: left;
    position: sticky;
    left: 0;
    z-index: 1;
    background-color: #fff;
}
.rating-table thead .row-name-cell {
    z-index: 3;
    background-color: #f8fafc;
}
.rating-table .row-name-inner {
    display: flex;
    align-items: center;
    gap: 6px;
}
.drag-handle {
    flex-shrink: 0;
    width: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #cbd5e1;
    cursor: grab;
    font-size: 0.7rem;
    letter-spacing: 1px;
    user-select: none;
    touch-action: none;
}
.drag-handle:hover { color: #475569; }
.drag-handle:active { cursor: grabbing; }
tr.dragging {
    opacity: 0.4;
    background: #f0fdfa !important;
}
tr.dragging > td { background: #f0fdfa !important; }
.drop-indicator {
    position: absolute;
    left: 0;
    right: 0;
    height: 2px;
    background: #0D9488;
    pointer-events: none;
    z-index: 10;
}
.rating-table .row-name-input {
    flex: 1;
    min-width: 0;
    border: none;
    background: transparent;
    padding: 0.2rem 0.35rem;
    font-size: 0.875rem;
    color: #334155;
    border-radius: 4px;
}
.rating-table .row-name-input:focus {
    outline: 2px solid #0D9488;
    background: #fff;
}
.rating-table .actions-cell {
    width: 44px;
    min-width: 44px;
    max-width: 44px;
    position: sticky;
    left: 200px;
    z-index: 1;
    background-color: #fff;
    border-right: 1px solid #e2e8f0;
    padding: 0.4rem;
}
.rating-table thead .actions-cell {
    z-index: 3;
    background-color: #f8fafc;
    font-size: 0.7rem;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.delete-row-btn {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: #cbd5e1;
    font-size: 0.75rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin: 0 auto;
    transition: background 0.15s, color 0.15s;
}
.delete-row-btn:hover {
    background: #fef2f2;
    color: #ef4444;
}
.rating-table .header-cell { min-width: 80px; }
.rating-table .header-cell.active-col { border-bottom-color: #0D9488; }
.rating-table .header-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}
.rating-table .header-input {
    width: 100%;
    text-align: center;
    font-weight: 600;
    font-size: 0.8rem;
    color: #475569;
    padding: 0.15rem 0.25rem;
    line-height: 1.3;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}
.rating-table .rating-cell {
    min-width: 36px;
    padding: 0.4rem 0.25rem;
    transition: min-width 0.15s ease;
}
.rating-table .rating-cell.expanded { min-width: 130px; }
.rating-dots {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    outline: none;
    border-radius: 4px;
    padding: 3px;
    cursor: pointer;
}
.rating-dots:focus {
    outline: 2px solid #0D9488;
    outline-offset: 1px;
}
.rating-dot {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid #cbd5e1;
    background: transparent;
    padding: 0;
    cursor: pointer;
    transition: background-color 0.1s, border-color 0.1s;
    flex-shrink: 0;
}
.rating-dot:hover { opacity: 0.8; }
.rating-dot[data-value="-2"] { border-color: #ef4444; }
.rating-dot[data-value="-1"] { border-color: #f97316; }
.rating-dot[data-value="0"]  { border-color: #cbd5e1; }
.rating-dot[data-value="1"]  { border-color: #5eead4; }
.rating-dot[data-value="2"]  { border-color: #0D9488; }
.rating-dot.selected[data-value="-2"] { background-color: #ef4444; border-color: #ef4444; }
.rating-dot.selected[data-value="-1"] { background-color: #f97316; border-color: #f97316; }
.rating-dot.selected[data-value="0"]  { background-color: #cbd5e1; border-color: #cbd5e1; }
.rating-dot.selected[data-value="1"]  { background-color: #5eead4; border-color: #5eead4; }
.rating-dot.selected[data-value="2"]  { background-color: #0D9488; border-color: #0D9488; }
.rating-cell:not(.expanded) .rating-dot:not(.selected) { display: none; }
.rating-dots.empty-highlight {
    outline: 2px solid #ef4444;
    outline-offset: 1px;
    border-radius: 4px;
}
.rating-cell:not(.expanded) .rating-dots:not(:has(.selected))::after {
    content: '';
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px dashed #e2e8f0;
    display: block;
    flex-shrink: 0;
}
.add-row-tr td {
    border-bottom: none;
    padding: 0.5rem 0.75rem;
}
.add-row-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: none;
    background: transparent;
    color: #475569;
    font-size: 0.85rem;
    cursor: pointer;
    padding: 0.3rem 0.5rem;
    border-radius: 6px;
    transition: color 0.15s, background 0.15s;
}
.add-row-btn:hover {
    color: #0D9488;
    background: #f0fdfa;
}
.add-row-btn .plus-icon {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 1.5px dashed currentColor;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    line-height: 1;
}
.submit-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    margin-top: 0;
}
.submit-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 1.1rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: #fff;
    background: #0D9488;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
}
.submit-btn:hover:not(:disabled) { background: #0B7C72; }
.submit-btn:disabled {
    background: #94a3b8;
    cursor: not-allowed;
}
.submit-btn .btn-icon {
    width: 18px;
    height: 18px;
}
.submit-btn.submitted { background: #64748b; }
.page-hints {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 0 1rem;
    align-self: stretch;
    font-size: 0.75rem;
    color: #475569;
}
.page-hints > .add-row-btn { justify-self: start; }
.page-hints-center {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.25rem 1.5rem;
}
.page-hints span {
    display: flex;
    align-items: center;
    gap: 4px;
}
.page-hints .copyright {
    justify-self: end;
    color: #94a3b8;
}
.page-hints .hint-icon {
    width: 14px;
    height: 14px;
}
/* On narrow screens, drop the 3-column grid so items stack rather than
 * squeeze the centered group off-axis. */
@media (max-width: 640px) {
    .page-hints {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    .page-hints > .add-row-btn { justify-self: center; }
    .page-hints > .copyright { justify-self: center; }
}
/* Data Input owns its own copyright (in .page-hints), so suppress the
 * base.html footer on this page to keep the bottom strip compact. */
body:has(main.data-input-page) > footer {
    display: none;
}
.result-links {
    margin-top: 1.25rem;
    padding: 1rem;
    background-color: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    text-align: center;
}
.result-links a { margin: 0 0.5rem; }
.status-message {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}
.read-only .rating-dots,
.read-only .rating-dot,
.read-only .row-name-input {
    pointer-events: none;
}
.read-only .row-name-input {
    background-color: transparent;
    color: #475569;
}
/* Once the sheet is submitted (read-only / calculating) the editing affordances
   no longer apply, so hide the entry instructions, the "how to enter data"
   guide, the keyboard-shortcut toggle, the "自動保存有効" indicator, and any
   open shortcuts panel. */
body:has(#table-container.read-only) .page-header-left p,
body:has(#table-container.read-only) .input-guide,
body:has(#table-container.read-only) .page-hints-center,
body:has(#table-container.read-only) .shortcuts-panel {
    display: none;
}
.rating-table tbody tr:hover > td { background-color: #f8fafc; }
.rating-table tbody tr:hover > .row-name-cell,
.rating-table tbody tr:hover > .actions-cell {
    background-color: #f8fafc;
}
.setup-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.5);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.setup-guide {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}
.setup-guide-header { padding: 1.5rem 1.75rem 0; }
.setup-guide-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 0.5rem 0;
}
.setup-guide-header p {
    font-size: 0.85rem;
    color: #475569;
    margin: 0 0 0.25rem 0;
    line-height: 1.5;
}
.setup-guide-header .guide-note {
    font-size: 0.8rem;
    color: #475569;
    margin: 0.75rem 0 0;
    padding: 0.6rem 0.75rem;
    background: #f8fafc;
    border-radius: 6px;
    border-left: 3px solid #0D9488;
}
.setup-guide-body {
    padding: 1rem 1.75rem;
    overflow-y: auto;
    flex: 1;
}
.setup-guide-body label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: #475569;
    margin-bottom: 0.5rem;
}
.setup-hints {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-bottom: 1rem;
    overflow: hidden;
}
.setup-hints-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: transparent;
    border: none;
    padding: 0.6rem 0.85rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: #475569;
    cursor: pointer;
    text-align: left;
}
.setup-hints-toggle:hover { color: #0D9488; }
.setup-hints-toggle .chevron-icon {
    color: #475569;
    transition: transform 0.2s;
}
.setup-hints.collapsed .setup-hints-toggle .chevron-icon {
    transform: rotate(-90deg);
}
.setup-hints-body {
    padding: 0 0.85rem 0.75rem;
    max-height: 800px;
    overflow: hidden;
    transition: max-height 0.25s ease, padding 0.25s ease;
}
.setup-hints.collapsed .setup-hints-body {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
}
.setup-hints-intro {
    font-size: 0.78rem;
    color: #475569;
    margin: 0 0 0.75rem;
    line-height: 1.5;
}
.hint-category { margin-bottom: 0.65rem; }
.hint-category:last-child { margin-bottom: 0; }
.hint-category-title {
    font-size: 0.7rem;
    font-weight: 700;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin: 0 0 0.35rem;
}
.hint-category-note {
    font-size: 0.72rem;
    color: #475569;
    margin: 0 0 0.35rem;
    line-height: 1.4;
}
.hint-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}
.hint-chip {
    display: inline-block;
    border: 1px solid #e2e8f0;
    background: #fff;
    color: #475569;
    font-size: 0.78rem;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    user-select: text;
}
.project-name-list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
.project-name-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.project-name-row .setup-drag-handle {
    flex-shrink: 0;
    width: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #cbd5e1;
    cursor: grab;
    font-size: 0.7rem;
    user-select: none;
    touch-action: none;
}
.project-name-row .setup-drag-handle:hover { color: #475569; }
.project-name-row .setup-drag-handle:active { cursor: grabbing; }
.project-name-row.dragging {
    opacity: 0.4;
    background: #f0fdfa;
    border-radius: 6px;
}
.setup-drop-indicator {
    height: 2px;
    background: #0D9488;
    border-radius: 1px;
    margin: -1px 0;
    pointer-events: none;
}
.project-name-row .row-number {
    width: 24px;
    text-align: right;
    font-size: 0.75rem;
    font-weight: 600;
    color: #475569;
    flex-shrink: 0;
}
.project-name-row input {
    flex: 1;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 0.45rem 0.65rem;
    font-size: 0.875rem;
    color: #334155;
    transition: border-color 0.15s;
}
.project-name-row input:focus {
    outline: none;
    border-color: #0D9488;
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.1);
}
.project-name-row input::placeholder { color: #94a3b8; }
.project-name-row .remove-project-btn {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: #cbd5e1;
    font-size: 0.85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s;
}
.project-name-row .remove-project-btn:hover {
    background: #fef2f2;
    color: #ef4444;
}
.add-project-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: none;
    background: transparent;
    color: #475569;
    font-size: 0.8rem;
    cursor: pointer;
    padding: 0.4rem 0.5rem;
    border-radius: 6px;
    margin-top: 0.25rem;
    transition: color 0.15s, background 0.15s;
}
.add-project-btn:hover {
    color: #0D9488;
    background: #f0fdfa;
}
.setup-guide-footer {
    padding: 1rem 1.75rem 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    border-top: 1px solid #f1f5f9;
}
.setup-guide-footer .guide-counter {
    font-size: 0.8rem;
    color: #475569;
}
.setup-guide-footer .guide-counter .count-value {
    font-weight: 600;
    color: #475569;
}
.setup-guide-footer .guide-counter .count-ok { color: #16a34a; }
.setup-guide-footer .guide-counter .count-low { color: #f97316; }
.setup-start-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 2rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: #fff;
    background: #0D9488;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
}
.setup-start-btn:hover:not(:disabled) { background: #0B7C72; }
.setup-start-btn:disabled {
    background: #94a3b8;
    cursor: not-allowed;
}
.input-guide {
    background: #f0fdfa;
    border: 1px solid #99f6e4;
    border-left: 4px solid #0D9488;
    border-radius: 8px;
    margin: 0 0 1rem;
    color: #334155;
    overflow: hidden;
}
.input-guide-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: transparent;
    border: none;
    padding: 0.7rem 1rem 0.7rem 1.25rem;
    cursor: pointer;
    text-align: left;
}
.input-guide-toggle:hover { background: rgba(13, 148, 136, 0.06); }
.input-guide-toggle .chevron-icon {
    color: #0B7C72;
    flex-shrink: 0;
    transition: transform 0.2s;
}
.input-guide.collapsed .input-guide-toggle .chevron-icon {
    transform: rotate(-90deg);
}
.input-guide-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #0B7C72;
}
.input-guide-body {
    padding: 0 1.25rem 1rem;
    max-height: 800px;
    overflow: hidden;
    transition: max-height 0.25s ease, padding 0.25s ease;
}
.input-guide.collapsed .input-guide-body {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
}
.input-guide-intro {
    font-size: 0.85rem;
    line-height: 1.55;
    margin: 0 0 0.6rem;
}
.input-guide-steps {
    font-size: 0.85rem;
    line-height: 1.7;
    margin: 0 0 0.5rem;
    padding-left: 1.25rem;
}
.input-guide-steps li { margin-bottom: 0.1rem; }
.input-guide-steps kbd { margin: 0 1px; }
.input-guide-note {
    font-size: 0.78rem;
    color: #475569;
    margin: 0;
}
.drag-handle-example {
    display: inline-block;
    padding: 0 6px;
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
    border-radius: 3px;
    font-family: inherit;
    line-height: 1.4;
}
.shortcuts-toggle {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    border: none;
    background: transparent;
    color: #475569;
    font-size: 0.75rem;
    cursor: pointer;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    transition: color 0.15s;
}
.shortcuts-toggle:hover { color: #475569; }
.shortcuts-toggle .chevron-icon {
    width: 12px;
    height: 12px;
    transition: transform 0.2s;
}
.shortcuts-toggle.open .chevron-icon { transform: rotate(180deg); }
.shortcuts-panel {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease, opacity 0.2s ease;
    opacity: 0;
    width: 100%;
}
.shortcuts-panel.open {
    max-height: 300px;
    opacity: 1;
}
.shortcuts-columns {
    display: flex;
    justify-content: center;
    gap: 3rem;
    padding: 1rem 0 0.5rem;
}
.shortcuts-group h4 {
    font-size: 0.75rem;
    font-weight: 600;
    color: #475569;
    margin: 0 0 0.5rem 0;
}
.shortcuts-group dl {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.3rem 0.75rem;
    align-items: baseline;
    margin: 0;
    font-size: 0.75rem;
    color: #475569;
}
.shortcuts-group dt {
    text-align: right;
    font-weight: normal;
    white-space: nowrap;
}
.shortcuts-group dd { margin: 0; }
kbd {
    display: inline-block;
    padding: 1px 5px;
    font-size: 0.7rem;
    font-family: inherit;
    color: #475569;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 3px;
    line-height: 1.4;
}
.kbd-note {
    font-size: 0.65rem;
    color: #475569;
    margin-left: 2px;
}

/* ── Admin page ── */
.statistics-card { text-align: center; }
.statistics-card .card-body { padding: 1.25rem; }
.statistics-card .card-title {
    font-size: 0.85rem;
    color: #6c757d;
    margin-bottom: 0.5rem;
}
.statistics-card .stat-value {
    font-size: 2rem;
    font-weight: bold;
    color: #212529;
    margin: 0;
}
/* Relative-time strings ("23時間45分前") are wider than the numeric stats;
   shrink so they fit one line in the same card. */
.statistics-card .stat-value-time { font-size: 1.25rem; }
#search-input { max-width: 400px; }
#search-count { margin-top: 0.25rem; }
#user-table th {
    background-color: #f8f9fa;
    font-weight: 600;
    white-space: nowrap;
}
#user-table td { vertical-align: middle; }
#user-table .btn-group-sm .btn {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
}
#user-table .btn:disabled { cursor: not-allowed; }
.admin-loading {
    text-align: center;
    padding: 3rem;
    color: #6c757d;
}
.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}
.admin-header h1 {
    font-size: 1.35rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
}
.advice-preview {
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 1.5rem;
    min-height: 300px;
}
.advice-preview .empty-preview {
    color: #475569;
    text-align: center;
    padding: 3rem 0;
}
@media (max-width: 768px) {
    .statistics-card .stat-value { font-size: 1.5rem; }
    #search-input { max-width: 100%; }
}

/* ── Landing page ── */
.landing-hero {
    background: linear-gradient(135deg, #ecfdf5 0%, #f0fdfa 45%, #ffffff 100%);
    border: 1px solid #d1faf4;
    border-radius: 16px;
    padding: 3rem 2.5rem;
    margin-bottom: 3.5rem;
}
.landing-eyebrow {
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: #0B7C72;
    margin: 0 0 0.85rem;
}
.landing-title {
    font-size: 2.25rem;
    font-weight: 800;
    line-height: 1.35;
    color: #1e293b;
    margin: 0 0 1.25rem;
}
.landing-accent { color: #0D9488; }
.landing-lead {
    font-size: 1.05rem;
    line-height: 1.85;
    color: #475569;
    margin: 0 0 1.75rem;
}
.landing-cta-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem 1.25rem;
    margin-bottom: 1rem;
}
.landing-secondary {
    color: #0B7C72;
    font-weight: 600;
    text-decoration: none;
}
.landing-secondary:hover { color: #0D9488; text-decoration: underline; }
.landing-note {
    font-size: 0.85rem;
    color: #475569;
    margin: 0;
}
.landing-note a { color: #0B7C72; }

/* Hero product preview */
.landing-preview {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    box-shadow: 0 20px 45px rgba(13, 148, 136, 0.10);
    padding: 1.25rem 1.35rem 1.4rem;
    max-width: 420px;
    margin: 0 auto;
}
.landing-preview-head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding-bottom: 0.85rem;
    margin-bottom: 0.35rem;
    border-bottom: 1px solid #f1f5f9;
}
.landing-preview-head .brand-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #0D9488;
    flex-shrink: 0;
}
.landing-preview-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: #334155;
}
.landing-preview-scale {
    margin-left: auto;
    font-size: 0.7rem;
    color: #94a3b8;
    white-space: nowrap;
}
.landing-preview-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.55rem 0;
}
.landing-preview-row + .landing-preview-row { border-top: 1px solid #f8fafc; }
.landing-preview-label {
    font-size: 0.85rem;
    color: #334155;
    font-weight: 500;
}
.lp-dots {
    display: inline-flex;
    gap: 6px;
    flex-shrink: 0;
}
.lp-dot {
    width: 15px;
    height: 15px;
    border-radius: 50%;
    border: 2px solid #cbd5e1;
    background: transparent;
    display: inline-block;
}
.lp-dot.v-2 { border-color: #ef4444; }
.lp-dot.v-1 { border-color: #f97316; }
.lp-dot.v0  { border-color: #cbd5e1; }
.lp-dot.v1  { border-color: #5eead4; }
.lp-dot.v2  { border-color: #0D9488; }
.lp-dot.sel.v-2 { background: #ef4444; }
.lp-dot.sel.v-1 { background: #f97316; }
.lp-dot.sel.v0  { background: #cbd5e1; }
.lp-dot.sel.v1  { background: #5eead4; }
.lp-dot.sel.v2  { background: #0D9488; }

/* Content sections */
.landing-section {
    margin-bottom: 3.5rem;
    text-align: center;
}
.landing-h2 {
    font-size: 1.6rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 0.5rem;
}
.landing-sub {
    font-size: 0.95rem;
    color: #475569;
    margin: 0 auto 2rem;
    max-width: 640px;
}
.landing-step,
.landing-feature {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 1.75rem 1.5rem;
    height: 100%;
    text-align: left;
}
.landing-step h3,
.landing-feature h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 0.5rem;
}
.landing-step p,
.landing-feature p {
    font-size: 0.9rem;
    line-height: 1.75;
    color: #475569;
    margin: 0;
}
.landing-step-num {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f0fdfa;
    color: #0D9488;
    font-weight: 800;
    font-size: 1.1rem;
    border: 1px solid #99f6e4;
    margin-bottom: 1rem;
}
.landing-feature-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f0fdfa;
    color: #0D9488;
    margin-bottom: 1rem;
}
.landing-feature-icon svg { width: 24px; height: 24px; }

/* Closing call-to-action */
.landing-final {
    background: linear-gradient(135deg, #0D9488 0%, #0B7C72 100%);
    border-radius: 16px;
    padding: 3rem 2rem;
    text-align: center;
    color: #fff;
    margin-bottom: 1rem;
}
.landing-final h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
    margin: 0 0 1.5rem;
}
.landing-final .btn-primary {
    background: #fff;
    border-color: #fff;
    color: #0B7C72;
    font-weight: 700;
}
.landing-final .btn-primary:hover,
.landing-final .btn-primary:focus,
.landing-final .btn-primary:active {
    background: #ecfdf5;
    border-color: #ecfdf5;
    color: #0B7C72;
    box-shadow: 0 0 0 0.2rem rgba(255, 255, 255, 0.35);
}
.landing-final .landing-note {
    color: #d1faf4;
    margin-top: 1rem;
}
.landing-final .landing-note a {
    color: #fff;
    text-decoration: underline;
}

@media (max-width: 991px) {
    .landing-title { font-size: 1.95rem; }
    .landing-preview { margin-top: 0.5rem; }
}
@media (max-width: 576px) {
    .landing-hero { padding: 2rem 1.35rem; }
    .landing-title { font-size: 1.6rem; }
    .landing-lead { font-size: 1rem; }
    .landing-preview-label { font-size: 0.8rem; }
    .lp-dot { width: 13px; height: 13px; }
}
