/* ============================================================================
   KohaPanel UI — "ORBIT"  (v4.1 / calm pass)
   ----------------------------------------------------------------------------
   これまでの左サイドバー + カードグリッドの構成を廃止し、レイアウトから
   組み直したレイヤー。読み込み順は styles.css の「後」。

   * ナビゲーション : 画面上部の固定バー(横並び)
   * サーバー一覧   : カードグリッド → 横長の行リスト
   * 電源操作       : ページ見出し右 → 上部バー内のコマンド群
   * ログイン       : 中央カード → 左右分割(ブランド / フォーム)
   * アカウント     : 上部バーのボタン → 大きな設定ダイアログ
   * 形状           : 角丸7〜12px、フラット面 + ヘアライン
   * 配色           : 深い紺 + ブルーを基調に、状態色のみ彩度を持たせる

   元に戻す場合: 各 HTML の <link href="/kohapanel-ui.css"> を外すだけ。
   ========================================================================== */

/* ==========================================================================
   0. トークン
   ========================================================================== */
:root {
    /* 面 */
    --kp-canvas: #0a1120;
    --kp-bar: #0d1628;
    --kp-surface: #111c31;
    --kp-surface-2: #16233c;
    --kp-inset: #0b1424;
    --kp-hover: rgba(var(--kp-indigo-rgb), 0.10);
    --kp-tint: rgba(var(--kp-indigo-rgb), 0.07);

    /* 線 */
    --kp-line: #1e2c48;
    --kp-line-2: #2b3d60;

    /* 文字 */
    --kp-text: #e8eef9;
    --kp-muted: #a6b2c9;
    --kp-faint: #76839c;

    /* アクセント */
    --kp-indigo: #4f7df3;
    --kp-indigo-2: #6b93ff;
    --kp-indigo-rgb: 79, 125, 243;
    --kp-violet: #7c8cf8;
    --kp-mint: #3fc0b0;
    --kp-lime: #b5ce6a;
    --kp-amber: #d9a043;
    --kp-rose: #df5c6e;
    --kp-emerald: #3fbd92;

    /* 既存コードが参照する変数 */
    --bg-primary: var(--kp-canvas);
    --bg-secondary: var(--kp-surface);
    --bg-color: var(--kp-canvas);
    --bg-glass: rgba(17, 28, 49, 0.94);
    --glass-bg: var(--kp-surface);
    --glass-border: var(--kp-line-2);
    --border-color: var(--kp-line);
    --text-primary: var(--kp-text);
    --text-secondary: var(--kp-muted);
    --accent-blue: var(--kp-indigo);
    --accent-blue-hover: #6b93ff;
    --accent-blue-rgb: 79, 125, 243;
    --success: var(--kp-emerald);
    --success-green: var(--kp-emerald);
    --danger: var(--kp-rose);
    --error-red: var(--kp-rose);
    --warning: var(--kp-amber);

    /* 形 */
    --kp-shadow: 0 6px 20px rgba(3, 6, 14, 0.35);
    --kp-shadow-pop: 0 18px 50px rgba(2, 5, 12, 0.55);
    --kp-ring: 0 0 0 3px rgba(79, 125, 243, 0.22);
    --kp-t: 0.16s ease;

    --font-main: 'Inter', 'Noto Sans JP', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --font-mono: 'Cascadia Code', Consolas, Menlo, 'Ubuntu Mono', monospace;
}

/* ==========================================================================
   1. ベース
   ========================================================================== */
html {
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-main);
    color: var(--kp-text);
    background: var(--kp-canvas);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

::selection {
    background: rgba(124, 108, 255, 0.38);
    color: #fff;
}

* {
    scrollbar-width: thin;
    scrollbar-color: #2a3557 transparent;
}

*::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

*::-webkit-scrollbar-thumb {
    background: #2a3557;
    border: 2px solid transparent;
    background-clip: padding-box;
    border-radius: 99px;
}

*::-webkit-scrollbar-thumb:hover {
    background: #3a4875;
    background-clip: padding-box;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
    outline: 2px solid var(--kp-mint);
    outline-offset: 2px;
}

h1,
h2,
h3,
h4 {
    letter-spacing: -0.025em;
}

.glass {
    background: var(--kp-surface);
    border: 1px solid var(--kp-line);
    border-radius: 12px;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

/* ==========================================================================
   2. 上部ナビゲーションバー(旧サイドバー)
   ========================================================================== */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    padding-top: 0;
}

.sidebar {
    position: sticky;
    top: 0;
    z-index: 500;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 14px;
    width: 100%;
    height: auto;
    min-height: 64px;
    padding: 0 clamp(12px, 2.2vw, 26px);
    background: var(--kp-bar);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-right: none;
    border-bottom: 1px solid var(--kp-line);
    overflow: visible;
}

/* 旧サイドバーのドロワー変形を無効化(常に上部バー) */
.sidebar,
.sidebar.active {
    transform: none;
}

/* 右側クラスタを押し出すスペーサー(電源コマンドの有無に関係なく機能する) */
.sidebar::after {
    content: '';
    display: block;
    order: 2;
    flex: 1 1 auto;
}

/* 上端のカラーライン(控えめな1本線) */
.sidebar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--kp-indigo);
}

.sidebar-header {
    flex: 0 0 auto;
    padding: 0;
    border: none;
    background: none;
}

.sidebar-header h2 {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 0.98rem;
    font-weight: 750;
    letter-spacing: -0.02em;
    color: var(--kp-text);
    white-space: nowrap;
}

.panel-logo {
    width: 26px;
    height: 26px;
    object-fit: contain;
    border-radius: 7px;
}

/* チャンネル表示 */
.sidebar-header h2::after {
    content: 'RELEASE';
    margin-left: 2px;
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid rgba(217, 160, 67, 0.45);
    background: rgba(217, 160, 67, 0.12);
    color: #e8bd76;
    font-size: 0.56rem;
    font-weight: 700;
    letter-spacing: 0.09em;
}

body.admin-page .sidebar-header h2::after {
    content: 'ADMIN';
    border-color: rgba(63, 192, 176, 0.45);
    background: rgba(63, 192, 176, 0.12);
    color: #78d6c9;
}

/* --- ナビ --- */
.sidebar-nav {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 3px;
    order: 1;
    flex: 0 1 auto;
    min-width: 0;
    padding: 0;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
}

.sidebar-nav::-webkit-scrollbar {
    display: none;
}

.nav-section-title,
.admin-nav-section {
    display: none;
}

.nav-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
    width: auto;
    min-height: 36px;
    height: 36px;
    padding: 0 12px;
    border: none;
    border-radius: 7px;
    background: transparent;
    color: var(--kp-muted);
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    position: relative;
    transition: background var(--kp-t), color var(--kp-t);
}

.nav-item i {
    font-size: 0.9rem;
    color: var(--kp-faint);
    transition: color var(--kp-t);
}

.nav-item::before,
.nav-item::after {
    display: none;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--kp-text);
    transform: none;
}

.nav-item:hover i {
    color: var(--kp-text);
}

.nav-item.active {
    background: rgba(var(--kp-indigo-rgb), 0.16);
    color: #fff;
    box-shadow: inset 0 0 0 1px rgba(var(--kp-indigo-rgb), 0.34);
    transform: none;
}

.nav-item.active i {
    color: var(--kp-indigo-2);
}

/* 選択中のサーバー名はチップとして表示 */
#nav-server .nav-section-title {
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
    margin: 0 6px 0 2px;
    padding: 4px 11px;
    border-radius: 999px;
    border: 1px solid rgba(45, 212, 191, 0.32);
    background: rgba(45, 212, 191, 0.10);
    color: #7ff0e2;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: none;
    text-overflow: ellipsis;
    max-width: 220px;
    overflow: hidden;
    white-space: nowrap;
}

/* --- 右側クラスタ --- */
.sidebar-footer {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
    order: 4;
    margin-left: 0;
    padding: 0;
    border-top: none;
    background: none;
    font-size: 0.8rem;
    color: var(--kp-muted);
    overflow: visible;
}

/* 上部バー内に置かれた通常ボタン(戻る等)はピルに畳む */
.sidebar-footer .btn {
    width: auto !important;
    min-height: 34px;
    height: 34px;
    padding: 0 14px;
    margin: 0 !important;
    border-radius: 7px;
    font-size: 0.8rem;
    white-space: nowrap;
    box-shadow: none;
}

/* アイコンは上部バーに収まるサイズに固定 */
.sidebar-footer .action-icon-wrapper {
    min-width: 30px;
    min-height: 30px;
}

/* --- サーバー表示中(旧: 細い縦レール)も同じ上部バーのまま --- */
body:not(.admin-page):not(.theme-pterodactyl):has(#nav-server:not([style*="none"])) .sidebar {
    width: 100%;
    overflow: visible;
}

body:not(.admin-page):not(.theme-pterodactyl):has(#nav-server:not([style*="none"])) .sidebar-header {
    padding: 0;
}

body:not(.admin-page):not(.theme-pterodactyl):has(#nav-server:not([style*="none"])) .sidebar-header h2 {
    font-size: 0.98rem;
}

body:not(.admin-page):not(.theme-pterodactyl):has(#nav-server:not([style*="none"])) .sidebar-nav {
    padding: 0;
    gap: 3px;
}

body:not(.admin-page):not(.theme-pterodactyl):has(#nav-server:not([style*="none"])) #nav-server .nav-item {
    min-height: 36px;
    height: 36px;
    padding: 0 12px;
    font-size: 0.85rem;
    gap: 8px;
}

body:not(.admin-page):not(.theme-pterodactyl):has(#nav-server:not([style*="none"])) .sidebar-footer {
    padding: 0;
    font-size: 0.8rem;
}

body:not(.admin-page):not(.theme-pterodactyl):has(#nav-server:not([style*="none"])) .sidebar-footer #btn-admin-menu {
    margin: 0 !important;
}

.sidebar-user {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 4px;
    padding: 4px 6px 4px 10px;
    border: 1px solid var(--kp-line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.03);
}

.sidebar-user-main {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.user-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    flex: 0 0 26px;
    border-radius: 50%;
    background: var(--kp-indigo);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
}

.user-text {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
    max-width: 150px;
}

.user-name {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--kp-text);
    line-height: 1.25;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.64rem;
    color: var(--kp-faint);
    line-height: 1.2;
    white-space: nowrap;
}

