:root {
  --bg: #0a1628;
  --surface: #132a4a;
  --surface2: #1e3f6b;
  --surface-elevated: #163056;
  --text: #f0f7ff;
  --muted: #93b4e8;
  --accent: #60a5fa;
  --accent-border: #3b82f6;
  --accent2: #34d399;
  --danger: #fb7185;
  --radius: 12px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: linear-gradient(165deg, #071525 0%, #0c2744 35%, #152a5c 100%);
  color: var(--text);
}

.hidden {
  display: none !important;
}

.view {
  min-height: 100dvh;
  padding: 16px;
  padding-bottom: max(16px, env(safe-area-inset-bottom));
}

.login-card {
  max-width: 400px;
  margin: 10vh auto;
}

.parking-select-card #btn-logout-from-select {
  margin-top: 16px;
  width: 100%;
}

.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
}

h1 {
  margin: 0 0 8px;
  font-size: 1.5rem;
}

h2 {
  margin: 0;
  font-size: 1.15rem;
}

h3 {
  font-size: 0.95rem;
  margin: 16px 0 8px;
  color: var(--muted);
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 0.85rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 12px 0;
}

.field span {
  font-size: 0.85rem;
  color: var(--muted);
}

input,
select,
textarea {
  background: var(--surface2);
  border: 1px solid #3b6cad;
  color: var(--text);
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 1rem;
}

input:focus,
select:focus {
  outline: 2px solid var(--accent);
  border-color: transparent;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 10px;
  border: 1px solid #3b6cad;
  background: var(--surface2);
  color: var(--text);
  font-size: 1rem;
  cursor: pointer;
}

.btn:hover {
  filter: brightness(1.08);
}

.btn.primary {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  border: none;
  font-weight: 600;
}

.btn.ghost {
  background: transparent;
  border-color: #4f7ec4;
}

.btn.large {
  width: 100%;
  padding: 16px;
  font-size: 1.1rem;
}

.icon-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
}

.error {
  color: var(--danger);
  font-size: 0.9rem;
  margin-top: 8px;
}

.top-bar {
  margin-bottom: 16px;
}

.top-bar-header-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.parking-sign-wrap {
  flex-shrink: 0;
  color: #2563eb;
  filter: drop-shadow(0 2px 6px rgba(37, 99, 235, 0.45));
}

.parking-sign {
  display: block;
  vertical-align: middle;
}

.parking-title-box {
  flex: 1;
  min-width: 0;
  margin: 0;
  margin-left: auto;
  text-align: right;
  padding: 10px 14px;
  border: 2px solid var(--accent-border);
  border-radius: var(--radius);
  background: var(--surface-elevated);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text);
}

.top-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.menu-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  max-width: 560px;
  margin: 0 auto;
}

.menu-tile {
  text-align: left;
  padding: 12px 10px 12px 14px;
  border-radius: var(--radius);
  border: 1px solid #2d5599;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  min-height: 88px;
  display: flex;
  flex-direction: row;
  align-items: stretch;
  justify-content: space-between;
  gap: 8px;
  position: relative;
  overflow: hidden;
  transition: transform 0.12s ease, border-color 0.12s;
}

.menu-tile:hover:not(:disabled) {
  transform: translateY(-2px);
  border-color: var(--accent);
}

.menu-tile.wide {
  grid-column: 1 / -1;
  min-height: auto;
}

.menu-tile.accent {
  border-color: #3b82f6;
  background: linear-gradient(145deg, #132a4a, #1e3a8a);
}

button.menu-tile.menu-tile--disabled,
button.menu-tile:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  border-color: #2d5599;
}

button.menu-tile.menu-tile--disabled:hover,
button.menu-tile:disabled:hover {
  transform: none;
  border-color: #2d5599;
}

.menu-tile-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  justify-content: center;
  text-align: left;
  z-index: 1;
}

.menu-tile-title {
  font-weight: 700;
  font-size: 1rem;
}

.menu-tile-hint {
  font-size: 0.8rem;
  color: var(--muted);
}

.menu-tile-hint:empty {
  display: none;
}

.menu-tile-art {
  flex-shrink: 0;
  width: 76px;
  height: 76px;
  align-self: center;
  position: relative;
  color: #2d5599;
  pointer-events: none;
  mask-image: linear-gradient(to left, #000 0%, #000 45%, transparent 100%);
  -webkit-mask-image: linear-gradient(to left, #000 0%, #000 45%, transparent 100%);
}

.menu-tile.accent .menu-tile-art {
  color: #3b82f6;
}

.menu-tile:hover:not(:disabled):not(.accent) .menu-tile-art {
  color: var(--accent);
}

.menu-tile.accent:hover:not(:disabled) .menu-tile-art {
  color: #93c5fd;
}

.menu-tile-art::before {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    -35deg,
    transparent,
    transparent 5px,
    currentColor 5px,
    currentColor 5.5px
  );
  opacity: 0.07;
  border-radius: 8px;
  mask-image: linear-gradient(to left, rgba(0, 0, 0, 0.5) 0%, transparent 75%);
  -webkit-mask-image: linear-gradient(to left, rgba(0, 0, 0, 0.5) 0%, transparent 75%);
}

.menu-tile-art svg {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  display: block;
}

.side-panel {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(7, 21, 37, 0.97);
  display: flex;
  flex-direction: column;
  max-width: 520px;
  margin: 0 auto;
  animation: slide 0.2s ease;
}

@keyframes slide {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid #2d5599;
}

.panel-body {
  padding: 16px;
  overflow-y: auto;
  flex: 1;
}

#panel-vehicles .panel-body,
#panel-pay .panel-body {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

#panel-vehicles .panel-body > .field,
#panel-pay .panel-body > .field {
  margin: 0;
}

