/* ──────────────────────────────────────────────
   XPR — Design System
   Pure minimalism · Dark palette · Inter font
   ────────────────────────────────────────────── */

/* ── Fonts ─────────────────────────────────── */
@font-face {
  font-family: 'Inter';
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  src: url('/fonts/Inter_18pt-Regular.ttf') format('truetype');
}
@font-face {
  font-family: 'Inter';
  font-weight: 500;
  font-style: normal;
  font-display: swap;
  src: url('/fonts/Inter_18pt-Medium.ttf') format('truetype');
}
@font-face {
  font-family: 'Inter';
  font-weight: 600;
  font-style: normal;
  font-display: swap;
  src: url('/fonts/Inter_18pt-SemiBold.ttf') format('truetype');
}
@font-face {
  font-family: 'Inter';
  font-weight: 700;
  font-style: normal;
  font-display: swap;
  src: url('/fonts/Inter_18pt-Bold.ttf') format('truetype');
}

/* ── Tokens ────────────────────────────────── */
:root {
  --bg:          #0d1015;
  --surface:     #171d26;
  --surface-2:   #252c38;
  --accent:      #6C7C9A;
  --accent-dim:  rgba(108, 124, 154, .12);
  --text:        #c8cdd6;
  --text-muted:  #6a7183;
  --text-bright: #e4e7ec;
  --danger:      #c45c5c;
  --success:     #4a9a6a;
  --border:      rgba(108, 124, 154, .12);
  --radius:      6px;
  --radius-lg:   10px;
  --mono:        ui-monospace, 'SF Mono', 'Cascadia Code', monospace;
}

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

html {
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  min-height: 100vh;
}

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

/* ── Layout ────────────────────────────────── */
.page-wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ── Header / Navbar ───────────────────────── */
header {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2.5rem;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: .6rem;
  text-decoration: none;
  color: var(--text-bright);
}

.header-brand img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  opacity: .85;
}

.header-brand span {
  font-weight: 600;
  font-size: .95rem;
  letter-spacing: .04em;
  text-transform: uppercase;
}

header nav {
  display: flex;
  gap: .75rem;
  margin-left: auto;
  align-items: center;
}

header nav a {
  font-size: .82rem;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: .02em;
  padding: .35rem .65rem;
  border-radius: var(--radius);
  transition: color .15s ease;
}
header nav a:hover {
  color: var(--text-bright);
}

.nav-user {
  font-size: .82rem;
  color: var(--text-muted);
  font-weight: 400;
}

/* ── Main ──────────────────────────────────── */
main {
  padding-bottom: 3rem;
}

main h1 {
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--text-bright);
  margin-bottom: 1.25rem;
  letter-spacing: -.01em;
}

main p {
  color: var(--text);
  font-size: .92rem;
  line-height: 1.6;
}

main p a {
  font-weight: 500;
}

/* ── Auth Card (login/register) ────────────── */
.auth-layout {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 120px);
}

.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.25rem 2rem;
}

.auth-card .auth-logo {
  display: flex;
  justify-content: center;
  margin-bottom: 1.5rem;
}

.auth-card .auth-logo img {
  width: 44px;
  height: 44px;
  object-fit: contain;
  opacity: .7;
}

.auth-card h1 {
  font-size: 1.1rem;
  text-align: center;
  margin-bottom: 1.5rem;
  font-weight: 600;
  color: var(--text-bright);
}

/* ── Forms ─────────────────────────────────── */
form {
  display: flex;
  flex-direction: column;
  gap: .9rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: .35rem;
}

.field label {
  font-size: .78rem;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: .03em;
  text-transform: uppercase;
}

input[type="text"],
input[type="email"],
input[type="password"] {
  width: 100%;
  padding: .6rem .75rem;
  background: var(--bg);
  color: var(--text-bright);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: .88rem;
  outline: none;
  transition: border-color .15s ease;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus {
  border-color: var(--accent);
}

input::placeholder {
  color: var(--text-muted);
  opacity: .6;
}

/* ── Buttons ───────────────────────────────── */
button,
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  padding: .6rem 1.15rem;
  background: var(--surface-2);
  color: var(--text-bright);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: .85rem;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}

button:hover,
.btn:hover {
  background: var(--accent-dim);
  border-color: var(--accent);
}

/* Primary variant */
button.primary,
.btn-primary {
  background: var(--surface-2);
  border-color: var(--accent);
  color: var(--text-bright);
}
button.primary:hover,
.btn-primary:hover {
  background: rgba(108, 124, 154, .18);
}

