:root {
  --bg: #f6f2ea;
  --panel: #ffffff;
  --ink: #1e1b16;
  --muted: #6e655a;
  --accent: #d9a441;
  --accent-2: #1c7d6f;
  --line: #eee4d6;
  --shadow: 0 10px 30px rgba(25, 20, 15, 0.08);
  --radius-lg: 18px;
  --radius-md: 14px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  color: var(--ink);
  background: radial-gradient(1200px 500px at 15% -10%, #f9e6c5 0%, transparent 60%),
    radial-gradient(1000px 600px at 95% 10%, #cfe9e4 0%, transparent 55%),
    var(--bg);
  min-height: 100vh;
}

.hidden {
  display: none !important;
}

.layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

.sidebar {
  padding: 28px 22px;
  background: linear-gradient(180deg, #fff7e6 0%, #fff 100%);
  border-right: 1px solid var(--line);
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 32px;
}

.brand-badge {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: linear-gradient(135deg, #e7b958 0%, #d48a2a 100%);
  box-shadow: var(--shadow);
  display: grid;
  place-items: center;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.5px;
}

.brand h1 {
  font-family: "Playfair Display", serif;
  font-size: 22px;
  margin: 0;
}

.brand span {
  display: block;
  font-size: 12px;
  color: var(--muted);
}

.menu {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.menu a {
  text-decoration: none;
  color: var(--ink);
  padding: 10px 14px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: transparent;
  transition: transform 0.2s ease, background 0.2s ease;
}

.menu a.active {
  background: #fff2d6;
  font-weight: 600;
  border: 1px solid #f2ddba;
}

.menu a:hover {
  transform: translateX(4px);
  background: #fff6e6;
}

.menu-group {
  display: flex;
  flex-direction: column;
}

.menu-toggle {
  text-decoration: none;
  color: var(--ink);
  padding: 10px 14px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: transparent;
  border: none;
  font-size: 1rem;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease;
}

.menu-toggle:hover {
  transform: translateX(4px);
  background: #fff6e6;
}

.menu-toggle.active {
  background: #fff2d6;
  font-weight: 600;
  border: 1px solid #f2ddba;
}

.menu-arrow {
  display: inline-block;
  transition: transform 0.3s;
}

.menu-toggle.active .menu-arrow {
  transform: rotate(90deg);
}

.submenu {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.submenu.open {
  max-height: 500px;
}

.submenu a {
  padding: 8px 14px 8px 28px;
  font-size: 0.95rem;
}

.submenu a.active {
  background: #fff2d6;
  font-weight: 600;
  border: 1px solid #f2ddba;
}

.sidebar-card {
  margin-top: 26px;
  padding: 16px;
  border-radius: 16px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.sidebar-card h3 {
  margin: 0 0 8px;
  font-size: 14px;
}

.sidebar-card p {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

.content {
  padding: 28px 36px 40px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.greeting h2 {
  margin: 0 0 6px;
  font-size: 26px;
}

.greeting p {
  margin: 0;
  color: var(--muted);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.pill {
  border: 1px solid var(--line);
  background: #fff;
  padding: 10px 14px;
  border-radius: 999px;
  font-size: 13px;
  color: var(--muted);
}

.primary-btn {
  border: none;
  background: var(--accent-2);
  color: #fff;
  padding: 12px 18px;
  border-radius: 999px;
  font-size: 13px;
  cursor: pointer;
  box-shadow: var(--shadow);
}

.grid {
  margin-top: 28px;
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 18px;
}

.card {
  background: var(--panel);
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 18px;
  animation: floatIn 0.6s ease both;
}

.card h3 {
  margin: 0 0 12px;
  font-size: 16px;
}

.stat {
  font-size: 26px;
  font-weight: 700;
}

.muted {
  color: var(--muted);
  font-size: 12px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: #f0f8f6;
  color: #1c7d6f;
  font-size: 12px;
  font-weight: 600;
}

.progress {
  height: 8px;
  background: #f4efe6;
  border-radius: 999px;
  overflow: hidden;
  margin-top: 12px;
}

.progress span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #e0b157, #d4872d);
  border-radius: inherit;
}

.ring-wrap {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.ring {
  padding: 12px;
  border: 1px dashed #f2ddba;
  border-radius: 14px;
  text-align: center;
}

.ring strong {
  display: block;
  font-size: 18px;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.table th,
.table td {
  text-align: left;
  padding: 10px 6px;
  border-bottom: 1px solid var(--line);
}

.table th {
  color: var(--muted);
  font-weight: 500;
}

.activity {
  display: grid;
  gap: 10px;
}

.activity-item {
  padding: 12px;
  border-radius: 12px;
  background: #fff8ea;
  border: 1px solid #f3e4c8;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(20, 16, 12, 0.45);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 50;
  backdrop-filter: blur(6px);
}

.modal.is-open {
  display: flex;
}

.modal-dialog {
  width: min(720px, 100%);
  background: #fff;
  border-radius: 20px;
  border: 1px solid var(--line);
  box-shadow: 0 18px 40px rgba(22, 18, 14, 0.2);
  padding: 22px;
  animation: floatIn 0.4s ease both;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.modal-title {
  margin: 0;
  font-size: 18px;
}

.ghost-btn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 12px;
  cursor: pointer;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin-top: 8px;
}

.form-field {
  display: grid;
  gap: 6px;
  font-size: 13px;
}

.form-field label {
  font-weight: 600;
}

.form-field input,
.form-field textarea {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 13px;
  font-family: inherit;
  background: #fffaf1;
}

.form-field textarea {
  resize: vertical;
  min-height: 80px;
}

.form-actions {
  margin-top: 18px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

@keyframes floatIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1024px) {
  .layout {
    grid-template-columns: 220px 1fr;
  }
}

@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: relative;
    height: auto;
  }

  .content {
    padding: 24px;
  }

  .grid {
    grid-template-columns: repeat(6, 1fr);
  }
}

@media (max-width: 600px) {
  .content {
    padding: 20px;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .grid {
    grid-template-columns: 1fr;
  }

  .ring-wrap {
    grid-template-columns: 1fr;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }
}

/* Modal Form Fields Visibility */
.modal .form-field {
  display: block !important;
}

.modal .form-field.edit-only {
  display: none !important;
}

.modal .form-field input,
.modal .form-field textarea,
.modal .form-field select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-family: inherit;
  font-size: 1rem;
}

.modal-dialog {
  max-height: 85vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.modal-header {
  flex-shrink: 0;
  padding: 20px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  position: sticky;
  top: 0;
  z-index: 1;
}

.modal-dialog > form {
  flex-shrink: 0;
  padding: 20px;
  overflow-y: auto;
}

.form-actions {
  flex-shrink: 0;
  padding: 16px 20px;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  background: var(--panel);
  position: sticky;
  bottom: 0;
  z-index: 1;
}

/* Filter Toggle Buttons */
.filter-toggle {
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
}

.filter-toggle:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.filter-toggle.active {
  box-shadow: 0 4px 12px rgba(217, 164, 65, 0.3);
}

.filter-toggle:not(.active):hover {
  background: #fff6e6 !important;
  color: var(--accent) !important;
}

/* Icon Button Styles */
.icon-btn {
  background: transparent;
  border: none;
  font-size: 18px;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.icon-btn:hover {
  background: var(--line);
  transform: scale(1.1);
}

.icon-btn.danger:hover {
  background: #ffebee;
}

.action-group {
  display: flex;
  gap: 4px;
  justify-content: center;
}
