/* ---------- CSS Reset (lightweight) ---------- */
*,
*::before,
*::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
img, svg { display: block; max-width: 100%; }

/* ---------- Theme ---------- */
:root{
  --bg: #0b0c0f;
  --panel: #14161b;
  --panel-2: #1b1e24;
  --text: #e9ecf1;
  --muted: #9aa3af;
  --link: #8ab4ff;
  --border: #2a2f37;

  --accent: #8ab4ff;
  --success-bg: #0e3b1e;
  --success-fg: #9af0c0;
  --wip-bg: #3a2e0a;
  --wip-fg: #ffdf8a;
  --planned-bg: #1a1f2a;
  --planned-fg: #b8c4ff;

  --radius: 12px;
  --shadow: 0 6px 24px rgba(0,0,0,.25);
}

@media (prefers-color-scheme: light) {
  :root{
    --bg: #f7f9fb;
    --panel: #ffffff;
    --panel-2: #fafafa;
    --text: #0f172a;
    --muted: #5b6470;
    --link: #1e66ff;
    --border: #e6e9ef;

    --success-bg: #eafdf3;
    --success-fg: #0f7b45;
    --wip-bg: #fff7e6;
    --wip-fg: #925b00;
    --planned-bg: #eef2ff;
    --planned-fg: #364fc7;
  }
}

/* ---------- Base ---------- */
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, "Helvetica Neue", Arial, "Noto Sans", "Apple Color Emoji", "Segoe UI Emoji";
}

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Layout ---------- */
main {
  max-width: 1100px;
  margin: 28px auto;
  padding: 0 16px;
}

nav {
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}

nav ul {
  margin: 0;
  padding: 0 16px;
  display: flex;
  gap: 16px;
  list-style: none;
  align-items: center;
  min-height: 54px;
}

nav a {
  display: inline-block;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--text);
}
nav a:hover {
  background: var(--panel-2);
  text-decoration: none;
}

/* ---------- Admin Landing ---------- */
.admin-landing__header {
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.admin-landing__header h1 {
  margin: 0;
  font-size: 24px;
  letter-spacing: 0.2px;
}

.admin-search {
  display: flex;
  align-items: center;
  min-width: 260px;
}
.admin-search input[type="search"]{
  width: 100%;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
  box-shadow: inset 0 0 0 1px transparent;
}
.admin-search input[type="search"]::placeholder { color: var(--muted); }
.admin-search input[type="search"]:focus{
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent);
}

/* HTMX loading state: dim list while fetching */
.htmx-request #admin-groups,
.admin-search.htmx-request input[type="search"] {
  opacity: .6;
}
/* single item */
	.admin-form {
				background: var(--panel);
				border: 1px solid var(--border);
				border-radius: var(--radius);
				box-shadow: var(--shadow);
				max-width: 800px;
				margin: 0 auto;
			}

			.admin-form__header {
				padding: 20px 24px;
				border-bottom: 1px solid var(--border);
				background: var(--panel-2);
				border-top-left-radius: var(--radius);
				border-top-right-radius: var(--radius);
			}

			.admin-form__header h1 {
				margin: 0 0 4px 0;
				font-size: 24px;
				letter-spacing: 0.2px;
			}

			.admin-form__meta {
				margin: 0;
				color: var(--muted);
				font-size: 14px;
			}

			.admin-form__body {
				padding: 24px;
			}

			/* ---------- Form Elements ---------- */
			.form-group {
				margin-bottom: 20px;
			}

			.form-label {
				display: block;
				margin-bottom: 6px;
				font-weight: 600;
				font-size: 14px;
				color: var(--text);
			}

			.form-input {
				width: 100%;
				background: var(--bg);
				color: var(--text);
				border: 1px solid var(--border);
				border-radius: 10px;
				padding: 10px 12px;
				font-size: 15px;
				font-family: inherit;
				outline: none;
				transition: border-color .15s ease, box-shadow .15s ease;
			}

			.form-input::placeholder {
				color: var(--muted);
			}

			.form-input:focus {
				border-color: var(--accent);
				box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent);
			}

			textarea.form-input {
				resize: vertical;
				min-height: 80px;
			}

			.form-checkbox {
				display: flex;
				align-items: center;
				gap: 8px;
				cursor: pointer;
				user-select: none;
			}

			.form-checkbox input[type="checkbox"] {
				width: 18px;
				height: 18px;
				cursor: pointer;
				accent-color: var(--accent);
			}

			.form-grid {
				display: grid;
				grid-template-columns: 1fr 1fr;
				gap: 16px;
				margin-bottom: 20px;
			}

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

			/* ---------- Form Actions ---------- */
			.form-actions {
				display: flex;
				gap: 12px;
				padding-top: 8px;
				border-top: 1px solid var(--border);
			}

			.btn {
				display: inline-flex;
				align-items: center;
				justify-content: center;
				padding: 10px 20px;
				border-radius: 10px;
				font-size: 15px;
				font-weight: 600;
				text-decoration: none;
				cursor: pointer;
				border: 1px solid var(--border);
				transition: all .15s ease;
				font-family: inherit;
			}

			.btn--primary {
				background: var(--accent);
				color: var(--bg);
				border-color: var(--accent);
			}

			.btn--primary:hover {
				background: color-mix(in srgb, var(--accent) 85%, black);
				border-color: color-mix(in srgb, var(--accent) 85%, black);
				text-decoration: none;
			}

			.btn--secondary {
				background: var(--panel-2);
				color: var(--text);
			}

			.btn--secondary:hover {
				background: var(--bg);
				text-decoration: none;
			}

