@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800;900&display=swap');

:root {
  --blue:   #0081C8;
  --yellow: #FCB131;
  --black:  #000000;
  --green:  #00A651;
  --red:    #EF3340;
  --gold:        #FFD700;
  --gold-dark:   #C8A200;
  --navy:        #0a1628;
  --navy-mid:    #162040;
  --navy-light:  #1e3060;
  --country-color: #0081C8;
}

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

body {
  font-family: 'Nunito', system-ui, sans-serif;
  min-height: 100vh;
}

/* ─────────────────────────────────────────
   LOGIN PAGE
───────────────────────────────────────── */
.login-page {
  background: linear-gradient(145deg, var(--navy) 0%, var(--navy-mid) 60%, var(--navy) 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem;
}

/* Stars background */
.login-page::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    radial-gradient(1px 1px at 15% 20%, rgba(255,255,255,0.4) 0%, transparent 100%),
    radial-gradient(1px 1px at 42% 8%,  rgba(255,255,255,0.3) 0%, transparent 100%),
    radial-gradient(1px 1px at 70% 15%, rgba(255,255,255,0.4) 0%, transparent 100%),
    radial-gradient(1px 1px at 88% 30%, rgba(255,255,255,0.2) 0%, transparent 100%),
    radial-gradient(1px 1px at 5%  65%, rgba(255,255,255,0.3) 0%, transparent 100%),
    radial-gradient(1px 1px at 95% 70%, rgba(255,255,255,0.3) 0%, transparent 100%),
    radial-gradient(1px 1px at 30% 85%, rgba(255,255,255,0.2) 0%, transparent 100%),
    radial-gradient(1px 1px at 60% 90%, rgba(255,255,255,0.3) 0%, transparent 100%);
  pointer-events: none;
  z-index: 0;
}

.login-container {
  position: relative;
  z-index: 1;
  text-align: center;
  width: 100%;
  max-width: 480px;
}

/* Olympic rings */
.olympic-rings {
  margin-bottom: 1.5rem;
}

.olympic-rings svg {
  width: 180px;
  height: auto;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.4));
}

/* Title */
.login-title {
  color: #fff;
  font-size: 2.4rem;
  font-weight: 900;
  line-height: 1.1;
  text-shadow: 0 2px 8px rgba(0,0,0,0.5);
}

.login-title span {
  color: var(--gold);
}

.login-subtitle {
  color: rgba(255,255,255,0.55);
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-top: 0.4rem;
  margin-bottom: 2.5rem;
}

/* Card reader area */
.card-reader-area {
  background: rgba(255,255,255,0.04);
  border: 2px solid rgba(255,255,255,0.1);
  border-radius: 28px;
  padding: 2.5rem 2rem;
  cursor: pointer;
  transition: border-color 0.3s, background 0.3s;
  position: relative;
  overflow: hidden;
  user-select: none;
}

.card-reader-area:hover {
  border-color: rgba(255,215,0,0.35);
  background: rgba(255,215,0,0.04);
}

.card-reader-area.scanning {
  border-color: var(--gold);
  background: rgba(255,215,0,0.07);
}

.card-reader-area.scanning .card-reader-icon {
  animation: spin-card 0.6s linear infinite;
  color: var(--gold);
}

/* Floating card icon */
.card-icon-wrap {
  margin-bottom: 1.25rem;
}

.card-reader-icon {
  width: 72px;
  height: 72px;
  color: rgba(255,255,255,0.7);
  animation: float 3s ease-in-out infinite;
  transition: color 0.3s;
}

@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50%       { transform: translateY(-8px); }
}

@keyframes spin-card {
  to { transform: rotate(360deg); }
}

.scan-label {
  color: #fff;
  font-size: 1.25rem;
  font-weight: 800;
}

.scan-hint {
  color: rgba(255,255,255,0.45);
  font-size: 0.95rem;
  margin-top: 0.35rem;
}

