:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #1b1f24;
  --muted: #667085;
  --line: #d8dee7;
  --accent: #2563eb;
  --accent-weak: #dbeafe;
  --danger: #b42318;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.4 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.login-page {
  align-items: center;
  display: flex;
  min-height: 100vh;
  justify-content: center;
  padding: 24px;
}

.login-form {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 14px;
  min-width: min(360px, 100%);
  padding: 24px;
}

.login-form label {
  color: var(--muted);
  display: grid;
  gap: 6px;
  font-weight: 650;
}

.login-form input {
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
  padding: 9px 10px;
}

.login-error {
  color: var(--danger);
  font-weight: 650;
}

.page {
  max-width: 1480px;
  margin: 0 auto;
  padding: 24px;
}

.toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

h1 {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
}

p {
  margin: 4px 0 0;
  color: var(--muted);
}

.meta-line {
  align-items: center;
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  overflow-x: auto;
  white-space: nowrap;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: auto;
}

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

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

th {
  background: #eef2f7;
  color: #344054;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

tbody tr:hover {
  background: var(--accent-weak);
}

.comment {
  white-space: normal;
  min-width: 320px;
}

.invoice {
  white-space: normal;
  min-width: 180px;
}

.invoice-item + .invoice-item {
  margin-top: 6px;
}

.invoice-badge.paid {
  background: #269b3b;
  color: white;
}

.invoice-badge.unpaid {
  background: #c83232;
  color: white;
}

.detail-invoice {
  margin-top: 6px;
  color: var(--muted);
}

.comment-line {
  font-weight: 650;
  white-space: normal;
}

.comment-line + .comment-line {
  margin-top: 2px;
}

.comment-line.error {
  color: var(--danger);
}

.comment-line.ok {
  color: #087443;
}

.comment-line.info {
  color: #175cd3;
}

.detail-comments {
  margin-top: 8px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.button,
button {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: white;
  border-radius: 6px;
  padding: 8px 12px;
  font: inherit;
  font-weight: 650;
  text-decoration: none;
  cursor: pointer;
}

.button.secondary,
button.secondary {
  background: white;
  color: var(--accent);
}

button:disabled {
  border-color: var(--line);
  color: var(--muted);
  background: #f2f4f7;
  cursor: not-allowed;
}

.back-link {
  color: var(--accent);
  display: inline-block;
  margin-bottom: 6px;
  text-decoration: none;
}

.table-link {
  color: var(--accent);
  text-decoration: none;
}

.table-link.strong {
  font-weight: 700;
}

.table-link:hover,
.back-link:hover {
  text-decoration: underline;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  min-height: 28px;
  border-radius: 999px;
  padding: 4px 14px;
  background: #269b3b;
  color: white;
  font: inherit;
  font-weight: inherit;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
}

.status-renewed {
  background: #667085;
}

.editable-table input,
.editable-table select {
  width: 100%;
  min-width: 130px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 8px;
  font: inherit;
  background: white;
}

.icon-button {
  border-color: #fecdca;
  background: white;
  color: var(--danger);
}

.status {
  min-height: 22px;
  margin-top: 12px;
  color: var(--muted);
  white-space: pre-line;
}

.status-entry {
  margin-top: 4px;
}

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

@media (max-width: 900px) {
  .toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .actions {
    justify-content: flex-start;
  }
}
