:root {
  --ink: #102f2a;
  --ink-2: #1c4941;
  --paper: #f4f7ee;
  --white: #ffffff;
  --lime: #e8ff77;
  --coral: #ff6e49;
  --muted: #60746f;
  --line: #d8e0da;
  --shadow: 0 22px 70px rgba(16, 47, 42, .12);
  --radius: 24px;
  --max: 1180px;
  --sidebar-width: 260px;
  --topbar-height: 72px;
}

* { box-sizing: border-box; }

html { overflow-x: clip; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.65;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
}

img, svg { display: block; max-width: 100%; }
a { color: inherit; }
button, input, textarea, select { font: inherit; }

.container {
  width: min(calc(100% - 40px), var(--max));
  margin-inline: auto;
}

.skip-link {
  position: fixed;
  left: 16px;
  top: -60px;
  z-index: 100;
  background: var(--lime);
  padding: 12px 16px;
  border-radius: 10px;
  font-weight: 800;
  text-decoration: none;
}

.skip-link:focus { top: 16px; }

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: var(--ink);
  color: var(--white);
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  z-index: 50;
}

.sidebar-brand {
  color: var(--white);
  padding: 4px 8px;
}

.sidebar-brand img {
  width: 40px;
  height: 40px;
}

.sidebar-nav {
  display: grid;
  gap: 6px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  min-height: 46px;
  padding: 10px 14px;
  border-radius: 14px;
  text-decoration: none;
  font-weight: 750;
  color: #c7d6d1;
}

.sidebar-link:hover {
  background: rgba(255, 255, 255, .06);
  color: var(--white);
}

.sidebar-link.is-active {
  background: var(--lime);
  color: var(--ink);
}

.sidebar-backdrop {
  display: none;
}

.app-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  min-height: var(--topbar-height);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 28px;
  background: rgba(244, 247, 238, .92);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(16, 47, 42, .08);
}

.topbar-title {
  flex: 1;
  min-width: 0;
}

.topbar-title .eyebrow {
  margin: 0 0 4px;
}

.topbar-title h1 {
  font-size: clamp(1.35rem, 2.4vw, 1.85rem);
  max-width: none;
}

.menu-toggle {
  display: none;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 12px;
  background: var(--ink);
  color: white;
  padding: 12px 11px;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
}

.menu-toggle span {
  display: block;
  height: 2px;
  background: white;
  border-radius: 2px;
}

.avatar-menu {
  position: relative;
  margin-left: auto;
}

.avatar-button {
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
}

.avatar-circle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--lime);
  color: var(--ink);
  font-weight: 900;
  letter-spacing: -.03em;
  box-shadow: 0 8px 20px rgba(16, 47, 42, .12);
}

.avatar-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  width: min(260px, calc(100vw - 32px));
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 10px;
  display: grid;
  gap: 4px;
  z-index: 60;
}

.avatar-dropdown[hidden] {
  display: none !important;
}

.avatar-meta {
  display: grid;
  gap: 2px;
  padding: 10px 12px 12px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 4px;
}

.avatar-meta strong {
  font-weight: 850;
  letter-spacing: -.02em;
}

.avatar-meta span {
  color: var(--muted);
  font-size: .9rem;
  font-weight: 650;
}

.avatar-dropdown a,
.avatar-dropdown button {
  display: flex;
  width: 100%;
  align-items: center;
  min-height: 42px;
  padding: 8px 12px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--ink);
  text-decoration: none;
  font-weight: 750;
  cursor: pointer;
  text-align: left;
}

.avatar-dropdown a:hover,
.avatar-dropdown button:hover {
  background: #eef3ee;
}

.page-inner {
  width: min(calc(100% - 56px), 1180px);
  margin-inline: auto;
  padding: 32px 0 72px;
}

.auth-wrap .page {
  padding: 48px 0 88px;
}

.auth-header .nav {
  min-height: 78px;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(244, 247, 238, .92);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(16, 47, 42, .08);
  padding-top: env(safe-area-inset-top, 0px);
}

