:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --text: #182026;
  --muted: #5c7080;
  --border: #d8e1e8;
  --primary: #137cbd;
  --primary-hover: #106ba3;
  --success: #0f9960;
  --warning: #d9822b;
  --danger: #db3737;
  --radius: 10px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
}

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 10px 14px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  justify-content: space-between;
}

.brand {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
  text-decoration: none;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.nav a,
.nav button {
  padding: 8px 11px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--text);
  background: transparent;
  border: 1px solid transparent;
  font-size: 0.92rem;
  cursor: pointer;
}

.nav a:hover,
.nav button:hover {
  background: var(--bg);
}

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 14px;
}

h1, h2, h3 {
  margin-top: 0;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 14px;
}

.card-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.muted {
  color: var(--muted);
  font-size: 0.9rem;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  background: #ebf1f5;
  color: var(--text);
}

.badge-set {
  background: #ffe3e3;
  color: #a82a2a;
}

.badge-ok {
  background: #d9f2e6;
  color: #0a6640;
}

.badge-warn {
  background: #fce8d5;
  color: #935610;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-sm {
  min-height: 36px;
  padding: 5px 10px;
  font-size: 0.85rem;
}

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-danger {
  background: #fff5f5;
  border-color: #f5b5b5;
  color: var(--danger);
}

.actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.form-grid p {
  margin: 0 0 10px;
}

label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 4px;
}

input[type="text"],
input[type="number"],
input[type="password"],
input[type="date"],
select,
textarea {
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
  background: #fff;
}

.table-scroll {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 480px;
}

th, td {
  text-align: left;
  padding: 8px 6px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.inline-inputs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.inline-inputs input {
  width: 82px;
  min-height: 36px;
  padding: 4px 6px;
}

.messages {
  list-style: none;
  padding: 0;
  margin: 0 0 12px;
}

.message {
  padding: 10px 12px;
  border-radius: 8px;
  margin-bottom: 8px;
  border: 1px solid var(--border);
  background: #e1f0fa;
}

.message.success {
  background: #d9f2e6;
  border-color: #9be0c0;
}

.message.error {
  background: #fde8e8;
  border-color: #f5b5b5;
  color: #9e2a2a;
}

.inline-form {
  display: inline;
}
