:root {
  --bg: #070b14;
  --bg-2: #0b1220;
  --panel: rgba(16, 24, 40, 0.82);
  --panel-2: rgba(22, 32, 52, 0.9);
  --line: rgba(148, 163, 184, 0.16);
  --text: #e5edf7;
  --muted: #94a3b8;
  --muted-2: #64748b;
  --accent: #4f8cff;
  --accent-2: #7c5cff;
  --ok: #34d399;
  --warn: #fbbf24;
  --bad: #fb7185;
  --radius: 18px;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.38);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.55;
}

body { position: relative; overflow-x: hidden; }

.backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(900px 600px at 12% -10%, rgba(79, 140, 255, 0.2), transparent 60%),
    radial-gradient(800px 500px at 100% 0%, rgba(124, 92, 255, 0.16), transparent 55%),
    linear-gradient(180deg, #08101e 0%, #060a12 60%, #05080e 100%);
}

a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
code { font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px clamp(18px, 4vw, 54px);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(7, 11, 20, 0.72);
}

.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 750; letter-spacing: -0.02em; }
.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 8px 24px rgba(79, 140, 255, 0.32);
  font-size: 17px;
}

.topbar-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.user-chip { color: var(--muted); font-size: 13px; }
.user-chip strong { color: var(--text); }

.lang-switch { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 2px; background: rgba(15, 23, 42, 0.6); }
.lang-switch a { padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; color: var(--muted); }
.lang-switch a.active { background: var(--panel-2); color: var(--text); box-shadow: 0 0 0 1px var(--line); }

.container { width: min(1120px, calc(100% - 36px)); margin: 0 auto; padding: 34px 0 80px; }

.eyebrow { text-transform: uppercase; letter-spacing: 0.16em; font-size: 11px; font-weight: 800; color: var(--accent); }
.lead { color: var(--muted); max-width: 62ch; }
.tiny { color: var(--muted-2); font-size: 12px; }
.muted { color: var(--muted); }
.hint { color: var(--muted-2); font-size: 12px; margin: 6px 0 0; }

h1 { font-size: clamp(32px, 4.6vw, 58px); line-height: 1.03; letter-spacing: -0.045em; margin: 10px 0 14px; }
h2 { font-size: 20px; letter-spacing: -0.02em; margin: 0; }
h3 { font-size: 16px; margin: 0; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--line);
  background: rgba(15, 23, 42, 0.7);
  color: var(--text);
  border-radius: 12px;
  padding: 9px 14px;
  cursor: pointer;
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); border-color: rgba(148, 163, 184, 0.34); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.btn-primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); border-color: transparent; box-shadow: 0 12px 30px rgba(79, 140, 255, 0.28); }
.btn-primary:hover { filter: brightness(1.06); }
.btn-ghost { background: transparent; }
.btn-danger { color: #ffd7dd; border-color: rgba(251, 113, 133, 0.32); background: rgba(251, 113, 133, 0.08); }
.btn-danger:hover { background: rgba(251, 113, 133, 0.14); }
.btn-lg { padding: 13px 20px; font-size: 16px; border-radius: 14px; }
.btn-small { padding: 6px 10px; font-size: 12px; border-radius: 9px; }

.icon-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  width: 32px;
  height: 32px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
}
.icon-btn:hover { color: var(--text); background: rgba(148, 163, 184, 0.1); }

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(300px, 0.7fr);
  gap: clamp(24px, 5vw, 72px);
  align-items: center;
  padding: clamp(20px, 5vw, 56px) 0 24px;
}
.hero h1 { max-width: 14ch; }
.hero-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 22px; }
.hf-logo {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.16);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: -0.04em;
}

.hero-card {
  background: linear-gradient(180deg, rgba(22, 32, 52, 0.92), rgba(10, 16, 28, 0.94));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
}
.hero-card-head { display: flex; align-items: center; gap: 9px; font-weight: 700; margin-bottom: 14px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 5px rgba(52, 211, 153, 0.12); }
.steps { margin: 0; padding-left: 18px; color: var(--muted); display: grid; gap: 8px; }
.steps li::marker { color: var(--accent); font-weight: 800; }
.endpoint-preview { margin-top: 18px; padding: 10px 12px; border: 1px dashed var(--line); border-radius: 10px; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }

.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 8px; }
.feature { padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: rgba(15, 23, 42, 0.46); }
.feature h3 { margin-bottom: 6px; }
.feature p { margin: 0; color: var(--muted); font-size: 13px; }

.page-head { display: flex; justify-content: space-between; gap: 18px; align-items: flex-end; margin-bottom: 20px; }
.page-head h1 { font-size: clamp(28px, 4vw, 42px); margin: 6px 0 8px; }
.head-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 18px; }
.stat { padding: 16px 18px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); }
.stat-label { display: block; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 8px; }
.stat-value { font-size: 22px; letter-spacing: -0.03em; }
.stat-value small { color: var(--muted); font-size: 13px; font-weight: 500; }
.stat-value.ok { color: var(--ok); font-size: 16px; }
.stat-value.bad { color: var(--bad); font-size: 16px; }
.endpoint-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.endpoint-row code { color: var(--text); font-size: 13px; overflow-wrap: anywhere; }

.notice { border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 12px; padding: 14px 16px; background: rgba(79, 140, 255, 0.08); margin: 14px 0; }
.notice.warning { border-left-color: var(--warn); background: rgba(251, 191, 36, 0.08); }
.notice p { margin: 6px 0 0; color: var(--muted); }
.notice-inline { padding: 10px 12px; border: 1px solid rgba(251, 191, 36, 0.28); background: rgba(251, 191, 36, 0.08); border-radius: 10px; color: #fde68a; font-size: 13px; }

.empty { text-align: center; padding: 58px 20px; border: 1px dashed var(--line); border-radius: var(--radius); background: rgba(15, 23, 42, 0.28); }
.empty-icon { font-size: 34px; color: var(--muted); }
.empty h2 { margin: 12px 0 6px; }
.empty p { color: var(--muted); margin: 0 0 18px; }

.bucket-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: 0 14px 40px rgba(0, 0, 0, 0.18); }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.bucket-name { font-size: 17px; overflow-wrap: anywhere; }
.badge { display: inline-block; margin-top: 6px; padding: 2px 8px; border-radius: 999px; background: rgba(52, 211, 153, 0.1); color: var(--ok); font-size: 11px; font-weight: 700; }
.meta { margin: 16px 0; display: grid; gap: 12px; }
.meta dt { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 4px; }
.meta dd { margin: 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.meta code { padding: 5px 8px; border: 1px solid var(--line); border-radius: 7px; background: rgba(2, 6, 16, 0.4); overflow-wrap: anywhere; }
.card-actions { display: flex; gap: 8px; justify-content: flex-end; border-top: 1px solid var(--line); padding-top: 14px; }

.help { margin-top: 34px; padding-top: 24px; border-top: 1px solid var(--line); }
.help-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-top: 14px; }
.help-grid div { padding: 12px; border: 1px solid var(--line); border-radius: 12px; color: var(--muted); font-size: 12px; background: rgba(15, 23, 42, 0.36); }
.help-grid span { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 7px; background: rgba(79, 140, 255, 0.14); color: var(--accent); font-weight: 800; margin-bottom: 8px; }