/* Pulse rings */
.pulse-rings {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.pulse-ring {
  position: absolute;
  border: 1.5px solid rgba(255,215,0,0.5);
  border-radius: 50%;
  animation: pulse-expand 2.4s ease-out infinite;
  opacity: 0;
}
.pulse-ring:nth-child(2) { animation-delay: 0.8s; }
.pulse-ring:nth-child(3) { animation-delay: 1.6s; }

@keyframes pulse-expand {
  0%   { width: 40px;  height: 40px;  opacity: 0.7; }
  100% { width: 260px; height: 260px; opacity: 0; }
}

/* Hidden card input */
#cardInput {
  position: fixed;
  opacity: 0;
  width: 1px;
  height: 1px;
  top: 0;
  left: 0;
  border: none;
  outline: none;
  pointer-events: none;
}

/* Error box */
.error-box {
  margin-top: 1.25rem;
  background: rgba(239,51,64,0.15);
  border: 1.5px solid rgba(239,51,64,0.5);
  border-radius: 14px;
  padding: 0.85rem 1.25rem;
  color: #ff7b85;
  font-size: 1rem;
  font-weight: 700;
  display: none;
  animation: shake 0.4s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-8px); }
  40%       { transform: translateX(8px); }
  60%       { transform: translateX(-5px); }
  80%       { transform: translateX(5px); }
}

/* Manual test input (Ctrl+Shift+T) */
.manual-input-row {
  display: none;
  gap: 0.6rem;
  margin-top: 0.75rem;
}

.manual-input-row.open {
  display: flex;
}

.manual-input-row input {
  flex: 1;
  background: rgba(255,255,255,0.07);
  border: 1.5px solid rgba(255,255,255,0.2);
  border-radius: 10px;
  color: #fff;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  padding: 0.6rem 1rem;
  outline: none;
  transition: border-color 0.2s;
}

.manual-input-row input::placeholder {
  color: rgba(255,255,255,0.25);
}

.manual-input-row input:focus {
  border-color: var(--gold);
}

.manual-submit-btn {
  background: var(--gold);
  border: none;
  border-radius: 10px;
  color: var(--navy);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 800;
  padding: 0.6rem 1.1rem;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.manual-submit-btn:hover  { background: #ffe033; }
.manual-submit-btn:active { transform: scale(0.97); }

/* Loading overlay */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10,22,40,0.92);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 200;
  backdrop-filter: blur(4px);
}

.loading-overlay.visible {
  display: flex;
}

