:root {
  --bg: #f4f8fb;
  --panel: #ffffffcc;
  --panel-solid: #ffffff;
  --text: #10202b;
  --muted: #5d6c77;
  --line: #d8e3ea;
  --brand: #0f766e;
  --brand-2: #0ea5a0;
  --brand-3: #164e63;
  --danger: #dc2626;
  --ok: #047857;
  --radius: 16px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  color: var(--text);
  font-family: "Manrope", "Segoe UI", sans-serif;
  background:
    radial-gradient(1200px 600px at 10% -10%, #d5f4ee 0%, transparent 60%),
    radial-gradient(1000px 550px at 100% 0%, #dbeaf7 0%, transparent 60%),
    var(--bg);
}

.page {
  max-width: 980px;
  margin: 28px auto;
  padding: 0 14px;
}

.shell {
  background: var(--panel);
  backdrop-filter: blur(8px);
  border: 1px solid #ffffff99;
  border-radius: var(--radius);
  box-shadow: 0 18px 50px rgba(16, 32, 43, 0.12);
  overflow: hidden;
  animation: fadeUp 0.45s ease;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 18px 20px;
  background: linear-gradient(135deg, var(--brand-3), var(--brand));
  color: #fff;
}

.brand {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.2px;
}

.nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.nav a {
  text-decoration: none;
  color: #e6f8f6;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid #ffffff44;
  font-weight: 700;
  font-size: 14px;
}

.nav a.active {
  background: #ffffff;
  color: var(--brand-3);
  border-color: #ffffff;
}

.content {
  padding: 20px;
}

h1 {
  margin: 0 0 8px;
  font-size: 28px;
  line-height: 1.15;
}

.muted {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.card {
  background: var(--panel-solid);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  margin-top: 14px;
  overflow: hidden;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.row {
  margin-bottom: 10px;
  min-width: 0;
}

label {
  display: block;
  margin-bottom: 5px;
  font-size: 13px;
  color: var(--muted);
  font-weight: 700;
}

input {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0 12px;
  font-family: inherit;
  font-size: 16px;
  background: #fdfefe;
  color: var(--text);
}

select {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0 12px;
  font-family: inherit;
  font-size: 16px;
  background: #fdfefe;
  color: var(--text);
}

input:focus {
  outline: none;
  border-color: var(--brand-2);
  box-shadow: 0 0 0 4px #0ea5a01a;
}

select:focus {
  outline: none;
  border-color: var(--brand-2);
  box-shadow: 0 0 0 4px #0ea5a01a;
}

.input-error {
  border-color: #dc2626 !important;
  box-shadow: 0 0 0 3px #dc262622 !important;
}

.field-error {
  min-height: 16px;
  margin-top: 4px;
  color: #dc2626;
  font-size: 12px;
  font-weight: 700;
}
.field-error:empty {
  display: none;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
  overflow: hidden;
  border-radius: 12px;
}

#items {
  min-width: 760px;
}

thead th {
  text-align: left;
  font-size: 12px;
  color: var(--muted);
  background: #f7fbfc;
  border-bottom: 1px solid var(--line);
  padding: 10px;
}

tbody td {
  border-bottom: 1px solid #eef3f6;
  padding: 10px;
}

button {
  border: 0;
  border-radius: 10px;
  padding: 10px 16px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.15s ease;
}

.btn-secondary {
  background: #eef6f6;
  color: #0f766e;
  border: 1px solid #b7d9d6;
  font-weight: 700;
}

.btn-secondary:hover {
  filter: none;
  background: #e2f1ef;
}

.btn-danger {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
  font-weight: 700;
}

.btn-danger:hover {
  filter: none;
  background: #fecaca;
}

button:hover {
  transform: translateY(-1px);
  filter: brightness(1.03);
}

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

.filters {
  margin-top: 10px;
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr auto auto;
  gap: 8px;
}

.invoice-link {
  color: var(--brand-3);
  font-weight: 700;
  text-decoration: none;
}

.list {
  list-style: none;
  padding: 0;
  margin: 10px 0 0;
  display: grid;
  gap: 8px;
}

.list a {
  display: block;
  text-decoration: none;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  background: #fff;
}

.list-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

.list-actions {
  display: flex;
  gap: 6px;
}

.pagination {
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.pagination input {
  width: 86px;
  height: 36px;
}

.status {
  margin-top: 10px;
  font-size: 14px;
}

.status.ok {
  color: var(--ok);
}

.status.err {
  color: var(--danger);
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 760px) {
  body {
    overflow-x: hidden;
  }
  .page {
    margin: 10px auto;
    padding: 0 8px;
  }
  .shell {
    border-radius: 12px;
  }
  .content {
    padding: 12px;
  }
  .grid-2 {
    grid-template-columns: 1fr;
  }
  .row {
    margin-bottom: 8px;
  }
  .row-due-date {
    margin-top: 12px;
    margin-bottom: 14px;
  }
  .row-rent-from,
  .row-rent-to {
    margin-top: 0;
    margin-bottom: 6px;
  }
  .grid-2 > * {
    min-width: 0;
  }
  input[type="date"] {
    -webkit-appearance: none;
    appearance: none;
  }
  input[type="date"]::-webkit-date-and-time-value {
    text-align: left;
  }
  input[type="date"]::-webkit-calendar-picker-indicator {
    opacity: 1;
  }
  .filters {
    grid-template-columns: 1fr;
  }
  .actions {
    flex-direction: column;
    align-items: stretch;
  }
  .actions button,
  .actions .btn-secondary {
    width: 100%;
  }
  .list-row {
    grid-template-columns: 1fr;
  }
  .list-actions {
    justify-content: flex-end;
  }
  .pagination {
    justify-content: center;
    gap: 8px;
  }
  .pagination input {
    width: 72px;
  }
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    padding: 14px 12px;
  }
  .nav {
    width: 100%;
  }
  .nav a {
    flex: 1 1 0;
    text-align: center;
  }
  .brand {
    font-size: 18px;
  }
  thead th,
  tbody td {
    padding: 8px;
  }
  .table-wrap {
    overflow-x: visible;
  }
  #items {
    min-width: 0;
    width: 100%;
    margin-top: 0;
    border-collapse: separate;
    border-spacing: 0 18px;
  }
  #items thead {
    display: none;
  }
  #items tbody tr {
    display: block;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 10px;
    background: #fff;
    margin-bottom: 18px;
  }
  #items tbody tr:last-child {
    margin-bottom: 0;
  }
  #items tbody td {
    display: block;
    border-bottom: 0;
    padding: 0;
    margin-bottom: 8px;
  }
  #items tbody td:last-child {
    margin-bottom: 0;
  }
  #items tbody td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 4px;
    font-size: 12px;
    line-height: 1.2;
    color: var(--muted);
    font-weight: 700;
  }
  #items tbody td[data-label=""]::before {
    display: none;
  }
  #items tbody td button {
    width: 100%;
  }
  h1 {
    font-size: 24px;
  }
}
