:root {
  --ink: #192019;
  --muted: #647063;
  --paper: #f7f8f3;
  --panel: #fff;
  --line: #d8ded1;
  --green: #4f8a42;
  --yellow: #f2c15b;
  --red: #b45a4f;
  --blue: #517da8;
  --shadow: 0 16px 40px rgba(20, 32, 20, .16);
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; color: var(--ink); font-family: Arial, Helvetica, sans-serif; background: #eef1ea; }
button, input, select { font: inherit; }
a { color: inherit; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 24px; border-bottom: 1px solid var(--line); background: rgba(247,248,243,.95); position: sticky; top: 0; z-index: 10; }
.eyebrow { margin: 0 0 2px; color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .08em; }
h1, h2 { margin: 0; line-height: 1.1; }
h1 { font-size: 28px; }
h2 { font-size: 17px; }
.top-actions, .action-row, .panel-head, .map-toolbar, .legend { display: flex; align-items: center; gap: 10px; }

.workspace { display: grid; grid-template-columns: minmax(0,1fr) 380px; gap: 18px; padding: 18px; }
.map-shell, .side-panel { min-width: 0; }
.map-toolbar { justify-content: space-between; margin-bottom: 10px; }
.legend { flex-wrap: wrap; color: var(--muted); font-size: 13px; }
.legend i { display: inline-block; width: 13px; height: 13px; margin-right: 5px; border-radius: 3px; vertical-align: -2px; }
.legend .open { background: rgba(255,255,255,.82); border: 1px solid var(--green); }
.legend .selected { background: var(--yellow); }
.legend .reserved { background: var(--blue); }
.legend .blocked { background: repeating-linear-gradient(135deg, #d6d9d2 0 4px, #aeb6aa 4px 8px); }

.map-frame { position: relative; overflow: auto; border: 1px solid var(--line); border-radius: 8px; min-height: 680px; background: #dfe6d9; box-shadow: var(--shadow); }
.map-image { display: block; width: 100%; min-width: 1366px; opacity: .78; filter: saturate(.92) contrast(1.05); }
.site-outline { position: absolute; left: 35.1%; top: 10.8%; width: 15.1%; height: 72.6%; border: 2px solid rgba(247,248,243,.9); border-radius: 3px; box-shadow: inset 0 0 0 2px rgba(20,32,20,.28), 0 2px 0 rgba(255,255,255,.7), 0 18px 35px rgba(0,0,0,.2); pointer-events: none; }
.spot-grid { position: absolute; left: 35.55%; top: 12.1%; width: 14.15%; height: 69.8%; display: grid; grid-template-columns: 10fr 10fr 8.42fr 10fr 10fr 20fr; grid-template-rows: repeat(10,minmax(0,1fr)); gap: 2px; transform: none; padding: 3px; }

.spot { position: relative; min-width: 0; border: 1px solid rgba(43,82,36,.88); border-radius: 3px; background: linear-gradient(145deg, rgba(255,255,255,.9), rgba(225,238,220,.83)); color: #183015; cursor: pointer; box-shadow: inset 1px 1px 0 rgba(255,255,255,.8), inset -2px -2px 0 rgba(24,48,21,.12), 0 3px 7px rgba(0,0,0,.18); overflow: hidden; }
.spot:hover, .spot:focus-visible { outline: 3px solid rgba(242,193,91,.85); outline-offset: 1px; }
.spot-id { display: block; font-weight: 700; font-size: clamp(9px,.85vw,12px); }
.spot-vendor { display: block; margin-top: 2px; padding: 0 2px; font-size: clamp(7px,.7vw,10px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.spot.selected { background: linear-gradient(145deg, #ffd979, #e8ad38); border-color: #8a6420; }
.spot.reserved { background: linear-gradient(145deg, #79a7cb, #446f99); border-color: #244461; color: #fff; }
.spot.blocked { color: #384035; cursor: not-allowed; background: repeating-linear-gradient(135deg, rgba(238,240,235,.95) 0 6px, rgba(165,174,158,.95) 6px 12px); border-color: #838d7d; }

.street-label { position: absolute; padding: 4px 8px; color: #fff; background: rgba(20,32,20,.55); border-radius: 4px; font-weight: 700; text-shadow: 0 1px 2px rgba(0,0,0,.6); pointer-events: none; }
.railroad { left: 72%; top: 9%; }
.third { left: 27%; top: 58%; transform: rotate(90deg); }
.broadway { left: 45%; top: 91%; }

.side-panel { display: flex; flex-direction: column; gap: 14px; }
.panel-block { padding: 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); box-shadow: 0 8px 24px rgba(20,32,20,.08); }
.panel-head { justify-content: space-between; margin-bottom: 12px; }
.save-state { color: var(--muted); font-size: 12px; }
.select, input { width: 100%; border: 1px solid var(--line); border-radius: 6px; padding: 10px; background: #fbfcf8; }
.field-label { display: grid; gap: 6px; color: var(--muted); font-size: 13px; margin-bottom: 12px; }
.vendor-details { min-height: 112px; margin: 12px 0; padding: 12px; border-radius: 7px; background: var(--paper); color: var(--muted); }
.vendor-details strong { display: block; color: var(--ink); font-size: 18px; margin-bottom: 4px; }
.vendor-details .chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.vendor-description { max-height: 78px; margin-top: 8px; overflow: auto; color: #3d4a39; font-size: 13px; line-height: 1.35; }
.chip { display: inline-flex; align-items: center; min-height: 24px; padding: 4px 8px; border-radius: 999px; background: #e6ede0; color: #30412b; font-size: 12px; }
.payment-prompt { display: grid; gap: 8px; margin-top: 12px; padding: 12px; border: 1px solid #e4be68; border-radius: 7px; background: #fff8e8; color: #4c3b16; }
.payment-prompt strong { color: #4c3b16; font-size: 14px; }
.payment-prompt p { margin: 0; font-size: 13px; line-height: 1.35; }
.payment-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.payment-actions a { display: inline-flex; align-items: center; min-height: 36px; padding: 8px 10px; border-radius: 6px; background: #006aff; color: #fff; text-decoration: none; font-size: 13px; font-weight: 700; }
.payment-actions a:hover { background: #0056cc; }
.payment-note { color: #6b5322; }
button, .ghost { border: 1px solid transparent; border-radius: 7px; padding: 9px 12px; background: var(--green); color: #fff; cursor: pointer; text-align: center; text-decoration: none; }
.ghost { border-color: var(--line); background: #fff; color: var(--ink); }
.action-row { justify-content: space-between; }
.stats { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; }
.stats div, .scale-note { padding: 10px; border-radius: 7px; background: var(--paper); }
.stats strong { display: block; font-size: 24px; }
.stats span, .scale-note { color: var(--muted); font-size: 13px; }
.scale-note { display: grid; gap: 3px; margin: 12px 0; }
.scale-note strong { color: var(--ink); }
.hidden { display: none; }
.assignment-list { display: grid; gap: 8px; max-height: 260px; overflow: auto; }
.assignment { display: grid; gap: 3px; padding: 10px; border: 1px solid var(--line); border-radius: 7px; background: #fbfcf8; }
.assignment strong { font-size: 14px; }
.assignment span { color: var(--muted); font-size: 12px; }
.message { color: var(--muted); font-size: 13px; }
.message.error { color: #9b2d22; }
.message.ok { color: #2c6a24; }

.login-page { display: grid; place-items: center; padding: 24px; }
.login-card { width: min(440px, 100%); padding: 28px; border: 1px solid var(--line); border-radius: 8px; background: #fff; box-shadow: var(--shadow); }
.login-card h1 { margin-bottom: 8px; }
.login-card p { color: var(--muted); }
.login-card form { display: grid; gap: 12px; margin-top: 18px; }
.login-card label { display: grid; gap: 6px; color: var(--muted); font-size: 13px; }
.small-link { display: inline-block; margin-top: 16px; color: var(--blue); }

@media (max-width: 1050px) {
  .workspace { grid-template-columns: 1fr; }
  .side-panel { display: grid; grid-template-columns: repeat(2,1fr); }
}
@media (max-width: 720px) {
  .topbar, .map-toolbar { align-items: flex-start; flex-direction: column; }
  .workspace { padding: 10px; }
  .side-panel { display: flex; }
  .map-frame { min-height: 520px; }
}
@media print {
  .topbar, .side-panel, .map-toolbar { display: none; }
  .workspace { display: block; padding: 0; }
  .map-frame { box-shadow: none; border: 0; }
}
