/* ==========================================================================
   Flower Shop — Admin Panel Styles
   ========================================================================== */

:root {
    --bg: #f4f0e6;
    --bg-soft: #ece5d4;
    --surface: #ffffff;
    --ink: #2b2822;
    --ink-soft: #7c7568;
    --line: #e2d9c6;
    /* Brand colors from Maya's logo: deep emerald + gold */
    --green: #1f6350;
    --green-dark: #17493a;
    --sage: #e7efe7;
    --rose: #b08a1e;        /* gold accent */
    --rose-dark: #8f6d10;
    --rose-soft: #f8f0d4;
    --amber: #b58a2e;
    --amber-soft: #faf0d8;
    --danger: #b04a3c;
    --danger-soft: #fbeae7;
    --blue: #4a6fa5;
    --blue-soft: #e7eef7;
    --radius-lg: 18px;
    --radius: 14px;
    --radius-sm: 10px;
    --shadow-sm: 0 2px 10px rgba(80, 60, 40, 0.08);
    --shadow-md: 0 14px 34px rgba(80, 60, 40, 0.15);
    --font-display: 'Cormorant Garamond', Georgia, serif;
    --font-body: 'Jost', 'Segoe UI', Arial, sans-serif;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

[hidden] {
    display: none !important;
}

.hidden {
    display: none !important;
}

h1, h2, h3 {
    font-family: var(--font-display);
    font-weight: 600;
    line-height: 1.15;
    margin: 0;
}

p {
    margin: 0;
}

button {
    font-family: inherit;
}

/* ==========================================================================
   Buttons, inputs, badges
   ========================================================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: none;
    border-radius: 999px;
    padding: 10px 20px;
    font-size: 0.9rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.2s ease, transform 0.12s ease, box-shadow 0.2s ease;
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: var(--green);
    color: #fff;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    background: var(--green-dark);
}

.btn-ghost {
    background: transparent;
    color: var(--green);
    box-shadow: inset 0 0 0 1.5px var(--green);
}

.btn-ghost:hover {
    background: var(--sage);
}

.btn-danger {
    background: transparent;
    color: var(--danger);
    box-shadow: inset 0 0 0 1.5px var(--danger);
}

.btn-danger:hover {
    background: var(--danger-soft);
}

.btn-sm {
    padding: 7px 14px;
    font-size: 0.8rem;
}

.btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}

.btn-block {
    display: flex;
    width: 100%;
}

label.f-label,
.f-label {
    display: block;
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink-soft);
    margin-bottom: 6px;
}

.f-input,
.f-select,
.f-textarea {
    width: 100%;
    padding: 11px 13px;
    font-family: inherit;
    font-size: 0.95rem;
    color: var(--ink);
    background: #fffdf9;
    border: 1.5px solid var(--line);
    border-radius: var(--radius-sm);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.f-input:focus,
.f-select:focus,
.f-textarea:focus {
    outline: none;
    border-color: var(--green);
    box-shadow: 0 0 0 3px rgba(65, 96, 78, 0.14);
}

.f-textarea {
    resize: vertical;
    min-height: 58px;
}

.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.badge.st-new      { background: var(--blue-soft); color: var(--blue); }
.badge.st-preparing{ background: var(--amber-soft); color: var(--amber); }
.badge.st-ready    { background: var(--sage); color: var(--green); }
.badge.st-completed{ background: var(--green); color: #fff; }
.badge.st-cancelled{ background: var(--danger-soft); color: var(--danger); }
.badge.pay-pending { background: var(--amber-soft); color: var(--amber); }
.badge.pay-ok      { background: var(--sage); color: var(--green); }
.badge.role        { background: var(--rose-soft); color: var(--rose-dark); }

/* ==========================================================================
   Activity log — glanceable, color-coded rows
   ========================================================================== */

.al-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 14px;
    margin-bottom: 16px;
    background: var(--bg-soft);
    border-radius: 10px;
}

.al-list {
    display: flex;
    flex-direction: column;
}

.al-date {
    margin: 18px 0 8px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ink-soft);
}

.al-date:first-child {
    margin-top: 0;
}

.al-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    padding: 10px 14px 10px 18px;
    border-bottom: 1px solid var(--line);
    border-left: 4px solid var(--line);
    font-size: 0.92rem;
    position: relative;
}

