:root {
  --bg: #f4f1ea;
  --bg-accent: #efe4d2;
  --panel: rgba(255, 252, 247, 0.92);
  --panel-strong: #fffaf1;
  --line: rgba(71, 52, 28, 0.12);
  --text: #20170f;
  --muted: #6f6253;
  --primary: #b55d2e;
  --primary-deep: #864222;
  --teal: #0f766e;
  --gold: #d6a94f;
  --red: #c2410c;
  --green: #2f6e49;
  --shadow: 0 24px 60px rgba(83, 57, 27, 0.12);
  --radius: 20px;
  --radius-sm: 14px;
  --sidebar-width: 260px;
  font-family: Georgia, "Times New Roman", serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(214, 169, 79, 0.18), transparent 26%),
    radial-gradient(circle at top right, rgba(15, 118, 110, 0.10), transparent 22%),
    linear-gradient(180deg, #f8f3eb 0%, #f3ede4 48%, #efe7dc 100%);
}

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

a {
  color: inherit;
}

.hidden {
  display: none !important;
}

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

.compact {
  margin: 0;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.78rem;
  color: var(--primary);
  font-weight: 700;
}

.auth-body {
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-panel {
  width: min(460px, 100%);
  padding: 36px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(255,255,255,0.95), rgba(255,249,240,0.88));
  box-shadow: var(--shadow);
}

.splash-panel {
  text-align: center;
}

.spinner {
  width: 44px;
  height: 44px;
  margin: 20px auto 0;
  border-radius: 999px;
  border: 4px solid rgba(181, 93, 46, 0.15);
  border-top-color: var(--primary);
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

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

.field {
  display: grid;
  gap: 8px;
  font-size: 0.94rem;
}

.field span {
  font-weight: 600;
}

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

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  background: rgba(255,255,255,0.82);
  color: var(--text);
}

textarea {
  resize: vertical;
}

.button {
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 12px 18px;
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

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

.button.primary {
  background: linear-gradient(135deg, var(--primary), #d37a47);
  color: #fff7f0;
  box-shadow: 0 14px 30px rgba(181, 93, 46, 0.22);
}

.button.secondary {
  background: rgba(32, 23, 15, 0.08);
  color: var(--text);
  border-color: var(--line);
}

.button.ghost {
  background: rgba(255,255,255,0.7);
  border-color: rgba(15, 118, 110, 0.18);
  color: var(--teal);
}

.notice {
  border: 1px solid rgba(181, 93, 46, 0.18);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  background: rgba(255, 247, 235, 0.9);
  color: var(--text);
  margin-bottom: 18px;
}

.notice.error {
  border-color: rgba(194, 65, 12, 0.22);
  background: rgba(254, 242, 242, 0.95);
  color: #7c2d12;
}

.notice.success {
  border-color: rgba(47, 110, 73, 0.2);
  background: rgba(240, 253, 244, 0.95);
  color: #14532d;
}

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 28px 22px;
  background:
    linear-gradient(180deg, rgba(31, 23, 16, 0.98), rgba(56, 38, 22, 0.96)),
    linear-gradient(180deg, rgba(181, 93, 46, 0.18), transparent);
  color: #f9f1e8;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 28px;
}

.brand-mark {
  width: 52px;
  height: 52px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, rgba(214,169,79,0.9), rgba(181,93,46,0.95));
  color: #fff8f0;
  font-weight: 800;
  font-size: 1.1rem;
  margin-bottom: 12px;
}

.brand-copy {
  display: grid;
  gap: 4px;
}

.brand-copy span {
  color: rgba(249, 241, 232, 0.72);
  font-size: 0.92rem;
}

.nav {
  display: grid;
  gap: 8px;
  align-content: start;
}

.nav-link {
  text-decoration: none;
  padding: 12px 14px;
  border-radius: 14px;
  color: rgba(249, 241, 232, 0.76);
  background: transparent;
}

.nav-link.active,
.nav-link:hover {
  color: #fff7f0;
  background: rgba(255,255,255,0.08);
}

.sidebar-footer {
  display: grid;
  gap: 10px;
}

.role-chip,
.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  padding: 7px 11px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.role-chip {
  background: rgba(214,169,79,0.18);
  color: #f6d79b;
}

.pill {
  background: rgba(15, 118, 110, 0.12);
  color: var(--teal);
}

.sidebar-email {
  color: rgba(249, 241, 232, 0.76);
  overflow-wrap: anywhere;
}

.content {
  padding: 32px;
  display: grid;
  align-content: start;
  gap: 22px;
}

.page-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: start;
}

.page-header h1 {
  margin: 6px 0 8px;
  font-size: clamp(1.9rem, 3vw, 2.5rem);
}

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

.toolbar,
.cards-grid,
.panel-grid,
.form-grid {
  display: grid;
  gap: 16px;
}

.toolbar {
  grid-template-columns: repeat(5, minmax(140px, 1fr));
}

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

.compact-cards {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

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

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

.span-2 {
  grid-column: span 2;
}

.panel,
.metric-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.panel {
  padding: 22px;
}

.metric-card {
  padding: 20px;
  display: grid;
  gap: 8px;
}

.metric-card span,
.metric-card small {
  color: var(--muted);
}

.metric-card strong {
  font-size: 1.9rem;
}

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

.panel-head h2 {
  margin: 0;
  font-size: 1.2rem;
}

.table-wrap {
  overflow: auto;
  border-radius: 16px;
  border: 1px solid rgba(71, 52, 28, 0.08);
}

table {
  width: 100%;
  min-width: 840px;
  border-collapse: collapse;
  background: rgba(255,255,255,0.55);
}

th,
td {
  padding: 14px 12px;
  text-align: left;
  border-bottom: 1px solid rgba(71, 52, 28, 0.08);
  vertical-align: top;
}

th {
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--muted);
}

.status-badge,
.warning-chip {
  display: inline-flex;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
}

.status-completed {
  background: rgba(47, 110, 73, 0.12);
  color: var(--green);
}

.status-pending,
.status-scheduled {
  background: rgba(214, 169, 79, 0.18);
  color: #8a651f;
}

.status-cancelled {
  background: rgba(194, 65, 12, 0.12);
  color: var(--red);
}

.warning-chip {
  background: rgba(181, 93, 46, 0.12);
  color: var(--primary-deep);
  margin: 0 6px 6px 0;
}

.insight-card {
  border: 1px solid rgba(15, 118, 110, 0.12);
  background: rgba(250, 255, 253, 0.9);
  border-radius: 16px;
  padding: 14px 16px;
}

.insight-card strong {
  display: block;
  margin-bottom: 6px;
}

.text-link {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}

.text-link:hover {
  text-decoration: underline;
}

.empty-state {
  padding: 18px;
  border-radius: 16px;
  background: rgba(255,255,255,0.55);
  color: var(--muted);
}

.positive {
  color: var(--green);
}

.negative {
  color: var(--red);
}

@media (max-width: 1100px) {
  .toolbar,
  .cards-grid,
  .compact-cards,
  .panel-grid {
    grid-template-columns: 1fr 1fr;
  }
}

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

  .sidebar {
    position: static;
    height: auto;
    grid-template-rows: auto;
  }

  .toolbar,
  .cards-grid,
  .compact-cards,
  .panel-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .span-2 {
    grid-column: span 1;
  }

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

  .content {
    padding: 18px;
  }
}
