:root {
  --bg: #f4f7f8;
  --panel: #ffffff;
  --ink: #172026;
  --muted: #667985;
  --line: #d8e1e5;
  --accent: #137c72;
  --accent-dark: #0d5f58;
  --danger: #b42318;
  --occupied: #ffe6de;
  --free: #e7f7ee;
  --asphalt: #303940;
  --paint: #f8fafb;
  font-family: Inter, Segoe UI, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
}

[dir="rtl"] body {
  font-family: Arial, Segoe UI, sans-serif;
}

button,
input {
  font: inherit;
}

button {
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  padding: 0 16px;
  font-weight: 700;
}

button:hover {
  background: var(--accent-dark);
}

button.secondary {
  background: #eef3f4;
  color: var(--ink);
  border: 1px solid var(--line);
}

button.secondary:hover {
  background: #dfe8eb;
}

button.danger {
  color: var(--danger);
}

input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
  background: #fff;
  color: var(--ink);
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(26px, 4vw, 40px);
  line-height: 1.05;
}

h2 {
  font-size: 20px;
}

.hidden {
  display: none !important;
}

.app-shell {
  min-height: 100vh;
  position: relative;
}

.language-switcher {
  width: fit-content;
  margin: 18px 24px 0 auto;
  display: flex;
  gap: 6px;
  padding: 5px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(28, 44, 52, 0.12);
}

[dir="rtl"] .language-switcher {
  margin: 18px auto 0 24px;
}

.language-button {
  min-height: 32px;
  min-width: 42px;
  padding: 0 10px;
  background: transparent;
  color: var(--muted);
  border-radius: 5px;
  font-size: 13px;
}

.language-button:hover,
.language-button.active {
  background: var(--accent);
  color: #fff;
}

.auth-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-panel {
  width: min(420px, 100%);
  display: grid;
  gap: 18px;
  padding: 30px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 18px 60px rgba(28, 44, 52, 0.12);
}

.eyebrow {
  color: var(--accent);
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
  font-size: 12px;
}

.hint,
.message {
  color: var(--muted);
  font-size: 14px;
}

.message {
  min-height: 18px;
  color: var(--danger);
}

.dashboard {
  min-height: 100vh;
  padding: 16px 24px 24px;
}

.topbar {
  max-width: 1400px;
  margin: 0 auto 20px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

[dir="rtl"] .topbar {
  text-align: right;
}

.session-box {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-weight: 700;
}

.workspace {
  max-width: 1400px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 360px);
  gap: 20px;
  align-items: start;
  direction: ltr;
}

.parking-map,
.control-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.parking-map {
  overflow: visible;
  direction: ltr;
  padding: 0 16px 20px;
  background: #fff;
  border: 0;
}

[dir="rtl"] .control-panel,
[dir="rtl"] .login-panel {
  direction: rtl;
  text-align: right;
}

[dir="rtl"] .parking-map .entrance span,
[dir="rtl"] .parking-map .plate {
  direction: rtl;
}

.entrance {
  min-height: 86px;
  display: flex;
  flex-direction: column;
  place-items: center;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
  position: relative;
  background: #fff;
  color: #111;
  font-size: 28px;
  font-weight: 900;
}

.entrance span {
  border: 0;
  padding: 0 24px 6px;
  font-size: 28px;
}

.gate {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -24px;
  height: 28px;
  pointer-events: none;
}

.gate::before,
.gate::after {
  content: "";
  position: absolute;
  bottom: 24px;
  width: calc(50% - 90px);
  border-top: 5px solid #111;
}

.gate::before {
  left: 0;
}

.gate::after {
  right: 0;
}

.gate span {
  position: absolute;
  bottom: 9px;
  width: 58px;
  height: 5px;
  padding: 0;
  border: 0;
  background: #111;
  transform-origin: center;
}

.gate span:first-child {
  left: calc(50% - 90px);
  transform: rotate(-16deg);
}

.gate span:last-child {
  right: calc(50% - 90px);
  transform: rotate(16deg);
}

.lot-body {
  min-height: 740px;
  display: grid;
  grid-template-columns: minmax(160px, 1fr) 390px;
  grid-template-rows: 1fr 126px;
  grid-template-areas:
    "left right"
    "left bottom";
  align-items: end;
  gap: 0 14px;
  padding: 220px 10px 10px;
  background: #fff;
  border-left: 5px solid #111;
  border-right: 5px solid #111;
  border-bottom: 5px solid #111;
}

.left-side,
.right-side,
.bottom-side {
  min-width: 0;
}

.left-side {
  grid-area: left;
  align-self: stretch;
  position: relative;
}

