:root {
  --bg: #0F0B1A;
  --surface: #1A1430;
  --surface-2: #241C3F;
  --primary: #B14AFF;
  --primary-2: #FF3DAE;
  --text: #F3EEFB;
  --muted: #B3AEC2;
  --border: #30285A;
  --radius: 14px;
  --maxw: 1100px;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: inherit;
  background: var(--bg);
  color: var(--text);
}
.layout {
  display: flex;
  min-height: 100vh;
}
.sidebar {
  width: 300px;
  flex-shrink: 0;
  background: var(--surface);
  color: var(--text);
  padding: 24px 20px;
  border-right: 1px solid var(--border);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.brand img { width: 32px; height: 32px; }
.sidebar h1 {
  font-size: 18px;
  margin: 0;
  font-weight: 700;
}
.status-badge {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
}
.status-badge.ok { background: rgba(0, 230, 168, 0.15); border-color: #00E6A8; color: #00E6A8; }
.status-badge.error { background: rgba(255, 80, 80, 0.15); border-color: #FF5050; color: #FF8A8A; }
.caption {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
}
main {
  flex: 1;
  padding: 32px 40px;
  max-width: var(--maxw);
}
.page { display: none; }
.page.active { display: block; }
h2 { margin-top: 0; color: var(--text); }
.form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin: 16px 0;
}
.form-row input[type="text"] {
  flex: 1;
  min-width: 260px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  background: var(--surface);
  color: var(--text);
}
.form-row input[type="number"] {
  width: 80px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  background: var(--surface);
  color: var(--text);
}
.checkbox-label {
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text);
}
button {
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 14px;
}
button.primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff;
  border-color: transparent;
  font-weight: 700;
}
button:disabled {
  opacity: 0.6;
  cursor: default;
}
.status-line {
  font-size: 13px;
  color: var(--muted);
  min-height: 20px;
  margin-bottom: 8px;
}
.status-line.error { color: #FF8A8A; }
.card-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  transition: border-color .2s, transform .2s;
}
.card:hover { border-color: var(--primary); transform: translateY(-2px); }
.card-top {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.icon-badge {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.icon-badge img { width: 20px; height: 20px; }
.card-title {
  font-weight: 700;
  font-size: 16px;
  flex: 1;
  min-width: 160px;
  color: var(--text);
}
.meta-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--muted);
  margin: 8px 0;
}
.summary-box {
  background: var(--surface-2);
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  margin-top: 8px;
  border: 1px solid var(--border);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-top: 6px;
  color: var(--text);
}
th, td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}
th { color: var(--muted); font-weight: 600; }
.empty-hint {
  color: var(--muted);
  font-size: 14px;
}
.caption-small {
  font-size: 12px;
  color: var(--muted);
  margin: 4px 0 10px;
}
.cost-columns {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  margin-top: 16px;
}
.cost-columns > div {
  flex: 1;
  min-width: 260px;
}
.total-estimate {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff;
  padding: 14px 18px;
  border-radius: var(--radius);
  font-size: 18px;
  font-weight: 700;
  margin: 12px 0;
  display: inline-block;
}
.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin-right: 6px;
  vertical-align: middle;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
.sort-row {
  margin-top: -4px;
}
.sort-label {
  font-size: 13px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
.sort-select {
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  background: var(--surface);
  color: var(--text);
}
.sort-dir-btn {
  padding: 6px 10px;
  font-size: 13px;
}

/* ---------- 常時表示のフローティングハンバーガーメニュー(スマホ・狭い画面のみ) ---------- */
.menu-toggle {
  display: none;
}
.sidebar-backdrop {
  display: none;
}
/* ---------- レスポンシブ(スマホ・狭い画面) ---------- */
@media (max-width: 760px) {
  .menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    top: 14px;
    right: 14px;
    width: 46px;
    height: 46px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    color: #fff;
    font-size: 20px;
    line-height: 1;
    z-index: 1100;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    cursor: pointer;
  }
  .layout {
    flex-direction: column;
  }
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(85vw, 300px);
    padding: 20px 16px;
    z-index: 1000;
    overflow-y: auto;
    transform: translateX(-105%);
    transition: transform 0.25s ease;
    box-shadow: 2px 0 16px rgba(0, 0, 0, 0.5);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .sidebar-backdrop.open {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 900;
  }
  main {
    padding: 72px 16px 16px;
    max-width: 100%;
  }
  .form-row input[type="text"] {
    min-width: 0;
    flex: 1 1 100%;
  }
  .form-row input[type="number"] {
    flex: 1 1 auto;
  }
  .sort-row {
    flex: 1 1 100%;
  }
  .cost-columns {
    flex-direction: column;
    gap: 16px;
  }
  table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
  }
}