.user-actions {
    display: flex;
    align-items: center;
    gap: 2px;
    margin: 0;
    padding: 0;
    border: none;
}

.action-icon-wrapper {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    min-height: 32px;
    border-radius: 8px;
    transition: background var(--kp-t);
}

.action-icon-wrapper:hover {
    background: rgba(255, 255, 255, 0.08);
}

.action-icon {
    font-size: 0.95rem;
    color: var(--kp-muted);
}

.action-icon-wrapper:hover .action-icon {
    color: var(--kp-text);
}

/* アカウントボタン(上部バー) */
button.kp-account-button {
    padding: 0;
    border: none;
    background: transparent;
    color: inherit;
    cursor: pointer;
    font: inherit;
}

/* 状態ドット */
.status-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 0;
    background: var(--kp-faint);
}

.status-indicator.online {
    background: var(--kp-emerald);
    box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.16);
}

.status-indicator.offline {
    background: var(--kp-rose);
    box-shadow: 0 0 0 3px rgba(244, 63, 94, 0.14);
}

/* 上部バーの補助ボタン */
#btn-back-dashboard,
#btn-admin-menu {
    width: auto;
    min-height: 34px;
    height: 34px;
    padding: 0 14px;
    border-radius: 7px;
    border: 1px solid var(--kp-line-2);
    background: transparent;
    font-size: 0.8rem;
    color: var(--kp-muted);
    white-space: nowrap;
    margin: 0 !important;
}

#btn-back-dashboard:hover,
#btn-admin-menu:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--kp-text);
}

/* --- 上部バー内の電源コマンド --- */
#server-controls {
    display: none;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
    order: 3;
    margin-left: 0;
}

#server-controls .btn {
    min-width: 0;
    height: 34px;
    min-height: 34px;
    padding: 0 13px;
    border-radius: 7px;
    font-size: 0.8rem;
    flex: 0 0 auto;
    box-shadow: none;
}

#server-status-text {
    margin: 0 4px 0 0 !important;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid rgba(245, 181, 68, 0.35);
    background: rgba(245, 181, 68, 0.12);
    color: #fcd34d !important;
    font-size: 0.74rem;
    font-weight: 700;
    white-space: nowrap;
}

/* ==========================================================================
   3. メイン領域
   ========================================================================== */
.main-content {
    width: 100%;
    max-width: 1280px;
    height: auto;
    min-height: 0;
    margin: 0 auto;
    padding: 26px clamp(16px, 2.6vw, 40px) 56px;
    overflow-y: auto;
    flex: 1 1 auto;
}

.top-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.top-header .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

#btn-discord-join {
    height: 34px;
    min-height: 34px;
    padding: 0 15px;
    border-radius: 7px;
    background: #5865f2;
    color: #fff;
    font-size: 0.82rem;
    font-weight: 600;
    box-shadow: none;
}

#btn-discord-join:hover {
    background: #6b76f5;
    border-color: transparent;
}

.top-header h1,
#page-title {
    margin: 0;
    font-size: 1.72rem;
    font-weight: 750;
    line-height: 1.25;
    letter-spacing: -0.035em;
}

#page-title::after {
    content: '';
    display: block;
    width: 28px;
    height: 2px;
    margin-top: 8px;
    border-radius: 0;
    background: var(--kp-indigo);
}

.subtitle {
    color: var(--kp-muted);
    line-height: 1.8;
    margin-bottom: 18px;
}

/* ==========================================================================
   4. サーバー一覧(行リスト)
   ========================================================================== */
.server-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.server-card {
    position: relative;
    display: grid;
    grid-template-columns: minmax(180px, 1.1fr) minmax(260px, 1fr) auto;
    align-items: center;
    gap: 18px;
    padding: 15px 18px 15px 22px;
    border: 1px solid var(--kp-line);
    border-radius: 10px;
    background: var(--kp-surface);
    box-shadow: none;
    overflow: hidden;
    animation: none !important;
    transition: border-color var(--kp-t), background var(--kp-t);
}

/* 稼働状態を示す左のアクセント */
.server-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 12px;
    bottom: 12px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--kp-faint);
}

.server-card:has(.status-indicator.online)::before {
    background: var(--kp-emerald);
}

.server-card:has(.status-indicator.offline)::before {
    background: var(--kp-rose);
    opacity: 0.55;
}

.server-card:hover {
    transform: none;
    border-color: var(--kp-line-2);
    background: var(--kp-surface-2);
    box-shadow: none;
}

.server-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0;
    padding: 0;
}

.server-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    border-radius: 12px;
    background: rgba(109, 94, 252, 0.14);
    border: 1px solid rgba(124, 108, 255, 0.28);
    color: #b9b0ff;
    font-size: 1rem;
}

.server-card:has(.status-indicator.online) .server-icon {
    background: rgba(45, 212, 191, 0.10);
    border-color: rgba(45, 212, 191, 0.26);
    color: #5eead4;
}

.server-card-titles {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
    flex: 1 1 auto;
}

.server-card-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.35;
    color: var(--kp-text);
    overflow-wrap: anywhere;
}

.server-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0;
    border: none;
    background: none;
    color: var(--kp-muted);
    font-size: 0.74rem;
    font-weight: 600;
    white-space: nowrap;
    flex: 0 0 auto;
}

.server-status:has(.status-indicator.online) {
    color: #6ee7b7;
}

.server-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(84px, 1fr));
    gap: 0;
    margin: 0;
    padding: 0;
    border: none;
}

.metric {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
    padding: 0 14px;
    border-left: 1px solid var(--kp-line);
}

.metric:first-child {
    padding-left: 0;
    border-left: none;
}

.metric-label {
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--kp-faint);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.metric-value {
    font-size: 0.98rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--kp-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.metric-sub {
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--kp-faint);
}

.server-stats.offline-stats {
    opacity: 0.55;
}

.server-actions {
    margin: 0;
    display: flex;
    justify-content: flex-end;
}

.server-actions .btn-manage {
    width: auto;
    min-width: 118px;
    height: 40px;
    min-height: 40px;
    padding: 0 18px;
    font-size: 0.85rem;
}

/* サーバー0件 */
.empty-state {
    padding: 48px 24px;
    border: 1px dashed var(--kp-line-2);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.015);
    text-align: center;
}

.empty-state i {
    color: var(--kp-faint);
}

/* ==========================================================================
   5. ボタン(ピル)
   ========================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    height: 40px;
    min-height: 40px;
    padding: 0 18px;
    border: 1px solid var(--kp-line-2);
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.035);
    color: var(--kp-text);
    font-family: inherit;
    font-size: 0.87rem;
    font-weight: 600;
    letter-spacing: 0;
    line-height: 1;
    cursor: pointer;
    box-shadow: none;
    transition: background var(--kp-t), border-color var(--kp-t), transform var(--kp-t);
}

.btn::after {
    display: none;
}

.btn i {
    font-size: 0.9em;
}

.btn:hover {
    background: rgba(255, 255, 255, 0.065);
    border-color: var(--kp-line-2);
    transform: none;
    filter: none;
    box-shadow: none;
}

.btn:active {
    transform: scale(0.985);
}

.btn:disabled,
.btn[disabled] {
    opacity: 0.42;
    cursor: not-allowed;
    filter: none;
}

.btn-sm {
    height: 32px;
    min-height: 32px;
    padding: 0 13px;
    font-size: 0.78rem;
}

.btn-primary {
    border-color: transparent;
    background: var(--kp-indigo);
    color: #fff;
    box-shadow: none;
}

.btn-primary:hover {
    background: var(--kp-indigo-2);
    border-color: transparent;
    box-shadow: none;
}

.btn-success {
    border-color: transparent;
    background: #2f9d87;
    color: #fff;
    box-shadow: none;
}

.btn-success:hover {
    background: #38b49b;
    border-color: transparent;
}

.btn-warning {
    border-color: transparent;
    background: #bc862f;
    color: #1c1305;
    box-shadow: none;
}

.btn-warning:hover {
    background: #d19a3c;
    border-color: transparent;
}

.btn-danger {
    border-color: transparent;
    background: #c94a5c;
    color: #fff;
    box-shadow: none;
}

.btn-danger:hover {
    background: #d95c6d;
    border-color: transparent;
}

/* 強制停止は枠線のみ(危険操作を一段下げる) */
#btn-server-kill {
    background: transparent !important;
    border-color: rgba(244, 63, 94, 0.5) !important;
    color: #fda4af;
    box-shadow: none;
}

#btn-server-kill:hover {
    background: rgba(244, 63, 94, 0.14) !important;
    border-color: var(--kp-rose) !important;
    color: #fecdd3;
}

/* ==========================================================================
   6. フォーム
   ========================================================================== */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 7px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--kp-muted);
}

.form-control,
.manager-search-input {
    width: 100%;
    min-height: 44px;
    padding: 10px 14px;
    background: var(--kp-inset);
    border: 1px solid var(--kp-line-2);
    border-radius: 12px;
    color: var(--kp-text);
    font-family: inherit;
    font-size: 0.92rem;
    outline: none;
    box-shadow: none;
    transition: border-color var(--kp-t), box-shadow var(--kp-t), background var(--kp-t);
}

.form-control::placeholder,
.manager-search-input::placeholder {
    color: #5f6c8c;
}

.form-control:focus,
.manager-search-input:focus {
    border-color: var(--kp-indigo);
    background: #0a1228;
    box-shadow: var(--kp-ring);
}

select.form-control {
    cursor: pointer;
}

textarea.form-control {
    min-height: 120px;
    line-height: 1.7;
    resize: vertical;
}

input[type="checkbox"],
input[type="radio"] {
    width: 17px;
    height: 17px;
    accent-color: var(--kp-indigo);
    cursor: pointer;
}

input[type="range"] {
    accent-color: var(--kp-indigo);
}

/* ファイル選択(ネイティブの白いボタンを配色に合わせる) */
input[type="file"] {
    color: var(--kp-muted);
    font-family: inherit;
    font-size: 0.85rem;
}

input[type="file"]::file-selector-button {
    margin-right: 10px;
    padding: 7px 14px;
    border: 1px solid var(--kp-line-2);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--kp-text);
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 650;
    cursor: pointer;
    transition: background var(--kp-t), border-color var(--kp-t);
}

input[type="file"]::file-selector-button:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: #34406a;
}

