    :root {
      --bg: #eef3f7;
      --panel: #ffffff;
      --panel-soft: #f7fafc;
      --border: #dbe4eb;
      --text: #0b1f33;
      --muted: #5a6f82;
      --accent: #00a6b6;
      --accent-2: #0c5c8e;
      --line: #d7e5ee;
      --success: #2ea66f;
      --warn: #d89a31;
      --danger: #d46277;
      --radius: 16px;
    }

    * { box-sizing: border-box; }
    html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
    body {
      margin: 0;
      min-height: 100vh;
      font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
      color: var(--text);
      background:
        radial-gradient(980px 380px at 12% -12%, rgba(0,166,182,.16), transparent 62%),
        radial-gradient(920px 360px at 95% -15%, rgba(12,92,142,.15), transparent 60%),
        var(--bg);
    }

    .app { max-width: 1320px; margin: 28px auto; padding: 0 20px; }
    #appShell { display: flex; flex-direction: column; min-height: calc(100vh - 56px); }

    .header, .panel {
      background: linear-gradient(180deg, #ffffff 0%, var(--panel-soft) 100%);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      box-shadow: 0 12px 34px rgba(14,33,53,.08);
    }

    .header {
      padding: 18px 22px;
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 12px;
      margin-bottom: 16px;
      position: relative;
      overflow: hidden;
    }

    .header::before {
      content: "";
      position: absolute;
      inset: 0 0 auto 0;
      height: 3px;
      background: linear-gradient(90deg, var(--accent), var(--accent-2));
      opacity: .85;
    }

    .title { font-weight: 700; letter-spacing: .2px; font-size: 18px; }
    .brand-title {
      display: inline-flex;
      align-items: center;
      gap: 10px;
      white-space: nowrap;
      min-width: 0;
    }
    .brand-title img {
      width: 30px;
      height: 30px;
      object-fit: contain;
      flex: 0 0 auto;
    }
    .brand-full-logo {
      display: none;
      width: min(180px, 48vw);
      max-width: 100%;
      height: auto;
    }
    .mobile-top-brand {
      display: none;
      justify-content: center;
      padding: 8px 0 10px;
    }
    .mobile-top-brand img {
      display: block;
      width: min(190px, 52vw);
      max-width: 100%;
      height: auto;
    }
    .brand-title-text-short { display: none; }
    .muted { color: var(--muted); font-size: 13px; }

    .toolbar {
      margin-bottom: 16px;
      padding: 12px 16px;
      display: flex;
      flex-wrap: wrap;
      gap: 10px 14px;
      align-items: center;
      background: #fff;
      border-color: #dbe5eb;
      box-shadow: 0 8px 20px rgba(14,33,53,.05);
    }

    input, select, button {
      background: #fff;
      border: 1px solid #cfdde6;
      color: var(--text);
      border-radius: 12px;
      padding: 10px 13px;
      font-size: 14px;
      transition: border-color .2s ease, box-shadow .2s ease, transform .05s ease;
    }

    input:focus, select:focus, button:focus {
      outline: none;
      border-color: #88bfcc;
      box-shadow: 0 0 0 3px rgba(0,166,182,.12);
    }

    button { cursor: pointer; }
    button:hover { border-color: #9dc7d4; }
    button:active { transform: translateY(1px); }

    .btn-primary {
      background: linear-gradient(90deg, var(--accent), var(--accent-2));
      border: none;
      color: #ffffff;
      font-weight: 700;
      letter-spacing: .2px;
      box-shadow: 0 10px 20px rgba(12,92,142,.24);
    }

    .btn-primary:hover {
      filter: brightness(1.03);
      box-shadow: 0 12px 24px rgba(12,92,142,.28);
    }

    .btn-microsoft {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      padding: 10px 18px;
      border: none;
      border-radius: 12px;
      background: linear-gradient(90deg, var(--accent), var(--accent-2));
      color: #ffffff;
      font-weight: 700;
      letter-spacing: 0;
      line-height: 1;
      white-space: nowrap;
      box-shadow: 0 10px 20px rgba(12,92,142,.24);
    }

    .btn-microsoft .ms-content {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 12px;
      white-space: nowrap;
      line-height: 1;
    }

    .btn-microsoft:hover {
      filter: brightness(1.03);
      box-shadow: 0 12px 24px rgba(12,92,142,.28);
    }

    .btn-microsoft svg {
      display: block;
      flex: 0 0 auto;
      width: 18px;
      height: 18px;
      min-width: 18px;
    }

    .btn-microsoft .ms-label {
      display: inline-block;
      white-space: nowrap;
      line-height: 1;
    }

    .layout { display: grid; grid-template-columns: minmax(0, 70%) minmax(0, 30%); gap: 16px; }
    .layout > .panel { min-width: 0; min-height: 600px; }
    .panel { padding: 16px; }

    .map-wrap {
      margin-top: 12px;
      border: 1px solid var(--line);
      border-radius: 12px;
      overflow: hidden;
      background: #f4fbff;
      -webkit-overflow-scrolling: touch;
    }

    svg { width: 100%; min-width: 0; display: block; }

    .spot-rect { fill: rgba(15,91,142,.08); stroke: #b6cfde; stroke-width: 2; rx: 6; }
    .spot-label { fill: #1a3550; font-size: 14px; font-weight: 600; letter-spacing: .2px; pointer-events: none; }
    .spot-group { cursor: pointer; }
    .spot-group.free .spot-rect { fill: rgba(46,166,111,.11); stroke: rgba(46,166,111,.9); }
    .spot-group.booked .spot-rect { fill: rgba(212,98,119,.12); stroke: rgba(212,98,119,.85); }
    .spot-group.selected .spot-rect { stroke: var(--accent); stroke-width: 3; }

    .chips { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
    .chip {
      font-size: 12px;
      padding: 6px 10px;
      border-radius: 999px;
      border: 1px solid #d2e2ea;
      color: #365369;
      background: #f9fdff;
      font-weight: 600;
    }

    .kv { margin-top: 10px; display: grid; gap: 8px; font-size: 14px; }
    .map-mini {
      margin-top: 10px;
      border: 1px solid var(--line);
      border-radius: 10px;
      overflow: hidden;
      display: none;
      background: #fff;
    }
    .map-mini-view { height: 340px; background-size: 260%; background-repeat: no-repeat; background-position: center; cursor: grab; touch-action: none; }
    .map-mini-view.dragging { cursor: grabbing; }
    .map-mini-caption { font-size: 12px; color: var(--muted); padding: 6px 8px; border-top: 1px solid var(--line); background: #f8fbfd; }

    .actions { margin-top: 12px; display: flex; gap: 8px; flex-wrap: wrap; }
    .login-actions {
      flex-wrap: nowrap;
      align-items: center;
    }
    .login-actions #loginConfirm,
    .login-actions #loginMicrosoft {
      height: 42px;
    }
    .login-actions #loginMicrosoft {
      flex: 0 0 auto;
      min-width: 0;
      width: auto;
    }
    table { width: 100%; border-collapse: collapse; margin-top: 14px; font-size: 13px; background: #fff; border-radius: 10px; overflow: hidden; }
    th, td { padding: 10px; border-bottom: 1px solid #e1ebf1; text-align: left; }
    th { color: #27455f; font-weight: 700; background: #f7fafc; }

    .overlay { position: fixed; inset: 0; background: rgba(5,16,29,.42); display: none; align-items: center; justify-content: center; padding: 16px; z-index: 10; }
    #loginModal { z-index: 30; }
    .modal { width: 100%; max-width: 740px; background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 16px; box-shadow: 0 16px 44px rgba(11,31,51,.2); }
    .mobile-nav {
      display: none;
      position: fixed;
      left: 0;
      right: 0;
      bottom: 0;
      padding: 5px 10px calc(5px + env(safe-area-inset-bottom, 0px));
      gap: 6px;
      background:
        radial-gradient(120% 160% at 50% 0%, rgba(255,255,255,.98) 0%, rgba(240,246,251,.96) 58%, rgba(233,240,246,.94) 100%);
      border: 1px solid rgba(197,211,223,.95);
      border-bottom: 0;
      border-radius: 24px 24px 0 0;
      box-shadow:
        0 22px 44px rgba(11,31,51,.20),
        inset 0 1px 0 rgba(255,255,255,.9);
      backdrop-filter: blur(12px);
      z-index: 7;
    }
    .mobile-nav::after {
      content: "";
      position: absolute;
      left: 0;
      right: 0;
      bottom: 0;
      height: 3px;
      border-radius: 0;
      background: linear-gradient(90deg, rgba(87,102,255,.9), rgba(56,85,230,.7));
    }
    .mobile-nav button {
      flex: 1 1 50%;
      min-width: 0;
      border: none;
      padding: 6px 8px;
      border-radius: 12px;
      background: transparent;
      box-shadow: none;
      color: #7c8fa3;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 2px;
      text-transform: uppercase;
      letter-spacing: .6px;
      font-size: 9px;
      font-weight: 800;
      line-height: 1.1;
      position: relative;
    }
    .mobile-nav button:hover {
      border: none;
    }
    .mobile-nav button svg {
      width: 16px;
      min-width: 16px;
      max-width: 16px;
      height: 16px;
      display: block;
      flex: 0 0 16px;
      stroke: currentColor;
      fill: none;
      stroke-width: 2;
      stroke-linecap: round;
      stroke-linejoin: round;
    }
    .mobile-nav button.active {
      background: linear-gradient(180deg, rgba(201,214,227,.72) 0%, rgba(187,201,217,.88) 100%);
      color: #163451;
      box-shadow: inset 0 1px 0 rgba(255,255,255,.58);
    }
    .mobile-nav-badge {
      display: none;
      position: absolute;
      top: 4px;
      right: calc(50% - 22px);
      width: 8px;
      height: 8px;
      border-radius: 999px;
      background: #e33d4f;
      box-shadow: 0 0 0 2px rgba(255,255,255,.9);
    }
    .mobile-nav-badge.visible {
      display: block;
    }
    .space-details-backdrop {
      display: none;
      position: fixed;
      inset: 0;
      background: rgba(5,16,29,.36);
      z-index: 8;
    }
    .mobile-panel-backdrop {
      display: none;
      position: fixed;
      inset: 0;
      background: rgba(5,16,29,.36);
      z-index: 8;
    }
    .login-modal {
      width: min(500px, calc(100vw - 32px));
      max-width: 500px;
      min-width: min(320px, calc(100vw - 32px));
    }
    .login-modal .row,
    .login-modal .actions {
      min-width: 0;
    }
    .login-brand {
      display: flex;
      justify-content: center;
      margin: 0 0 12px;
    }
    .login-brand img {
      display: block;
      width: min(180px, 48vw);
      max-width: 100%;
      height: auto;
    }
    .login-modal h3 { margin-top: 0; }
    .login-modal input,
    .login-modal button {
      min-width: 0;
      max-width: 100%;
    }
    .row { display: grid; gap: 8px; margin-bottom: 10px; }
    .header-actions { display: flex; align-items: center; gap: 8px; }

    .filter-field {
      display: flex;
      flex-direction: column;
      gap: 5px;
      min-width: 0;
      flex: 0 0 auto;
    }
    .filter-field:first-child {
      width: min(320px, 100%);
    }
    .filter-field:nth-child(2) {
      width: min(240px, 100%);
    }
    .filter-label {
      color: #708597;
      font-size: 11px;
      font-weight: 600;
      letter-spacing: .15px;
      line-height: 1.2;
      text-transform: none;
    }
    .filter-control {
      position: relative;
      display: flex;
      align-items: center;
      min-height: 44px;
      background: #fff;
      border: 1px solid #e4eaef;
      border-radius: 10px;
      box-shadow: inset 0 1px 0 rgba(255,255,255,.9);
      overflow: hidden;
    }
    .filter-control select,
    .filter-control input {
      width: 100%;
      min-width: 0;
      border: 0;
      background: transparent;
      border-radius: 0;
      box-shadow: none;
      padding: 11px 42px 11px 16px;
      font-size: 14px;
      font-weight: 500;
      line-height: 1.25;
      letter-spacing: 0;
      color: #182d3f;
      appearance: none;
      -webkit-appearance: none;
      -moz-appearance: none;
    }
    .filter-control select:focus,
    .filter-control input:focus {
      border: 0;
      box-shadow: none;
    }
    .filter-control:focus-within {
      border-color: #88bfcc;
      box-shadow: 0 0 0 3px rgba(0,166,182,.12);
    }
    .filter-control input[type="date"]::-webkit-calendar-picker-indicator {
      opacity: 0;
      position: absolute;
      right: 0;
      width: 54px;
      height: 100%;
      cursor: pointer;
    }
    .filter-icon {
      position: absolute;
      right: 14px;
      top: 50%;
      transform: translateY(-50%);
      pointer-events: none;
      opacity: .72;
    }
    .filter-icon-chevron {
      width: 12px;
      height: 12px;
      border-right: 2px solid #9ba8b4;
      border-bottom: 2px solid #9ba8b4;
      border-radius: 1px;
      transform: translateY(-60%) rotate(45deg);
    }
    .filter-icon-calendar {
      width: 22px;
      height: 20px;
      border: 2px solid #9ba8b4;
      border-radius: 4px;
    }
    .filter-icon-calendar::before,
    .filter-icon-calendar::after {
      content: "";
      position: absolute;
      background: #9ba8b4;
      border-radius: 2px;
    }
    .filter-icon-calendar::before {
      top: -3px;
      left: 4px;
      width: 3px;
      height: 6px;
      box-shadow: 9px 0 0 #9ba8b4;
    }
    .filter-icon-calendar::after {
      left: -2px;
      right: -2px;
      top: 5px;
      height: 2px;
    }
    .filter-toggle {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      min-height: 44px;
      cursor: pointer;
      user-select: none;
      flex: 0 1 auto;
      align-self: flex-end;
    }
    .toggle-switch {
      position: relative;
      display: inline-flex;
      width: 44px;
      height: 26px;
      flex: 0 0 auto;
    }
    .toggle-switch input {
      position: absolute;
      inset: 0;
      width: 100%;
      height: 100%;
      margin: 0;
      opacity: 0;
      cursor: pointer;
    }
    .toggle-slider {
      position: absolute;
      inset: 0;
      border-radius: 999px;
      background: #087b8e;
      box-shadow: inset 0 0 0 1px rgba(0,0,0,.06);
      transition: background .2s ease;
    }
    .toggle-slider::after {
      content: "";
      position: absolute;
      top: 3px;
      left: 21px;
      width: 20px;
      height: 20px;
      border-radius: 999px;
      background: #fff;
      box-shadow: 0 2px 8px rgba(11,31,51,.18);
      transition: transform .2s ease, left .2s ease;
    }
    .toggle-switch input:not(:checked) + .toggle-slider {
      background: #b9c8d2;
    }
    .toggle-switch input:not(:checked) + .toggle-slider::after {
      left: 3px;
    }
    .toggle-switch input:focus-visible + .toggle-slider {
      box-shadow: 0 0 0 3px rgba(0,166,182,.12);
    }
    .toggle-label {
      color: #41576a;
      font-size: 13px;
      font-weight: 600;
      line-height: 1.25;
      letter-spacing: 0;
      white-space: nowrap;
    }

    .pill {
      font-size: 12px;
      color: #2e4d63;
      border: 1px solid #cbe0ea;
      border-radius: 999px;
      padding: 7px 11px;
      background: #f6fbfe;
      white-space: nowrap;
      font-weight: 600;
    }

    .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
    .admin-block { border: 1px solid var(--border); border-radius: 10px; padding: 10px; margin-top: 10px; background: #fff; }
    .users-admin-grid { display:grid; grid-template-columns: 1.1fr .9fr; gap: 12px; margin-top: 8px; }
    .users-left-col, .users-right-col { min-width: 0; }
    .users-right-col { border: 1px solid var(--border); border-radius: 10px; padding: 10px; background: #fbfdff; }
    .list { max-height: 320px; overflow: auto; border: 1px solid var(--border); border-radius: 8px; margin-top: 8px; }
    .list div {
      padding: 8px;
      border-bottom: 1px solid #e2ebf1;
      display: flex;
      align-items: center;
      gap: 8px;
      min-width: 0;
    }
    .list div:last-child { border-bottom: 0; }
    .list .item-label {
      min-width: 0;
      flex: 1;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .list .item-del {
      margin-left: auto;
      flex-shrink: 0;
    }
    .danger { border-color: #d5909d; color: #a03f52; }
    .admin-tab-btn.active { outline: 2px solid #6cbec8; }

    @media (max-width:1040px) {
      .layout { grid-template-columns: 1fr; }
      .grid2 { grid-template-columns: 1fr; }
      .users-admin-grid { grid-template-columns: 1fr; }
      .header { align-items: flex-start; }
      .header-actions { flex-wrap: wrap; }
    }

    @media (min-width:769px) {
      #floorPanel {
        max-height: 680px;
        overflow: hidden;
      }
      #floorPanel .map-wrap {
        max-height: 648px;
        overflow: auto;
      }
    }

    @media (max-width:768px) {
      body {
        background:
          radial-gradient(980px 380px at 12% -12%, rgba(0,166,182,.12), transparent 62%),
          linear-gradient(180deg, #eef4f8 0%, #edf3f7 100%);
        min-height: 100vh;
      }

      .app { margin: 14px auto; padding: 0 10px 86px; }
      #appShell { min-height: calc(100vh - 28px - env(safe-area-inset-bottom, 0px)); }
      .mobile-top-brand { display: flex; }
      .header { order: 10; padding: 14px; border-radius: 14px; margin-top: 14px; margin-bottom: 0; }
      .title { font-size: 16px; }
      .brand-title { display: none; }
      .panel { padding: 12px; }
      input, select, button { font-size: 16px; }
      .toolbar { padding: 12px; gap: 10px; align-items: stretch; }
      .toolbar > * { min-width: 0; }
      .toolbar .filter-field,
      .toolbar .filter-toggle { width: 100%; max-width: 100%; }
      .toolbar .filter-field:first-child,
      .toolbar .filter-field:nth-child(2) {
        width: 100%;
      }
      .toolbar .filter-toggle {
        min-height: 0;
        padding: 2px 2px 0;
        align-self: auto;
      }
      .toolbar .toggle-label {
        white-space: normal;
      }
      .filter-select-control {
        overflow: visible;
      }
      .filter-select-control select {
        appearance: auto;
        -webkit-appearance: menulist;
        -moz-appearance: menulist;
        padding-right: 16px;
      }
      .filter-select-control .filter-icon-chevron {
        display: none;
      }
      .header-actions button { flex: 1 1 calc(50% - 6px); }
      .pill { width: 100%; text-align: center; }

      .map-wrap { border-radius: 10px; overflow: hidden; }
      svg { min-width: 0; }
      .spot-label { font-size: 16px; }

      .actions button { width: 100%; }
      .login-actions { flex-wrap: wrap; }
      .login-actions button { width: 100%; }
      .login-actions #loginMicrosoft { min-width: 0; width: 100%; }

      table { font-size: 12px; display: block; overflow-x: auto; white-space: nowrap; }
      th, td { padding: 8px; }

      .modal { padding: 12px; }
      .login-modal { width: calc(100vw - 20px); min-width: 0; }
      .row { margin-bottom: 8px; }

      #spaceDetailsPanel {
        display: none;
        position: fixed;
        left: 10px;
        right: 10px;
        bottom: 10px;
        max-height: min(78vh, 680px);
        min-height: 0;
        overflow: auto;
        border-radius: 20px 20px 16px 16px;
        box-shadow: 0 22px 48px rgba(11,31,51,.28);
        z-index: 9;
        transform: translateY(calc(100% + 20px));
        transition: transform .28s ease;
      }

      #spaceDetailsPanel.mobile-open {
        display: block;
        transform: translateY(0);
      }

      #spaceDetailsPanel.mobile-tall {
        max-height: min(88vh, 860px);
      }

      #spaceDetailsBackdrop.mobile-open {
        display: block;
      }

      #mobileHeaderPanel,
      #bookingsSection {
        display: none;
        position: fixed;
        left: 10px;
        right: 10px;
        bottom: 64px;
        margin-top: 0 !important;
        min-height: 0;
        overflow: auto;
        z-index: 9;
        transform: translateY(calc(100% + 20px));
        transition: transform .28s ease;
      }

      #mobileHeaderPanel {
        max-height: min(42vh, 320px);
      }

      #bookingsSection {
        max-height: min(78vh, 680px);
      }

      #mobileHeaderPanel.mobile-open {
        display: flex;
        transform: translateY(0);
      }

      #bookingsSection.mobile-open {
        display: block;
        transform: translateY(0);
      }

      #mobilePanelBackdrop.mobile-open {
        display: block;
      }

      #mobileToolbarPanel {
        display: flex;
        position: static;
        left: auto;
        right: auto;
        bottom: auto;
        margin-top: 0;
        margin-bottom: 12px;
        max-height: none;
        overflow: visible;
        z-index: auto;
        transform: none;
        transition: none;
      }

      .mobile-nav {
        display: flex;
      }
    }
  </style>
