*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --bg: #f5f7f5;
  --surface: #ffffff;
  --surface-variant: #f0f4f0;
  --border: #dce5dc;
  --text: #1b2e1b;
  --text-secondary: #5f7060;
  --primary: #2e7d32;
  --primary-dark: #1b5e20;
  --primary-light: #e8f5e9;
  --primary-on: #ffffff;
  --green: #2e7d32;
  --green-light: #e8f5e9;
  --green-border: #a5d6a7;
  --red: #c62828;
  --red-light: #ffebee;
  --red-border: #ef9a9a;
  --amber: #f57f17;
  --amber-light: #fff8e1;
  --amber-border: #ffe082;
  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 6px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
  --font: 'Inter', system-ui, -apple-system, sans-serif;
  --transition: 180ms cubic-bezier(0.4, 0, 0.2, 1);
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

.hidden {
  display: none !important;
}

/* ——— Gate ——— */
.gate {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: linear-gradient(145deg, #1b5e20, #43a047 50%, #66bb6a);
}

.gate-card {
  background: var(--surface);
  padding: 2.5rem 2rem;
  border-radius: 24px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.18);
  max-width: 380px;
  width: 100%;
  text-align: center;
}

.gate-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 1.25rem;
  background: var(--primary-light);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gate-icon .material-icons-round {
  font-size: 32px;
  color: var(--primary);
}

.gate-card h1 {
  margin: 0 0 0.4rem;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

.gate-card p {
  margin: 0 0 1.5rem;
  color: var(--text-secondary);
  font-size: 0.92rem;
}

.gate-card form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.gate-card input {
  font-family: var(--font);
  font-size: 1.5rem;
  padding: 0.85rem 1rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  letter-spacing: 0.35em;
  text-align: center;
  transition: border-color var(--transition), box-shadow var(--transition);
  background: var(--surface);
}

.gate-card input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.15);
}

.gate-card button {
  font-family: var(--font);
  font-size: 1rem;
  padding: 0.85rem 1rem;
  background: var(--primary);
  color: var(--primary-on);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: background var(--transition), transform 80ms ease;
}

.gate-card button:hover {
  background: var(--primary-dark);
}

.gate-card button:active {
  transform: scale(0.97);
}

.btn-icon {
  font-size: 20px;
}

.error {
  color: var(--red);
  font-size: 0.875rem;
  margin-top: 0.5rem;
}

/* ——— App shell ——— */
.app {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 1rem 3rem;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
  padding: 1rem 0 0;
  margin-bottom: 1.25rem;
}

.app-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.app-header h1 {
  margin: 0;
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.header-icon {
  font-size: 26px;
  color: var(--primary);
}

/* ——— Tabs ——— */
.tabs {
  display: flex;
  gap: 0;
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 4px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}

.tab {
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.55rem 1rem;
  border: none;
  background: none;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: var(--radius-xs);
  transition: all var(--transition);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  white-space: nowrap;
  flex: 1;
  justify-content: center;
}

.tab:hover {
  color: var(--text);
  background: var(--surface-variant);
}

.tab.active {
  color: var(--primary-on);
  background: var(--primary);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.tab-icon {
  font-size: 18px;
}

.tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.4rem;
  height: 1.4rem;
  padding: 0 0.35rem;
  font-size: 0.72rem;
  font-weight: 700;
  background: rgba(0,0,0,0.15);
  color: inherit;
  border-radius: 99px;
}

.tab:not(.active) .tab-badge {
  background: var(--border);
  color: var(--text-secondary);
}

.settings-gear {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: none;
  background: none;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: color var(--transition), background var(--transition);
}

.settings-gear:hover {
  color: var(--primary);
  background: var(--surface-variant);
}

.settings-gear .material-icons-round {
  font-size: 22px;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.loading,
.empty {
  text-align: center;
  color: var(--text-secondary);
  padding: 3rem 1rem;
  font-size: 0.95rem;
}

/* ——— Vendor cards ——— */
.vendors-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.vendor-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  transition: box-shadow var(--transition), transform var(--transition);
}

.vendor-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.vendor-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.vendor-name {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.vendor-category {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2em 0.7em;
  border-radius: 99px;
  white-space: nowrap;
}

.vendor-nep {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2em 0.7em;
  border-radius: 99px;
  white-space: nowrap;
}

.vendor-app-received {
  margin-left: auto;
  font-size: 0.8rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

.section-label {
  display: block;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-secondary);
  margin-bottom: 0.3rem;
}

.vendor-details,
.vendor-social {
  margin-bottom: 1rem;
}

.vendor-details p {
  margin: 0;
  white-space: pre-wrap;
  color: var(--text);
  font-size: 0.9rem;
}

.social-text {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.9rem;
}

.social-text a {
  color: var(--primary);
  text-decoration: none;
  transition: color var(--transition);
}

.social-text a:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

.vendor-photos {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.vendor-photos img {
  width: 140px;
  height: 140px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
}

.vendor-photos img:hover {
  transform: scale(1.04);
  box-shadow: var(--shadow-lg);
}

/* ——— Lightbox ——— */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  backdrop-filter: blur(4px);
}

.lightbox img {
  max-width: 95vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: var(--radius-sm);
}

.lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1.25rem;
  background: rgba(255, 255, 255, 0.12);
  border: none;
  color: #fff;
  cursor: pointer;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition);
}

