/* PDTHUB POS portal — same palette as the till, so the two read as one product. */

:root {
    --bg: #181a20;
    --surface: #21242c;
    --surface-alt: #2a2e38;
    --border: #3a3f4c;
    --text: #eceff4;
    --muted: #969eaf;
    --accent: #388ee0;
    --violet: #7b5bd6;
    --success: #2ea061;
    --danger: #c74646;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
    -webkit-font-smoothing: antialiased;
}

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

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

.signin-wrap {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        radial-gradient(900px 500px at 20% -10%, rgba(56, 142, 224, .18), transparent 60%),
        radial-gradient(800px 500px at 90% 110%, rgba(123, 91, 214, .16), transparent 60%),
        var(--bg);
}

.signin {
    width: 100%;
    max-width: 420px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 36px 32px 32px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 28px;
}

.brand img { width: 46px; height: 46px; object-fit: contain; }
.brand h1 { font-size: 20px; margin: 0; letter-spacing: .3px; }
.brand span { display: block; font-size: 12px; color: var(--muted); font-weight: 400; }

label {
    display: block;
    font-size: 13px;
    color: var(--muted);
    margin: 0 0 7px;
}

input[type=email], input[type=password], input[type=text], input[type=date] {
    width: 100%;
    padding: 13px 14px;
    margin-bottom: 18px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 9px;
    color: var(--text);
    font-size: 15px;
    font-family: inherit;
}

/* Date fields.
   The browser's own control ships a light-themed calendar button and a set of
   spin fields that ignore the surrounding colours entirely. color-scheme tells
   it which way round we are, which is the only way to recolour the picker
   itself; the rest is just making the box match every other input. */
input[type=date] {
    color-scheme: dark;
    min-height: 46px;
}

input[type=date]::-webkit-calendar-picker-indicator {
    filter: invert(0.85);
    cursor: pointer;
    opacity: .8;
}

input[type=date]::-webkit-calendar-picker-indicator:hover { opacity: 1; }

/* In a toolbar a date field sits in a flex row next to a button, so the
   full-width-and-18px-below treatment the form inputs get would push the Apply
   button onto its own line. Same colours, its own size. */
.toolbar input[type=date] {
    width: auto;
    margin-bottom: 0;
    padding: 9px 12px;
    font-size: 14px;
    min-height: 0;
}

input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(56, 142, 224, .18);
}

button {
    width: 100%;
    padding: 14px;
    border: 0;
    border-radius: 9px;
    background: var(--accent);
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
}

button:hover { filter: brightness(1.08); }
button:disabled { opacity: .55; cursor: default; }

.error {
    display: none;
    background: rgba(199, 70, 70, .14);
    border: 1px solid rgba(199, 70, 70, .45);
    color: #ffb4b4;
    padding: 11px 13px;
    border-radius: 9px;
    font-size: 14px;
    margin-bottom: 18px;
}

.error.show { display: block; }

.hint {
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid var(--border);
    font-size: 12.5px;
    color: var(--muted);
    line-height: 1.6;
}

/* ---------------------------------------------------------- dashboard -- */

.topbar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 24px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

/* The badge art carries its own rounded corners and transparent surround, so
   it is fitted rather than cropped — the mark is slightly taller than it is
   wide, and forcing it square is visible on the lettering. */
.topbar img { width: 34px; height: 34px; object-fit: contain; }
.topbar .title { font-weight: 600; font-size: 16px; }
.topbar .spacer { flex: 1; }
.topbar .who { font-size: 13.5px; color: var(--muted); text-align: right; }
.topbar .who b { color: var(--text); display: block; font-weight: 600; }

.pill {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    background: var(--accent);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .4px;
}

.btn-ghost {
    width: auto;
    padding: 9px 16px;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 14px;
}

main { padding: 26px 24px 60px; max-width: 1180px; margin: 0 auto; }

h2 {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: .8px;
    color: var(--muted);
    margin: 32px 0 14px;
    font-weight: 600;
}

h2:first-child { margin-top: 8px; }

.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 14px;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 18px 20px;
}

.card .k { font-size: 12.5px; color: var(--muted); margin-bottom: 8px; }
.card .v { font-size: 27px; font-weight: 600; letter-spacing: -.5px; }
.card .sub { font-size: 12.5px; color: var(--muted); margin-top: 6px; }

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
}

th, td {
    padding: 13px 18px;
    text-align: left;
    font-size: 14px;
    border-bottom: 1px solid var(--border);
}

th {
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: .6px;
    color: var(--muted);
    font-weight: 600;
}

tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

.empty {
    background: var(--surface);
    border: 1px dashed var(--border);
    border-radius: 12px;
    padding: 26px;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.65;
}