.al-row:last-child {
    border-bottom: none;
}

/* Left rail color = what happened, visible from across the room */
.al-row.is-done   { border-left-color: var(--green); background: rgba(95, 130, 102, 0.05); }
.al-row.is-cancel { border-left-color: var(--danger); background: rgba(160, 60, 60, 0.05); }

.al-time {
    flex: none;
    min-width: 64px;
    color: var(--ink-soft);
    font-variant-numeric: tabular-nums;
    font-size: 0.84rem;
}

.al-order {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.02em;
}

.al-who {
    font-weight: 500;
}

.al-items {
    color: var(--ink-soft);
    font-size: 0.82rem;
    max-width: 340px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.al-change {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.al-from {
    opacity: 0.62;
}

.al-arrow {
    color: var(--ink-soft);
    font-weight: 600;
}

.al-note {
    color: var(--ink-soft);
    font-size: 0.84rem;
}

@media (max-width: 640px) {
    .al-time {
        min-width: 0;
    }
}

/* ==========================================================================
   Login
   ========================================================================== */

.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background:
        radial-gradient(560px 340px at 85% -10%, rgba(185, 106, 119, 0.12), transparent 70%),
        radial-gradient(520px 320px at 8% 90%, rgba(65, 96, 78, 0.08), transparent 70%),
        var(--bg);
}

.login-card {
    width: min(400px, 100%);
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 36px 32px;
    text-align: center;
}

.login-mark {
    width: 44px;
    height: 44px;
    color: var(--rose);
    margin-bottom: 10px;
}

.login-logo {
    width: 76px;
    height: 76px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 12px;
    box-shadow: var(--shadow-sm);
}

.login-title {
    font-size: 2rem;
    margin-bottom: 4px;
}

.login-sub {
    color: var(--ink-soft);
    font-weight: 300;
    font-size: 0.9rem;
    margin-bottom: 26px;
}

.login-card .field {
    margin-bottom: 14px;
    text-align: left;
}

.login-error {
    background: var(--danger-soft);
    color: var(--danger);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 0.85rem;
    margin-bottom: 14px;
    text-align: left;
}

.login-hint {
    margin-top: 18px;
    font-size: 0.75rem;
    color: var(--ink-soft);
    font-weight: 300;
}

.demo-pill {
    display: inline-block;
    margin-top: 14px;
    background: var(--amber-soft);
    color: var(--amber);
    border-radius: 999px;
    padding: 4px 14px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

/* ==========================================================================
   App shell
   ========================================================================== */

.app {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 220px;
    flex: none;
    background: var(--green-dark);
    color: #fff;
    display: flex;
    flex-direction: column;
    padding: 22px 14px;
    position: sticky;
    top: 0;
    height: 100vh;
}

.side-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 10px 22px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.14);
    margin-bottom: 18px;
}

.side-brand svg {
    width: 26px;
    height: 26px;
    color: #e6c34a;
}

.side-logo {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
    flex: none;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

.side-brand .name {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.1;
}

.side-brand .sub {
    font-size: 0.62rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    opacity: 0.65;
}

.nav-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.82);
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    letter-spacing: 0.03em;
    cursor: pointer;
    text-align: left;
    transition: background-color 0.15s ease;
}

.nav-btn svg {
    width: 19px;
    height: 19px;
    flex: none;
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.09);
}

.nav-btn.is-active {
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
    font-weight: 600;
}

.side-foot {
    margin-top: auto;
    border-top: 1px solid rgba(255, 255, 255, 0.14);
    padding-top: 14px;
    display: grid;
    gap: 8px;
}

.side-user {
    padding: 0 10px 6px;
    font-size: 0.78rem;
    opacity: 0.75;
}

.side-user strong {
    display: block;
    font-size: 0.9rem;
    opacity: 1;
    letter-spacing: 0.03em;
}

.tv-link {
    display: flex;
    align-items: center;
    gap: 10px;
    color: rgba(255, 255, 255, 0.82);
    text-decoration: none;
    font-size: 0.9rem;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
}

.tv-link:hover {
    background: rgba(255, 255, 255, 0.09);
}

.tv-link svg {
    width: 19px;
    height: 19px;
}

/* ==========================================================================
   Main content
   ========================================================================== */

