/* ---------- Base ---------- */
:root {
  --bg: #0f1115;
  --panel: #171a21;
  --panel-2: #1f232c;
  --text: #e7e9ee;
  --muted: #8b93a3;
  --border: #2a2f3a;
  --accent: #5b8cff;
  --accent-hover: #6c9bff;
  --danger: #ff5a5a;
  --success: #38c77a;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
    Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { margin: 0 0 0.5em 0; font-weight: 600; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1rem; }

button { cursor: pointer; }

.muted { color: var(--muted); font-size: 0.9em; }
.error {
  background: rgba(255, 90, 90, 0.1);
  border: 1px solid rgba(255, 90, 90, 0.4);
  color: #ff9a9a;
  padding: 0.6rem 0.9rem;
  border-radius: 6px;
  margin-bottom: 1rem;
  font-size: 0.92rem;
}
.success {
  background: rgba(56, 199, 122, 0.1);
  border: 1px solid rgba(56, 199, 122, 0.4);
  color: #7de0ad;
  padding: 0.6rem 0.9rem;
  border-radius: 6px;
  margin-bottom: 1rem;
  font-size: 0.92rem;
}

/* ---------- Auth pages ---------- */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.75rem;
}
.auth-card label {
  display: block;
  margin-bottom: 0.9rem;
  font-size: 0.9rem;
  color: var(--muted);
}
.auth-card input {
  display: block;
  width: 100%;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.55rem 0.7rem;
  margin-top: 0.3rem;
  font-size: 0.95rem;
}
.auth-card input:focus {
  outline: none;
  border-color: var(--accent);
}
.auth-card button[type="submit"] {
  width: 100%;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 0.6rem;
  font-size: 0.95rem;
  font-weight: 500;
  transition: background 0.15s;
}
.auth-card button[type="submit"]:hover { background: var(--accent-hover); }

.auth-card p { margin-top: 1rem; text-align: center; }

/* ---------- Top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.8rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
}
.topbar h2 { margin: 0; }
.topbar .me { display: flex; align-items: center; gap: 0.8rem; font-size: 0.9rem; color: var(--muted); }

.ghost {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.35rem 0.7rem;
  font-size: 0.85rem;
}
.ghost:hover { background: var(--panel-2); text-decoration: none; }

/* ---------- Main container ---------- */
.container {
  max-width: 900px;
  margin: 1.5rem auto;
  padding: 0 1.5rem 3rem;
}
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
}
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

/* ---------- Aggregate link card ---------- */
.aggregate-link .muted { font-size: 0.85rem; margin-top: 0.25rem; }
.url-row {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
}
.url-row input[type="text"] {
  flex: 1;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.55rem 0.7rem;
  font-family: ui-monospace, "SF Mono", "Menlo", monospace;
  font-size: 0.85rem;
}
.url-row input[type="text"]:focus {
  outline: none;
  border-color: var(--accent);
}
.url-row button {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 0 1rem;
  font-size: 0.9rem;
}
.url-row button:hover { background: var(--accent-hover); }

.copy-ok { color: #7de0ad; }

.inline-form { margin-top: 0.75rem; }

/* ---------- Subscription form ---------- */
.row-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.row-form input {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.5rem 0.7rem;
  font-size: 0.9rem;
}
.row-form input[name="name"] { flex: 0 0 30%; min-width: 140px; }
.row-form input[name="url"]   { flex: 1 1 40%; min-width: 200px; }
.row-form input:focus { outline: none; border-color: var(--accent); }
.row-form button {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 0 1rem;
  font-size: 0.9rem;
}
.row-form button:hover { background: var(--accent-hover); }

.empty { padding: 1rem 0; text-align: center; }

.sub-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.sub-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--border);
}
.sub-list li:last-child { border-bottom: none; }
.sub-info { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; flex: 1; margin-right: 1rem; }
.sub-info strong { font-size: 0.95rem; }
.sub-info .url {
  font-family: ui-monospace, "SF Mono", "Menlo", monospace;
  font-size: 0.82rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sub-info .date { font-size: 0.78rem; color: var(--muted); }

.delete-btn { color: var(--danger); border-color: rgba(255, 90, 90, 0.3); }
.delete-btn:hover { background: rgba(255, 90, 90, 0.08); }

/* ---------- Responsive ---------- */
@media (max-width: 600px) {
  .row-form input { flex: 1 1 100%; }
  .topbar { flex-direction: column; gap: 0.5rem; align-items: flex-start; }
}
