:root {
  --ink: #10231f;
  --muted: #5b6e69;
  --paper: #f3f7f4;
  --panel: rgba(255, 255, 255, 0.82);
  --line: rgba(16, 35, 31, 0.12);
  --accent: #0f7a62;
  --accent-2: #c45c26;
  --warn: #b45309;
  --danger: #b42318;
  --ok: #0f7a62;
  --shadow: 0 18px 50px rgba(16, 35, 31, 0.12);
  --radius: 18px;
  --font-display: "Sora", "Noto Sans SC", sans-serif;
  --font-body: "Noto Sans SC", "Sora", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--paper);
}

.bg-atmosphere {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(15, 122, 98, 0.22), transparent 55%),
    radial-gradient(900px 500px at 90% 0%, rgba(196, 92, 38, 0.16), transparent 50%),
    linear-gradient(180deg, #e8f1ec 0%, #f3f7f4 45%, #eef2ef 100%);
}
.bg-atmosphere::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(16, 35, 31, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(16, 35, 31, 0.04) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(180deg, rgba(0,0,0,0.55), transparent 80%);
  pointer-events: none;
}

.hidden { display: none !important; }

.brand-mark {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.08em;
  font-size: 1.05rem;
  margin: 0;
}

.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-panel {
  width: min(440px, 100%);
  padding: 40px 36px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--panel);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
  animation: rise 0.55s ease both;
}
.login-panel h1 {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  margin: 10px 0 8px;
  line-height: 1.15;
}
.login-sub, .hint { color: var(--muted); margin: 0 0 20px; line-height: 1.6; }
.field { display: grid; gap: 8px; margin-bottom: 14px; }
.field span { font-size: 0.9rem; color: var(--muted); }
input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  font: inherit;
  background: #fff;
  color: var(--ink);
}
input:focus {
  outline: 2px solid rgba(15, 122, 98, 0.35);
  border-color: var(--accent);
}
.error { color: var(--danger); min-height: 1.2em; margin: 0 0 10px; font-size: 0.92rem; }

.btn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 999px;
  padding: 10px 16px;
  font: inherit;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  width: 100%;
}
.btn.ghost { background: transparent; }
.actions .btn.primary, .inline-form .btn.primary, .grid-form .btn.primary, .toolbar .btn {
  width: auto;
}

.app-view { min-height: 100vh; }
.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,0.7);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-brand { display: grid; min-width: 120px; }
.brand-sub { font-size: 0.75rem; color: var(--muted); letter-spacing: 0.04em; }
.nav { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; }
.nav-btn {
  border: 0;
  background: transparent;
  padding: 8px 12px;
  border-radius: 999px;
  cursor: pointer;
  font: inherit;
  color: var(--muted);
}
.nav-btn.active {
  background: rgba(15, 122, 98, 0.12);
  color: var(--accent);
  font-weight: 600;
}

.main { padding: 28px 24px 48px; max-width: 1200px; margin: 0 auto; }
.section-head { margin-bottom: 20px; }
.section-head.row { display: flex; justify-content: space-between; gap: 16px; align-items: end; flex-wrap: wrap; }
.section-head h2 {
  font-family: var(--font-display);
  margin: 0 0 6px;
  font-size: 1.7rem;
}
.section-head p { margin: 0; color: var(--muted); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

.stat-grid, .disk-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.stat-card, .disk-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  background: var(--panel);
  animation: rise 0.45s ease both;
}
.stat-card .label, .disk-card .label { color: var(--muted); font-size: 0.85rem; }
.stat-card .value {
  font-family: var(--font-display);
  font-size: 2rem;
  margin-top: 8px;
}
.disk-card.warn { border-color: rgba(180, 83, 9, 0.45); background: rgba(255, 247, 237, 0.9); }
.disk-card .value { font-family: var(--font-display); font-size: 1.35rem; margin: 8px 0; }
.meter {
  height: 8px;
  border-radius: 999px;
  background: rgba(16,35,31,0.08);
  overflow: hidden;
}
.meter > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #1fa88a);
}
.disk-card.warn .meter > span { background: linear-gradient(90deg, var(--warn), #f59e0b); }

.table-wrap {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  overflow: auto;
  margin-bottom: 16px;
}
.table-wrap h3 { margin: 14px 16px 0; font-size: 1rem; }
table { width: 100%; border-collapse: collapse; }
th, td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  font-size: 0.92rem;
  vertical-align: top;
}
th { color: var(--muted); font-weight: 500; }
tr:last-child td { border-bottom: 0; }

.inline-form, .grid-form, .toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.inline-form input, .grid-form input, .toolbar input { flex: 1; min-width: 140px; }
.split {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 16px;
}
.conflict-box {
  margin: 12px 16px;
  padding: 12px;
  border-radius: 12px;
  background: rgba(15, 122, 98, 0.06);
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}
.code-box {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #0f1c19;
  color: #d7ebe4;
  padding: 18px;
  overflow: auto;
  font-size: 0.9rem;
  line-height: 1.55;
}

.site-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.site-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  background: var(--panel);
  display: grid;
  gap: 8px;
  animation: rise 0.4s ease both;
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.site-card:hover {
  transform: translateY(-2px);
  border-color: rgba(15, 122, 98, 0.35);
}
.site-card h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.1rem;
}
.site-card .note {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
  min-height: 2.8em;
}
.site-card .url {
  font-size: 0.86rem;
  color: var(--accent);
  word-break: break-all;
  text-decoration: none;
}
.site-card .url:hover { text-decoration: underline; }
.site-card .card-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 860px) {
  .topbar { flex-wrap: wrap; }
  .split { grid-template-columns: 1fr; }
  .section-head.row { align-items: start; }
}
