:root {
  color-scheme: light;
  --bg: #f7f7f8;
  --card: #ffffff;
  --text: #15171a;
  --muted: #687080;
  --border: #e6e8ec;
  --primary: #111827;
  --primaryText: #ffffff;
  --danger: #b42318;
  --success: #067647;
  --info: #175cd3;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); }
a { color: inherit; }
button, input { font: inherit; }

.view-page {
  background: #0b0d10;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.image-shell {
  width: min(100%, 860px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

.main-image {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: calc(100vh - 96px);
  border-radius: 16px;
  background: #101418;
  box-shadow: 0 24px 80px rgba(0,0,0,.36);
}

.view-meta {
  color: rgba(255,255,255,.62);
  font-size: 12px;
  text-align: center;
}

.open-original {
  color: rgba(255,255,255,.86);
  font-size: 13px;
  text-decoration: none;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 999px;
  padding: 7px 12px;
  background: rgba(255,255,255,.06);
}

.loader, .empty, .error-box {
  color: #fff;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.13);
  border-radius: 16px;
  padding: 18px 20px;
  text-align: center;
}

.app-page {
  min-height: 100vh;
  padding: 24px 16px 48px;
}

.container {
  width: min(100%, 1040px);
  margin: 0 auto;
}

.auth-container {
  width: min(100%, 430px);
  margin: 80px auto 0;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 18px 50px rgba(16,24,40,.08);
  padding: 22px;
}

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0;
  margin-bottom: 18px;
}

.nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.nav a, .nav button, .button, button {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  padding: 9px 13px;
  text-decoration: none;
  cursor: pointer;
}

.button.primary, button.primary {
  background: var(--primary);
  color: var(--primaryText);
  border-color: var(--primary);
}

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

h1 { margin: 0 0 6px; font-size: 24px; line-height: 1.2; }
p { color: var(--muted); margin: 0 0 18px; }

.field { margin: 14px 0; }
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 7px; }
input[type="email"], input[type="password"], input[type="file"] {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 11px 12px;
  background: #fff;
}

.message {
  min-height: 20px;
  margin-top: 12px;
  font-size: 14px;
  color: var(--muted);
}
.message.error { color: var(--danger); }
.message.success { color: var(--success); }
.message.info { color: var(--info); }

.preview {
  display: block;
  max-width: min(100%, 620px);
  max-height: 520px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #f2f4f7;
  object-fit: contain;
}

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 11px 12px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
th { background: #f9fafb; color: #475467; font-weight: 600; white-space: nowrap; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: 12px; white-space: nowrap; }
.wrap { max-width: 280px; word-break: break-word; }
.badge { display: inline-block; border-radius: 999px; padding: 3px 8px; background: #eef4ff; color: #3538cd; font-size: 12px; white-space: nowrap; }
.empty-row { text-align: center; color: var(--muted); padding: 28px; }

@media (max-width: 640px) {
  .header { align-items: flex-start; flex-direction: column; }
  .card { padding: 18px; }
  .view-page { padding: 10px; align-items: flex-start; }
  .main-image { border-radius: 12px; max-height: calc(100vh - 80px); }
}


/* Network log upgrade */
.wide-container { width: min(100%, 1360px); }
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  margin: 0 0 16px;
}
.stat-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 15px 16px;
  box-shadow: 0 12px 32px rgba(16,24,40,.06);
}
.stat-card span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 5px; }
.stat-card strong { font-size: 24px; line-height: 1; }
.toolbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.inline-field { flex: 1 1 360px; margin: 0; }
input[type="search"] {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 11px 12px;
  background: #fff;
}
.compact-message { margin-top: 0; min-height: auto; }
.note { font-size: 13px; line-height: 1.55; background: #fffaeb; color: #7a5a00; border: 1px solid #fedf89; border-radius: 12px; padding: 10px 12px; margin: 0 0 12px; }
.network-table { min-width: 1500px; }
.network-table th, .network-table td { padding: 9px 10px; }

@media (max-width: 760px) {
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
