:root {
  --bg-a: #fdf5e8;
  --bg-b: #f4ddd4;
  --ink: #172121;
  --muted: #5f6a6a;
  --brand: #e36544;
  --brand-dark: #b9472d;
  --panel: #fffef9;
  --line: #e6d8cf;
  --ok: #1f8a70;
  --danger: #b42318;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Manrope", sans-serif;
  background: radial-gradient(circle at 80% 10%, #ffffff 0%, transparent 45%),
              linear-gradient(130deg, var(--bg-a), var(--bg-b));
}

h1, h2, h3 {
  font-family: "Space Grotesk", sans-serif;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.25rem;
}

.auth-card {
  width: min(460px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: 0 14px 36px rgba(23, 33, 33, 0.12);
}

.auth-form {
  display: grid;
  gap: 0.6rem;
}

.role-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 1rem;
  margin: 0;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.role-options legend {
  padding: 0 0.25rem;
  font-weight: 700;
}

.role-options label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.role-options input {
  margin: 0;
  padding: 0;
}

input, button {
  border-radius: 10px;
  border: 1px solid var(--line);
  padding: 0.7rem 0.8rem;
  font: inherit;
}

button {
  border: none;
  background: var(--brand);
  color: white;
  font-weight: 700;
  cursor: pointer;
}

button:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.form-error {
  color: var(--danger);
  min-height: 1.25rem;
}

.form-success {
  color: var(--ok);
  min-height: 1.25rem;
}

.dashboard-shell {
  display: grid;
  grid-template-columns: 250px 1fr;
  min-height: 100vh;
}

.sidebar {
  padding: 1.4rem;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.62);
  backdrop-filter: blur(3px);
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar nav {
  display: grid;
  gap: 0.5rem;
}

.sidebar a {
  text-decoration: none;
  color: var(--muted);
  font-weight: 700;
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
}

.sidebar a.active,
.sidebar a:hover {
  color: var(--ink);
  background: #fff1e8;
}

.dashboard-main {
  padding: 1.4rem;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.profile-box {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.6rem 0.8rem;
}

.card {
  margin-top: 1rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1rem;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.section-heading h3,
.section-heading p {
  margin: 0;
}

.section-heading p {
  margin-top: 0.35rem;
  color: var(--muted);
}

.user-table-wrap {
  overflow-x: auto;
}

.user-table {
  width: 100%;
  min-width: 620px;
  margin-top: 1rem;
  border-collapse: collapse;
  text-align: left;
}

.user-table th,
.user-table td {
  padding: 0.75rem;
  border-bottom: 1px solid var(--line);
}

.user-table th {
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
}

.user-table select {
  min-width: 110px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.5rem;
  font: inherit;
}

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

.user-actions button {
  padding: 0.5rem 0.65rem;
}

.delete-button {
  background: var(--danger);
}

#item-form {
  display: grid;
  grid-template-columns: minmax(180px, 0.35fr) minmax(240px, 1fr);
  gap: 0.75rem;
}

#item-form label {
  align-self: center;
  font-weight: 700;
}

#item-form textarea {
  min-height: 100px;
  resize: vertical;
}

#item-form button {
  grid-column: 2;
  justify-self: start;
}

.items-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.8rem;
}

.item-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.8rem;
  background: white;
}

.item-card p {
  margin: 0.4rem 0;
}

.loading-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 1fr));
  gap: 0.8rem;
}

.skeleton {
  height: 74px;
  border-radius: 12px;
  background: linear-gradient(90deg, #efe4da 0%, #fff5ee 50%, #efe4da 100%);
  background-size: 200% 100%;
  animation: pulse 1.15s infinite linear;
}

.error-banner {
  margin-top: 1rem;
  background: #fee4e2;
  color: var(--danger);
  border: 1px solid #fecdca;
  border-radius: 10px;
  padding: 0.7rem;
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 1rem;
  color: var(--muted);
}

.hidden {
  display: none;
}

@keyframes pulse {
  from { background-position: 0% 0%; }
  to { background-position: 200% 0%; }
}

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

  .sidebar {
    position: static;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--line);
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  #item-form {
    grid-template-columns: 1fr;
  }

  #item-form button {
    grid-column: auto;
  }
}
