/* FONT-SCALE-120-APPLIED */
:root {
    --bg: #071321;
    --bg-soft: #0a1828;
    --sidebar: #081625;

    --panel: #0e2033;
    --panel-2: #10263b;
    --panel-hover: #142c43;

    --border: #203a52;
    --border-light: #294863;

    --text: #eef6ff;
    --text-soft: #a8b8c9;
    --text-muted: #70869b;

    --blue: #2b95ff;
    --blue-hover: #52aaff;

    --cyan: #48d6ff;

    --purple: #8b6cff;
    --purple-hover: #9d84ff;

    --green: #49d89a;
    --yellow: #f2be5c;
    --red: #ff626d;

    --radius: 13px;
    --radius-small: 9px;

    --sidebar-width: 238px;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
    background: var(--bg);
    color: var(--text);

    font-family:
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        "Noto Sans JP",
        "Hiragino Sans",
        "Yu Gothic UI",
        sans-serif;
}

button,
input,
textarea,
select {
    font: inherit;
}

a {
    color: inherit;
    text-decoration: none;
}


/* ---------------------------------
   Login
---------------------------------- */

.login-page {
    min-height: 100vh;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    padding: 28px;

    background:
        radial-gradient(
            circle at 50% 0%,
            rgba(43,149,255,.10),
            transparent 35%
        ),
        var(--bg);
}

.login-brand {
    width: min(440px,100%);

    display: flex;
    align-items: center;
    gap: 13px;

    margin-bottom: 22px;
}

.brand-mark {
    width: 44px;
    height: 44px;

    display: grid;
    place-items: center;

    border-radius: 12px;

    background:
        linear-gradient(
            135deg,
            var(--blue),
            var(--purple)
        );

    font-weight: 800;
    font-size: 25.2px;
}

.brand-mark.small {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    font-size: 19.2px;
}

.brand-title {
    font-size: 21.6px;
    font-weight: 700;
}

.brand-subtitle {
    margin-top: 2px;

    font-size: 12px;
    letter-spacing: .14em;

    color: var(--text-muted);
}

.login-card {
    width: min(440px,100%);

    padding: 34px;

    border: 1px solid var(--border);
    border-radius: 16px;

    background:
        linear-gradient(
            180deg,
            rgba(255,255,255,.018),
            rgba(255,255,255,0)
        ),
        var(--panel);

    box-shadow:
        0 22px 60px rgba(0,0,0,.22);
}

.login-card-header {
    margin-bottom: 27px;
}

.login-card h1 {
    margin: 5px 0 8px;
    font-size: 32.4px;
}

.login-card p {
    margin: 0;
    color: var(--text-soft);
    font-size: 16.8px;
}

.login-footer {
    margin-top: 22px;

    color: var(--text-muted);
    font-size: 13.2px;
    letter-spacing: .08em;
}


/* ---------------------------------
   Form
---------------------------------- */

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

.form-group label {
    display: block;

    margin-bottom: 8px;

    font-size: 15.6px;
    font-weight: 600;

    color: var(--text-soft);
}

input {
    width: 100%;

    padding: 12px 13px;

    border: 1px solid var(--border-light);
    border-radius: var(--radius-small);

    outline: none;

    color: var(--text);

    background: #091827;

    transition:
        border-color .15s ease,
        box-shadow .15s ease;
}

input:focus {
    border-color: var(--blue);

    box-shadow:
        0 0 0 3px rgba(43,149,255,.13);
}


/* ---------------------------------
   Buttons
---------------------------------- */

.button {
    appearance: none;

    border: 0;
    border-radius: 10px;

    padding: 10px 15px;

    cursor: pointer;

    font-weight: 650;

    color: var(--text);

    transition:
        transform .1s ease,
        background .15s ease,
        border-color .15s ease;
}

.button:active {
    transform: translateY(1px);
}

.button-primary {
    background: var(--blue);
}

.button-primary:hover {
    background: var(--blue-hover);
}

.button-secondary {
    border: 1px solid var(--border-light);
    background: transparent;
}

.button-secondary:hover {
    background: var(--panel-hover);
}

.button-ai {
    background:
        linear-gradient(
            135deg,
            #7659ef,
            #9d75ff
        );
}

.button-ai:hover {
    background:
        linear-gradient(
            135deg,
            #8469f2,
            #aa89ff
        );
}

.button-full {
    width: 100%;
    padding: 12px 16px;
}

.button-small {
    padding: 7px 11px;
    font-size: 14.4px;
}

.icon-button {
    width: 38px;
    height: 38px;

    border: 1px solid var(--border);
    border-radius: 10px;

    background: var(--panel);

    color: var(--text-soft);

    cursor: pointer;
}

