* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text-primary);
  padding: 24px 16px 64px;
}

.app { max-width: 480px; margin: 0 auto; }

header.top { margin-bottom: 20px; display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
header.top h1 { font-size: 20px; font-weight: 600; margin: 0 0 4px; }
header.top p { font-size: 13px; color: var(--text-secondary); margin: 0; }

nav.tabs { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }
nav.tabs button {
  flex: 1 1 auto;
  min-width: 78px;
  padding: 10px 4px;
  font-size: 13px;
  font-family: inherit;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface-1);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all .15s ease;
}
nav.tabs button.active {
  border: 2px solid var(--accent);
  background: var(--accent-bg);
  color: var(--accent-text);
  font-weight: 600;
}

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

.card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  margin-bottom: 14px;
}
.card-title { font-size: 13px; color: var(--text-secondary); margin: 0 0 10px; }
.card h2 { font-size: 15px; font-weight: 600; margin: 0 0 12px; }

.metrics-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; margin-bottom: 14px; }
.metric { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; }
.metric .label { font-size: 12px; color: var(--text-secondary); margin: 0 0 4px; }
.metric .value { font-size: 22px; font-weight: 600; margin: 0; }
.metric .value .of { font-size: 13px; color: var(--text-secondary); font-weight: 400; }

.seat-grid { display: grid; grid-template-columns: repeat(20, 1fr); gap: 2px; }
.seat { padding-bottom: 100%; border-radius: 2px; }
.seat.sold { background: var(--accent); }
.seat.free { background: var(--surface-1); border: 1px solid var(--border); }

.vote-row { margin-bottom: 12px; }
.vote-row .top { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 4px; }
.vote-row .top .count { color: var(--text-secondary); }
.bar-track { width: 100%; height: 6px; background: var(--surface-1); border-radius: 3px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--accent); border-radius: 3px; }

table.list { width: 100%; border-collapse: collapse; font-size: 13px; }
table.list th { text-align: left; font-weight: 600; color: var(--text-secondary); font-size: 12px; padding: 6px 4px; border-bottom: 1px solid var(--border-strong); }
table.list td { padding: 10px 4px; border-bottom: 1px solid var(--border); vertical-align: middle; }

.badge { display: inline-block; padding: 3px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.badge.paid { background: var(--success-bg); color: var(--success-text); }
.badge.partial { background: var(--warning-bg); color: var(--warning-text); }
.badge.unpaid { background: var(--danger-bg); color: var(--danger-text); }
.badge.open { background: var(--success-bg); color: var(--success-text); }
.badge.closed { background: var(--danger-bg); color: var(--danger-text); }

.empty-note { font-size: 12px; color: var(--text-muted); margin-top: 8px; }

label { display: block; font-size: 12px; color: var(--text-secondary); font-weight: 600; margin: 0 0 4px; }
input, select, textarea {
  width: 100%;
  padding: 9px 10px;
  margin-bottom: 12px;
  background: var(--surface-1);
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 13px;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }

.btn {
  display: inline-block;
  padding: 9px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: var(--surface-1);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.danger { color: var(--danger-text); border-color: var(--danger); }
.btn.small { padding: 5px 10px; font-size: 12px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.field-row { display: flex; gap: 8px; }
.field-row > * { flex: 1; }

.entry-card { display: flex; gap: 12px; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-1); margin-bottom: 10px; }
.entry-card img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; flex-shrink: 0; background: var(--border); }
.entry-card .body { flex: 1; min-width: 0; }
.entry-card .body h4 { margin: 0 0 4px; font-size: 14px; }
.entry-card .body p { margin: 0; font-size: 12px; color: var(--text-secondary); }

.public-entry { border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 14px; margin-bottom: 14px; background: var(--surface-1); }
.public-entry img { width: 100%; height: 220px; object-fit: cover; border-radius: var(--radius); margin-bottom: 10px; }
.jury-comment { background: var(--bg); border-left: 3px solid var(--accent); border-radius: 0 8px 8px 0; padding: 10px 12px; margin-top: 8px; font-size: 13px; }
.jury-comment strong { display: block; font-size: 11px; color: var(--text-secondary); margin-bottom: 2px; }

.stand-grid { display: grid; gap: 4px; margin-bottom: 12px; }
.stand-cell {
  aspect-ratio: 1;
  border-radius: 6px;
  border: 1px solid var(--border-strong);
  background: var(--surface-1);
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  text-align: center;
  padding: 2px;
  overflow: hidden;
}
.stand-cell.occupied { background: var(--accent-bg); border-color: var(--accent); color: var(--accent-text); font-weight: 600; }
.stand-cell.horseshoe-gap { visibility: hidden; }

.modal-overlay {
  position: fixed; inset: 0; background: rgba(44,44,42,0.45);
  display: flex; align-items: flex-end; justify-content: center; z-index: 50;
}
.modal-sheet {
  background: var(--surface-1); border-radius: 16px 16px 0 0; padding: 20px 18px 24px;
  width: 100%; max-width: 480px; max-height: 80vh; overflow-y: auto;
}
.modal-sheet h3 { margin: 0 0 12px; font-size: 15px; }
.modal-close { float: right; background: none; border: none; font-size: 18px; color: var(--text-secondary); cursor: pointer; }

.pin-gate { max-width: 320px; margin: 80px auto; text-align: center; }
.pin-gate h1 { font-size: 18px; margin-bottom: 6px; }
.pin-gate p { font-size: 13px; color: var(--text-secondary); margin-bottom: 16px; }

.role-nav { display: flex; gap: 8px; margin-top: 10px; }
.role-nav a { font-size: 12px; color: var(--text-secondary); text-decoration: none; }
.role-nav a:hover { color: var(--accent-text); }
