/* ============================================================
   UTM Online Voting -- visual refresh
   CSS-only pass: every selector below matches existing markup,
   nothing here requires template/JS changes.
   ============================================================ */

:root {
  /* ink */
  --ink: #0b0b0b;
  --ink-secondary: #52514e;
  --ink-muted: #898781;

  /* surfaces */
  --page: #f6f6f4;
  --surface: #ffffff;
  --border: #e1e0d9;
  --border-strong: #c3c2b7;

  /* brand / accent (categorical slot 1, dataviz palette) */
  --accent: #2a78d6;
  --accent-dark: #184f95;
  --accent-tint: #eaf2fc;

  /* status (dataviz status palette) */
  --good: #0ca30c;
  --good-tint: #e7f7e7;
  --warning: #fab219;
  --serious: #ec835a;
  --critical: #d03b3b;
  --critical-tint: #fdecec;

  /* type */
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-display: 'Cabin', var(--font-body);

  /* scale */
  --radius: 8px;
  --radius-sm: 4px;
  --shadow-1: 0 1px 3px rgba(11,11,11,0.10), 0 1px 2px rgba(11,11,11,0.06);
  --shadow-2: 0 4px 14px rgba(11,11,11,0.12);
}

* { box-sizing: border-box; }

html{
	min-height: 100%; margin-bottom: 1px;
	overflow: -moz-scrollbars-vertical;
	height: 101%;
}

body{
	background-color: var(--page);
	color: var(--ink);
	font-family: var(--font-body);
	-webkit-text-stroke: 1px transparent;
	-webkit-font-smoothing: antialiased;
}

a { color: var(--accent); }
a:hover { color: var(--accent-dark); }

#wrapper, #wrapper1 {
    margin: 0 auto;
    padding: 24px 20px 60px;
    position: relative;
    z-index:0;
}
#wrapper {
    max-width: 960px;
}
#wrapper1 {
    margin-left:100px;
    margin-right: 100px;
}
#svgwrapper {
    margin: 0 auto;
    position: absolute;
    top:0; left:0;
    width:100%;height:100%;
    z-index:2;
}
#lines { position: absolute;}

/* ---------- typography ---------- */

h1{
	font-family: var(--font-display);
	font-weight: 600;
	font-size: 40px;
	color: var(--ink);
	letter-spacing: -0.01em;
}

h2{
	font-family: var(--font-display);
	font-weight: 600;
	font-size: 28px;
	letter-spacing: 0;
	line-height: 1.25em;
	color: var(--ink);
	margin-top: 1.6em;
}

h2.ft {
    padding:20px 0;
    text-align:center;
}

h3{
	font-family: var(--font-display);
	font-weight: 600;
	font-size: 20px;
	letter-spacing: 0;
	color: var(--ink);
}
h1,h2,h3,h4,h5,h6 {
   line-height: 1.25em;
}
h4.round { font-size:16px;}
p.large {
        font-size: 18px;
}

td, p, li, div {
        font-family: var(--font-body);
        font-size: 16px;
        letter-spacing: 0;
	color: var(--ink);
	line-height: 1.5em;
}

p,li {
   font-size: 16px;
   line-height: 1.5em;
   margin-top: 1.2em;
}

p.item,p.large {
        font-size: 17px;
}


#toggles {
    position: fixed;
    width:190px;
    height: auto;
    right: 16px;
    bottom: 16px;
    z-index: 999;
}
button {
    width:100%;
    margin:8px 4px;
    font-family: var(--font-body);
    font-size: 14px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-strong);
    background: var(--surface);
    color: var(--ink);
    cursor: pointer;
}
button:hover { background: var(--accent-tint); border-color: var(--accent); }

/* quote styling */

p.quote{
	font-family: var(--font-display);
	font-size: 14px;
	line-height: 1.4em;
}

p.name{
	font-family: var(--font-display);
	font-size: 14px;
	line-height: 1.4em;
}

p.position{
	font-family: var(--font-display);
	font-size: 12px;
	line-height: 1.4em;
}

p.copyright{
	color: var(--ink-muted);
	font-family: var(--font-display);
	font-size: 12px;
	line-height: 26px;
}