.check-group {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 13px;
    border: 1px solid var(--kp-line);
    border-radius: 12px;
    background: var(--kp-tint);
}

.check-group label {
    margin-bottom: 0;
    color: var(--kp-text);
    cursor: pointer;
}

/* 自動入力の白背景を矯正 */
.form-control:-webkit-autofill,
.form-control:-webkit-autofill:hover,
.form-control:-webkit-autofill:focus,
input:-webkit-autofill {
    -webkit-text-fill-color: var(--kp-text);
    -webkit-box-shadow: 0 0 0 1000px var(--kp-inset) inset;
    box-shadow: 0 0 0 1000px var(--kp-inset) inset;
    caret-color: var(--kp-text);
    transition: background-color 9999s ease-in-out 0s;
}

/* ==========================================================================
   7. ドロップダウン / 通知
   ========================================================================== */
.dropdown-menu {
    position: absolute;
    top: calc(100% + 12px);
    bottom: auto;
    right: 0;
    left: auto;
    min-width: 220px;
    background: var(--kp-surface-2);
    border: 1px solid var(--kp-line-2);
    border-radius: 8px;
    box-shadow: var(--kp-shadow-pop);
    padding: 6px;
    backdrop-filter: none;
}

.dropdown-header {
    padding: 10px 12px;
    margin: 2px 2px 4px;
    border-bottom: 1px solid var(--kp-line);
    background: transparent;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--kp-text);
}

.dropdown-body {
    max-height: 340px;
    overflow-y: auto;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 9px;
    width: calc(100% - 8px);
    min-height: 38px;
    margin: 2px 4px;
    padding: 8px 11px;
    border: none;
    border-radius: 9px;
    background: transparent;
    color: var(--kp-muted);
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    text-align: left;
    transition: background var(--kp-t), color var(--kp-t);
}

.dropdown-item:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--kp-text);
}

.dropdown-item.text-danger {
    color: #fda4af;
}

.dropdown-item.text-danger:hover {
    background: rgba(244, 63, 94, 0.14);
    color: #fecdd3;
}

.notif-item {
    padding: 10px 12px;
    border-bottom: 1px solid var(--kp-line);
    border-radius: 9px;
    transition: background var(--kp-t);
}

.notif-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.notif-item.unread {
    background: rgba(109, 94, 252, 0.12);
    border-left: 3px solid var(--kp-indigo);
}

.notif-item .notif-time {
    font-size: 0.7rem;
    color: var(--kp-faint);
}

/* ==========================================================================
   8. 統計カード / コンソール
   ========================================================================== */
.console-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 312px;
    gap: 14px;
    height: calc(100vh - 210px);
    min-height: 380px;
}

.console-main {
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
    border-radius: 16px;
}

.console-output {
    flex: 1 1 auto;
    padding: 16px 18px;
    background: #04070f;
    font-family: var(--font-mono);
    font-size: 0.84rem;
    line-height: 1.7;
    color: #c9d6f5;
}

.console-output .log-time {
    color: var(--kp-faint);
}

.console-input-area {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 10px 12px;
    border-top: 1px solid var(--kp-line);
    background: #070d1a;
}

.console-input-area .prompt {
    font-family: var(--font-mono);
    font-weight: 700;
    color: var(--kp-mint);
}

#console-input {
    flex: 1 1 auto;
    min-width: 0;
    padding: 6px 2px;
    border: none;
    background: transparent;
    color: #fff;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    outline: none;
}

#console-form .btn {
    width: 40px;
    min-width: 40px;
    height: 34px;
    min-height: 34px;
    padding: 0;
}

.console-sidebar {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: auto;
    overflow-y: auto;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid var(--kp-line);
    border-radius: 12px;
    background: var(--kp-surface);
    box-shadow: none;
    transition: border-color var(--kp-t), background var(--kp-t);
}

.stat-card:hover {
    transform: none;
    border-color: #2c3a63;
    background: var(--kp-surface-2);
}

.stat-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    border-radius: 11px;
    background: rgba(109, 94, 252, 0.12);
    border: 1px solid rgba(124, 108, 255, 0.24);
    color: #b9b0ff;
    font-size: 0.98rem;
}

.stat-icon.danger {
    background: rgba(244, 63, 94, 0.12);
    border-color: rgba(244, 63, 94, 0.26);
    color: #fda4af;
}

.stat-icon.warning {
    background: rgba(245, 181, 68, 0.12);
    border-color: rgba(245, 181, 68, 0.26);
    color: #fcd34d;
}

.stat-icon.success {
    background: rgba(45, 212, 191, 0.12);
    border-color: rgba(45, 212, 191, 0.26);
    color: #5eead4;
}

.stat-title {
    margin-bottom: 2px;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--kp-faint);
}

.stat-value {
    font-size: 1rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--kp-text);
    overflow-wrap: anywhere;
}

.stat-value small {
    font-size: 0.74rem;
    font-weight: 500;
    color: var(--kp-faint);
}

/* ==========================================================================
   9. 管理画面
   ========================================================================== */
/* 管理画面は項目数が多いので、上部バーを2段(ブランド行 + ナビ行)にする */
body.admin-page .sidebar {
    flex-wrap: wrap;
    row-gap: 6px;
    height: auto;
    padding: 8px clamp(12px, 2.2vw, 26px);
    overflow: visible !important;
}

body.admin-page .sidebar-header {
    padding: 0;
}

body.admin-page .sidebar-header h2 {
    font-size: 0.98rem;
}

body.admin-page .sidebar-footer {
    order: 2;
    margin: 0;
    padding: 0;
}

body.admin-page .sidebar::after {
    order: 1;
}

body.admin-page .sidebar-footer .user-actions {
    margin: 0;
    padding: 0;
}

body.admin-page .sidebar-footer .action-icon-wrapper {
    padding: 0;
    min-width: 32px;
    min-height: 32px;
}

body.admin-page .sidebar-footer .mb-3 {
    margin-bottom: 0;
}

body.admin-page .sidebar-nav {
    order: 3;
    flex: 1 0 100%;
    width: 100%;
    gap: 3px;
    padding: 6px 0 2px;
    border-top: 1px solid var(--kp-line);
}

body.admin-page .sidebar-nav .nav-item {
    height: 34px;
    min-height: 34px;
    padding: 0 12px;
    font-size: 0.85rem;
}

body.admin-page .main-content {
    padding: 26px clamp(16px, 2.6vw, 40px) 56px;
}

/* パネルは見出しと同じ幅いっぱいに広げる(左右の余白を揃える) */
body.admin-page .admin-wrapper {
    max-width: none !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

.admin-wrapper {
    background: var(--kp-surface) !important;
    border: 1px solid var(--kp-line) !important;
    border-radius: 16px !important;
    box-shadow: none !important;
}

.inner-tabs {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 3px;
    margin-bottom: 18px;
    padding: 4px;
    border: 1px solid var(--kp-line);
    border-radius: 999px;
    background: var(--kp-surface);
}

.inner-tab-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 999px;
    background: transparent;
    color: var(--kp-muted);
    font-family: inherit;
    font-size: 0.84rem;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--kp-t), color var(--kp-t);
}

.inner-tab-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--kp-text);
}

.inner-tab-btn.active {
    background: rgba(109, 94, 252, 0.22);
    color: #fff;
    box-shadow: inset 0 0 0 1px rgba(124, 108, 255, 0.4);
}

.java-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 10px;
}

.java-card {
    padding: 15px 13px;
    border: 1px solid var(--kp-line);
    border-radius: 13px;
    background: var(--kp-inset);
    text-align: center;
    transition: border-color var(--kp-t), background var(--kp-t);
}

.java-card:hover {
    border-color: #34406a;
    background: #0b1428;
}

.java-card i {
    margin-bottom: 7px;
    font-size: 1.6rem;
    color: #b9b0ff;
}

.java-card.installed {
    border-color: rgba(45, 212, 191, 0.4);
    background: rgba(45, 212, 191, 0.06);
}

.java-card.installed i {
    color: var(--kp-emerald);
}

/* ==========================================================================
   10. バッジ / テーブル
   ========================================================================== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 9px;
    border: 1px solid var(--kp-line-2);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.05);
    color: #cdd6ee;
    font-size: 0.7rem;
    font-weight: 700;
}

.badge.online {
    border-color: rgba(45, 212, 191, 0.4);
    background: rgba(45, 212, 191, 0.12);
    color: #6ee7b7;
}

.badge.offline {
    border-color: var(--kp-line-2);
    background: rgba(255, 255, 255, 0.05);
    color: #cdd6ee;
}

.text-danger {
    color: #fda4af !important;
}

.table-container {
    border: 1px solid var(--kp-line);
    border-radius: 10px;
    background: var(--kp-surface);
    overflow: auto;
}

.players-table,
.table,
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.players-table th,
.table th,
.data-table th {
    padding: 11px 14px;
    text-align: left;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--kp-faint);
    background: rgba(255, 255, 255, 0.025);
    border-bottom: 1px solid var(--kp-line);
    white-space: nowrap;
}

.players-table td,
.table td,
.data-table td {
    padding: 11px 14px;
    border-bottom: 1px solid var(--kp-line);
    color: var(--kp-text);
    font-size: 0.87rem;
}

.players-table tbody tr:last-child td,
.table tbody tr:last-child td {
    border-bottom: none;
}

.players-table tbody tr:hover,
.table tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.players-wrapper {
    padding: 14px;
}

.player-avatar {
    width: 30px;
    height: 30px;
    border-radius: 9px;
    border: 1px solid var(--kp-line);
}

.player-info {
    gap: 9px;
    font-weight: 600;
}

.ping.good {
    color: var(--kp-emerald);
}

.ping.ok {
    color: var(--kp-amber);
}

/* ==========================================================================
   11. モーダル
   ========================================================================== */
.modal-overlay,
.modal {
    background: rgba(4, 8, 16, 0.72);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

.modal-content {
    max-height: 88vh;
    padding: 24px;
    border: 1px solid var(--kp-line-2);
    border-radius: 12px;
    background: var(--kp-surface);
    box-shadow: var(--kp-shadow-pop);
    color: var(--kp-text);
}

.modal-header {
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--kp-line);
    font-size: 1.02rem;
    font-weight: 700;
}

.modal-body {
    margin-bottom: 16px;
    color: var(--kp-muted);
    line-height: 1.75;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding-top: 14px;
    border-top: 1px solid var(--kp-line);
}