.lightbox-close .material-icons-round {
  font-size: 24px;
}

.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* ——— Notes ——— */
.vendor-manager-note {
  margin-bottom: 1rem;
}

.vendor-manager-note label {
  display: block;
}

.vendor-manager-note textarea,
.juror-note-textarea {
  width: 100%;
  margin: 0.3rem 0 0.5rem;
  padding: 0.6rem 0.75rem;
  font-family: var(--font);
  font-size: 0.875rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  resize: vertical;
  transition: border-color var(--transition), box-shadow var(--transition);
  color: var(--text);
  background: var(--surface);
}

.vendor-manager-note textarea:focus,
.juror-note-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.1);
}

.btn-save-note,
.btn-save-juror-note {
  font-family: var(--font);
  font-size: 0.8rem;
  font-weight: 500;
  padding: 0.35rem 0.85rem;
  background: var(--surface);
  color: var(--text);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all var(--transition);
}

.btn-save-note:hover,
.btn-save-juror-note:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}

/* ——— Decisions ——— */
.vendor-decisions {
  border-top: 1px solid var(--border);
  padding-top: 1rem;
  margin-top: 0.5rem;
}

.juror-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.juror-label {
  font-weight: 600;
  font-size: 0.9rem;
  min-width: 3.5rem;
}

.decision-btns {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  align-items: center;
}

.decision-btn {
  font-family: var(--font);
  font-size: 0.8rem;
  font-weight: 500;
  padding: 0.4rem 0.9rem;
  background: var(--surface);
  color: var(--text);
  border: 1.5px solid var(--border);
  border-radius: 99px;
  cursor: pointer;
  transition: all var(--transition);
}

.decision-btn:hover {
  border-color: #9ca3af;
  background: var(--surface-variant);
}

.decision-btn.active[data-decision="approve"] {
  background: var(--green-light);
  color: var(--green);
  border-color: var(--green-border);
  font-weight: 600;
}

.decision-btn.active[data-decision="deny"] {
  background: var(--red-light);
  color: var(--red);
  border-color: var(--red-border);
  font-weight: 600;
}

.decision-btn.active[data-decision="waitlist"] {
  background: var(--amber-light);
  color: var(--amber);
  border-color: var(--amber-border);
  font-weight: 600;
}

.clear-btn {
  font-family: var(--font);
  font-size: 0.72rem;
  font-weight: 500;
  padding: 0.3rem 0.6rem;
  background: none;
  color: var(--text-secondary);
  border: 1px dashed var(--border);
  border-radius: 99px;
  cursor: pointer;
  transition: all var(--transition);
  margin-left: 0.15rem;
}

.clear-btn:hover {
  color: var(--red);
  border-color: var(--red-border);
  background: var(--red-light);
}

.juror-note {
  margin-bottom: 0.75rem;
  margin-left: 4.25rem;
}

.juror-note label {
  display: block;
}

/* ——— Approved vendor cards ——— */
.category-group {
  margin-bottom: 1.75rem;
}

.category-group-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--primary);
  margin: 0 0 0.5rem;
  padding: 0.35rem 0.75rem;
  background: var(--primary-light);
  border-radius: var(--radius-xs);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.category-group-title .material-icons-round {
  font-size: 16px;
}

.category-group-count {
  color: var(--text-secondary);
  font-weight: 500;
}

.approved-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.approved-card {
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 1rem 1.25rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: box-shadow var(--transition);
}

.approved-card:hover {
  box-shadow: var(--shadow);
}

.approved-info {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}

.approved-info-main {
  min-width: 0;
}

.approved-name {
  font-weight: 600;
  font-size: 0.95rem;
  margin: 0 0 0.1rem;
}

.approved-category {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.2em 0.6em;
  border-radius: 99px;
  white-space: nowrap;
  margin-right: 0.35rem;
}

.approved-nep {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.2em 0.6em;
  border-radius: 99px;
  white-space: nowrap;
}