/* span styling */

span.color{
	color: var(--accent-dark);
}

span.italic{
	font-style: italic;
}

span.bold{
	font-weight: bold;
}

span.orange{
	color: var(--serious);
}

span.blue{
	color: var(--accent);
}

span.green{
	color: var(--good);
}

span.purple{
	color: #4a3aa7;
}

span.superscript{
	font-size: .75em;
    line-height: 0.5em;
    vertical-align: baseline;
    position: relative;
    top: -0.4em;
}

span.superscript2{
	font-size: .4em !important;
    line-height: 0.5em;
    vertical-align: baseline;
    position: relative;
    top: -1em;
}

.rightjustify{
	text-align: right;
}

.clear,
.clearFloat{
	clear: both;
	font-size: 1px;
}

.h3em { height: 3em;}

.rule{
	width: 500px;
	max-width: 100%;
	border-top: 1px dashed var(--border-strong);
}


#header{
	width: 100%;
	float: left;
}

#content {
	width: 100%;
	text-align: left;
}

#main_wrapper {
	margin: 0 auto 30px;
	text-align: center;
	font-family: var(--font-body);
	max-width: 640px;
	background-color: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	box-shadow: var(--shadow-1);
	position: relative;
}

/* ---------- buttons ---------- */

.submit {
        font-family: var(--font-body);
        font-weight: 600;
        font-size: 18px;
        padding: 14px 36px;
        margin-top: 24px;
        margin-bottom: 24px;
        color: #fff;
        background: var(--accent);
        box-shadow: var(--shadow-1);
        border: 1px solid var(--accent-dark);
        border-radius: var(--radius);
        cursor: pointer;
        transition: background-color .12s ease, transform .05s ease;
}
.submit:hover { background: var(--accent-dark); }
.submit:active { transform: translateY(1px); }

.submit.light {
    background: var(--surface);
    color: var(--accent-dark);
    border: 1px solid var(--border-strong);
}
.submit.light:hover { background: var(--accent-tint); }