/* ---------- Groups & Model List ---------- */
.admin-group {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.admin-group__header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--panel-2);
  border-top-left-radius: var(--radius);
  border-top-right-radius: var(--radius);
}
.admin-group__header h2 {
  margin: 0;
  font-size: 16px;
  letter-spacing: .3px;
}

.admin-model-list {
  list-style: none;
  margin: 0;
  padding: 8px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 8px;
}

.admin-model-item {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: linear-gradient(0deg, var(--panel), var(--panel));
  display: grid;
  gap: 6px;
  transition: transform .08s ease, border-color .15s ease, background-color .15s ease;
}
.admin-model-item:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
}

.admin-model-item__main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.admin-model-item__link {
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
}
.admin-model-item__link:hover { color: var(--link); }

.admin-model-item__desc {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

/* ---------- Badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--border);
  text-transform: capitalize; /* planned → Planned */
  line-height: 1.6;
}

.badge--done {
  background: var(--success-bg);
  color: var(--success-fg);
  border-color: color-mix(in srgb, var(--success-fg) 25%, var(--border));
}

.badge--wip {
  background: var(--wip-bg);
  color: var(--wip-fg);
  border-color: color-mix(in srgb, var(--wip-fg) 25%, var(--border));
}

.badge--planned {
  background: var(--planned-bg);
  color: var(--planned-fg);
  border-color: color-mix(in srgb, var(--planned-fg) 25%, var(--border));
}

/* ---------- Footer ---------- */
footer {
  max-width: 1100px;
  margin: 32px auto 24px;
  padding: 0 16px;
  color: var(--muted);
  font-size: 13px;
}

/* ---------- Utilities ---------- */
.hidden { display: none !important; }

/* Focus ring for keyboard users */
:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 50%, transparent);
  outline-offset: 2px;
}

/* ---------- Small screens ---------- */
@media (max-width: 720px) {
  .admin-landing__header {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
}

/* ---------- Containers ---------- */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 16px;
}

/* ---------- Top Navigation ---------- */
.topnav {
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 60;
}
.topnav__inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  min-height: 56px;
  gap: 12px;
}
.topnav__brand { display: flex; align-items: center; gap: 10px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); }
.brand__logo { border-radius: 6px; }
.brand__name { font-weight: 700; letter-spacing: .2px; }

.topnav__links {
  list-style: none;
  display: inline-flex;
  gap: 10px;
  margin: 0; padding: 0;
  justify-self: center;
}
.topnav__links a {
  display: inline-block;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
}
.topnav__links a:hover { background: var(--panel-2); text-decoration: none; }
.topnav__links a.is-active { background: var(--panel-2); box-shadow: inset 0 0 0 1px var(--border); }

.topnav__actions {
  justify-self: end;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.nav-search {
  display: inline-flex; align-items: center;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 4px 8px;
}
.nav-search input[type="search"]{
  background: transparent; border: 0; outline: none;
  color: var(--text);
  width: 200px;
}
.nav-search input::placeholder { color: var(--muted); }

.icon-btn {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 6px 10px;
  border-radius: 10px;
  cursor: pointer;
}
.icon-btn:hover { background: var(--panel); }

.avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  transition: all .15s ease;
  font-family: inherit;
}

.btn:hover {
  background: var(--bg);
  text-decoration: none;
  transform: translateY(-1px);
}

.btn--primary {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}

.btn--primary:hover {
  background: color-mix(in srgb, var(--accent) 85%, black);
  border-color: color-mix(in srgb, var(--accent) 85%, black);
}

/* ---------- Footer ---------- */
.site-footer {
  background: var(--panel);
  border-top: 1px solid var(--border);
  margin-top: 36px;
}
.site-footer__inner { padding: 24px 0; }
.footer-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(4, minmax(0,1fr));
}
.footer-grid h4 { margin: 0 0 8px 0; font-size: 14px; letter-spacing: .2px; }
.footer-grid ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.footer-grid a { color: var(--text); }
.footer-grid a:hover { color: var(--link); text-decoration: none; }
.muted { color: var(--muted); }

@media (max-width: 860px) {
  .topnav__inner { grid-template-columns: 1fr auto; }
  .topnav__links { display: none; } /* collapse links on small screens */
  .nav-search input[type="search"]{ width: 140px; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 520px) {
  .footer-grid { grid-template-columns: 1fr; }
}

/* ------------------- util classes ------------- */
.flex-container {
  display : flex;
  /* justify-content: center; */
  align-items: center;
  gap:4;
}