.nav {
  min-height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  font-weight: 900;
  letter-spacing: -.03em;
  font-size: 1.25rem;
}

.brand img {
  width: 40px;
  height: 40px;
}

.page {
  padding: 0;
}

.messages {
  list-style: none;
  padding: 0;
  margin: 0 0 24px;
  display: grid;
  gap: 10px;
}

.note {
  padding: 18px 20px;
  background: #e4ebe5;
  border-left: 5px solid var(--coral);
  border-radius: 12px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 11px;
  background: #e1e9e2;
  border-radius: 999px;
  font-size: .84rem;
  font-weight: 850;
  letter-spacing: .02em;
  text-transform: uppercase;
  margin: 0 0 18px;
}

.eyebrow::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--coral);
}

h1, h2, h3 {
  margin: 0;
  line-height: 1.08;
  letter-spacing: -.04em;
}

h1 {
  font-size: clamp(2.4rem, 5vw, 4.2rem);
  max-width: 900px;
}

.lead {
  font-size: clamp(1.08rem, 1.7vw, 1.28rem);
  color: #425a54;
  max-width: 690px;
  margin: 18px 0 0;
}

.btn {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 9px;
  min-height: 50px;
  padding: 12px 19px;
  border-radius: 14px;
  text-decoration: none;
  font-weight: 850;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
  background: transparent;
  color: var(--ink);
}

.btn:hover { transform: translateY(-2px); }

.btn-primary {
  background: var(--ink);
  color: var(--white);
  box-shadow: 0 12px 28px rgba(16, 47, 42, .18);
}

.btn-outline {
  border-color: var(--ink);
  color: var(--ink);
  background: transparent;
}

.btn-small {
  min-height: 42px;
  padding: 9px 14px;
}

.card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: 0 10px 30px rgba(16, 47, 42, .05);
}

.greeting-card {
  margin-top: 8px;
  padding: 36px 32px;
}

.auth-panel {
  max-width: 480px;
  margin: 12px auto 0;
}

.form-card {
  margin-top: 28px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 26px;
  padding: 28px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 18px;
}

.field {
  display: grid;
  gap: 8px;
  font-weight: 750;
}

.field span { color: var(--ink); }

.field input {
  width: 100%;
  min-height: 50px;
  padding: 12px 14px;
  border: 1px solid #b8c6c0;
  border-radius: 12px;
  background: #fafcf8;
  color: var(--ink);
  font-size: 16px;
}

.field input:focus {
  outline: 2px solid var(--lime);
  outline-offset: 1px;
  border-color: var(--ink);
}

.form-errors {
  padding: 14px 16px;
  background: #fff1ec;
  border-left: 5px solid var(--coral);
  border-radius: 12px;
  color: #1c211e;
}

.form-errors p { margin: 0; }

.field-error {
  color: var(--coral);
  font-weight: 700;
  font-size: .92rem;
}

.form-card .btn-primary {
  margin-top: 4px;
}

.auth-panel .form-card .btn-primary {
  width: 100%;
}

.btn-lime {
  background: var(--lime);
  color: var(--ink);
}

.page-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.page-head-compact {
  align-items: center;
  margin-bottom: 22px;
}

.page-head h1 { margin: 0; }

.form-section { max-width: 560px; }
.form-section-wide { max-width: 720px; }

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 6px;
}

.field select,
.field textarea {
  width: 100%;
  min-height: 50px;
  padding: 12px 14px;
  border: 1px solid #b8c6c0;
  border-radius: 12px;
  background: #fafcf8;
  color: var(--ink);
  font-size: 16px;
}

.field textarea {
  min-height: 110px;
  resize: vertical;
}

.field select:focus,
.field textarea:focus {
  outline: 2px solid var(--lime);
  outline-offset: 1px;
  border-color: var(--ink);
}

.check-field {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 750;
  cursor: pointer;
}

.check-field input {
  width: 18px;
  height: 18px;
  accent-color: var(--ink);
}