img.photo {
    padding:2px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

/* ---------- results tables ---------- */

table.tally th, table.tally td {
   text-align: left;
   border: 1px solid var(--border);
   padding: 6px 8px;
}
table.tally td    {
   font-size: 14px;
}

table.tally {
   width: 98%;
   border-collapse: collapse;
}
.stvitem {
   line-height: 1.5em;
   padding: 10px 0;
   border-bottom: 1px solid var(--border);
}
.stvitem span.candidate {
   display: inline-block;
   max-width: 70%;
}
.stvitem select { float: right; margin-right:1em;}
span.votetype {
   font-size: 85%;
   color: var(--ink-secondary);
}

div.items-box {
   margin-left: 20px;
   margin-top: 12px;
}
.layer0 {
    position:relative;
    z-index:9;
}
.stv-log-c {
    position:relative;
    z-index:1;
}
.stv-log {
    font-size:12px;
    line-height: 1.4em;
    color: var(--ink-secondary);
}
.stv-log pre {
    font-size:11px;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* ---------- forms ---------- */

div.fitem {
   margin-top: 20px;
}
.fitem label,
#bform label {
   display: block;
   font-weight: 600;
   margin-bottom: 4px;
   margin-top: 10px;   
}

.smaller {
   font-size: 13px;
   font-weight: 400;
   color: var(--ink-secondary);
   margin:0;
}
.hidden {
   display:none;
}
.vitem {
   border: 1px solid var(--border);
   border-radius: var(--radius);
   width: 100%;
   max-width: 640px;
   padding: 16px;
   padding-top: 4px;
   margin-top: 20px;
   background: var(--surface);
}
.right {
   width: 100%;
   max-width: 640px;
   text-align: right;
}
.error, .warn {
   color: var(--critical) !important;
   background: var(--critical-tint);
   border: 1px solid var(--critical);
   border-radius: var(--radius-sm);
   padding: 10px 14px;
   font-weight: 600;
   margin: 12px 0;
}
.error:empty { display: none; }

.message:not(:empty) {
   color: var(--good);
   background: var(--good-tint);
   border: 1px solid var(--good);
   border-radius: var(--radius-sm);
   padding: 10px 14px;
   margin: 12px 0;
   font-weight: 600;
   line-height:2em;
}

span.seats {
   color: var(--serious) !important;
   padding-left: 1em;
}

.red { color: var(--critical);}
.serious { color: var(--serious);}

#iadder a { color: var(--critical); margin-top:20px; font-weight:600; display:block; font-size:120%;}

input[type="text"], input.text, textarea, select {
   font-family: var(--font-body);
   font-size: 15px;
   padding: 8px 10px;
   border: 1px solid var(--border-strong);
   border-radius: var(--radius-sm);
   background: var(--surface);
   color: var(--ink);
}
input[type="text"]:focus, input.text:focus, textarea:focus, select:focus {
   outline: none;
   border-color: var(--accent);
   box-shadow: 0 0 0 3px var(--accent-tint);
}
input[type="checkbox"], input[type="radio"] {
   accent-color: var(--accent);
}
select { margin-right: 1.5em;}

span.stat { display: inline-block; float: right; font-size: 10px; color: var(--ink-secondary);}
span.disappove { display: inline-block; padding-left: 0em; font-weight:400; font-size:12px; color: var(--critical);}
#meetingpollingtime,#webpollingtime {  padding: 1em 1.5em; border: 1px solid var(--border); border-radius: var(--radius); margin-top: 8px;}
strong { font-weight: 700 !important;}
#webpollingtime, #webpollingtime .smaller, #webpollingtime .datepair  { color: var(--serious);}
input.large { font-size:20px; margin-top:1em;}
.ui-timepicker-list { background: var(--surface); padding-right:2em; border: 1px solid var(--border); border-radius: var(--radius-sm);}
.datepair input { width:8em !important;}
.yna-wrapper { margin-bottom: 1em;}
#voter-list br {display:none;}

.ui-timepicker-list li { margin-top:0; font-size:14px; line-height:1.4em;}

.stvitem:nth-child(2n) {
    background-color: var(--page);
}

/* ---------- STV round detail tables ---------- */

.xtable {
    display: inline-block;
    vertical-align: top;
    max-width: 100%;
    overflow-x: auto;
    white-space: nowrap;
    border-collapse: collapse;
    border-spacing: 0;
    border-radius: var(--radius-sm);
}

.xtable,
.xtable--flip tbody {
    -webkit-overflow-scrolling: touch;
    background: radial-gradient(left, ellipse, rgba(11,11,11, .12) 0%, rgba(11,11,11, 0) 75%) 0 center,
                radial-gradient(right, ellipse, rgba(11,11,11, .12) 0%, rgba(11,11,11, 0) 75%) 100% center;
    background-size: 10px 100%, 10px 100%;
    background-attachment: scroll, scroll;
    background-repeat: no-repeat;
}

.xtable th {
    font-size: 12px;
    text-align: left;
    color: var(--ink-secondary);
}

.xtable th,
.xtable td {
    padding: 6px 12px;
    border: 1px solid var(--border);
}

.xtable--flip {
    display: flex;
    overflow: hidden;
    background: none;
}

.xtable--flip thead {
    display: flex;
    flex-shrink: 0;
    min-width: min-content;
}

.xtable--flip tbody {
    display: flex;
    position: relative;
    overflow-x: auto;
    overflow-y: hidden;
}

.xtable--flip tr {
    display: flex;
    flex-direction: column;
    min-width: min-content;
    flex-shrink: 0;
}

.xtable--flip td,
.xtable--flip th {
    display: block;
}

.xtable--flip td {
    background-image: none !important;
    border-left: 0;
}

.xtable--flip th:not(:last-child),
.xtable--flip td:not(:last-child) {
    border-bottom: 0;
}

.xtable th.fz, .xtable td.fz { padding: 10px 20px;}
.xtable { margin-left:16px;}
tr:nth-child(odd) {  background-color: var(--page) !important;}
th { font-weight:600; background-color: var(--accent-tint);}
td,th {font-size: 12px;padding: 6px 8px;} th {font-weight:600;}

/* round outcome semantics -> dataviz status palette */
.elected { color: var(--good);}
.eliminated {color: var(--serious);}
.small { font-size:12px; }
.strike { text-decoration: line-through; color: var(--ink-muted);}
.strike.elected, .xstrike.elected { color: var(--good) !important; }
.strike.eliminated, .xstrike.eliminated { color: var(--serious) !important; }
.current { background: var(--accent-tint);}
.current.elect { background: var(--good-tint);}
.current.eliminate { background: var(--critical-tint);}
.final { background: var(--good-tint); color: var(--good) !important;font-weight:bold;}
.redish {color:#8a3a8a; font-weight:bold;}
.round0 { background: #fbf6e8;}
.round1 { background: var(--accent-tint);}
.round2 { background: var(--good-tint);}
.round3 { background: var(--page);}
.stv-log *, .stv-result { line-height: 1.3em !important;}
.quota { background: #fbf6e8; border-radius: var(--radius-sm); padding: 8px 12px;}
h4.decision { margin-left: 1.5em;}
h4.decision-eliminate { color: var(--serious);}
h4.decision-elect { color: var(--good);}
.id-container { float: right; margin: 12px 0 0 0;}
.id-image { width:90px; height:auto; border-radius: var(--radius-sm); box-shadow: var(--shadow-1);}


th.colh, td.colh { font-weight:600; color:#fff; background: var(--accent) !important;}

td.xed { font-weight:bold; border-radius: 50%; border-width: 1px; border-style: solid; color: var(--critical); min-width:1.5em;
         display:inline-block; font-style: normal;}

/*
 * Per-candidate STV round-transfer colors (z1-z21).
 * z1-z8 come from the dataviz-skill validated categorical palette
 * (light mode, worst-case adjacent CVD deltaE 9.1, normal-vision 19.6 --
 * see references/palette.md). Candidate names are always printed as text
 * alongside these colors, so identity is never carried by color alone.
 * z9-z21 extend the same 8 hues at different lightness steps to cover
 * larger candidate fields; distinguishability beyond ~8 categories is an
 * inherent limit of categorical color, not specific to this app.
 */
td.z1  {border-color: #2a78d6; background:#dce9fa;}
td.z2  {border-color: #eb6834; background:#fbe0d2;}
td.z3  {border-color: #1baf7a; background:#d4f0e5;}
td.z4  {border-color: #eda100; background:#fbeacb;}
td.z5  {border-color: #e87ba4; background:#fbe1ea;}
td.z6  {border-color: #008300; background:#d3ecd3;}
td.z7  {border-color: #4a3aa7; background:#ddd8f2;}
td.z8  {border-color: #e34948; background:#fbdcdc;}
td.z9  {border-color: #184f95; background:#c7dcf5;}
td.z10 {border-color: #b04d24; background:#f3d3bd;}
td.z11 {border-color: #12805a; background:#bfe6d7;}
td.z12 {border-color: #b37c00; background:#f5ddab;}
td.z13 {border-color: #c25b7d; background:#f5cddc;}
td.z14 {border-color: #006200; background:#bfe0bf;}
td.z15 {border-color: #382b7d; background:#cac2e8;}
td.z16 {border-color: #a83433; background:#f3c4c4;}
td.z17 {border-color: #6fa0e0; background:#eef4fc;}
td.z18 {border-color: #f0916a; background:#fdece2;}
td.z19 {border-color: #55c79c; background:#e6f7f0;}
td.z20 {border-color: #f2b940; background:#fdf3dd;}
td.z21 {border-color: #ef9fbe; background:#fdedf3;}

.z1  { color:#2a78d6; }
.z2  { color:#eb6834; }
.z3  { color:#1baf7a; }
.z4  { color:#eda100; }
.z5  { color:#e87ba4; }
.z6  { color:#008300; }
.z7  { color:#4a3aa7; }
.z8  { color:#e34948; }
.z9  { color:#184f95; }
.z10 { color:#b04d24; }
.z11 { color:#12805a; }
.z12 { color:#b37c00; }
.z13 { color:#c25b7d; }
.z14 { color:#006200; }
.z15 { color:#382b7d; }
.z16 { color:#a83433; }
.z17 { color:#6fa0e0; }
.z18 { color:#f0916a; }
.z19 { color:#55c79c; }
.z20 { color:#f2b940; }
.z21 { color:#ef9fbe; }




@media only screen and (min-width : 320px) {
    .radio-item  { font-size: 120%;}
    .radio-item  input { margin: 20px 10px;}
    input[type="radio"] {
        transform: scale(3);
    }
    .stvitem {
        padding: 20px 0px 20px 10px;
        font-size: 120%;
    }
    .stvitem select {
        font-size: 100% !important;
    }
    span.candidate { font-size: 120%;}

    .submit {
        font-size: 22px;
        padding: 22px 48px;
    }
}

@media only screen and (min-width : 480px) {
    .radio-item  { font-size: 150%;}
    .radio-item  input { margin: 40px 10px;}
    input[type="radio"] {
        transform: scale(3);
    }
    .stvitem {
        padding: 20px 0px 20px 10px;
        font-size: 120%;
    }
    .stvitem select {
        font-size: 100% !important;
    }

    .submit {
        font-size: 22px;
        padding: 22px 48px;
    }
}

@media only screen and (min-width : 768px) {
    .radio-item  { font-size: 110%;}
    .radio-item  input { margin: 20px 20px;}
    input[type="radio"] {
        transform: scale(2);
    }
    .stvitem {
        padding: 20px 0px 20px 10px;
        font-size: 120%;
    }
    .stvitem select {
        font-size: 100% !important;
    }

    .submit {
        font-size: 20px;
        padding: 16px 44px;
    }
}


@media only screen and (min-width : 768px) and (orientation: portrait) {
    .radio-item  { font-size: 110%;}
    .radio-item  input { margin: 30px 20px;}
    input[type="radio"] {
        transform: scale(3);
    }
    .stvitem {
        padding: 20px 0px 20px 10px;
        margin: 20px;
        font-size: 120%;
    }
    .stvitem select {
        font-size: 120% !important;
    }

    .submit {
        font-size: 20px;
        padding: 16px 44px;
    }
}


@media only screen and (min-width : 992px) {
    .radio-item  { font-size: 100%;}
    .radio-item  input { margin: 10px 6px;}
    input[type="radio"] {
        transform: scale(1);
    }
    .stvitem {
        padding: 10px;
        font-size: 100%;
    }
    .stvitem select {
        font-size: 100%;
    }

    .submit {
        font-size: 18px;
        padding: 14px 36px;
    }
}

@media print {
  body { background: #fff; }
  .submit, #toggles, .stv-log-c, #svgwrapper { display: none !important; }
  .error, .message { border: 1px solid #000 !important; background: none !important; color: #000 !important; }
}

/* ---------- admin dashboard (admin.php / admin_voters.php / admin_edit_active.php) ---------- */

.elections-list {
  list-style: none;
  margin: 12px 0;
  padding: 0;
}
.elections-list li {
  padding: 12px 16px;
  margin-bottom: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 16px;
}
.elections-list li a {
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  font-weight:400;
}
.elections-list li a.red { color: var(--critical); }

.campaign-row {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
}
.campaign-title {
  white-space: nowrap;
  font-weight: 600;
}
.campaign-dots {
  flex: 1 1 auto;
  min-width: 24px;
  margin: 0 8px;
  border-bottom: 2px dotted var(--border-strong);
}
.campaign-links {
  white-space: nowrap;
  text-align: right;
}
.id-image {
    width: 100%;
    height: 100%;
    min-width:100px;min-height:100px;
    text-align: center;
    line-height: 100px;
    color: var(--good);
    object-fit: cover;
    -webkit-mask-image: radial-gradient(circle, rgba(0,0,0,1) 30%, rgba(0,0,0,0) 70%);
    mask-image: radial-gradient(circle, rgba(0,0,0,1) 40%, rgba(0,0,0,0) 70%);
}
.fright {float:right;}
.modified {
    color: #0ca30c !important; 
    animation: blinker 1s linear 1;    
}
@keyframes blinker { 50% { opacity: 0; }}


@media print {
    .onscreen-only { display: none;}
}
