:root {
  --navy: #0b1f33; --ink: #0f172a; --slate: #475569; --muted: #64748b;
  --line: #e2e8f0; --bg: #f1f5f9; --card: #fff; --sky: #0ea5e9; --teal: #14b8a6;
  --amber: #d97706; --red: #b91c1c; --green: #0f766e;
  --grad: linear-gradient(135deg, #0ea5e9, #14b8a6);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: "Inter", system-ui, sans-serif; background: var(--bg); color: var(--ink); }
.hidden { display: none !important; }
h1, h2 { font-family: "Sora", sans-serif; color: var(--navy); }
button { font-family: inherit; cursor: pointer; }

/* Login gate */
.gate { min-height: 100vh; display: grid; place-items: center; background: var(--navy); padding: 24px; }
.gate-card { background: #fff; border-radius: 20px; padding: 40px; width: 100%; max-width: 380px; text-align: center; box-shadow: 0 20px 60px -20px rgba(0,0,0,.5); }
.gate-logo { height: 56px; margin-bottom: 12px; }
.gate-card h1 { font-size: 1.7rem; }
.gate-card p { color: var(--slate); margin: 8px 0 22px; }
.gate-card input { width: 100%; padding: 14px; margin-bottom: 12px; border: 1.5px solid var(--line); border-radius: 12px; font-size: 1rem; }
.gate-card input:focus { outline: none; border-color: var(--sky); }
.gate-card button { width: 100%; padding: 14px; border: 0; border-radius: 999px; background: var(--grad); color: #fff; font-weight: 600; font-size: 1rem; }
.gate-error { color: var(--red); min-height: 1.2em; margin-top: 10px; font-size: .9rem; }

/* App shell */
.topbar { display: flex; align-items: center; gap: 24px; background: #fff; border-bottom: 1px solid var(--line); padding: 0 24px; height: 64px; position: sticky; top: 0; z-index: 10; }
.brand { display: flex; align-items: center; gap: 10px; font-family: "Sora", sans-serif; font-weight: 800; color: var(--navy); font-size: 1.1rem; }
.brand img { height: 30px; }
.brand .accent { color: var(--sky); }
.park-sep { width: 1px; height: 24px; background: var(--line); margin: 0 6px; }
.park-mark { height: 32px; width: auto; display: block; }
.tabs { display: flex; gap: 4px; margin-left: 12px; }
.tab { border: 0; background: transparent; padding: 10px 18px; border-radius: 999px; font-weight: 600; color: var(--slate); }
.tab.active { background: var(--navy); color: #fff; }
.who { margin-left: auto; display: flex; align-items: center; gap: 14px; color: var(--slate); font-size: .92rem; }
.link { border: 0; background: none; color: var(--sky); font-weight: 600; }

.tabpanel { padding: 24px; max-width: 1400px; margin: 0 auto; }
.panel-head { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.week-label { font-family: "Sora", sans-serif; font-weight: 700; font-size: 1.15rem; color: var(--navy); }
.navbtn { border: 1.5px solid var(--line); background: #fff; padding: 9px 16px; border-radius: 10px; font-weight: 600; color: var(--navy); }
.navbtn.ghost { color: var(--slate); }
.navbtn:hover { border-color: var(--sky); }

/* Week grid */
.week-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 12px; }
.day { background: var(--card); border: 1px solid var(--line); border-radius: 14px; min-height: 200px; display: flex; flex-direction: column; overflow: hidden; }
.day.today { border-color: var(--sky); box-shadow: 0 0 0 2px rgba(14,165,233,.18); }
.day-head { padding: 12px 14px; border-bottom: 1px solid var(--line); }
.day-name { font-family: "Sora", sans-serif; font-weight: 700; color: var(--navy); }
.day-date { font-size: .8rem; color: var(--muted); }
.day-count { float: right; font-size: .78rem; font-weight: 700; color: #fff; background: var(--teal); border-radius: 999px; padding: 2px 9px; }
.day-body { padding: 10px; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; }
.due { border: 1px solid var(--line); border-radius: 10px; padding: 9px 10px; font-size: .82rem; }
.due.overdue { border-color: #fca5a5; background: #fef2f2; }
.due .code { font-weight: 700; color: var(--navy); }
.due .type { font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.due .task { color: var(--slate); margin: 3px 0 7px; }
.due .badge { font-size: .68rem; font-weight: 700; color: var(--red); }
.due .done { border: 0; background: var(--grad); color: #fff; font-weight: 600; border-radius: 8px; padding: 5px 12px; font-size: .78rem; }
.empty { color: var(--muted); font-size: .82rem; text-align: center; padding: 20px 0; }

/* Inventory */
.inv-actions { margin-left: auto; display: flex; gap: 10px; }
.add-unit { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; background: #fff; padding: 16px; border: 1px solid var(--line); border-radius: 12px; }
.add-unit input, .add-unit select { padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 10px; font-size: .95rem; }
.add-unit button { border: 0; background: var(--grad); color: #fff; font-weight: 600; padding: 10px 20px; border-radius: 10px; }
.form-msg { align-self: center; font-size: .88rem; }
.inv-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.inv-card { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 16px; display: flex; gap: 14px; align-items: center; }
.inv-card img { width: 64px; height: 64px; }
.inv-card .meta { flex: 1; }
.inv-card .code { font-weight: 700; color: var(--navy); }
.inv-card .sub { font-size: .82rem; color: var(--muted); }
.inv-card .status { font-size: .72rem; font-weight: 700; text-transform: uppercase; padding: 2px 8px; border-radius: 999px; background: #ecfdf5; color: var(--green); }
.inv-card .status.rented { background: #fef3c7; color: var(--amber); }
.inv-card .card-actions { display: flex; align-items: center; gap: 14px; margin-top: 8px; }
.inv-card label.sel { display: flex; align-items: center; gap: 6px; font-size: .8rem; color: var(--slate); }
.inv-card .status.maintenance { background: #fef2f2; color: var(--red); }
.issue-btn { border: 1.5px solid var(--line); background: #fff; color: var(--red); font-weight: 600; font-size: .8rem; padding: 5px 12px; border-radius: 8px; }
.issue-btn:hover { border-color: #fca5a5; }

/* Out-of-service issues panel (maintenance tab) */
.issues { border: 1.5px solid #fca5a5; background: #fef2f2; border-radius: 14px; padding: 16px; margin-bottom: 22px; }
.issues-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 12px; }
.issues-title { font-family: "Sora", sans-serif; font-weight: 800; color: var(--red); font-size: 1.05rem; }
.issues-title::before { content: "🔧 "; }
.issues-sub { color: #991b1b; font-size: .9rem; }
.issues-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.issue { background: #fff; border: 1px solid #fecaca; border-radius: 12px; padding: 14px; }
.issue-main { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.issue-main .mono { font-family: ui-monospace, monospace; font-weight: 700; color: var(--navy); }
.issue-reason { font-weight: 700; color: var(--red); }
.issue-note { font-size: .88rem; color: var(--slate); margin: 8px 0; }
.issue-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
.issue-meta { font-size: .78rem; color: var(--muted); }
.resolve { border: 0; background: var(--grad); color: #fff; font-weight: 600; font-size: .8rem; padding: 7px 14px; border-radius: 8px; }

/* Users tab */
.users-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 12px; }
.user-card { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 14px; display: flex; align-items: center; gap: 14px; }
.user-avatar { width: 44px; height: 44px; border-radius: 50%; background: var(--grad); color: #fff; display: grid; place-items: center; font-weight: 800; }
.user-meta { flex: 1; }
.user-name { font-weight: 700; color: var(--navy); display: flex; align-items: center; gap: 8px; }
.user-name .tag { font-size: .7rem; font-weight: 700; text-transform: uppercase; background: #e0f2fe; color: #075985; padding: 2px 8px; border-radius: 999px; }
.user-name .warn { font-size: .68rem; font-weight: 700; text-transform: uppercase; background: #fee2e2; color: var(--red); padding: 2px 7px; border-radius: 999px; }
.user-card .sub { font-size: .82rem; color: var(--muted); margin-top: 1px; }
.deact { border: 1.5px solid #fca5a5; background: #fff; color: var(--red); font-weight: 600; padding: 7px 14px; border-radius: 10px; font-size: .82rem; }
.deact:hover { background: #fef2f2; }

/* Gate (meta + ghost button) */
.gate-card .ghost { background: transparent; color: var(--slate); margin-top: 8px; }
.gate-meta { color: var(--muted); font-size: .85rem; margin-top: -4px; }

/* Modal */
.modal { position: fixed; inset: 0; background: rgba(11,31,51,.45); display: grid; place-items: center; z-index: 100; padding: 24px; }
.modal-card { background: #fff; border-radius: 18px; padding: 26px; width: 100%; max-width: 440px; box-shadow: 0 24px 70px -20px rgba(0,0,0,.5); }
.modal-card h3 { font-family: "Sora", sans-serif; color: var(--navy); margin-bottom: 16px; }
.modal-label { display: block; font-weight: 600; font-size: .88rem; color: var(--ink); margin: 12px 0 6px; }
.modal-label .hint { font-weight: 400; color: var(--muted); }
.modal-card select, .modal-card textarea { width: 100%; padding: 11px 13px; border: 1.5px solid var(--line); border-radius: 10px; font-family: inherit; font-size: .95rem; }
.modal-card select:focus, .modal-card textarea:focus { outline: none; border-color: var(--sky); }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }
.modal-go { border: 0; background: var(--grad); color: #fff; font-weight: 600; padding: 10px 18px; border-radius: 10px; }

/* Rented Out */
.rent-summary { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.pill { font-size: .78rem; font-weight: 700; padding: 4px 12px; border-radius: 999px; text-transform: capitalize; }
.pill.total { background: var(--navy); color: #fff; }
.pill.wheelchair { background: #e0f2fe; color: #075985; }
.pill.scooter { background: #ccfbf1; color: #115e59; }
.pill.stroller { background: #ede9fe; color: #5b21b6; }
.table-wrap { background: #fff; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.rent-table { width: 100%; border-collapse: collapse; }
.rent-table th { text-align: left; font-size: .74rem; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); padding: 14px 16px; border-bottom: 1px solid var(--line); background: #f8fafc; }
.rent-table td { padding: 14px 16px; border-bottom: 1px solid var(--line); font-size: .92rem; vertical-align: middle; }
.rent-table tr:last-child td { border-bottom: 0; }
.rent-table tr:hover td { background: #f8fafc; }
.rent-table .mono { font-family: ui-monospace, monospace; font-weight: 600; color: var(--navy); }
.rent-table .sub { font-size: .76rem; color: var(--muted); margin-top: 2px; }
.rent-table .renter-name { font-weight: 700; color: var(--navy); }
.tag { font-size: .72rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; text-transform: capitalize; }
.tag.wheelchair { background: #e0f2fe; color: #075985; }
.tag.scooter { background: #ccfbf1; color: #115e59; }
.tag.stroller { background: #ede9fe; color: #5b21b6; }
.warn { font-size: .7rem; font-weight: 700; color: var(--amber); background: #fef3c7; padding: 2px 7px; border-radius: 999px; }
.ret { border: 1.5px solid var(--line); background: #fff; color: var(--navy); font-weight: 600; padding: 7px 14px; border-radius: 9px; }
.ret:hover { border-color: var(--sky); color: var(--sky); }

/* Overdue returns */
.overdue { border: 1.5px solid #fca5a5; background: #fef2f2; border-radius: 14px; padding: 16px; margin-bottom: 26px; }
.overdue .table-wrap { border-color: #fecaca; margin-top: 12px; }
.overdue-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.overdue-title { font-family: "Sora", sans-serif; font-weight: 800; color: var(--red); font-size: 1.05rem; }
.overdue-title::before { content: "⚠ "; }
.overdue-sub { color: #991b1b; font-size: .9rem; }
.overdue .rent-table th { background: #fff5f5; }
.rent-subhead { font-family: "Sora", sans-serif; color: var(--navy); font-size: 1rem; margin: 0 0 10px; }

/* Unit detail modal */
.modal-wide { max-width: 760px; width: 100%; max-height: 92vh; overflow-y: auto; position: relative; }
.modal-x { position: absolute; top: 12px; right: 14px; background: none; border: 0; font-size: 28px; line-height: 1; color: var(--muted); cursor: pointer; padding: 4px 10px; }
.modal-x:hover { color: var(--navy); }
.unit-qr-large { text-align: center; padding: 8px 0 20px; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.unit-qr-large img { width: 220px; height: 220px; display: block; margin: 0 auto; }
.unit-code { font-family: ui-monospace, monospace; font-weight: 800; font-size: 1.6rem; color: var(--navy); margin-top: 14px; letter-spacing: .04em; }
.unit-sub { color: var(--muted); margin-top: 6px; font-size: .92rem; }
.unit-sub .tag { font-size: .68rem; font-weight: 700; text-transform: uppercase; padding: 3px 8px; border-radius: 999px; background: #e0f2fe; color: #075985; vertical-align: middle; }
.unit-history-head { font-family: "Sora", sans-serif; color: var(--navy); margin: 14px 0 10px; }
.history-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.history-table th { text-align: left; font-size: .72rem; text-transform: uppercase; color: var(--muted); letter-spacing: .05em; padding: 10px 12px; border-bottom: 1px solid var(--line); background: #f8fafc; }
.history-table td { padding: 12px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.history-table tr:last-child td { border-bottom: 0; }
.hist-name { font-weight: 700; color: var(--navy); }
.history-table .sub { font-size: .76rem; color: var(--muted); margin-top: 2px; }
.hist-status { font-size: .68rem; font-weight: 700; text-transform: uppercase; padding: 3px 9px; border-radius: 999px; display: inline-block; }
.hist-status.active { background: #fef3c7; color: var(--amber); }
.hist-status.returned { background: #ecfdf5; color: var(--green); }
.hist-status.maint { background: #fef2f2; color: var(--red); }
.qr-thumb { background: none; border: 0; padding: 0; cursor: pointer; border-radius: 8px; transition: box-shadow .12s ease; }
.qr-thumb:hover { box-shadow: 0 0 0 2px var(--sky); }
.qr-thumb img { width: 64px; height: 64px; display: block; }

/* Rental detail modal — customer / license / waiver */
.rent-table tr.clickable { cursor: pointer; }
.rent-table tr.clickable:hover td { background: #f1f5f9; }

.cust-head { border-bottom: 1px solid var(--line); padding-bottom: 14px; margin-bottom: 14px; padding-right: 38px; }
.cust-head h2 { font-family: "Sora", sans-serif; color: var(--navy); font-size: 1.55rem; margin-bottom: 4px; }
.cust-unit { color: var(--muted); font-size: .92rem; }
.cust-unit .mono { font-family: ui-monospace, monospace; font-weight: 700; color: var(--navy); }
.cust-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px 24px; margin-bottom: 18px; }
.cust-grid .full { grid-column: 1 / -1; }
.cust-grid .lbl { font-size: .7rem; text-transform: uppercase; font-weight: 700; letter-spacing: .06em; color: var(--muted); }
.cust-grid .val { font-size: .98rem; color: var(--ink); margin-top: 2px; }
.cust-grid .val.mono { font-family: ui-monospace, monospace; }
.verified { font-size: .72rem; font-weight: 700; color: var(--green); background: #ecfdf5; padding: 2px 8px; border-radius: 999px; margin-left: 6px; }

.sec-head { font-family: "Sora", sans-serif; color: var(--navy); font-size: 1.1rem; margin: 18px 0 10px; padding-top: 16px; border-top: 1px solid var(--line); }
.sec-head .ver { font-family: ui-monospace, monospace; font-weight: 600; font-size: .78rem; color: var(--muted); margin-left: 6px; }

.lic-frame { background: #f1f5f9; border: 1px solid var(--line); border-radius: 12px; padding: 10px; text-align: center; }
.lic-frame img { max-width: 100%; max-height: 360px; border-radius: 8px; display: inline-block; }

.waiver-pages { display: flex; flex-direction: column; gap: 14px; }
.wp { background: #f8fafc; border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.wp-head { font-size: .78rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 8px; }
.wp-text { font-size: .9rem; color: var(--ink); white-space: pre-wrap; line-height: 1.55; max-height: 180px; overflow-y: auto; background: #fff; padding: 12px; border-radius: 8px; border: 1px solid var(--line); }
.wp-sig { margin-top: 10px; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 8px; text-align: center; }
.wp-sig img { max-width: 100%; max-height: 110px; display: inline-block; }

/* Print labels */
.print-area { display: none; }
@media print {
  body * { visibility: hidden; }
  .print-area, .print-area * { visibility: visible; }
  .print-area { display: grid !important; position: absolute; top: 0; left: 0; width: 100%;
    grid-template-columns: repeat(3, 1fr); gap: 16px; padding: 16px; }
  .label { border: 1px dashed #999; border-radius: 10px; padding: 14px; text-align: center; page-break-inside: avoid; }
  .label img { width: 150px; height: 150px; }
  .label .code { font-family: monospace; font-weight: 700; font-size: 1.05rem; margin-top: 6px; }
  .label .lbl { font-size: .8rem; color: #333; }
}

@media (max-width: 1000px) { .week-grid { grid-template-columns: repeat(2, 1fr); } }