.icon-button:hover {
    background: var(--panel-hover);
}


/* ---------------------------------
   Alert
---------------------------------- */

.alert {
    margin-bottom: 20px;
    padding: 12px 13px;

    border-radius: 9px;

    font-size: 15.6px;
}

.alert-error {
    border: 1px solid rgba(255,98,109,.35);
    background: rgba(255,98,109,.09);
    color: #ffafb5;
}


/* ---------------------------------
   App layout
---------------------------------- */

.app-shell {
    min-height: 100vh;

    display: grid;
    grid-template-columns:
        var(--sidebar-width)
        minmax(0,1fr);
}

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;

    width: var(--sidebar-width);

    padding: 21px 14px;

    background: var(--sidebar);

    border-right: 1px solid var(--border);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;

    padding: 0 9px 20px;
}

.sidebar-brand-main {
    font-size: 16.8px;
    font-weight: 750;
}

.sidebar-brand-sub {
    margin-top: 1px;

    font-size: 10.8px;
    letter-spacing: .15em;

    color: var(--text-muted);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 11px;

    min-height: 43px;

    padding: 0 12px;

    border-radius: 10px;

    color: var(--text-soft);

    font-size: 15.6px;

    transition:
        background .15s ease,
        color .15s ease;
}

.nav-item:hover {
    background: rgba(255,255,255,.035);
    color: var(--text);
}

.nav-item.active {
    background: rgba(43,149,255,.13);
    color: #8cc9ff;
}

.nav-item.ai-nav {
    color: #b5a5ff;
}

.nav-icon {
    width: 21px;
    text-align: center;
}

.app-main {
    grid-column: 2;
    min-width: 0;
}


/* ---------------------------------
   Topbar
---------------------------------- */

.topbar {
    min-height: 75px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 20px;

    padding: 14px 30px;

    border-bottom: 1px solid var(--border);

    background: rgba(7,19,33,.86);
}

.topbar h1 {
    margin: 0;

    font-size: 22.8px;
}

.topbar-sub {
    margin-top: 3px;

    color: var(--text-muted);
    font-size: 13.2px;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 9px;
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 9px;

    margin-left: 5px;
}

.user-avatar {
    width: 35px;
    height: 35px;

    display: grid;
    place-items: center;

    border-radius: 50%;

    background: #163653;

    font-weight: 700;
}

.user-info {
    display: flex;
    flex-direction: column;

    font-size: 14.4px;
}

.user-info small {
    color: var(--text-muted);
}


/* ---------------------------------
   Main Content
---------------------------------- */

.content {
    padding: 28px 30px 80px;
}

.section-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;

    gap: 20px;

    margin-bottom: 18px;
}

.section-heading h2 {
    margin: 3px 0 0;

    font-size: 26.4px;
}

.eyebrow {
    font-size: 10.8px;
    letter-spacing: .16em;

    color: #6289aa;
}


/* ---------------------------------
   KPI
---------------------------------- */

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

    gap: 12px;
}

.kpi-card {
    min-height: 126px;

    padding: 17px;

    border: 1px solid var(--border);
    border-radius: var(--radius);

    background:
        linear-gradient(
            180deg,
            rgba(255,255,255,.018),
            transparent
        ),
        var(--panel);
}

.kpi-label {
    color: var(--text-soft);
    font-size: 14.4px;
}

.kpi-value {
    margin-top: 16px;

    font-size: 30px;
    font-weight: 750;

    letter-spacing: -.03em;
}

.kpi-value span {
    margin-left: 3px;

    color: var(--text-soft);

    font-size: 13.2px;
    font-weight: 500;
}

.kpi-note {
    margin-top: 7px;

    color: var(--text-muted);

    font-size: 12px;
}

.profit-card .kpi-value {
    color: var(--green);
}


/* ---------------------------------
   Tooltip
---------------------------------- */

.help-wrap {
    position: relative;

    display: inline-flex;

    margin-left: 3px;
}

.help-button {
    width: 17px;
    height: 17px;

    padding: 0;

    border: 1px solid #55728d;
    border-radius: 50%;

    background: transparent;

    color: #8ca3b8;

    font-size: 12px;

    cursor: help;
}

.tooltip {
    position: absolute;

    z-index: 30;

    top: 25px;
    left: 50%;

    width: 245px;

    padding: 11px 12px;

    border: 1px solid var(--border-light);
    border-radius: 9px;

    background: #07121e;

    color: var(--text-soft);

    font-size: 13.2px;
    line-height: 1.6;

    box-shadow:
        0 13px 30px rgba(0,0,0,.28);

    transform:
        translateX(-50%)
        translateY(-4px);

    opacity: 0;
    visibility: hidden;

    transition:
        opacity .12s ease,
        transform .12s ease;
}