#panel-pay .panel-body > .pay-end-preview,
#panel-pay .panel-body > .result {
  margin: 0;
}

#panel-free .spot-cell {
  color: #ffffff;
}

.panel-foot {
  flex-shrink: 0;
  padding: 12px 16px 16px;
  border-top: 1px solid #2d5599;
  background: var(--surface);
}

.panel-foot .panel-back-menu {
  width: 100%;
  box-sizing: border-box;
  padding-top: 12px;
  padding-bottom: 12px;
  font-weight: 600;
}

.backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 20;
}

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

.list li {
  padding: 10px 0;
  border-bottom: 1px solid #2d5599;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.sub-box {
  background: var(--surface2);
  padding: 12px;
  border-radius: 8px;
  font-size: 0.95rem;
}

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

.subs-list > .subs-group {
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #2d5599;
}

.subs-list > .subs-group:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.subs-plate-heading {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0 0 10px;
  letter-spacing: 0.02em;
}

.subs-group-items {
  list-style: none;
  padding: 0;
  margin: 0;
}

.subs-group-items .subs-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 10px 0;
  border-bottom: 1px solid #1e3f6b;
}

.subs-group-items .subs-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.subs-list > .subs-empty {
  padding: 8px 0;
}

.subs-list li {
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.subs-list .badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
}

.subs-list .badge.ok {
  background: rgba(34, 197, 94, 0.2);
  color: #4ade80;
}

.subs-list .badge.exp {
  background: rgba(248, 113, 113, 0.2);
  color: #fca5a5;
}

.vehicles-list .del {
  flex-shrink: 0;
}

.veh-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.veh-row-view,
.veh-row-edit {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.veh-row-edit .veh-edit-input {
  flex: 1;
  min-width: 140px;
  max-width: 220px;
}

.veh-row-actions {
  flex-shrink: 0;
}

.free-spots-wrap {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.free-spots-group {
  margin: 0;
}

.free-spots-group-title {
  margin: 0 0 10px;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.02em;
}

.free-spots-grid-inner {
  margin: 0;
}

.spots-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 8px;
}

.spot-cell {
  padding: 12px 8px;
  text-align: center;
  border-radius: 10px;
  border: 1px solid #3b6cad;
  background: var(--surface2);
  cursor: pointer;
  font-weight: 600;
}

.spot-cell.free:hover {
  border-color: var(--accent2);
  background: rgba(34, 197, 94, 0.15);
}

.spot-cell.taken,
.spot-cell.blocked {
  opacity: 0.45;
  cursor: not-allowed;
}

.pay-end-preview {
  margin: 0 0 14px;
  font-size: 0.95rem;
  line-height: 1.4;
}

.pay-block-warning {
  margin: 0 0 14px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid rgba(251, 191, 36, 0.5);
  background: rgba(251, 191, 36, 0.12);
  color: #fde68a;
  font-size: 0.92rem;
  line-height: 1.45;
}

select#pay-spot option.pay-spot-option--yours {
  background: #14532d;
  color: #bbf7d0;
}

select#pay-spot:has(option:checked.pay-spot-option--yours) {
  border-color: #22c55e;
  box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.45);
}

.msg {
  margin-top: 16px;
  font-size: 1.05rem;
  color: var(--accent2);
}

.result {
  margin-top: 12px;
  padding: 12px;
  background: #0a1528;
  border-radius: 8px;
  font-size: 0.8rem;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.55);
}

.modal-inner {
  width: 100%;
  max-width: 420px;
  max-height: 80vh;
  overflow-y: auto;
}

.parking-list {
  list-style: none;
  padding: 0;
  margin: 0 0 16px;
}

.parking-list li {
  margin-bottom: 8px;
}

.parking-list button {
  width: 100%;
  text-align: left;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid #3b6cad;
  background: var(--surface2);
  color: var(--text);
  cursor: pointer;
}

.parking-list button:hover {
  border-color: var(--accent);
}

.parking-list .addr {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 4px;
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  background: var(--surface);
  border: 1px solid #3b6cad;
  padding: 12px 20px;
  border-radius: 999px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.field.row {
  flex-direction: row;
  align-items: center;
  gap: 10px;
}

.panel-subtitle {
  margin: 20px 0 8px;
  font-size: 1rem;
  color: var(--text);
}

.profile-share-section {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid rgba(59, 108, 173, 0.45);
}

.guest-banner {
  background: rgba(96, 165, 250, 0.12);
  border: 1px solid rgba(96, 165, 250, 0.35);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 16px;
  font-size: 0.9rem;
  line-height: 1.4;
}

.share-list {
  list-style: none;
  padding: 0;
  margin: 12px 0 0;
}

.share-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 12px;
  margin-bottom: 8px;
  background: var(--surface2);
  border-radius: 10px;
  border: 1px solid rgba(59, 108, 173, 0.4);
}

.share-list .share-phone {
  font-weight: 600;
}

.share-list .share-meta {
  font-size: 0.8rem;
  color: var(--muted);
  width: 100%;
}

.share-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
  margin-top: 4px;
}

.share-actions .btn {
  flex: 1 1 auto;
  min-width: 0;
}

#panel-vehicles.guest-readonly .veh-add-block {
  display: none;
}

#panel-vehicles.guest-readonly .veh-row-actions {
  display: none;
}

#panel-vehicles.guest-readonly .veh-row .btn.ghost {
  display: none;
}
