:root {
  --bg: #f4f7fb;
  --card: #ffffff;
  --text: #1e293b;
  --muted: #64748b;
  --accent: #0f6dca;
  --danger: #b91c1c;
  --warn: #b45309;
  --border: #d9e2ef;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Plus Jakarta Sans", "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  color: var(--text);
  background: radial-gradient(circle at top right, #dbeafe 0%, transparent 34%),
    linear-gradient(180deg, #eef3fb 0%, var(--bg) 56%);
}

.container {
  width: min(1320px, 95vw);
  margin: 0 auto;
}

.topbar {
  background: linear-gradient(90deg, #0f172a, #1e293b);
  color: #fff;
  border-bottom: 3px solid #3b82f6;
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
}

.topbar nav {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.topbar a,
.btn-link {
  color: #dbeafe;
  text-decoration: none;
  font-size: 14px;
  background: none;
  border: none;
  cursor: pointer;
}

main {
  padding: 20px 0 32px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.05);
}

.dashboard-hero {
  background: linear-gradient(140deg, #0f172a 0%, #1d4ed8 95%);
  color: #f8fafc;
  border-color: #1d4ed8;
}

.dashboard-hero h2,
.dashboard-hero p {
  margin: 0;
}

.dashboard-hero p {
  margin-top: 6px;
  color: #dbeafe;
}

.dashboard-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.muted {
  color: var(--muted);
  font-size: 13px;
}

.narrow {
  max-width: 460px;
}

.form-grid {
  display: grid;
  gap: 10px;
}

.three-col {
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

label {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 2px;
  display: block;
}

input,
select,
button {
  font: inherit;
}

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

.checkline {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.checkline input {
  width: auto;
}

.btn {
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 8px 12px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-weight: 600;
}

.btn.small {
  padding: 6px 10px;
  font-size: 13px;
}

.btn.warn {
  background: var(--warn);
}

.btn.danger {
  background: var(--danger);
}

table {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
}

thead th {
  background: #eef4ff;
  color: #334155;
}

th,
td {
  border-bottom: 1px solid var(--border);
  padding: 10px 8px;
  vertical-align: top;
  text-align: left;
  font-size: 14px;
}

pre {
  margin: 0;
  white-space: pre-wrap;
  max-width: 540px;
  color: #0f172a;
}

.inline-form {
  display: inline-block;
  margin-right: 6px;
  margin-bottom: 6px;
}

.bulk-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.inline-reset-form,
.inline-note-form {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

.inline-reset-form input,
.inline-note-form input {
  width: 180px;
}

.flash-wrap {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.flash {
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 14px;
}

.flash.success {
  background: #dcfce7;
  color: #166534;
}

.flash.error {
  background: #fee2e2;
  color: #991b1b;
}

.hidden {
  display: none !important;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 16px;
}

.modal-overlay[aria-hidden="false"] {
  display: flex;
}

.modal-card {
  width: min(520px, 95vw);
  background: #fff;
  border-radius: 14px;
  padding: 18px;
  border: 1px solid var(--border);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
}

.modal-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.modal-head h3 {
  margin: 0;
}

.modal-close-link {
  color: #0f172a;
}

.modal-target {
  margin-top: 10px;
  font-weight: 600;
}

.modal-actions {
  display: flex;
  gap: 8px;
  margin: 10px 0;
  flex-wrap: wrap;
}

.modal-expiry {
  margin: 6px 0;
  font-size: 13px;
  color: #334155;
}

.modal-status {
  margin: 8px 0 0;
  color: #166534;
}

.modal-status.error {
  color: #991b1b;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.status-pill.pending {
  background: #fff7ed;
  color: #9a3412;
}

.status-pill.approved {
  background: #dcfce7;
  color: #166534;
}

.status-pill.rejected {
  background: #fee2e2;
  color: #991b1b;
}

.status-pill.expired {
  background: #e2e8f0;
  color: #334155;
}

.modal-open {
  overflow: hidden;
}

@media (max-width: 900px) {
  .topbar-inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .inline-reset-form,
  .inline-note-form {
    display: grid;
    margin-top: 8px;
  }

  .inline-reset-form input,
  .inline-note-form input {
    width: 100%;
  }

  pre {
    max-width: 100%;
  }
}