.tooltip strong {
    display: block;

    margin-bottom: 3px;

    color: var(--text);
}

.help-wrap:hover .tooltip,
.help-wrap:focus-within .tooltip {
    opacity: 1;
    visibility: visible;

    transform:
        translateX(-50%)
        translateY(0);
}


/* ---------------------------------
   Dashboard Panels
---------------------------------- */

.dashboard-grid {
    display: grid;
    grid-template-columns:
        2fr 1fr;

    gap: 14px;

    margin-top: 15px;
}

.panel {
    padding: 19px;

    border: 1px solid var(--border);
    border-radius: var(--radius);

    background: var(--panel);
}

.panel-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 12px;

    margin-bottom: 17px;
}

.panel-heading h3 {
    margin: 4px 0 0;

    font-size: 18px;
}

.production-flow {
    display: flex;
    align-items: center;

    gap: 10px;
}

.flow-item {
    flex: 1;

    padding: 14px;

    border: 1px solid var(--border);
    border-radius: 10px;

    background: var(--bg-soft);
}

.flow-item span {
    display: block;

    margin-bottom: 8px;

    color: var(--text-muted);

    font-size: 13.2px;
}

.flow-item strong {
    font-size: 26.4px;
}

.flow-arrow {
    color: #43627d;
}

.status-badge {
    display: inline-flex;
    align-items: center;

    min-height: 24px;

    padding: 0 9px;

    border-radius: 999px;

    font-size: 12px;
    font-weight: 700;
}

.status-success {
    border: 1px solid rgba(73,216,154,.25);

    background: rgba(73,216,154,.08);

    color: var(--green);
}

.system-list {
    margin: 0;
}

.system-list div {
    display: flex;
    justify-content: space-between;

    gap: 18px;

    padding: 10px 0;

    border-bottom: 1px solid var(--border);
}

.system-list div:last-child {
    border-bottom: 0;
}

.system-list dt {
    color: var(--text-muted);
    font-size: 13.2px;
}

.system-list dd {
    margin: 0;

    font-size: 13.2px;
}


/* ---------------------------------
   Mobile
---------------------------------- */

.mobile-nav {
    display: none;
}

@media (max-width: 1100px) {

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

}

@media (max-width: 760px) {

    .app-shell {
        display: block;
    }

    .sidebar {
        display: none;
    }

    .app-main {
        width: 100%;
    }

    .topbar {
        min-height: 64px;

        padding:
            11px
            15px;
    }

    .topbar-actions .icon-button,
    .user-info,
    .logout-form {
        display: none;
    }

    .content {
        padding:
            20px
            14px
            90px;
    }

    .section-heading {
        align-items: flex-start;
    }

    .section-heading .button-ai {
        padding: 8px 10px;

        font-size: 13.2px;
    }

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

        gap: 9px;
    }

    .kpi-card {
        min-height: 112px;

        padding: 14px;
    }

    .kpi-value {
        font-size: 26.4px;
    }

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

    .production-flow {
        align-items: stretch;
        flex-direction: column;
    }

    .flow-arrow {
        display: none;
    }

    .mobile-nav {
        position: fixed;

        z-index: 50;

        right: 10px;
        bottom: 10px;
        left: 10px;

        display: grid;
        grid-template-columns: repeat(4,1fr);

        padding:
            7px
            max(7px,env(safe-area-inset-right))
            calc(7px + env(safe-area-inset-bottom))
            max(7px,env(safe-area-inset-left));

        border: 1px solid var(--border);
        border-radius: 14px;

        background: rgba(9,23,38,.97);

        box-shadow:
            0 12px 35px rgba(0,0,0,.32);
    }

    .mobile-nav a {
        display: flex;
        flex-direction: column;
        align-items: center;

        gap: 3px;

        padding: 6px 3px;

        color: var(--text-muted);

        font-size: 10.8px;
    }

    .mobile-nav a span {
        font-size: 20.4px;
    }

    .mobile-nav a.active {
        color: #7bc2ff;
    }

}

@media (max-width: 430px) {

    .login-page {
        padding: 18px;
    }

    .login-card {
        padding: 25px 21px;
    }

    .user-chip {
        margin: 0;
    }

}


/* =====================================================
   Idea Management
===================================================== */

.action-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 9px;
}

.button[disabled] {
    opacity: .48;
    cursor: not-allowed;
}


/* Stats */