.main {
    flex: 1;
    min-width: 0;
    padding: 26px 30px 60px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 22px;
    flex-wrap: wrap;
}

.topbar h1 {
    font-size: 2rem;
}

.topbar .sub {
    color: var(--ink-soft);
    font-weight: 300;
    font-size: 0.9rem;
}

.top-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 22px;
    margin-bottom: 18px;
}

.card h2 {
    font-size: 1.45rem;
    margin-bottom: 14px;
}

.empty {
    text-align: center;
    padding: 42px 16px;
    color: var(--ink-soft);
    font-weight: 300;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
    margin-bottom: 18px;
}

@media (min-width: 760px) {
    .stat-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.stat-card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 16px 18px;
}

.stat-label {
    font-size: 0.68rem;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ink-soft);
    margin-bottom: 4px;
}

.stat-value {
    font-size: 1.65rem;
    font-weight: 600;
    color: var(--green-dark);
    font-variant-numeric: tabular-nums;
}

.stat-value.rose {
    color: var(--rose-dark);
}

/* ==========================================================================
   Orders board (drag & drop Kanban)
   ========================================================================== */

.board {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
    margin-bottom: 16px;
}

@media (min-width: 800px) {
    .board {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Loading indicator shown while orders are being fetched */
.board-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 22px;
    margin-bottom: 14px;
    border: 1px dashed var(--line);
    border-radius: 10px;
    color: var(--ink-soft);
    font-size: 0.88rem;
}

/* Generic per-tab loading bar (products, users, reports, activity) */
.tab-loading {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    margin-bottom: 16px;
    border: 1px dashed var(--line);
    border-radius: 10px;
    color: var(--ink-soft);
    font-size: 0.86rem;
}

.tab-loading::before {
    content: '';
    width: 14px;
    height: 14px;
    flex: none;
    border-radius: 50%;
    border: 2px solid var(--sage);
    border-top-color: var(--green);
    animation: tabSpin 0.8s linear infinite;
}

@keyframes tabSpin {
    to { transform: rotate(360deg); }
}

.board-loading-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--green);
    animation: boardDot 1s ease-in-out infinite;
}

.board-loading-dot:nth-child(2) { animation-delay: 0.15s; }
.board-loading-dot:nth-child(3) { animation-delay: 0.3s; }

@keyframes boardDot {
    0%, 100% { opacity: 0.25; transform: translateY(0); }
    50% { opacity: 1; transform: translateY(-4px); }
}

.board-col {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    min-height: 260px;
}

.board-col-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    font-size: 0.8rem;
}

.col-new .board-col-head { background: var(--blue-soft); color: var(--blue); }
.col-preparing .board-col-head { background: var(--amber-soft); color: var(--amber); }
.col-ready .board-col-head { background: var(--sage); color: var(--green); }

.board-count {
    min-width: 26px;
    height: 26px;
    padding: 0 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.75);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-variant-numeric: tabular-nums;
    font-size: 0.9rem;
}

.board-col-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 12px;
    transition: background-color 0.15s ease, box-shadow 0.15s ease;
}

.board-col.is-dragover .board-col-body {
    background: var(--sage);
    box-shadow: inset 0 0 0 2px var(--green);
}

.board-empty {
    margin: auto;
    text-align: center;
    color: var(--ink-soft);
    font-weight: 300;
    font-size: 0.85rem;
    padding: 26px 12px;
}

.board-card {
    margin-bottom: 0;
    cursor: grab;
    padding: 12px 14px;
}

.board-card .order-head {
    margin-bottom: 0;
}

.board-card.is-ready {
    box-shadow: inset 0 0 0 1.5px rgba(65, 96, 78, 0.35), var(--shadow-sm);
}

.board-card:active {
    cursor: grabbing;
}

.board-card.dragging {
    opacity: 0.45;
}

