/* ===========================================================================
   TapKit console.

   The palette is lifted straight from the phone app's colors.xml, so somebody
   holding the handset and looking at the browser can see they are the same
   product. Deep teal carries the chrome, amber is spent only on the one thing
   on a screen that wants acting on.
   =========================================================================== */

:root {
    --ink: #101720;
    --ink2: #5A6B7C;
    --ground: #F2F5F8;
    --surface: #FFFFFF;
    --line: #DCE4EC;

    --brand: #16697A;
    --brand-dk: #0B4553;
    --accent: #E8871E;

    --ok: #1B7F5C;
    --warn: #9A6207;
    --stop: #A33B3B;

    --r: 14px;
    --shadow: 0 1px 2px rgba(16, 23, 32, .04), 0 8px 24px rgba(16, 23, 32, .06);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--ground);
    color: var(--ink);
    font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

/* --------------------------------------------------------------- the bar */

.tk-bar {
    position: sticky;
    top: 0;
    z-index: 40;
    background: linear-gradient(135deg, var(--brand-dk), var(--brand));
    color: #fff;
    box-shadow: 0 2px 14px rgba(11, 69, 83, .28);
}

.tk-bar-in {
    max-width: 1400px;
    margin: 0 auto;
    padding: 12px 18px;
    display: flex;
    align-items: center;
    gap: 14px;
}

.tk-logo { display: flex; align-items: center; gap: 12px; color: #fff; text-decoration: none; }

.tk-logo-mark {
    width: 40px; height: 40px;
    border-radius: 11px;
    display: grid; place-items: center;
    background: rgba(255, 255, 255, .14);
    border: 1px solid rgba(255, 255, 255, .22);
    font-size: 17px;
    /* the app's tap glyph, rotated so it reads as a card meeting a reader */
    transform: rotate(-90deg);
}

.tk-logo-name { display: block; font-size: 18px; font-weight: 700; letter-spacing: .2px; }
.tk-logo-sub  { display: block; font-size: 12px; color: #A9D4DD; margin-top: 1px; }

.tk-bar-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }

.tk-who { font-size: 13px; color: #CFE7EC; display: flex; align-items: center; gap: 7px; }

.tk-role {
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: .6px;
    padding: 2px 7px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .16);
    color: #fff;
}

.tk-out {
    color: #CFE7EC; text-decoration: none; font-size: 15px;
    width: 34px; height: 34px; border-radius: 9px;
    display: grid; place-items: center;
    background: rgba(255, 255, 255, .10);
    transition: background .15s, color .15s;
}
.tk-out:hover { background: rgba(255, 255, 255, .22); color: #fff; }

.tk-burger {
    display: none;
    margin-left: auto;
    background: rgba(255, 255, 255, .12);
    border: 0; color: #fff;
    width: 38px; height: 38px; border-radius: 10px;
    font-size: 16px; cursor: pointer;
}

/* ------------------------------------------------------------- the shell */

.tk-main { max-width: 1400px; margin: 0 auto; padding: 20px 18px 40px; }

.tk-foot {
    text-align: center;
    color: var(--ink2);
    font-size: 11.5px;
    padding: 0 18px 26px;
    letter-spacing: .3px;
}

/* --------------------------------------------------------------- the tabs */

.tk-tabs {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    scrollbar-width: none;
    padding: 5px;
    margin-bottom: 20px;
    /* glass, so the bar lifts off the page without becoming another card */
    background: rgba(255, 255, 255, .68);
    backdrop-filter: blur(12px) saturate(140%);
    -webkit-backdrop-filter: blur(12px) saturate(140%);
    border: 1px solid rgba(255, 255, 255, .8);
    border-radius: var(--r);
    box-shadow: var(--shadow);
}
.tk-tabs::-webkit-scrollbar { display: none; }

.tk-tab {
    flex: 0 0 auto;
    border: 0;
    background: transparent;
    color: var(--ink2);
    font-size: 13.5px;
    font-weight: 600;
    padding: 10px 16px;
    border-radius: 10px;
    cursor: pointer;
    display: flex; align-items: center; gap: 8px;
    white-space: nowrap;
    transition: background .15s, color .15s;
}
.tk-tab:hover { background: rgba(22, 105, 122, .08); color: var(--brand-dk); }

.tk-tab.on {
    background: var(--brand);
    color: #fff;
    box-shadow: 0 2px 10px rgba(22, 105, 122, .32);
}

.tk-tab .n {
    font-size: 11px;
    padding: 1px 6px;
    border-radius: 999px;
    background: rgba(16, 23, 32, .08);
}
.tk-tab.on .n { background: rgba(255, 255, 255, .22); }

/* -------------------------------------------------------------- the cards */

.tk-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r);
    box-shadow: var(--shadow);
    padding: 18px;
}