.stat-strip {
    display: grid;
    grid-template-columns: repeat(5, 1fr);

    margin-bottom: 15px;

    border: 1px solid var(--border);
    border-radius: var(--radius);

    background: var(--panel);

    overflow: hidden;
}

.stat-strip > div {
    padding: 15px 17px;

    border-right: 1px solid var(--border);
}

.stat-strip > div:last-child {
    border-right: 0;
}

.stat-strip span {
    display: block;

    margin-bottom: 6px;

    color: var(--text-muted);

    font-size: 12px;
}

.stat-strip strong {
    font-size: 25.2px;
}


/* Toolbar */

.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 15px;

    margin: 13px 0;
}

.view-switch {
    display: inline-flex;

    padding: 3px;

    border: 1px solid var(--border);
    border-radius: 9px;

    background: var(--bg-soft);
}

.view-switch a {
    padding: 7px 13px;

    border-radius: 7px;

    color: var(--text-muted);

    font-size: 13.2px;
}

.view-switch a.active {
    background: var(--panel-hover);
    color: var(--text);
}

.toolbar-note {
    color: var(--text-muted);
    font-size: 13.2px;
}


/* Table */

.table-panel {
    border: 1px solid var(--border);
    border-radius: var(--radius);

    background: var(--panel);

    overflow: hidden;
}

.responsive-table {
    width: 100%;
    overflow-x: auto;
}

.data-table {
    width: 100%;

    border-collapse: collapse;

    font-size: 14.4px;
}

.data-table th {
    padding: 12px 14px;

    color: var(--text-muted);

    font-size: 12px;
    font-weight: 600;

    text-align: left;

    background: rgba(255,255,255,.015);

    border-bottom: 1px solid var(--border);
}

.data-table td {
    padding: 13px 14px;

    border-bottom: 1px solid var(--border);

    color: var(--text-soft);

    white-space: nowrap;
}

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

.data-table tbody tr:hover {
    background: rgba(255,255,255,.018);
}

.table-title {
    color: var(--text);

    font-weight: 650;
}

.table-title:hover {
    color: #80c5ff;
}

.table-action {
    text-align: right;
}

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

    color: #6e9bbe;

    font-size: 12px;
}


/* Status */

.idea-status,
.neutral-badge {
    display: inline-flex;
    align-items: center;

    min-height: 24px;

    padding: 0 9px;

    border: 1px solid var(--border);

    border-radius: 999px;

    font-size: 12px;
    font-weight: 650;
}

.idea-status[data-status="候補"] {
    color: #8ecaff;
    background: rgba(43,149,255,.08);
    border-color: rgba(43,149,255,.25);
}

.idea-status[data-status="AI評価済"] {
    color: #b5a5ff;
    background: rgba(139,108,255,.09);
    border-color: rgba(139,108,255,.25);
}

.idea-status[data-status="採用"] {
    color: var(--green);
    background: rgba(73,216,154,.08);
    border-color: rgba(73,216,154,.25);
}

.idea-status[data-status="保留"] {
    color: var(--yellow);
    background: rgba(242,190,92,.08);
    border-color: rgba(242,190,92,.25);
}

.idea-status[data-status="却下"] {
    color: #ff969e;
    background: rgba(255,98,109,.07);
    border-color: rgba(255,98,109,.23);
}

.neutral-badge {
    color: var(--text-soft);
}


/* Kanban */

.kanban-board {
    display: grid;

    grid-template-columns:
        repeat(5,minmax(220px,1fr));

    gap: 11px;

    padding-bottom: 10px;

    overflow-x: auto;
}

.kanban-column {
    min-width: 220px;

    padding: 10px;

    border: 1px solid var(--border);
    border-radius: var(--radius);

    background: rgba(10,24,40,.58);
}

.kanban-column-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 10px;

    margin-bottom: 10px;

    padding: 3px 2px;
}

.kanban-column-heading strong {
    color: var(--text-muted);

    font-size: 13.2px;
}

.kanban-stack {
    display: flex;
    flex-direction: column;

    gap: 8px;
}

.kanban-card {
    display: block;

    padding: 13px;

    border: 1px solid var(--border);
    border-radius: 10px;

    background: var(--panel);

    transition:
        transform .12s ease,
        background .12s ease,
        border-color .12s ease;
}

.kanban-card:hover {
    transform: translateY(-1px);

    background: var(--panel-hover);
    border-color: var(--border-light);
}

.kanban-card h3 {
    margin: 7px 0 9px;

    font-size: 15.6px;
    line-height: 1.5;
}

.kanban-card p {
    margin: 9px 0 0;

    color: var(--text-muted);

    font-size: 12px;
    line-height: 1.6;
}

