:root {
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  color: #172438;
  font-synthesis: none;
  --ink: #172438;
  --muted: #8190a3;
  --blue: #4678e8;
  --line: #e8edf3;
  --glass: rgba(255, 255, 255, .94);
  --shadow: 0 12px 38px rgba(25, 42, 68, .14), 0 2px 7px rgba(25, 42, 68, .07);
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; min-width: 320px; min-height: 100%; margin: 0; overflow: hidden; }
button, input { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

.map-screen { position: fixed; inset: 0; overflow: hidden; background: #e3eaf0; }
#map { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1; }
.leaflet-container { font: 13px Inter, "Segoe UI", Arial, sans-serif; background: #e4ebef; }
.leaflet-control-zoom { border: 0 !important; box-shadow: var(--shadow) !important; overflow: hidden; border-radius: 11px !important; }
.leaflet-control-zoom a { width: 38px !important; height: 38px !important; line-height: 38px !important; color: #43536b !important; border: 0 !important; font-size: 19px !important; }
.leaflet-control-zoom-in { border-bottom: 1px solid #edf0f4 !important; }
.leaflet-bottom { margin-bottom: 14px; }
.leaflet-right { margin-right: 13px; }

.map-toolbar {
  position: absolute; z-index: 500; top: 16px; left: 17px; right: 17px;
  display: flex; align-items: center; gap: 14px; pointer-events: none;
}
.map-toolbar > * { pointer-events: auto; }
.map-brand, .map-search, .map-user {
  min-height: 54px; display: flex; align-items: center; border: 1px solid rgba(224, 231, 240, .85);
  background: var(--glass); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--shadow); border-radius: 15px;
}
.map-brand { flex: 0 0 208px; gap: 10px; padding: 7px 13px; text-decoration: none; color: var(--ink); }
.map-brand-icon {
  height: 37px; width: 37px; border-radius: 12px; display: grid; place-items: center;
  background: linear-gradient(145deg, #e9f0ff, #dce7ff); color: #3e71df; font-size: 24px;
}
.map-brand strong, .map-brand small { display: block; }
.map-brand strong { font-size: 14px; letter-spacing: -.3px; }
.map-brand small { color: var(--muted); font-size: 10px; margin-top: 3px; }
.map-search { height: 54px; flex: 1; max-width: 580px; gap: 10px; padding: 0 14px; color: #8795a7; }
.map-search > span { font-size: 25px; line-height: 1; }
.map-search input[type="search"] { min-width: 0; width: 100%; border: 0; outline: 0; background: transparent; color: #28384e; font-size: 12px; }
.map-search input::placeholder { color: #98a4b2; }
.search-clear { width: 27px; height: 27px; flex: 0 0 auto; border: 0; border-radius: 50%; background: #eff3f8; color: #65758b; font-size: 18px; }
.map-user { margin-left: auto; height: 54px; gap: 9px; padding: 7px 10px 7px 7px; }
.map-user > span { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 11px; background: #eaf0fc; color: #3e68c0; font-weight: 700; font-size: 12px; }
.map-user strong { max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.map-user form { margin-left: 4px; border-left: 1px solid var(--line); padding-left: 7px; }
.logout { width: 30px; height: 32px; border: 0; border-radius: 8px; background: transparent; color: #78869a; font-size: 20px; }
.logout:hover { background: #f1f4f8; color: #32435d; }

.map-stats {
  position: absolute; z-index: 500; top: 84px; left: 17px; display: flex; gap: 8px;
  padding: 7px; border: 1px solid rgba(224, 231, 240, .85); border-radius: 13px;
  background: var(--glass); box-shadow: var(--shadow); backdrop-filter: blur(15px);
}
.map-stats > div { min-width: 104px; position: relative; display: grid; grid-template-columns: 10px 1fr; align-items: center; column-gap: 7px; padding: 5px 9px; }
.map-stats > div + div { border-left: 1px solid #edf0f4; }
.map-stats small { color: #8693a3; font-size: 9px; }
.map-stats strong { grid-column: 2; margin-top: 3px; font-size: 14px; letter-spacing: -.3px; }
.stat-dot { grid-row: 1 / span 2; width: 8px; height: 8px; border-radius: 50%; }
.stat-dot.blue { background: #4d7ee6; box-shadow: 0 0 0 4px #4d7ee617; }
.stat-dot.violet { background: #8872dc; box-shadow: 0 0 0 4px #8872dc18; }
.stat-dot.amber { background: #dda447; box-shadow: 0 0 0 4px #dda44719; }

.map-hint {
  position: absolute; z-index: 450; bottom: 22px; left: 18px; display: flex; align-items: center; gap: 8px;
  padding: 10px 13px; border: 1px solid rgba(224, 231, 240, .85); border-radius: 11px;
  background: var(--glass); box-shadow: var(--shadow); backdrop-filter: blur(15px);
  color: #65758a; font-size: 10px;
}
.hint-pulse { width: 8px; height: 8px; border-radius: 50%; background: #4c7fe8; box-shadow: 0 0 0 4px #4c7fe81c; }
.map-attribution {
  position: absolute; z-index: 400; bottom: 3px; right: 5px; padding: 3px 6px;
  border-radius: 4px; background: rgba(255,255,255,.8); color: #647187; font-size: 9px;
}
.map-attribution a { color: #52657e; }
.map-message {
  position: absolute; z-index: 600; top: 155px; left: 50%; transform: translateX(-50%);
  max-width: min(450px, calc(100% - 30px)); padding: 11px 16px; border: 1px solid #e4e9f0;
  border-radius: 10px; background: var(--glass); box-shadow: var(--shadow); color: #526178;
  text-align: center; font-size: 11px; backdrop-filter: blur(12px);
}

.order-marker-shell, .order-cluster-shell { border: 0; background: transparent; }
.order-marker { position: relative; width: 46px; height: 54px; display: flex; align-items: flex-start; justify-content: center; filter: drop-shadow(0 4px 5px rgba(28, 52, 91, .28)); transition: transform .16s ease; }
.order-marker:hover { transform: translateY(-3px) scale(1.08); }
.order-marker::before {
  content: ""; position: absolute; bottom: 3px; width: 35px; height: 35px; border: 3px solid #fff;
  border-radius: 50% 50% 50% 7px; transform: rotate(-45deg);
  background: linear-gradient(145deg, #6390f4 0%, #3c6fdf 70%, #315fc7 100%);
}
.marker-core {
  position: relative; z-index: 1; margin-top: 10px; min-width: 21px; text-align: center;
  color: white; font-size: 10px; line-height: 16px; font-weight: 700;
}
.order-cluster { width: 48px; height: 48px; display: grid; place-items: center; border: 4px solid #ffffffd9; border-radius: 50%; background: linear-gradient(145deg, #6a93ee, #366bd6); box-shadow: 0 3px 12px #1e3f7c48; color: white; }
.order-cluster > span { width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid #ffffff70; border-radius: 50%; font-size: 10px; font-weight: 700; }
.marker-cluster-small, .marker-cluster-medium, .marker-cluster-large { background: #4778e822 !important; }

.building-drawer {
  position: absolute; z-index: 550; top: 84px; right: 17px; bottom: 20px; width: min(370px, calc(100% - 34px));
  display: flex; flex-direction: column; overflow: hidden; border: 1px solid rgba(224, 231, 240, .9);
  border-radius: 17px; background: var(--glass); box-shadow: 0 18px 55px rgba(23, 39, 64, .2);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  animation: drawer-in .2s ease-out;
}
@keyframes drawer-in { from { opacity: 0; transform: translateX(12px); } to { opacity: 1; transform: translateX(0); } }
.drawer-head { display: flex; align-items: flex-start; gap: 11px; padding: 17px 15px 12px; }
.drawer-icon { flex: 0 0 auto; width: 39px; height: 39px; display: grid; place-items: center; border-radius: 12px; background: #eaf0ff; color: #4778e8; font-size: 22px; }
.drawer-title { min-width: 0; flex: 1; }
.drawer-title > small { color: #97a2b1; letter-spacing: 1px; font-size: 8px; font-weight: 700; }
.drawer-title h2 { margin: 5px 0 0; color: #233148; font-size: 16px; letter-spacing: -.4px; }
.drawer-title p { margin: 4px 0 0; color: #8491a1; font-size: 10px; }
.drawer-close { width: 29px; height: 29px; flex: 0 0 auto; border: 1px solid #e7ebf0; border-radius: 9px; background: #fff; color: #65748a; font-size: 19px; line-height: 1; }
.drawer-close:hover { background: #f4f6fa; }
.building-summary { margin: 0 15px 14px; padding: 9px 11px; border-radius: 9px; background: #f2f5fb; color: #5f6e83; font-size: 10px; }
.orders-heading { display: flex; justify-content: space-between; align-items: center; padding: 0 16px 9px; border-bottom: 1px solid #e8edf3; }
.orders-heading strong, .orders-heading small { display: block; }
.orders-heading strong { color: #28364b; font-size: 12px; }
.orders-heading small { margin-top: 3px; color: #96a1af; font-size: 9px; }
.orders-total { padding: 5px 8px; border-radius: 7px; background: #eaf0ff; color: #426fce; font-size: 10px; font-weight: 700; }
.building-orders { min-height: 0; flex: 1; overflow: auto; padding: 4px 12px; }
.building-order { width: 100%; display: flex; align-items: center; gap: 9px; padding: 10px 4px; border: 0; border-bottom: 1px solid #edf0f4; background: transparent; text-align: left; }
.building-order:hover { background: #f5f7fb; border-radius: 9px; }
.order-bullet { width: 30px; height: 30px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 9px; background: #edf2ff; color: #4778e8; font-size: 16px; }
.building-order-body { min-width: 0; flex: 1; }
.building-order strong, .building-order small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.building-order strong { color: #354258; font-size: 10px; }
.building-order small { margin-top: 4px; color: #8a96a6; font-size: 8px; }
.order-arrow { color: #9aa5b2; font-size: 20px; }
.drawer-loading, .drawer-empty { padding: 22px 10px; color: #8a96a6; text-align: center; font-size: 10px; }
.drawer-loading span { width: 14px; height: 14px; display: inline-block; margin-right: 7px; vertical-align: -3px; border: 2px solid #dce4f1; border-top-color: #4778e8; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.drawer-foot { padding: 10px 13px; border-top: 1px solid #e8edf3; color: #9aa5b2; text-align: center; font-size: 8px; }

.modal { position: fixed; inset: 0; z-index: 1200; display: grid; place-items: center; padding: 18px; background: rgba(20, 32, 51, .36); backdrop-filter: blur(3px); }
.modal-card { width: min(550px, 100%); max-height: 85vh; overflow: auto; padding: 20px; border: 1px solid #e7ebf1; border-radius: 15px; background: #fff; box-shadow: 0 25px 80px #18253c30; }
.modal-title { margin: 5px 0 15px; color: #243249; font-size: 16px; }
.modal-content { display: grid; grid-template-columns: 145px 1fr; font-size: 10px; }
.modal-content dt, .modal-content dd { margin: 0; padding: 9px 3px; border-bottom: 1px solid #f0f2f5; }
.modal-content dt { color: #8792a0; }
.modal-content dd { color: #39465a; overflow-wrap: anywhere; }
.modal-close { float: right; width: 29px; height: 29px; border: 1px solid #e7ebf0; border-radius: 9px; background: #fff; color: #65748a; font-size: 19px; }

.login-wrap { min-height: 100vh; display: grid; grid-template-columns: minmax(360px, 520px) 1fr; background: radial-gradient(ellipse at 10% 15%, #eaf0ff 0, transparent 38%), #f5f7fb; overflow: auto; }
.login-card { width: min(390px, calc(100% - 44px)); align-self: center; justify-self: center; padding: 31px; border: 1px solid var(--line); border-radius: 17px; background: #fff; box-shadow: 0 20px 60px #283d5c0c; }
.login-card .logo { display: flex; align-items: center; gap: 10px; padding-bottom: 31px; color: #223047; font-size: 18px; font-weight: 800; text-decoration: none; }
.login-card .logo > span:last-child > span { color: #4778e8; }
.login-card h1 { margin: 8px 0; color: #233047; font-size: 26px; line-height: 1.2; letter-spacing: -1px; }
.kicker { color: #99a4b3; font-size: 9px; font-weight: 700; letter-spacing: 1.25px; }
.subtle { margin-bottom: 23px; color: #7e8a9a; font-size: 11px; line-height: 1.6; }
.login-form label { display: block; margin: 13px 0; color: #586579; font-size: 10px; font-weight: 600; }
.login-form input { display: block; width: 100%; height: 41px; margin-top: 6px; padding: 0 10px; border: 1px solid #e0e6ee; border-radius: 8px; outline-color: #7897e5; }
.button { height: 42px; padding: 0 14px; border: 0; border-radius: 8px; font-size: 11px; font-weight: 600; }
.button.primary { width: 100%; height: 43px; display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 18px; background: #4778e8; color: #fff; }
.button.primary span { font-size: 17px; }
.notice { padding: 9px; border-radius: 7px; background: #f2f5fa; color: #68768a; font-size: 10px; line-height: 1.5; }
.notice.error { background: #fff0ef; color: #aa4843; }
.notice code { font-size: 9px; }
.privacy-note { margin-top: 18px; padding: 11px; border: 1px solid #edf0f4; border-radius: 9px; background: #f7f9fc; color: #758295; font-size: 10px; line-height: 1.5; }
.login-decoration { position: relative; display: grid; place-items: center; overflow: hidden; }
.glow { position: absolute; width: 440px; height: 440px; border-radius: 50%; background: radial-gradient(circle, #cddcff 0, #e9efff80 45%, transparent 70%); }
.demo-map { position: relative; width: min(560px, 70%); height: 340px; border-radius: 25px; background: linear-gradient(31deg, transparent 46%, #fff 46.4%, #fff 47.3%, transparent 47.7%), linear-gradient(147deg, transparent 42%, #fff 42.4%, #fff 43.5%, transparent 43.9%), #e6edf1; box-shadow: 0 18px 55px #32496e19; transform: rotate(-5deg); }
.demo-map i { position: absolute; z-index: 1; width: 19px; height: 19px; border: 3px solid #fff; border-radius: 50% 50% 50% 0; background: #4778e8; box-shadow: 0 2px 8px #18366555; transform: rotate(-45deg); }
.demo-map i:nth-child(1) { top: 70px; left: 34%; }.demo-map i:nth-child(2) { top: 47%; left: 55%; }.demo-map i:nth-child(3) { top: 64%; left: 28%; }.demo-map i:nth-child(4) { top: 29%; left: 73%; }.demo-map i:nth-child(5) { top: 69%; left: 75%; }

@media (max-width: 720px) {
  .map-toolbar { top: 9px; left: 9px; right: 9px; gap: 7px; flex-wrap: wrap; }
  .map-brand { min-height: 48px; height: 48px; flex-basis: 145px; padding: 5px 8px; gap: 7px; border-radius: 12px; }
  .map-brand-icon { width: 32px; height: 32px; border-radius: 10px; font-size: 20px; }
  .map-brand strong { font-size: 12px; }.map-brand small { font-size: 8px; }
  .map-user { min-height: 48px; height: 48px; gap: 6px; padding: 5px; border-radius: 12px; }
  .map-user > span { width: 32px; height: 32px; }.map-user strong { display: none; }
  .map-search { order: 2; flex: 1 0 100%; max-width: none; min-height: 46px; height: 46px; border-radius: 12px; }
  .map-search input[type="search"] { font-size: 11px; }
  .map-stats { top: 119px; left: 9px; gap: 1px; padding: 4px; border-radius: 11px; }
  .map-stats > div { min-width: 82px; column-gap: 6px; padding: 5px 6px; }
  .map-stats small { font-size: 8px; }.map-stats strong { font-size: 12px; }
  .building-drawer { top: auto; left: 9px; right: 9px; bottom: 29px; width: auto; max-height: min(62vh, 520px); border-radius: 16px; }
  .drawer-head { padding: 13px 13px 9px; }.drawer-title h2 { font-size: 14px; }
  .map-hint { bottom: 23px; left: 9px; padding: 8px 10px; font-size: 9px; }
  .map-screen:has(.building-drawer:not(.hidden)) .map-hint { display: none; }
  .map-message { top: 177px; }
  .leaflet-bottom { margin-bottom: 12px; }.leaflet-right { margin-right: 8px; }
  .login-wrap { grid-template-columns: 1fr; }.login-card { margin: 30px auto; }.login-decoration { display: none; }
  .modal-content { grid-template-columns: 120px 1fr; }
}