.tk-card + .tk-card { margin-top: 16px; }

.tk-h {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .9px;
    text-transform: uppercase;
    color: var(--ink2);
    margin: 0 0 12px;
}

/* the overview figures. Big numbers only where the number is the point. */
.tk-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.tk-stat {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r);
    padding: 15px 16px;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

.tk-stat .v {
    font-size: 27px;
    font-weight: 700;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}
.tk-stat .k {
    font-size: 11.5px;
    color: var(--ink2);
    margin-top: 3px;
    letter-spacing: .2px;
}
.tk-stat i {
    position: absolute;
    right: 13px; top: 13px;
    font-size: 15px;
    opacity: .18;
}

.tk-stat.attn { border-color: rgba(232, 135, 30, .5); }
.tk-stat.attn .v { color: var(--warn); }
.tk-stat.bad  .v { color: var(--stop); }
.tk-stat.good .v { color: var(--ok); }

/* -------------------------------------------------------------- the tables */

.tk-scroll { overflow-x: auto; }

table.tk {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}

table.tk th {
    text-align: left;
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: .7px;
    color: var(--ink2);
    font-weight: 700;
    padding: 9px 10px;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}

table.tk td {
    padding: 10px;
    border-bottom: 1px solid #EFF3F7;
    vertical-align: middle;
}

table.tk tbody tr:hover { background: #F7FAFC; }
table.tk tbody tr:last-child td { border-bottom: 0; }

.uid {
    font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
    font-size: 12.5px;
    letter-spacing: .4px;
    color: var(--brand-dk);
}

.muted { color: var(--ink2); }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; text-align: right; }

