:root {
  --admin-ink: #07134f;
  --admin-text: #1c2946;
  --admin-muted: #65708a;
  --admin-accent: #05aeb0;
  --admin-accent-dark: #048d90;
  --admin-bg: #f4f7fb;
  --admin-surface: #fff;
  --admin-line: #dce2ec;
  --admin-line-strong: #bdc8d8;
  --admin-danger: #b42318;
  --admin-shadow: 0 10px 30px rgb(20 35 70 / 0.08);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--admin-bg);
}

body {
  margin: 0;
  background: var(--admin-bg);
  color: var(--admin-text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.55;
}

a {
  color: #086f83;
}

a:hover {
  color: var(--admin-ink);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  border-bottom: 1px solid rgb(7 19 79 / 0.1);
  background: rgb(255 255 255 / 0.96);
  box-shadow: 0 4px 18px rgb(20 35 70 / 0.05);
  backdrop-filter: blur(14px);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  width: min(1480px, calc(100% - 40px));
  min-height: 74px;
  margin: 0 auto;
}

.brand {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 11px;
  color: var(--admin-ink);
  text-decoration: none;
}

.brand:hover {
  color: var(--admin-ink);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  color: #fff;
  background: var(--admin-accent);
  font-size: 1.16rem;
  font-weight: 900;
}

.brand-copy {
  display: grid;
  gap: 1px;
}

.brand-kicker {
  color: var(--admin-accent-dark);
  font-size: 0.62rem;
  font-weight: 850;
  line-height: 1.2;
}

.brand-name {
  font-size: 1.04rem;
  font-weight: 850;
  line-height: 1.3;
}

.admin-nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  min-width: 0;
}

.admin-nav-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 8px 11px;
  color: #47526d;
  font-size: 0.86rem;
  font-weight: 750;
  text-decoration: none;
  white-space: nowrap;
}

.admin-nav-link::after {
  content: "";
  position: absolute;
  right: 11px;
  bottom: 3px;
  left: 11px;
  height: 2px;
  background: transparent;
}

.admin-nav-link:hover,
.admin-nav-link:focus-visible,
.admin-nav-link.is-active {
  color: var(--admin-ink);
  outline: none;
}

.admin-nav-link.is-active::after {
  background: var(--admin-accent);
}

.topbar form {
  margin: 0 0 0 8px;
}

.admin-logout {
  min-height: 36px;
  padding: 7px 11px;
  border-color: var(--admin-line-strong);
  color: #47526d;
  background: #fff;
  font-size: 0.82rem;
}

.admin-logout:hover,
.admin-logout:focus-visible {
  border-color: var(--admin-accent);
  color: var(--admin-ink);
  background: #f2fbfb;
}

.container {
  width: min(1180px, calc(100vw - 40px));
  margin: 30px auto 56px;
}

h1,
h2,
h3 {
  color: var(--admin-ink);
  line-height: 1.3;
}

h1 {
  margin: 0 0 22px;
  font-size: 2rem;
}

h2 {
  margin: 0 0 16px;
  font-size: 1.08rem;
}

.panel {
  margin: 0 0 18px;
  padding: 20px;
  border: 1px solid var(--admin-line);
  border-radius: 8px;
  background: var(--admin-surface);
  box-shadow: var(--admin-shadow);
}

.panel.warning {
  border-color: #e9c76e;
  background: #fffaf0;
}

.panel.danger {
  border-color: #e1a2a2;
  background: #fff5f5;
}

.flash {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto 16px;
  padding: 12px 14px;
  border: 1px solid;
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--admin-shadow);
}

.container > .flash {
  width: 100%;
}

.flash.success {
  border-color: #83c7b0;
  color: #145f4a;
  background: #effaf6;
}

.flash.error {
  border-color: #df9a9a;
  color: #8f211a;
  background: #fff3f2;
}

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

.grid-form {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  align-items: end;
}

.inline-form {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
}

.narrow {
  max-width: 440px;
}

label {
  display: grid;
  gap: 6px;
  color: #34415d;
  font-weight: 700;
}

label.check {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
}

input,
select,
textarea,
button,
.button {
  min-height: 40px;
  padding: 8px 11px;
  border: 1px solid var(--admin-line-strong);
  border-radius: 6px;
  font: inherit;
}

input,
select,
textarea {
  width: 100%;
  color: var(--admin-text);
  background: #fff;
}

input[type="checkbox"],
input[type="radio"] {
  width: auto;
  min-height: 0;
  accent-color: var(--admin-accent-dark);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--admin-accent);
  outline: 3px solid rgb(5 174 176 / 0.14);
}

button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-color: var(--admin-ink);
  color: #fff;
  background: var(--admin-ink);
  font-weight: 750;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease, transform 0.16s ease;
}

button:hover,
button:focus-visible,
.button:hover,
.button:focus-visible {
  border-color: var(--admin-accent-dark);
  color: #fff;
  background: var(--admin-accent-dark);
  outline: none;
}

button:active,
.button:active {
  transform: translateY(1px);
}

button:disabled,
.button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

button.danger,
.button.danger {
  border-color: var(--admin-danger);
  background: var(--admin-danger);
}

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

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid #e5e9f0;
  text-align: left;
  vertical-align: top;
}

th {
  color: #59647d;
  background: #f8fafc;
  font-size: 0.78rem;
  font-weight: 800;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.muted {
  color: var(--admin-muted);
  overflow-wrap: anywhere;
}

.thumb {
  width: 96px;
  height: 64px;
  object-fit: contain;
  border-radius: 6px;
  background: #111;
}

.asset-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 96px;
  height: 64px;
  border-radius: 6px;
  color: #fff;
  background: #53617d;
  font-weight: 800;
}

.actions form {
  display: inline;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.stats div {
  padding: 20px;
  border: 1px solid var(--admin-line);
  border-top: 3px solid var(--admin-accent);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--admin-shadow);
}

.stats strong {
  display: block;
  color: var(--admin-ink);
  font-size: 2rem;
  line-height: 1.25;
}

.item-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
}

.item-form label {
  min-width: 120px;
}

code,
pre {
  font-family: Consolas, "Courier New", monospace;
}

code {
  overflow-wrap: anywhere;
}

@media (max-width: 1050px) {
  .topbar-inner {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
    padding: 12px 0 8px;
  }

  .admin-nav {
    justify-content: flex-start;
    width: 100%;
    overflow-x: auto;
    padding-bottom: 3px;
    scrollbar-width: thin;
  }
}

@media (max-width: 720px) {
  .topbar-inner,
  .container {
    width: calc(100% - 24px);
  }

  .topbar-inner {
    min-height: 0;
  }

  .brand-mark {
    width: 34px;
    height: 34px;
  }

  .brand-kicker {
    display: none;
  }

  .brand-name {
    font-size: 0.96rem;
  }

  .admin-nav-link {
    min-height: 38px;
    padding: 7px 9px;
    font-size: 0.8rem;
  }

  .topbar form {
    margin-left: 3px;
  }

  .admin-logout {
    min-height: 34px;
    white-space: nowrap;
  }

  .container {
    margin-top: 22px;
  }

  h1 {
    font-size: 1.65rem;
  }

  .panel {
    padding: 16px;
  }

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

  .flash {
    width: calc(100% - 24px);
  }
}
