:root {
  --ink: #302f25;
  --muted: #625f50;
  --olive: #3f583b;
  --olive-dark: #2d422e;
  --olive-soft: #e8eadc;
  --clay: #9b593d;
  --line: #c9bea5;
  --white: #fff;
  --shadow: 0 18px 50px rgba(54, 57, 39, 0.12);
}

* {
  box-sizing: border-box;
}
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: linear-gradient(145deg, #f3efe4 0%, #e8eadc 55%, #e9dfcf 100%);
  font-family: Inter, ui-rounded, "Segoe UI", sans-serif;
}
button,
input,
textarea {
  font: inherit;
}
button,
a {
  -webkit-tap-highlight-color: transparent;
}
[hidden] {
  display: none !important;
}
.shell {
  min-height: 100vh;
}
.topbar {
  height: 76px;
  padding: 0 clamp(20px, 4vw, 56px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.9);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  text-decoration: none;
}
.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  color: var(--white);
  background: var(--olive);
  border-radius: 13px;
  font-size: 22px;
  transform: rotate(-4deg);
}
.brand strong,
.brand small {
  display: block;
}
.brand strong {
  letter-spacing: 0.06em;
}
.brand small {
  color: var(--muted);
  margin-top: 2px;
}
.user-area {
  display: flex;
  align-items: center;
  gap: 16px;
  color: var(--muted);
}
main {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 54px 0 90px;
}
.login-card {
  width: min(520px, 100%);
  margin: 7vh auto 0;
  padding: 48px;
  text-align: center;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: var(--shadow);
}
.login-icon {
  width: 82px;
  height: 82px;
  margin: 0 auto 22px;
  display: grid;
  place-items: center;
  background: var(--olive-soft);
  border-radius: 25px;
  font-size: 42px;
}
h1,
h2,
p {
  margin-top: 0;
}
h1 {
  margin-bottom: 12px;
  font-size: clamp(2rem, 5vw, 3.1rem);
  line-height: 1.08;
}
h2 {
  margin-bottom: 8px;
  font-size: 1.55rem;
}
.login-card > p:not(.eyebrow) {
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.6;
}
.eyebrow {
  margin-bottom: 8px;
  color: var(--clay);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.help-text {
  margin: 18px 0 0 !important;
  font-size: 0.87rem !important;
}
.primary-button,
.secondary-button,
.text-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 13px;
  cursor: pointer;
  font-weight: 750;
  text-decoration: none;
  transition:
    transform 0.15s,
    box-shadow 0.15s,
    background 0.15s;
}
.primary-button {
  padding: 12px 18px;
  color: var(--white);
  background: var(--olive);
  box-shadow: 0 8px 20px rgba(63, 88, 59, 0.22);
}
.primary-button:hover {
  background: var(--olive-dark);
  transform: translateY(-1px);
}
.primary-button.large {
  width: 100%;
  padding: 15px 20px;
  margin-top: 16px;
}
.secondary-button {
  padding: 11px 16px;
  color: var(--olive-dark);
  background: var(--white);
  border: 1px solid var(--line);
}
.secondary-button:hover {
  background: #f3efe4;
}
.text-button {
  padding: 7px 0;
  color: var(--olive-dark);
  background: transparent;
}
.welcome-row,
.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.welcome-row {
  margin-bottom: 34px;
}
.welcome-row h1 {
  margin-bottom: 0;
}
.tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 18px;
}
.tab {
  padding: 13px 18px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid var(--line);
  border-radius: 14px;
  cursor: pointer;
  font-weight: 750;
}
.tab.active {
  color: var(--olive-dark);
  background: var(--white);
  border-color: #a8b395;
  box-shadow: 0 7px 20px rgba(54, 57, 39, 0.08);
}
.count {
  display: inline-grid;
  min-width: 22px;
  height: 22px;
  margin-left: 6px;
  place-items: center;
  background: var(--olive-soft);
  border-radius: 999px;
  font-size: 0.78rem;
}
.panel {
  padding: clamp(22px, 4vw, 36px);
  background: rgba(255, 255, 255, 0.93);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
}
.panel-heading {
  margin-bottom: 28px;
}
.panel-heading p {
  margin: 0;
  color: var(--muted);
}
.field-help {
  margin: -8px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}