.kanban-meta {
    display: flex;
    flex-wrap: wrap;

    gap: 5px;
}

.kanban-meta span {
    padding: 3px 6px;

    border-radius: 5px;

    background: rgba(255,255,255,.035);

    color: var(--text-muted);

    font-size: 10.8px;
}


/* Forms */

.editor-layout {
    display: grid;
    grid-template-columns:
        minmax(0,1fr)
        minmax(0,1.25fr);

    gap: 14px;
}

.form-panel {
    align-self: start;
}

.form-panel textarea,
.form-panel select {
    width: 100%;

    padding: 11px 13px;

    border: 1px solid var(--border-light);
    border-radius: var(--radius-small);

    outline: none;

    color: var(--text);

    background: #091827;
}

.form-panel textarea {
    resize: vertical;

    line-height: 1.65;
}

.form-panel textarea:focus,
.form-panel select:focus {
    border-color: var(--blue);

    box-shadow:
        0 0 0 3px rgba(43,149,255,.13);
}

.form-grid-2 {
    display: grid;
    grid-template-columns: repeat(2,1fr);

    gap: 12px;
}

.form-grid-3 {
    display: grid;
    grid-template-columns: repeat(3,1fr);

    gap: 12px;
}

.form-actions {
    grid-column: 1 / -1;

    display: flex;
    justify-content: flex-end;

    gap: 9px;

    padding-top: 2px;
}


/* Detail */

.detail-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;

    gap: 20px;

    margin-bottom: 17px;
}

.detail-code {
    margin-bottom: 4px;

    color: #6293bb;

    font-family:
        "SFMono-Regular",
        Consolas,
        monospace;

    font-size: 12px;
}

.detail-header h2 {
    margin: 0 0 10px;

    font-size: 28.8px;
}

.detail-tags {
    display: flex;
    flex-wrap: wrap;

    gap: 6px;
}

.detail-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;

    gap: 14px;

    margin-bottom: 14px;
}

.detail-list {
    margin: 0;
}

.detail-list > div {
    display: flex;
    justify-content: space-between;

    gap: 20px;

    padding: 10px 0;

    border-bottom: 1px solid var(--border);
}

.detail-list > div:last-child {
    border-bottom: 0;
}

.detail-list dt {
    color: var(--text-muted);
    font-size: 13.2px;
}

.detail-list dd {
    margin: 0;

    font-size: 14.4px;
}

.rich-text {
    color: var(--text-soft);

    line-height: 1.8;

    white-space: pre-wrap;
}

.story-grid {
    display: grid;
    grid-template-columns:
        minmax(0,.8fr)
        minmax(0,1.5fr)
        minmax(0,.8fr);

    gap: 14px;

    margin-bottom: 14px;
}

.story-label {
    margin-bottom: 11px;

    color: #74a8d0;

    font-size: 12px;
    font-weight: 700;
}

.story-content {
    color: var(--text-soft);

    font-size: 14.4px;
    line-height: 1.75;

    white-space: pre-wrap;
}

.status-control {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 20px;
}

.status-control h3 {
    margin: 3px 0 0;

    font-size: 16.8px;
}

.status-actions {
    display: flex;
    flex-wrap: wrap;

    gap: 6px;
}

.status-action-button {
    min-height: 32px;

    padding: 0 11px;

    border: 1px solid var(--border-light);
    border-radius: 8px;

    background: transparent;

    color: var(--text-soft);

    cursor: pointer;

    font-size: 12px;
}

.status-action-button:hover {
    background: var(--panel-hover);
}

.status-action-button.current {
    opacity: .55;
    cursor: default;
}


/* Empty state */

.empty-state {
    padding: 65px 25px;

    text-align: center;
}

.empty-icon {
    margin-bottom: 10px;

    color: #5687af;

    font-size: 42px;
}

.empty-state h3 {
    margin: 0 0 8px;
}

.empty-state p {
    max-width: 480px;

    margin: 0 auto 20px;

    color: var(--text-muted);

    font-size: 14.4px;
    line-height: 1.7;
}


/* Responsive idea pages */

@media (max-width: 900px) {

    .editor-layout,
    .detail-grid,
    .story-grid {
        grid-template-columns: 1fr;
    }

    .stat-strip {
        grid-template-columns:
            repeat(5,minmax(100px,1fr));

        overflow-x: auto;
    }

}


@media (max-width: 600px) {

    .detail-header {
        flex-direction: column;
    }

    .detail-header h2 {
        font-size: 24px;
    }

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

    .status-control {
        align-items: flex-start;
        flex-direction: column;
    }

    .section-heading {
        flex-direction: column;
    }

}


