:root {
  --bg-color: #f4f7f9;
  --card-bg: #ffffff;
  --text-main: #333333;
  --text-muted: #666666;
  --primary: #007bff;
  --primary-hover: #0056b3;
  --danger: #dc3545;
  --danger-hover: #c82333;
  --secondary: #e2e8f0;
  --secondary-hover: #cbd5e1;
  --border: #e2e8f0;
}

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

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

.hidden { display: none !important; }

/* Views */
.view { min-height: 100vh; }
#login-container { display: flex; align-items: center; justify-content: center; }

.login-card { width: 100%; max-width: 400px; padding: 2rem; text-align: center; }
.login-card h2 { margin-bottom: 1.5rem; }

/* Navbar */
.navbar {
  display: flex; justify-content: space-between; align-items: center;
  background-color: var(--card-bg); padding: 1rem 2rem;
  border-bottom: 1px solid var(--border); box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.dashboard { padding: 2rem; max-width: 1400px; margin: 0 auto; display: flex; flex-direction: column; gap: 2rem; }

/* Cards */
.card {
  background-color: var(--card-bg); border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1); padding: 1.5rem;
}

.card-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 1rem; flex-wrap: wrap; gap: 1rem;
}

/* Forms & Inputs */
input[type="text"], input[type="password"], input[type="number"], select, textarea {
  width: 100%; padding: 0.5rem; margin-bottom: 1rem;
  border: 1px solid var(--border); border-radius: 4px; font-family: inherit;
}
input:focus, textarea:focus { outline: none; border-color: var(--primary); }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-grid input { margin-bottom: 0; }

.checkbox-label { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 1rem; cursor: pointer; }
.checkbox-label input { width: auto; margin: 0; }

label { display: block; font-size: 0.875rem; font-weight: 500; margin-bottom: 0.25rem; color: var(--text-muted); }

/* Buttons */
.btn {
  padding: 0.5rem 1rem; border: none; border-radius: 4px;
  font-weight: 500; cursor: pointer; transition: background-color 0.2s; font-size: 0.875rem;
}
.btn-primary { background-color: var(--primary); color: white; }
.btn-primary:hover { background-color: var(--primary-hover); }
.btn-secondary { background-color: var(--secondary); color: var(--text-main); }
.btn-secondary:hover { background-color: var(--secondary-hover); }
.btn-danger { background-color: var(--danger); color: white; }
.btn-danger:hover { background-color: var(--danger-hover); }

/* Tables */
.table-responsive { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 600px; }
th, td { padding: 0.75rem; text-align: left; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
th { background-color: #f8fafc; font-weight: 600; color: var(--text-muted); }
tbody tr:hover { background-color: #f8fafc; }
td .btn { padding: 0.25rem 0.5rem; font-size: 0.75rem; margin-right: 0.25rem; }

/* Modals (Native Dialog) */
dialog {
  margin: auto; padding: 1.5rem; border: none; border-radius: 8px;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
  width: calc(100% - 2rem);
  max-width: 560px;
}
dialog.wide { max-width: 1000px; }
dialog::backdrop { background: rgba(0, 0, 0, 0.5); }
dialog h3 { margin-bottom: 1rem; }
.modal-actions { display: flex; justify-content: flex-end; gap: 0.5rem; margin-top: 1rem; }

.error { color: var(--danger); font-size: 0.875rem; margin-top: 0.5rem; }
.summary { margin-top: 1rem; font-weight: bold; font-size: 1.1rem; text-align: right; }

/* Inline forms (used in Forced Domains and Profile Pricing) */
.inline-form {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}
.inline-form select,
.inline-form input { margin-bottom: 0; }
.inline-form select { flex: 1; min-width: 140px; }
.inline-form input[type="number"] { width: 130px; }
.inline-form button { white-space: nowrap; }

/* Domain lists */
.domain-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.domain-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid var(--border);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.85rem;
}
.domain-list li.muted { color: var(--text-muted); font-style: italic; }
.domain-list li:last-child { border-bottom: none; }
.domain-list li .btn { padding: 0.15rem 0.4rem; font-size: 0.7rem; }

/* Small helpers */
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.85rem; }
.muted { color: var(--text-muted); }
td .btn { margin-right: 0.25rem; }

/* Filter bars */
.filters {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.filters input,
.filters select { margin-bottom: 0; width: auto; }
.filters label {
  display: flex; align-items: center; gap: 0.4rem;
  margin: 0; font-size: 0.85rem; color: var(--text-muted);
}
.filters label input { margin-bottom: 0; }
.filters input[type="number"] { width: 90px; }
.filters input[type="text"]   { min-width: 160px; }

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.75rem;
}
.pagination span { font-size: 0.9rem; }
.pagination button[disabled] { opacity: 0.5; cursor: not-allowed; }

/* Paid/Unpaid badges */
.badge {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.badge-paid   { background: #d1fae5; color: #065f46; }
.badge-unpaid { background: #fee2e2; color: #991b1b; }