:root {
  --bg: #f3f5f7;
  --panel: #ffffff;
  --text: #0f172a;
  --muted: #4b5563;
  --line: #d1d5db;
  --brand: #e98b3a;
  --danger: #df4f4b;
  --info: #4f7de8;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Avenir Next", "Segoe UI", sans-serif;
}

.wrap {
  width: min(1720px, calc(100% - 48px));
  margin: 0 auto;
}

.header {
  background: var(--panel);
  border-bottom: 1px solid #e5e7eb;
  padding: 30px 0;
}

.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
}

.header-left {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

h1 {
  margin: 0;
  font-size: clamp(32px, 2.2vw, 52px);
  line-height: 1.08;
}

h1 span { color: var(--brand); }

.header p {
  margin: 10px 0 0;
  font-size: 17px;
  color: var(--muted);
}

.logo {
  width: 170px;
  height: 86px;
  object-fit: contain;
  border: 1px solid #efefef;
  background: #fff;
}

.btn {
  border: 0;
  border-radius: 16px;
  background: #fff;
  color: var(--text);
  font: inherit;
  padding: 10px 16px;
  cursor: pointer;
}

.btn.upload {
  margin-top: 14px;
  padding: 10px 22px;
  background: var(--brand);
  color: #fff;
  font-size: 18px;
  line-height: 1;
  font-weight: 600;
}

#app {
  padding: 28px 0 42px;
}

.category-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.chip {
  border: 1px solid #c7cfd8;
  background: #fdfefe;
  color: #374151;
  border-radius: 16px;
  padding: 10px 16px;
  font-size: 16px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.chip.active {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}

.stats {
  margin: 24px 0 16px;
  font-size: 21px;
  color: #374151;
}

.cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 26px;
}

.card {
  background: var(--panel);
  border: 1px solid #dadfe4;
  border-radius: 16px;
  overflow: hidden;
}

.thumb-wrap {
  background: #f4f5f8;
  height: 255px;
  padding: 14px;
  border-bottom: 1px solid #e5e7eb;
}

.thumb {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #fff;
}

.meta {
  padding: 18px;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #eff2f5;
  border-radius: 11px;
  color: #636b75;
  font-size: 14px;
  padding: 6px 10px;
  text-transform: lowercase;
}

.meta h3 {
  margin: 14px 0 8px;
  font-size: 24px;
  line-height: 1.15;
}

.updated {
  margin: 0;
  font-size: 15px;
  color: #6b7280;
}

.card-actions {
  margin-top: 16px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
}

.action {
  border: 0;
  border-radius: 14px;
  height: 52px;
  cursor: pointer;
  color: #fff;
  font: inherit;
}

.action.view {
  background: var(--brand);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.action.edit {
  width: 74px;
  background: var(--info);
  font-size: 22px;
}

.viewer-shell {
  padding-top: 10px;
}

.viewer-back {
  color: #1f2937;
  text-decoration: none;
  display: inline-block;
  margin-bottom: 16px;
}

.viewer-frame {
  background: #fff;
  border-radius: 16px;
  border: 1px solid #d8dee6;
  padding: 14px;
}

.viewer-frame img {
  width: 100%;
  max-height: 76vh;
  object-fit: contain;
}

.modal {
  border: 0;
  border-radius: 14px;
  padding: 0;
  width: min(560px, calc(100% - 24px));
}

.modal::backdrop {
  background: rgba(15, 23, 42, 0.55);
}

.modal form {
  display: grid;
  gap: 12px;
  padding: 18px;
}

.modal h3 {
  margin: 0 0 4px;
}

.modal label {
  display: grid;
  gap: 6px;
  font-size: 14px;
  color: #374151;
}

.modal input,
.modal select {
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 10px;
  font: inherit;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 8px;
}

.modal-actions button {
  border: 1px solid #d1d5db;
  background: #fff;
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
}

.modal-actions .primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.inline-error {
  margin: 8px 0 0;
  color: #b42318;
  font-size: 14px;
}

@media (max-width: 1540px) {
  h1 { font-size: clamp(28px, 2vw, 42px); }
  .header p { font-size: 16px; }
  .chip { font-size: 15px; padding: 9px 14px; }
  .stats { font-size: 19px; }
  .tag { font-size: 13px; }
  .meta h3 { font-size: 22px; }
  .updated { font-size: 14px; }
  .action.view { font-size: 17px; }
  .action.edit, .action.delete { font-size: 20px; }
  .btn.upload { font-size: 17px; padding: 10px 18px; margin-top: 10px; }
  .logo { width: 140px; height: 74px; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .thumb-wrap { height: 225px; }
}

@media (max-width: 880px) {
  .wrap { width: calc(100% - 24px); }
  .header-inner { flex-direction: column; align-items: flex-start; }
  .logo { display: none; }
  .cards { grid-template-columns: 1fr; }
  .thumb-wrap { height: 250px; }
  .card-actions { grid-template-columns: 1fr auto auto; }
}
