:root {
  --navy-deep: #031D28;
  --navy: #0F2438;
  --surface: #132D40;
  --teal: #206277;
  --cyan: #2BD7CF;
  --skyblue: #6EC1E4;
  --white: #FFFFFF;
  --slate: #93AAB8;
  --red: #E05252;
  --amber: #E0A952;
  --green: #4CC38A;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--navy-deep);
  color: var(--white);
  font-size: 1rem;
  line-height: 1.5;
}

a { color: var(--skyblue); text-decoration: none; }
a:hover { text-decoration: underline; }

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem;
}

/* --- Top nav --- */
.topnav {
  background: var(--navy);
  border-bottom: 1px solid var(--surface);
}
.topnav .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 1rem;
  padding-bottom: 1rem;
  flex-wrap: wrap;
  gap: 1rem;
}
.topnav .brand {
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--white);
}
.topnav nav a {
  color: var(--slate);
  margin-right: 1.25rem;
  font-weight: 500;
}
.topnav nav a.active,
.topnav nav a:hover {
  color: var(--cyan);
  text-decoration: none;
}
.topnav .user {
  color: var(--slate);
  font-size: 0.9rem;
}

/* --- Cards --- */
.card {
  background: var(--surface);
  border: 1px solid var(--teal);
  border-radius: 14px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.stat-card {
  background: var(--surface);
  border-radius: 14px;
  padding: 1.25rem;
  border: 1px solid var(--teal);
}
.stat-card .value {
  font-size: 2.1rem;
  font-weight: 700;
  color: var(--cyan);
}
.stat-card .label {
  color: var(--slate);
  font-size: 0.9rem;
  margin-top: 0.25rem;
}

/* --- Page heading row --- */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.page-header h1 { margin: 0; font-size: 1.5rem; }

/* --- Buttons --- */
.btn {
  display: inline-block;
  background: var(--cyan);
  color: var(--navy-deep);
  border: none;
  border-radius: 14px;
  padding: 0.7rem 1.1rem;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { opacity: 0.9; text-decoration: none; }
.btn-secondary {
  background: transparent;
  color: var(--skyblue);
  border: 1px solid var(--teal);
}
.btn-danger {
  background: var(--red);
  color: var(--white);
}
.btn-sm { padding: 0.4rem 0.75rem; font-size: 0.85rem; }

/* --- Forms --- */
label {
  display: block;
  font-size: 0.85rem;
  color: var(--slate);
  margin-bottom: 0.35rem;
  margin-top: 1rem;
}
label:first-child { margin-top: 0; }
input[type=text], input[type=email], input[type=password],
input[type=number], input[type=date], select, textarea {
  width: 100%;
  padding: 0.65rem 0.8rem;
  border-radius: 10px;
  border: 1px solid var(--teal);
  background: var(--navy);
  color: var(--white);
  font-family: var(--font);
  font-size: 0.95rem;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--cyan);
}
textarea { resize: vertical; min-height: 80px; }
.form-actions { margin-top: 1.5rem; display: flex; gap: 0.75rem; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 640px) { .field-row { grid-template-columns: 1fr; } }

/* --- Table --- */
table { width: 100%; border-collapse: collapse; }
th, td {
  text-align: left;
  padding: 0.75rem;
  border-bottom: 1px solid var(--teal);
  font-size: 0.92rem;
}
th { color: var(--slate); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em; }
tr:last-child td { border-bottom: none; }

/* --- Status badges --- */
.badge {
  display: inline-block;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
}
.status-active { background: rgba(76,195,138,0.15); color: var(--green); }
.status-warning { background: rgba(224,169,82,0.15); color: var(--amber); }
.status-expired { background: rgba(224,82,82,0.15); color: var(--red); }
.status-inactive { background: rgba(147,170,184,0.15); color: var(--slate); }

/* --- Alerts / flash messages --- */
.alert {
  border-radius: 10px;
  padding: 0.85rem 1rem;
  margin-bottom: 1.25rem;
  font-size: 0.92rem;
}
.alert-success { background: rgba(76,195,138,0.15); color: var(--green); border: 1px solid var(--green); }
.alert-error { background: rgba(224,82,82,0.15); color: var(--red); border: 1px solid var(--red); }

/* --- Login / install --- */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}
.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--teal);
  border-radius: 14px;
  padding: 2rem;
}
.auth-card h1 {
  font-size: 1.3rem;
  margin-top: 0;
  margin-bottom: 1.5rem;
  text-align: center;
}

.text-muted { color: var(--slate); }
.mt-0 { margin-top: 0; }
.help-text { font-size: 0.8rem; color: var(--slate); margin-top: 0.35rem; }

.empty-state {
  text-align: center;
  color: var(--slate);
  padding: 2rem;
}
