:root {
  --dark: #111f19;
  --dark-2: #1a2b24;
  --sand: #bebfa8;
  --light: #e4e4e4;
  --white: #ffffff;
  --bg: #f5f5f2;
  --text: #17211b;
  --muted: #647067;
  --success-bg: #eef7f0;
  --success-text: #255c39;
  --error-bg: #fbeeee;
  --error-text: #9d2f2f;
  --border: rgba(17, 31, 25, 0.08);
  --border-strong: rgba(17, 31, 25, 0.14);
  --shadow: 0 12px 28px rgba(17, 31, 25, 0.08);
  --shadow-soft: 0 6px 18px rgba(17, 31, 25, 0.06);
  --radius: 22px;
  --radius-sm: 14px;
  --font-sans: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, "Helvetica Neue", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body,
input,
button,
select,
textarea {
  font-family: var(--font-sans);
}

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

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

button {
  transition:
    transform 0.15s ease,
    opacity 0.15s ease,
    box-shadow 0.15s ease,
    background-color 0.15s ease,
    color 0.15s ease;
}

button:hover {
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0);
}

input,
select,
textarea,
button,
a {
  outline: none;
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible,
a:focus-visible {
  box-shadow: 0 0 0 4px rgba(190, 191, 168, 0.28);
  border-color: rgba(17, 31, 25, 0.22);
}

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 290px 1fr;
}

.sidebar {
  background: linear-gradient(180deg, var(--dark), var(--dark-2));
  color: var(--white);
  padding: 26px 20px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  position: sticky;
  top: 0;
  min-height: 100vh;
}

.brand-card,
.user-card {
  display: flex;
  gap: 12px;
  align-items: center;
}

.brand-card p,
.user-card p {
  margin: 4px 0 0;
  color: rgba(255, 255, 255, 0.72);
  font-size: 13px;
  line-height: 1.4;
}

.brand-card strong,
.user-card strong {
  font-weight: 700;
}

.brand-mark,
.avatar {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.12);
  display: grid;
  place-items: center;
  font-weight: 800;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.brand-mark.large {
  width: 56px;
  height: 56px;
  font-size: 22px;
}

.nav-links {
  display: grid;
  gap: 10px;
}

.nav-links a {
  padding: 12px 14px;
  border-radius: 14px;
  color: rgba(255, 255, 255, 0.84);
  font-weight: 600;
  transition:
    background-color 0.18s ease,
    color 0.18s ease,
    transform 0.15s ease;
}

.nav-links a.active,
.nav-links a:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--white);
}

.sidebar-footer {
  margin-top: auto;
  display: grid;
  gap: 14px;
}

.main-content {
  padding: 28px;
  min-width: 0;
}

.main-content.auth-layout {
  grid-column: 1 / -1;
  width: 100%;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px;
}

.main-content.auth-layout .auth-card,
.main-content.auth-layout .error-card {
  width: min(460px, calc(100vw - 32px));
  margin: 0 auto;
}

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

