:root {
  --bg: #0f1117;
  --card: #171a22;
  --border: #2a2f3a;
  --text: #f3f4f6;
  --muted: #9ca3af;
  --accent: #5b8def;
  --ok: #34d399;
  --warn: #fbbf24;
  --danger: #f87171;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}
/* Vue 読込前も骨組みを表示（CDN失敗時の真っ白を防ぐ） */
[v-cloak] { opacity: 0.6; }

.container { max-width: 1120px; margin: 0 auto; padding: 0 1rem; }
.container.main-wide { max-width: none; padding: 0 0.75rem; }
.main { padding: 1.5rem 0 3rem; }
.main-wide { padding: 0.75rem 0 1.5rem; }
.narrow { max-width: 640px; }
.stack { display: flex; flex-direction: column; gap: 1rem; }
.stack-lg { gap: 2rem; }

.site-header {
  border-bottom: 1px solid var(--border);
  background: rgba(23, 26, 34, 0.9);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 10;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 0;
}
.brand { color: var(--text); text-decoration: none; font-weight: 700; }
.nav { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.nav a {
  color: var(--muted);
  text-decoration: none;
  padding: 0.35rem 0.65rem;
  border-radius: 0.5rem;
  border: 1px solid var(--border);
  font-size: 0.875rem;
}
.nav a:hover { color: var(--text); border-color: var(--accent); }

.page-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  align-items: end;
}
.filter { min-width: 220px; }

h1 { margin: 0 0 0.25rem; font-size: 1.5rem; }
h2 { margin: 0; font-size: 0.95rem; color: var(--muted); }
.group-title { margin: 0; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 1rem;
}
.project-card {
  display: flex;
  gap: 1rem;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.project-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(0,0,0,0.35);
}
.status-ok { border-color: rgba(52, 211, 153, 0.45); }
.status-warning { border-color: rgba(251, 191, 36, 0.45); }
.status-danger { border-color: rgba(248, 113, 113, 0.45); }
.status-unknown { border-color: var(--border); }

.drag-handle { cursor: grab; color: var(--muted); padding-top: 0.25rem; user-select: none; }
.favicon { width: 40px; height: 40px; border-radius: 0.5rem; object-fit: cover; background: var(--bg); }
.og-thumb { width: 120px; height: 72px; border-radius: 0.5rem; object-fit: cover; display: none; }
@media (min-width: 900px) { .og-thumb { display: block; } }

.project-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.project-head { display: flex; justify-content: space-between; gap: 0.75rem; }
.project-actions { display: flex; align-items: center; gap: 0.5rem; }
.desc { margin: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.meta-grid, .edit-grid {
  display: grid;
  gap: 0.5rem;
  font-size: 0.75rem;
}
.meta-grid { grid-template-columns: repeat(2, 1fr); }
@media (min-width: 700px) { .meta-grid { grid-template-columns: repeat(4, 1fr); } }
.edit-grid { grid-template-columns: 1fr; }
@media (min-width: 700px) { .edit-grid { grid-template-columns: repeat(3, 1fr); } }
.edit-grid label { color: var(--muted); display: flex; flex-direction: column; gap: 0.25rem; }

.badge {
  font-size: 0.7rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
}
.badge-ok { background: rgba(52,211,153,0.2); color: var(--ok); }
.badge-warning { background: rgba(251,191,36,0.2); color: var(--warn); }
.badge-danger { background: rgba(248,113,113,0.2); color: var(--danger); }
.badge-unknown { background: rgba(156,163,175,0.2); color: var(--muted); }

.label { display: block; font-size: 0.75rem; color: var(--muted); margin-bottom: 0.25rem; }
.input {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  border-radius: 0.5rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
}
.input:focus { outline: none; border-color: var(--accent); }
textarea.input { min-height: 5rem; resize: vertical; }
.mono { font-family: ui-monospace, monospace; font-size: 0.8rem; }

.btn {
  border: none;
  border-radius: 0.5rem;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  cursor: pointer;
}
.btn-primary { background: var(--accent); color: white; }
.btn-danger { background: transparent; border: 1px solid var(--danger); color: var(--danger); }
.btn-block { width: 100%; margin-top: 0.75rem; }
.btn-icon {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 0.5rem;
  padding: 0.2rem 0.45rem;
  cursor: pointer;
}
.btn:disabled, .btn-icon:disabled { opacity: 0.5; cursor: not-allowed; }

.muted { color: var(--muted); }
.small { font-size: 0.75rem; }
.link { color: var(--accent); font-size: 0.75rem; word-break: break-all; }
.msg-ok { color: var(--ok); font-size: 0.875rem; }
.msg-error { color: var(--danger); font-size: 0.875rem; }

.auth-wrap { min-height: 70vh; display: flex; align-items: center; justify-content: center; }
.auth-card { width: 100%; max-width: 400px; }

.settings-page h2 { margin: 0 0 0.25rem; font-size: 1rem; }
.settings-page .grid-2 {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: 1fr;
}
@media (min-width: 640px) {
  .settings-page .grid-2 { grid-template-columns: 1fr 1fr; }
}
.checkbox-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
}

/* --- 一覧テーブル（Excel風・高密度） --- */
.page-dashboard .page-head { margin-bottom: 0.5rem; }
.input-sm { padding: 0.35rem 0.5rem; font-size: 0.8rem; }

/* お知らせ（インフォメーションエリア） */
.info-alerts {
  margin: 0.5rem 0 1rem;
  padding: 0.65rem 0.85rem;
  border: 1px solid rgba(91, 141, 239, 0.45);
  border-radius: 0.5rem;
  background: rgba(91, 141, 239, 0.08);
}

.info-alerts-head {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.45rem;
  font-size: 0.8rem;
}

.info-alerts-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.1rem;
  height: 1.1rem;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
}