/* state reads as shape as well as colour, so it survives a mono printout */
.pill {
    display: inline-block;
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    padding: 3px 9px;
    border-radius: 999px;
    border: 1px solid transparent;
}
.pill.active   { background: rgba(27, 127, 92, .10);  color: var(--ok);    border-color: rgba(27, 127, 92, .28); }
.pill.lost     { background: rgba(163, 59, 59, .10);  color: var(--stop);  border-color: rgba(163, 59, 59, .28); }
.pill.retired  { background: rgba(90, 107, 124, .10); color: var(--ink2);  border-color: rgba(90, 107, 124, .28); }
.pill.ok       { background: rgba(27, 127, 92, .10);  color: var(--ok);    border-color: rgba(27, 127, 92, .28); }
.pill.unknown  { background: rgba(154, 98, 7, .10);   color: var(--warn);  border-color: rgba(154, 98, 7, .30); }
.pill.blocked  { background: rgba(163, 59, 59, .10);  color: var(--stop);  border-color: rgba(163, 59, 59, .28); }
.pill.error    { background: rgba(163, 59, 59, .10);  color: var(--stop);  border-color: rgba(163, 59, 59, .28); }
.pill.reader   { background: rgba(22, 105, 122, .09); color: var(--brand); border-color: rgba(22, 105, 122, .26); }
.pill.manager  { background: rgba(232, 135, 30, .12); color: var(--warn);  border-color: rgba(232, 135, 30, .32); }
.pill.admin    { background: rgba(122, 75, 191, .10); color: #6B3FAE;      border-color: rgba(122, 75, 191, .28); }
.pill.off      { background: #F0F3F6; color: var(--ink2); border-color: var(--line); }

/* -------------------------------------------------------------- the inputs */

.tk-bar-tools {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
    align-items: center;
    margin-bottom: 14px;
}

input.tk-in, select.tk-in, textarea.tk-in {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 9px 12px;
    font-size: 13.5px;
    color: var(--ink);
    font-family: inherit;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}
input.tk-in:focus, select.tk-in:focus, textarea.tk-in:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(22, 105, 122, .12);
}

textarea.tk-in {
    width: 100%;
    font-family: ui-monospace, Consolas, monospace;
    font-size: 12.5px;
    line-height: 1.5;
    resize: vertical;
}

.grow { flex: 1 1 200px; min-width: 0; }

label.tk-lab {
    display: block;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .7px;
    text-transform: uppercase;
    color: var(--ink2);
    margin: 0 0 5px;
}

.btn {
    border: 0;
    border-radius: 10px;
    padding: 9px 16px;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    display: inline-flex; align-items: center; gap: 7px;
    transition: transform .1s, box-shadow .15s, background .15s;
}
.btn:active { transform: translateY(1px); }

.btn-p { background: var(--brand); color: #fff; box-shadow: 0 2px 8px rgba(22, 105, 122, .26); }
.btn-p:hover { background: var(--brand-dk); }

.btn-a { background: var(--accent); color: #fff; box-shadow: 0 2px 8px rgba(232, 135, 30, .28); }
.btn-a:hover { filter: brightness(.94); }

.btn-g { background: #EDF1F5; color: var(--ink); }
.btn-g:hover { background: #E2E8EE; }

.btn-d { background: rgba(163, 59, 59, .10); color: var(--stop); }
.btn-d:hover { background: rgba(163, 59, 59, .18); }

.btn-s { padding: 6px 11px; font-size: 12px; border-radius: 8px; }

/* --------------------------------------------------------- skeleton screens */

/* Shown while the first fetch is out. A grey pulse says "coming" where an
   empty panel says "broken", and the two are worth telling apart. */
.sk { display: grid; gap: 9px; }
.sk i {
    display: block;
    height: 13px;
    border-radius: 7px;
    background: linear-gradient(90deg, #E8EDF2 25%, #F3F6F9 50%, #E8EDF2 75%);
    background-size: 240% 100%;
    animation: shine 1.3s ease-in-out infinite;
}
.sk i:nth-child(2) { width: 88%; }
.sk i:nth-child(3) { width: 72%; }
.sk i:nth-child(4) { width: 80%; }
.sk i:nth-child(5) { width: 60%; }

@keyframes shine {
    0%   { background-position: 120% 0; }
    100% { background-position: -120% 0; }
}

/* ------------------------------------------------------------- taps by hour */

.hours {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 74px;
    margin-top: 6px;
}
.hours .h { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; height: 100%; }
.hours .h b {
    display: block;
    background: linear-gradient(180deg, var(--brand), #2A8FA3);
    border-radius: 4px 4px 2px 2px;
    min-height: 2px;
    transition: height .35s cubic-bezier(.2, .8, .2, 1);
}
.hours .h.none b { background: #E4EAF0; }
.hours .h s {
    text-decoration: none;
    font-size: 8.5px;
    color: var(--ink2);
    text-align: center;
    margin-top: 4px;
    font-variant-numeric: tabular-nums;
}

/* -------------------------------------------------------------- the drawer */

.sheet {
    position: fixed;
    inset: 0;
    background: rgba(16, 23, 32, .42);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    z-index: 60;
    display: none;
    align-items: flex-end;
    justify-content: center;
}
.sheet.on { display: flex; }

.sheet-in {
    background: var(--surface);
    width: 100%;
    max-width: 560px;
    border-radius: 18px 18px 0 0;
    padding: 20px;
    max-height: 88vh;
    overflow-y: auto;
    box-shadow: 0 -8px 40px rgba(16, 23, 32, .22);
    animation: rise .22s cubic-bezier(.2, .9, .2, 1);
}

@keyframes rise {
    from { transform: translateY(26px); opacity: .6; }
    to   { transform: translateY(0);    opacity: 1; }
}

.sheet-t { font-size: 17px; font-weight: 700; margin: 0 0 3px; }
.sheet-s { font-size: 12.5px; color: var(--ink2); margin: 0 0 18px; }

.fld { margin-bottom: 13px; }
.fld input.tk-in, .fld select.tk-in { width: 100%; }

.two { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }

.sheet-btns { display: flex; gap: 9px; margin-top: 18px; }
.sheet-btns .btn { flex: 1; justify-content: center; }

/* ---------------------------------------------------------------- messages */

.note {
    padding: 11px 14px;
    border-radius: 10px;
    font-size: 13px;
    margin-bottom: 14px;
    display: flex; gap: 9px; align-items: flex-start;
}
.note.bad  { background: rgba(163, 59, 59, .08); color: #7D2E2E; border: 1px solid rgba(163, 59, 59, .2); }
.note.good { background: rgba(27, 127, 92, .08); color: #14614A; border: 1px solid rgba(27, 127, 92, .2); }
.note.info { background: rgba(22, 105, 122, .07); color: var(--brand-dk); border: 1px solid rgba(22, 105, 122, .18); }

.empty { text-align: center; padding: 34px 18px; color: var(--ink2); }
.empty i { font-size: 27px; opacity: .3; display: block; margin-bottom: 11px; }
.empty p { margin: 0; font-size: 13.5px; }

.toast {
    position: fixed;
    left: 50%;
    bottom: 26px;
    transform: translateX(-50%) translateY(90px);
    background: var(--ink);
    color: #fff;
    padding: 11px 20px;
    border-radius: 999px;
    font-size: 13.5px;
    z-index: 90;
    opacity: 0;
    transition: transform .26s cubic-bezier(.2, .9, .2, 1), opacity .26s;
    box-shadow: 0 8px 26px rgba(16, 23, 32, .3);
    pointer-events: none;
}
.toast.on { transform: translateX(-50%) translateY(0); opacity: 1; }

/* ----------------------------------------------------------------- sign in */

.tk-gate { max-width: 400px; margin: 7vh auto 0; }

.tk-gate .tk-card { padding: 26px; }
.tk-gate h1 { font-size: 21px; font-weight: 700; margin: 0 0 5px; }
.tk-gate p.lede { font-size: 13.5px; color: var(--ink2); margin: 0 0 22px; line-height: 1.5; }
.tk-gate .fld input.tk-in { width: 100%; padding: 12px 14px; font-size: 15px; }
.tk-gate .btn { width: 100%; justify-content: center; padding: 12px; font-size: 15px; }

.tk-swap {
    text-align: center;
    margin-top: 18px;
    font-size: 12.5px;
    color: var(--ink2);
}
.tk-swap a { color: var(--brand); font-weight: 600; text-decoration: none; cursor: pointer; }
.tk-swap a:hover { text-decoration: underline; }

.code {
    font-family: ui-monospace, Consolas, monospace;
    font-size: 21px;
    letter-spacing: 3px;
    font-weight: 700;
    color: var(--brand-dk);
    background: #F2F7F9;
    border: 1px dashed rgba(22, 105, 122, .35);
    border-radius: 11px;
    padding: 13px 16px;
    text-align: center;
}

/* ------------------------------------------------------------------ mobile */

@media (max-width: 760px) {
    .tk-burger { display: grid; place-items: center; }

    /* the identity strip becomes a slide-in panel rather than wrapping */
    .tk-bar-right {
        position: fixed;
        top: 0; right: 0; bottom: 0;
        width: 232px;
        background: var(--brand-dk);
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
        padding: 74px 20px 20px;
        transform: translateX(100%);
        transition: transform .25s cubic-bezier(.2, .9, .2, 1);
        z-index: 50;
        margin-left: 0;
        box-shadow: -8px 0 30px rgba(11, 69, 83, .3);
    }
    .tk-bar-right.on { transform: translateX(0); }

    .tk-main { padding: 16px 13px 32px; }
    .tk-logo-name { font-size: 16px; }
    .tk-stat .v { font-size: 23px; }
    .two { grid-template-columns: 1fr; }
    .sheet-in { max-width: none; }
    table.tk { font-size: 12.5px; }
    table.tk th, table.tk td { padding: 8px 7px; }
}

@media (prefers-reduced-motion: reduce) {
    * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
