/* Bloom ERP — plain CSS, no build step needed on the server. */
:root {
    --leaf: #1f3d2b;
    --leaf-2: #2c5440;
    --leaf-soft: #e7efe9;
    --rose: #b8365f;
    --rose-dark: #962a4c;
    --ink: #1d2320;
    --muted: #6b746f;
    --line: #e3e1dc;
    --paper: #ffffff;
    --bg: #f6f5f1;
    --ok: #2f7a4b;
    --ok-bg: #e5f3ea;
    --warn: #9a6500;
    --warn-bg: #fdf1dc;
    --err: #b3261e;
    --err-bg: #fbe9e7;
    --radius: 10px;
    --shadow: 0 1px 2px rgba(20, 30, 25, .06), 0 2px 8px rgba(20, 30, 25, .04);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 15px;
    color: var(--ink);
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--bg); line-height: 1.45; }
a { color: var(--rose); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 1.35rem; }
h2 { font-size: 1.05rem; margin-bottom: .6rem; }
code, .mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .88em; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.lead { font-size: 1.1rem; margin: 0 0 1.2rem; }

/* Layout */
.shell { display: flex; min-height: 100vh; }
.sidebar {
    width: 236px; flex: 0 0 236px; background: var(--leaf); color: #dfe9e2;
    display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand { display: flex; gap: .7rem; align-items: center; padding: 1.2rem 1.1rem; }
.brand strong { display: block; color: #fff; font-size: 1.05rem; }
.brand small { display: block; color: #a9bdb0; font-size: .78rem; }
.brand-mark {
    width: 36px; height: 36px; border-radius: 9px; background: var(--rose); color: #fff;
    display: grid; place-items: center; font-size: 1.2rem;
}
.sidebar nav { display: flex; flex-direction: column; padding: .3rem .6rem; flex: 1; }
.sidebar nav a, .nav-soon {
    color: #dfe9e2; padding: .48rem .7rem; border-radius: 7px; font-size: .93rem;
}
.sidebar nav a:hover { background: var(--leaf-2); text-decoration: none; }
.sidebar nav a.active { background: #fff; color: var(--leaf); font-weight: 600; }
.nav-group { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: #8fa898; padding: 1rem .7rem .3rem; }
.nav-soon { color: #7f9886; font-size: .86rem; padding-top: .25rem; padding-bottom: .25rem; }
.sidebar-user { border-top: 1px solid var(--leaf-2); padding: .9rem 1.1rem; display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.sidebar-user a { color: #fff; }
.sidebar-user strong { display: block; font-size: .9rem; }
.sidebar-user small { color: #a9bdb0; }
.sidebar-user .link { color: #a9bdb0; }

.main { flex: 1; min-width: 0; }
.topbar {
    display: flex; align-items: center; gap: 1rem; padding: 1rem 1.6rem;
    background: var(--paper); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5;
}
.topbar h1 { flex: 1; }
.topbar-actions { display: flex; gap: .6rem; align-items: center; }
.content { padding: 1.4rem 1.6rem 3rem; max-width: 1280px; }
.nav-toggle, .nav-button { display: none; }

/* Cards and grids */
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.2rem; box-shadow: var(--shadow); margin-bottom: 1rem; }
.card.flush { padding: 0; overflow: hidden; }
.card.flush.table-scroll { overflow-x: auto; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; margin-bottom: .6rem; }
.card-head h2 { margin: 0; }
.stack { display: flex; flex-direction: column; gap: .85rem; }
.stack > .card { margin-bottom: 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; align-items: start; }
.grid-wide-left { grid-template-columns: 2fr 1fr; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: .85rem; }
.span-2 { grid-column: span 2; }
.narrow { max-width: 640px; }
.row-actions { display: flex; gap: 1rem; align-items: center; }
.checks { display: flex; flex-wrap: wrap; gap: .6rem 1.4rem; align-items: center; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 1rem; margin-bottom: 1.2rem; }
.tile { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; box-shadow: var(--shadow); color: var(--ink); }
.tile:hover { text-decoration: none; border-color: #cfd8d2; }
.tile span { display: block; color: var(--muted); font-size: .85rem; }
.tile strong { font-size: 1.8rem; font-weight: 650; }
.tile-warn { background: var(--warn-bg); border-color: #f1d9a8; }

/* Forms */
label { display: flex; flex-direction: column; gap: .3rem; font-size: .86rem; font-weight: 550; color: #39423d; }
label.check { flex-direction: row; align-items: center; gap: .5rem; font-weight: 450; font-size: .92rem; }
input:not([type=checkbox]):not([type=radio]), select, textarea {
    font: inherit; font-weight: 400; color: var(--ink); background: #fff;
    border: 1px solid #cfccc5; border-radius: 7px; padding: .5rem .65rem; width: 100%; min-height: 38px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(184, 54, 95, .25); border-color: var(--rose); }
input[type=checkbox], input[type=radio] { width: 17px; height: 17px; accent-color: var(--rose); }
input[disabled] { opacity: .55; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem 1rem 1rem; display: flex; flex-direction: column; gap: .55rem; }
legend { font-weight: 650; padding: 0 .4rem; }
.w-sm { max-width: 96px; }
.w-md { max-width: 170px; }
input.right { text-align: right; }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
    font: inherit; font-weight: 600; padding: .55rem 1rem; border-radius: 8px;
    border: 1px solid #cfccc5; background: #fff; color: var(--ink); cursor: pointer; min-height: 38px;
}
.btn:hover { background: #f3f2ee; text-decoration: none; }
.btn-primary { background: var(--rose); border-color: var(--rose); color: #fff; }
.btn-primary:hover { background: var(--rose-dark); }
.btn-block { width: 100%; }
.link { background: none; border: 0; padding: 0; font: inherit; color: var(--rose); cursor: pointer; }
.link.danger { color: var(--err); }

.filters { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.filters input[type=search] { flex: 1 1 260px; }
.filters select, .filters input[type=date] { width: auto; }

/* Tables */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: .76rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; padding: .65rem .9rem; border-bottom: 1px solid var(--line); background: #fbfaf8; }
.table td { padding: .6rem .9rem; border-bottom: 1px solid #efede8; vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table th.right, .table td.right { text-align: right; }
.row-muted td { color: var(--muted); }
.table-scroll { overflow-x: auto; }
.table.units td { padding: .45rem .55rem; }
.thumb { width: 52px; }
.thumb img, .thumb-empty { width: 40px; height: 40px; border-radius: 7px; object-fit: cover; display: grid; place-items: center; background: var(--leaf-soft); color: var(--leaf); }
.indent { color: var(--muted); margin: 0 .4rem 0 .6rem; }
.audit .changes { font-size: .82rem; max-width: 420px; }
.audit del { color: var(--err); }
.audit ins { color: var(--ok); text-decoration: none; }

.badge { display: inline-block; font-size: .74rem; font-weight: 600; padding: .15rem .5rem; border-radius: 99px; background: #eeece7; color: #4a524d; white-space: nowrap; }
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }

.alert { border-radius: 8px; padding: .75rem 1rem; margin-bottom: 1rem; border: 1px solid transparent; }
.alert ul { margin: .4rem 0 0; padding-left: 1.2rem; }
.alert-ok { background: var(--ok-bg); color: #1f5a35; border-color: #c4e3cf; }
.alert-error { background: var(--err-bg); color: var(--err); border-color: #f2c5bf; }
.alert-info { background: var(--leaf-soft); color: var(--leaf); }

.details { display: grid; grid-template-columns: 110px 1fr; gap: .4rem .8rem; margin: 0; }
.details dt { color: var(--muted); }
.details dd { margin: 0; }

.inline-edit { display: inline-block; text-align: left; }
.inline-edit summary { cursor: pointer; color: var(--rose); list-style: none; }
.inline-edit[open] { position: relative; }
.inline-edit[open] > form:first-of-type {
    position: absolute; right: 0; z-index: 10; width: 280px; background: #fff; padding: 1rem;
    border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 10px 30px rgba(0,0,0,.12); margin-top: .4rem;
}
.inline-edit[open] > form:last-of-type { margin-top: .4rem; }

.image-field img { width: 100%; max-height: 180px; object-fit: cover; border-radius: 8px; margin-bottom: .5rem; }

.pager { display: flex; gap: 1rem; align-items: center; justify-content: center; margin: 1rem 0; }
.pager .disabled { color: #b5b9b6; }
.pager-info { color: var(--muted); font-size: .88rem; }

/* Login */
body.guest { display: grid; place-items: center; min-height: 100vh; background: linear-gradient(160deg, var(--leaf) 0%, #2d5a43 60%, #7a2f4a 140%); }
.guest-card { background: #fff; width: min(380px, 92vw); border-radius: 14px; padding: 1.8rem; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.brand-guest { padding: 0 0 1.3rem; }
.brand-guest strong { color: var(--ink); }
.brand-guest small { color: var(--muted); }

/* Tablet and phone: the sidebar slides in. Tills run on tablets, so this matters. */
@media (max-width: 900px) {
    .sidebar { position: fixed; left: 0; top: 0; z-index: 20; transform: translateX(-100%); transition: transform .2s; box-shadow: 4px 0 20px rgba(0,0,0,.2); }
    .nav-toggle:checked ~ .shell .sidebar { transform: none; }
    .nav-button { display: grid; place-items: center; width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; font-size: 1.1rem; flex-direction: row; }
    .content { padding: 1rem; }
    .topbar { padding: .8rem 1rem; }
    .grid-2, .grid-wide-left { grid-template-columns: 1fr; }
    .hide-sm { display: none; }
}
@media (max-width: 600px) {
    .grid-3 { grid-template-columns: 1fr; }
    .span-2 { grid-column: auto; }
    .table th, .table td { padding: .5rem .55rem; }
}