.server-checkbox-list label {
    padding: 10px 13px;
    border: 1px solid var(--kp-line);
    border-radius: 11px;
    background: var(--kp-tint);
}

.server-checkbox-list label:hover {
    background: var(--kp-hover);
    border-color: #34406a;
}

/* ==========================================================================
   12. ログイン(左右分割)
   ========================================================================== */
.login-shell {
    display: grid;
    grid-template-columns: minmax(0, 1.04fr) minmax(0, 0.96fr);
    min-height: 100vh;
}

/* 左: ブランドパネル */
.login-hero {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 32px;
    padding: clamp(28px, 4vw, 56px);
    overflow: hidden;
    border-right: 1px solid var(--kp-line);
    background: #0c1526;
}

.login-hero::after {
    display: none;
}

.hero-brand {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.hero-brand .panel-logo {
    width: 28px;
    height: 28px;
    border-radius: 6px;
}

.hero-chip {
    padding: 2px 6px;
    border: 1px solid rgba(217, 160, 67, 0.45);
    border-radius: 4px;
    background: rgba(217, 160, 67, 0.12);
    color: #e8bd76;
    font-size: 0.56rem;
    font-weight: 700;
    letter-spacing: 0.09em;
}

.hero-body {
    position: relative;
    z-index: 1;
    max-width: 520px;
}

.hero-body h1 {
    margin: 0 0 16px;
    font-size: clamp(1.8rem, 3.2vw, 2.4rem);
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: -0.02em;
    color: #f2f5fb;
}

.hero-lead {
    margin: 0 0 26px;
    max-width: 420px;
    color: #aab6d4;
    font-size: 0.92rem;
    line-height: 1.9;
}

.hero-points {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin: 0;
    padding: 0;
    list-style: none;
    border-top: 1px solid var(--kp-line);
}

.hero-points li {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 0;
    border: none;
    border-bottom: 1px solid var(--kp-line);
    border-radius: 0;
    background: none;
    backdrop-filter: none;
}

.hero-points i {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
    border-radius: 7px;
    background: rgba(var(--kp-indigo-rgb), 0.12);
    color: #9db6f7;
    font-size: 0.78rem;
}

.hero-points li:nth-child(2) i {
    background: rgba(63, 192, 176, 0.12);
    color: #8ad8cd;
}

.hero-points li:nth-child(3) i {
    background: rgba(181, 206, 106, 0.12);
    color: #cfdfa0;
}

.hero-points strong {
    display: block;
    font-size: 0.84rem;
    font-weight: 600;
    color: #e8eef9;
}

.hero-points span {
    display: block;
    margin-top: 2px;
    font-size: 0.76rem;
    color: var(--kp-faint);
}

.hero-foot {
    position: relative;
    z-index: 1;
    font-size: 0.72rem;
    color: var(--kp-faint);
    letter-spacing: 0;
}

/* 右: フォームパネル */
.login-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px clamp(20px, 4vw, 56px);
    background: var(--kp-canvas);
}

.login-container {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    gap: 20px;
    width: 100%;
    max-width: 372px;
    min-height: auto;
    padding: 0;
}

.login-card {
    position: relative;
    width: 100%;
    max-width: none;
    padding: 0;
    border: none;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    text-align: left;
    overflow: visible;
}

.login-card::before,
.login-card::after {
    display: none;
}

.login-title {
    margin: 0 0 6px;
    font-size: 1.55rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--kp-text);
    text-align: left;
}

.login-card .login-title {
    margin: 0 0 6px;
    color: var(--kp-text);
    font-size: 1.55rem;
    font-weight: 700;
}

.login-card .login-lead {
    margin: 0 0 24px;
    font-size: 0.84rem;
    color: var(--kp-faint);
    text-align: left;
}

/* ログインの入力はアンダーライン方式(他画面と差別化) */
.login-card .form-control {
    min-height: 44px;
    height: 44px;
    padding: 8px 2px;
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--kp-line-2);
    border-radius: 0;
    font-size: 0.95rem;
    transition: border-color var(--kp-t);
}

.login-card .form-control:focus {
    background: transparent;
    border-bottom-color: var(--kp-indigo-2);
    box-shadow: 0 1px 0 0 var(--kp-indigo-2);
}

.login-card .form-control:-webkit-autofill,
.login-card .form-control:-webkit-autofill:hover,
.login-card .form-control:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--kp-text);
    -webkit-box-shadow: 0 0 0 1000px var(--kp-canvas) inset;
    box-shadow: 0 0 0 1000px var(--kp-canvas) inset;
    border-bottom: 1px solid var(--kp-line-2);
}

.login-card .btn {
    height: 44px;
    min-height: 44px;
    border-radius: 7px;
}

.login-card #btn-discord-login {
    border-color: #5865f2;
    background: #5865f2;
    color: #fff;
}

.login-card #btn-discord-login:hover {
    background: #6b76f5;
    border-color: #6b76f5;
}

.login-card #btn-passkey-login {
    background: transparent;
}

.login-error {
    padding: 10px 13px;
    margin-bottom: 14px;
    border: 1px solid rgba(244, 63, 94, 0.36);
    border-radius: 11px;
    background: rgba(244, 63, 94, 0.12);
    color: #fda4af !important;
    font-size: 0.84rem;
    text-align: left;
}

/* 「または」 */
.login-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 16px 0 6px;
    font-size: 0.76rem;
    color: var(--kp-faint);
}

.login-divider::before,
.login-divider::after {
    content: '';
    flex: 1 1 auto;
    height: 1px;
    background: var(--kp-line);
}

.login-footer {
    margin-top: 4px;
    font-size: 0.76rem;
    color: var(--kp-faint);
    text-align: left;
}

.login-footer a {
    color: var(--kp-muted);
    transition: color var(--kp-t);
}

.login-footer a:hover {
    color: var(--kp-text);
    text-decoration: none;
}

/* ==========================================================================
   13. その他
   ========================================================================== */
/* トースト(インラインstyleを上書き) */
#toast-container > div {
    border-radius: 8px !important;
    padding: 10px 16px !important;
    border: 1px solid var(--kp-line-2) !important;
    box-shadow: 0 10px 26px rgba(2, 5, 12, 0.5) !important;
    font-size: 0.85rem !important;
    font-weight: 600 !important;
}

.settings-wrapper {
    max-width: 620px;
    margin: 0 auto;
    padding: 24px;
}

.pterodactyl-filter-bar {
    padding: 9px 13px;
    border: 1px solid var(--kp-line);
    border-radius: 8px;
    background: var(--kp-surface);
}

.swal2-popup {
    background: var(--kp-surface) !important;
    border: 1px solid var(--kp-line-2) !important;
    border-radius: 18px !important;
    color: var(--kp-text) !important;
    box-shadow: var(--kp-shadow-pop) !important;
}

div:where(.swal2-container) h2:where(.swal2-title) {
    color: var(--kp-text) !important;
    font-family: var(--font-main) !important;
    font-weight: 700 !important;
}

div:where(.swal2-container) div:where(.swal2-html-container) {
    color: var(--kp-muted) !important;
    font-family: var(--font-main) !important;
}

.swal2-input,
.swal2-textarea {
    background: var(--kp-inset) !important;
    border: 1px solid var(--kp-line-2) !important;
    border-radius: 11px !important;
    color: var(--kp-text) !important;
}

.swal2-confirm {
    background: var(--kp-indigo) !important;
    border-radius: 7px !important;
}

.swal2-cancel {
    background: #1e2c48 !important;
    color: var(--kp-text) !important;
    border-radius: 7px !important;
}

.swal2-deny {
    background: #c94a5c !important;
    border-radius: 7px !important;
}

/* ベータ警告バナー(有効化した場合) */
.debug-build-badge {
    border-radius: 12px;
    border: 1px solid rgba(245, 181, 68, 0.5);
    background: rgba(42, 22, 4, 0.96);
    color: #fed7aa;
    font-size: 0.8rem;
    box-shadow: 0 10px 30px rgba(2, 4, 10, 0.55);
}

.debug-build-badge strong,
.debug-build-badge i {
    color: #fcd34d;
}

/* ==========================================================================
   14. Pterodactyl テーマの調色(レイアウトはそのまま)
   ========================================================================== */
body.theme-pterodactyl {
    --bg-glass: var(--kp-surface);
    --bg-color: var(--kp-canvas);
    background: var(--kp-canvas) !important;
}

body.theme-pterodactyl .sidebar {
    background: rgba(6, 9, 18, 0.94) !important;
    border-color: var(--kp-line) !important;
}

body.theme-pterodactyl #nav-server:not([style*="none"]) {
    background: transparent !important;
    border-bottom: none !important;
}

body.theme-pterodactyl .server-card {
    background: var(--kp-surface) !important;
    border: 1px solid var(--kp-line) !important;
    border-radius: 14px !important;
}

body.theme-pterodactyl .server-card:hover {
    background: var(--kp-surface-2) !important;
    border-color: #2c3a63 !important;
}

body.theme-pterodactyl .console-sidebar .stat-card {
    background: var(--kp-surface) !important;
    border: 1px solid var(--kp-line) !important;
}

body.theme-pterodactyl .terminal-container,
body.theme-pterodactyl .console-output {
    background: #04070f !important;
}

body.theme-pterodactyl .modal-content,
body.theme-pterodactyl .glass {
    border: 1px solid var(--kp-line) !important;
}

body.theme-pterodactyl .dropdown-menu {
    background: var(--kp-surface-2) !important;
    border-radius: 14px !important;
}

body.theme-pterodactyl #nav-global .nav-item.active,
body.theme-pterodactyl #nav-server .nav-item.active {
    background: rgba(109, 94, 252, 0.16) !important;
    border-bottom: none !important;
    color: #fff !important;
}

body.theme-pterodactyl .btn {
    background: rgba(255, 255, 255, 0.04) !important;
    border-color: var(--kp-line-2) !important;
    color: var(--kp-text) !important;
}

body.theme-pterodactyl .btn-primary {
    background: linear-gradient(120deg, var(--kp-indigo), var(--kp-indigo-2)) !important;
    border-color: rgba(139, 92, 246, 0.55) !important;
    color: #fff !important;
}

body.theme-pterodactyl #btn-server-start {
    background: linear-gradient(120deg, #0d9488, #14b8a6) !important;
    color: #001a18 !important;
}