.spinner {
  width: 56px;
  height: 56px;
  border: 4px solid rgba(255,255,255,0.1);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
  margin-bottom: 1.25rem;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-text {
  color: rgba(255,255,255,0.7);
  font-size: 1.1rem;
  font-weight: 600;
}

/* ─────────────────────────────────────────
   DASHBOARD PAGE
───────────────────────────────────────── */
.dashboard-page {
  background: #eef2f7;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Header */
.dashboard-header {
  flex-shrink: 0;
  background: var(--country-color, #0081C8);
  background: linear-gradient(
    135deg,
    var(--country-color, #0081C8) 0%,
    color-mix(in srgb, var(--country-color, #0081C8) 65%, #000) 100%
  );
  padding: 2rem 1.5rem 2.5rem;
  color: #fff;
  position: relative;
  overflow: hidden;
}

/* Countdown bar */
.countdown-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 7px;
  background: rgba(255,255,255,0.18);
  overflow: hidden;
}

.countdown-fill {
  height: 100%;
  width: 100%;
  background: rgba(255,255,255,0.85);
  transition: width 1s linear, background 0.6s ease;
  will-change: width;
}


/* Decorative circle */
.dashboard-header::after {
  content: '';
  position: absolute;
  top: -80px;
  right: -80px;
  width: 360px;
  height: 360px;
  background: rgba(255,255,255,0.07);
  border-radius: 50%;
  pointer-events: none;
}

.header-inner {
  position: relative;
  z-index: 1;
  max-width: 860px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.country-identity {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.country-flag {
  font-size: 5rem;
  line-height: 1;
  filter: drop-shadow(0 4px 10px rgba(0,0,0,0.35));
}

.country-text-block h1 {
  font-size: 2.2rem;
  font-weight: 900;
  line-height: 1.05;
  text-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.greeting-line {
  font-size: 1.1rem;
  opacity: 0.85;
  margin-top: 0.3rem;
  font-weight: 600;
}

/* Total points widget */
.points-widget {
  background: rgba(0,0,0,0.2);
  border: 2px solid rgba(255,255,255,0.2);
  border-radius: 20px;
  padding: 1.25rem 2rem;
  text-align: center;
  min-width: 160px;
  backdrop-filter: blur(8px);
}

.points-widget-label {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  opacity: 0.75;
}

.points-widget-value {
  font-size: 3.5rem;
  font-weight: 900;
  color: var(--gold);
  line-height: 1;
  text-shadow: 0 0 20px rgba(255,215,0,0.45);
  margin: 0.15rem 0;
}

.points-widget-unit {
  font-size: 0.95rem;
  opacity: 0.75;
  font-weight: 600;
}

/* Logout */
.logout-btn {
  position: absolute;
  top: 1rem;
  right: 1.5rem;
  background: transparent;
  border: 1.5px solid rgba(255,255,255,0.35);
  color: rgba(255,255,255,0.85);
  padding: 0.45rem 1.1rem;
  border-radius: 50px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  z-index: 2;
}

.logout-btn:hover {
  background: rgba(255,255,255,0.15);
  border-color: rgba(255,255,255,0.65);
  color: #fff;
}

/* Main content area */
.dashboard-content {
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  padding: 1.25rem 1.5rem 1rem;
  flex: 1;
  overflow: hidden;
  display: grid;
  grid-template-columns: 2fr 3fr;
  gap: 1.25rem;
  min-height: 0;
}

.dash-left,
.dash-right {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

/* Podium */
.podium-wrap {
  background: #fff;
  border-radius: 16px;
  padding: 0.9rem 0.75rem 0;
  box-shadow: 0 2px 10px rgba(0,0,0,0.06);
  flex-shrink: 0;
  margin-bottom: 0.75rem;
}

.podium {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 0.4rem;
}

.podium-place {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
}

.podium-info {
  text-align: center;
  margin-bottom: 0.4rem;
  padding: 0 0.15rem;
}

.podium-flag {
  display: block;
  font-size: 1.7rem;
  line-height: 1.2;
}

.podium-name {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  color: #2a3550;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 90px;
}

.podium-pts {
  display: block;
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--gold-dark);
}

.podium-block {
  width: 100%;
  border-radius: 8px 8px 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.podium-place.first  .podium-block { height: 88px; background: linear-gradient(to top, #c8920a, #FFD700); }
.podium-place.second .podium-block { height: 64px; background: linear-gradient(to top, #7a7a7a, #C0C0C0); }
.podium-place.third  .podium-block { height: 46px; background: linear-gradient(to top, #7a4a00, #CD7F32); }

.podium-place.own-team .podium-name  { color: var(--blue); font-size: 0.78rem; }
.podium-place.own-team .podium-block { box-shadow: inset 0 0 0 3px rgba(255,255,255,0.6); }

/* Ranking list */
.ranking-list {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  background: #fff;
  border-radius: 16px;
  padding: 0.5rem;
  box-shadow: 0 2px 10px rgba(0,0,0,0.06);
}

.ranking-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.45rem 0.65rem;
  border-radius: 10px;
  flex-shrink: 0;
  transition: background 0.15s;
}

.ranking-row.own-team {
  background: rgba(0,129,200,0.1);
  border-left: 3px solid var(--blue);
  padding-left: 0.45rem;
}

.rank-medal { font-size: 1rem; width: 22px; text-align: center; flex-shrink: 0; }
.rank-pos   { font-size: 0.85rem; font-weight: 800; color: #8a97b0; width: 22px; text-align: center; flex-shrink: 0; }
.rank-flag  { font-size: 1.25rem; flex-shrink: 0; }
.rank-name  { flex: 1; font-weight: 700; font-size: 0.88rem; color: #1a2540; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-pts   { font-weight: 800; font-size: 0.95rem; color: var(--blue); flex-shrink: 0; }

/* Section heading variant */
.section-heading--sm {
  font-size: 1.05rem;
  margin-top: 0;
  margin-bottom: 0.6rem;
}

.section-heading {
  flex-shrink: 0;
  font-size: 1.3rem;
  font-weight: 800;
  color: #1a2540;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.section-heading svg {
  color: var(--gold-dark);
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

/* Entry cards */
.entries-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  flex: 1;
  overflow: hidden;
}

.entry-card {
  background: #fff;
  border-radius: 18px;
  padding: 1.1rem 1.4rem;
  display: flex;
  align-items: center;
  gap: 1.1rem;
  box-shadow: 0 2px 10px rgba(0,0,0,0.06);
  transition: transform 0.18s, box-shadow 0.18s;
  animation: slide-in 0.3s ease both;
}

.entry-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.1);
}

@keyframes slide-in {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.entry-medal-icon {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dark) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
  box-shadow: 0 3px 10px rgba(255,215,0,0.45);
}

.entry-body {
  flex: 1;
  min-width: 0;
}

.entry-child-name {
  font-size: 1.05rem;
  font-weight: 800;
  color: #1a2540;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.entry-task-name {
  font-size: 0.92rem;
  color: #6b7a99;
  margin-top: 0.15rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.entry-right {
  text-align: right;
  flex-shrink: 0;
}

.entry-points-value {
  font-size: 1.9rem;
  font-weight: 900;
  color: var(--blue);
  line-height: 1;
}

.entry-points--neg {
  color: #dc2626;
}

.entry-timestamp {
  font-size: 0.8rem;
  color: #b0bac9;
  margin-top: 0.2rem;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: #a0abbf;
}

.empty-state svg {
  width: 64px;
  height: 64px;
  opacity: 0.3;
  margin-bottom: 1rem;
}

.empty-state p {
  font-size: 1.1rem;
  font-weight: 600;
}

/* Responsive */
@media (max-width: 560px) {
  .login-title       { font-size: 1.9rem; }
  .country-text-block h1 { font-size: 1.7rem; }
  .points-widget-value   { font-size: 2.8rem; }
  .header-inner          { flex-direction: column; align-items: flex-start; }
  .points-widget         { width: 100%; }
}

/* ─────────────────────────────────────────
   ADMIN PAGE
───────────────────────────────────────── */
.admin-page {
  background: #f0f4f8;
  min-height: 100vh;
}

/* Header */
.admin-header {
  background: var(--navy);
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 2px 12px rgba(0,0,0,0.3);
}

.admin-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  max-width: 1100px;
  margin: 0 auto;
}

.admin-brand {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  color: #fff;
}

.admin-brand svg {
  width: 32px;
  height: 32px;
  color: var(--gold);
  flex-shrink: 0;
}

.admin-brand-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: #fff;
}

.admin-brand-sub {
  font-size: 0.78rem;
  color: rgba(255,255,255,0.45);
  font-weight: 600;
}

/* Tabs */
.admin-tabs {
  display: flex;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.tab-btn {
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  color: rgba(255,255,255,0.5);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  padding: 0.75rem 1.1rem;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}

.tab-btn:hover { color: rgba(255,255,255,0.85); }

.tab-btn.active {
  color: #fff;
  border-bottom-color: var(--gold);
}

/* Main area */
.admin-main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

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

/* Panel bar */
.panel-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.panel-title {
  font-size: 1.4rem;
  font-weight: 800;
  color: #1a2540;
}

.sub-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #1a2540;
  margin: 1.75rem 0 0.85rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: inherit;
  font-weight: 700;
  cursor: pointer;
  border: none;
  border-radius: 10px;
  padding: 0.6rem 1.2rem;
  font-size: 0.92rem;
  transition: background 0.15s, transform 0.1s, opacity 0.15s;
  text-decoration: none;
}

.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: var(--blue);
  color: #fff;
}
.btn-primary:hover { background: #006aab; }

.btn-ghost {
  background: rgba(0,0,0,0.06);
  color: #444;
}
.btn-ghost:hover { background: rgba(0,0,0,0.12); }

.btn-danger {
  background: rgba(239,51,64,0.1);
  color: #c0001a;
}
.btn-danger:hover { background: rgba(239,51,64,0.18); }

.btn-outline-white {
  background: transparent;
  border: 1.5px solid rgba(255,255,255,0.35);
  color: rgba(255,255,255,0.85);
}
.btn-outline-white:hover {
  background: rgba(255,255,255,0.12);
  border-color: rgba(255,255,255,0.65);
  color: #fff;
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.82rem;
  border-radius: 8px;
}

/* Table */
.table-wrap {
  background: #fff;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0,0,0,0.06);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.admin-table thead tr {
  background: #f8fafc;
  border-bottom: 1.5px solid #e8edf3;
}

.admin-table th {
  text-align: left;
  padding: 0.85rem 1.1rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: #8a97b0;
}

.admin-table tbody tr {
  border-bottom: 1px solid #f0f4f8;
  transition: background 0.15s;
}
.admin-table tbody tr:last-child { border-bottom: none; }
.admin-table tbody tr:hover { background: #fafbff; }

.admin-table td {
  padding: 0.9rem 1.1rem;
  color: #2a3550;
  vertical-align: middle;
}

.td-flag   { font-size: 1.8rem; width: 60px; }
.td-name   { font-weight: 700; }
.td-actions { white-space: nowrap; text-align: right; }
.td-date   { color: #8a97b0; font-size: 0.85rem; white-space: nowrap; }

.card-id {
  background: #f0f4f8;
  border-radius: 6px;
  padding: 0.2rem 0.5rem;
  font-size: 0.88rem;
  font-family: 'Courier New', monospace;
  color: #3a4560;
}

.color-swatch {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
  border: 1px solid rgba(0,0,0,0.1);
}

.points-badge {
  background: rgba(0,129,200,0.1);
  color: var(--blue);
  font-weight: 800;
  font-size: 1rem;
  padding: 0.2rem 0.6rem;
  border-radius: 8px;
}

.points-badge--neg {
  background: #fee2e2;
  color: #dc2626;
}

.empty-hint {
  background: #fff;
  border-radius: 18px;
  padding: 2.5rem;
  text-align: center;
  color: #a0abbf;
  font-size: 1rem;
  font-weight: 600;
  box-shadow: 0 2px 10px rgba(0,0,0,0.06);
}

.loading-row {
  padding: 1.5rem;
  color: #a0abbf;
  font-weight: 600;
}

/* Award form */
.award-card {
  background: #fff;
  border-radius: 18px;
  padding: 1.5rem;
  box-shadow: 0 2px 10px rgba(0,0,0,0.06);
  margin-bottom: 0.5rem;
}

.award-form {
  display: flex;
  gap: 1rem;
  align-items: flex-end;
  flex-wrap: wrap;
}

.award-form .form-group { margin-bottom: 0; flex: 1; min-width: 160px; }
.award-points-group     { max-width: 130px; }

.award-btn {
  flex-shrink: 0;
  align-self: flex-end;
  padding: 0.65rem 1.4rem;
}

.award-feedback {
  margin-top: 0.85rem;
  font-size: 0.95rem;
  font-weight: 700;
  min-height: 1.4em;
}
.award-feedback.success { color: #00a651; }
.award-feedback.error   { color: #c0001a; }

/* Form elements */
.form-group { margin-bottom: 1.1rem; }

.form-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  color: #5a6880;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 0.4rem;
}

.form-input {
  display: block;
  width: 100%;
  background: #f5f7fa;
  border: 1.5px solid #dde3ed;
  border-radius: 10px;
  padding: 0.65rem 0.9rem;
  font-family: inherit;
  font-size: 0.97rem;
  color: #1a2540;
  outline: none;
  transition: border-color 0.2s, background 0.2s;
}

.form-input:focus {
  border-color: var(--blue);
  background: #fff;
}

select.form-input { appearance: auto; }

.form-color {
  height: 42px;
  padding: 0.2rem 0.4rem;
  cursor: pointer;
}

.form-hint {
  display: block;
  font-size: 0.8rem;
  color: #8a97b0;
  margin-top: 0.3rem;
}

/* Modal */
.admin-modal {
  border: none;
  border-radius: 20px;
  padding: 0;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  max-width: 540px;
  width: calc(100vw - 2rem);
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  margin: 0;
}

.admin-modal::backdrop {
  background: rgba(10,22,40,0.6);
  backdrop-filter: blur(3px);
}

.modal-inner {
  padding: 2rem;
}

.modal-title {
  font-size: 1.3rem;
  font-weight: 800;
  color: #1a2540;
  margin-bottom: 1.5rem;
}

.modal-body { margin-bottom: 0.5rem; }

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid #eef1f7;
}

.modal-error {
  background: rgba(239,51,64,0.08);
  border: 1px solid rgba(239,51,64,0.3);
  border-radius: 8px;
  padding: 0.6rem 0.9rem;
  color: #c0001a;
  font-size: 0.9rem;
  font-weight: 600;
  margin-top: 1rem;
}

/* Settings */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
  align-items: start;
}

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

.settings-card {
  background: #fff;
  border-radius: 18px;
  padding: 1.75rem;
  box-shadow: 0 2px 10px rgba(0,0,0,0.06);
}

.settings-input-short { max-width: 120px; flex: none !important; }
.settings-unit { font-size: 0.9rem; color: #6b7a99; white-space: nowrap; align-self: center; }

.settings-card-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: #1a2540;
  margin-bottom: 0.5rem;
}

.settings-card-hint {
  color: #6b7a99;
  font-size: 0.9rem;
  line-height: 1.55;
  margin-bottom: 1.25rem;
}

.settings-form {
  display: flex;
  gap: 0.75rem;
  align-items: flex-end;
}

.settings-form .form-input { flex: 1; }

.settings-current {
  margin-top: 1rem;
  font-size: 0.88rem;
  color: #8a97b0;
}

/* Emoji picker */
.emoji-field {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.6rem;
}

.emoji-preview-lg {
  font-size: 2.2rem;
  line-height: 1;
  min-width: 2.4rem;
  text-align: center;
  flex-shrink: 0;
}

.emoji-picker-box {
  border: 1.5px solid #c8d0e0;
  border-radius: 12px;
  padding: 0.65rem;
  background: #f8faff;
}

.emoji-search-input {
  margin-bottom: 0.55rem;
}

.emoji-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(38px, 1fr));
  gap: 2px;
  max-height: 168px;
  overflow-y: auto;
}

.emoji-btn {
  font-size: 1.45rem;
  line-height: 1;
  padding: 0.25rem;
  border: none;
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.12s;
  text-align: center;
}

.emoji-btn:hover { background: #e0eaff; }
.emoji-btn:active { background: #c7d9ff; }

.emoji-source-hint {
  font-size: 0.78rem;
  color: #8a97b0;
  margin-bottom: 0.4rem;
  min-height: 1.1em;
}

.emoji-empty {
  padding: 0.5rem;
  color: #8a97b0;
  font-size: 0.88rem;
}

/* Combobox (searchable dropdown) */
.combobox {
  position: relative;
}

.combobox-input {
  padding-right: 2.2rem; /* space for chevron */
}

.combobox-chevron {
  position: absolute;
  right: 0.7rem;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: #8a97b0;
  pointer-events: none;
  transition: transform 0.2s;
}

.combobox:focus-within .combobox-chevron {
  transform: translateY(-50%) rotate(180deg);
  color: var(--blue);
}

.combobox-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: #fff;
  border: 1.5px solid #c8d0e0;
  border-radius: 12px;
  box-shadow: 0 8px 28px rgba(0,0,0,0.13);
  z-index: 200;
  max-height: 260px;
  overflow-y: auto;
  overflow-x: hidden;
}

.combobox-dropdown.open { display: block; }

.combobox-item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.6rem 0.9rem;
  cursor: pointer;
  transition: background 0.12s;
  border-radius: 0;
}

.combobox-item:first-child { border-radius: 10px 10px 0 0; }
.combobox-item:last-child  { border-radius: 0 0 10px 10px; }
.combobox-item:only-child  { border-radius: 10px; }

.combobox-item:hover,
.combobox-item.active {
  background: #eef4ff;
}

.combobox-flag { font-size: 1.2rem; flex-shrink: 0; }
.combobox-team { font-size: 0.78rem; color: #8a97b0; font-weight: 600; min-width: 80px; flex-shrink: 0; }
.combobox-name { font-weight: 700; color: #1a2540; font-size: 0.92rem; }

.combobox-empty {
  padding: 0.75rem 0.9rem;
  color: #a0abbf;
  font-size: 0.9rem;
  font-style: italic;
}

.settings-current code {
  background: #f0f4f8;
  border-radius: 6px;
  padding: 0.15rem 0.5rem;
  font-family: 'Courier New', monospace;
  color: #3a4560;
}

/* ── CSV Import ─────────────────────────────────────────────────────────────── */

.csv-card {
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.06);
  margin-bottom: 1.75rem;
  overflow: hidden;
}

.csv-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 1.5rem;
}

.csv-card-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: #1a2540;
}

.csv-card-body { padding: 0 1.5rem 1.5rem; }

/* Drop area */
.csv-file-area {
  border: 2px dashed #c8d0e0;
  border-radius: 14px;
  padding: 2.5rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  user-select: none;
  outline: none;
}

.csv-file-area:hover,
.csv-file-area:focus,
.csv-file-area.drag-over {
  border-color: var(--blue);
  background: #eef4ff;
}

.csv-file-icon { font-size: 2.5rem; margin-bottom: 0.75rem; }

.csv-file-text {
  font-size: 1rem;
  font-weight: 700;
  color: #1a2540;
  margin-bottom: 0.3rem;
}

.csv-file-hint { font-size: 0.85rem; color: #8a97b0; }

/* Chosen file bar */
.csv-file-chosen {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem 1rem;
  background: #f5f7fa;
  border-radius: 10px;
  margin-bottom: 1.25rem;
  font-weight: 700;
  color: #1a2540;
  font-size: 0.95rem;
}

.csv-chosen-icon { font-size: 1.25rem; flex-shrink: 0; }
.csv-chosen-rows { color: #8a97b0; font-weight: 600; font-size: 0.85rem; flex: 1; }

/* Section title (inside card) */
.csv-section-title {
  font-size: 0.92rem;
  font-weight: 800;
  color: #1a2540;
  margin-bottom: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Mapping selects */
.csv-mapping-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.85rem;
  margin-bottom: 1rem;
}

@media (max-width: 640px) {
  .csv-mapping-grid { grid-template-columns: 1fr; }
}

.csv-mapping-grid .form-group { margin-bottom: 0; }

/* Match mode radios */
.csv-match-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.csv-match-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: #5a6880;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.csv-radio-label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.92rem;
  font-weight: 700;
  color: #1a2540;
  cursor: pointer;
}

/* Result bar */
.csv-result-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.1rem;
  background: #f5f7fa;
  border-radius: 12px;
  flex-wrap: wrap;
}

.csv-ok-badge  { font-weight: 700; color: #00a651; font-size: 1rem; }
.csv-err-badge { font-weight: 700; color: #c0001a; font-size: 1rem; }

/* Failed rows */
.csv-fail-row {
  border: 1.5px solid #e8edf3;
  border-radius: 14px;
  padding: 1.1rem;
  margin-bottom: 0.75rem;
  display: flex;
  gap: 1rem;
  align-items: flex-end;
  flex-wrap: wrap;
  transition: opacity 0.25s, background 0.25s;
}

.csv-fail-fields {
  display: grid;
  grid-template-columns: 2fr 2fr 1fr;
  gap: 0.75rem;
  flex: 1;
  min-width: 0;
}

@media (max-width: 640px) {
  .csv-fail-fields { grid-template-columns: 1fr; }
  .csv-fail-actions { flex-direction: row; }
}

.csv-fail-fields .form-group { margin-bottom: 0; }

.csv-fail-actions {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  flex-shrink: 0;
}

.csv-fail-row--saved {
  opacity: 0.5;
  border-color: #bbf7d0;
  background: #f0fdf4;
}

.csv-fail-row--skipped { opacity: 0.35; }