.modal { position: fixed; inset: 0; display: none; align-items: center; justify-content: center; z-index: 50; padding: 18px; }
.modal.open { display: flex; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(2, 6, 16, 0.72); backdrop-filter: blur(5px); }
.modal-card { position: relative; width: min(720px, 100%); max-height: min(86vh, 900px); overflow: auto; background: linear-gradient(180deg, #111a2b, #0a111e); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); }
.modal-card-small { width: min(560px, 100%); }
.modal-head, .modal-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px; }
.modal-head { border-bottom: 1px solid var(--line); }
.modal-foot { border-top: 1px solid var(--line); justify-content: flex-end; }
.modal-body { padding: 18px 20px; }
.available-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.available-list { display: grid; gap: 8px; max-height: 320px; overflow: auto; padding-right: 4px; }
.bucket-option { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 11px; background: rgba(15, 23, 42, 0.5); cursor: pointer; }
.bucket-option:hover { border-color: rgba(79, 140, 255, 0.45); }
.bucket-option input { accent-color: var(--accent); }
.bucket-option .grow { flex: 1; min-width: 0; }
.bucket-option .name { font-weight: 650; overflow-wrap: anywhere; }
.bucket-option .sub { color: var(--muted); font-size: 12px; }
.manual { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); display: grid; gap: 7px; }
.manual label { font-size: 13px; font-weight: 650; }
input[type="text"] { width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: rgba(2, 6, 16, 0.5); color: var(--text); outline: none; }
input[type="text"]:focus { border-color: rgba(79, 140, 255, 0.65); box-shadow: 0 0 0 3px rgba(79, 140, 255, 0.12); }
.credential { margin-top: 14px; }
.credential-label { display: block; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 5px; }
.credential-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.credential code { flex: 1; min-width: 0; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; background: rgba(2, 6, 16, 0.55); overflow-wrap: anywhere; }

.toast { position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; padding: 10px 16px; border-radius: 999px; border: 1px solid var(--line); background: #111a2b; color: var(--text); box-shadow: var(--shadow); transition: opacity 160ms ease, transform 160ms ease; z-index: 80; max-width: calc(100% - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { border-color: rgba(251, 113, 133, 0.5); color: #ffd7dd; }
.toast.ok { border-color: rgba(52, 211, 153, 0.4); }

.error-page { display: grid; place-items: center; min-height: 62vh; }
.error-card { max-width: 640px; padding: 28px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); box-shadow: var(--shadow); }

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; }
  .features { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr; }
  .help-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
  .topbar { padding: 14px 16px; }
  .container { width: min(100% - 24px, 1120px); padding-top: 24px; }
  .page-head { align-items: flex-start; flex-direction: column; }
  .bucket-grid { grid-template-columns: 1fr; }
  .help-grid { grid-template-columns: 1fr; }
  .modal-head, .modal-body, .modal-foot { padding-left: 16px; padding-right: 16px; }
}

/* Statistics */
.split {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 14px;
  margin-top: 14px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 18px;
  min-width: 0;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.legend { color: var(--muted); font-size: 12px; }
.legend-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin: 0 4px 0 10px; }
.legend-dot.in { background: var(--accent); }
.legend-dot.out { background: var(--accent-2); }

.chart { display: grid; gap: 6px; max-height: 420px; overflow: auto; padding-right: 4px; }
.chart-row { display: grid; grid-template-columns: 44px 1fr 80px; gap: 8px; align-items: center; font-size: 11px; }
.chart-day { color: var(--muted); }
.chart-bars { display: grid; gap: 2px; min-width: 0; }
.bar { display: block; height: 6px; border-radius: 999px; min-width: 0; }
.bar.in { background: linear-gradient(90deg, var(--accent), #7aa7ff); }
.bar.out { background: linear-gradient(90deg, var(--accent-2), #a78bfa); }
.chart-value { color: var(--muted); text-align: right; }

.op-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.op { border: 1px solid var(--line); border-radius: 12px; padding: 10px; background: rgba(2, 6, 16, 0.28); }
.op span { display: block; color: var(--muted); font-size: 11px; }
.op strong { font-size: 18px; }

.table-wrap { overflow: auto; max-height: 420px; }
.data-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.data-table th, .data-table td { padding: 7px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.data-table th { color: var(--muted); font-weight: 600; position: sticky; top: 0; background: #0d1524; }
.data-table td.path { max-width: 320px; overflow-wrap: anywhere; color: var(--muted); }
.data-table td.nowrap, .data-table th.nowrap { white-space: nowrap; }
.method { font-family: "SFMono-Regular", Consolas, monospace; font-size: 10px; padding: 2px 6px; border-radius: 6px; background: rgba(79, 140, 255, 0.12); color: #a9c4ff; }

@media (max-width: 900px) {
  .split { grid-template-columns: 1fr; }
  .op-grid { grid-template-columns: repeat(2, 1fr); }
}