.info-alerts-count {
  margin-left: auto;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 400;
}

.info-alerts-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.info-alert-link {
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
  padding: 0.3rem 0.4rem;
  border-radius: 0.35rem;
  text-decoration: none;
  color: var(--text);
  font-size: 0.78rem;
  line-height: 1.35;
}
.info-alert-link:hover {
  background: rgba(255, 255, 255, 0.05);
  text-decoration: underline;
}

.alert-badge {
  flex-shrink: 0;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
}
.alert-danger { background: rgba(248, 113, 113, 0.25); color: var(--danger); }
.alert-warning { background: rgba(251, 191, 36, 0.25); color: var(--warn); }

.info-alert-text { min-width: 0; }

.data-table tr.row-highlight td {
  animation: row-flash 2.2s ease;
}
@keyframes row-flash {
  0%, 100% { background: var(--card); }
  15%, 45% { background: rgba(91, 141, 239, 0.22); }
}

.customer-sections {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.customer-section {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.customer-heading {
  margin: 0;
  padding: 0.25rem 0 0.15rem;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  border-bottom: 2px solid var(--accent);
  line-height: 1.3;
}

.customer-section .table-scroll {
  max-height: none;
}

.table-scroll {
  overflow: auto;
  max-height: calc(100vh - 7rem);
  border: 1px solid var(--border);
  border-radius: 0.375rem;
  background: var(--card);
}

.data-table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  font-size: 0.6875rem;
  line-height: 1.3;
  table-layout: fixed;
}

.data-table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: #1e222b;
  font-weight: 600;
  text-align: left;
  padding: 0.35rem 0.4rem;
  border-bottom: 2px solid var(--border);
  border-right: 1px solid var(--border);
  white-space: nowrap;
  color: var(--muted);
}

.data-table td {
  padding: 0.2rem 0.35rem;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid rgba(42, 47, 58, 0.6);
  vertical-align: middle;
  background: var(--card);
}

.data-table tbody tr:hover td { background: #1c2030; }

.row-status-ok td:first-child { box-shadow: inset 3px 0 0 var(--ok); }
.row-status-warning td:first-child { box-shadow: inset 3px 0 0 var(--warn); }
.row-status-danger td:first-child { box-shadow: inset 3px 0 0 var(--danger); }
.row-status-unknown td:first-child { box-shadow: inset 3px 0 0 var(--muted); }

.col-drag { width: 28px; text-align: center; }
.col-status { width: 72px; }
.col-icon { width: 28px; }
.col-og { width: 44px; }
.col-title { width: 120px; }
.col-desc { width: 140px; }
.col-url { width: 160px; }
.col-http { width: 44px; text-align: center; }
.col-ssl { width: 40px; text-align: center; }
.col-ssl-days { width: 44px; text-align: right; }
.col-wp { width: 28px; text-align: center; }
.col-wp-ver { width: 56px; }
.col-server { width: 88px; }
.col-id { width: 72px; }
.col-renewal { width: 72px; text-align: right; }
.col-memo { width: 120px; }
.col-dns { width: 72px; }
.col-dns-id { width: 64px; }
.col-checked { width: 88px; white-space: nowrap; }

.cell-clip {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 0;
}

.cell-thumb { width: 16px; height: 16px; object-fit: contain; display: block; }
.cell-og { width: 36px; height: 22px; object-fit: cover; border-radius: 2px; display: block; }
.cell-link { color: var(--accent); text-decoration: none; }
.cell-link:hover { text-decoration: underline; }

.cell-input {
  width: 100%;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  font-size: inherit;
  padding: 0.1rem 0.2rem;
  border-radius: 2px;
  min-width: 0;
}
.cell-input:hover { border-color: var(--border); background: var(--bg); }
.cell-input:focus { outline: none; border-color: var(--accent); background: var(--bg); }
.cell-input-wide { min-width: 100px; }

.renewal-cell {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.15rem;
}
.renewal-days {
  font-weight: 600;
  white-space: nowrap;
}
.cell-date {
  width: 1.1rem;
  height: 1.1rem;
  padding: 0;
  border: none;
  background: transparent;
  color: transparent;
  cursor: pointer;
  flex-shrink: 0;
}
.cell-date::-webkit-calendar-picker-indicator {
  cursor: pointer;
  opacity: 0.55;
  filter: invert(0.8);
}
.cell-date:hover::-webkit-calendar-picker-indicator,
.cell-date:focus::-webkit-calendar-picker-indicator {
  opacity: 1;
}
.col-memo .cell-input { cursor: text; }

.cell-select {
  width: 100%;
  font-size: inherit;
  padding: 0.1rem 0;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  border-radius: 2px;
  cursor: pointer;
}
.cell-select:hover,
.cell-select:focus { border-color: var(--accent); background: var(--bg); outline: none; }

.cell-ok { color: var(--ok); font-weight: 600; }
.cell-warn { color: var(--warn); font-weight: 600; }
.cell-danger { color: var(--danger); font-weight: 600; }

.drag-handle {
  cursor: grab;
  color: var(--muted);
  user-select: none;
  font-size: 0.75rem;
}
.drag-handle:active { cursor: grabbing; }

.checked-cell {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
.checked-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }

.btn-refresh {
  flex-shrink: 0;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  border-radius: 3px;
  padding: 0 0.25rem;
  font-size: 0.7rem;
  line-height: 1.4;
  cursor: pointer;
}
.btn-refresh:hover:not(:disabled) { border-color: var(--accent); }
.btn-refresh:disabled { opacity: 0.5; cursor: not-allowed; }

/* Sortable ゴースト行 */
.sortable-ghost td { opacity: 0.4; background: #252a38 !important; }
