:root {
  --bg: #f4efe7;
  --panel: rgba(255, 255, 255, 0.9);
  --line: rgba(31, 45, 51, 0.12);
  --line-strong: rgba(61, 132, 158, 0.35);
  --text: #1f2d33;
  --muted: #63757d;
  --accent: #3d849e;
  --accent-strong: #285f73;
  --danger: #a54747;
  --success: #2b7a57;
  --shadow: rgba(24, 38, 44, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--text);
  font-family: "Segoe UI", system-ui, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(61, 132, 158, 0.12), transparent 28%),
    linear-gradient(180deg, #faf7f1, var(--bg));
}

a {
  color: inherit;
  text-decoration: none;
}

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

.admin-shell {
  width: min(100%, 1360px);
  margin: 0 auto;
  padding: 22px;
}

.topbar,
.panel,
.sidebar-nav {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: 0 16px 36px var(--shadow);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px;
  margin-bottom: 20px;
}

.muted {
  color: var(--muted);
}

.topbar-actions,
.section-head,
.two-column,
.stats-grid,
.form-grid,
.admin-grid {
  display: grid;
  gap: 18px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.admin-grid {
  grid-template-columns: 240px minmax(0, 1fr);
  align-items: start;
}

.sidebar {
  position: sticky;
  top: 12px;
}

.sidebar-nav {
  display: grid;
  gap: 8px;
  padding: 16px;
}

.sidebar-link {
  display: block;
  padding: 12px 14px;
  border-radius: 16px;
  color: var(--muted);
}

.sidebar-link:hover,
.sidebar-link.is-active {
  color: var(--text);
  background: rgba(61, 132, 158, 0.12);
}

.workspace-wide {
  grid-column: 1 / -1;
}

.page-title {
  margin: 0;
  font-size: clamp(1.8rem, 3vw, 2.6rem);
}

.flash {
  margin-bottom: 18px;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid var(--line);
}

.flash-success {
  color: var(--success);
  border-color: rgba(43, 122, 87, 0.25);
  background: rgba(43, 122, 87, 0.08);
}

.flash-error {
  color: var(--danger);
  border-color: rgba(165, 71, 71, 0.25);
  background: rgba(165, 71, 71, 0.08);
}

.panel {
  padding: 22px;
}

.auth-panel {
  width: min(100%, 540px);
  margin: 8vh auto 0;
}

.stack-form {
  display: grid;
  gap: 14px;
}

.stack-form label {
  display: grid;
  gap: 8px;
}

.stack-form input,
.stack-form select,
.stack-form textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.94);
}

.stack-form textarea {
  resize: vertical;
  min-height: 120px;
}

.checkbox {
  display: flex !important;
  align-items: center;
  gap: 10px;
}

.checkbox input {
  width: auto;
}

.button,
.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
}

.button {
  background: linear-gradient(180deg, #5a9ab1, var(--accent));
  color: #fff;
  cursor: pointer;
}

.button-secondary {
  background: transparent;
  color: var(--accent-strong);
}

.button-danger {
  background: linear-gradient(180deg, #c76c6c, var(--danger));
  color: #fff;
}

.pill {
  background: rgba(61, 132, 158, 0.1);
  color: var(--accent-strong);
}

.stats-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 18px;
}

.stat-card strong {
  display: block;
  margin-top: 8px;
  font-size: 2rem;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 18px;
}

.two-column {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

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

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

.data-table tbody tr:hover {
  background: rgba(61, 132, 158, 0.05);
}

.note-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
}

.media-grid,
.records-list {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.media-item,
.record-card {
  padding: 14px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
}

.media-item img,
.media-item video {
  width: 100%;
  border-radius: 16px;
}

.media-copy {
  display: grid;
  gap: 4px;
  margin: 10px 0;
}

@media (max-width: 1080px) {
  .admin-grid,
  .form-grid,
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }
}

@media (max-width: 720px) {
  .admin-shell {
    padding: 14px;
  }

  .topbar,
  .section-head,
  .topbar-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .two-column {
    grid-template-columns: 1fr;
  }
}
