:root {
  --bg: #0A0A0A;
  --surface: #1C1C1E;
  --surface-alt: #2C2C2E;
  --accent: #F7C600;
  --text: #FFFFFF;
  --muted: #8E8E93;
  --border: rgba(255,255,255,0.08);
  --success: #30D158;
  --warning: #FF9F0A;
  --error: #FF453A;
}

* {
  box-sizing: border-box;
}

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

button,
input,
select,
textarea {
  font: inherit;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card,
.panel,
.modal-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.login-card {
  width: min(100%, 420px);
  padding: 32px;
}

.brand-mark {
  color: var(--accent);
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 24px;
  font-size: 28px;
}

h2 {
  margin-bottom: 0;
  font-size: 20px;
}

.form-stack,
.form-grid {
  display: grid;
  gap: 16px;
}

label span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
}

input,
select,
textarea {
  width: 100%;
  color: var(--text);
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 11px 12px;
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
}

.button {
  border: 0;
  border-radius: 8px;
  padding: 11px 14px;
  color: var(--text);
  cursor: pointer;
  font-weight: 700;
}

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

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

.button.secondary {
  background: var(--surface-alt);
  border: 1px solid var(--border);
}

.button.small {
  padding: 8px 10px;
  font-size: 13px;
}

.form-message {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.form-message.error,
.error {
  color: var(--error);
}

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

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

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px 1fr;
}

.sidebar {
  padding: 24px 16px;
  background: #111111;
  border-right: 1px solid var(--border);
}

.nav-list {
  display: grid;
  gap: 6px;
  margin-top: 28px;
}

.nav-item {
  width: 100%;
  padding: 12px;
  color: var(--muted);
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
}

.nav-item.active,
.nav-item:hover {
  color: var(--text);
  background: var(--surface);
  border-color: var(--border);
}

.content-shell {
  min-width: 0;
}

.topbar {
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 28px;
  border-bottom: 1px solid var(--border);
}

.topbar h1 {
  margin: 0;
  font-size: 24px;
}

.content {
  padding: 28px;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(180px, 260px);
  gap: 16px;
  margin-bottom: 18px;
}

.summary {
  margin-bottom: 18px;
  padding: 12px 14px;
  background: rgba(255,159,10,0.08);
  border: 1px solid rgba(255,159,10,0.24);
  border-radius: 10px;
}

.table-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 14px;
}

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

.table-wrap {
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 900px;
}

th,
td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

td {
  font-size: 14px;
}

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

.thumbnail,
.thumbnail-fallback {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  object-fit: cover;
  display: block;
  background: var(--surface-alt);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--surface-alt);
  font-size: 12px;
  font-weight: 700;
}

.status-pill.ok {
  color: var(--success);
}

.status-pill.warn {
  color: var(--warning);
}

.placeholder {
  display: grid;
  place-items: center;
  min-height: 260px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 10;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.72);
}

.modal-panel {
  position: relative;
  width: min(720px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow: auto;
  margin: 16px auto;
  padding: 24px;
}

.modal-header,
.modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.modal-header {
  margin-bottom: 20px;
}

.modal-actions {
  justify-content: flex-end;
  margin-top: 20px;
}

.icon-button {
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  background: var(--surface-alt);
  cursor: pointer;
}

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

.full-width {
  grid-column: 1 / -1;
}

.import-panel {
  display: grid;
  gap: 18px;
  margin-bottom: 18px;
  padding: 18px;
}

.file-drop {
  display: block;
}

.import-settings {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.import-settings label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}

.import-settings input {
  width: auto;
}

@media (max-width: 860px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

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

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

  .table-meta {
    align-items: flex-start;
    flex-direction: column;
  }
}
