:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --border: #e2e5ea;
  --text: #1f2430;
  --muted: #6b7280;
  --primary: #3b5bfd;
  --primary-hover: #2d47d6;
  --danger: #e5484d;
  --danger-hover: #c93d41;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(16, 24, 40, 0.08);
}

* { 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);
}

/* ---------- Login page ---------- */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 16px;
}

.login-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px 28px;
  width: 100%;
  max-width: 360px;
}

.login-card h1 {
  font-size: 20px;
  margin: 0 0 4px;
}

.login-card .subtitle {
  color: var(--muted);
  margin: 0 0 20px;
  font-size: 14px;
}

.login-card label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
}

.login-card input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 16px;
}

.login-card button {
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.login-card button:hover { background: var(--primary-hover); }

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

.alert-error {
  background: #fdecea;
  color: var(--danger);
}

/* ---------- App shell ---------- */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 12px;
}

.app-header h1 {
  font-size: 18px;
  margin: 0;
}

.app-header .actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

.btn:hover { background: var(--bg); }

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.btn-primary:hover { background: var(--primary-hover); }

.btn-danger { color: var(--danger); border-color: #f3c9ca; }
.btn-danger:hover { background: #fdecea; }

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

/* ---------- Filters ---------- */
.filters {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
  align-items: end;
}

.filters .field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
}

.filters select,
.filters input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
}

.filters .field.actions-field {
  display: flex;
  gap: 8px;
}

/* ---------- Table ---------- */
.table-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.table-scroll {
  overflow-x: auto;
}

table.enquiries {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 700px;
}

table.enquiries thead th {
  text-align: left;
  padding: 12px 14px;
  background: #fafbfc;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}

table.enquiries tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

table.enquiries tbody tr:hover { background: #fafbfc; }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: #eef0ff;
  color: var(--primary);
  font-size: 12px;
  font-weight: 600;
}

.field-list { margin: 0; padding: 0; list-style: none; }
.field-list li { margin-bottom: 2px; }
.field-list .k { color: var(--muted); margin-right: 4px; }

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
}

.icon-btn {
  border: none;
  background: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 13px;
}

.icon-btn:hover { color: var(--danger); }

/* ---------- Pagination ---------- */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px;
  font-size: 13px;
  color: var(--muted);
  flex-wrap: wrap;
  gap: 10px;
}

.pagination .controls { display: flex; gap: 6px; }

.pagination button {
  padding: 6px 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
}

.pagination button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 18, 25, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 50;
}

.modal {
  background: var(--surface);
  border-radius: var(--radius);
  max-width: 560px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  padding: 24px;
}

.modal h2 {
  margin: 0 0 4px;
  font-size: 16px;
}

.modal .meta {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 16px;
}

.modal table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.modal table td {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.modal table td.k {
  width: 35%;
  color: var(--muted);
  font-weight: 600;
  padding-right: 12px;
}

.modal-close {
  margin-top: 18px;
  text-align: right;
}

@media (max-width: 640px) {
  .app-header { padding: 14px 16px; }
  .container { padding: 16px 16px 40px; }
}
