:root {
  --primary: #008fbe;
  --primary-dark: #00739a;
  --bg: #f5f7fb;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --shadow: 0 10px 30px rgba(2, 8, 23, 0.08);
  --radius: 16px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
}

.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 24px;
}

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

/* Top bar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

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

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 240px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  background: var(--primary);
  color: #fff;
  font-weight: 800;
  border-radius: 12px;
  box-shadow: 0 8px 18px rgba(0, 143, 190, 0.25);
}

.brand-title {
  font-weight: 800;
  line-height: 1.1;
}

.brand-subtitle {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 2px;
}

/* Nav */
.nav {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.nav-link {
  color: var(--text);
  font-weight: 600;
  font-size: 0.92rem;
  padding: 10px 12px;
  border-radius: 12px;
}

.nav-link:hover {
  background: rgba(2, 8, 23, 0.04);
  text-decoration: none;
}

/* Card */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  margin-top: 22px;
}

.card h1 {
  margin: 0 0 14px 0;
  font-size: 2rem;
  letter-spacing: -0.02em;
}

.card p { color: var(--muted); }

/* Buttons */
button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--primary);
  color: #fff;
  border: 0;
  border-radius: 12px;
  padding: 10px 14px;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: transform 0.04s ease, background 0.15s ease;
}

button:hover,
.button:hover {
  background: var(--primary-dark);
  text-decoration: none;
}

button:active,
.button:active {
  transform: translateY(1px);
}

.button.secondary {
  background: #fff;
  color: var(--text);
  border: 1px solid var(--border);
}

.button.secondary:hover {
  background: rgba(2, 8, 23, 0.03);
}

/* Forms */
form { margin-top: 14px; }
label {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 6px;
  font-weight: 600;
}

input, select {
  width: 100%;
  padding: 12px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  font-size: 0.95rem;
  background: #fff;
  outline: none;
}

input:focus, select:focus {
  border-color: rgba(0, 143, 190, 0.45);
  box-shadow: 0 0 0 4px rgba(0, 143, 190, 0.12);
}

.inline-form {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.inline-form input, .inline-form select {
  flex: 1;
  min-width: 220px;
}

.actions {
  display: flex;
  gap: 12px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

@media (max-width: 720px) {
  .container { padding: 16px; }
  .grid { grid-template-columns: 1fr; }
  .brand { min-width: auto; }
}

/* Table */
.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin-top: 16px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 14px;
}

.table thead th {
  text-align: left;
  font-size: 0.85rem;
  letter-spacing: 0.02em;
  color: var(--muted);
  background: #f8fafc;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}

.table tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 0.95rem;
}

.table tbody tr:hover {
  background: rgba(2, 8, 23, 0.02);
}

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

/* Status pill */
.pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 800;
  border: 1px solid var(--border);
  background: #fff;
}

/* Muted */
.muted { color: var(--muted); }

/* Alerts */
.alert {
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #f8fafc;
  color: var(--text);
  margin-bottom: 12px;
}

.alert.success { border-color: rgba(22,163,74,0.25); background: rgba(22,163,74,0.08); }
.alert.warning { border-color: rgba(217,119,6,0.25); background: rgba(217,119,6,0.08); }
.alert.error   { border-color: rgba(220,38,38,0.25); background: rgba(220,38,38,0.08); }

/* Footer */
.footer {
  margin-top: 28px;
  padding: 18px 0 10px 0;
  color: var(--muted);
  text-align: center;
  font-size: 0.9rem;
}

/* Link-like button */
.link-button {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  color: var(--primary);
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 700;
}
.link-button:hover { text-decoration: underline; }

/* Make tables fill available width nicely */
.table {
  table-layout: fixed;           /* key: distribute width across columns */
}

.table th, .table td {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Column sizing for invoices table */
.table th:nth-child(1), .table td:nth-child(1) { width: 16%; } /* Date */
.table th:nth-child(2), .table td:nth-child(2) { width: 22%; } /* Invoice */
.table th:nth-child(3), .table td:nth-child(3) { width: 18%; } /* Status */
.table th:nth-child(4), .table td:nth-child(4) { width: 14%; } /* Total */
.table th:nth-child(5), .table td:nth-child(5) { width: 14%; } /* Paid */
.table th:nth-child(6), .table td:nth-child(6) { width: 14%; } /* Due */
.table th:nth-child(7), .table td:nth-child(7) { width: 12%; } /* Action */

/* Right align numeric columns */
.table th:nth-child(4),
.table th:nth-child(5),
.table th:nth-child(6),
.table td:nth-child(4),
.table td:nth-child(5),
.table td:nth-child(6) {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Push the action column content to the right */
.table th:last-child,
.table td:last-child {
  text-align: right;
}

.table a.link {
  display: inline-flex;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  font-weight: 700;
  text-decoration: none;
  background: #fff;
}

.table a.link:hover {
  background: rgba(2, 8, 23, 0.03);
  text-decoration: none;
}
