:root {
  --red: #d70b20;
  --red-dark: #8d0715;
  --navy: #001e45;
  --navy-dark: #001026;
  --ink: #f6f8ff;
  --muted: #aebbd3;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px 1fr;
  color: var(--ink);
  background:
    radial-gradient(circle at 18px 18px, rgba(255,255,255,.08) 0 3px, transparent 4px) 0 0/28px 28px,
    linear-gradient(145deg, var(--red) 0 28%, var(--navy) 28% 100%);
  font-family: Arial, Helvetica, sans-serif;
}

.sidebar {
  min-height: 100vh;
  padding: 22px;
  background: rgba(0, 13, 32, .88);
  border-right: 1px solid rgba(255,255,255,.12);
}

.sidebar img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 8px;
  border: 2px solid var(--red);
}

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

.tab {
  width: 100%;
  height: 48px;
  margin-bottom: 10px;
  color: var(--ink);
  background: rgba(0,30,69,.72);
  border: 1px solid rgba(215,11,32,.8);
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
}

.tab.active, .tab:hover { background: var(--red); }

main { padding: 28px; }

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 22px;
}

header p { margin: 0 0 4px; color: var(--muted); }
header h2 { margin: 0; font-size: 34px; }
#status { color: var(--muted); }

.panel { display: none; }
.panel.active { display: block; }

.login {
  max-width: 720px;
  padding: 22px;
  background: rgba(0, 16, 38, .82);
  border: 1px solid rgba(215,11,32,.7);
  border-radius: 8px;
}

.form {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 16px;
  max-width: 1050px;
  margin-bottom: 24px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 700;
}

input, select, textarea {
  width: 100%;
  color: var(--ink);
  background: rgba(0, 16, 38, .88);
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 8px;
  padding: 12px;
  font: inherit;
}

textarea, label:has(textarea) { grid-column: 1 / -1; }

.hint {
  grid-column: 1 / -1;
  margin: -6px 0 0;
  color: var(--muted);
}

button {
  height: 48px;
  color: white;
  background: var(--red);
  border: 0;
  border-radius: 8px;
  font-weight: 800;
  cursor: pointer;
}

.form > button { grid-column: 1 / -1; }

.list-tools {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(220px, 320px);
  gap: 10px;
  max-width: 1050px;
  margin: 10px 0 14px;
}

.data-list {
  display: grid;
  gap: 10px;
  max-width: 1050px;
}

.data-row {
  display: grid;
  grid-template-columns: 72px 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 10px;
  background: rgba(0, 16, 38, .82);
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 8px;
}

.thumb {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 6px;
  background: rgba(255,255,255,.1);
}

.placeholder {
  border: 1px dashed rgba(255,255,255,.25);
}

.data-row strong {
  display: block;
  margin-bottom: 4px;
  color: var(--ink);
}

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

.row-actions {
  display: flex;
  gap: 8px;
}

.row-actions button {
  min-width: 86px;
  height: 38px;
}

.row-actions button:last-child {
  background: #6f101a;
}

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

.pager {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 1050px;
  margin-top: 14px;
  color: var(--muted);
  font-weight: 800;
}

.pager span {
  min-width: 190px;
  text-align: center;
}

.pager button {
  min-width: 120px;
}

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

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 20;
  max-width: min(420px, calc(100vw - 44px));
  padding: 14px 18px;
  color: white;
  background: #101827;
  border: 1px solid rgba(215,11,32,.8);
  border-radius: 8px;
  box-shadow: 0 12px 36px rgba(0,0,0,.35);
  font-weight: 800;
}

.install-prompt {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 25;
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 12px;
  width: min(620px, calc(100vw - 32px));
  padding: 14px;
  color: var(--ink);
  background: rgba(0, 16, 38, .96);
  border: 1px solid rgba(215,11,32,.9);
  border-radius: 8px;
  box-shadow: 0 16px 44px rgba(0,0,0,.42);
  transform: translateX(-50%);
}

.install-prompt[hidden] {
  display: none;
}

.install-prompt strong,
.install-prompt span {
  display: block;
}

.install-prompt span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 14px;
}

.install-prompt button {
  min-width: 96px;
}

#dismissInstall {
  min-width: 42px;
  padding: 0;
  background: rgba(255,255,255,.12);
  font-size: 22px;
}

@media (max-width: 820px) {
  body { grid-template-columns: 1fr; }
  .sidebar { min-height: auto; }
  .sidebar img { width: 120px; }
  .form { grid-template-columns: 1fr; }
  .list-tools { grid-template-columns: 1fr; }
  .pager { flex-wrap: wrap; }
  .pager span { order: -1; width: 100%; }
  .pager button { flex: 1; }
  .install-prompt { grid-template-columns: 1fr; }
  .install-prompt button { width: 100%; }
  .data-row { grid-template-columns: 56px 1fr; }
  .thumb { width: 56px; height: 56px; }
  .row-actions { grid-column: 1 / -1; }
  .row-actions button { flex: 1; }
}