/* =====================================================
   Video Production
===================================================== */

.production-status {
    display: inline-flex;
    align-items: center;

    min-height: 24px;

    padding: 0 9px;

    border: 1px solid rgba(43,149,255,.25);
    border-radius: 999px;

    background: rgba(43,149,255,.08);

    color: #8ecaff;

    font-size: 12px;
    font-weight: 650;
}

.production-progress-panel {
    margin-bottom: 14px;
}

.production-steps {
    display: grid;
    grid-template-columns: repeat(9,minmax(90px,1fr));

    gap: 6px;

    overflow-x: auto;
}

.production-step-form {
    min-width: 90px;
}

.production-step {
    width: 100%;
    min-height: 76px;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    gap: 7px;

    padding: 8px;

    border: 1px solid var(--border);
    border-radius: 9px;

    background: var(--bg-soft);

    color: var(--text-muted);

    cursor: pointer;
}

.production-step:hover {
    border-color: var(--border-light);
    background: var(--panel-hover);
}

.production-step.completed {
    border-color: rgba(73,216,154,.22);
    color: var(--green);
}

.production-step.current {
    border-color: rgba(43,149,255,.45);
    background: rgba(43,149,255,.09);
    color: #9bd1ff;
}

.step-dot {
    width: 24px;
    height: 24px;

    display: grid;
    place-items: center;

    border: 1px solid currentColor;
    border-radius: 50%;

    font-size: 10.8px;
    font-weight: 700;
}

.step-name {
    font-size: 10.8px;
    white-space: nowrap;
}

.source-idea h4 {
    margin: 7px 0 10px;

    font-size: 16.8px;
}

.source-idea p {
    margin: 0 0 14px;

    color: var(--text-muted);

    font-size: 13.2px;
    line-height: 1.7;
}

.project-path-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 20px;

    margin-top: 14px;
}

.project-path-panel h3 {
    margin: 3px 0 0;
    font-size: 16.8px;
}

.project-path-panel code {
    padding: 8px 10px;

    border: 1px solid var(--border);
    border-radius: 7px;

    background: #07121e;

    color: #75a9d2;

    font-size: 12px;
}

@media (max-width: 760px) {

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

    .project-path-panel code {
        width: 100%;
        overflow-x: auto;
    }

}


/* =====================================================
   Reference Library
===================================================== */

.reference-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;

    margin-bottom: 16px;
}

.reference-filter a {
    padding: 8px 12px;

    border: 1px solid var(--border);
    border-radius: 999px;

    color: var(--text-muted);

    font-size: 12px;
}

.reference-filter a.active,
.reference-filter a:hover {
    background: var(--panel-hover);
    color: var(--text);
    border-color: var(--border-light);
}

.reference-grid {
    display: grid;
    grid-template-columns:
        repeat(auto-fill,minmax(210px,1fr));

    gap: 14px;
}

.reference-card {
    overflow: hidden;

    border: 1px solid var(--border);
    border-radius: var(--radius);

    background: var(--panel);

    transition:
        transform .12s ease,
        border-color .12s ease,
        background .12s ease;
}

.reference-card:hover {
    transform: translateY(-2px);

    border-color: var(--border-light);

    background: var(--panel-hover);
}

.reference-image {
    position: relative;

    aspect-ratio: 4 / 3;

    background: #07121e;

    overflow: hidden;
}

.reference-image img {
    width: 100%;
    height: 100%;

    object-fit: cover;
}

.reference-status {
    display: inline-flex;
    align-items: center;

    min-height: 24px;

    padding: 0 9px;

    border-radius: 999px;

    font-size: 11px;
    font-weight: 700;
}

.reference-image .reference-status {
    position: absolute;

    top: 9px;
    right: 9px;

    backdrop-filter: blur(7px);
}

.reference-status[data-status="下書き"] {
    color: #a9bdd0;
    background: rgba(10,24,40,.88);
    border: 1px solid var(--border-light);
}

.reference-status[data-status="確認中"] {
    color: var(--yellow);
    background: rgba(45,36,18,.9);
    border: 1px solid rgba(242,190,92,.32);
}

.reference-status[data-status="FIX"] {
    color: var(--green);
    background: rgba(11,46,37,.91);
    border: 1px solid rgba(73,216,154,.34);
}

.reference-status[data-status="旧版"] {
    color: #91a0ae;
    background: rgba(22,28,35,.9);
    border: 1px solid #42505c;
}

.reference-card-body {
    padding: 14px;
}

.reference-card-body h3 {
    margin: 6px 0;

    font-size: 16px;
}