body.theme-pterodactyl #btn-server-restart {
    background: linear-gradient(120deg, #f59e0b, #fbbf24) !important;
    color: #241500 !important;
}

body.theme-pterodactyl #btn-server-stop {
    background: linear-gradient(120deg, #e11d48, #f43f5e) !important;
    color: #fff !important;
}

body.theme-pterodactyl #btn-server-kill {
    background: transparent !important;
    border-color: rgba(244, 63, 94, 0.5) !important;
    color: #fda4af !important;
}

/* ==========================================================================
   15. レスポンシブ
   ========================================================================== */
/* ワイドだが余裕がない幅では上部バーのボタンをアイコンのみに */
@media (max-width: 1500px) {
    #server-controls .btn-label,
    #btn-admin-menu .btn-label,
    #btn-back-dashboard .btn-label {
        display: none;
    }

    #server-controls .btn,
    #btn-admin-menu,
    #btn-back-dashboard {
        width: 34px;
        min-width: 34px;
        padding: 0;
    }
}

/* 中間幅 */
@media (max-width: 1180px) {
    .user-text {
        max-width: 96px;
    }

    .user-status {
        display: none;
    }

    .nav-item {
        padding: 0 10px;
    }
}

/* 狭いデスクトップ/タブレット: ナビを2段目に送って見切れを防ぐ */
@media (min-width: 981px) and (max-width: 1100px) {
    .sidebar {
        flex-wrap: wrap;
        min-height: 0;
        padding-top: 6px;
        padding-bottom: 6px;
        row-gap: 6px;
    }

    .sidebar::after {
        display: none;
    }

    .sidebar-header {
        order: 0;
        flex: 1 1 auto;
        min-width: 0;
    }

    .sidebar-footer {
        order: 1;
        margin-left: auto;
    }

    .sidebar-nav {
        order: 2;
        flex: 1 0 100%;
        width: 100%;
        padding-top: 6px;
        border-top: 1px solid var(--kp-line);
    }

    #server-controls {
        order: 3;
        flex: 1 0 100%;
        padding-top: 6px;
        border-top: none;
    }
}

@media (max-width: 980px) {

    /* 上部バーを2段に(ブランド行 + ナビ行) */
    .sidebar {
        height: auto;
        min-height: 64px;
        flex-wrap: wrap;
        gap: 6px 8px;
        padding: 8px 10px;
    }

    .sidebar-header {
        order: 1;
        flex: 1 1 auto;
        min-width: 0;
    }

    .sidebar-footer {
        order: 2;
        flex: 0 1 auto;
        margin-left: auto;
        min-width: 0;
    }

    .sidebar::after {
        display: none;
    }

    #server-controls {
        order: 4;
        flex: 1 0 100%;
        width: 100%;
        margin: 0;
        padding-top: 6px;
        border-top: 1px solid var(--kp-line);
        overflow-x: auto;
        flex-wrap: nowrap;
    }

    .sidebar-nav {
        order: 3;
        width: 100%;
        flex-wrap: nowrap;
        padding-bottom: 2px;
        border-top: 1px solid var(--kp-line);
        padding-top: 8px;
    }

    .main-content {
        padding: 20px 16px 44px;
    }

    /* 旧ハンバーガーは使わない */
    .mobile-nav-toggle {
        display: none !important;
    }

    .console-layout {
        grid-template-columns: 1fr;
        height: auto;
    }

    .console-main {
        min-height: 420px;
        max-height: 62vh;
    }

    .server-card {
        grid-template-columns: 1fr auto;
        grid-template-areas:
            'head action'
            'metrics metrics';
        row-gap: 12px;
        padding: 14px 16px 14px 20px;
    }

    .server-card-header {
        grid-area: head;
    }

    .server-metrics {
        grid-area: metrics;
        padding-top: 12px;
        border-top: 1px solid var(--kp-line);
    }

    .server-actions {
        grid-area: action;
    }

    .server-actions .btn-manage {
        min-width: 0;
        padding: 0 14px;
    }

    .server-actions .btn-manage .btn-label {
        display: none;
    }
}

@media (max-width: 900px) {
    .login-shell {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
        align-content: start;
    }

    .login-hero {
        flex-direction: row;
        align-items: center;
        justify-content: flex-start;
        gap: 12px;
        padding: 16px 20px;
        border-right: none;
        border-bottom: 1px solid var(--kp-line);
    }

    .hero-body,
    .hero-foot {
        display: none;
    }

    .login-panel {
        align-items: flex-start;
        padding: 36px 22px 56px;
    }

    .login-container {
        max-width: 420px;
    }
}

@media (max-width: 560px) {
    .sidebar-header h2 {
        font-size: 0.9rem;
    }

    .user-text,
    .user-status {
        display: none;
    }

    .sidebar-user {
        padding: 4px;
    }

    .metric {
        padding: 0 9px;
    }

    .metric-label {
        font-size: 0.55rem;
    }

    .metric-value {
        font-size: 0.9rem;
    }

    #page-title {
        font-size: 1.45rem;
    }

    .inner-tabs {
        width: 100%;
        justify-content: flex-start;
        overflow-x: auto;
    }
}

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }
}

/* ==========================================================================
   16. アカウントダイアログ(大きな設定画面)
   ========================================================================== */
#modal-account-settings {
    z-index: 9500;
    padding: 20px;
}

#modal-account-settings .kp-account-dialog {
    display: flex;
    flex-direction: column;
    width: min(940px, 100%);
    max-width: 940px;
    height: min(700px, 92vh);
    max-height: 92vh;
    padding: 0;
    overflow: hidden;
    border-radius: 14px;
}

#modal-admin-account .kp-account-dialog {
    height: auto;
}

.kp-account-head {
    display: flex;
    align-items: center;
    gap: 13px;
    flex: 0 0 auto;
    padding: 18px 20px;
    border-bottom: 1px solid var(--kp-line);
    background: var(--kp-surface-2);
}

.kp-account-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    border-radius: 10px;
    background: var(--kp-indigo);
    color: #fff;
    font-size: 1rem;
    font-weight: 700;
    text-transform: uppercase;
}

.kp-account-id {
    min-width: 0;
    flex: 1 1 auto;
}

.kp-account-id h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 650;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.kp-account-id p {
    margin: 2px 0 0;
    font-size: 0.76rem;
    color: var(--kp-faint);
}

.kp-account-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    margin-left: auto;
    flex: 0 0 32px;
    border: 1px solid var(--kp-line-2);
    border-radius: 7px;
    background: transparent;
    color: var(--kp-muted);
    cursor: pointer;
    transition: background var(--kp-t), color var(--kp-t);
}

.kp-account-close:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--kp-text);
}

.kp-account-body {
    display: grid;
    grid-template-columns: 216px minmax(0, 1fr);
    flex: 1 1 auto;
    min-height: 0;
}

.kp-account-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 14px 10px;
    border-right: 1px solid var(--kp-line);
    background: #0e1729;
    overflow-y: auto;
}

.kp-account-nav button {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--kp-muted);
    font-family: inherit;
    font-size: 0.84rem;
    font-weight: 500;
    text-align: left;
    white-space: nowrap;
    cursor: pointer;
    transition: background var(--kp-t), color var(--kp-t);
}

.kp-account-nav button i {
    width: 16px;
    flex: 0 0 16px;
    text-align: center;
    font-size: 0.86rem;
    color: var(--kp-faint);
}

.kp-account-nav button:hover {
    background: rgba(255, 255, 255, 0.045);
    color: var(--kp-text);
}

.kp-account-nav button.active {
    background: rgba(var(--kp-indigo-rgb), 0.14);
    color: #fff;
}

.kp-account-nav button.active i {
    color: var(--kp-indigo-2);
}

.kp-account-nav .kp-account-logout {
    margin-top: auto;
    color: #e39aa4;
}

.kp-account-nav .kp-account-logout i {
    color: #d17c88;
}

.kp-account-nav .kp-account-logout:hover {
    background: rgba(223, 92, 110, 0.1);
    color: #f0b1b9;
}

.kp-account-content {
    padding: 24px 26px 30px;
    overflow-y: auto;
}

.kp-account-pane {
    display: none;
}

.kp-account-pane.active {
    display: block;
}

.kp-account-content .account-section {
    margin-top: 0 !important;
}

.kp-account-content .account-section + .account-section {
    margin-top: 26px !important;
    padding-top: 22px;
    border-top: 1px solid var(--kp-line);
}

.kp-account-content .account-section h4 {
    margin: 0 0 14px !important;
    padding-bottom: 10px !important;
    border-bottom: 1px solid var(--kp-line) !important;
    color: var(--kp-text) !important;
    font-size: 0.92rem;
    font-weight: 650;
}

.kp-account-content .form-group {
    margin-bottom: 12px;
}

.kp-account-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.kp-account-row .form-control {
    flex: 1 1 auto;
    min-width: 0;
}

.kp-account-row .btn {
    flex: 0 0 auto;
}

.kp-account-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1px;
    margin-top: 18px;
    overflow: hidden;
    border: 1px solid var(--kp-line);
    border-radius: 8px;
    background: var(--kp-line);
}

.kp-account-meta > div {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 11px 14px;
    background: var(--kp-surface-2);
}

.kp-account-meta span {
    font-size: 0.7rem;
    color: var(--kp-faint);
}

.kp-account-meta strong {
    font-size: 0.84rem;
    font-weight: 600;
    overflow-wrap: anywhere;
}

.kp-account-note {
    margin: 0 0 14px;
    font-size: 0.8rem;
    line-height: 1.75;
    color: var(--kp-muted);
}

.kp-account-hint {
    margin: 10px 0 0;
    font-size: 0.72rem;
    line-height: 1.7;
    color: var(--kp-faint);
}

.kp-discord-box {
    padding: 14px;
    border: 1px solid rgba(88, 101, 242, 0.35);
    border-radius: 8px;
    background: rgba(88, 101, 242, 0.08);
}

.kp-discord-box #discord-link-description {
    margin-bottom: 10px;
    font-size: 0.8rem;
    line-height: 1.7;
    color: var(--kp-muted);
}

.kp-discord-box #btn-discord-link {
    border-color: #5865f2;
    background: #5865f2;
    color: #fff;
}

.kp-discord-box #btn-discord-link:hover {
    background: #6b76f5;
    border-color: #6b76f5;
}

.kp-theme-desc {
    display: block;
}

