:root {
  --bg: #f6f8f4;
  --panel: #ffffff;
  --text: #1c2a28;
  --muted: #5f6f6c;
  --line: #d7dfdd;
  --brand: #1f7a6d;
  --danger: #9a2f2f;
  --ok: #1f7a4a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 10% 5%, rgba(217, 124, 47, 0.12), transparent 35%),
    radial-gradient(circle at 80% 0%, rgba(31, 122, 109, 0.12), transparent 40%),
    var(--bg);
}

.shell {
  max-width: 1320px;
  margin: 0 auto;
  padding: 1rem 0.75rem;
  display: grid;
  gap: 1rem;
}

.topbar {
  background: linear-gradient(118deg, #0f5a51, #1f7a6d);
  color: #fff;
  padding: 1rem;
  border-radius: 14px;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
}

.eyebrow {
  margin: 0;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

h1,
h2,
h3,
p {
  margin: 0;
}

.subtitle {
  margin-top: 0.35rem;
  color: rgba(255, 255, 255, 0.92);
}

.auth-actions {
  display: flex;
  gap: 0.5rem;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1rem;
}

.inset {
  background: #fbfcfb;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.7rem;
}

.metric {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.65rem;
}

.metric .label {
  color: var(--muted);
  font-size: 0.78rem;
}

.metric .value {
  font-size: 1.35rem;
  font-weight: 700;
}

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

.station-split {
  align-items: start;
}

.admin-split {
  margin-top: 0.75rem;
}

.form-grid {
  display: grid;
  gap: 0.55rem;
  margin-top: 0.6rem;
}

.inline-group {
  margin-top: 0;
}

.field-hidden {
  display: none;
}

input,
select,
textarea,
button {
  font: inherit;
}

input,
select,
textarea {
  width: 100%;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 8px;
}

textarea {
  min-height: 72px;
  resize: vertical;
}

.btn {
  border: 0;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  padding: 0.58rem 0.85rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-ghost {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.8);
  color: #fff;
}

.btn-neutral {
  background: #ecefed;
  color: #1f2f2d;
}

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

.btn-small {
  padding: 0.4rem 0.65rem;
  font-size: 0.85rem;
}

.btn-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.actions-cell {
  display: flex;
  gap: 0.4rem;
}

.import-box {
  min-height: 130px;
}

.import-result {
  margin: 0.75rem 0 0;
  padding: 0.6rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f5f7f6;
  max-height: 220px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.muted {
  color: var(--muted);
  font-size: 0.9rem;
}

.admin-list-head {
  margin-top: 1rem;
}

.row-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.inline-controls {
  justify-content: flex-start;
  flex-wrap: wrap;
}

.inline-controls select {
  width: auto;
  min-width: 180px;
}

#statusMessage.error {
  color: var(--danger);
}

#statusMessage.success {
  color: var(--ok);
}

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

#adminToolsTable,
#userRolesTable,
#loanManagementTable {
  overflow-x: auto;
}

th,
td {
  text-align: left;
  padding: 0.55rem;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-size: 0.83rem;
}

#loanManagementTable input,
#loanManagementTable select {
  min-width: 90px;
  max-width: 170px;
}

#loanManagementTable th,
#loanManagementTable td {
  white-space: normal;
}

.low {
  color: var(--danger);
  font-weight: 700;
}

.stack {
  display: grid;
  gap: 0.5rem;
}

.item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.55rem;
}

.item small {
  color: var(--muted);
}

.notif-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
  margin-top: 0.6rem;
}

@media (max-width: 760px) {
  .topbar {
    flex-direction: column;
  }

  .row-head {
    flex-direction: column;
    align-items: stretch;
  }

  .actions-cell {
    flex-direction: column;
  }
}
