/* ============================================================
   JB Storage — base stylesheet
   No external frameworks. Simple, responsive, functional.
   ============================================================ */

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

:root {
    --color-primary:    #2563eb;
    --color-primary-dk: #1d4ed8;
    --color-danger:     #dc2626;
    --color-success:    #16a34a;
    --color-muted:      #6b7280;
    --color-border:     #e5e7eb;
    --color-bg:         #f9fafb;
    --color-surface:    #ffffff;
    --color-text:       #111827;
    --color-text-light: #6b7280;
    --nav-height:       56px;
    --radius:           6px;
    --shadow:           0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);
}

html, body {
    margin: 0;
    padding: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: var(--color-text);
    background: var(--color-bg);
}

a {
    color: var(--color-primary);
    text-decoration: none;
}
a:hover { text-decoration: underline; }

/* ── Navbar ─────────────────────────────────────────────── */

.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--nav-height);
    padding: 0 1.5rem;
    background: var(--color-primary);
    color: #fff;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar-brand a {
    color: #fff;
    font-size: 1.25rem;
    font-weight: 700;
    text-decoration: none;
    letter-spacing: -0.01em;
}

.navbar-menu {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.nav-link {
    color: rgba(255,255,255,.85);
    font-size: .9rem;
    text-decoration: none;
}
.nav-link:hover { color: #fff; text-decoration: none; }

.nav-user {
    color: rgba(255,255,255,.85);
    font-size: .9rem;
    font-weight: 500;
}

/* ── Main content ───────────────────────────────────────── */

.main-content {
    max-width: 1100px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

/* ── Card ───────────────────────────────────────────────── */

.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

/* ── Page header ────────────────────────────────────────── */

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}

.page-header h1 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
}

/* ── Buttons ────────────────────────────────────────────── */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: .45rem 1rem;
    font-size: .875rem;
    font-weight: 500;
    border-radius: var(--radius);
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: background .15s, border-color .15s, color .15s;
    line-height: 1.4;
    background: transparent;
}

.btn-primary {
    background: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
}
.btn-primary:hover {
    background: var(--color-primary-dk);
    border-color: var(--color-primary-dk);
    color: #fff;
    text-decoration: none;
}

.btn-outline {
    background: transparent;
    color: var(--color-primary);
    border-color: var(--color-primary);
}
.btn-outline:hover {
    background: var(--color-primary);
    color: #fff;
    text-decoration: none;
}

/* Outline in navbar (white variant) */
.navbar .btn-outline {
    color: #fff;
    border-color: rgba(255,255,255,.6);
}
.navbar .btn-outline:hover {
    background: rgba(255,255,255,.15);
    color: #fff;
}

.btn-sm {
    padding: .25rem .65rem;
    font-size: .8rem;
}

.btn-full { width: 100%; }

.inline-form {
    display: inline;
    margin: 0;
    padding: 0;
}

/* ── Alerts ─────────────────────────────────────────────── */

.alert {
    padding: .75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: .9rem;
}

.alert-error {
    background: #fef2f2;
    border: 1px solid #fca5a5;
    color: var(--color-danger);
}

/* ── Forms ──────────────────────────────────────────────── */

.form-group {
    margin-bottom: 1.1rem;
}

.form-group label {
    display: block;
    font-size: .875rem;
    font-weight: 500;
    margin-bottom: .35rem;
    color: var(--color-text);
}

.form-control {
    display: block;
    width: 100%;
    padding: .45rem .75rem;
    font-size: .9rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-surface);
    color: var(--color-text);
    transition: border-color .15s, box-shadow .15s;
}
.form-control:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgb(37 99 235 / .15);
}

.form-check {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: .5rem;
    flex-wrap: wrap;
}
.form-check input[type=checkbox] {
    margin-top: .2rem;
    flex-shrink: 0;
}
.form-check label {
    margin-bottom: 0;
}

.form-actions {
    display: flex;
    gap: .75rem;
    margin-top: 1.5rem;
}

.hint {
    font-size: .8rem;
    color: var(--color-text-light);
    margin: .2rem 0 0;
}

/* ── Permissions grid ───────────────────────────────────── */

.permissions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: .5rem;
    margin-top: .5rem;
}

.perm-label {
    display: flex;
    align-items: center;
    gap: .4rem;
    font-size: .875rem;
    font-weight: 400;
    cursor: pointer;
    padding: .35rem .5rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-bg);
    text-transform: capitalize;
}
.perm-label input { flex-shrink: 0; }

/* ── Table ──────────────────────────────────────────────── */

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

.table th, .table td {
    text-align: left;
    padding: .6rem .75rem;
    border-bottom: 1px solid var(--color-border);
}

