:root {
  color-scheme: light;
  --bg: #f7f8fb;
  --surface: #ffffff;
  --text: #172033;
  --muted: #667085;
  --line: #d7dce5;
  --primary: #1f6feb;
  --primary-strong: #174ea6;
  --success: #176b45;
  --success-bg: #e8f6ef;
  --danger: #b42318;
  --danger-bg: #fff1f0;
  --accent: #8a5a00;
}

* {
  box-sizing: border-box;
}

html {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  letter-spacing: 0;
}

body {
  margin: 0;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.brand {
  color: var(--text);
  font-weight: 800;
}

.nav {
  grid-column: 1 / -1;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.nav a {
  flex: 0 0 auto;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.92rem;
}

.logout {
  margin: 0;
}

.page {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 18px 14px 44px;
}

.page-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 8px 0 16px;
}

h1,
h2 {
  margin: 0 0 12px;
  line-height: 1.15;
}

h1 {
  font-size: 1.65rem;
}

h2 {
  font-size: 1.15rem;
}

.panel,
.photo-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.narrow {
  max-width: 460px;
  margin: 28px auto;
}

.stack {
  display: grid;
  gap: 14px;
}

.compact {
  gap: 10px;
}

label span {
  display: block;
  margin-bottom: 6px;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font: inherit;
}

input[type="checkbox"] {
  width: auto;
  min-height: 0;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.check-row span {
  margin: 0;
  font-weight: 500;
}

.button,
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
}

.button.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.button.primary:hover {
  background: var(--primary-strong);
  text-decoration: none;
}

.button.danger,
button.danger {
  background: var(--danger-bg);
  border-color: #ffb4ab;
  color: var(--danger);
}

.button.small {
  min-height: 34px;
  padding: 6px 10px;
  font-size: 0.9rem;
}

.icon-button {
  min-width: 42px;
  padding: 0;
}

.notice {
  margin: 0 0 14px;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #eef4ff;
}

.notice.success {
  border-color: #a7dfbf;
  background: var(--success-bg);
  color: var(--success);
}

.notice.danger {
  border-color: #ffb4ab;
  background: var(--danger-bg);
  color: var(--danger);
}

.muted {
  color: var(--muted);
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.stat {
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.stat span {
  display: block;
  font-size: 1.8rem;
  font-weight: 800;
}

.stat small {
  color: var(--muted);
}

.split {
  display: grid;
  gap: 16px;
}

.hero-image,
.preview-wrap img {
  width: 100%;
  border-radius: 8px;
  display: block;
  background: #e9edf5;
  object-fit: cover;
}

.hero-image {
  aspect-ratio: 4 / 5;
  max-height: 520px;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}

.photo-card {
  padding: 0;
  overflow: hidden;
}

.photo-card img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
}

.photo-card-body {
  padding: 12px;
}

.photo-card h2 {
  font-size: 1rem;
  overflow-wrap: anywhere;
}

.photo-card p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.photo-detail {
  display: grid;
  gap: 16px;
}

.preview-wrap img {
  max-height: 75vh;
  object-fit: contain;
}

.metadata {
  display: grid;
  grid-template-columns: minmax(90px, auto) 1fr;
  gap: 8px 12px;
  margin: 0 0 16px;
}

.metadata dt {
  color: var(--muted);
  font-weight: 700;
}

.metadata dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.hash {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.78rem;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.danger-zone {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.token-once {
  display: grid;
  gap: 10px;
}

.token-value {
  display: block;
  overflow-x: auto;
  padding: 10px;
  border-radius: 8px;
  background: #111827;
  color: #e5e7eb;
  white-space: nowrap;
}

.table-scroll {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 0.88rem;
}

.inline-form {
  display: flex;
  min-width: 240px;
  gap: 8px;
}

.inline-form input {
  min-height: 36px;
}

.prose {
  margin-bottom: 14px;
}

.prose li {
  margin: 8px 0;
}

.prose code,
td code,
.check-row code {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.9em;
}

.shortcut-grid {
  display: grid;
  gap: 16px;
  margin-bottom: 16px;
}

.shortcut-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.shortcut-card.fresh {
  border-color: #79b8ff;
  box-shadow: 0 0 0 3px #e3f0ff;
}

.shortcut-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
}

.mode-pill {
  flex: 0 0 auto;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.shortcut-fields {
  display: grid;
  grid-template-columns: minmax(120px, auto) 1fr;
  gap: 10px 12px;
  margin: 0;
}

.shortcut-fields dt {
  color: var(--muted);
  font-weight: 800;
}

.shortcut-fields dd {
  display: grid;
  gap: 8px;
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
}

.shortcut-fields code {
  overflow-wrap: anywhere;
}

.shortcut-steps {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.shortcut-steps h3 {
  margin: 0 0 10px;
  font-size: 1rem;
}

.shortcut-steps ol {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.shortcut-steps li {
  display: grid;
  grid-template-columns: 86px 1fr;
  gap: 10px;
  align-items: start;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcff;
}

.screen-label {
  color: var(--primary);
  font-weight: 800;
  font-size: 0.84rem;
}

@media (min-width: 760px) {
  .topbar {
    grid-template-columns: auto 1fr auto;
  }

  .nav {
    grid-column: auto;
    justify-content: center;
  }

  .split {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .photo-detail {
    grid-template-columns: minmax(0, 1fr) 360px;
    align-items: start;
  }
}
