OpenTally/html/main.css

347 lines
8.5 KiB
CSS
Raw Normal View History

/* OpenTally: Open-source election vote counting
* Copyright © 20212022 Lee Yingtong Li (RunasSudo)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
2021-06-02 21:37:47 +10:00
2021-06-22 23:47:35 +10:00
@import url('https://fonts.googleapis.com/css2?family=Source+Sans+Pro:wght@400;600&display=swap');
2021-06-02 21:37:47 +10:00
html, body {
font-family: 'Source Sans Pro', sans-serif;
}
body {
padding: 0.5em;
}
a {
color: #1d46c4;
text-decoration: none;
}
a:hover {
color: #1d3da2;
text-decoration: underline;
}
2021-07-23 00:04:43 +10:00
tr.stage-no a {
color: initial !important;
}
li.highlight {
background-color: #fffedd;
}
2021-06-02 21:37:47 +10:00
/* Menu styling */
.menudiv {
border-bottom: 1px solid #ccc;
line-height: 1.8;
margin-bottom: 0.5em;
padding-bottom: 0.5em;
}
.menudiv .subheading {
font-size: 0.8em;
2021-06-22 23:47:35 +10:00
font-weight: 600;
2021-08-16 18:48:49 +10:00
margin-top: 0.5rem;
}
.menudiv > div > .subheading:first-child {
margin-top: 0;
2021-06-22 23:47:35 +10:00
}
.pill-grey {
border-radius: 4px;
background-color: #3f454f;
color: #fff;
font-size: 0.7rem;
font-weight: 600;
padding: 0 0.5em;
2021-06-02 21:37:47 +10:00
}
2021-06-23 20:18:53 +10:00
.pill-grey[title] {
cursor: help;
}
2021-06-02 21:37:47 +10:00
.cols-12 {
display: grid;
grid-template-columns: repeat(12, 1fr);
}
.col-3 { grid-column-end: span 3; }
.col-6 { grid-column-end: span 6; }
.col-12 { grid-column-end: span 12; }
@media screen and (max-width: 17.5cm) {
.cols-sm-6 {
grid-template-columns: repeat(6, 1fr);
}
}
/* Count table */
table {
border-collapse: collapse;
2021-06-07 20:51:55 +10:00
color-adjust: exact;
-webkit-print-color-adjust: exact;
2021-06-02 21:37:47 +10:00
}
2021-09-11 21:08:36 +10:00
table.result td, table.transfers td {
2021-06-02 21:37:47 +10:00
padding: 0px 8px;
height: 1em;
2021-06-02 21:37:47 +10:00
}
td.count {
text-align: right;
}
td.count sup {
font-size: 0.6rem;
top: 0;
}
2021-08-16 18:48:49 +10:00
tr.stage-no td, tr.stage-kind td, tr.stage-comment td, tr.hint-papers-votes td {
2021-06-02 21:37:47 +10:00
text-align: center;
}
td.candidate-name, td.elected, td.excluded {
white-space: nowrap;
}
2021-06-03 15:47:19 +10:00
tr.stage-kind td {
2021-06-02 21:37:47 +10:00
font-size: 0.75em;
min-width: 5rem;
color: #1b2839;
background-color: #f0f5fb;
}
2021-08-16 18:48:49 +10:00
tr.hint-papers-votes td {
font-size: 0.75em;
font-style: italic;
}
2021-06-02 21:37:47 +10:00
td.excluded {
background-color: #fde2e2;
}
td.elected {
background-color: #e0fdc5;
}
tr.info td {
background-color: #f0f5fb;
}
2021-09-11 21:08:36 +10:00
tr.stage-no td:not(:empty), tr.hint-papers-votes td:not(:empty), tr.transfers td,
table.transfers tr:first-child td, table.transfers tr:nth-last-child(2) td, table.transfers tr:last-child td {
2021-06-02 21:37:47 +10:00
border-top: 1px solid #76858c;
}
2021-09-11 21:08:36 +10:00
tr.info:last-child td, .bb,
table.transfers tr:first-child td, table.transfers tr:nth-last-child(2) td, table.transfers tr:last-child td {
2021-06-02 21:37:47 +10:00
border-bottom: 1px solid #76858c;
}
2021-06-22 15:23:46 +10:00
.blw {
/* Used to separate counts in Wright STV */
border-left: 2px solid #76858c;
}
2021-06-02 21:37:47 +10:00
2021-09-11 21:08:36 +10:00
table.transfers tr:first-child td {
font-weight: 600;
}
table.transfers tr:first-child td, table.transfers tr:nth-last-child(2) td, .transfers tr:last-child td {
background-color: #f0f5fb;
}
2021-09-11 21:08:36 +10:00
2021-06-07 20:51:55 +10:00
/* Table stripes */
2021-06-10 15:47:09 +10:00
tr.stage-no td:nth-child(even):not([rowspan]),
2021-06-07 20:51:55 +10:00
tr.stage-comment td:nth-child(odd),
2021-08-16 18:48:49 +10:00
tr.hint-papers-votes td:nth-child(even),
2021-06-07 20:51:55 +10:00
tr.candidate.transfers td:nth-child(even):not(.elected):not(.excluded),
2021-09-11 21:08:36 +10:00
tr.candidate.votes td:nth-child(odd):not(.elected):not(.excluded),
table.transfers td:nth-child(even) {
2021-06-07 20:51:55 +10:00
background-color: #f9f9f9;
}
tr.candidate.transfers td.elected:nth-child(even),
tr.candidate.votes td.elected:nth-child(odd) {
background-color: #e0f7ca;
}
tr.candidate.transfers td.excluded:nth-child(even),
tr.candidate.votes td.excluded:nth-child(odd) {
background-color: #fbdfdf;
}
tr.info.stage-kind td:nth-child(odd),
tr.info.transfers td:nth-child(even),
tr.info.votes td:nth-child(odd),
table.transfers tr:first-child td:nth-child(even), table.transfers tr:nth-last-child(2) td:nth-child(even), .transfers tr:last-child td:nth-child(even) {
2021-06-07 20:51:55 +10:00
background-color: #e8eef7;
}
2021-09-11 21:08:36 +10:00
a.detailedTransfersLink {
color: #aaa;
2021-06-02 21:37:47 +10:00
}
/* Print stylesheet */
#printWarning {
display: none;
}
#printContainer > div:first-child > p:first-child {
margin-top: 0;
}
@media print {
2021-06-06 17:31:20 +10:00
#divUI {
2021-06-02 21:37:47 +10:00
display: none !important;
}
#printWarning {
display: block;
}
a.detailedTransfersLink {
display: none;
}
2021-06-02 21:37:47 +10:00
}
/* Form styling */
/* Adapted in part from https://github.com/nathansmith/formalize (GPL/MIT) */
select, input, button {
line-height: 1.15;
}
2021-07-20 13:41:38 +10:00
select, input[type="text"], input[type="number"], textarea, .js-Dropdown-title {
2021-06-02 21:37:47 +10:00
appearance: none;
2021-07-20 13:41:38 +10:00
background-color: #fff !important;
2021-06-02 21:37:47 +10:00
border: 1px solid;
border-color: #999 #bbb #ddd;
border-radius: 0;
box-sizing: border-box;
color: #000;
padding: 2px 3px;
}
2021-07-20 13:41:38 +10:00
select, .js-Dropdown-title {
2021-06-02 21:37:47 +10:00
/* Dropdown arrow */
background-image: url(data:image/png;base64,R0lGODlhDQAEAIAAAAAAAP8A/yH5BAEHAAEALAAAAAANAAQAAAILhA+hG5jMDpxvhgIAOw==);
background-position: right center;
background-repeat: no-repeat;
padding-right: 20px; /* Padding for dropdown arrow */
}
button, input[type="file"]::-webkit-file-upload-button {
background-color: #f0f0f0;
border: 1px solid;
border-color: #ddd #bbb #999;
border-radius: 4px;
color: #000;
font-family: inherit;
padding: 2px 10px;
}
button:hover, input[type="file"]::-webkit-file-upload-button:hover {
background-color: #eaeaea;
}
button:active, input[type="file"]::-webkit-file-upload-button:active {
background-color: #dfdfdf;
border-color: #999 #bbb #ddd;
}
/* Chrome can't parse this and ignores the entire rule */
input[type="file"]::file-selector-button {
background-color: #f0f0f0;
border: 1px solid;
border-color: #ddd #bbb #999;
border-radius: 4px;
color: #000;
font-family: inherit;
padding: 2px 10px;
}
button:hover, input[type="file"]::file-selector-button:hover {
background-color: #f5f5f5;
}
button:active, input[type="file"]::file-selector-button:active {
background-color: #eaeaea;
border-color: #999 #bbb #ddd;
}
input[type="checkbox"] {
appearance: none;
position: relative;
width: 0.9em;
height: 0.9em;
border: 1px solid;
border-color: #999 #bbb #ddd;
vertical-align: -2px;
}
input[type="checkbox"]:disabled {
background-color: #f0f0f0;
cursor: not-allowed;
}
2021-06-02 21:37:47 +10:00
input[type="checkbox"]:checked {
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAABhWlDQ1BJQ0MgcHJvZmlsZQAAKJF9kT1Iw1AUhU9TtSoVB4uIOASsThZERRy1CkWoEGqFVh1MXvoHTRqSFBdHwbXg4M9i1cHFWVcHV0EQ/AFxc3NSdJES70sKLWJ9cHkf571zuO8+QKgWmWa1jQOabpuJWFRMpVfFwCs60E81jC6ZWcacJMXRcn3dw8f3uwjPan3vz9WjZiwG+ETiWWaYNvEG8fSmbXDeJw6xvKwSnxOPmdQg8SPXFY/fOOdcFnhmyEwm5olDxGKuiZUmZnlTI54iDquaTvlCymOV8xZnrVhm9T75C4MZfWWZ61RDiGERS5AgQkEZBRRhI0K7ToqFBJ1HW/gHXb9ELoVcBTByLKAEDbLrB/+D37O1spMTXlIwCrS/OM7HCBDYBWoVx/k+dpzaCeB/Bq70hr9UBWY+Sa80tPAR0LsNXFw3NGUPuNwBBp4M2ZRdyU8lZLPA+xl9UxrouwW617y51c9x+gAkaVbxG+DgEBjNUfZ6i3d3Ns/t3zv1+f0AL85yjOh1oPUAAAAGYktHRAD/AP8A/6C9p5MAAAAJcEhZcwAALiMAAC4jAXilP3YAAAAHdElNRQflBhYGJAX1YLTpAAAAGXRFWHRDb21tZW50AENyZWF0ZWQgd2l0aCBHSU1QV4EOFwAAADdJREFUOMtjYBiqIIRSzf/JNQSmmSwDaK85hFLN2BQQ7WxsCkn2M7oGsgIMWSPFcR0yYEmVvgAAhfEhGaqKIlIAAAAASUVORK5CYII=);
2021-06-02 21:37:47 +10:00
background-position: center;
background-repeat: no-repeat;
background-size: contain;
}
button:focus, select:focus, input:focus, textarea:focus {
outline: 0;
}
2021-07-20 13:41:38 +10:00
select:focus, .js-Dropdown-title:focus, input:focus, textarea:focus {
2021-06-02 21:37:47 +10:00
border-color: #3daee9;
}
label {
white-space: nowrap;
}
2021-07-20 13:41:38 +10:00
/* Custom dropdown */
/* Adapted from https://github.com/zoltantothcom/vanilla-js-dropdown (Unlicense) */
.js-Dropdown {
display: inline-block;
position: relative;
}
.js-Dropdown-title {
width: 100%;
text-align: left;
2021-07-21 00:44:22 +10:00
position: relative;
z-index: 999;
padding: 2px 6px; /* Needs additional padding to match <select> */
2021-07-20 13:41:38 +10:00
}
.js-Dropdown-list {
background: #fff;
border-bottom: 1px solid #ddd;
border-left: 1px solid #bbb;
border-right: 1px solid #bbb;
box-sizing: border-box;
display: none;
list-style: none;
2021-07-21 00:44:22 +10:00
margin: -5px 0 0 0;
2021-07-20 13:41:38 +10:00
padding: 0;
position: absolute;
min-width: 100%;
2021-07-21 00:44:22 +10:00
z-index: 998;
2021-07-20 13:41:38 +10:00
max-height: 80vh;
overflow-y: auto;
}
.js-Dropdown-list.is-open {
display: block;
}
.js-Dropdown-list li {
cursor: pointer;
padding: 2px 3px 2px 11px;
line-height: 1.3;
}
.js-Dropdown-list li:hover {
background-color: #e9f7ff;
}
.js-Dropdown-list li.is-selected {
background-color: #c0e8fd;
}
.js-Dropdown-optgroup {
font-weight: bold;
padding: 2px 3px;
line-height: 1.3;
}
2021-07-21 00:44:22 +10:00
.js-Dropdown-optgroup:first-child {
padding-top: 4px;
}