.field-hint {
  margin: -6px 0 0;
  color: var(--muted);
  font-size: .92rem;
  font-weight: 650;
}

.text-link {
  color: var(--ink);
  font-weight: 850;
  text-underline-offset: 3px;
}

.list-card {
  padding: 0;
  overflow: hidden;
}

.list-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 24px 16px;
}

.list-card-head h2 {
  font-size: 1.25rem;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

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

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

.data-table th {
  background: var(--ink);
  color: white;
  font-weight: 800;
  font-size: .92rem;
  white-space: nowrap;
}

.data-table th a {
  color: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.data-table th a:hover {
  color: var(--lime);
}

.data-table .sort-indicator {
  opacity: .55;
  font-size: .8rem;
}

.data-table .sort-indicator.is-active {
  opacity: 1;
  color: var(--lime);
}

.data-table tbody tr:hover td {
  background: #f7faf4;
}

.data-table tr:last-child td { border-bottom: 0; }

.data-table a {
  font-weight: 800;
  text-underline-offset: 3px;
}

.col-actions { text-align: right; white-space: nowrap; }

.table-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 22px;
  border-top: 1px solid var(--line);
  background: #fafcf8;
}

.table-footer-meta {
  color: var(--muted);
  font-weight: 650;
  font-size: .92rem;
}

.pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pagination a,
.pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  min-height: 38px;
  padding: 6px 10px;
  border-radius: 12px;
  text-decoration: none;
  font-weight: 800;
  border: 1px solid transparent;
}

.pagination a {
  border-color: var(--line);
  background: var(--white);
}

.pagination a:hover {
  border-color: var(--ink);
}

.pagination .is-current {
  background: var(--ink);
  color: var(--white);
}

.pagination .is-disabled {
  color: var(--muted);
  opacity: .55;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: .84rem;
  font-weight: 850;
  letter-spacing: .02em;
}

.badge-scheduled {
  background: #e1e9e2;
  color: var(--ink);
}

.badge-completed {
  background: var(--lime);
  color: var(--ink);
}

.badge-cancelled {
  background: #e4ebe5;
  color: var(--muted);
}

.empty-state {
  margin: 0;
  padding: 28px 24px 12px;
  color: var(--muted);
  font-weight: 650;
}

.list-card .hero-actions,
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 0 24px 24px;
}

.complete-card {
  margin-bottom: 22px;
  background: var(--ink);
  color: var(--white);
  border-color: transparent;
}

.complete-card h2 {
  font-size: 1.35rem;
}

.lead-sm {
  margin: 10px 0 0;
  color: #bfd1cc;
  max-width: 520px;
}

.complete-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  margin-top: 20px;
}

.complete-card .check-field { color: var(--white); }

.dashboard-home .page-head {
  margin-bottom: 22px;
}

.profile-grid {
  display: grid;
  gap: 22px;
  max-width: 640px;
}

.profile-grid .form-card {
  margin-top: 0;
}

.profile-grid h2 {
  font-size: 1.25rem;
  margin-bottom: 4px;
}

@media (prefers-reduced-motion: reduce) {
  .btn { transition: none; }
  .btn:hover { transform: none; }
}

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

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: min(var(--sidebar-width), 86vw);
    transform: translateX(-105%);
    transition: transform .2s ease;
  }

  body.sidebar-open .sidebar {
    transform: translateX(0);
  }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(16, 47, 42, .34);
    z-index: 45;
  }

  .menu-toggle {
    display: inline-flex;
  }

  .page-inner {
    width: min(calc(100% - 32px), 1180px);
    padding: 24px 0 56px;
  }

  .topbar {
    padding: 12px 16px;
  }
}

@media (max-width: 640px) {
  .container { width: min(calc(100% - 28px), var(--max)); }
  .auth-wrap .page { padding: 36px 0 56px; }
  .greeting-card { padding: 28px 22px; }
  .page-head h1 {
    font-size: clamp(2rem, 8vw, 3rem);
  }
  .topbar-title h1 {
    font-size: 1.2rem;
  }
}
