:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --border: #e2e4e9;
  --text: #1b1e23;
  --muted: #666c76;
  --brand: #2f6fed;
  --brand-dark: #244fb0;
  --danger: #d1453b;
  --success: #1c7a4c;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand { display: flex; align-items: center; }

.brand-logo {
  height: 28px;
  width: auto;
  display: block;
}

.topbar nav a {
  margin-left: 18px;
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
}

.topbar nav a:hover { color: var(--brand); }

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 20px 60px;
}

.page-head h1 {
  font-size: 22px;
  margin: 0 0 16px;
}

.count-badge {
  display: inline-block;
  background: var(--brand);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 999px;
  vertical-align: middle;
  margin-left: 6px;
}

.alert {
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 14px;
}

.alert-error { background: #fbe9e7; color: var(--danger); }
.alert-success { background: #e5f5ec; color: var(--success); }

.auth-wrap {
  min-height: 80vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 32px;
  width: 100%;
  max-width: 360px;
}

.auth-card h1 { margin: 0 0 4px; font-size: 20px; }
.auth-card .subtitle { margin: 0 0 20px; color: var(--muted); font-size: 13px; }

.auth-card label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 14px;
}

.auth-card input {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
}

button, .btn-copy, .btn-danger {
  cursor: pointer;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
}

.auth-card button, .upload-card button {
  width: 100%;
  padding: 10px;
  background: var(--brand);
  color: #fff;
  margin-top: 6px;
}

.auth-card button:hover, .upload-card button:hover { background: var(--brand-dark); }

.upload-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 20px;
}

.file-label {
  flex: 1;
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  color: var(--muted);
}

.upload-card button { width: auto; padding: 10px 20px; }

.group { margin-bottom: 20px; }

.group-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 4px 6px 8px;
  font-size: 14px;
  font-weight: 600;
}

.group-count {
  color: var(--muted);
  font-weight: 400;
  font-size: 12px;
}

.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow-x: auto;
}

table { width: 100%; border-collapse: collapse; font-size: 13px; table-layout: fixed; }

th, td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}

th:nth-child(1), td.cell-name { width: 26%; word-break: break-all; }
th:nth-child(2) { width: 9%; }
th:nth-child(3) { width: 13%; }
th:nth-child(4) { width: 40%; }
th:nth-child(5), td.cell-actions { width: 12%; }

td:nth-child(2), td:nth-child(3) { white-space: nowrap; }

th { color: var(--muted); font-weight: 500; }

.empty { padding: 24px; color: var(--muted); font-size: 14px; }

.url-cell { display: flex; gap: 6px; align-items: center; }

.url-input {
  flex: 1;
  min-width: 0;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
  color: var(--muted);
}

.cell-actions { text-align: right; }

.btn-copy {
  background: var(--brand);
  color: #fff;
  padding: 6px 12px;
}

.btn-copy:hover { background: var(--brand-dark); }

.btn-danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger);
  padding: 6px 12px;
}

.btn-danger:hover { background: var(--danger); color: #fff; }
