/*  Vote App — Design System
    Mobile-first, token-based  */

/* ── Tokens ── */
:root {
  --c-bg:       #f4f6f8;
  --c-surface:  #ffffff;
  --c-surface2: #f8f9fb;
  --c-border:   #e3e6ea;
  --c-text:     #1a1d21;
  --c-text2:    #5f6872;
  --c-text3:    #9aa2ad;
  --c-primary:  #4f46e5;
  --c-primary-h:#4338ca;
  --c-primary-l:#eef2ff;
  --c-green:    #16a34a;
  --c-green-l:  #f0fdf4;
  --c-red:      #dc2626;
  --c-red-l:    #fef2f2;
  --c-amber:    #d97706;
  --c-amber-l:  #fffbeb;
  --font:       'Play', system-ui, -apple-system, sans-serif;
  --r:          12px;
  --r-lg:       16px;
  --shadow:     0 1px 3px rgba(0,0,0,.05), 0 1px 2px rgba(0,0,0,.03);
  --shadow-m:   0 4px 12px rgba(0,0,0,.07);
  --tr:         .15s ease;
}

/* ── Reset ── */
*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
html{-webkit-text-size-adjust:100%;scroll-behavior:smooth}

body {
  font-family: var(--font);
  background: var(--c-bg);
  color: var(--c-text);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
  line-height: 1.5;
}

a { color: var(--c-primary); text-decoration: none; }
a:hover { color: var(--c-primary-h); }

