:root {
    --maxw: 960px;
    --radius: 10px;
    --border: #e5e7eb;
    --muted: #6b7280;
    --bg: #fafafa;
    --card: #fff;
}

html, body {
    height: 100%;
}

body {
    font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial;
    max-width: var(--maxw);
    margin: 24px auto;
    padding: 0 16px 40px;
    background: var(--bg);
    color: #111827;
}

h1 {
    font-size: 20px;
    margin: 0 0 12px;
}

fieldset {
    border: 1px solid var(--border);
    margin: 14px 0;
    padding: 12px;
    border-radius: var(--radius);
    background: var(--card);
}


label {
    font-size: 12px;
    color: #444;
    display: block;
    margin-bottom: 6px;
}

/* Touch-friendly controls */
input, select, button, textarea {
    width: 100%;
    padding: 10px 12px;
    font-size: 16px; /* larger for mobile */
    line-height: 1.2;
    border: 1px solid #ccc;
    border-radius: 8px;
    background: #fff;
    min-height: 44px; /* finger-friendly */
    box-sizing: border-box;
}

textarea{
    min-height: 200px;
}

button {
    cursor: pointer;
    background: #111827;
    color: #fff;
    border: 0;
    border-radius: 8px;
}

button:active {
    transform: translateY(1px);
}

/* Result cards */
pre {
    background: #f7f7f7;
    padding: 12px;
    border-radius: 8px;
    font: 13px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    white-space: pre; /* keep columns aligned */
    overflow-x: auto; /* allow side scroll on mobile */
}

/* Small helper */
.note {
    font-size: 12px;
    color: var(--muted);
    margin-top: 6px;
}

/* --- Responsive grid with column utilities --- */
.row {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(var(--cols, 1), minmax(0, 1fr));
    margin-top: 10px;
}

/* Base column utilities */
.col-1 {
    --cols: 1;
}

.col-2 {
    --cols: 2;
}

.col-3 {
    --cols: 3;
}

.col-4 {
    --cols: 4;
}

/* Prevent child overflow */
.row > div {
    min-width: 0;
}

/* Breakpoint utilities (optional) */
@media (max-width: 520px) {
    /* small tablets */
    .sm-col-1 {
        --cols: 1;
    }

    .sm-col-2 {
        --cols: 2;
    }

    .sm-col-3 {
        --cols: 3;
    }

    .sm-col-4 {
        --cols: 4;
    }
}

@media (min-width: 760px) {
    /* medium/landscape tablets */
    .md-col-1 {
        --cols: 1;
    }

    .md-col-2 {
        --cols: 2;
    }

    .md-col-3 {
        --cols: 3;
    }

    .md-col-4 {
        --cols: 4;
    }
}

@media (min-width: 900px) {
    /* desktop */
    .lg-col-1 {
        --cols: 1;
    }

    .lg-col-2 {
        --cols: 2;
    }

    .lg-col-3 {
        --cols: 3;
    }

    .lg-col-4 {
        --cols: 4;
    }
}

/* ====== Layout: container + side menu ====== */
.container {
    max-width: var(--maxw);
    margin: 24px auto;
    padding: 0 16px 40px;
    display: grid;
    gap: 16px;
    grid-template-columns: 240px minmax(0, 1fr); /* sidebar + content */
}

/* Stack on small screens; menu becomes a top bar */
@media (max-width: 760px) {
    .container {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}

/* ====== Side menu card ====== */
.menu {
    align-self: start; /* let it stick nicely */
    position: sticky;
    top: 16px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 8px 24px rgba(0, 0, 0, .06);
    padding: 10px;
}

/* Desktop: vertical list */
.menu ol {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 6px;
}

/* Links */
.menu a {
    display: block;
    text-decoration: none;
    color: #111827;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid transparent;
    transition: background .15s ease, color .15s ease, border-color .15s ease, transform .08s ease;
}

.menu a:hover {
    background: #f3f4f6;
}

.menu a:focus-visible {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, .25);
}

/* Active state: use either aria-current="page" or .active on the <li> */
.menu a[aria-current="page"],
.menu li.active > a {
    background: #111827;
    color: #fff;
}

/* ====== Mobile: make the side menu a pill bar ====== */
@media (max-width: 760px) {
    .menu {
        position: relative;
        top: 0;
        padding: 8px;
        border-radius: 12px;
        z-index: 40;
    }

    .menu ol {
        display: block;
        padding: 4px;
    }

    .menu li {
        margin-top: 10px;
    }

    .menu a {
        border: 1px solid var(--border);
        background: #fff;
        border-radius: 9999px; /* pill */
        padding: 10px 14px;
        white-space: nowrap;
    }

    .menu a:hover {
        background: #f9fafb;
    }
}

/* ====== Content area ====== */
.content {
    min-width: 0; /* prevent overflow in grids */
}

/* Searchable select (combobox) */
.combo {
    position: relative;
}

.combo-input { /* inherits your input styles */
}

.combo-list {
    position: absolute;
    z-index: 50;
    left: 0;
    right: 0;
    margin-top: 6px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    max-height: 280px;
    overflow: auto;
    padding: 6px;
    box-shadow: 0 10px 24px rgba(0, 0, 0, .08);
    display: none;
}

.combo.is-open .combo-list {
    display: block;
}

.combo-option {
    list-style: none;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    user-select: none;
}

.combo-option:hover,
.combo-option.is-active {
    background: #f3f4f6;
}

/*Main page*/
.card {
    display: block;
    text-decoration: none;
    color: inherit;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px 18px;
    transition: transform .15s ease, box-shadow .2s ease, border-color .2s ease;
}

.card:focus-visible {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, .25)
}

.card:hover {
    transform: translateY(-2px)
}

.title {
    display: block;
    font-weight: 700;
    font-size: 18px
}

.desc {
    display: block;
    margin-top: 6px;
    color: var(--muted);
    font-size: 14px
}

.cta {
    display: inline-block;
    margin-top: 12px;
    font-weight: 600
}

.cta::after {
    content: " →"
}

footer {
    margin-top: 28px;
    color: var(--muted);
    font-size: 12px
}

header {
    padding: 36px 0 8px
}

h1 {
    margin: 0;
    font-size: 28px
}

.tagline {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 14px
}


/*Candle*/
/* PRINT SHEET SIZING */
#ps-sticker {
    border: 1px dashed #bbb;
    padding: 10px;
    /* approx 90x60mm visual area; browser print scaling varies slightly */
    max-height: 60mm;
    max-width: 90mm;
    margin-top: 20px;
}

/* Table borders for log */
#ps-log th, #ps-log td, #pc-res th, #pc-res td {
    border: 1px solid black;
    padding: 6px;
    font-size: 12px;
    min-width: 50px;
    text-align: center;
}

#ps-log td, #pc-res td {
    padding: 20px 0;
}

#ps-log td{
}

.ps-details {
    font-size: 14px;
}

/* Print rules */
@media print {
    header, .menu, .tagline, #print-refresh {
        display: none !important;
    }

    #print {
        display: block !important;
    }

    .container {
        grid-template-columns: 1fr !important;
    }

    body {
        background: #fff;
        color: #000;
    }

    .card, fieldset {
        box-shadow: none;
    }

    button {
        display: none !important;
    }
}
