:root {
  --max-width: 1040px;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, sans-serif;
  line-height: 1.4;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0.75rem 1rem;
}

.topbar {
  border-bottom: 1px solid #e5e5e5;
}

.brand {
  font-weight: 700;
  margin-right: 1rem;
}

.nav a {
  margin-right: 0.75rem;
  text-decoration: none;
}

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

.table th,
.table td {
  padding: 0.45rem 0.5rem;
  border-bottom: 1px solid #eaeaea;
  text-align: left;
  vertical-align: top;
}

.form {
  max-width: 560px;
}

.form-row {
  margin-bottom: 0.75rem;
}

label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

input,
select,
textarea {
  width: 100%;
  padding: 0.45rem 0.5rem;
  box-sizing: border-box;
}

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

.btn {
  display: inline-block;
  padding: 0.35rem 0.6rem;
  border: 1px solid #ddd;
  border-radius: 8px;
  text-decoration: none;
  color: inherit;
}

.btn.primary {
  background: #111;
  border-color: #111;
  color: #fff;
}

.card {
  padding: 0.75rem 0.9rem;
  border: 1px solid #e5e5e5;
  border-radius: 10px;
  margin-bottom: 1rem;
}

.muted {
  opacity: 0.8;
}

.filters-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: flex-end;
}

.filters-row .field {
  flex: 1 1 180px;
  min-width: 160px;
}

.filters-row .field.checkbox {
  flex: 0 0 auto;
  min-width: 160px;
}

.filters-row .field.actions {
  flex: 0 0 auto;
}

.checkbox-inline {
  display: inline-flex;
  gap: 0.5rem;
  align-items: center;
  font-weight: 600;
}

.btn.small {
  padding: 0.25rem 0.5rem;
  border-radius: 8px;
}

.badge {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  border: 1px solid #ddd;
  border-radius: 999px;
  font-size: 0.85em;
  margin-left: 0.35rem;
}

.badge.overdue {
  border-color: #b00020;
  color: #b00020;
}

.row-overdue td {
  background: rgba(176, 0, 32, 0.04);
}

/* --- UI polish (screen only) ------------------------------------------ */
@media screen {
  :root {
    --bg: #f7f7f8;
    --card-bg: #fff;
    --border: #e6e6e6;
    --text: #111;
  }

  body {
    background: var(--bg);
    color: var(--text);
  }

  .topbar {
    background: #fff;
    position: sticky;
    top: 0;
    z-index: 10;
  }

  .topbar .container {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem 1rem;
  }

  .brand {
    font-size: 1.1rem;
  }

  .nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 0.5rem;
    align-items: center;
  }

  .nav a {
    padding: 0.25rem 0.4rem;
    border-radius: 8px;
  }

  .nav a:hover {
    background: rgba(0, 0, 0, 0.04);
  }

  .card {
    background: var(--card-bg);
    border-color: var(--border);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  }

  input,
  select,
  textarea {
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
  }

  .table tr:hover td {
    background: rgba(0, 0, 0, 0.02);
  }
}