/* Small inline form buttons (logout etc) */
.btn-inline {
  padding: .3rem .65rem;
  font-size: .78rem;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.btn-inline:hover {
  color: var(--text-bright);
  border-color: var(--accent);
}

/* ── Errors / Flash ────────────────────────── */
.error {
  font-size: .84rem;
  color: var(--danger);
  background: rgba(196, 92, 92, .08);
  border: 1px solid rgba(196, 92, 92, .18);
  border-radius: var(--radius);
  padding: .55rem .75rem;
  margin-bottom: .25rem;
}

.flash {
  font-size: .84rem;
  color: var(--success);
  background: rgba(74, 154, 106, .08);
  border: 1px solid rgba(74, 154, 106, .18);
  border-radius: var(--radius);
  padding: .55rem .75rem;
  margin-bottom: 1rem;
}

/* ── Muted / Utility ──────────────────────── */
.muted {
  color: var(--text-muted);
  font-size: .85rem;
}

.mono {
  font-family: var(--mono);
  font-size: .82rem;
  color: var(--text-muted);
}

code {
  font-family: var(--mono);
  font-size: .82rem;
  background: var(--surface);
  color: var(--accent);
  padding: .15em .35em;
  border-radius: 3px;
}

/* ── Admin ─────────────────────────────────── */
main.admin {
  max-width: 960px;
}

.admin h2 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-bright);
  margin-top: 2rem;
  margin-bottom: .75rem;
  padding-bottom: .5rem;
  border-bottom: 1px solid var(--border);
}

.admin-form {
  display: block;
  max-width: none;
}

/* ── Tables ────────────────────────────────── */
.admin-table {
  width: 100%;
  border-collapse: collapse;
  margin: .75rem 0 1.5rem;
}

.admin-table th,
.admin-table td {
  padding: .55rem .75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.admin-table th {
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  background: var(--surface);
}

.admin-table td {
  font-size: .87rem;
}

.admin-table tr:last-child td {
  border-bottom: none;
}

.admin-table .mono {
  font-family: var(--mono);
  font-size: .8rem;
  color: var(--text-muted);
}

/* Checkbox styling */
.admin-table input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--bg);
  cursor: pointer;
  position: relative;
  transition: border-color .15s ease, background .15s ease;
}

.admin-table input[type="checkbox"]:checked {
  background: var(--accent);
  border-color: var(--accent);
}

.admin-table input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 5px;
  width: 4px;
  height: 8px;
  border: solid var(--bg);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.admin-table input[type="checkbox"]:hover {
  border-color: var(--accent);
}

/* Select styling */
.admin-table select {
  padding: .4rem .6rem;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: .84rem;
  min-width: 14rem;
  outline: none;
  cursor: pointer;
  transition: border-color .15s ease;
}

.admin-table select:focus,
.admin-table select:hover {
  border-color: var(--accent);
}

.admin-form > button {
  margin-top: 1rem;
}

/* ── Home Layout ───────────────────────────── */
.home-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 3rem 0 2rem;
}

.home-hero img {
  width: 64px;
  height: 64px;
  object-fit: contain;
  opacity: .6;
  margin-bottom: 1.25rem;
}

.home-hero h1 {
  margin-bottom: .6rem;
}

.home-hero p {
  max-width: 420px;
}

.home-links {
  display: flex;
  gap: .6rem;
  justify-content: center;
  margin-top: 1.5rem;
}

.home-links a {
  font-size: .84rem;
  font-weight: 500;
  padding: .5rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  transition: color .15s ease, border-color .15s ease;
}
.home-links a:hover {
  color: var(--text-bright);
  border-color: var(--accent);
}

/* Auth footer link */
.auth-footer {
  text-align: center;
  margin-top: 1.25rem;
  font-size: .82rem;
  color: var(--text-muted);
}

.auth-footer a {
  color: var(--accent);
  font-weight: 500;
}
.auth-footer a:hover {
  color: var(--text-bright);
}

/* ── Upload form ───────────────────────────── */
.upload-form input[type="file"] {
  width: 100%;
  padding: .5rem .6rem;
  background: var(--bg);
  color: var(--text);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: .85rem;
  cursor: pointer;
  transition: border-color .15s ease;
}
.upload-form input[type="file"]:hover {
  border-color: var(--accent);
}
.upload-form input[type="file"]::file-selector-button {
  margin-right: .75rem;
  padding: .35rem .75rem;
  background: var(--surface-2);
  color: var(--text-bright);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: .8rem;
  cursor: pointer;
}
.upload-form input[type="file"]::file-selector-button:hover {
  background: var(--accent-dim);
  border-color: var(--accent);
}

/* ── Status badge (pending/declined/queued/etc.) ── */
.badge {
  display: inline-block;
  padding: .15rem .5rem;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  border: 1px solid var(--border);
  color: var(--text-muted);
  background: var(--surface);
}
.badge-pending {
  color: #d4a64a;
  border-color: rgba(212, 166, 74, .35);
  background: rgba(212, 166, 74, .08);
}
.badge-accepted {
  color: var(--success);
  border-color: rgba(74, 154, 106, .35);
  background: rgba(74, 154, 106, .08);
}
.badge-declined,
.badge-failed {
  color: var(--danger);
  border-color: rgba(196, 92, 92, .35);
  background: rgba(196, 92, 92, .08);
}
.badge-queued,
.badge-in_progress {
  color: var(--accent);
  border-color: rgba(108, 124, 154, .35);
  background: var(--accent-dim);
}

/* ── Responsive ────────────────────────────── */
@media (max-width: 600px) {
  html { font-size: 14px; }
  .auth-card { padding: 1.75rem 1.25rem; }
  header { flex-wrap: wrap; gap: .75rem; }
}

/* ── Scrollbar ─────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--surface-2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ── Selection ─────────────────────────────── */
::selection {
  background: rgba(108, 124, 154, .3);
  color: var(--text-bright);
}