.approved-app-received {
  flex-shrink: 0;
  font-size: 0.8rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

.approved-links {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.approved-links a {
  font-size: 0.78rem;
  color: var(--primary);
  text-decoration: none;
  padding: 0.25rem 0.65rem;
  border: 1px solid rgba(46, 125, 50, 0.2);
  border-radius: 99px;
  transition: all var(--transition);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.approved-links a:hover {
  background: var(--primary-light);
  border-color: var(--primary);
}

/* ——— Settings (modal) ——— */
.settings-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.settings-modal.hidden {
  display: none;
}

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

.settings-modal-content {
  position: relative;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  max-width: 28rem;
  width: 100%;
  max-height: 90vh;
  overflow: auto;
}

.settings-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.settings-modal-header h2 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
}

.settings-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: none;
  background: none;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: color var(--transition), background var(--transition);
}

.settings-close:hover {
  color: var(--text);
  background: var(--surface-variant);
}

.settings-container {
  max-width: none;
  padding: 1.25rem 1.25rem 1.5rem;
}

.settings-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.settings-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.settings-field label,
.settings-field .section-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.settings-field input[type="text"] {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  background: var(--surface);
  color: var(--text);
}

.settings-field input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-light);
}

.settings-jurors-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.settings-juror-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.settings-juror-row .settings-juror-id {
  width: 6rem;
  flex-shrink: 0;
}

.settings-juror-row .settings-juror-name {
  flex: 1;
  min-width: 0;
}

.btn-remove-juror {
  flex-shrink: 0;
  padding: 0.35rem;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: var(--radius);
  transition: color var(--transition), background var(--transition);
}

.btn-remove-juror:hover {
  color: var(--error, #c62828);
  background: rgba(198, 40, 40, 0.08);
}

.btn-add-juror {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.9rem;
  color: var(--primary);
  background: none;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
}

.btn-add-juror:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.settings-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.btn-save-settings {
  padding: 0.6rem 1.2rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: white;
  background: var(--primary);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background var(--transition), transform var(--transition);
}

.btn-save-settings:hover {
  background: var(--primary-dark, #1b5e20);
  transform: translateY(-1px);
}

.settings-message {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.settings-message.error {
  color: var(--error, #c62828);
}

/* ——— Analytics ——— */
.analytics-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.analytics-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  border-left-width: 4px;
  border-left-style: solid;
}

.analytics-card[data-section="total"] { border-left-color: var(--primary); }
.analytics-card[data-section="fees"] { border-left-color: var(--amber); }
.analytics-card[data-section="category"] { border-left-color: var(--primary); }
.analytics-card[data-section="nep"] { border-left-color: #0d47a1; }
.analytics-card[data-section="booth"] { border-left-color: var(--text-secondary); }

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

.analytics-card-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-secondary);
  margin: 0 0 1rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.analytics-card-title .material-icons-round {
  font-size: 18px;
  color: var(--primary);
}

.stat-number {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1.1;
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

.chart-wrap {
  max-width: 280px;
  margin: 0 auto;
}

.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.stat-item {
  text-align: center;
  padding: 1rem;
  background: var(--surface-variant);
  border-radius: var(--radius-sm);
}

.stat-item .stat-number {
  font-size: 1.75rem;
}

.booth-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.nep-list .nep-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0;
}

.nep-swatch {
  display: inline-block;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.25em 0.6em;
  border-radius: 99px;
  white-space: nowrap;
}

.booth-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.75rem;
  background: var(--surface-variant);
  border-radius: var(--radius-xs);
}

.booth-size-label {
  font-weight: 500;
  font-size: 0.9rem;
}

.booth-size-count {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--primary);
  background: var(--primary-light);
  padding: 0.15em 0.55em;
  border-radius: 99px;
}

/* ——— Mobile responsive ——— */
@media (max-width: 640px) {
  .app {
    padding: 0 0.75rem 2rem;
  }

  .app-header {
    padding-top: 0.75rem;
  }

  .app-header h1 {
    font-size: 1.2rem;
  }

  .tabs {
    gap: 0;
  }

  .tab {
    font-size: 0.75rem;
    padding: 0.5rem 0.5rem;
    gap: 0.25rem;
  }

  .tab-icon {
    font-size: 16px;
  }

  .vendor-card {
    padding: 1rem;
  }

  .vendor-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
  }

  .vendor-name {
    font-size: 1rem;
  }

  .juror-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
  }

  .juror-label {
    min-width: auto;
  }

  .juror-note {
    margin-left: 0;
  }

  .decision-btns {
    width: 100%;
  }

  .decision-btn {
    flex: 1;
    text-align: center;
    padding: 0.5rem 0.25rem;
  }

  .vendor-photos img {
    width: 100px;
    height: 100px;
  }

  .vendor-manager-note textarea,
  .juror-note-textarea {
    font-size: 16px;
  }

  .social-text {
    word-break: break-word;
  }

  .analytics-container {
    grid-template-columns: 1fr;
  }

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

  .approved-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.85rem 1rem;
  }

  .approved-links a {
    max-width: 160px;
  }
}
