:root {
  color-scheme: light;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  color: #19251f;
  background: #f3efe6;
  --ink: #19251f;
  --muted: #637067;
  --paper: #fffdf8;
  --line: #d7d2c5;
  --forest: #244b3c;
  --forest-dark: #18372c;
  --lime: #d8f36a;
  --error: #87372d;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(ellipse at 10% 0%, rgba(216, 243, 106, 0.22), transparent 33rem),
    #f3efe6;
}

button,
input {
  font: inherit;
}

button,
a,
input {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 3px solid #f1784d;
  outline-offset: 3px;
}

[hidden] {
  display: none !important;
}

.admin-page {
  display: grid;
  width: min(1120px, calc(100% - 40px));
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 16px;
  margin: 0 auto;
  padding: clamp(24px, 5vw, 58px) 0;
}

.admin-header {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: 1fr auto;
  align-items: start;
  gap: 22px;
  padding: clamp(24px, 5vw, 48px);
  border-radius: 20px;
  background: var(--forest-dark);
  color: var(--paper);
  box-shadow: 0 18px 42px rgba(24, 55, 44, 0.14);
}

.back-link {
  grid-column: 1 / -1;
  width: fit-content;
  color: var(--lime);
  font-weight: 700;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

.admin-heading .eyebrow {
  margin: 5px 0 10px;
}

.eyebrow {
  color: var(--forest);
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.admin-heading .eyebrow {
  color: var(--lime);
}

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

h1 {
  margin-bottom: 10px;
  color: var(--paper);
  font-size: clamp(2rem, 6vw, 3.6rem);
  letter-spacing: -0.065em;
  line-height: 1.02;
}

h2 {
  margin-bottom: 0;
  color: var(--ink);
  font-size: clamp(1.3rem, 3vw, 1.8rem);
  letter-spacing: -0.04em;
}

.intro {
  max-width: 540px;
  margin: 0;
  color: #d4ddd4;
  line-height: 1.55;
}

.header-actions {
  display: flex;
  gap: 8px;
}

.secondary-button,
.delete-button,
.login-button {
  min-height: 44px;
  padding: 10px 15px;
  border: 1px solid #b7c1b6;
  border-radius: 10px;
  background: #f4f5ea;
  color: var(--forest-dark);
  font-weight: 750;
  cursor: pointer;
}

.secondary-button:disabled,
.delete-button:disabled,
.delete-all-button:disabled,
.login-button:disabled {
  cursor: wait;
  opacity: 0.6;
}

.signout-button {
  border-color: rgba(255, 255, 255, 0.35);
  background: transparent;
  color: var(--paper);
}

.login-card {
  position: relative;
  grid-column: 4 / span 6;
  padding: clamp(24px, 5vw, 42px);
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--paper);
  box-shadow: 0 16px 40px rgba(25, 37, 31, 0.08);
}

.login-mark {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  margin-bottom: 25px;
  border-radius: 14px;
  background: var(--lime);
  color: var(--forest-dark);
  font-size: 1.25rem;
  font-weight: 900;
}

.login-card .eyebrow {
  margin: 0 0 8px;
}

.login-copy {
  margin: 10px 0 24px;
  color: var(--muted);
  line-height: 1.55;
}

.password-label {
  display: block;
  margin-bottom: 7px;
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 700;
}

.password-field {
  display: flex;
  min-height: 50px;
  align-items: center;
  border: 1px solid #b7c1b6;
  border-radius: 10px;
  background: white;
}

.password-field:focus-within {
  border-color: var(--forest);
  box-shadow: 0 0 0 3px rgba(36, 75, 60, 0.12);
}

.password-field input {
  width: 100%;
  min-width: 0;
  height: 48px;
  padding: 0 13px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
}

.password-field input:focus-visible {
  outline: 0;
}

.password-toggle {
  flex: 0 0 auto;
  padding: 8px 12px;
  border: 0;
  background: transparent;
  color: var(--forest);
  font-size: 0.85rem;
  font-weight: 750;
  cursor: pointer;
}

.login-button {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  margin-top: 15px;
  border-color: var(--forest);
  background: var(--forest);
  color: white;
}

.login-button:hover:not(:disabled) {
  background: var(--forest-dark);
}

.password-reset-button {
  display: block;
  margin: 13px auto 0;
  padding: 5px 8px;
  border: 0;
  background: transparent;
  color: var(--forest);
  font-size: 0.88rem;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.password-reset-button:disabled {
  cursor: wait;
  opacity: 0.6;
}

.login-footnote {
  margin: 17px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
  text-align: center;
}

.status {
  grid-column: 1 / -1;
  margin: 0;
  padding: 13px 16px;
  border: 1px solid #b4b9a8;
  border-radius: 11px;
  background: var(--paper);
  color: #465248;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.status:empty {
  display: none;
}

.status[data-kind="error"] {
  border-color: #d59c91;
  background: #fff2ee;
  color: var(--error);
}

.status[data-kind="success"] {
  border-color: #8ba78c;
  background: #edf4e8;
  color: #28543a;
}

#admin-content {
  display: contents;
}

.summary {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 12px;
}

.summary-card,
.data-section,
.record {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--paper);
  box-shadow: 0 8px 24px rgba(25, 37, 31, 0.05);
}

