*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:       #0f0f1a;
  --surface:  #1a1a2e;
  --border:   #2a2a4e;
  --accent:   #7c83ff;
  --accent-h: #6670ee;
  --text:     #e0e0e0;
  --muted:    #777;
  --error:    #ff6b6b;
  --green:    #74c69d;
  --green-bg: #1e3a2f;
  --red-bg:   #3a2020;
}

html, body { height: 100%; font-family: system-ui, sans-serif; font-size: 14px; background: var(--bg); color: var(--text); }

.page { min-height: 100vh; }
.hidden { display: none !important; }

/* ── Login ───────────────────────────────────────────────── */
#panel-login { display: flex; align-items: center; justify-content: center; }

.login-card {
  width: 360px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 36px 32px;
  display: flex; flex-direction: column; gap: 14px;
}

h1 { font-size: 24px; color: var(--accent); }
.sub { color: var(--muted); font-size: 13px; }

/* ── Forms ───────────────────────────────────────────────── */
form { display: flex; flex-direction: column; gap: 8px; }
label { font-size: 12px; color: var(--muted); font-weight: 500; }

input[type="text"],
input[type="password"],
input[type="time"],
select {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  width: 100%;
  outline: none;
}
input:focus, select:focus { border-color: var(--accent); }

.error { font-size: 12px; color: var(--error); margin-top: 4px; }

/* ── Buttons ─────────────────────────────────────────────── */
button { cursor: pointer; border: none; border-radius: 6px; font-size: 13px; font-weight: 600; padding: 8px 16px; transition: background 0.15s; }
.btn-primary  { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-h); }
.btn-secondary { background: #2a2a4e; color: var(--text); }
.btn-secondary:hover { background: #353560; }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--text); }
.btn-sm { padding: 5px 12px; font-size: 12px; }
button:disabled { opacity: 0.5; cursor: default; }

/* ── Nav ─────────────────────────────────────────────────── */
nav {
  display: flex; align-items: center; gap: 8px;
  padding: 0 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  height: 52px;
}

.nav-brand { font-size: 16px; font-weight: 700; color: var(--accent); margin-right: 8px; }

.nav-tabs { display: flex; flex: 1; }
.nav-tab {
  background: transparent; color: var(--muted);
  border-radius: 0; border-bottom: 2px solid transparent;
  padding: 0 16px; height: 52px; font-size: 13px; font-weight: 500;
  margin-bottom: -1px;
}
.nav-tab:hover { color: var(--text); }
.nav-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ── Tab sections ────────────────────────────────────────── */
.tab-section { max-width: 900px; margin: 0 auto; padding: 24px; display: flex; flex-direction: column; gap: 20px; }

.section-header { display: flex; align-items: center; justify-content: space-between; }
.section-header h2 { font-size: 18px; font-weight: 600; }

/* ── Status bar ──────────────────────────────────────────── */
.status-bar {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 13px;
}
.badge {
  display: inline-block; padding: 2px 12px; border-radius: 12px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.3px;
}
.badge-blocking { background: var(--green-bg); color: var(--green); }
.badge-idle     { background: #1e1e3a; color: #888; }
.badge-bypassed { background: #3a2a3a; color: #e07ddc; }

/* ── Cards ───────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
}

.card-list { display: flex; flex-direction: column; gap: 10px; }

.group-card, .schedule-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
}

.group-card-info h3, .schedule-card-info h3 { font-size: 14px; font-weight: 600; margin-bottom: 6px; }

.tag-row { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.tag {
  display: inline-block; padding: 1px 8px; border-radius: 4px;
  font-size: 11px; font-family: monospace;
}
.tag-domain  { background: #1e2a4e; color: #9ab0ff; }
.tag-process { background: #2a1e3a; color: #c9a0ff; }

.card-actions { display: flex; gap: 6px; flex-shrink: 0; }
.btn-delete { background: transparent; color: var(--muted); font-size: 18px; padding: 2px 6px; line-height: 1; font-weight: 400; }
.btn-delete:hover { color: var(--error); background: transparent; }

/* ── Form card ───────────────────────────────────────────── */
.form-card { margin-top: 4px; }
.form-card h3 { font-size: 15px; margin-bottom: 14px; }
.form-actions { display: flex; gap: 8px; margin-top: 8px; }

/* ── Tag inputs ──────────────────────────────────────────── */
.tag-input-wrap {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px;
  background: var(--bg);
  display: flex; flex-direction: column; gap: 6px;
}
.tag-list { display: flex; flex-wrap: wrap; gap: 4px; min-height: 4px; }
.tag-removable { display: inline-flex; align-items: center; gap: 3px; }
.tag-removable button { background: transparent; color: inherit; opacity: 0.6; padding: 0 2px; font-size: 12px; font-weight: 400; border-radius: 2px; }
.tag-removable button:hover { opacity: 1; }
.tag-add-row { display: flex; gap: 6px; }
.tag-add-row input { flex: 1; }

/* ── Grid ────────────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.card h3 { font-size: 13px; font-weight: 600; margin-bottom: 10px; display: flex; align-items: center; gap: 6px; }
.count { font-size: 11px; background: var(--border); border-radius: 8px; padding: 1px 7px; color: var(--muted); }

.item-list { list-style: none; display: flex; flex-direction: column; gap: 4px; }
.item-list li { font-size: 12px; font-family: monospace; color: #aaa; padding: 3px 0; border-bottom: 1px solid #1e1e38; }
.item-list li:last-child { border-bottom: none; }
.empty-msg { font-size: 12px; color: var(--muted); font-style: italic; }

/* ── Time row ────────────────────────────────────────────── */
.time-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ── Day picker ──────────────────────────────────────────── */
.day-picker { display: flex; gap: 8px; flex-wrap: wrap; }
.day-check {
  display: flex; align-items: center; gap: 5px;
  padding: 5px 10px; border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  cursor: pointer; font-size: 12px; font-weight: 500;
  color: var(--muted);
  user-select: none;
}
.day-check:has(input:checked) { border-color: var(--accent); color: var(--accent); background: #1a1a3e; }
.day-check input { display: none; }

/* ── Schedule meta ───────────────────────────────────────── */
.sched-meta { font-size: 12px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 10px; margin-top: 4px; }
.sched-meta span { display: flex; align-items: center; gap: 4px; }
