:root {
  --primary: #3adcc9;
  --accent: #f0f4ff;
  --bg: #f7f9fc;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #d1d5db;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
               Roboto, Oxygen, Ubuntu, Cantarell, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
}

/* -------------------------
   Layout
------------------------- */

.topbar {
  background: var(--primary);
  color: #fff;
}

.topbar-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #fff;
  text-decoration: none;
}

.brand-logo {
  height: 32px;
}

.brand-name {
  font-weight: 600;
}

.nav {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.nav-link {
  color: #fff;
  text-decoration: none;
  font-size: 0.95rem;
}

.nav-link:hover {
  text-decoration: underline;
}

.nav-user {
  font-size: 0.85rem;
  opacity: 0.9;
}

/* -------------------------
   Main content
------------------------- */

.container {
  max-width: 1100px;
  margin: 2rem auto;
  padding: 0 1rem;
}

h1, h2, h3 {
  margin-top: 0;
}

.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

/* Optional: Card variants */
.card-accent {
  background: var(--accent);
  border: 1px solid var(--border);
}

/* Muted helper text */
.muted {
  color: var(--muted);
}

/* -------------------------
   Dashboard / Send-Receive cards
------------------------- */

.mode-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.mode-card-link {
  text-decoration: none;
}

.mode-card {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem;
  background: var(--accent);
}

.mode-card h3 {
  margin: 0 0 0.25rem 0;
}

.mode-card p {
  margin: 0;
  color: var(--muted);
}

/* -------------------------
   Buttons & forms
------------------------- */

button,
input[type="submit"] {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 0.5rem 0.9rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
}

button.secondary {
  background: var(--muted);
}

button:hover,
input[type="submit"]:hover {
  opacity: 0.9;
}

input[type="text"],
input[type="password"],
input[type="number"],
select {
  width: 100%;
  padding: 0.45rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  margin-bottom: 0.75rem;
  background: #fff;
  color: var(--text);
}

/* File input should match other controls more closely */
input[type="file"] {
  width: 100%;
  padding: 0.45rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #fff;
  color: var(--text);
}

/* Upload form layout (Files > Send) */
.upload-grid {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 0.75rem;
  align-items: end;
  max-width: 720px;
}

.upload-grid label {
  display: block;
  margin-bottom: 0.25rem;
}

/* Put the submit in the last column */
.upload-actions {
  align-self: end;
}

@media (max-width: 640px) {
  .upload-grid {
    grid-template-columns: 1fr;
  }
}

/* -------------------------
   Tables / file lists
------------------------- */

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  padding: 0.6rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

th {
  font-size: 0.85rem;
  color: var(--muted);
  text-transform: uppercase;
}

/* Actions column: keep buttons aligned and compact */
.actions {
  white-space: nowrap;
}

.actions form {
  display: inline-block;
  margin: 0;
  vertical-align: middle;
}

.actions input[type="submit"] {
  padding: 0.35rem 0.7rem;
  font-size: 0.85rem;
}

/* Divider between action buttons (instead of raw pipes in HTML) */
.actions .divider {
  display: inline-block;
  margin: 0 0.4rem;
  color: var(--muted);
}

/* -------------------------
   Messages
------------------------- */

.alert {
  padding: 0.75rem;
  border-radius: 4px;
  margin-bottom: 1rem;
}

.alert-error {
  background: #fee2e2;
  color: #991b1b;
}

.alert-success {
  background: #dcfce7;
  color: #166534;
}

/* -------------------------
   Footer
------------------------- */

.footer {
  border-top: 1px solid var(--border);
  margin-top: 3rem;
  padding: 1rem 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.footer-inner {
  display: flex;
  justify-content: center;
}

/* -------------------------
   Dashboard shared helpers
   (used by dashboard.html + admin_dash.html)
------------------------- */

.card-muted {
  color: var(--muted);
  margin-top: 0;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
}

.stat-box {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem;
}

.stat-box.muted-border {
  border-color: var(--muted);
}

.stat-header {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: baseline;
}

.stat-sub {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.chart-box {
  margin-top: 1rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem;
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem;
}

.chart {
  margin-top: 0.75rem;
}

.scope-buttons {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin: 0.75rem 0 0.25rem 0;
}

.scope-hint {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.word-break {
  word-break: break-word;
}

/* Dashboard layout: 2/3 + 1/3 row */
.dash-row {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1rem;
  align-items: start;
}

/* Stack on smaller screens */
@media (max-width: 900px) {
  .dash-row {
    grid-template-columns: 1fr;
  }
}

/* Quota progress bar */
.quota-progress {
  height: 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 0.5rem;
  background: transparent;
}

.quota-progress > span {
  display: block;
  height: 100%;
  width: var(--pct, 0%);
  background: var(--border);
}
