:root {
  --sr-primary: #82271c;
  --sr-secondary: #2b685b;
  --sr-tertiary: #214971;
  --sr-surface: #fff8ef;
  --sr-surface-container: #f3ece1;
  --sr-surface-container-high: #ebe3d4;
  --sr-on-surface: #1e1b13;
  --sr-on-surface-variant: #4a4537;
  --sr-outline: #7b7769;
  --sr-outline-variant: #ccc5b5;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background-color: var(--sr-surface);
  color: var(--sr-on-surface);
}

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

/* Layout */
.admin-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 220px;
  background: var(--sr-surface-container);
  border-right: 1px solid var(--sr-outline-variant);
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  padding: 24px;
  border-bottom: 1px solid var(--sr-outline-variant);
}

.sidebar-brand {
  font-size: 18px;
  font-weight: 700;
  color: var(--sr-primary);
  letter-spacing: 0.05em;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav-item {
  padding: 12px 16px;
  border-radius: 6px;
  color: var(--sr-on-surface-variant);
  font-size: 14px;
  transition: all 0.2s;
  cursor: pointer;
}

.nav-item:hover,
.nav-item.active {
  background: rgba(130, 39, 28, 0.08);
  color: var(--sr-primary);
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--sr-outline-variant);
}

.main-content {
  flex: 1;
  padding: 32px;
  overflow: auto;
}

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.page-title {
  font-size: 24px;
  font-weight: 600;
  margin: 0;
}

/* Cards */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: #fff;
  border: 1px solid var(--sr-outline-variant);
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(30, 27, 19, 0.04);
}

.stat-label {
  font-size: 12px;
  color: var(--sr-outline);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--sr-primary);
}

.stat-sub {
  font-size: 13px;
  color: var(--sr-on-surface-variant);
  margin-top: 4px;
}

.panel {
  background: #fff;
  border: 1px solid var(--sr-outline-variant);
  border-radius: 8px;
  padding: 24px;
  margin-bottom: 24px;
}

.panel-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
}

/* Forms */
.form-section {
  margin-bottom: 24px;
}

.form-section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--sr-primary);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--sr-outline-variant);
}

.form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 16px;
}

.form-group {
  flex: 1;
  min-width: 240px;
}

.form-group label {
  display: block;
  font-size: 13px;
  color: var(--sr-on-surface-variant);
  margin-bottom: 6px;
}

.form-input,
.form-textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--sr-outline-variant);
  border-radius: 6px;
  font-size: 14px;
  background: var(--sr-surface);
  color: var(--sr-on-surface);
}

.form-input:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--sr-primary);
}

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

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
}

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

.btn-primary:hover {
  background: #6b1f16;
}

.btn-secondary {
  background: transparent;
  border: 1px solid var(--sr-outline-variant);
  color: var(--sr-on-surface);
}

.btn-secondary:hover {
  background: var(--sr-surface-container);
}

/* Tags */
.tags-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: var(--sr-surface-container-high);
  border-radius: 4px;
  font-size: 13px;
}

.tag-remove {
  cursor: pointer;
  color: var(--sr-outline);
}

.tag-remove:hover {
  color: var(--sr-primary);
}

/* Image upload */
.image-preview {
  max-width: 100%;
  max-height: 240px;
  border-radius: 6px;
  border: 1px solid var(--sr-outline-variant);
  margin-top: 8px;
}

/* Tables */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th,
.data-table td {
  text-align: left;
  padding: 12px;
  border-bottom: 1px solid var(--sr-outline-variant);
}

.data-table th {
  color: var(--sr-outline);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-size: 12px;
}

/* Charts */
.chart-container {
  height: 240px;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 16px 0;
}

.chart-bar-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.chart-bar {
  width: 100%;
  background: var(--sr-primary);
  opacity: 0.85;
  border-radius: 4px 4px 0 0;
  min-height: 4px;
  transition: opacity 0.2s;
}

.chart-bar:hover {
  opacity: 1;
}

.chart-label {
  font-size: 11px;
  color: var(--sr-outline);
  white-space: nowrap;
}

/* Login */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--sr-surface) 0%, var(--sr-surface-container) 100%);
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: #fff;
  border: 1px solid var(--sr-outline-variant);
  border-radius: 12px;
  padding: 40px;
  box-shadow: 0 8px 30px rgba(30, 27, 19, 0.06);
}

.login-title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 24px;
  text-align: center;
  color: var(--sr-primary);
}

.login-btn {
  width: 100%;
  margin-top: 8px;
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 16px;
}

.page-btn {
  padding: 6px 12px;
  border: 1px solid var(--sr-outline-variant);
  background: #fff;
  border-radius: 4px;
  font-size: 13px;
  cursor: pointer;
}

.page-btn.active,
.page-btn:hover {
  background: var(--sr-primary);
  color: #fff;
  border-color: var(--sr-primary);
}

/* Hidden */
.hidden {
  display: none !important;
}
