:root {
  --bg: #f4f6f8;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --line: #d7dde5;
  --primary: #0c7a6b;
  --danger: #b42318;
  --warn: #b54708;
  --ok: #067647;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: radial-gradient(circle at top right, #e8f5f3 0%, var(--bg) 40%);
  color: var(--text);
}

.container {
  width: min(1120px, 92vw);
  margin: 0 auto;
}

.topbar {
  border-bottom: 1px solid var(--line);
  background: #fff;
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.9rem 0;
}

.brand {
  font-weight: 800;
  text-decoration: none;
  color: var(--text);
  letter-spacing: 0.3px;
}

.nav {
  display: flex;
  gap: 0.65rem;
  align-items: center;
  flex-wrap: wrap;
}

.nav a {
  text-decoration: none;
  color: var(--text);
  padding: 0.35rem 0.55rem;
  border-radius: 0.4rem;
}

.nav a:hover {
  background: #edf2f7;
}

.inline-form {
  margin: 0;
}

main {
  padding: 1.2rem 0 2rem;
}

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  padding: 1rem;
  margin-bottom: 1rem;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.7rem;
  flex-wrap: wrap;
}

.auth-card {
  max-width: 420px;
  margin: 2rem auto;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  padding: 1.3rem;
}

.stack-form {
  display: grid;
  gap: 0.55rem;
}

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

label {
  font-weight: 600;
  margin-top: 0.35rem;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 0.45rem;
  padding: 0.55rem 0.65rem;
  font-size: 0.95rem;
}

input[type="checkbox"] {
  width: auto;
  margin-right: 0.35rem;
}

.button {
  border: 0;
  border-radius: 0.45rem;
  padding: 0.55rem 0.85rem;
  background: var(--primary);
  color: #fff;
  text-decoration: none;
  cursor: pointer;
  font-weight: 650;
  display: inline-block;
}

.button-muted {
  background: #d0d5dd;
  color: #111827;
}

.button-analyze {
  background: #0a66c2;
}

.button-analyze:hover {
  background: #084f96;
}

.button-danger {
  background: var(--danger);
}

.button-danger:hover {
  background: #912018;
}

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

.table th,
.table td {
  text-align: left;
  border-bottom: 1px solid var(--line);
  padding: 0.55rem;
  vertical-align: top;
}

.badge {
  display: inline-block;
  border-radius: 99px;
  padding: 0.15rem 0.5rem;
  font-size: 0.78rem;
  font-weight: 700;
  color: #fff;
}

.badge-ok {
  background: var(--ok);
}

.badge-warn {
  background: var(--warn);
}

.badge-danger {
  background: var(--danger);
}

.badge-neutral {
  background: #98a2b3;
}

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

.error {
  color: var(--danger);
}

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

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

.photo-preview {
  width: 100%;
  max-width: 420px;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.75rem;
}

.photo-card {
  display: flex;
  flex-direction: column;
  color: var(--text);
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  overflow: clip;
  background: #fff;
}

.photo-card img {
  width: 100%;
  height: 130px;
  object-fit: cover;
  display: block;
}

.photo-card span {
  display: block;
  font-size: 0.8rem;
  padding: 0.45rem;
}

.photo-link {
  display: block;
}

.photo-card-body {
  display: grid;
  gap: 0.55rem;
  padding: 0.6rem;
}

.photo-meta {
  font-size: 0.85rem;
}

.analysis-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.analysis-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
  font-size: 0.75rem;
  background: #f8fafc;
}

.semafor-dot {
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 999px;
  display: inline-block;
}

.semafor-green {
  background: #16a34a;
}

.semafor-yellow {
  background: #f59e0b;
}

.semafor-red {
  background: #dc2626;
}

.semafor-gray {
  background: #94a3b8;
}

.analysis-details {
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  padding: 0.45rem 0.6rem;
  background: #f8fafc;
}

.analysis-details summary {
  cursor: pointer;
  font-weight: 600;
}

.analysis-details pre {
  margin: 0.6rem 0 0;
  max-height: 260px;
  overflow: auto;
  background: #101828;
  color: #f8fafc;
  border-radius: 0.5rem;
  padding: 0.75rem;
  font-size: 0.77rem;
}

.pairing-box {
  margin-top: 1rem;
  border: 1px dashed var(--line);
  border-radius: 0.6rem;
  padding: 0.75rem;
  background: #f8fbff;
}

.pairing-code {
  margin: 0;
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: 1.5px;
}

.danger-zone {
  border-color: #f3b2ad;
  background: #fff7f6;
}

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

  .table th,
  .table td {
    font-size: 0.87rem;
    padding: 0.4rem;
  }
}
