:root {
  color-scheme: light;
  --bg: #f7f2e8;
  --bg-2: #eef3e8;
  --surface: rgba(255, 252, 245, 0.92);
  --surface-strong: #fffaf0;
  --line: #dfd1bd;
  --line-soft: #ece0cf;
  --text: #2b241c;
  --muted: #786b5d;
  --primary: #486a4f;
  --primary-strong: #36533d;
  --primary-soft: #dfeada;
  --accent: #b5793d;
  --danger: #b63b2e;
  --danger-soft: #ffe0da;
  --warning-soft: #fff0b8;
  --shadow: 0 18px 45px rgba(67, 47, 26, 0.12);
  --shadow-soft: 0 8px 24px rgba(67, 47, 26, 0.08);
  font-family: Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

* {
  box-sizing: border-box;
}

body {
  background:
    linear-gradient(135deg, rgba(255, 250, 240, 0.96), rgba(238, 243, 232, 0.96)),
    repeating-linear-gradient(0deg, rgba(78, 52, 27, 0.025) 0 1px, transparent 1px 22px);
  margin: 0;
  min-height: 100vh;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  color: var(--primary-strong);
}

.topbar {
  align-items: center;
  backdrop-filter: blur(16px);
  background: rgba(255, 250, 240, 0.86);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 8px 24px rgba(67, 47, 26, 0.06);
  display: flex;
  justify-content: space-between;
  min-height: 62px;
  padding: 0 26px;
  position: sticky;
  top: 0;
  z-index: 10;
}

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

.topbar nav a,
.link-button {
  border-radius: 999px;
  color: var(--muted);
  padding: 8px 11px;
  transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}

.topbar nav a:hover,
.link-button:hover {
  background: var(--primary-soft);
  color: var(--primary-strong);
  transform: translateY(-1px);
}

.brand {
  color: var(--text);
  font-weight: 800;
  letter-spacing: 0;
}

.brand::before {
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 18px rgba(181, 121, 61, 0.35);
  content: "";
  display: inline-block;
  height: 9px;
  margin-right: 10px;
  width: 9px;
}

.nav-form {
  margin: 0;
}

.link-button {
  background: transparent;
  border: 0;
  cursor: pointer;
  font: inherit;
  min-height: 0;
}

.container {
  animation: page-in 360ms ease both;
  margin: 0 auto;
  max-width: 1180px;
  padding: 30px 24px 56px;
}

@keyframes page-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.page-title {
  align-items: center;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin-bottom: 22px;
}

.page-title h1 {
  font-size: 28px;
  line-height: 1.1;
  margin: 0;
}

.section {
  margin-top: 30px;
}

.section h2,
.details-grid h2 {
  font-size: 17px;
  margin: 0 0 10px;
}

.button-link,
button {
  align-items: center;
  background: var(--primary);
  border: 1px solid var(--primary);
  border-radius: 8px;
  color: #fffaf0;
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  justify-content: center;
  min-height: 42px;
  padding: 9px 14px;
  transition: box-shadow 160ms ease, transform 160ms ease, background 160ms ease;
}

.button-link:hover,
button:hover {
  background: var(--primary-strong);
  box-shadow: 0 10px 18px rgba(54, 83, 61, 0.18);
  color: #fffaf0;
  transform: translateY(-1px);
}

.button-link.secondary {
  background: var(--surface-strong);
  border-color: var(--line);
  color: var(--text);
}

.button-link.secondary:hover {
  background: #fff4df;
  color: var(--text);
}

.actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.module-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.module-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-soft);
  color: var(--text);
  display: grid;
  gap: 10px;
  min-height: 128px;
  padding: 20px;
  position: relative;
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.module-card::after {
  color: var(--accent);
  content: "→";
  font-size: 24px;
  position: absolute;
  right: 20px;
  top: 18px;
  transition: transform 180ms ease;
}

.module-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow);
  transform: translateY(-3px);
}

.module-card:hover::after {
  transform: translateX(3px);
}

.module-title {
  font-size: 19px;
  font-weight: 800;
  padding-right: 28px;
}

.module-text {
  color: var(--muted);
  line-height: 1.45;
}

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

.details-grid > div,
.table-wrap,
.edit-form,
.auth-form,
.result-card,
.search-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-soft);
}

.details-grid > div,
.table-wrap,
.result-card,
.search-panel {
  padding: 17px;
}

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

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

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

tr {
  transition: background 140ms ease;
}

tbody tr:hover {
  background: rgba(223, 234, 218, 0.45);
}

th {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.search-panel {
  margin-bottom: 24px;
}

.search-form {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

.search-form button {
  width: fit-content;
}

.inline-check {
  align-items: center;
  color: var(--muted);
  display: flex;
  gap: 8px;
  min-height: 42px;
}

.inline-check input {
  min-height: auto;
}

input,
select,
textarea {
  background: #fffdf8;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font: inherit;
  min-height: 42px;
  padding: 9px 12px;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(72, 106, 79, 0.15);
  outline: none;
}

textarea {
  resize: vertical;
}

.edit-form,
.auth-form {
  display: grid;
  gap: 16px;
  max-width: 740px;
  padding: 22px;
}

.auth-form {
  max-width: 390px;
}

.edit-form label,
.auth-form label {
  color: var(--muted);
  display: grid;
  gap: 7px;
  font-weight: 700;
}

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

.form-actions {
  align-items: center;
  display: flex;
  gap: 16px;
}

.danger-form {
  margin-top: 16px;
}

.danger-button {
  background: var(--danger);
  border-color: var(--danger);
}

.danger-button:hover {
  background: #932f25;
}

.results {
  display: grid;
  gap: 14px;
}

.result-card {
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.result-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.result-card h2 {
  font-size: 19px;
  margin: 5px 0 7px;
}

.result-card p {
  margin: 0;
}

.result-type,
.muted {
  color: var(--muted);
  font-size: 14px;
}

.comment-text {
  color: #4b4238;
  margin-top: 10px !important;
  white-space: pre-wrap;
}

.alert-error {
  background: var(--danger-soft);
  border: 1px solid var(--danger);
  border-radius: 8px;
  color: #7a271a;
  margin: 0;
  padding: 10px 12px;
}

.time-row.time-warning > td {
  background: var(--warning-soft) !important;
}

.time-row.time-danger > td {
  background: var(--danger-soft) !important;
}

.time-row.time-danger > td:first-child,
.time-row.time-warning > td:first-child {
  border-left: 4px solid transparent;
}

.time-row.time-warning > td:first-child {
  border-left-color: #d99a00;
}

.time-row.time-danger > td:first-child {
  border-left-color: var(--danger);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
  }
}

@media (max-width: 640px) {
  .search-form {
    grid-template-columns: 1fr;
  }

  .details-grid,
  .form-row {
    grid-template-columns: 1fr;
  }

  .page-title {
    align-items: flex-start;
    flex-direction: column;
  }

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