.lower-block {
  position: absolute;
  left: -10px;
  right: -126px;
  bottom: -10px;
  height: 126px;
  border-top: 5px solid #111;
  border-right: 5px solid #111;
  background: #fff;
  z-index: 0;
}

.right-side {
  grid-area: right;
  padding: 0;
  align-self: end;
  margin-bottom: 18px;
}

.section-title {
  margin-bottom: 12px;
  color: var(--muted);
  font-weight: 900;
}

.spots-grid {
  display: grid;
  grid-template-rows: repeat(8, 54px);
  gap: 12px;
  justify-content: end;
}

.spot-row {
  display: grid;
  grid-template-columns: repeat(3, 108px);
  gap: 16px;
}

.spot {
  display: grid;
  place-items: center;
  width: 108px;
  min-height: 54px;
  border: 5px solid #111;
  border-radius: 0;
  padding: 2px;
  background: var(--free);
  color: var(--ink);
  text-align: left;
}

.bottom-side {
  grid-area: bottom;
  display: grid;
  grid-template-columns: repeat(4, 54px);
  gap: 16px;
  align-self: stretch;
  justify-content: end;
  position: relative;
  z-index: 1;
}

.bottom-spot {
  width: 54px;
  min-height: 108px;
  align-self: stretch;
}

[dir="rtl"] .spot {
  text-align: right;
}

.spot.occupied {
  background: var(--occupied);
  border-color: #111;
}

.spot.selected {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.plate {
  align-self: center;
  justify-self: center;
  font-size: 15px;
  font-weight: 900;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.control-panel {
  display: grid;
  gap: 22px;
  padding: 20px;
}

.control-panel section {
  display: grid;
  gap: 14px;
}

.selected-spot {
  color: var(--muted);
  font-weight: 800;
}

.spot-form,
.user-form {
  display: grid;
  gap: 12px;
}

.button-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.users-list {
  display: grid;
  gap: 8px;
}

.user-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  min-height: 46px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

[dir="rtl"] .user-item {
  grid-template-columns: auto 1fr;
}

[dir="rtl"] .user-item .user-meta {
  order: 2;
}

[dir="rtl"] .user-item button {
  order: 1;
}

.user-meta {
  min-width: 0;
}

.user-name {
  font-weight: 900;
  overflow-wrap: anywhere;
}

.user-role {
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 980px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .lot-body {
    grid-template-columns: minmax(80px, 1fr) 390px;
    padding-top: 170px;
    overflow-x: auto;
  }

  .spot-row {
    grid-template-columns: repeat(3, 108px);
  }
}

@media (max-width: 620px) {
  .dashboard {
    padding: 10px;
  }

  .language-switcher,
  [dir="rtl"] .language-switcher {
    margin: 10px 14px 0 auto;
  }

  .topbar,
  .session-box {
    align-items: stretch;
    flex-direction: column;
  }

  .workspace {
    gap: 12px;
  }

  .lot-body {
    width: 100%;
    min-width: 0;
    min-height: 560px;
    grid-template-columns: minmax(42px, 1fr) 256px;
    grid-template-rows: 1fr 88px;
    padding: 112px 6px 6px;
    border-width: 4px;
  }

  .parking-map {
    overflow: hidden;
    padding: 0 4px 12px;
    border-radius: 6px;
  }

  .entrance {
    min-height: 68px;
  }

  .entrance span {
    font-size: 22px;
    padding-bottom: 4px;
  }

  .gate::before,
  .gate::after {
    width: calc(50% - 64px);
    border-top-width: 4px;
  }

  .gate span {
    width: 42px;
    height: 4px;
  }

  .gate span:first-child {
    left: calc(50% - 64px);
  }

  .gate span:last-child {
    right: calc(50% - 64px);
  }

  .right-side {
    margin-bottom: 8px;
  }

  .spot-row {
    gap: 8px;
    grid-template-columns: repeat(3, 80px);
  }

  .spots-grid {
    grid-template-rows: repeat(8, 40px);
    gap: 8px;
  }

  .spot {
    width: 80px;
    min-height: 40px;
    border-width: 4px;
    padding: 2px;
  }

  .bottom-side {
    grid-template-columns: repeat(4, 40px);
    gap: 8px;
  }

  .lower-block {
    height: 88px;
    right: -84px;
    border-top-width: 4px;
    border-right-width: 4px;
  }

  .bottom-spot {
    width: 40px;
    min-height: 80px;
  }

  .plate {
    font-size: 11px;
  }

  .control-panel {
    padding: 14px;
  }

  .button-row {
    grid-template-columns: 1fr;
  }
}