.reference-meta {
    color: var(--text-muted);
    font-size: 11px;
}

.field-help {
    margin-top: 7px;

    color: var(--text-muted);

    font-size: 11px;
}

.reference-detail-grid {
    display: grid;
    grid-template-columns:
        minmax(0,1.5fr)
        minmax(300px,.8fr);

    gap: 14px;

    margin-bottom: 14px;
}

.reference-main-image {
    display: block;

    width: 100%;
    max-height: 720px;

    object-fit: contain;

    border-radius: 9px;

    background: #07121e;
}

.reference-description {
    margin-top: 18px;

    color: var(--text-soft);

    line-height: 1.8;

    white-space: pre-wrap;
}

.prompt-panel {
    margin-top: 14px;
}

.prompt-block {
    margin-top: 14px;
}

.prompt-block label {
    display: block;

    margin-bottom: 8px;

    color: var(--text-muted);

    font-size: 11px;
}

.prompt-block pre {
    margin: 0;

    padding: 14px;

    overflow-x: auto;

    border: 1px solid var(--border);
    border-radius: 9px;

    background: #07121e;

    color: var(--text-soft);

    font-family:
        "SFMono-Regular",
        Consolas,
        monospace;

    font-size: 11px;
    line-height: 1.65;

    white-space: pre-wrap;
}

@media (max-width: 800px) {

    .reference-detail-grid {
        grid-template-columns: 1fr;
    }

}


/* =====================================================
   Video Reference Assignment
===================================================== */

.video-reference-panel {
    margin-top: 14px;
}

.video-reference-grid {
    display: grid;
    grid-template-columns:
        repeat(auto-fill,minmax(280px,1fr));

    gap: 12px;

    margin-bottom: 24px;
}

.video-reference-card {
    overflow: hidden;

    border: 1px solid var(--border);
    border-radius: 11px;

    background: var(--bg-soft);
}

.video-reference-image {
    display: block;

    height: 180px;

    overflow: hidden;

    background: #07121e;
}

.video-reference-image img {
    width: 100%;
    height: 100%;

    object-fit: cover;
}

.video-reference-body {
    padding: 14px;
}

.reference-card-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;

    gap: 10px;

    margin-bottom: 12px;
}

.reference-card-heading strong {
    display: block;

    margin-top: 4px;

    font-size: 15px;
}

.reference-usage {
    margin-bottom: 12px;

    color: var(--text-soft);

    font-size: 12px;
}

.reference-warning {
    margin-bottom: 12px;

    padding: 9px 10px;

    border: 1px solid rgba(242,190,92,.25);
    border-radius: 8px;

    background: rgba(242,190,92,.07);

    color: var(--yellow);

    font-size: 11px;
}

.reference-add {
    padding-top: 19px;

    border-top: 1px solid var(--border);
}

.reference-add h4 {
    margin: 0 0 14px;

    font-size: 15px;
}

.reference-add-form {
    display: grid;

    grid-template-columns:
        minmax(220px,1.5fr)
        minmax(180px,1fr)
        auto;

    align-items: end;

    gap: 11px;
}

.reference-add-form .form-group {
    margin-bottom: 0;
}

.reference-add-form select {
    width: 100%;

    padding: 11px 13px;

    border: 1px solid var(--border-light);
    border-radius: var(--radius-small);

    background: #091827;
    color: var(--text);
}

.inline-empty {
    padding: 18px;

    border: 1px dashed var(--border-light);
    border-radius: 9px;

    color: var(--text-muted);

    font-size: 12px;
}

.inline-empty a {
    color: #76bdff;
}

.field-help-inline {
    margin-left: 5px;

    color: var(--text-muted);

    font-size: 10px;
    font-weight: normal;
}

@media (max-width: 760px) {

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

}


/* =====================================================
   Official FIX Branding
===================================================== */

.app-brand-logo {
    display: block;
    width: 170px;
    max-width: 100%;
    height: 48px;
    object-fit: contain;
    object-position: left center;
}

.login-brand-logo {
    display: block;
    width: 260px;
    max-width: 100%;
    height: auto;
    object-fit: contain;
}

.sidebar-brand .app-brand-logo + div {
    display: none;
}

.login-brand .login-brand-logo + div {
    display: none;
}


/* =====================================================
   Branding FIX v2
===================================================== */

.sidebar {
    overflow: hidden;
}

.sidebar-brand {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;

    min-height: 58px;
    padding: 4px 8px 18px !important;

    overflow: hidden;
}

.brand-app-icon {
    flex: 0 0 auto;

    display: block !important;

    width: 38px !important;
    height: 38px !important;

    max-width: 38px !important;
    max-height: 38px !important;

    object-fit: contain !important;
}

