:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --panel-2: #eef2f5;
  --line: #d9dee5;
  --ink: #1f2933;
  --muted: #697586;
  --accent: #0f766e;
  --accent-2: #0b5f59;
  --danger: #b42318;
  --shadow: 0 10px 30px rgb(31 41 51 / 0.08);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 0 14px;
  cursor: pointer;
}

button:hover {
  border-color: #aeb7c2;
}

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

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

button.primary:hover {
  background: var(--accent-2);
}

input,
select {
  min-height: 40px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 0 12px;
}

.shell {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 28px 0 40px;
}

.login-view {
  display: grid;
  min-height: calc(100dvh - 56px);
  place-items: center;
}

.login-panel {
  width: min(360px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 24px;
}

.login-panel h1,
.topbar h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.15;
}

.login-panel label {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.login-panel span,
.muted {
  color: var(--muted);
}

.error {
  min-height: 20px;
  color: var(--danger);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.topbar p {
  margin: 6px 0 0;
}

.top-actions,
.toolbar,
.pager {
  display: flex;
  align-items: center;
  gap: 10px;
}

.top-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.upload-panel,
.toolbar,
.asset-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.upload-panel {
  padding: 14px;
}

.drop-zone {
  position: relative;
  display: grid;
  min-height: 150px;
  place-items: center;
  gap: 6px;
  border: 1px dashed #9aa6b2;
  border-radius: 6px;
  background: var(--panel-2);
  text-align: center;
  outline: none;
}

.drop-zone strong {
  font-size: 18px;
}

.drop-zone span {
  color: var(--muted);
  font-size: 14px;
}

.drop-zone.drag {
  border-color: var(--accent);
  background: #e7f3f1;
}

.drop-zone input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.upload-result {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.result-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
}

.result-row code,
.asset-path {
  overflow-wrap: anywhere;
}

.toolbar {
  margin-top: 18px;
  padding: 12px;
}

.toolbar input {
  flex: 1 1 auto;
}

.toolbar select {
  width: 120px;
}

.asset-list {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.asset-card {
  display: grid;
  grid-template-columns: 152px 1fr;
  gap: 14px;
  padding: 12px;
}

.asset-card img {
  width: 152px;
  height: 114px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-2);
}

.asset-main {
  min-width: 0;
}

.asset-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.asset-title {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 16px;
  line-height: 1.3;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 9px;
  background: #e7f3f1;
  color: #0f766e;
  font-size: 13px;
}

.badge.cold {
  background: #eef2ff;
  color: #475467;
}

.asset-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 8px 0;
  color: var(--muted);
  font-size: 13px;
}

.asset-path {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.asset-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.asset-actions .danger {
  border-color: #f1b8b3;
  color: var(--danger);
}

.empty {
  margin: 28px 0;
  color: var(--muted);
  text-align: center;
}

.pager {
  justify-content: center;
  margin-top: 18px;
}

@media (max-width: 720px) {
  .shell {
    width: min(100vw - 20px, 1180px);
    padding-top: 16px;
  }

  .topbar,
  .toolbar,
  .result-row {
    align-items: stretch;
    flex-direction: column;
    grid-template-columns: 1fr;
  }

  .top-actions {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .top-actions button,
  .toolbar select {
    width: 100%;
  }

  .asset-card {
    grid-template-columns: 1fr;
  }

  .asset-card img {
    width: 100%;
    height: auto;
    aspect-ratio: 4 / 3;
  }
}
