@import url("/partials/ui-tokens.css?v=b73f220");

:root {
  color-scheme: light;
  --ink: #111118;
  --paper: #f7f1e6;
  --sand: #efe3d2;
  --terra: #d88f6a;
  --sage: #5e7c73;
  --charcoal: #1d232b;
  --fog: rgba(255, 255, 255, 0.6);
  --shadow: 0 24px 60px rgba(15, 20, 28, 0.16);
  --radius-xl: 26px;
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at top, #fff1d6 0%, #f2e6d5 40%, #e3d6c5 80%);
  color: var(--ink);
  font-family: "Avenir Next", "Gill Sans", "Segoe UI", sans-serif;
}

.page {
  display: grid;
  gap: 0.8rem;
  padding: 0.9rem clamp(0.8rem, 2.5vw, 1.6rem);
}

.groups-shell {
  max-width: 600px;
  margin: 0 auto;
  width: 100%;
}

.groups-panel {
  background: #fff8ef;
  border-radius: var(--radius-xl);
  padding: 1.4rem;
  border: 1px solid #ecdcc7;
  box-shadow: var(--shadow);
}

.groups-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.groups-header h2 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 600;
}

.groups-loading,
.groups-empty {
  text-align: center;
  padding: 2rem 1rem;
  color: #7b6f63;
  font-size: 0.95rem;
}

.group-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0.7rem 0.9rem;
  border: 1px solid #e6d4bc;
  border-radius: var(--radius-md);
  background: #fff;
  cursor: pointer;
  font-size: 0.95rem;
  transition: background 0.15s ease, border-color 0.15s ease;
  margin-bottom: 0.5rem;
  text-align: left;
}

.group-item:hover {
  background: #fdf4e8;
  border-color: var(--terra);
}

.group-item-name {
  font-weight: 500;
  color: var(--ink);
}

.group-item-meta {
  font-size: 0.8rem;
  color: #7b6f63;
}

/* Detail view */
.detail-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1.2rem;
}

.detail-header h2 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 600;
  flex: 1;
}

.detail-section {
  margin-bottom: 1.2rem;
}

.detail-section h3 {
  margin: 0 0 0.5rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: #5a4c40;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.member-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.45rem 0.6rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
}

.member-item:nth-child(odd) {
  background: rgba(239, 227, 210, 0.3);
}

.member-name {
  font-weight: 500;
}

.member-role {
  font-size: 0.8rem;
  color: #7b6f63;
}

/* Form rows */
.form-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.7rem;
}

.form-row input[type="text"] {
  flex: 1;
  border: 1px solid #e6d4bc;
  border-radius: var(--radius-md);
  padding: 0.5rem 0.7rem;
  background: #fff;
  font-size: 0.9rem;
}

.form-row input[type="text"]:focus {
  outline: none;
  border-color: var(--terra);
}

.form-status {
  font-size: 0.8rem;
  color: #7b6f63;
  min-height: 1.2em;
  margin-bottom: 0.5rem;
}

/* Buttons */
.primary-button {
  border: none;
  padding: 0.45rem 1rem;
  border-radius: 999px;
  background: var(--charcoal);
  color: #fff8ef;
  cursor: pointer;
  font-size: 0.85rem;
  transition: box-shadow 0.2s ease;
}

.primary-button:hover {
  box-shadow: 0 10px 20px rgba(24, 33, 44, 0.2);
}

.primary-button:disabled {
  opacity: 0.5;
  cursor: default;
}

.ghost-button {
  border: none;
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  background: #f1e3cf;
  color: #5a4c40;
  cursor: pointer;
  font-size: 0.85rem;
  transition: background 0.2s ease, color 0.2s ease;
}

.ghost-button:hover {
  background: #e6d4bc;
  color: #3f342b;
}

.danger-button {
  border: none;
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  background: #e8c4c4;
  color: #7a2e2e;
  cursor: pointer;
  font-size: 0.85rem;
  transition: background 0.2s ease;
}

.danger-button:hover {
  background: #dda8a8;
}

.detail-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.back-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  padding: 0.2rem 0.4rem;
  color: #5a4c40;
}

.back-btn:hover {
  color: var(--ink);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

@media (max-width: 640px) {
  .page {
    padding: 0.9rem clamp(0.5rem, 3vw, 1rem);
  }

  .groups-panel {
    padding: 1rem;
  }
}