.panel-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 22px;
}
.card-list {
  display: grid;
  gap: 14px;
}
.content-card {
  display: grid;
  grid-template-columns: 100px 1fr auto;
  align-items: center;
  gap: 18px;
  padding: 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 17px;
}
.card-image {
  width: 100px;
  height: 84px;
  object-fit: cover;
  background: var(--olive-soft);
  border-radius: 12px;
}
.card-image.placeholder {
  display: grid;
  place-items: center;
  font-size: 30px;
}
.content-card h3 {
  margin: 0 0 5px;
  font-size: 1.08rem;
}
.content-card p {
  margin: 3px 0;
  color: var(--muted);
  font-size: 0.9rem;
}
.badge {
  display: inline-block;
  margin-top: 6px;
  padding: 4px 8px;
  color: #554426;
  background: #e9dcb8;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
}
.card-actions {
  display: flex;
  gap: 7px;
}
.icon-button {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  color: var(--olive-dark);
  background: #f3efe4;
  border: 1px solid var(--line);
  border-radius: 11px;
  cursor: pointer;
  font-size: 20px;
}
.icon-button.danger {
  color: #b4233e;
}
.empty-state {
  padding: 52px 20px;
  text-align: center;
  color: var(--muted);
  border: 2px dashed var(--line);
  border-radius: 18px;
}
.empty-state span {
  display: block;
  margin-bottom: 10px;
  font-size: 38px;
}
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 17px;
}
.photo-card {
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 17px;
}
.photo-card img {
  width: 100%;
  aspect-ratio: 4 / 3;
  display: block;
  object-fit: cover;
}
.photo-info {
  padding: 13px;
}
.photo-info p {
  margin: 0 0 10px;
  min-height: 2.5em;
  line-height: 1.3;
}
.photo-info .card-actions {
  justify-content: flex-end;
}
.editor-dialog {
  width: min(650px, calc(100% - 24px));
  max-height: calc(100vh - 30px);
  padding: 0;
  color: var(--ink);
  background: #fff;
  border: 0;
  border-radius: 23px;
  box-shadow: 0 30px 90px rgba(39, 43, 30, 0.32);
}
.editor-dialog::backdrop {
  background: rgba(37, 46, 33, 0.58);
  backdrop-filter: blur(3px);
}
.editor-dialog form {
  padding: clamp(22px, 5vw, 36px);
  overflow-y: auto;
}
.dialog-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 22px;
}
.dialog-heading h2 {
  margin: 0;
  font-size: 1.7rem;
}
label {
  display: grid;
  gap: 7px;
  margin-bottom: 17px;
  font-weight: 700;
}
input,
textarea {
  width: 100%;
  padding: 12px 13px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 11px;
  outline: none;
}
input:focus,
textarea:focus {
  border-color: var(--olive);
  box-shadow: 0 0 0 3px rgba(63, 88, 59, 0.15);
}
input[type="file"] {
  padding: 10px;
  background: #f3efe4;
}
.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.check-label {
  display: flex;
  grid-template: none;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: var(--olive-soft);
  border-radius: 11px;
}
.check-label input {
  width: 20px;
  height: 20px;
}
.image-preview {
  min-height: 140px;
  margin: -6px 0 17px;
  padding: 10px;
  background: #f3efe4;
  border-radius: 13px;
}
.image-preview img {
  display: block;
  max-width: 100%;
  max-height: 260px;
  margin: auto;
  border-radius: 9px;
}
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 25px;
}
.loading {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-content: center;
  justify-items: center;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(5px);
}
.spinner {
  width: 44px;
  height: 44px;
  border: 5px solid #cbd3bf;
  border-top-color: var(--olive);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.loading p {
  margin: 13px 0 0;
  font-weight: 750;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 30;
  max-width: min(390px, calc(100% - 44px));
  padding: 14px 18px;
  color: #fff;
  background: #315f44;
  border-radius: 12px;
  box-shadow: var(--shadow);
  font-weight: 700;
}
.toast.error {
  background: #9e253c;
}

@media (max-width: 700px) {
  .topbar {
    height: 68px;
    padding: 0 16px;
  }
  .brand small,
  #user-name {
    display: none;
  }
  main {
    padding-top: 30px;
  }
  .login-card {
    margin-top: 3vh;
    padding: 32px 22px;
  }
  .welcome-row,
  .panel-heading {
    align-items: stretch;
    flex-direction: column;
  }
  .welcome-row .secondary-button,
  .panel-heading .primary-button {
    width: 100%;
  }
  .tabs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
  }
  .tab {
    padding: 12px 8px;
    font-size: 0.9rem;
  }
  .content-card {
    grid-template-columns: 72px 1fr;
  }
  .card-image {
    width: 72px;
    height: 72px;
  }
  .content-card > .card-actions {
    grid-column: 1 / -1;
  }
  .content-card > .card-actions .icon-button {
    flex: 1;
    width: auto;
  }
  .field-row {
    grid-template-columns: 1fr;
    gap: 0;
  }
  .photo-grid {
    grid-template-columns: 1fr;
  }
}
