/*
 * Pergam Analyzer in a browser. Every size and colour here is the desktop
 * window's - main.cpp's stylesheet (kStyle) and the paint events of its own
 * controls - so the two are one design; a change there is a change here.
 */
@font-face { font-family: "Fira Sans"; font-weight: 400; src: url("fonts/FiraSans-Regular.ttf"); }
@font-face { font-family: "Fira Sans"; font-weight: 600; src: url("fonts/FiraSans-SemiBold.ttf"); }
@font-face { font-family: "Fira Mono"; font-weight: 400; src: url("fonts/FiraMono-Regular.ttf"); }
@font-face { font-family: "Fira Mono"; font-weight: 500; src: url("fonts/FiraMono-Medium.ttf"); }

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
    font: 13px "Fira Sans", "Segoe UI", sans-serif;
    color: #000;
    background: #f8fafc;
    overflow: auto;            /* a window under the least size scrolls, as a window cannot */
    -webkit-font-smoothing: antialiased;
    user-select: none;
}
body.wait, body.wait * { cursor: progress !important; }
button { font: inherit; }
[hidden] { display: none !important; }

#app  { display: flex; flex-direction: column; height: 100%; min-width: 1180px; min-height: 760px; }
#main { display: flex; flex: 1; min-height: 0; }
#pages { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* ── the column on the right ─────────────────────────────────────────────── */
#side {
    width: 312px; flex: none; background: #fff; border-left: 1px solid #dbeafe;
    padding: 14px 14px 14px 13px; display: flex; flex-direction: column; gap: 8px; min-height: 0;
}
#logo { width: 168px; margin: 4px auto 10px; display: block; }
#dayNav { display: flex; align-items: flex-start; gap: 8px; height: 32px; flex: none; }
#dayLabel { flex: 1; text-align: center; line-height: 15px; white-space: nowrap; }
#dayLabel b { font-size: 15px; font-weight: 600; color: #1e3a8a; }
#dayLabel span { color: #475569; font-size: 11px; }

#head { background: #1e40af; border-radius: 10px; padding: 8px 14px; display: flex; align-items: center; height: 54px; flex: none; }
#head .cap { color: #fff; font-size: 11px; letter-spacing: 0.8px; flex: 1; }
#headNum { color: #fff; font: 500 32px "Fira Mono", Consolas, monospace; }