.board-sum {
    margin-top: 5px;
    font-size: 0.9rem;
    color: var(--ink);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.board-customer {
    margin-top: 7px;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.board-loc {
    position: relative;
    margin-top: 3px;
    padding-left: 17px;
    font-size: 0.8rem;
    line-height: 1.35;
    color: var(--ink-soft);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.board-loc svg {
    position: absolute;
    left: 0;
    top: 2px;
    width: 11px;
    height: 11px;
    color: var(--green);
}

.board-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 8px;
}

.board-foot .order-total {
    font-size: 0.98rem;
}

.board-eta {
    flex: none;
    font-size: 0.68rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ink-soft);
    background: var(--bg);
    padding: 3px 10px;
    border-radius: 999px;
    white-space: nowrap;
}

/* --- Order details pop-up --- */

.pop-badges {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

#orderSheetBody .order-items {
    margin-bottom: 16px;
}

#orderSheetBody .order-items li {
    font-size: 0.98rem;
}

.pop-total {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1.5px solid var(--line);
    font-weight: 600;
    font-size: 1.15rem;
}

.pop-total span:last-child {
    color: var(--rose-dark);
}

.pop-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    flex-wrap: wrap;
    margin-top: 18px;
}

.done-bar {
    margin-bottom: 14px;
}

.done-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 0;
    border-bottom: 1px dashed var(--line);
    font-size: 0.92rem;
}

.done-row:last-child {
    border-bottom: none;
}

.done-row .badge {
    margin-left: auto;
}

/* ==========================================================================
   Orders tab
   ========================================================================== */

.order-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 18px 20px;
    margin-bottom: 14px;
}

.order-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.order-id {
    font-weight: 600;
    letter-spacing: 0.05em;
    font-variant-numeric: tabular-nums;
}

.order-time {
    color: var(--ink-soft);
    font-size: 0.8rem;
    font-weight: 300;
}

.order-grid {
    display: grid;
    gap: 14px;
}

@media (min-width: 800px) {
    .order-grid {
        grid-template-columns: 1.4fr 1fr;
    }
}

.order-items {
    margin: 0;
    padding: 0;
    list-style: none;
}

.order-items li {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 5px 0;
    border-bottom: 1px dashed var(--line);
    font-size: 0.92rem;
}

.order-items li:last-child {
    border-bottom: none;
}

.order-items .qty {
    color: var(--ink-soft);
    flex: none;
}

.order-meta {
    background: var(--bg);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    font-size: 0.88rem;
}

.order-meta .row {
    display: flex;
    gap: 10px;
    padding: 2px 0;
}

.order-meta .k {
    color: var(--ink-soft);
    flex: none;
    min-width: 88px;
    font-size: 0.78rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding-top: 2px;
}

.order-meta .v {
    font-weight: 500;
    word-break: break-word;
}

.order-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
}

.order-total {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--rose-dark);
}

.status-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ==========================================================================
   Products tab
   ========================================================================== */

.product-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 16px;
}

.admin-product {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.admin-product .thumb {
    aspect-ratio: 4 / 3;
    background: linear-gradient(150deg, var(--rose-soft), var(--bg-soft));
    overflow: hidden;
    position: relative;
}

.admin-product .thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.admin-product.is-unavailable .thumb img {
    filter: grayscale(0.85);
    opacity: 0.7;
}

.admin-product .body {
    padding: 12px 14px 14px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex: 1;
}

.admin-product .cat {
    font-size: 0.62rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--rose-dark);
    font-weight: 500;
}

.admin-product .name {
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 600;
}

.admin-product .price {
    font-weight: 600;
    color: var(--green-dark);
}

.admin-product .mto-chip,
.admin-product .stock-line {
    align-self: flex-start;
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 3px 9px;
    border-radius: 999px;
}

.admin-product .mto-chip {
    background: #fdf3dd;
    color: #9a6b15;
}

.admin-product .stock-line {
    background: var(--bg-soft, #f1efe9);
    color: var(--ink-soft, #6d675c);
}

.admin-product .stock-line.out {
    background: #fbe4e4;
    color: #a33d3d;
}

.admin-product .actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

/* --- Product form modal --- */

.overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: rgba(43, 39, 33, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow-y: auto;
}

.sheet {
    width: min(560px, 100%);
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 26px 28px;
    max-height: 92vh;
    overflow-y: auto;
}

.sheet-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
}

.sheet-head h2 {
    font-size: 1.6rem;
}

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--ink);
    cursor: pointer;
}

.icon-btn:hover {
    background: var(--bg-soft);
}

.icon-btn svg {
    width: 20px;
    height: 20px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0 14px;
    margin-bottom: 14px;
}

