/* 旧管理画面（黒いサイドバー＋緑のタイル）の配置を踏襲している */
:root {
  --sidebar: #1c1c1c;
  --sidebar-head: #4c6b28;
  --accent: #9ee619;
  --line: #dcdcdc;
  --text: #222;
  --muted: #6b6b6b;
  --ok: #2e7d32;
  --warn: #b26a00;
  --ng: #c62828;
  --bg: #fff;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic UI", Meiryo, sans-serif;
  font-size: 14px;
  line-height: 1.6;
}

.layout { display: flex; min-height: 100vh; }

/* --- サイドバー --- */
.sidebar { width: 190px; flex: 0 0 190px; background: var(--sidebar); }
.sidebar h1 {
  margin: 0; padding: 10px 14px; font-size: 14px; font-weight: 500;
  color: #fff; background: var(--sidebar-head);
}
.sidebar a {
  display: block; padding: 9px 14px; color: #c9c9c9;
  text-decoration: none; border-bottom: 1px solid #2a2a2a; font-size: 13px;
}
.sidebar a:hover { background: #2c2c2c; color: #fff; }
.sidebar a.active { color: #fff; background: #333; border-left: 3px solid var(--accent); }

/* --- 本文 --- */
.main { flex: 1; min-width: 0; padding: 0 26px 60px; }
.page-title {
  margin: 0 0 20px; padding: 18px 0; font-size: 26px; font-weight: 400; text-align: center;
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
h2 { font-size: 16px; font-weight: 600; margin: 26px 0 10px; }
h2:first-of-type { margin-top: 10px; }

/* --- トップページのタイル --- */
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 8px; }
.tile {
  display: block; padding: 14px; background: var(--accent); color: #111;
  text-decoration: none; font-size: 13px; min-height: 58px;
  border: 1px solid #8bcf12;
}
.tile:hover { filter: brightness(1.06); }
.tile .num { display: block; font-size: 22px; font-weight: 700; }

/* --- 表 --- */
table { width: 100%; border-collapse: collapse; margin-bottom: 18px; }
th, td { padding: 6px 8px; border: 1px solid var(--line); text-align: left; vertical-align: top; }
th { background: #f4f4f4; font-weight: 600; white-space: nowrap; }
td.num, th.num { text-align: right; white-space: nowrap; }
tbody tr:nth-child(even) { background: #fafafa; }
.table-wrap { overflow-x: auto; }

/* --- 状態バッジ --- */
.badge {
  display: inline-block; padding: 1px 7px; border-radius: 3px;
  font-size: 12px; white-space: nowrap; color: #fff;
}
.badge.success { background: var(--ok); }
.badge.failed { background: var(--ng); }
.badge.running { background: #1565c0; }
.badge.needs_login { background: var(--warn); }
.badge.skipped { background: var(--muted); }

/* --- 入力・ボタン --- */
input[type=text], input[type=password], input[type=number], select {
  padding: 4px 6px; border: 1px solid #bbb; font-size: 13px; font-family: inherit;
}
button, .btn {
  padding: 5px 12px; border: 1px solid #bbb; background: #efefef; color: #222;
  cursor: pointer; font-size: 13px; font-family: inherit; text-decoration: none;
  display: inline-block;
}
button:hover, .btn:hover { background: #e2e2e2; }
button.primary { background: var(--accent); border-color: #8bcf12; }
button.danger { background: #fdecec; border-color: #e0a5a5; }

.filters { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.muted { color: var(--muted); font-size: 12px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }

/* --- 注意書き --- */
.notice { padding: 10px 14px; margin: 0 0 16px; border-left: 4px solid var(--warn); background: #fff8e8; }
.notice.error { border-left-color: var(--ng); background: #fdecec; }
.notice.info { border-left-color: #1565c0; background: #eef4fc; }
.notice h3 { margin: 0 0 6px; font-size: 14px; }
.notice ul { margin: 4px 0 0; padding-left: 20px; }

pre.log {
  background: #1c1c1c; color: #ddd; padding: 12px; overflow-x: auto;
  font-size: 12px; line-height: 1.5; max-height: 520px; overflow-y: auto;
}

/* --- 手動ログイン画面（noVNC） --- */
.vnc-frame {
  width: 100%; aspect-ratio: 1280 / 900; min-height: 420px;
  border: 1px solid var(--line); background: #111; margin-bottom: 10px;
}
.vnc-frame iframe { width: 100%; height: 100%; border: 0; display: block; }

/* --- ログイン --- */
.login-box { max-width: 340px; margin: 90px auto; }
.login-box h1 { font-size: 20px; font-weight: 400; text-align: center; }
.login-box label { display: block; margin: 12px 0 4px; font-size: 13px; }
.login-box input { width: 100%; }
.login-box button { width: 100%; margin-top: 18px; }

@media (max-width: 900px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; flex: none; }
  .sidebar a { display: inline-block; border: none; }
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .main { padding: 0 14px 40px; }
}

/* ---- 落札明細（プレビュー） ---- */
td.thumb { width: 96px; text-align: center; }
td.thumb img {
  width: 80px; height: 80px; object-fit: contain;
  background: #f4f6f8; border: 1px solid var(--line); border-radius: 4px;
}
.small { font-size: 12px; line-height: 1.6; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #111; font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); }

/* ---- 誰が使っているか（サイドバー下部）---- */
.badge.warn { background: var(--warn); }
.whoami {
  padding: 12px 14px; border-top: 1px solid #333; margin-top: 8px;
  color: #ccc; font-size: 12px; line-height: 1.7;
}
.whoami-name { display: block; color: #fff; font-size: 14px; font-weight: 600; }
.whoami-code { color: #888; }
