/* Stretch only enrolled rows; keep native link semantics and controls separate. */
.all-connections .caption:has(> ng-include .lan-route-choice) { position: relative; }
.all-connections .caption > ng-include:has(.lan-route-choice) > a.home-connection::after {
    content: '';
    position: absolute;
    inset: 0;
}
.lan-route-switch button { position: relative; z-index: 1; }
.lan-route-slot { display: contents; }
.all-connections .caption > ng-include:has(.lan-route-choice) {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .25rem .75rem;
    width: 100%;
    min-width: 0;
}
.all-connections .caption > ng-include:has(.lan-route-choice) > a.home-connection {
    flex: 1 1 12rem;
    min-width: 0;
    align-self: stretch;
    display: flex;
    align-items: center;
    overflow-wrap: anywhere;
}
.lan-route-choice { display: flex; flex: 0 1 auto; align-items: center; flex-wrap: wrap; gap: .75rem; margin-inline-start: auto; }
.lan-route-switch { display: inline-flex; align-items: center; gap: .35rem; }
.lan-route-switch button { min-height: 2rem; margin: 0; padding: .2rem .15rem !important; border: 0 !important; background: transparent !important; color: inherit; font-size: .9em; cursor: pointer; box-shadow: none; }
.lan-route-switch button[aria-pressed="true"] { font-weight: bold !important; }
.lan-route-switch button:focus-visible { outline: 2px solid #70b9fa; outline-offset: 2px; }
.lan-route-switch button.lan-route-track { position: relative; flex: none; width: 2.5rem; min-width: 0 !important; height: 1.35rem; min-height: 0; padding: 0 !important; border-radius: 999px !important; background: #64748b !important; }
.lan-route-switch button.lan-route-track[aria-checked="true"] { background: #2585c6 !important; }
.lan-route-track span { position: absolute; top: .15rem; left: .15rem; width: 1.05rem; height: 1.05rem; border-radius: 50%; background: white; transition: transform .15s ease; }
.lan-route-track[aria-checked="true"] span { transform: translateX(1.15rem); }
.lan-route-sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.lan-route-status { display: inline-flex; align-items: center; gap: .4rem; font-size: .9em; }
.lan-route-dot { width: .55rem; height: .55rem; border-radius: 50%; background: #a1a1aa; flex: none; }
.lan-route-status.is-ready .lan-route-dot { background: #22c55e; }
@media (max-width: 480px) {
    .lan-route-choice { margin-inline-start: 0; width: 100%; justify-content: space-between; }
    .lan-route-switch { flex-wrap: wrap; }
}

.lan-route-failure {
    padding: .5rem 1rem .75rem;
    background: rgb(40 40 40 / 95%);
    color: white;
    text-align: center;
    overflow-wrap: anywhere;
}

.lan-route-failure p { margin: 0 0 .5rem; }
/* ==========================================================================
   Dark Color System for Apache Guacamole (shadcn/ui Zinc)
   ========================================================================= */

/* --------------------------------------------------------------------------
   1. ログイン・ログアウト画面 (Login / Logout UI)
   -------------------------------------------------------------------------- */
/* 🚨【絶対解決】ログアウト状態の画面全体を強制的に深い黒 (Zinc-950) に */
html, 
body, 
.login-ui, 
.logged-out-ui, 
.logout, 
body.logout,
#logout-screen,
.guac-logout,
.logged-out,
guac-modal { /* 👈 モーダルのルートを直撃 */
    background-color: #09090b !important;
    background: #09090b !important;
    background-image: none !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* 🚨【最重要】ログアウト画面中央の「白い四角い箱」を完全にダーク化 */
.login-ui .dialog, 
.logged-out-ui .dialog, 
.dialog-container .dialog,
guac-modal .modal-contents, /* 👈 ここが真っ白の犯人でした */
.notification,
div.dialog,
.dialog {
    background-color: #18181b !important; /* レイヤー1個上のグレー (Zinc-900) */
    background: #18181b !important;
    color: #f4f4f5 !important;
    border: 1px solid #27272a !important; /* Zinc-800 の繊細なボーダー */
    border-radius: 8px !important;
    box-shadow: 0 4px 24px rgba(0,0,0,0.6) !important;
    padding: 2.5em !important;
}

/* ダイアログ内のテキスト（"You have been logged out." など） */
.login-ui .dialog h2, 
.logged-out-ui .dialog h2, 
guac-modal .modal-contents p,
.notification p,
.dialog p, 
.dialog div,
.dialog span {
    color: #ffffff !important;
    font-weight: 600 !important;
    letter-spacing: -0.02em !important;
    text-shadow: none !important;
}

/* フォームの入力エリア */
.login-ui .dialog input {
    background: #09090b !important;
    color: #f4f4f5 !important;
    border: 1px solid #27272a !important;
    border-radius: 6px !important;
    padding: 8px 12px !important;
}

.login-ui .dialog input:focus {
    border-color: #a1a1aa !important; /* フォーカス時は Zinc-400 */
    outline: none !important;
}

/* 🚨「Submit」および「Re-login」ボタンを中央配置のシャープな反転白に統一 */
.login-ui .submit, 
.logged-out-ui .re-login, 
.logged-out-ui .button,
.notification button, /* 👈 ログアウト画面のボタンを直撃 */
guac-modal button,
.dialog .submit,
.dialog button,
.re-login {
    background: #f4f4f5 !important; /* Zinc-100 */
    color: #09090b !important; /* 文字は漆黒 */
    font-weight: 500 !important;
    border-radius: 6px !important;
    border: none !important;
    padding: 8px 20px !important;
    cursor: pointer !important;
    display: inline-block !important;
    text-decoration: none !important;
    transition: background-color 0.2s !important;
    text-shadow: none !important;
    box-shadow: none !important;
    margin-top: 12px !important;
}

.login-ui .submit:hover, 
.logged-out-ui .re-login:hover, 
.notification button:hover,
guac-modal button:hover,
.dialog .submit:hover,
.re-login:hover {
    background: #e4e4e7 !important; /* Hover時は Zinc-200 */
    color: #09090b !important;
}

/* --------------------------------------------------------------------------
   2. メイン画面・管理UI全体の背景
   -------------------------------------------------------------------------- */
body, .viewport, .main-view, .settings-view, .page-container {
    background-color: #09090b !important;
    color: #f4f4f5 !important;
}

h2, h3, .header h2, p, .title {
    color: #ffffff !important;
}

/* --------------------------------------------------------------------------
   3. ナビゲーション・メニュー・全タブ（プルダウン白化＆文字消え完全対策）
   -------------------------------------------------------------------------- */
/* メニューバーおよび展開されたドロップダウン全体のコンテナ */
.header, 
.navigation, 
.user-menu, 
.menu-dropdown, 
.page-list-level,
.user-menu.open .menu-dropdown,
.user-menu .menu-dropdown,
.user-menu .menu-contents { 
    background-color: #18181b !important; /* レイヤー1個上のグレー (Zinc-900) */
}

.header {
    border-bottom: 1px solid #27272a !important;
}

/* 🚨 マウスアウト時も絶対に白くならないようドロップダウンの「箱」の背景を完全固定 */
.user-menu .menu-dropdown,
.user-menu .menu-contents {
    border: 1px solid #27272a !important;
    border-radius: 6px !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5) !important;
    background: #18181b !important;
}

.navigation li, 
.navigation .menu-dropdown, 
.navigation .client-group,
.navigation .links,
.page-list-level,
.page-list-level li,
.user-menu .profile,
.user-menu .action-list {
    background: transparent !important;
    border: none !important;
}

/* ドロップダウン内を含めた全メニューテキストを常時白に強制 */
.navigation *,
.user-menu *,
.menu-dropdown *,
.links *,
.page-list-level a,
.page-list-level a:link,
.page-list-level a:visited,
.menu-title,
.menu-title a,
.name,
.menu-dropdown a,
.menu-dropdown a:link,
.menu-dropdown a:visited,
div.menu-title,
.user-menu div.menu-title,
.user-menu .profile *,
.user-menu .full-name a,
.user-menu .organization,
.user-menu .logout,
.user-menu .action-list a {
    color: #f4f4f5 !important; /* 明るいグレー (Zinc-100) */
    font-weight: 500 !important;
    text-decoration: none !important;
    border: none !important;
}

.user-menu .organization,
.user-menu .organizational-role {
    color: #a1a1aa !important; /* Zinc-400 */
    font-size: 0.85em !important;
    padding: 2px 12px !important;
}

.navigation a,
.menu-dropdown a,
.links a,
.page-list-level a,
.user-menu .action-list a,
.user-menu .full-name a {
    padding: 8px 12px !important;
    display: inline-block !important;
    border-radius: 6px !important;
}

/* 🚨 ユーザー名「daisuke」が左右のアイコンと絶対に重ならないパディング */
.user-menu .menu-title,
div.menu-title,
.user-menu div.menu-title {
    padding: 8px 32px !important; /* 左右に32pxの安全な余白 */
    display: inline-block !important;
    border-radius: 6px !important;
    transition: background-color 0.2s, color 0.2s !important;
    box-sizing: border-box !important;
}

.menu-dropdown a,
.page-list-level a,
.user-menu .action-list a,
.user-menu .full-name a {
    width: 100% !important;
    box-sizing: border-box !important;
}

.navigation a:focus,
.user-menu *:focus,
.menu-dropdown a:focus,
.links a:focus,
.page-list-level a:focus,
div.menu-title:focus,
.user-menu:focus,
.menu-title:focus {
    outline: none !important;
    box-shadow: none !important;
}

/* カーソルホバー時ハイライト */
.navigation a:hover, 
.user-menu *:hover,
.menu-dropdown a:hover,
.links a:hover,
.page-list-level a:hover,
.user-menu .menu-title:hover,
div.menu-title:hover,
.user-menu .action-list a:hover,
.user-menu .full-name a:hover {
    color: #ffffff !important;
    background-color: #27272a !important; /* Zinc-800 */
    outline: none !important;
}

.navigation .active,
.navigation .active *,
.links .active,
.links .active *,
.navigation li.active a,
.page-list-level a.current {
    color: #ffffff !important;
    background-color: #27272a !important; 
    font-weight: 600 !important;
}

/* --------------------------------------------------------------------------
   4. ボタン・フォーム部品（各種ボタンのアイコン重なり・立体感の完全対策）
   -------------------------------------------------------------------------- */
/* Kill Sessions、Update Password、その他すべての標準ボタンのベース */
button, .button, .submit-button, .change-password, .action-buttons button {
    background-color: #27272a !important; /* Zinc-800 */
    color: #f4f4f5 !important; /* Zinc-100 */
    border: 1px solid #3f3f46 !important; /* Zinc-700 */
    border-radius: 6px !important;
    padding: 8px 16px !important; /* フラットデザインの黄金比パディング */
    cursor: pointer !important;
    font-weight: 500 !important;
    display: inline-block !important;
    text-decoration: none !important;
    transition: background-color 0.2s, border-color 0.2s !important;
    box-sizing: border-box !important;
    text-shadow: none !important;
    box-shadow: none !important;
}

button:hover, .button:hover, .submit-button:hover, .change-password:hover, .action-buttons button:hover {
    background-color: #3f3f46 !important; /* Zinc-700 */
    color: #ffffff !important;
}

/* 🚨【絶対解決】邪魔をしていた ::before 疑似要素（アイコン）を完全に破壊・消去 */
button.change-password::before,
.change-password::before,
.action-buttons button::before,
.action-buttons button.change-password::before {
    display: none !important;
    content: none !important;
    width: 0 !important;
    height: 0 !important;
}

/* 🚨 Update Password などのプレーンボタンの余白を完全に対称（中央配置）にする */
button.change-password,
.change-password,
.action-buttons button,
.action-buttons button.change-password {
    padding-left: 16px !important; /* 👈 邪魔者が消えたため、16pxで完全に美しい中央に整列します */
    padding-right: 16px !important;
    background-image: none !important;
}

/* 🚨 アイコン付きボタン群（New Connectionなど）は左側に安全なスペースを維持 */
.button.add-connection,
.button.add-connection-group,
.button.import-connections,
.button.add-user-group,
.button.add-user,
.button.add-group,
.button.import {
    padding-left: 36px !important; 
    background-position: 12px center !important; 
}

/* 🚨 アイコン付きボタンの ::before は消さないように保護 */
.button.add-connection::before,
.button.add-connection-group::before,
.button.import-connections::before,
.button.add-user-group::before,
.button.add-user::before {
    display: inline-block !important;
}

/* 検索窓やセレクトボックス */
input, select, textarea {
    background-color: #18181b !important;
    color: #f4f4f5 !important;
    border: 1px solid #27272a !important;
    border-radius: 6px !important;
    padding: 6px 12px !important;
}

input:focus {
    border-color: #a1a1aa !important;
    outline: none !important;
}

/* 設定画面のデータテーブル（shadcn/ui モダンストライプ仕様） */
table {
    border-collapse: collapse !important;
    width: 100% !important;
    background-color: transparent !important;
}

/* テーブルヘッダー：Zinc-900背景に純白の太文字 */
table th, table.sorted th {
    background-color: #18181b !important;
    color: #ffffff !important;
    font-weight: 600 !important;
    border-bottom: 2px solid #27272a !important; /* 境界線を少し太くくっきりと */
    padding: 12px !important;
    text-align: left !important;
}

/* 通常の行（奇数行）：基本の黒背景 */
table tr {
    background-color: #09090b !important;
    transition: background-color 0.2s !important;
}

/* 🚨【視認性改善】偶数行（2行目、4行目...）をほんのり明るいグレー(Zinc-900)にして縞模様に */
table tr:nth-child(even) {
    background-color: #18181b !important;
}

/* 🚨【視認性改善】マウスカーソルが乗った行を Zinc-800 でハイライト */
table tr:hover {
    background-color: #27272a !important;
}

/* 各セルの文字色と下部ボーダー(Zinc-800) */
table td {
    padding: 12px !important;
    border-bottom: 1px solid #27272a !important; /* ボーダーをくっきり化 */
    color: #e4e4e7 !important; /* 読みやすい少し明るめのグレー(Zinc-200) */
}

/* --------------------------------------------------------------------------
   5. 接続先ツリーリスト（shadcn/ui ステルスホバー仕様）
   -------------------------------------------------------------------------- */
/* リスト全体のコンテナ背景を完全にフラットな黒(Zinc-950)に */
.group-list, 
.group-list-page, 
.list-item, 
.caption, 
.connection, 
.new-sharing-profile,
.children {
    background-color: transparent !important;
    border-color: #18181b !important; /* 階層の境界線を薄いグレーに */
}

/* 接続アイテム（aタグ）の標準状態：文字はZinc-200 */
.group-list a,
a.settings-connection,
a.new-sharing-profile {
    color: #e4e4e7 !important; /* Zinc-200 */
    display: flex !important;
    align-items: center !important;
    padding: 8px 12px !important;
    border-radius: 6px !important;
    transition: background-color 0.15s, color 0.15s !important;
    text-decoration: none !important;
    background-color: transparent !important;
}

/* 🚨【明るさ調整】マウスオーバー時：明るすぎず、上品にほんのり浮き上がる(Zinc-900) */
.group-list a:hover,
a.settings-connection:hover,
a.new-sharing-profile:hover,
.caption:hover {
    background-color: #18181b !important; /* 👈 明るすぎない絶妙なレイヤーグレー */
    color: #ffffff !important; /* 文字は純白に輝かせる */
}

/* 展開用アイコン(▶︎ / ▼)のホバー時の色も白に固定 */
.icon.expand {
    transition: transform 0.15s, opacity 0.15s !important;
}
.caption:hover .icon.expand {
    opacity: 1 !important;
}

/* 子階層（展開された下のアイテム）のコンテナ調整 */
.group-list .children {
    padding-left: 24px !important; /* 綺麗なインデントを確保 */
    border-left: 1px solid #18181b !important; /* 左側に薄いガイド線を挿入 */
    margin-left: 18px !important;
}

/* ページャー（下部の「1」などのページ選択）もダークモード化 */
.pager .page-numbers li {
    color: #a1a1aa !important;
    background-color: transparent !important;
    border: 1px solid #27272a !important;
    border-radius: 4px !important;
}
.pager .page-numbers li.current {
    color: #09090b !important;
    background-color: #f4f4f5 !important; /* 現在のページは反転白 */
}
/* Guacamole 1.6 appends its clipboard target and inline-styled, classless
   InputSink directly to body. Keep them focusable and selectable for input. */
body > textarea.clipboard-service-target,
body > textarea:not([class])[style*="position: fixed"][style*="resize: none"] {
    width: 0 !important;
    height: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    overflow: hidden;
    resize: none;
    opacity: 0;
    pointer-events: none;
}

/* Guacamole 1.6 home tree. Keep the native links, visibility and click handlers. */
.all-connections .group-list .caption {
    display: flex;
    align-items: center;
    min-height: 40px;
}
.all-connections .group-list .caption > ng-include {
    display: block;
    min-width: 0;
    flex: 1 1 auto;
}
.all-connections .group-list .caption > .icon.expand {
    flex: 0 0 32px;
    width: 32px;
    height: 32px;
    cursor: pointer;
    background-image: none;
    position: relative;
}
.all-connections .group-list .caption > .icon.expand::before {
    content: '';
    display: block;
    position: absolute;
    top: 10px;
    left: 10px;
    width: 8px;
    height: 8px;
    border-right: 2px solid #d4d4d8;
    border-bottom: 2px solid #d4d4d8;
    transform: rotate(-45deg);
}
.all-connections .group-list .expanded > .caption > .icon.expand::before {
    top: 8px;
    transform: rotate(45deg);
}
.all-connections .group-list .caption > .icon.expand:focus-visible,
.all-connections .group-list .caption a:focus-visible {
    outline: 2px solid #93c5fd;
    outline-offset: -2px;
    border-radius: 4px;
}
.all-connections .group-list .connection .caption .icon.type,
.all-connections .group-list .empty.balancer .caption .icon.type {
    filter: invert(0.85);
    flex: 0 0 24px;
}
.all-connections .group-list .expandable > .children {
    margin-left: 15px !important;
    padding-left: 22px !important;
    border-left: 0 !important;
}
.all-connections .group-list .expandable.expanded > .children > .list-item::before,
.all-connections .group-list .expandable.expanded > .children > .list-item::after {
    z-index: 0;
    border-color: #71717a !important;
    pointer-events: none;
    left: -22px;
}
.all-connections .group-list .expandable.expanded > .children > .list-item::before {
    top: -20px;
    bottom: 0;
    height: auto;
}
.all-connections .group-list .expandable.expanded > .children > .list-item:last-child::before {
    bottom: auto;
    height: 40px;
}
.all-connections .group-list .expandable.expanded > .children > .list-item::after {
    width: 18px;
    top: 20px;
}

/* Stock Guacamole gives .menu a light surface; NeoFlow uses light text. */
#guac-menu {
    background-color: #18181b;
    color: #f4f4f5;
    box-shadow: 1px 0 2px black;
}

/* Preserve the dark strokes and original colors in the stock illustrations. */
#guac-menu .choice .figure img,
#guac-menu .client-zoom-in:not(:hover),
#guac-menu .client-zoom-out:not(:hover) {
    background-color: #eee;
    border-radius: 0.25em;
}

#guac-menu .client-zoom-in img,
#guac-menu .client-zoom-out img {
    opacity: 1;
}

#guac-menu #share-links a[href] {
    color: #93c5fd;
}

#guac-menu .menu-body input:is([type="radio"], [type="checkbox"]):focus-visible {
    outline: 2px solid #93c5fd !important;
    outline-offset: 2px;
}

/* The upstream theme's generic textarea color would reveal masked text. */
#guac-menu .clipboard-editor .clipboard-contents-hidden {
    color: transparent !important;
}