@media (min-width: 560px) {
    .form-row.two {
        grid-template-columns: 1fr 1fr;
    }
}

.form-row .field {
    margin-bottom: 14px;
}

.form-row .field:last-child {
    margin-bottom: 0;
}

.field {
    margin-bottom: 14px;
}

.field .f-error {
    display: none;
    color: var(--danger);
    font-size: 0.78rem;
    margin-top: 4px;
}

.field.invalid .f-error {
    display: block;
}

.field.invalid .f-input,
.field.invalid .f-select,
.field.invalid .f-textarea {
    border-color: var(--danger);
}

.check-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.92rem;
    margin-bottom: 14px;
}

.check-row input {
    width: 18px;
    height: 18px;
    accent-color: var(--green);
}

/* --- Image upload --- */

.upload-box {
    border: 1.5px dashed var(--line);
    border-radius: var(--radius);
    background: var(--bg);
    padding: 14px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.upload-box:hover {
    border-color: var(--green);
    background: var(--sage);
}

.upload-box.has-image {
    padding: 0;
    border-style: solid;
}

.upload-box img {
    width: 100%;
    max-height: 240px;
    object-fit: cover;
    border-radius: var(--radius);
    display: block;
}

.upload-box .upload-hint {
    padding: 18px 10px;
    color: var(--ink-soft);
    font-size: 0.85rem;
    font-weight: 300;
}

.upload-box .upload-hint strong {
    color: var(--green);
    font-weight: 500;
}

.upload-progress {
    margin-top: 8px;
    font-size: 0.8rem;
    color: var(--ink-soft);
}

.form-error {
    background: var(--danger-soft);
    color: var(--danger);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 0.85rem;
    margin-bottom: 14px;
}

.sheet-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 6px;
}

/* ==========================================================================
   Users tab
   ========================================================================== */

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

table.data {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
}

table.data th {
    text-align: left;
    font-size: 0.68rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ink-soft);
    font-weight: 500;
    padding: 8px 10px;
    border-bottom: 1.5px solid var(--line);
}

table.data td {
    padding: 10px;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}

table.data tr:last-child td {
    border-bottom: none;
}

/* ==========================================================================
   Reports tab
   ========================================================================== */

.bar-chart {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 10px;
    align-items: end;
    min-height: 180px;
    padding-top: 10px;
}

.bar-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    height: 100%;
    justify-content: flex-end;
}

.bar {
    width: 100%;
    max-width: 46px;
    background: linear-gradient(180deg, var(--rose), var(--rose-dark));
    border-radius: 6px 6px 2px 2px;
    min-height: 4px;
    transition: height 0.4s ease;
}

.bar-col .bar-value {
    font-size: 0.68rem;
    color: var(--ink-soft);
    font-variant-numeric: tabular-nums;
}

.bar-col .bar-label {
    font-size: 0.68rem;
    color: var(--ink-soft);
    text-align: center;
    line-height: 1.2;
}

.top-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.top-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 9px 0;
    border-bottom: 1px dashed var(--line);
    font-size: 0.92rem;
}

.top-list li:last-child {
    border-bottom: none;
}

.top-list .rank {
    width: 26px;
    height: 26px;
    flex: none;
    border-radius: 50%;
    background: var(--sage);
    color: var(--green);
    font-size: 0.78rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-right: 10px;
}

.top-list .name {
    flex: 1;
    display: flex;
    align-items: center;
    font-weight: 500;
}

.top-list .qty {
    color: var(--ink-soft);
    font-size: 0.82rem;
    flex: none;
}

.top-list .rev {
    font-weight: 600;
    color: var(--rose-dark);
    flex: none;
}

/* --- Reports: range toolbar --- */

.rep-toolbar {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 18px;
}

.rep-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.rep-chip {
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--ink-soft);
    font: inherit;
    font-size: 0.85rem;
    font-weight: 500;
    padding: 7px 16px;
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.rep-chip:hover {
    border-color: var(--green);
    color: var(--green);
}

.rep-chip.is-active {
    background: var(--green);
    border-color: var(--green);
    color: #fff;
}

.rep-custom {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.rep-custom .rep-date {
    width: auto;
    min-width: 150px;
    padding: 8px 10px;
}

.rep-to {
    color: var(--ink-soft);
    font-size: 0.88rem;
}

.rep-toolbar-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    border-top: 1px dashed var(--line);
    padding-top: 12px;
}