.table th {
    font-weight: 600;
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--color-text-light);
    background: var(--color-bg);
}

.table tbody tr:hover { background: #f3f4f6; }

/* ── Badges ─────────────────────────────────────────────── */

.badge {
    display: inline-block;
    padding: .15rem .45rem;
    font-size: .75rem;
    font-weight: 600;
    border-radius: 9999px;
}
.badge-info    { background: #dbeafe; color: #1d4ed8; }
.badge-success { background: #dcfce7; color: #15803d; }
.badge-muted   { background: #f3f4f6; color: var(--color-muted); }

/* ── Login page ─────────────────────────────────────────── */

.login-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - var(--nav-height) - 4rem);
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 2rem 2rem 1.75rem;
    box-shadow: var(--shadow);
}

.login-title {
    margin: 0 0 .25rem;
    font-size: 1.6rem;
    font-weight: 700;
    text-align: center;
    color: var(--color-primary);
}

.login-subtitle {
    text-align: center;
    color: var(--color-text-light);
    font-size: .9rem;
    margin: 0 0 1.5rem;
}

.login-form { margin-top: 1rem; }

/* ── Misc ───────────────────────────────────────────────── */

.placeholder-text {
    color: var(--color-text-light);
    font-style: italic;
    margin: 0;
}

h2 {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0 0 1rem;
}

/* ── Status badges (container inventory) ─────────────────── */

.badge-available    { background: #dcfce7; color: #15803d; }
.badge-on-lease     { background: #dbeafe; color: #1d4ed8; }
.badge-serviceable  { background: #fef9c3; color: #a16207; }
.badge-maintenance  { background: #fee2e2; color: #b91c1c; }
.badge-sold         { background: #f3f4f6; color: var(--color-muted); }

/* ── Currency fields ─────────────────────────────────────── */

.currency-input { text-align: right; }
td.currency     { text-align: right; font-variant-numeric: tabular-nums; }

/* ── Calculated field display ────────────────────────────── */

.calc-field {
    padding: .45rem .75rem;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: .9rem;
    font-variant-numeric: tabular-nums;
    color: var(--color-text-light);
    text-align: right;
}

/* ── Sort link / arrow indicators ────────────────────────── */

.sort-link {
    color: var(--color-text-light);
    text-decoration: none;
    white-space: nowrap;
}
.sort-link:hover { color: var(--color-primary); text-decoration: none; }

.sort-asc::after  { content: " ▲"; font-size: .7em; }
.sort-desc::after { content: " ▼"; font-size: .7em; }

/* ── Yard map ────────────────────────────────────────────── */

.yard-zone {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow);
}

.yard-zone-unassigned { border-style: dashed; }

.yard-zone-title {
    font-size: 1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--color-text-light);
    margin: 0 0 .75rem;
}

.yard-row {
    display: flex;
    align-items: flex-start;
    gap: .75rem;
    margin-bottom: .5rem;
    padding: .5rem;
    background: var(--color-bg);
    border-radius: var(--radius);
}

.yard-row-label {
    font-size: .8rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--color-muted);
    min-width: 60px;
    padding-top: .2rem;
}

.yard-row-cards {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
}

.yard-container-card {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: .3rem .5rem;
    border-radius: var(--radius);
    font-size: .75rem;
    font-weight: 600;
    text-decoration: none;
    border: 1px solid transparent;
    transition: opacity .15s;
    cursor: pointer;
}
.yard-container-card:hover { opacity: .8; text-decoration: none; }

.yard-status-available          { background: #dcfce7; color: #15803d; border-color: #bbf7d0; }
.yard-status-on_lease           { background: #dbeafe; color: #1d4ed8; border-color: #bfdbfe; }
.yard-status-serviceable_damage { background: #fef9c3; color: #a16207; border-color: #fde68a; }
.yard-status-maintenance        { background: #fee2e2; color: #b91c1c; border-color: #fecaca; }
.yard-status-sold               { background: #f3f4f6; color: var(--color-muted); border-color: var(--color-border); }

/* ── Event timeline ──────────────────────────────────────── */

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

.event-item {
    padding: .6rem 0;
    border-bottom: 1px solid var(--color-border);
}
.event-item:last-child { border-bottom: none; }

.event-meta {
    display: flex;
    align-items: center;
    gap: .5rem;
    flex-wrap: wrap;
    margin-bottom: .2rem;
}

.event-date {
    font-size: .8rem;
    color: var(--color-text-light);
}

.event-desc {
    margin: 0;
    font-size: .9rem;
}

/* ── Customer badges ─────────────────────────────────────── */

.badge-tax-exempt { background: #fef9c3; color: #a16207; }
