/* ── App shell ─────────────────────────────────────────── */
#app { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }

/* ── Desktop (>=768px): sidebar + main ─────────────────── */
@media (min-width: 768px) {
  #mobile-header { display: none; }

  #shell {
    display: flex;
    flex: 1;
    overflow: hidden;
  }

  #sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--color-border);
    overflow: hidden;
  }

  #main {
    flex: 1;
    overflow-y: auto;
  }
}

/* ── Mobile (<768px) ────────────────────────────────────── */
@media (max-width: 767px) {
  #shell { flex: 1; overflow: hidden; position: relative; }

  #mobile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
    height: var(--header-height);
    border-bottom: 1px solid var(--color-border);
    background: var(--color-surface);
    flex-shrink: 0;
  }

  #sidebar {
    position: absolute;
    inset: 0;
    z-index: 10;
    background: var(--color-bg);
    display: flex;
    flex-direction: column;
    transform: translateX(-100%);
    transition: transform .25s ease;
  }
  #sidebar.open { transform: translateX(0); }

  #main { height: 100%; overflow-y: auto; overflow-x: hidden; }

  .box-detail { padding: 1rem; }
  .box-detail-header { flex-wrap: wrap; }
  .box-detail-header > div:last-child { width: 100%; }
}

/* ── Sidebar internals ──────────────────────────────────── */
.sidebar-header {
  padding: 1rem;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  gap: .75rem;
  flex-shrink: 0;
}

.sidebar-logo {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--color-accent);
  letter-spacing: -.3px;
}

.sidebar-search {
  position: relative;
}
.sidebar-search input {
  padding-left: 2rem;
  font-size: .9rem;
}
.sidebar-search .search-icon {
  position: absolute;
  left: .6rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-muted);
  font-size: .85rem;
  pointer-events: none;
}

.sidebar-list {
  flex: 1;
  overflow-y: auto;
  padding: .5rem 0;
}

/* ── Main area ──────────────────────────────────────────── */
.main-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 1rem;
  color: var(--color-text-muted);
  text-align: center;
  padding: 2rem;
}
.main-empty .empty-icon { font-size: 3rem; }

/* ── Home logo button ───────────────────────────────────── */
.btn-home-logo {
  background: none;
  border: none;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--color-accent);
  letter-spacing: -.3px;
  cursor: pointer;
  padding: 0;
}
.btn-home-logo:hover { opacity: .8; }

/* ── Home view ──────────────────────────────────────────── */
.home-view {
  padding: 1.5rem;
  height: 100%;
  overflow-y: auto;
  box-sizing: border-box;
}

.home-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}
.home-title {
  font-size: 1.2rem;
  font-weight: 700;
}

.home-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
}

.home-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  transition: border-color .15s, transform .15s;
}
.home-card:hover {
  border-color: var(--color-accent);
  transform: translateY(-2px);
}

.home-card-img {
  aspect-ratio: 4 / 3;
  background: var(--color-surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.home-card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.home-card-placeholder { font-size: 2.5rem; }

.home-card-body {
  padding: .6rem .75rem .75rem;
}
.home-card-code {
  font-size: .72rem;
  color: var(--color-text-muted);
  margin-bottom: .15rem;
}
.home-card-title {
  font-size: .95rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.home-card-location {
  font-size: .75rem;
  color: var(--color-text-muted);
  margin-top: .2rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.home-empty {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 3rem;
  color: var(--color-text-muted);
}

@media (max-width: 767px) {
  .home-view { padding: 1rem; }
  .home-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .75rem; }
}

/* ── Fullscreen overlay (wizard, detail on mobile) ─────── */
.fullscreen {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--color-bg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.fullscreen-header {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.fullscreen-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
}