.sidebar-brand-main {
    display: block !important;

    font-weight: 750;
    white-space: nowrap;
}

.sidebar-brand-sub {
    display: block !important;

    margin-top: 2px;

    letter-spacing: .12em;
}


/* Login branding */

.login-brand {
    width: min(440px, 100%);

    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;

    gap: 14px !important;

    margin-bottom: 22px;

    overflow: hidden;
}

.login-app-icon {
    flex: 0 0 auto;

    display: block !important;

    width: 54px !important;
    height: 54px !important;

    max-width: 54px !important;
    max-height: 54px !important;

    object-fit: contain !important;
}

.login-brand > div {
    display: block !important;
}

.login-brand .brand-title {
    font-weight: 750;
}

.login-brand .brand-subtitle {
    display: block !important;
}


/* 旧ロゴ部品は使用しない */

.app-brand-logo,
.login-brand-logo {
    display: none !important;
}


/* =====================================================
   Layout Repair 2026-09-22
===================================================== */

.app-shell {
    min-height: 100vh !important;
    display: grid !important;
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr) !important;
}

.sidebar {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    bottom: 0 !important;

    width: var(--sidebar-width) !important;
    height: 100vh !important;

    padding: 18px 14px !important;

    overflow-y: auto !important;
    overflow-x: hidden !important;
}

.app-main {
    grid-column: 2 !important;
    width: auto !important;
    min-width: 0 !important;
}

.sidebar-brand {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;

    gap: 10px !important;

    width: 100% !important;
    min-height: 48px !important;

    padding: 0 8px 18px !important;
    margin: 0 !important;

    overflow: hidden !important;
}

.brand-app-icon {
    display: block !important;

    flex: 0 0 34px !important;

    width: 34px !important;
    height: 34px !important;

    min-width: 34px !important;
    max-width: 34px !important;

    min-height: 34px !important;
    max-height: 34px !important;

    object-fit: contain !important;
}

.sidebar-brand-text {
    display: block !important;

    min-width: 0 !important;

    overflow: hidden !important;
}

.sidebar-brand-main {
    display: block !important;

    white-space: nowrap !important;

    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

.sidebar-brand-sub {
    display: block !important;
}

.sidebar-nav {
    display: flex !important;
    flex-direction: column !important;

    gap: 4px !important;

    margin: 0 !important;
    padding: 0 !important;
}


/* Login */

.login-page {
    min-height: 100vh !important;
    min-height: 100svh !important;

    display: flex !important;
    flex-direction: column !important;

    align-items: center !important;
    justify-content: center !important;

    padding: 24px !important;

    position: relative !important;
}

.login-brand {
    position: static !important;

    width: min(440px, 100%) !important;

    display: flex !important;
    flex-direction: row !important;

    align-items: center !important;
    justify-content: flex-start !important;

    gap: 13px !important;

    margin: 0 0 20px !important;

    transform: none !important;
}

.login-app-icon {
    display: block !important;

    flex: 0 0 46px !important;

    width: 46px !important;
    height: 46px !important;

    min-width: 46px !important;
    max-width: 46px !important;

    min-height: 46px !important;
    max-height: 46px !important;

    object-fit: contain !important;
}

.login-brand-text {
    display: block !important;
}

.login-card {
    position: static !important;

    width: min(440px, 100%) !important;

    margin: 0 !important;

    transform: none !important;
}

.login-footer {
    position: static !important;

    margin: 20px 0 0 !important;

    transform: none !important;
}


/* 古いロゴ画像UIは完全停止 */

.app-brand-logo,
.login-brand-logo {
    display: none !important;
}


/* Mobile */

@media (max-width: 760px) {

    .app-shell {
        display: block !important;
    }

    .sidebar {
        display: none !important;
    }

    .app-main {
        width: 100% !important;
    }

}


/* =====================================================
   Official Icon System / ICON-Design-FIX
===================================================== */

.nav-svg {
    flex: 0 0 auto;

    width: 24px;
    height: 24px;

    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.nav-item {
    gap: 12px;
}

.nav-item .nav-svg {
    color: #a9c8e9;
}

.nav-item:hover .nav-svg {
    color: #d6e9ff;
}

.nav-item.active .nav-svg {
    color: #49a9ff;
}

.nav-item.ai-nav .nav-svg {
    color: #9c7cff;
}

.mobile-nav-svg {
    width: 23px;
    height: 23px;

    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.mobile-nav a.active .mobile-nav-svg {
    color: #54adff;
}

/* 旧文字アイコン */
.nav-icon {
    display: none !important;
}
