:root {
  --ink: #111713;
  --muted: #5d6860;
  --line: #d8dfd7;
  --paper: #f6f8f4;
  --white: #ffffff;
  --green: #1f6b45;
  --green-2: #8bbf5a;
  --amber: #b47a28;
  --graphite: #202622;
  --silver: #8b9990;
  --shadow: 0 18px 48px rgba(18, 23, 19, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow-x: hidden;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 268px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 24px;
  padding: 24px;
  color: var(--white);
  background: var(--graphite);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  font-weight: 800;
  text-decoration: none;
}

.brand-mark {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 1px solid currentColor;
  border-radius: 50%;
}

.brand-mark span {
  width: 13px;
  height: 18px;
  border-radius: 13px 13px 13px 3px;
  background: currentColor;
  transform: rotate(28deg);
}

.side-nav {
  display: grid;
  align-content: start;
  gap: 8px;
}

.side-nav button {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0;
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.72);
  background: transparent;
  font-weight: 750;
  text-align: left;
}

.side-nav button.is-active {
  color: var(--white);
  background: rgba(255, 255, 255, 0.1);
}

.side-nav svg,
.primary-action svg,
.ghost-button svg {
  width: 19px;
  height: 19px;
}

svg path,
svg circle {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sidebar-foot {
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
}

.sidebar-foot span {
  display: block;
  color: rgba(255, 255, 255, 0.62);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.sidebar-foot strong {
  display: block;
  margin-top: 5px;
}

.workspace {
  min-width: 0;
  padding: 28px clamp(18px, 3vw, 40px) 40px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: start;
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(32px, 4vw, 54px);
  line-height: 1;
}

h2 {
  margin-bottom: 0;
  font-size: 22px;
  line-height: 1.15;
}

.top-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

select,
input {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--ink);
  background: var(--white);
}

.primary-action,
.ghost-button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 8px;
  padding: 0 14px;
  font-weight: 800;
}

.primary-action {
  border: 1px solid var(--green);
  color: var(--white);
  background: var(--green);
}

.ghost-button {
  border: 1px solid var(--line);
  color: var(--ink);
  background: var(--white);
}

.view {
  display: none;
}

.view.is-active {
  display: block;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.metric-panel,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  box-shadow: 0 1px 0 rgba(18, 23, 19, 0.03);
}

.metric-panel {
  min-height: 132px;
  padding: 20px;
}

.metric-panel span,
.metric-panel small {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.metric-panel strong {
  display: block;
  margin: 14px 0 8px;
  font-size: clamp(28px, 3vw, 42px);
  line-height: 1;
}

.dashboard-grid,
.portal-grid,
.admin-grid,
.reports-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(380px, 0.9fr);
  gap: 14px;
  min-width: 0;
}

.map-view-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 420px);
  gap: 14px;
  min-width: 0;
}

.panel {
  min-width: 0;
  padding: 18px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  margin-bottom: 18px;
}

.mini-map-wrap,
.full-map-wrap {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(31, 107, 69, 0.055) 1px, transparent 1px),
    linear-gradient(0deg, rgba(31, 107, 69, 0.055) 1px, transparent 1px),
    #f6f8f4;
  background-size: 42px 42px;
}

.mini-map-wrap {
  min-height: 360px;
}

.full-map-wrap {
  min-height: 620px;
}

.local-map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: grab;
  user-select: none;
  touch-action: none;
}

.local-map.is-dragging {
  cursor: grabbing;
}

.map-water {
  fill: #d8e5e0;
}

.map-land {
  fill: #d9e4d7;
  stroke: #9fb2a2;
  stroke-width: 1.6;
}

.map-land.mys {
  fill: #d2dfd0;
}

.map-land.sgp {
  fill: #bdd4c2;
  stroke: var(--green);
  stroke-width: 3;
}

.route-line {
  fill: none;
  stroke: rgba(31, 107, 69, 0.34);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 8 10;
}

.region-label {
  fill: rgba(18, 23, 19, 0.62);
  font-size: 22px;
  font-weight: 800;
}

.region-label.small {
  font-size: 16px;
}