.summary-card {
  display: flex;
  grid-column: span 3;
  min-height: 108px;
  flex-direction: column;
  justify-content: space-between;
  gap: 6px;
  padding: 17px;
  color: var(--muted);
}

.summary-card strong {
  color: var(--forest-dark);
  font-size: 2rem;
  line-height: 1;
}

.admin-id-card {
  grid-column: span 6;
}

.bulk-actions {
  display: flex;
  grid-column: 1 / -1;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 20px;
  border: 1px solid #d59c91;
  border-radius: 14px;
  background: #fff7f2;
}

.bulk-actions .eyebrow {
  margin: 0 0 6px;
  color: var(--error);
}

.bulk-actions-copy {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.bulk-actions-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 9px;
}

.delete-all-button {
  min-height: 44px;
  padding: 10px 15px;
  border: 1px solid var(--error);
  border-radius: 10px;
  background: var(--error);
  color: white;
  font-weight: 800;
  cursor: pointer;
}

.delete-all-button:hover:not(:disabled) {
  background: #682820;
}

.data-section {
  grid-column: span 6;
  padding: clamp(17px, 2.7vw, 25px);
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.section-heading .eyebrow {
  margin: 0 0 5px;
}

.records {
  display: grid;
  gap: 9px;
}

.record {
  padding: 13px;
  box-shadow: none;
}

.record-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.record-heading > div {
  min-width: 0;
}

.record-title {
  margin: 0;
  color: var(--ink);
  font-size: 1rem;
  overflow-wrap: anywhere;
}

.record-meta,
.record-details {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.record-details {
  padding-top: 8px;
  border-top: 1px solid #e5e2d8;
  color: #39483e;
}

.delete-button {
  flex: 0 0 auto;
  border-color: #d59c91;
  background: #fff7f2;
  color: var(--error);
}

.delete-button:hover:not(:disabled) {
  background: #ffe9e1;
}

.empty-state {
  margin: 0;
  padding: 18px;
  border: 1px dashed #a9a99b;
  border-radius: 10px;
  background: #f8f6ee;
  color: #5b6258;
  line-height: 1.5;
  text-align: center;
}

@media (max-width: 800px) {
  .login-card {
    grid-column: 2 / span 10;
  }

  .data-section {
    grid-column: 1 / -1;
  }

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

  .summary-card {
    grid-column: span 4;
  }

  .admin-id-card {
    grid-column: span 12;
  }
}

@media (max-width: 540px) {
  .admin-page {
    width: calc(100% - 24px);
    grid-template-columns: minmax(0, 1fr);
    gap: 11px;
    padding: 12px 0 26px;
  }

  .admin-header {
    grid-template-columns: minmax(0, 1fr);
    gap: 15px;
    padding: 22px;
    border-radius: 15px;
  }

  .back-link {
    grid-column: 1;
  }

  .header-actions {
    width: 100%;
  }

  .header-actions button {
    flex: 1;
  }

  .login-card {
    grid-column: 1;
    padding: 25px 20px;
  }

  .summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
  }

  .summary-card {
    grid-column: span 1;
    min-height: 92px;
  }

  .admin-id-card {
    grid-column: 1 / -1;
  }

  .data-section {
    grid-column: 1;
    padding: 16px;
  }

  .bulk-actions,
  .bulk-actions-buttons {
    width: 100%;
  }

  .bulk-actions-buttons {
    flex-direction: column;
  }

  .bulk-actions-buttons button {
    width: 100%;
  }
}

@media (max-width: 390px) {
  .record-heading {
    flex-direction: column;
  }

  .delete-button {
    align-self: flex-start;
  }
}
