/* pointcloud-registry — dark theme */
:root {
    --bg: #0d1117;
    --panel: #161b22;
    --border: #30363d;
    --text: #e6edf3;
    --text-dim: #8b949e;
    --accent: #79c0ff;
    --green: #56d364;
    --red: #ff7b72;
    --yellow: #e3b341;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: "Hiragino Sans", "Noto Sans JP", system-ui, sans-serif;
    line-height: 1.6;
}

/* ログイン */
.login-overlay {
    position: fixed; inset: 0; background: var(--bg);
    display: flex; align-items: center; justify-content: center; z-index: 300;
}
.login-box {
    background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
    padding: 32px 36px; width: 340px; display: flex; flex-direction: column; gap: 12px;
}
.login-box h1 { margin: 0; font-size: 1.4rem; }
.login-box input {
    background: #0d1117; color: var(--text); border: 1px solid var(--border);
    border-radius: 8px; padding: 10px 12px; font-size: 0.95rem;
}
.login-error { color: var(--red); font-size: 0.82rem; min-height: 1em; }

/* ヘッダ */
.header-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.header-user { display: flex; align-items: center; gap: 8px; font-size: 0.82rem; color: var(--text-dim); }

/* タブ */
.tabs { display: flex; gap: 6px; margin: 14px 0 4px; border-bottom: 1px solid var(--border); }
.tab {
    background: none; border: none; color: var(--text-dim); cursor: pointer;
    padding: 8px 16px; font-size: 0.9rem; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.site-header { padding: 26px 24px 8px; max-width: 1200px; margin: 0 auto; }
.site-header h1 { margin: 0; font-size: 1.5rem; }
.site-header p { margin: 4px 0 0; color: var(--text-dim); font-size: 0.88rem; }
.header-stats { margin-top: 6px; color: var(--accent); font-size: 0.8rem; font-variant-numeric: tabular-nums; }

main { max-width: 1200px; margin: 0 auto; padding: 10px 24px 40px; }

.hint { color: var(--text-dim); font-size: 0.82rem; margin: 6px 0; }

/* toolbar */
.toolbar { display: flex; gap: 10px; margin: 14px 0; flex-wrap: wrap; }
.toolbar input[type="search"] {
    flex: 1; min-width: 200px;
    background: var(--panel); color: var(--text);
    border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px;
}

select, input[type="text"], input[type="date"], textarea {
    background: var(--panel); color: var(--text);
    border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px;
    font-size: 0.88rem;
}

textarea { width: 100%; font-family: ui-monospace, monospace; resize: vertical; margin-top: 8px; }

.btn {
    background: #21262d; color: var(--text);
    border: 1px solid var(--border); border-radius: 7px;
    padding: 8px 16px; font-size: 0.88rem; cursor: pointer; text-decoration: none;
    display: inline-block;
}
.btn:hover { background: #30363d; }
.btn.primary { background: #1c3a5e; border-color: #2f6fab; }
.btn.primary:hover { background: #24486f; }
.btn.primary:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.small { padding: 4px 12px; font-size: 0.8rem; }
.btn.danger { border-color: var(--red); color: var(--red); }

/* catalog */
.catalog {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 14px;
}

.cloud-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    transition: border-color 0.15s, transform 0.1s;
}
.cloud-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.cloud-thumb {
    width: 100%; aspect-ratio: 1; object-fit: cover; display: block;
    background: #090c10;
}
.cloud-thumb-placeholder {
    width: 100%; aspect-ratio: 1; display: flex; align-items: center;
    justify-content: center; color: var(--text-dim); font-size: 2rem; background: #090c10;
}
.cloud-info { padding: 10px 12px; }
.cloud-name { font-weight: 600; font-size: 0.92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cloud-meta { color: var(--text-dim); font-size: 0.75rem; margin-top: 2px; }
.chip {
    display: inline-block; padding: 1px 8px; border-radius: 10px;
    font-size: 0.7rem; background: #1c3a5e; color: var(--accent); margin-right: 4px;
}
.chip.tf { background: #2a2440; color: #d2a8ff; }
.chip.src { background: #28331c; color: #9ece6a; }
.chip.vis-priv { background: #3a2a1c; color: var(--yellow); }
.chip.vis-int { background: #1c3a2a; color: var(--green); }

/* 詳細モーダル: KV テーブル / サムネ / 画像グリッド / 派生リスト */
table.kv { width: 100%; }
table.kv th { width: 130px; white-space: nowrap; color: var(--text-dim); }
.detail-thumb-wrap { float: right; margin: 0 0 10px 14px; }
.detail-thumb { width: 200px; border-radius: 8px; display: block; }
.derived-list { margin: 4px 0 12px; padding-left: 20px; font-size: 0.85rem; }
.derived-list a { color: var(--accent); }
.img-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin: 8px 0; }
.img-cell { margin: 0; }
.img-cell img {
    width: 100%; aspect-ratio: 16/9; object-fit: cover; border-radius: 6px;
    background: #090c10; cursor: pointer; border: 1px solid var(--border);
}
.img-cell figcaption { font-size: 0.7rem; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* card section */
.card {
    background: var(--panel); border: 1px solid var(--border);
    border-radius: 10px; padding: 18px 20px; margin-top: 22px;
}
.card h2 { margin: 0 0 8px; font-size: 1.05rem; }

.frame-row { display: flex; gap: 10px; align-items: center; margin: 10px 0; flex-wrap: wrap; }

pre {
    background: #0d1117; border: 1px solid var(--border); border-radius: 8px;
    padding: 10px 14px; overflow-x: auto; font-size: 0.82rem; line-height: 1.6;
    font-variant-numeric: tabular-nums;
}

/* tables */
table { border-collapse: collapse; width: 100%; font-size: 0.84rem; margin-top: 10px; }
th, td { border: 1px solid var(--border); padding: 5px 10px; text-align: left; }
th { background: #21262d; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }

/* modal */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(0, 0, 0, 0.65);
    display: flex; align-items: center; justify-content: center; z-index: 100;
    padding: 20px;
}
.modal {
    background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
    padding: 22px 24px; width: 100%; max-width: 540px; max-height: 90vh; overflow-y: auto;
}
.modal-wide { max-width: 760px; }
.modal h2 { margin: 0 0 12px; font-size: 1.1rem; }

.drop-zone {
    border: 2px dashed var(--border); border-radius: 10px; padding: 22px;
    text-align: center; cursor: pointer; color: var(--text-dim); margin-bottom: 14px;
}
.drop-zone.drag-over, .drop-zone:hover { border-color: var(--accent); color: var(--accent); }
.drop-zone.has-file { border-color: var(--green); border-style: solid; color: var(--green); }

.form-grid {
    display: grid; grid-template-columns: 90px 1fr; gap: 8px 10px; align-items: center;
    font-size: 0.85rem;
}
.form-grid label { color: var(--text-dim); text-align: right; }

.modal-actions { display: flex; gap: 10px; margin-top: 16px; justify-content: flex-end; }

.detail-thumb { width: 200px; border-radius: 8px; float: right; margin: 0 0 10px 14px; }
.detail-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }

/* toast */
.toast {
    position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
    background: #21262d; border: 1px solid var(--border); border-radius: 8px;
    padding: 10px 18px; font-size: 0.85rem; opacity: 0; pointer-events: none;
    transition: opacity 0.2s; z-index: 200;
}
.toast.show { opacity: 1; }
.toast.err { border-color: var(--red); color: var(--red); }

.site-footer {
    max-width: 1200px; margin: 0 auto; padding: 16px 24px 32px;
    color: var(--text-dim); font-size: 0.76rem;
}
.site-footer code { background: #21262d; padding: 1px 5px; border-radius: 4px; }

/* グラフ健全性タブ */
.health-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 0.6rem; margin-bottom: 1rem; }
.hcard { background: var(--card, #1c2333); border: 1px solid var(--border, #2a3447); border-radius: 8px; padding: 0.8rem; text-align: center; }
.hcard.warn { border-color: #c9a227; }
.hnum { font-size: 1.7rem; font-weight: 700; line-height: 1.1; }
.hlabel { font-size: 0.72rem; opacity: 0.7; margin-top: 0.2rem; }