/* 外観: 選べるプレビュー */
.kp-theme-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.kp-theme-option {
    display: block;
    padding: 10px;
    border: 1px solid var(--kp-line-2);
    border-radius: 10px;
    background: var(--kp-surface-2);
    color: var(--kp-text);
    font-family: inherit;
    text-align: left;
    cursor: pointer;
    transition: border-color var(--kp-t), background var(--kp-t);
}

.kp-theme-option:hover {
    border-color: #3a4d75;
}

.kp-theme-option.active {
    border-color: var(--preview-accent);
    box-shadow: inset 0 0 0 1px var(--preview-accent);
}

.kp-theme-preview {
    display: flex;
    height: 82px;
    overflow: hidden;
    border: 1px solid #1b2942;
    border-radius: 6px;
    background: #0b1424;
}

.kp-preview-rail {
    display: flex;
    flex-direction: column;
    gap: 5px;
    width: 26px;
    flex: 0 0 26px;
    padding: 8px 5px;
    border-right: 1px solid #1b2942;
    background: #0e1a2e;
}

.kp-preview-rail span {
    height: 4px;
    border-radius: 2px;
    background: #26365a;
}

.kp-preview-rail span:first-child {
    background: var(--preview-accent);
}

.kp-preview-main {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1 1 auto;
    padding: 9px 10px;
}

.kp-preview-bar {
    height: 5px;
    border-radius: 2px;
    background: #26365a;
}

.kp-preview-bar.w70 {
    width: 70%;
}

.kp-preview-bar.w90 {
    width: 90%;
}

.kp-preview-bar.w50 {
    width: 50%;
}

.kp-preview-bar.accent {
    width: 38%;
    margin-top: auto;
    background: var(--preview-accent);
}

.kp-theme-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 9px;
}

.kp-theme-name {
    font-size: 0.78rem;
    font-weight: 600;
}

.kp-theme-check {
    color: var(--preview-accent);
    font-size: 0.72rem;
    opacity: 0;
}

.kp-theme-option.active .kp-theme-check {
    opacity: 1;
}

.kp-theme-desc {
    margin-top: 3px;
    font-size: 0.7rem;
    color: var(--kp-faint);
}

.kp-theme-option[data-theme="default"] {
    --preview-accent: #4f7df3;
}

.kp-theme-option[data-theme="teal"] {
    --preview-accent: #2f9d92;
}

.kp-theme-option[data-theme="amber"] {
    --preview-accent: #c08a33;
}

.kp-theme-option[data-theme="rose"] {
    --preview-accent: #c25568;
}

/* アクセントテーマ */
html[data-kp-accent="default"] {
    --kp-indigo: #4f7df3;
    --kp-indigo-2: #6b93ff;
    --kp-indigo-rgb: 79, 125, 243;
    --accent-blue-hover: #6b93ff;
    --accent-blue-rgb: 79, 125, 243;
}

html[data-kp-accent="teal"] {
    --kp-indigo: #2f9d92;
    --kp-indigo-2: #45b7ab;
    --kp-indigo-rgb: 47, 157, 146;
    --accent-blue-hover: #45b7ab;
    --accent-blue-rgb: 47, 157, 146;
}

html[data-kp-accent="amber"] {
    --kp-indigo: #c08a33;
    --kp-indigo-2: #d6a252;
    --kp-indigo-rgb: 192, 138, 51;
    --accent-blue-hover: #d6a252;
    --accent-blue-rgb: 192, 138, 51;
}

html[data-kp-accent="rose"] {
    --kp-indigo: #c25568;
    --kp-indigo-2: #d97a8a;
    --kp-indigo-rgb: 194, 85, 104;
    --accent-blue-hover: #d97a8a;
    --accent-blue-rgb: 194, 85, 104;
}

@media (max-width: 720px) {
    #modal-account-settings {
        padding: 0;
    }

    #modal-account-settings .kp-account-dialog {
        width: 100%;
        max-width: none;
        height: 100vh;
        max-height: 100vh;
        border: none;
        border-radius: 0;
    }

    #modal-admin-account .kp-account-dialog {
        width: calc(100% - 24px);
        height: auto;
        max-height: 92vh;
        border: 1px solid var(--kp-line-2);
        border-radius: 12px;
    }

    .kp-account-head {
        padding: 14px 16px;
    }

    .kp-account-body {
        grid-template-columns: 1fr;
        grid-template-rows: auto minmax(0, 1fr);
    }

    .kp-account-nav {
        flex-direction: row;
        gap: 4px;
        padding: 8px;
        border-right: none;
        border-bottom: 1px solid var(--kp-line);
        overflow-x: auto;
    }

    .kp-account-nav button {
        width: auto;
        padding: 8px 10px;
        font-size: 0.8rem;
    }

    .kp-account-nav .kp-account-logout {
        margin-top: 0;
        margin-left: auto;
    }

    .kp-account-content {
        padding: 18px 16px 26px;
    }

    .kp-theme-grid {
        grid-template-columns: 1fr;
    }

    .kp-account-row {
        flex-direction: column;
        align-items: stretch;
    }
}


/* ==========================================================================
   16. ボトムナビゲーションバー(サーバー管理時下部固定)
   ========================================================================== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px;
    padding: 8px 16px;
    background: var(--kp-bar);
    border-top: 1px solid var(--kp-line);
    z-index: 600;
    backdrop-filter: blur(10px);
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--kp-muted);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--kp-t), color var(--kp-t);
    white-space: nowrap;
}

.bottom-nav-item i {
    font-size: 1.1rem;
}

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

.bottom-nav-item.active {
    background: var(--kp-indigo);
    color: #fff;
}

.bottom-nav-item.bottom-nav-back {
    margin-right: auto;
    background: rgba(255, 255, 255, 0.04);
    color: var(--kp-text);
}

.bottom-nav-item.bottom-nav-back:hover {
    background: rgba(255, 255, 255, 0.08);
}

/* モバイルでの下部ナビ調整 */
@media (max-width: 720px) {
    .bottom-nav {
        padding: 6px 8px;
        gap: 2px;
    }
    .bottom-nav-item {
        padding: 6px 8px;
        font-size: 0.7rem;
    }
    .bottom-nav-item i {
        font-size: 1rem;
    }
}


/* ==========================================================================
   17. v4.1 調整(サーバー一覧クリック / 上部バー / 下部タブ)
   ========================================================================== */

/* 電源コマンドは右クラスタへ(広い画面) */
#server-controls {
    order: 3;
    flex-wrap: nowrap;
}

/* ユーザーボックスはアカウント設定を開くボタン */
.sidebar-user#user-account-box {
    cursor: pointer;
    transition: background var(--kp-t), border-color var(--kp-t);
}

.sidebar-user#user-account-box:hover,
.sidebar-user#user-account-box:focus-visible {
    background: rgba(255, 255, 255, 0.07);
    border-color: var(--kp-line-2);
    outline: none;
}

/* サーバーカード: 管理ボタン廃止に合わせて2カラムに */
.server-grid .server-card {
    grid-template-columns: minmax(180px, 1.1fr) minmax(260px, 1fr);
}

/* 下部タブ表示中はコンテンツが隠れないように余白を確保 */
body:has(#bottom-nav:not([style*="none"])) .main-content {
    padding-bottom: 92px;
}

/* コンソールは下部タブのぶん高さを詰める */
body:has(#bottom-nav:not([style*="none"])) .console-layout {
    height: calc(100vh - 330px);
}

@media (max-width: 980px) {
    body:has(#bottom-nav:not([style*="none"])) .console-layout {
        height: auto;
    }

    .server-grid .server-card {
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas:
            'head'
            'metrics';
    }
}


/* サーバーカード(行リスト)の微調整 */
.server-grid {
    gap: 8px;
}

.server-grid .server-card {
    padding: 12px 18px 12px 22px;
    min-height: 68px;
}

.server-card-chevron {
    flex: 0 0 auto;
    margin-left: auto;
    color: var(--kp-faint);
    font-size: 0.78rem;
    transition: transform var(--kp-t), color var(--kp-t);
}

.server-card:hover .server-card-chevron {
    color: var(--kp-text);
    transform: translateX(2px);
}

.server-grid .server-card .server-metrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0;
    margin: 0;
}


/* 下部ナビ: 戻るボタンは左端に固定、タブは中央 */
.bottom-nav {
    justify-content: center;
}

.bottom-nav-item.bottom-nav-back {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    flex-direction: row;
    gap: 6px;
    width: max-content;
    margin: 0;
}

@media (max-width: 720px) {
    .bottom-nav-item.bottom-nav-back {
        left: 8px;
        padding: 6px 10px;
    }

    .bottom-nav-item.bottom-nav-back .fa-solid {
        margin: 0;
    }
}


/* 下部ナビの戻るボタンはラベル付きで表示(上部バーの34px固定を解除) */
.bottom-nav #btn-back-dashboard {
    width: auto !important;
    min-width: 0 !important;
    padding: 7px 14px !important;
}

@media (max-width: 560px) {
    .bottom-nav #btn-back-dashboard .back-text {
        display: none;
    }
}


/* モバイル: 下部タブを横スクロール可能にし、戻るボタンと重ならないようにする */
@media (max-width: 980px) {
    .bottom-nav {
        justify-content: flex-start;
        overflow-x: auto;
        overflow-y: hidden;
        padding-left: 64px;
        scrollbar-width: none;
    }

    .bottom-nav::-webkit-scrollbar {
        display: none;
    }

    .bottom-nav #btn-back-dashboard {
        position: fixed;
        left: 10px;
        bottom: 18px;
        z-index: 2;
        background: var(--kp-surface-2);
        border: 1px solid var(--kp-line);
        border-radius: 8px;
        height: 36px;
        display: flex;
    }

    .bottom-nav #btn-back-dashboard .back-text {
        display: none;
    }
}


/* モバイル下部タブの詰め調整 */
@media (max-width: 720px) {
    .bottom-nav {
        padding: 6px 4px 6px 58px;
        gap: 0;
    }

    .bottom-nav-item {
        flex: 0 0 auto;
        padding: 5px 5px;
        font-size: 0.62rem;
        gap: 3px;
    }

    .bottom-nav-item i {
        font-size: 0.95rem;
    }

    .bottom-nav #btn-back-dashboard {
        left: 6px;
        bottom: 16px;
        height: 32px;
        padding: 0 8px !important;
    }
}