.cap2 { color: #475569; font-size: 11px; letter-spacing: 0.8px; text-transform: uppercase; margin-top: 6px; line-height: 13px; }
.row { display: flex; align-items: center; justify-content: space-between; flex: none; }
.plabel { color: #475569; letter-spacing: 0.15px; }

.stepper {
    width: 156px; height: 32px; background: #fff; border: 1px solid #c7d7f5; border-radius: 8px;
    display: flex; align-items: center; padding: 0;
}
.stepper:focus-within { border-color: #1e40af; }
.stepper button {
    width: 32px; height: 30px; background: transparent; border: 0; border-radius: 7px; color: #1e40af;
    font-size: 18px; font-weight: 600; cursor: pointer; padding: 0; line-height: 1;
}
.stepper button:last-child { margin-right: 2px; }
.stepper button:hover { background: #eff4ff; }
.stepper button:active { background: #dbeafe; }
.stepper input {
    flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; text-align: center; color: #0f172a;
    font: 13.33px "Fira Mono", Consolas, monospace; padding: 0; user-select: text;
}
.stepper input::selection { background: #dbeafe; color: #0f172a; }

.picker {
    width: 156px; height: 30px; background: #fff; border: 1px solid #c7d7f5; border-radius: 8px; cursor: pointer;
    text-align: left; padding: 0 34px 0 11px; font-weight: 600; color: #0f172a; position: relative;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.picker:hover { background-color: #f5f8ff; border-color: #1e40af; }
.picker:focus-visible { outline: 0; border: 2px solid #f59e0b; padding-left: 10px; }
.picker {
    background-repeat: no-repeat; background-position: right 10px top 11px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='-6 -4 12 8'%3E%3Cpath d='M-4.5 -3 L0 2 L4.5 -3' fill='none' stroke='%231e40af' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
.picker:focus-visible { background-position: right 9px top 10px; }

.toggle { width: 84px; height: 26px; border: 0; background: transparent; cursor: pointer; position: relative; padding: 0;
          text-align: right; color: #475569; font-size: 13px; }
.toggle span { position: absolute; left: 0; right: 54px; top: 0; line-height: 26px; }
.toggle::before { content: ""; position: absolute; right: 2px; top: 2px; width: 44px; height: 22px; border-radius: 11px; background: #cbd5e1; }
.toggle::after  { content: ""; position: absolute; right: 27px; top: 5px; width: 16px; height: 16px; border-radius: 8px; background: #fff; }
.toggle.on { color: #1e40af; font-weight: 600; }
.toggle.on::before { background: #1e40af; }
.toggle.on::after  { right: 5px; }
.toggle:focus-visible { outline: 0; }
.toggle:focus-visible::before { box-shadow: 0 0 0 2px #f59e0b; }

.value {
    width: 156px; height: 30px; background: #f8fafc; border: 1px solid #e9eef6; border-radius: 6px; padding: 3px 12px 3px 8px;
    color: #0f172a; text-align: right; font: 13.33px/22px "Fira Mono", Consolas, monospace; white-space: nowrap; overflow: hidden;
}
.value.hot { background: #fff; border: 1px solid #d97706; border-left: 4px solid #d97706; }

.choice { width: 156px; height: 30px; background: #fff; border: 1px solid #c7d7f5; border-radius: 8px; display: flex; padding: 2px; cursor: pointer; }
.choice span { flex: 1; text-align: center; line-height: 24px; border-radius: 6px; color: #475569; font-size: 13px; }
.choice span.chosen { background: #1e40af; color: #fff; font-weight: 600; }
.choice:focus-visible { outline: 0; border: 2px solid #f59e0b; padding: 1px; }

#laps { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; }
#lapGrid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.lap {
    height: 68px; background: #fff; border: 1px solid #dbeafe; border-radius: 9px; position: relative; cursor: pointer;
    text-align: left; padding: 0; overflow: hidden; color: #0f172a;
}
.lap.day { grid-column: 1 / 3; }
.lap:hover { background: #f5f8ff; }
.lap.checked { border-color: #1e40af; background: #fff; }
.lap.checked::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: #1e40af; }
.lap:focus-visible { outline: 0; border: 2px solid #f59e0b; }
.lap b { position: absolute; left: 11px; top: 6px; font-size: 14px; font-weight: 600; line-height: 18px; white-space: nowrap; }
.lap i { position: absolute; left: 11px; top: 24px; font: normal 12px/16px "Fira Mono", Consolas, monospace; color: #475569; white-space: pre;
         letter-spacing: -0.2px; }
.lap em s { display: inline-block; width: 6.5px; height: 6.5px; background: currentColor; transform: rotate(45deg); margin: 0 7px 1px 3px; }
.lap em { position: absolute; left: 11px; top: 44px; font-style: normal; font-size: 11px; line-height: 17px; color: #64748b; white-space: nowrap; }
.lap em.k1, .lap em.k2 { left: 10px; padding: 0 8px; border-radius: 8.5px; font-weight: 600; max-width: calc(100% - 20px); overflow: hidden; text-overflow: ellipsis; }
.lap em.k1 { background: #fdeccc; color: #7a4a00; }
.lap em.k2 { background: #e6ebf7; color: #1e3a8a; }

.link { background: transparent; color: #1e40af; border: 0; text-align: left; padding: 2px; cursor: pointer; flex: none; }
.link:hover { text-decoration: underline; }
.link:focus-visible { outline: 1px solid #f59e0b; border-radius: 4px; }

.act {
    background: #fff; color: #1e40af; border: 1px solid #c7d7f5; border-radius: 8px; height: 38px; font-weight: 600;
    cursor: pointer; flex: 1; padding: 0 6px;
}
.act:hover { background: #eff4ff; }
.act:focus-visible { outline: 0; border: 2px solid #f59e0b; }
.act:disabled { color: #94a3b8; border-color: #e2e8f0; cursor: default; background: #fff; }
.pair { display: flex; gap: 8px; flex: none; }
.two  { display: flex; gap: 6px; width: 156px; }
#reports { margin-top: 2px; display: flex; flex-direction: column; gap: 8px; flex: none; }

.pager {
    background: #fff; border: 1px solid #c7d7f5; border-radius: 6px; color: #1e40af; font-size: 15px; font-weight: 600;
    width: 28px; height: 26px; cursor: pointer; padding: 0; line-height: 1; flex: none;
}
#dayNav .pager { width: 32px; height: 30px; }
.pager:hover { background: #eff4ff; }
.pager:disabled { color: #cbd5e1; border-color: #e2e8f0; cursor: default; background: #fff; }

/* ── before a day is open ────────────────────────────────────────────────── */
#empty { flex: 1; display: flex; flex-direction: column; align-items: center; }
#empty::before { content: ""; flex: 2; }
#empty::after  { content: ""; flex: 3; }
#empty h1 { color: #1e3a8a; font-size: 22px; font-weight: 600; margin: 4px 0 12px; }
#empty p  { color: #475569; font-size: 14px; margin: 0 0 20px; text-align: center; line-height: 1.35; white-space: pre-line; }
.primary { background: #1e40af; color: #fff; border: 1px solid #1e40af; border-radius: 8px; height: 42px; font-weight: 600; width: 220px; cursor: pointer; }
.primary:hover { background: #1b3a9c; }
.primary:focus-visible { outline: 0; border: 2px solid #f59e0b; }

/* ── a day ───────────────────────────────────────────────────────────────── */
#view { flex: 1; min-height: 0; display: flex; flex-direction: column; }
#strip { height: 46px; flex: none; background: #fff; border-bottom: 1px solid #dbeafe; padding: 0 16px; display: flex; align-items: center; white-space: nowrap; }
#stripText { flex: none; word-spacing: -0.4px; }
/* Qt gives a 16 px Fira Mono whole pixels a character, and a 12 px one seven */
#stripText span[style*="16px"] { letter-spacing: 0.4px; }
#pager { display: flex; align-items: center; gap: 6px; margin-left: 24px; color: #475569; }
#configBox { display: flex; align-items: center; gap: 14px; margin-left: 42px; }
#pager:not([hidden]) + #configBox { margin-left: 24px; }
#configBox .stepper { width: 118px; }
.stripbtn { background: #fff; color: #1e40af; border: 1px solid #c7d7f5; border-radius: 8px; font-weight: 600; width: 104px; height: 32px;
            cursor: pointer; margin-left: 16px; flex: none; }
.stripbtn:hover { background: #eff4ff; }
.stripbtn:focus-visible { outline: 0; border: 2px solid #f59e0b; }
.stripbtn:disabled { color: #94a3b8; border-color: #e2e8f0; cursor: default; background: #fff; }
#path { flex: 1; min-width: 0; margin-left: 24px; color: #475569; font: 12px "Fira Mono", Consolas, monospace; overflow: hidden;
        display: flex; justify-content: flex-end; letter-spacing: -0.2px; }
#path span { flex: none; }

#holder { flex: 1; min-height: 0; padding: 12px; display: flex; }
#figureCard { flex: 1; min-width: 0; background: #fff; border: 1px solid #dbeafe; border-radius: 10px; padding: 5px; display: flex; }
#figureBox { flex: 1; min-width: 0; position: relative; overflow: hidden; }
#figure { position: absolute; left: 0; top: 0; width: 100%; height: 100%; display: block; -webkit-user-drag: none; }

#tbl { height: 150px; flex: none; background: #fff; border-top: 1px solid #dbeafe; padding: 6px 12px; }
#tableScroll { height: 100%; overflow: auto; outline: 0; }
#table { border-collapse: separate; border-spacing: 0; font: 12px "Fira Mono", Consolas, monospace; color: #0f172a; white-space: nowrap;
         letter-spacing: -0.2px; }
#table th { font: 600 12px "Fira Sans", sans-serif; color: #475569; text-align: left; padding: 5px 16px 5px 8px; height: 33px;
            border-bottom: 1px solid #dbeafe; position: sticky; top: 0; background: #fff; letter-spacing: 0.15px; }
#table td { height: 28px; padding: 0 11px 2px; border-bottom: 1px solid #eef2f9; }
#table tr.selected td { background: #e6ebf7; }
#table td.none { color: #475569; border-bottom: 0; }

#status { height: 20px; flex: none; background: #fff; color: #475569; border-top: 1px solid #dbeafe; display: flex; align-items: center;
          padding: 0 8px 0 6px; white-space: nowrap; }
#statusText { flex: 1; overflow: hidden; text-overflow: ellipsis; }
#account { flex: none; color: #475569; }
#account button { background: transparent; border: 0; color: #1e40af; cursor: pointer; padding: 0 6px; }
#account button:last-child { padding-right: 0; }
#account button:hover { text-decoration: underline; }

::-webkit-scrollbar { width: 10px; height: 10px; background: transparent; }
::-webkit-scrollbar-thumb { background: #c7d7f5; border-radius: 4px; border: 1px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: #93b4f0; background-clip: padding-box; }
/* Firefox has no such pseudo-elements; where they exist these two would override them */
@supports not selector(::-webkit-scrollbar) { * { scrollbar-width: thin; scrollbar-color: #c7d7f5 transparent; } }

/* ── menus and dialogs ───────────────────────────────────────────────────── */
.menu { position: fixed; z-index: 50; background: #fff; border: 1px solid #c7d7f5; border-radius: 8px; padding: 5px; min-width: 120px;
        box-shadow: 0 6px 18px rgba(15, 23, 42, 0.10); }
.menu div { color: #0f172a; padding: 7px 16px; border-radius: 6px; cursor: pointer; white-space: nowrap; }
.menu div:hover { background: #eff4ff; color: #1e40af; }
.menu div.off { color: #64748b; cursor: default; background: transparent; }
.menu div.check { padding-left: 30px; position: relative; }
.menu div.check.on::before { content: ""; position: absolute; left: 13px; top: 9px; width: 5px; height: 9px; border-right: 2px solid #1e40af;
                             border-bottom: 2px solid #1e40af; transform: rotate(45deg); }
.menu hr { border: 0; height: 1px; background: #e9eef6; margin: 4px 8px; }

.veil { position: fixed; inset: 0; z-index: 40; background: rgba(15, 23, 42, 0.28); display: flex; align-items: center; justify-content: center; }
.dialog { background: #f8fafc; border-radius: 10px; box-shadow: 0 18px 50px rgba(15, 23, 42, 0.30); overflow: hidden; }
.dialog .bar { background: #fff; border-bottom: 1px solid #dbeafe; padding: 9px 14px; font-weight: 600; color: #0f172a; display: flex; }
.dialog .bar span { flex: 1; }
.dialog .bar button { border: 0; background: transparent; color: #475569; cursor: pointer; font-size: 15px; padding: 0 2px; }
.dialog .body { padding: 22px 26px 16px; }
.dialog .q { color: #0f172a; font-size: 17px; font-weight: 600; margin: 0 0 6px; }
.dialog .h { color: #475569; margin: 0 0 18px; }
.cards { display: flex; gap: 14px; margin-bottom: 8px; }
.opencard { width: 264px; height: 168px; background: #fff; border: 1px solid #c7d7f5; border-radius: 10px; cursor: pointer; text-align: left;
            padding: 16px 18px; display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-start; }
.opencard:hover, .opencard:focus-visible { border: 2px solid #1e40af; background: #f5f8ff; padding: 15px 17px; outline: 0; }
.opencard:focus-visible { border-color: #f59e0b; }
.opencard:active { background: #dbeafe; }
.opencard b { display: block; color: #1e3a8a; font-size: 18px; font-weight: 600; line-height: 26px; margin-bottom: 8px; }
.opencard span { display: block; color: #475569; font-size: 13px; line-height: 1.3; white-space: pre-line; }
.dialog .foot { display: flex; justify-content: flex-end; gap: 8px; }
.textbtn { background: transparent; color: #475569; border: 0; padding: 6px 10px; cursor: pointer; }
.textbtn:hover { color: #1e40af; text-decoration: underline; }
.message { max-width: 520px; min-width: 320px; }
.message .body { padding: 20px 24px 16px; }
.message p { margin: 0 0 18px; color: #0f172a; white-space: pre-line; line-height: 1.4; user-select: text; }
.message .act { flex: none; min-width: 84px; height: 34px; padding: 0 14px; }
.message .act.main { background: #1e40af; color: #fff; border-color: #1e40af; }
.message .act.main:hover { background: #1b3a9c; }

/* ── Settings: one's own password, and for an administrator the users ───── */
.settings { width: 700px; max-height: calc(100vh - 60px); display: flex; flex-direction: column; }
.settings .body { padding: 14px 24px 20px; overflow-y: auto; }
.settings .cap2 { margin: 14px 0 8px; }
.settings .line { display: flex; align-items: center; gap: 8px; }
.field { height: 32px; border: 1px solid #c7d7f5; border-radius: 8px; padding: 0 10px; font: inherit; color: #0f172a; outline: 0;
         background: #fff; min-width: 0; flex: 1; user-select: text; }
.field:focus { border-color: #1e40af; }
.field.name { flex: 0 0 150px; }
.settings .act { flex: none; height: 32px; padding: 0 14px; }
.settings .act.main { background: #1e40af; color: #fff; border-color: #1e40af; }
.settings .act.main:hover { background: #1b3a9c; }
.settings .act.quiet { border-color: transparent; font-weight: 400; padding: 0 8px; }
.settings .act.quiet:hover { border-color: #c7d7f5; }
.settings .act.quiet:disabled { color: #cbd5e1; border-color: transparent; }
.settings .said { min-height: 18px; margin: 6px 0 0; color: #b45309; }
.settings .said.good { color: #15803d; }
.users { width: 100%; border-collapse: separate; border-spacing: 0; background: #fff; border: 1px solid #dbeafe; border-radius: 10px; overflow: hidden; }
.users th { text-align: left; font-weight: 600; font-size: 12px; color: #475569; padding: 7px 10px; border-bottom: 1px solid #dbeafe; }
.users td { padding: 4px 10px; border-bottom: 1px solid #eef2f9; color: #0f172a; height: 38px; white-space: nowrap; }
.users tr:last-child td { border-bottom: 0; }
.users td.mono { font: 12px "Fira Mono", Consolas, monospace; color: #475569; }
.users td.name { font-weight: 600; }
.users td.name i { font-style: normal; font-weight: 400; color: #64748b; }
.users td:last-child { text-align: right; }
.users .toggle { vertical-align: middle; }
.handover { margin-top: 12px; background: #fff; border: 1px solid #d97706; border-left: 4px solid #d97706; border-radius: 8px; padding: 10px 12px;
            display: flex; align-items: center; gap: 12px; }
.handover div { flex: 1; color: #0f172a; line-height: 1.5; user-select: text; }
.handover b { font: 500 14px "Fira Mono", Consolas, monospace; }
.handover span { color: #475569; }

/* ── signing in ──────────────────────────────────────────────────────────── */
#signin { height: 100%; display: flex; align-items: center; justify-content: center; }
#signin form { width: 340px; background: #fff; border: 1px solid #dbeafe; border-radius: 10px; padding: 26px 26px 22px; }
#signin img { width: 168px; display: block; margin: 0 auto 18px; }
#signin h1 { color: #1e3a8a; font-size: 18px; font-weight: 600; text-align: center; margin: 0 0 18px; }
#signin label { display: block; color: #475569; font-size: 11px; letter-spacing: 0.8px; text-transform: uppercase; margin: 12px 0 4px; }
#signin input { width: 100%; height: 36px; border: 1px solid #c7d7f5; border-radius: 8px; padding: 0 10px; font: inherit; color: #0f172a; outline: 0; }
#signin input:focus { border-color: #1e40af; }
#signin .primary { width: 100%; margin-top: 20px; }
#signin .primary:disabled { background: #a5b4d6; border-color: #a5b4d6; cursor: default; }
#signin p { color: #b45309; min-height: 18px; margin: 12px 0 0; text-align: center; }