.map-marker-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.map-marker-plane {
  position: absolute;
  width: 980px;
  height: 430px;
  transform-origin: 0 0;
}

.map-marker {
  position: absolute;
  z-index: 2;
  width: 18px;
  height: 18px;
  border: 2px solid var(--white);
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 7px rgba(31, 107, 69, 0.16);
  transform: translate(-50%, -50%);
  pointer-events: auto;
}

.map-marker.hub {
  background: var(--amber);
  box-shadow: 0 0 0 7px rgba(180, 122, 40, 0.18);
}

.map-marker.planned {
  background: var(--silver);
  box-shadow: 0 0 0 7px rgba(125, 140, 132, 0.16);
}

.map-marker.is-active {
  z-index: 3;
  width: 22px;
  height: 22px;
  border-color: var(--ink);
}

.map-marker-label {
  position: absolute;
  left: 50%;
  top: -12px;
  display: none;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 8px 20px rgba(18, 23, 19, 0.12);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  transform: translate(-50%, -100%);
}

.map-marker.is-active .map-marker-label {
  display: block;
}

.map-controls {
  display: flex;
  gap: 8px;
}

.map-controls button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--ink);
  background: var(--white);
  font-weight: 800;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 13px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  color: var(--green);
  background: #edf5e9;
  font-size: 12px;
  font-weight: 800;
}

.restaurant-summary {
  color: var(--white);
  background: var(--green);
  border-color: var(--green);
}

.restaurant-summary .eyebrow,
.restaurant-summary .detail-grid dt {
  color: #d5e8be;
}

.status-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  margin: 18px 0;
}

.status-row span {
  padding: 8px 11px;
  border-radius: 999px;
  color: var(--green);
  background: var(--white);
  font-weight: 800;
}

.detail-grid,
.location-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 18px 0 0;
}

.detail-grid div,
.location-stats div {
  padding: 14px;
  border: 1px solid rgba(18, 23, 19, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.restaurant-summary .detail-grid div {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.18);
}

dt {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

dd {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
}

.record-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.record-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.record-form .primary-action {
  grid-column: 1 / -1;
}

.node-list,
.report-list {
  display: grid;
  gap: 10px;
}

.node-item,
.report-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcf8;
}

.node-item strong,
.report-item strong {
  display: block;
}

.node-item span,
.report-item span {
  color: var(--muted);
  font-size: 13px;
}

.location-switcher {
  display: flex;
  max-width: 100%;
  gap: 8px;
  margin: 16px 0;
  padding-bottom: 4px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.location-switcher button {
  flex: 0 0 auto;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: #fbfcf8;
  font-size: 12px;
  font-weight: 800;
}

.location-switcher button.is-active {
  color: var(--white);
  border-color: var(--green);
  background: var(--green);
}

.location-card p:last-child {
  color: var(--muted);
  line-height: 1.6;
}

.bar-chart {
  display: grid;
  gap: 12px;
}

.bar-row {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr) 78px;
  gap: 10px;
  align-items: center;
}

.bar-row span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.bar-track {
  height: 12px;
  border-radius: 999px;
  background: #e7ece5;
  overflow: hidden;
}

.bar-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
}

@media (max-width: 1100px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    grid-template-columns: 1fr;
  }

  .side-nav {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .side-nav button {
    justify-content: center;
    padding: 0 8px;
    font-size: 12px;
  }

  .sidebar-foot {
    display: none;
  }

  .metric-grid,
  .dashboard-grid,
  .portal-grid,
  .admin-grid,
  .reports-grid,
  .map-view-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .workspace {
    padding: 18px 12px 28px;
  }

  .topbar,
  .top-actions,
  .panel-head {
    flex-direction: column;
    align-items: stretch;
  }

  .top-actions select,
  .primary-action,
  .ghost-button {
    width: 100%;
  }

  .side-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metric-grid,
  .detail-grid,
  .location-stats,
  .record-form {
    grid-template-columns: 1fr;
  }

  .mini-map-wrap,
  .full-map-wrap {
    min-height: 430px;
  }

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