/* ==========================================================================
   18. サーバー操作バー(ページタイトル直下)
   ========================================================================== */
#server-controls.server-powerbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    margin: 0 0 16px;
    padding: 12px 14px;
    border: 1px solid var(--kp-line);
    border-radius: 12px;
    background: var(--kp-surface);
}

.server-powerbar .server-power-label {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin-right: auto;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--kp-muted);
    white-space: nowrap;
}

/* 上部バー用のアイコン固定を解除してラベル付きボタンに */
#server-controls .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    width: auto;
    min-width: 0;
    min-height: 40px;
    padding: 0 16px;
    white-space: nowrap;
}

#server-controls .btn .btn-label {
    display: inline;
}

@media (max-width: 720px) {
    #server-controls.server-powerbar {
        justify-content: stretch;
        gap: 8px;
        margin-bottom: 12px;
        padding: 10px;
    }

    #server-controls .server-power-label {
        display: none;
    }

    #server-controls .btn {
        flex: 1 1 0;
        min-width: 0;
        min-height: 46px;
        padding: 0 8px;
        font-size: 0.82rem;
    }

    #server-controls .btn .btn-label {
        display: inline;
    }

    #server-controls .btn i {
        font-size: 0.85rem;
    }

    #server-status-text {
        flex: 1 1 100%;
        margin: 0 0 2px;
        text-align: center;
    }
}


/* 360px前後のスマホでも下部タブが収まるように */
@media (max-width: 400px) {
    .bottom-nav {
        padding-left: 44px;
    }

    .bottom-nav-item {
        padding: 5px 3px;
        font-size: 0.56rem;
        gap: 2px;
    }

    .bottom-nav-item i {
        font-size: 0.9rem;
    }

    .bottom-nav #btn-back-dashboard {
        left: 4px;
        height: 30px;
        padding: 0 7px !important;
    }
}


/* ==========================================================================
   ファイルマネージャ
   v4 のフラットな紺色・ヘアラインを保ち、一覧の情報設計だけを更新する
   ========================================================================== */
.file-manager.files-panel {
    height: calc(100vh - 360px);
    min-height: 360px;
    max-height: 760px;
    padding: 0 !important;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.fm-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 18px 20px 14px;
    border-bottom: 1px solid var(--kp-line);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.025), transparent);
}

.fm-heading {
    display: flex;
    align-items: center;
    gap: 11px;
    min-width: 0;
}

.fm-heading-icon {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    border: 1px solid rgba(var(--kp-indigo-rgb), 0.32);
    border-radius: 10px;
    background: var(--kp-tint);
    color: var(--kp-indigo-2);
    font-size: 0.95rem;
}

.fm-heading-text {
    min-width: 0;
}

.fm-heading-text h2 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.3;
    color: var(--kp-text);
}

.fm-heading-text p {
    margin: 3px 0 0;
    overflow: hidden;
    color: var(--kp-faint);
    font-size: 0.73rem;
    line-height: 1.4;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fm-search {
    position: relative;
    display: flex;
    align-items: center;
    width: min(280px, 34vw);
    flex: 0 1 280px;
}

.fm-search > i {
    position: absolute;
    left: 12px;
    color: var(--kp-faint);
    font-size: 0.78rem;
    pointer-events: none;
}

.fm-search input {
    width: 100%;
    height: 38px;
    padding: 0 12px 0 34px;
    border: 1px solid var(--kp-line-2);
    border-radius: 8px;
    outline: none;
    background: var(--kp-inset);
    color: var(--kp-text);
    font-family: inherit;
    font-size: 0.8rem;
    transition: border-color var(--kp-t), box-shadow var(--kp-t), background var(--kp-t);
}

.fm-search input::placeholder {
    color: var(--kp-faint);
}

.fm-search input:focus {
    border-color: var(--kp-indigo);
    background: var(--kp-surface);
    box-shadow: var(--kp-ring);
}

.fm-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 11px 20px;
    border-bottom: 1px solid var(--kp-line);
    background: rgba(255, 255, 255, 0.012);
}

.fm-nav-group {
    display: flex;
    align-items: center;
    gap: 2px;
    flex: 0 0 auto;
    padding: 3px;
    border: 1px solid var(--kp-line);
    border-radius: 9px;
    background: var(--kp-inset);
}

.fm-icon-btn {
    display: inline-grid;
    place-items: center;
    width: 30px;
    height: 28px;
    padding: 0;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--kp-muted);
    font-size: 0.78rem;
    cursor: pointer;
    transition: background var(--kp-t), color var(--kp-t);
}

.fm-icon-btn:hover:not(:disabled) {
    background: var(--kp-hover);
    color: var(--kp-text);
}

.fm-icon-btn:disabled {
    opacity: 0.3;
    cursor: default;
}

.fm-breadcrumb {
    display: flex;
    align-items: center;
    gap: 1px;
    flex: 1 1 220px;
    min-width: 0;
    height: 36px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    white-space: nowrap;
}

.fm-breadcrumb::-webkit-scrollbar {
    display: none;
}

.fm-crumb {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 240px;
    min-width: 0;
    padding: 5px 8px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--kp-muted);
    font-family: inherit;
    font-size: 0.8rem;
    line-height: 1.2;
    text-align: left;
    white-space: nowrap;
    cursor: pointer;
    transition: background var(--kp-t), color var(--kp-t);
}

.fm-crumb > span {
    overflow: hidden;
    text-overflow: ellipsis;
}

.fm-crumb:hover {
    background: var(--kp-hover);
    color: var(--kp-text);
}

.fm-crumb.is-current {
    background: var(--kp-tint);
    color: var(--kp-text);
    font-weight: 600;
    cursor: default;
}

.fm-crumb-sep {
    flex: 0 0 auto;
    color: var(--kp-faint);
    font-size: 0.55rem;
    opacity: 0.8;
}

.fm-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
    margin-left: auto;
}

.fm-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    height: 34px;
    padding: 0 11px;
    border: 1px solid var(--kp-line-2);
    border-radius: 7px;
    background: var(--kp-surface-2);
    color: var(--kp-muted);
    font-family: inherit;
    font-size: 0.77rem;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: background var(--kp-t), border-color var(--kp-t), color var(--kp-t);
}

.fm-action-btn:hover {
    border-color: #3b5078;
    background: #1b2a46;
    color: var(--kp-text);
}

.fm-action-btn.fm-action-primary {
    border-color: var(--kp-indigo);
    background: var(--kp-indigo);
    color: #fff;
}

.fm-action-btn.fm-action-primary:hover {
    border-color: var(--kp-indigo-2);
    background: var(--kp-indigo-2);
}

.fm-content {
    position: relative;
    display: flex;
    flex: 1;
    min-height: 0;
    flex-direction: column;
    padding: 14px 20px 18px;
}

.fm-explorer {
    flex: 1;
    min-height: 0;
    overflow: auto;
    border: 1px solid var(--kp-line);
    border-radius: 10px;
    background: var(--kp-inset);
}

.fm-table {
    width: 100%;
    min-width: 520px;
    border-collapse: separate;
    border-spacing: 0;
    table-layout: fixed;
}

.fm-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    padding: 0;
    border-bottom: 1px solid var(--kp-line);
    background: #0f1a2d;
    text-align: left;
}

.fm-sort-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    padding: 10px 14px;
    border: none;
    background: transparent;
    color: var(--kp-faint);
    font-family: inherit;
    font-size: 0.61rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-align: left;
    text-transform: uppercase;
    white-space: nowrap;
    cursor: pointer;
    transition: color var(--kp-t), background var(--kp-t);
}

.fm-sort-btn:hover {
    background: rgba(255, 255, 255, 0.025);
    color: var(--kp-text);
}

.fm-sort-btn i {
    font-size: 0.62rem;
    opacity: 0.55;
}

.fm-table th[aria-sort="ascending"] .fm-sort-btn,
.fm-table th[aria-sort="descending"] .fm-sort-btn {
    color: var(--kp-text);
}

.fm-table th[aria-sort="ascending"] .fm-sort-btn i,
.fm-table th[aria-sort="descending"] .fm-sort-btn i {
    color: var(--kp-indigo-2);
    opacity: 1;
}

.fm-col-size {
    width: 110px;
}

.fm-col-date {
    width: 180px;
}

.fm-col-actions {
    width: 148px;
    text-align: right !important;
    padding: 10px 14px !important;
    color: var(--kp-faint);
    font-size: 0.61rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    white-space: nowrap;
}

.fm-table tbody td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--kp-line);
    color: var(--kp-text);
    font-size: 0.84rem;
    vertical-align: middle;
}

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

.fm-row {
    cursor: pointer;
    transition: background var(--kp-t);
}

.fm-row:hover {
    background: rgba(var(--kp-indigo-rgb), 0.065);
}

.fm-row:focus-visible {
    outline: 2px solid var(--kp-mint);
    outline-offset: -2px;
}

.fm-name-cell {
    overflow: hidden;
}

.fm-file-cell {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.fm-file-icon {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    border: 1px solid var(--kp-line);
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.025);
    color: var(--kp-muted);
    font-size: 0.78rem;
}

.fm-icon-folder {
    border-color: rgba(217, 160, 67, 0.28);
    background: rgba(217, 160, 67, 0.11);
    color: #e5b567;
}

.fm-icon-config {
    border-color: rgba(63, 192, 176, 0.25);
    background: rgba(63, 192, 176, 0.1);
    color: #7fd4c8;
}

.fm-icon-archive {
    border-color: rgba(124, 140, 248, 0.28);
    background: rgba(124, 140, 248, 0.1);
    color: #b8c1ff;
}

.fm-icon-code {
    border-color: rgba(var(--kp-indigo-rgb), 0.26);
    background: var(--kp-tint);
    color: #8bb0ff;
}

.fm-icon-text {
    color: #b8c5db;
}

.fm-icon-image {
    border-color: rgba(223, 92, 110, 0.24);
    background: rgba(223, 92, 110, 0.09);
    color: #f3a6c8;
}

.fm-icon-binary {
    color: #9aa8c0;
}