.page-header h1,
.auth-card h1,
.error-card h1 {
  margin: 6px 0;
  font-size: 32px;
  line-height: 1.1;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.page-header p,
.auth-card p,
.error-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.eyebrow {
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.12em;
  color: var(--muted);
  font-weight: 700;
}

.flash {
  padding: 14px 16px;
  border-radius: 16px;
  margin-bottom: 18px;
  font-weight: 600;
  border: 1px solid transparent;
}

.flash-success {
  background: var(--success-bg);
  color: var(--success-text);
  border-color: rgba(37, 92, 57, 0.12);
}

.flash-error {
  background: var(--error-bg);
  color: var(--error-text);
  border-color: rgba(157, 47, 47, 0.12);
}

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

.stat-card,
.panel-card,
.table-card,
.auth-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.stat-card {
  padding: 18px;
  display: grid;
  gap: 10px;
}

.stat-card span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.stat-card strong {
  font-size: 28px;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.stat-card small {
  color: var(--muted);
}

.stat-card.accent {
  background: linear-gradient(135deg, var(--dark), var(--dark-2));
  color: var(--white);
}

.stat-card.accent span,
.stat-card.accent small {
  color: rgba(255, 255, 255, 0.72);
}

.dashboard-grid,
.content-grid {
  display: grid;
  grid-template-columns: 1.45fr 1fr;
  gap: 18px;
}

.users-grid {
  grid-template-columns: 420px 1fr;
}

.panel-card,
.table-card {
  padding: 20px;
}

.panel-card.compact {
  padding: 18px;
  margin-bottom: 18px;
}

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

.panel-header h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.panel-header.small-gap {
  margin-bottom: 10px;
}

.top-gap {
  margin-top: 18px;
}

.list-stack,
.metric-list {
  display: grid;
  gap: 12px;
}

.list-item {
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 14px;
  background: #fafaf8;
  box-shadow: var(--shadow-soft);
}

.list-item.compact {
  padding: 12px;
}

.list-item-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.list-item p {
  margin: 4px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.meta-line {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  color: var(--muted);
  font-size: 13px;
  margin-top: 10px;
  line-height: 1.5;
}

.meta-line.compact {
  font-size: 12px;
  margin-top: 8px;
}

.metric-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.metric-row:last-child {
  border-bottom: 0;
}

.metric-row span {
  color: var(--muted);
}

.metric-row strong {
  font-weight: 700;
}

.metric-row.wide span {
  max-width: 82%;
}

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

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

.filters-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: end;
}

.field {
  display: grid;
  gap: 7px;
}

.field label {
  font-weight: 700;
  font-size: 14px;
}

.field small {
  color: var(--muted);
  font-weight: 500;
}

.full-width {
  grid-column: 1 / -1;
}

.checkbox-field label {
  display: flex;
  align-items: center;
  gap: 8px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid rgba(17, 31, 25, 0.12);
  background: var(--white);
  color: var(--text);
  border-radius: 14px;
  padding: 12px 14px;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    background-color 0.15s ease;
}

input::placeholder,
textarea::placeholder {
  color: #8a938d;
}

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

.primary-button,
.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 16px;
  border-radius: 14px;
  font-weight: 700;
  border: 0;
  cursor: pointer;
}

.primary-button {
  background: var(--dark);
  color: var(--white);
  box-shadow: var(--shadow-soft);
}

.primary-button:hover {
  background: #0e1914;
}

.ghost-button {
  background: #eff1ed;
  color: var(--text);
}

.ghost-button:hover {
  background: #e7ebe5;
}

.full-width {
  width: 100%;
}

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

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #eef1ed;
  color: var(--text);
  min-height: 34px;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.preview-card {
  border: 1px solid var(--border);
  background: #fbfbf8;
  border-radius: 18px;
  padding: 16px;
  display: grid;
  gap: 8px;
}

.preview-label {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 11px;
  color: var(--muted);
  font-weight: 700;
}

.preview-card strong {
  font-size: 24px;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.side-panel {
  align-content: start;
}

.table-card {
  overflow: auto;
}

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

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

th {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 700;
  background: #fcfcfa;
  position: sticky;
  top: 0;
  z-index: 1;
}

tr:hover td {
  background: #fcfcf9;
}

.table-link {
  font-weight: 700;
  color: var(--dark);
}

.empty-state {
  border: 1px dashed rgba(17, 31, 25, 0.15);
  border-radius: 16px;
  padding: 18px;
  text-align: center;
  color: var(--muted);
  background: #fcfcfa;
  line-height: 1.55;
}

.auth-card {
  width: min(460px, 100%);
  padding: 28px;
}

.auth-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}

.error-card {
  max-width: 560px;
}

hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 20px 0;
}

@media (max-width: 1100px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: none;
  }

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

  .dashboard-grid,
  .content-grid,
  .users-grid,
  .filters-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  table {
    min-width: 720px;
  }
}

@media (max-width: 680px) {
  .main-content {
    padding: 18px;
  }

  .main-content.auth-layout {
    padding: 18px;
  }

  .page-header {
    flex-direction: column;
  }

  .page-header h1,
  .auth-card h1,
  .error-card h1 {
    font-size: 28px;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .actions-inline {
    flex-direction: column;
    align-items: stretch;
  }

  .primary-button,
  .ghost-button {
    width: 100%;
  }

  .table-card {
    padding: 14px;
  }

  table {
    min-width: 620px;
  }
}