:root {
    --bg-main: #eef1f8;
    --bg-sub: #e6eaf4;
    --bg-card: #f4f6fb;
    --bg-card-strong: #dde3f2;

    --sidebar-bg: #2f334a;
    --sidebar-bg-hover: #3a3f5b;
    --header-bg: #353a56;
    --mobile-menu-bg: #3a3f5b;

    --text-main: #2d3142;
    --text-sub: #5b6280;
    --text-on-dark: #eef1f8;

    --primary: #7b7fe8;
    --primary-soft: #989cf0;
    --accent: #76c7df;
    --accent-soft: #a6d9e8;

    --border: #cfd6e6;
    --shadow: rgba(76, 88, 140, 0.12);

    --success-bg: #dff3ea;
    --success-text: #2f6b52;

    --danger-bg: #f3dce5;
    --danger-text: #8a4f69;

    --practice-bg: #dbeaf2;
    --production-bg: #eadcf6;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    background: linear-gradient(180deg, var(--bg-main) 0%, var(--bg-sub) 100%);
    color: var(--text-main);
    font-family: "Helvetica Neue", Arial, "Hiragino Kaku Gothic ProN", "Hiragino Sans", Meiryo, sans-serif;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    opacity: 0.9;
}

.app-shell {
    min-height: 100vh;
    display: flex;
}

.sidebar {
    width: 260px;
    background: linear-gradient(180deg, var(--sidebar-bg) 0%, #3a2a43 100%);
    color: var(--text-on-dark);
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: 2px 0 14px var(--shadow);
}

.sidebar__title {
    padding: 20px;
    font-size: 20px;
    font-weight: 700;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    letter-spacing: 0.04em;
}

.sidebar__nav {
    padding: 16px;
}

.sidebar__nav a {
    display: block;
    color: var(--text-on-dark);
    padding: 10px 12px;
    border-radius: 10px;
    margin-bottom: 6px;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.sidebar__nav a:hover {
    background: var(--sidebar-bg-hover);
    transform: translateX(2px);
}

/* メインエリア全体に背景 */
.main-area {
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
    z-index: 0;
}

/* 背景画像 */
.main-area::before {
    content: "";
    position: fixed;
    top: 0;
    left: 260px; /* サイドバー分 */
    width: calc(100% - 260px);
    height: 100%;

    background: url('/img/background.png') center center / cover no-repeat;

    opacity: 0.5;
    z-index: -2;
}

/* 上にかぶせるフィルター */
.main-area::after {
    content: "";
    position: fixed;
    top: 0;
    left: 260px;
    width: calc(100% - 260px);
    height: 100%;

    background: linear-gradient(
        180deg,
        rgba(235, 240, 250, 0.85),
        rgba(240, 243, 250, 0.9)
    );

    z-index: -1;
}
@media (max-width: 767px) {
    .main-area::before,
    .main-area::after {
        left: 0;
        width: 100%;
    }
}

.sp-header {
    display: none;
    background: linear-gradient(90deg, var(--header-bg) 0%, #41476a 100%);
    color: var(--text-on-dark);
    padding: 14px 16px;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 10px var(--shadow);
}

.sp-header__button {
    border: none;
    background: transparent;
    color: var(--text-on-dark);
    font-size: 22px;
    cursor: pointer;
}

.sp-header__title {
    font-weight: 700;
    letter-spacing: 0.04em;
}

.mobile-menu {
    display: none;
    background: var(--mobile-menu-bg);
    color: var(--text-on-dark);
    padding: 12px 16px 16px;
    box-shadow: 0 4px 14px var(--shadow);
}

.mobile-menu.is-open {
    display: block;
}

.mobile-menu a {
    display: block;
    color: var(--text-on-dark);
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.content {
    padding: 24px;
}

.page-title {
    font-size: 28px;
    font-weight: 700;
    margin: 0 0 20px;
    color: var(--text-main);
}

.card {
    background: linear-gradient(180deg, var(--bg-card) 0%, #edf1f9 100%);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 6px 18px var(--shadow);
    padding: 24px;
}

.card + .card {
    margin-top: 20px;
}

.muted {
    color: var(--text-sub);
}

.input,
.select,
.textarea {
    width: 100%;
    border: 1px solid var(--border);
    background: #eef2f9;
    color: var(--text-main);
    border-radius: 10px;
    padding: 10px 12px;
    outline: none;
}

.input:focus,
.select:focus,
.textarea:focus {
    border-color: var(--primary-soft);
    box-shadow: 0 0 0 3px rgba(123, 127, 232, 0.15);
}

.button {
    display: inline-block;
    border: none;
    border-radius: 10px;
    padding: 10px 16px;
    background: linear-gradient(90deg, var(--primary) 0%, var(--accent) 100%);
    color: #f4f6fb;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(123, 127, 232, 0.18);
}

.button:hover {
    opacity: 0.95;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

.badge--practice {
    background: var(--practice-bg);
    color: #48657a;
}

.badge--production {
    background: var(--production-bg);
    color: #6b4f85;
}

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

.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-card);
    border-radius: 14px;
    overflow: hidden;
}

.table th,
.table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    white-space: nowrap;
}

.table th {
    background: #e7ebf6;
    color: var(--text-main);
    font-size: 14px;
}

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

.row-practice td {
    background: rgba(118, 199, 223, 0.08);
}

.row-production td {
    background: rgba(155, 124, 232, 0.08);
}

.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.auth-card {
    width: 100%;
    max-width: 380px;
    background: linear-gradient(180deg, var(--bg-card) 0%, #edf1f9 100%);
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: 0 10px 24px var(--shadow);
    padding: 28px;
}

.auth-title {
    margin: 0 0 18px;
    text-align: center;
    font-size: 24px;
    font-weight: 700;
}

.error-text {
    color: #9a5572;
    font-size: 14px;
    margin-bottom: 12px;
}

@media (max-width: 767px) {
    .sidebar {
        display: none;
    }

    .sp-header {
        display: flex;
    }

    .content {
        padding: 16px;
    }

    .page-title {
        font-size: 24px;
    }

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

/* ===== Chart共通 ===== */
.chart-container {
    position: relative;
    width: 100%;
    height: 420px;
    max-height: 1200px;
}

/* SP対応 */
@media (max-width: 768px) {
    .chart-container {
        height: 260px;
        max-height: 320px;
    }
}

/* テーブル横スクロール */
.table-wrap {
    overflow-x: auto;
}

.custom-pagination {
    margin-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.custom-pagination__summary {
    color: var(--text-sub);
    font-size: 14px;
}

.custom-pagination__links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.custom-pagination__item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 38px;
    padding: 0 12px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.72);
    color: var(--text-main);
    text-decoration: none;
}

.custom-pagination__item:hover {
    background: rgba(255, 255, 255, 0.92);
}

.custom-pagination__item--active {
    background: linear-gradient(90deg, var(--primary) 0%, var(--accent) 100%);
    color: #f4f6fb;
    border-color: transparent;
}

.custom-pagination__item--disabled {
    opacity: 0.5;
    pointer-events: none;
}