:root {
  --sand: #d6c9ab;
  --sand-light: #eee7d7;
  --paper: #fffdf8;
  --ink: #27251f;
  --muted: #6d675b;
  --line: #c5b895;
  --accent: #485642;
  --accent-dark: #34402f;
  --danger: #8a3f36;
  --shadow: 0 14px 38px rgba(54, 47, 32, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--sand);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(255,255,255,0.24), transparent 32rem),
    var(--sand);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

.page-shell {
  width: min(1120px, calc(100% - 28px));
  margin: 0 auto;
  padding: 34px 0 70px;
}

.login-card,
.panel,
.list-section {
  background: rgba(255, 253, 248, 0.96);
  border: 1px solid rgba(100, 85, 54, 0.18);
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.login-card {
  width: min(460px, 100%);
  margin: 10vh auto 0;
  padding: 38px;
}

.brand-mark {
  display: grid;
  width: 54px;
  height: 54px;
  margin-bottom: 22px;
  place-items: center;
  color: white;
  background: var(--accent);
  border-radius: 16px;
  font-size: 30px;
  font-weight: 800;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 10px;
  font-size: clamp(2rem, 5vw, 3.25rem);
  line-height: 1.02;
  letter-spacing: -0.045em;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(1.3rem, 3vw, 1.75rem);
  letter-spacing: -0.025em;
}

.eyebrow {
  margin-bottom: 7px;
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.intro {
  color: var(--muted);
  line-height: 1.6;
}

.stack {
  display: grid;
  gap: 11px;
  margin-top: 28px;
}

label {
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 750;
}

label span,
.required-note span {
  color: var(--danger);
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: none;
  background: white;
  color: var(--ink);
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

input {
  min-height: 48px;
  padding: 0 14px;
}

textarea {
  min-height: 92px;
  padding: 12px 14px;
  resize: vertical;
}

input:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(72, 86, 66, 0.13);
}

.primary-button,
.secondary-button,
.danger-button,
.text-button {
  border: 0;
  border-radius: 11px;
  font-weight: 800;
}

.primary-button {
  min-height: 47px;
  padding: 0 20px;
  color: white;
  background: var(--accent);
}

.primary-button:hover {
  background: var(--accent-dark);
}

.secondary-button {
  min-height: 40px;
  padding: 0 14px;
  color: var(--accent-dark);
  background: #e3eadf;
}

.danger-button {
  min-height: 40px;
  padding: 0 13px;
  color: var(--danger);
  background: #f5e5e2;
}

.text-button {
  padding: 10px 12px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.58);
}

.form-message {
  min-height: 1.3em;
  margin: 0;
  color: var(--danger);
  font-size: 0.9rem;
}

.form-message.success {
  color: var(--accent);
}

.app-view {
  display: grid;
  gap: 24px;
}

.app-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 10px 4px 2px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 9px;
}

.role-badge,
.count-badge {
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 850;
}

.role-badge {
  min-height: 39px;
  padding: 0 14px;
  color: white;
  background: var(--accent);
}

.count-badge {
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  color: var(--accent-dark);
  background: var(--sand-light);
}

.panel,
.list-section {
  padding: 24px;
}

.panel-heading,
.section-heading,
.form-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.required-note {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.item-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 23px;
}

.field {
  display: grid;
  gap: 7px;
}

.full-width {
  grid-column: 1 / -1;
}

.form-footer {
  align-items: flex-end;
}

.list-section {
  box-shadow: 0 8px 24px rgba(54, 47, 32, 0.08);
}

.item-list {
  display: grid;
  gap: 12px;
  margin-top: 20px;
}

.item-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  padding: 18px;
  border: 1px solid #ddd4bd;
  border-radius: 16px;
  background: white;
}

.item-title {
  margin: 0 0 7px;
  font-size: 1.08rem;
  line-height: 1.35;
}

.item-byline,
.item-meta,
.item-notes,
.item-date {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.item-byline {
  margin: 0 0 7px;
}

.item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 8px;
}

.meta-pill {
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--sand-light);
}

.item-notes {
  margin: 0 0 7px;
  white-space: pre-wrap;
}

.item-date {
  margin: 0;
}

.item-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  max-width: 270px;
}

.empty-state {
  margin: 0;
  padding: 26px 18px;
  border: 1px dashed var(--line);
  border-radius: 15px;
  color: var(--muted);
  text-align: center;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 10;
  max-width: min(360px, calc(100% - 36px));
  padding: 13px 16px;
  border-radius: 12px;
  color: white;
  background: var(--accent-dark);
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 720px) {
  .page-shell {
    width: min(100% - 18px, 1120px);
    padding-top: 18px;
  }

  .login-card {
    margin-top: 5vh;
    padding: 26px 22px;
  }

  .app-header,
  .panel-heading,
  .section-heading {
    align-items: flex-start;
  }

  .app-header {
    flex-direction: column;
  }

  .header-actions {
    width: 100%;
    justify-content: space-between;
  }

  .panel,
  .list-section {
    padding: 18px;
    border-radius: 18px;
  }

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

  .full-width {
    grid-column: auto;
  }

  .form-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .item-card {
    grid-template-columns: 1fr;
  }

  .item-actions {
    justify-content: flex-start;
    max-width: none;
  }

  .item-actions button {
    flex: 1 1 auto;
  }
}