.rep-range-note,
.rep-subnote {
    margin: 0;
    font-size: 0.8rem;
    font-weight: 300;
    color: var(--ink-soft);
}

.rep-subnote {
    margin-bottom: 12px;
}

#repExport {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    flex: none;
}

#repExport svg {
    width: 16px;
    height: 16px;
}

/* --- Reports: two-column card grid --- */

.rep-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    margin-bottom: 18px;
}

@media (max-width: 860px) {
    .rep-grid-2 {
        grid-template-columns: 1fr;
    }
}

/* --- Reports: category share bars --- */

.rep-cat-list .cat-row {
    flex-wrap: wrap;
}

.cat-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 180px;
    justify-content: flex-end;
}

.cat-share {
    position: relative;
    flex: 1;
    max-width: 130px;
    height: 6px;
    border-radius: 999px;
    background: var(--sage);
    overflow: hidden;
}

.cat-share-fill {
    position: absolute;
    inset: 0 auto 0 0;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--green), var(--rose));
}

/* --- Reports: payment rows + status chips --- */

.pay-row {
    padding: 10px 0;
    border-bottom: 1px dashed var(--line);
}

.pay-row:last-of-type {
    border-bottom: none;
}

.pay-row-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.pay-name {
    font-weight: 500;
    font-size: 0.94rem;
}

.pay-row-sub {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 7px;
    font-size: 0.8rem;
    color: var(--ink-soft);
}

.pay-row-sub .cat-share {
    max-width: 180px;
}

.pay-statuses {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed var(--line);
}

.status-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.status-chip {
    display: inline-flex;
    align-items: center;
    padding: 7px 14px;
    border-radius: 999px;
    background: var(--sage);
    color: var(--green);
    font-size: 0.82rem;
    font-weight: 500;
}

.status-chip.warn {
    background: #f7ead3;
    color: #a3701c;
}

.status-chip.good {
    background: #e2eee7;
    color: var(--green);
}

.empty-note {
    color: var(--ink-soft);
    font-weight: 300;
    font-size: 0.88rem;
}

/* Dense variant when the range has many days */
.bar-chart.dense {
    gap: 4px;
    min-height: 150px;
}

.bar-chart.dense .bar-value {
    display: none;
}

.bar-chart.dense .bar-label {
    font-size: 0.56rem;
}

.bar-chart.dense .bar {
    max-width: none;
    border-radius: 3px 3px 1px 1px;
}

/* ==========================================================================
   Toast
   ========================================================================== */

.toast {
    position: fixed;
    left: 50%;
    bottom: 28px;
    transform: translate(-50%, 16px);
    z-index: 200;
    background: var(--green-dark);
    color: #fff;
    padding: 11px 22px;
    border-radius: 999px;
    font-size: 0.88rem;
    box-shadow: var(--shadow-md);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
    max-width: calc(100vw - 40px);
    text-align: center;
}

.toast.error {
    background: var(--danger);
}

.toast.show {
    opacity: 1;
    transform: translate(-50%, 0);
}

/* ==========================================================================
   Responsive: sidebar collapses to a top bar on small screens
   ========================================================================== */

@media (max-width: 719px) {
    .app {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
        position: static;
        flex-direction: row;
        align-items: center;
        flex-wrap: wrap;
        gap: 4px;
        padding: 10px 12px;
    }

    .side-brand {
        border-bottom: none;
        padding: 0 8px 0 4px;
        margin-bottom: 0;
    }

    .side-brand .name {
        font-size: 1.05rem;
    }

    .nav-btn {
        width: auto;
        padding: 8px 12px;
        font-size: 0.85rem;
    }

    .nav-btn svg {
        display: none;
    }

    .side-foot {
        margin-top: 0;
        margin-left: auto;
        border-top: none;
        padding-top: 0;
        display: flex;
        align-items: center;
        gap: 4px;
    }

    .side-user {
        display: none;
    }

    .tv-link {
        padding: 8px 10px;
        font-size: 0.85rem;
    }

    .side-foot .btn {
        padding: 7px 12px;
        font-size: 0.78rem;
    }

    .main {
        padding: 20px 16px 60px;
    }
}