/* ── Header ── */
.hdr {
  background: var(--c-text);
  border-bottom: 1px solid rgba(255,255,255,.1);
  padding: 12px 0;
  position: sticky; top: 0; z-index: 50;
}
.hdr-inner {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.hdr-left { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; }
.hdr-logo { height: 32px; flex-shrink: 0; }
.hdr-title { font-size: 1rem; font-weight: 700; color: #fff; }
.hdr-right { display: flex; align-items: center; gap: 8px; }
.hdr-back {
  font-size: .82rem; color: rgba(255,255,255,.7);
  display: inline-flex; align-items: center; gap: 4px;
  padding: 6px 12px; border-radius: 8px;
  background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.15);
  transition: var(--tr); text-decoration: none;
}
.hdr-back:hover { background: rgba(255,255,255,.2); color: #fff; }

/* ── Page ── */
.page { flex: 1; padding: 24px 16px 40px; }
.page-inner { max-width: 720px; margin: 0 auto; }

/* ── Card / Section ── */
.card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: 24px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

/* ── Typography ── */
.t-page   { font-size: 1.35rem; font-weight: 700; color: var(--c-text); margin-bottom: 4px; }
.t-section{ font-size: 1rem; font-weight: 700; color: var(--c-text); margin-bottom: 12px; }
.t-label  { font-size: .78rem; font-weight: 600; color: var(--c-text3); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 6px; }
.t-body   { font-size: .92rem; color: var(--c-text2); line-height: 1.6; }
.t-muted  { color: var(--c-text3); font-size: .85rem; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 18px; border-radius: 10px;
  font: 600 .88rem/1.3 var(--font);
  border: none; cursor: pointer; text-decoration: none;
  transition: var(--tr); white-space: nowrap; color: #fff;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-m); color: #fff; }
.btn:active { transform: none; box-shadow: none; }

.btn-p  { background: var(--c-primary); }
.btn-p:hover  { background: var(--c-primary-h); }
.btn-g  { background: var(--c-green); }
.btn-g:hover  { background: #15803d; }
.btn-r  { background: var(--c-red); }
.btn-r:hover  { background: #b91c1c; }
.btn-a  { background: var(--c-amber); }
.btn-a:hover  { background: #b45309; }
.btn-o  {
  background: transparent; color: var(--c-text2);
  border: 1px solid var(--c-border);
}
.btn-o:hover { background: var(--c-surface2); color: var(--c-text); }

.btn-s  { padding: 7px 14px; font-size: .8rem; border-radius: 8px; }
.btn-l  { padding: 14px 24px; font-size: .95rem; }
.btn-full { width: 100%; }
.btn-icon { width: 34px; height: 34px; padding: 0; border-radius: 8px; }

/* ── Inputs ── */
.input {
  width: 100%; padding: 10px 14px;
  border: 1px solid var(--c-border);
  border-radius: 10px; font: .9rem var(--font);
  background: var(--c-surface); color: var(--c-text);
  transition: var(--tr);
}
.input:focus { outline: none; border-color: var(--c-primary); box-shadow: 0 0 0 3px rgba(79,70,229,.1); }
.input::placeholder { color: var(--c-text3); }

/* ── Checkbox / Radio ── */
.ck, .rd {
  appearance: none; -webkit-appearance: none;
  width: 20px; height: 20px; flex-shrink: 0;
  border: 2px solid var(--c-border); background: #fff;
  cursor: pointer; position: relative; transition: var(--tr);
}
.ck { border-radius: 5px; }
.rd { border-radius: 50%; }
.ck:checked { background: var(--c-primary); border-color: var(--c-primary); }
.ck:checked::after {
  content: '\2713'; position: absolute; top: 50%; left: 50%;
  transform: translate(-50%,-50%); color: #fff; font: bold 12px/1 sans-serif;
}
.rd:checked { border-color: var(--c-primary); }
.rd:checked::before {
  content: ''; width: 10px; height: 10px; background: var(--c-primary);
  border-radius: 50%; position: absolute; top: 50%; left: 50%;
  transform: translate(-50%,-50%);
}
.ck:focus, .rd:focus { outline: none; box-shadow: 0 0 0 3px rgba(79,70,229,.1); }

/* ── Table ── */
.tbl { width: 100%; border-collapse: separate; border-spacing: 0; }
.tbl th, .tbl td { padding: 10px 14px; text-align: left; font-size: .88rem; }
.tbl th {
  background: var(--c-surface2); color: var(--c-text3);
  font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
  border-bottom: 1px solid var(--c-border);
}
.tbl td { border-bottom: 1px solid var(--c-border); }
.tbl tr:last-child td { border-bottom: none; }
.tbl tr:hover td { background: var(--c-primary-l); }
.tbl tr.sel td { background: var(--c-primary-l); }
.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--c-border); border-radius: var(--r); }

/* ── Badge ── */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 20px;
  font-size: .75rem; font-weight: 600;
}
.badge-g { background: var(--c-green-l); color: var(--c-green); }
.badge-y { background: var(--c-amber-l); color: var(--c-amber); }
.badge-n { background: var(--c-surface2); color: var(--c-text3); }

.dot {
  width: 7px; height: 7px; border-radius: 50%; display: inline-block;
}
.dot-g { background: var(--c-green); animation: blink 2s ease infinite; }
@keyframes blink { 0%,100%{opacity:1}50%{opacity:.4} }

/* ── Alert box ── */
.abox {
  padding: 14px 18px; border-radius: var(--r); margin-bottom: 16px;
  font-size: .88rem; display: flex; flex-direction: column; gap: 10px;
}
.abox-g { background: var(--c-green-l); border: 1px solid #bbf7d0; color: #166534; }
.abox-r { background: var(--c-red-l); border: 1px solid #fecaca; color: var(--c-red); }

/* ── Vector card ── */
.vcard {
  background: var(--c-surface); border: 1px solid var(--c-border);
  border-radius: var(--r-lg); padding: 18px;
  transition: var(--tr); display: flex; flex-direction: column; gap: 12px;
}
.vcard:hover { box-shadow: var(--shadow-m); }
.vcard-name { font-size: 1rem; font-weight: 700; color: var(--c-text); }
.vcard-name a { color: inherit; text-decoration: none; }
.vcard-name a:hover { color: var(--c-primary); }
.vcard-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ── Grid ── */
.grid { display: grid; gap: 12px; }
.grid-2 { grid-template-columns: 1fr; }

/* ── Flex helpers ── */
.flex { display: flex; }
.flex-b { justify-content: space-between; }
.flex-c { justify-content: center; }
.flex-w { flex-wrap: wrap; }
.flex-col { flex-direction: column; }
.items-c { align-items: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.w-full { width: 100%; }
.text-c { text-align: center; }

/* ── Divider ── */
.divider { border: none; border-top: 1px solid var(--c-border); margin: 20px 0; }

/* ── Employee list ── */
.emp-list {
  max-height: 240px; overflow-y: auto;
  border: 1px solid var(--c-border); border-radius: var(--r);
  background: var(--c-surface);
}
.emp-item {
  padding: 10px 14px; font-size: .88rem;
  display: flex; align-items: center; gap: 8px;
  cursor: pointer; transition: var(--tr);
  border-bottom: 1px solid var(--c-border);
}
.emp-item:last-child { border-bottom: none; }
.emp-item:hover { background: var(--c-primary-l); }
.emp-item i { color: var(--c-primary); font-size: .85rem; }

/* ── Voting list ── */
.vlist { list-style: none; }
.vlist-item {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; margin-bottom: 6px;
  border-radius: var(--r); background: var(--c-surface2);
  border: 2px solid transparent;
  cursor: pointer; transition: var(--tr);
}
.vlist-item:hover { border-color: var(--c-primary-l); background: var(--c-primary-l); }
.vlist-item.active { border-color: var(--c-primary); background: var(--c-primary-l); }
.vlist-item label { cursor: pointer; font-weight: 500; flex: 1; }

.unicorn {
  height: 22px; width: auto; flex-shrink: 0;
  opacity: 0; transform: scale(.5);
  transition: .3s cubic-bezier(.68,-.55,.27,1.55);
}
.unicorn.show { opacity: 1; transform: scale(1); }

/* ── Empty state ── */
.empty {
  text-align: center; padding: 40px 20px; color: var(--c-text3);
}
.empty i { font-size: 2rem; display: block; margin-bottom: 10px; opacity: .5; }

/* ── Modal ── */
.modal-bg {
  display: none; position: fixed; z-index: 100; inset: 0;
  background: rgba(0,0,0,.35); backdrop-filter: blur(3px);
}
.modal-box {
  background: var(--c-surface); border-radius: var(--r-lg);
  max-width: 420px; width: 92%; margin: 15dvh auto;
  padding: 28px; box-shadow: var(--shadow-m);
  animation: fadeUp .2s ease;
}
@keyframes fadeUp { from{opacity:0;transform:translateY(16px)} to{opacity:1;transform:none} }

/* ── Footer ── */
.ftr {
  background: var(--c-surface); border-top: 1px solid var(--c-border);
  text-align: center; padding: 14px 16px; margin-top: auto;
  font-size: .78rem; color: var(--c-text3);
}

/* ── QR ── */
.qr-img {
  max-width: 240px; width: 100%; display: block; margin: 0 auto;
  background: #fff; border: 1px solid var(--c-border);
  border-radius: var(--r-lg); padding: 12px;
  box-shadow: var(--shadow-m);
}

/* ══ Responsive ══ */
@media (min-width: 600px) {
  .grid-2 { grid-template-columns: 1fr 1fr; }
  .page { padding: 32px 24px 48px; }
  .card { padding: 28px; }
  body { font-size: 16px; }
}

@media (min-width: 900px) {
  .page-inner { max-width: 800px; }
  .hdr-inner { max-width: 800px; }
}