.fm-file-name {
    display: block;
    overflow: hidden;
    min-width: 0;
    color: var(--kp-text);
    font-weight: 500;
    line-height: 1.4;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fm-row.is-folder .fm-file-name {
    font-weight: 600;
}

.fm-size,
.fm-date {
    color: var(--kp-muted);
    font-size: 0.76rem;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.fm-row-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 2px;
    flex-wrap: nowrap;
}

.fm-row-action {
    display: inline-grid;
    place-items: center;
    width: 27px;
    height: 27px;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: var(--kp-faint);
    font-size: 0.76rem;
    cursor: pointer;
    transition: background var(--kp-t), border-color var(--kp-t), color var(--kp-t);
}

.fm-row-action:hover {
    border-color: var(--kp-line-2);
    background: var(--kp-surface-2);
    color: var(--kp-text);
}

.fm-row-action--accent:hover {
    border-color: rgba(var(--kp-indigo-rgb), 0.35);
    background: var(--kp-tint);
    color: var(--kp-indigo-2);
}

.fm-row-action--danger:hover {
    border-color: rgba(223, 92, 110, 0.35);
    background: rgba(223, 92, 110, 0.1);
    color: #fda4af;
}

.fm-state-row td {
    padding: 42px 20px !important;
    border-bottom: none !important;
    text-align: center;
}

.fm-state {
    display: flex;
    align-items: center;
    flex-direction: column;
    gap: 8px;
    color: var(--kp-muted);
    font-size: 0.83rem;
}

.fm-state > i {
    margin-bottom: 2px;
    color: var(--kp-faint);
    font-size: 1.55rem;
}

.fm-state strong {
    color: var(--kp-text);
    font-size: 0.9rem;
}

.fm-state span {
    color: var(--kp-faint);
    font-size: 0.75rem;
}

.fm-state-btn {
    margin-top: 4px;
    padding: 6px 11px;
    border: 1px solid var(--kp-line-2);
    border-radius: 6px;
    background: var(--kp-surface-2);
    color: var(--kp-muted);
    font-family: inherit;
    font-size: 0.74rem;
    font-weight: 600;
    cursor: pointer;
}

.fm-state-btn:hover {
    border-color: var(--kp-indigo);
    color: var(--kp-text);
}

.fm-spinner {
    width: 22px;
    height: 22px;
    margin-bottom: 2px;
    border: 2px solid var(--kp-line-2);
    border-top-color: var(--kp-indigo-2);
    border-radius: 50%;
    animation: fmSpin 0.8s linear infinite;
}

@keyframes fmSpin {
    to {
        transform: rotate(360deg);
    }
}

.fm-editor {
    display: none;
    flex: 1;
    min-height: 0;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--kp-line);
    border-radius: 10px;
    background: #0b111d;
}

.file-manager.is-editing .fm-editor {
    display: flex;
}

.file-manager.is-editing .fm-header,
.file-manager.is-editing .fm-toolbar {
    display: none;
}

.fm-editor-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--kp-line);
    background: var(--kp-surface);
}

.fm-editor-file {
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
}

.fm-editor-icon {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    border: 1px solid rgba(var(--kp-indigo-rgb), 0.28);
    border-radius: 7px;
    background: var(--kp-tint);
    color: var(--kp-indigo-2);
    font-size: 0.76rem;
}

.fm-editor-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.fm-editor-meta strong {
    overflow: hidden;
    color: var(--kp-text);
    font-size: 0.82rem;
    font-weight: 600;
    line-height: 1.3;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fm-editor-meta span {
    color: var(--kp-faint);
    font-size: 0.68rem;
    line-height: 1.2;
}

.fm-editor-meta span.is-dirty {
    color: var(--kp-amber);
}

.fm-editor-meta span.is-saved {
    color: var(--kp-emerald);
}

.fm-editor-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
}

#file-editor-textarea {
    flex: 1;
    width: 100%;
    min-height: 0;
    padding: 16px 18px;
    border: none;
    outline: none;
    resize: none;
    background: #0b111d;
    color: #dce6f7;
    font-family: var(--font-mono);
    font-size: 13.5px;
    line-height: 1.65;
    tab-size: 4;
    white-space: pre;
    overflow: auto;
}

#file-editor-textarea::selection {
    background: rgba(79, 125, 243, 0.36);
}

.fm-editor-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 7px 12px;
    border-top: 1px solid var(--kp-line);
    background: var(--kp-surface);
    color: var(--kp-faint);
    font-size: 0.68rem;
}

.fm-editor-footer kbd {
    padding: 1px 4px;
    border: 1px solid var(--kp-line-2);
    border-radius: 3px;
    background: var(--kp-inset);
    color: var(--kp-muted);
    font-family: inherit;
    font-size: 0.65rem;
}

.fm-drop-overlay {
    position: absolute;
    inset: 10px;
    z-index: 20;
    display: none;
    align-items: center;
    justify-content: center;
    border: 2px dashed rgba(var(--kp-indigo-rgb), 0.6);
    border-radius: 12px;
    background: rgba(10, 17, 32, 0.88);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    pointer-events: none;
}

.fm-drop-overlay.is-visible {
    display: flex;
}

.fm-drop-card {
    display: flex;
    align-items: center;
    flex-direction: column;
    gap: 7px;
    color: var(--kp-muted);
    text-align: center;
}

.fm-drop-card > i {
    margin-bottom: 4px;
    color: var(--kp-indigo-2);
    font-size: 2rem;
}

.fm-drop-card strong {
    color: var(--kp-text);
    font-size: 0.94rem;
}

.fm-drop-card span {
    color: var(--kp-faint);
    font-size: 0.76rem;
}

@media (max-width: 980px) {
    .file-manager.files-panel {
        height: auto;
        min-height: 260px;
        max-height: calc(100vh - 320px);
    }

    .file-manager.is-editing {
        height: calc(100vh - 320px);
        min-height: 260px;
        max-height: calc(100vh - 320px);
    }

    .fm-explorer {
        max-height: 62vh;
    }

    .fm-content {
        min-height: 0;
        padding: 12px 14px 16px;
    }

    .fm-header {
        padding: 16px 16px 12px;
    }

    .fm-toolbar {
        padding: 10px 14px;
    }
}

@media (max-width: 720px) {
    .fm-header {
        align-items: flex-start;
        flex-wrap: wrap;
        gap: 12px;
    }

    .fm-search {
        width: 100%;
        flex: 1 0 100%;
    }

    .fm-actions {
        width: auto;
        margin-left: auto;
    }

    .fm-action-btn {
        width: 34px;
        flex: 0 0 34px;
        padding: 0;
    }

    .fm-action-btn span {
        display: none;
    }

    .fm-breadcrumb {
        order: 10;
        flex: 1 0 100%;
        height: 30px;
    }

    .fm-table {
        min-width: 0;
    }

    .fm-col-size {
        width: 68px;
    }

    .fm-col-date,
    .fm-date {
        display: none;
    }

    .fm-col-actions {
        width: 118px;
        padding-right: 8px !important;
        padding-left: 4px !important;
    }

    .fm-sort-btn {
        padding: 9px 9px;
        font-size: 0.57rem;
    }

    .fm-table tbody td {
        padding: 9px 9px;
        font-size: 0.8rem;
    }

    .fm-file-cell {
        gap: 8px;
    }

    .fm-file-icon {
        width: 27px;
        height: 27px;
        flex-basis: 27px;
        font-size: 0.72rem;
    }

    .fm-size {
        font-size: 0.7rem;
    }

    .fm-row-action {
        width: 25px;
        height: 25px;
        font-size: 0.71rem;
    }

    .fm-editor-actions .fm-action-btn {
        width: auto;
        flex: 0 0 auto;
        padding: 0 9px;
    }

    .fm-editor-actions .fm-action-btn span {
        display: inline;
    }

    .fm-editor-footer > span:last-child {
        display: none;
    }

    .fm-state-row td {
        padding: 34px 12px !important;
    }
}


/* ==========================================================================
   19. スマートフォン向けPC推奨メッセージ
   ========================================================================== */
#mobile-pc-notice {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 20000;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(4, 8, 18, 0.88);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

#mobile-pc-notice.show {
    display: flex;
}

.mobile-pc-card {
    width: 100%;
    max-width: 420px;
    padding: 28px 22px 22px;
    border: 1px solid var(--kp-line);
    border-radius: 16px;
    background: var(--kp-surface);
    text-align: center;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.5);
    animation: mobileNoticeIn 0.25s ease-out;
}

@keyframes mobileNoticeIn {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.mobile-pc-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    margin-bottom: 14px;
    border-radius: 16px;
    background: rgba(var(--kp-indigo-rgb), 0.14);
    color: var(--kp-indigo-2);
    font-size: 1.5rem;
}

.mobile-pc-card h3 {
    margin: 0 0 12px;
    font-size: 1.1rem;
    color: var(--kp-text);
}

.mobile-pc-card p {
    margin: 0 0 12px;
    font-size: 0.88rem;
    line-height: 1.7;
    color: var(--kp-muted);
}

.mobile-pc-hint {
    padding: 10px 12px;
    border-radius: 8px;
    background: rgba(var(--kp-indigo-rgb), 0.08);
    color: var(--kp-indigo-2) !important;
    font-size: 0.8rem !important;
}

.mobile-pc-card .btn {
    margin-top: 8px;
    min-height: 44px;
}

@media (min-width: 769px) {
    #mobile-pc-notice {
        display: none !important;
    }
}


/* スマホのアカウント設定タブ: 横スクロールではなく折り返し表示 */
@media (max-width: 720px) {
    .kp-account-nav {
        flex-wrap: wrap;
        overflow-x: visible;
    }

    .kp-account-nav button {
        flex: 1 1 auto;
        justify-content: center;
        white-space: nowrap;
    }

    .kp-account-nav .kp-account-logout {
        flex: 1 1 auto;
        margin-top: 2px;
    }
}

/* ==========================================================================
   スーパーメニュー
   ========================================================================== */
#btn-super-menu {
    width: auto;
    min-height: 34px;
    height: 34px;
    padding: 0 14px;
    border-radius: 7px;
    border: 1px solid rgba(139, 92, 246, 0.52);
    background: rgba(139, 92, 246, 0.14);
    color: #e9d5ff;
    font-size: 0.8rem;
    white-space: nowrap;
    margin: 0 !important;
}

#btn-super-menu:hover {
    background: rgba(139, 92, 246, 0.26);
    border-color: rgba(167, 139, 250, 0.8);
    color: #fff;
}

@media (max-width: 1180px) {
    #btn-super-menu .btn-label {
        display: none;
    }

    #btn-super-menu {
        width: 34px;
        min-width: 34px;
        padding: 0;
    }
}