/* ==========================================================================
   Order selection (print labels) + batch print bar
   ========================================================================== */

.card-pick {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
    cursor: pointer;
    color: var(--ink-soft);
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    user-select: none;
    -webkit-user-select: none;
}

.card-pick input {
    width: 15px;
    height: 15px;
    margin: 0;
    accent-color: var(--green);
    cursor: pointer;
}

.card-pick:hover {
    color: var(--green);
}

.print-batch-bar {
    position: fixed;
    left: 50%;
    bottom: 18px;
    transform: translateX(-50%);
    z-index: 90;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px 14px;
    max-width: min(94vw, 640px);
    padding: 10px 16px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md), inset 0 0 0 1.5px var(--line);
}

.pb-count {
    font-weight: 600;
    color: var(--green);
    white-space: nowrap;
}

.pb-size {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 0.78rem;
    color: var(--ink-soft);
    white-space: nowrap;
}

.pb-size .f-select {
    padding: 6px 28px 6px 10px;
    font-size: 0.82rem;
}

/* ==========================================================================
   Printing — order cards / bouquet labels
   (#printArea is display:none on screen and replaces the whole page in print)
   ========================================================================== */

#printArea {
    display: none;
}

@media print {
    @page {
        size: auto;
        margin: 10mm;
    }

    html, body {
        background: #fff !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    /* Replace the whole admin UI with the print area. */
    body > *:not(#printArea) {
        display: none !important;
    }

    #printArea {
        display: block !important;
    }

    .print-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 5mm;
    }

    /* 2-per-page mode: full-width, taller cards. */
    .print-grid.per-2 {
        grid-template-columns: 1fr;
    }

    .print-card {
        break-inside: avoid;
        page-break-inside: avoid;
        min-height: 118mm;
        box-sizing: border-box;
        border: 1.2px dashed #9a9a9a;
        border-radius: 4mm;
        padding: 6mm 7mm;
        color: #1c1c1c;
        font-family: var(--font-body);
        font-size: 10.5pt;
        line-height: 1.45;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }

    .pc-top {
        display: flex;
        align-items: baseline;
        justify-content: space-between;
        gap: 4mm;
        border-bottom: 1px solid #d0d0d0;
        padding-bottom: 2.5mm;
        margin-bottom: 3.5mm;
    }

    .pc-shop {
        font-size: 8pt;
        font-weight: 600;
        letter-spacing: 0.22em;
        text-transform: uppercase;
        color: #1f6350;
    }

    .pc-id {
        font-size: 12.5pt;
        font-weight: 600;
        letter-spacing: 0.04em;
        white-space: nowrap;
    }

    .pc-row {
        margin: 0 0 2.6mm;
    }

    .pc-k {
        display: block;
        font-size: 7.5pt;
        font-weight: 600;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        color: #8a8a8a;
        margin-bottom: 0.6mm;
    }

    .pc-name {
        font-size: 14.5pt;
        font-weight: 600;
        line-height: 1.25;
    }

    .pc-deliver {
        border: 1.2px solid #1f6350;
        border-radius: 2.5mm;
        padding: 2.2mm 3mm;
        margin-bottom: 3mm;
    }

    .pc-deliver .pc-when {
        font-size: 11.5pt;
        font-weight: 600;
        color: #1f6350;
    }

    .pc-items {
        margin: 0;
        padding: 0;
        list-style: none;
    }

    .pc-items li {
        display: flex;
        justify-content: space-between;
        gap: 4mm;
    }

    .pc-items .qty {
        white-space: nowrap;
        color: #555;
    }

    .pc-message {
        margin-top: auto;
        border-left: 2.5px solid #1f6350;
        padding: 1.5mm 0 1.5mm 3.5mm;
        font-style: italic;
        font-size: 11pt;
    }

    .pc-message .pc-k {
        font-style: normal;
    }

    .pc-notes {
        color: #555;
        font-size: 9.5pt;
    }

    .pc-foot {
        margin-top: 3mm;
        padding-top: 2.5mm;
        border-top: 1px solid #d0d0d0;
        display: flex;
        justify-content: space-between;
        gap: 4mm;
        font-weight: 600;
    }

    .pc-foot .pc-pay {
        font-weight: 400;
        color: #555;
        text-align: right;
    }
}
