:root {
  --bg: #f2f6fb;
  --card: #ffffff;
  --ink: #0f172a;
  --brand: #0b2545;
  --brand-2: #134074;
  --ok: #065f46;
  --warn: #991b1b;
  --line: #dbe4f0;
  --soft: #f8fafc;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top right, #dbeafe 0%, transparent 38%),
    radial-gradient(circle at bottom left, #e2e8f0 0%, transparent 35%),
    var(--bg);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
  color: #fff;
}

.brand {
  font-weight: 700;
  letter-spacing: 0.2px;
}

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

.topbar a {
  color: #fff;
  text-decoration: none;
  font-size: 0.9rem;
  padding: 6px 9px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
}

.topbar a:hover {
  background: rgba(255, 255, 255, 0.22);
}

.container {
  max-width: 1100px;
  margin: 18px auto;
  padding: 0 12px 28px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 12px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.05);
}

.narrow {
  max-width: 420px;
  margin-left: auto;
  margin-right: auto;
}

h1, h2 {
  margin-top: 0;
  margin-bottom: 10px;
  line-height: 1.2;
}

h1 {
  font-size: 1.35rem;
}

h2 {
  font-size: 1.1rem;
}

h3 {
  font-size: 1rem;
  margin: 12px 0 8px;
}

.alerts {
  margin-bottom: 12px;
}

.alert {
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 8px;
}

.alert.success {
  background: #dcfce7;
  color: var(--ok);
}

.alert.error {
  background: #fee2e2;
  color: var(--warn);
}

.form-grid {
  display: grid;
  gap: 7px;
}

label {
  font-size: 0.95rem;
  font-weight: 600;
}

.required-star {
  color: #dc2626;
  font-size: 0.85em;
  vertical-align: super;
}

input,
textarea,
select,
button {
  font: inherit;
}

input,
textarea,
select {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
}

textarea {
  resize: vertical;
}

button {
  border: 0;
  border-radius: 8px;
  padding: 9px 12px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}

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

.inline-form input,
.inline-form select {
  flex: 1 1 280px;
}

.ghost-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  padding: 9px 12px;
  border: 1px solid #cbd5e1;
  color: var(--ink);
  text-decoration: none;
  background: #fff;
}

.danger-btn {
  background: #dc2626;
}

.danger-btn:hover {
  background: #b91c1c;
}

.admin-delete-form {
  display: grid;
  gap: 6px;
  min-width: 150px;
}

.admin-delete-form input {
  min-width: 0;
  padding: 7px 8px;
  font-size: 0.86rem;
}

.admin-delete-form button {
  padding: 7px 10px;
  font-size: 0.86rem;
}

.muted {
  color: #475569;
  font-size: 0.95rem;
}

.auth-link {
  margin-bottom: 0;
  text-align: center;
}

.auth-link a {
  color: var(--brand-2);
  font-weight: 700;
}

.status-badge {
  display: inline-block;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
}

.status-badge.open {
  background: #dbeafe;
  color: #1e3a8a;
}

.status-badge.resolved {
  background: #dcfce7;
  color: #166534;
}

.status-check {
  font-weight: 800;
  margin-right: 4px;
}

.my-records-table th,
.my-records-table td {
  font-size: 0.88rem;
  padding: 8px;
  line-height: 1.25;
}

.my-records-table .status-badge {
  font-size: 0.78rem;
  padding: 4px 8px;
}

.my-records-table .ghost-btn {
  padding: 6px 10px;
  font-size: 0.82rem;
}

.news-list {
  display: grid;
  gap: 10px;
}

.news-item {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.news-item h2 {
  margin: 6px 0 8px;
}

.news-item p {
  margin: 0 0 10px;
  white-space: pre-wrap;
  line-height: 1.45;
}

.news-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: #64748b;
  font-size: 0.82rem;
}

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

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

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 9px;
  text-align: left;
  vertical-align: top;
}

.checkbox {
  display: flex;
  gap: 8px;
  align-items: center;
  font-weight: 500;
}

@media (max-width: 768px) {
  body {
    background: var(--bg);
  }

  .topbar {
    padding: 10px;
    align-items: flex-start;
    flex-direction: column;
  }

  .brand {
    font-size: 0.95rem;
  }

  .topbar nav {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .topbar a {
    text-align: center;
    font-size: 0.82rem;
    padding: 7px 6px;
  }

  .container {
    margin: 10px auto;
    padding: 0 8px 18px;
  }

  .card {
    padding: 10px;
    margin-bottom: 10px;
    box-shadow: none;
  }

  h1 {
    font-size: 1.12rem;
  }

  h2 {
    font-size: 1rem;
  }

  .inline-form {
    display: grid;
    grid-template-columns: 1fr;
  }

  .inline-form input,
  .inline-form select,
  .inline-form button,
  .inline-form .ghost-btn {
    width: 100%;
    flex: none;
  }

  input,
  textarea,
  select,
  button,
  .ghost-btn {
    min-height: 42px;
    font-size: 0.95rem;
  }

  .table-wrap {
    overflow: visible;
  }

  table {
    min-width: 0;
    border-collapse: separate;
    border-spacing: 0 8px;
  }

  thead {
    display: none;
  }

  tbody,
  tr,
  td {
    display: block;
    width: 100%;
  }

  tr {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--soft);
    padding: 8px;
  }

  td {
    display: grid;
    grid-template-columns: 104px minmax(0, 1fr);
    gap: 8px;
    border-bottom: 0;
    padding: 5px 0;
    font-size: 0.9rem;
    line-height: 1.3;
    word-break: break-word;
  }

  td::before {
    content: attr(data-label);
    color: #64748b;
    font-weight: 700;
  }

  td[colspan] {
    display: block;
  }

  td[colspan]::before {
    content: "";
    display: none;
  }

  td form {
    display: grid;
    gap: 6px;
  }

  .status-badge {
    width: fit-content;
    max-width: 100%;
  }

  .my-records-table th,
  .my-records-table td {
    font-size: 0.9rem;
    padding: 5px 0;
  }

  .news-item {
    padding: 10px;
  }
}