.table-wrap { overflow-x: auto; }

/* --------------------------------------------------------------- nav -- */

.nav {
    display: flex;
    gap: 2px;
    padding: 0 24px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
}

.nav a {
    padding: 13px 18px;
    font-size: 14px;
    font-weight: 500;
    color: var(--muted);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
}

.nav a:hover { color: var(--text); }

.nav a.on {
    color: var(--text);
    border-bottom-color: var(--accent);
}

/* ------------------------------------------------------------ toolbar -- */

.toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 22px 0 16px;
    flex-wrap: wrap;
}

.toolbar h1 { font-size: 21px; margin: 0; font-weight: 600; }
.toolbar .spacer { flex: 1; }

.btn {
    width: auto;
    padding: 10px 18px;
    font-size: 14px;
    border-radius: 8px;
}

.btn-sm {
    width: auto;
    padding: 7px 13px;
    font-size: 13px;
    border-radius: 7px;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    color: var(--text);
}

.btn-danger { background: var(--danger); border: 0; color: #fff; }

input[type=search], select {
    padding: 10px 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
    margin: 0;
}

.muted { color: var(--muted); }
.right { text-align: right; }

.tag {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 600;
    background: var(--surface-alt);
    color: var(--muted);
    border: 1px solid var(--border);
}

.tag.off { color: #ffb4b4; border-color: rgba(199,70,70,.5); }
.tag.on  { color: #9ae6bd; border-color: rgba(46,160,97,.5); }

.swatch {
    display: inline-block;
    width: 13px; height: 13px;
    border-radius: 4px;
    vertical-align: -2px;
    margin-right: 7px;
    border: 1px solid rgba(255,255,255,.18);
}

/* -------------------------------------------------------------- modal -- */

.modal-back {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.6);
    display: none;
    place-items: center;
    padding: 24px;
    z-index: 40;
}

.modal-back.show { display: grid; }

.modal {
    width: 100%;
    max-width: 520px;
    max-height: 88vh;
    overflow-y: auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 26px 28px;
}

.modal h3 { margin: 0 0 20px; font-size: 18px; }
.modal .row { display: flex; gap: 14px; }
.modal .row > * { flex: 1; }
.modal label { margin-top: 4px; }
.modal .actions { display: flex; gap: 12px; margin-top: 22px; }
.modal .actions button { flex: 1; }

.check {
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 6px 0 18px;
    font-size: 14px;
    color: var(--text);
}

.check input { width: 17px; height: 17px; margin: 0; }

/* -------------------------------------------------------------- toast -- */

.toast {
    position: fixed;
    left: 50%;
    bottom: 28px;
    transform: translateX(-50%) translateY(24px);
    background: var(--success);
    color: #fff;
    padding: 13px 22px;
    border-radius: 9px;
    font-size: 14px;
    font-weight: 500;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s, transform .2s;
    z-index: 60;
}

.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: var(--danger); }

/* ---------------------------------------------------------- picture picker --
   A dropdown that shows the pictures rather than their file names. Names are
   generated from SKUs, so a list of them asks you to remember which coffee is
   which — the whole reason someone is choosing a picture is that they want to
   look at it. */

.imgpick { position: relative; }

.imgpick-field {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 10px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    cursor: pointer;
    text-align: left;
    font: inherit;
}

.imgpick-field:hover { border-color: var(--accent); }

.imgpick-thumb {
    width: 54px;
    height: 36px;
    flex: none;
    border-radius: 5px;
    border: 1px solid var(--border);
    background: var(--surface) center/contain no-repeat;
}

.imgpick-thumb.none { border-style: dashed; }

.imgpick-name {
    flex: 1;
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.imgpick-caret { color: var(--muted); font-size: 11px; flex: none; }

.imgpick-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    /* Above the modal it sits in, below the toast that reports the upload. */
    z-index: 55;
    max-height: 320px;
    overflow-y: auto;
    padding: 8px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
    gap: 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, .45);
}

.imgpick-opt {
    padding: 6px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
    cursor: pointer;
    display: block;
}

.imgpick-opt:hover { border-color: var(--accent); }
.imgpick-opt.sel { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }

.imgpick-opt i {
    display: block;
    height: 62px;
    border-radius: 5px;
    background: var(--surface) center/contain no-repeat;
}

.imgpick-opt.none i { border: 1px dashed var(--border); }

.imgpick-opt span {
    display: block;
    margin-top: 5px;
    font-size: 11px;
    color: var(--muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.imgpick-empty {
    grid-column: 1 / -1;
    padding: 18px 6px;
    text-align: center;
    color: var(--muted);
    font-size: 13px;
}
