:root {
  --bg: #f5f1ea;
  --surface: #fffdf9;
  --surface-soft: #f3ede4;
  --ink: #1f2933;
  --muted: #5b6773;
  --line: #ddd4c7;
  --brand: #8a5a2b;
  --brand-dark: #69411a;
  --accent: #22313f;
  --shadow: 0 14px 40px rgba(31, 41, 51, 0.08);
}

html {
  overflow: hidden;
  height: 100%;
}

body {
  margin: 0;
  padding: 0;
  overflow: hidden;
  height: 100%;
  font-family: 'Inter', sans-serif;
  color: var(--ink);
  background: var(--bg);
}

div {
  margin: 0;
  padding: 0;
}

a {
  transition: all 0.18s ease;
}

.design-shell {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.design-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
  padding: 1rem 1.25rem;
  background: linear-gradient(135deg, #22313f, #334a5c);
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,0.12);
}

.design-topbar__brand {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-width: 0;
}

.design-home-link {
  display: inline-flex;
  align-items: center;
}

.design-logo {
  width: 250px;
  max-width: 42vw;
  display: block;
}

.design-topbar__copy h1 {
  margin: 0 0 0.2rem;
  font-size: clamp(1.6rem, 2.2vw, 2rem);
  line-height: 1.1;
}

.design-topbar__copy p {
  margin: 0;
  color: rgba(255,255,255,0.86);
}

.design-eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.74rem;
  font-weight: 800;
  color: var(--brand);
  margin: 0 0 0.45rem;
}

.design-topbar .design-eyebrow {
  color: #d8e1e9;
}

.design-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.9rem 1.1rem;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 700;
  color: #fff;
  border: 1px solid rgba(255,255,255,0.28);
  background: rgba(255,255,255,0.08);
}

.design-pill:hover {
  color: #fff;
  background: rgba(255,255,255,0.16);
  text-decoration: none;
}

.design-workspace {
  flex: 1;
  min-height: 0;
  width: 100%;
}

.main-row {
  padding: 0;
  height: 100%;
}

.sidebar {
  height: 100%;
  padding: 1rem;
  overflow-x: hidden;
  overflow-y: auto;
  background: transparent;
  border-right: 1px solid var(--line);
}

.main {
  height: 100%;
  padding: 1rem 1rem 1rem 0;
}

.main-stage {
  position: relative;
  height: 100%;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.card-surface {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.sidebar-intro {
  padding: 1.2rem 1.25rem;
  margin-bottom: 1rem;
}

.sidebar-intro h2,
.items-header h2 {
  margin: 0 0 0.6rem;
  font-size: 1.45rem;
  line-height: 1.15;
}

.sidebar-steps {
  margin: 0;
  padding-left: 1.15rem;
  color: var(--muted);
}

.sidebar-steps li + li {
  margin-top: 0.45rem;
}

.nav-sidebar {
  margin: 0 0 1rem;
  overflow: hidden;
}

.nav-sidebar > li + li {
  border-top: 1px solid var(--line);
}

.nav-sidebar > li > a {
  padding: 1rem 1.15rem;
  color: var(--ink);
  font-weight: 700;
}

.nav-sidebar > li > a:hover,
.nav-sidebar > li > a:focus {
  background: var(--surface-soft);
}

.nav-sidebar > .active > a,
.nav-sidebar > .active > a:hover,
.nav-sidebar > .active > a:focus {
  color: #fff;
  background: var(--accent);
}

.tool-card {
  padding: 0;
  margin-bottom: 1rem;
}

.tool-card__inner {
  padding: 1.1rem 1.2rem 1.2rem;
}

#context-menu {
  display: none;
}

#context-menu-name {
  display: block;
  margin-bottom: 1rem;
  color: var(--accent);
  font-weight: 700;
}

.panel-rr {
  margin-bottom: 1rem;
  border-radius: 18px;
  border-color: var(--line);
  box-shadow: none;
  overflow: hidden;
}

.panel-rr > .panel-heading {
  color: var(--accent);
  background: var(--surface-soft);
  border-color: var(--line);
  font-weight: 700;
}

.panel-rr > .panel-body {
  color: var(--ink);
}

.texture-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.texture-cell {
  width: calc(50% - 0.35rem);
}

.texture-select-thumbnail {
  margin: 0;
  border-radius: 14px;
  border-color: var(--line);
  overflow: hidden;
}

.texture-select-thumbnail:hover {
  border-color: var(--brand);
}

.lock-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  color: var(--muted);
}

#loading-modal {
  position: absolute;
  z-index: 10;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  padding: 20px;
  background-color: rgba(34, 49, 63, 0.88);
}

#loading-modal h1 {
  text-align: center;
  margin-top: 24%;
  color: #fff;
  font-size: 2rem;
}

#viewer,
#floorplanner,
#add-items {
  display: none;
  height: 100%;
}

#add-items {
  padding: 7rem 1.5rem 1.5rem;
  overflow-y: auto;
  background: linear-gradient(180deg, rgba(243,237,228,0.55), rgba(255,253,249,0.98));
}

.items-header {
  margin-bottom: 1.2rem;
  max-width: 680px;
}

.items-header p:last-child {
  color: var(--muted);
}

#main-controls,
#camera-controls,
#floorplanner-controls {
  position: absolute;
  z-index: 8;
}

#main-controls {
  top: 18px;
  left: 18px;
}

#camera-controls {
  right: 18px;
  bottom: 18px;
  text-align: right;
}

#floorplanner-controls {
  left: 0;
  top: 0;
  width: 100%;
  padding: 18px 18px 0;
}

.control-strip .btn {
  border-radius: 999px;
  border-color: var(--line);
  color: var(--accent);
  font-weight: 700;
  box-shadow: 0 8px 24px rgba(31,41,51,0.08);
}

.control-strip .btn:hover,
.control-strip .btn:focus {
  background: var(--surface-soft);
  border-color: var(--brand);
  color: var(--accent);
}

.control-strip .btn-primary,
.control-strip .btn-primary:hover,
.control-strip .btn-primary:focus {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.control-gap {
  display: inline-block;
  width: 0.45rem;
}

#draw-walls-hint {
  position: absolute;
  left: 18px;
  bottom: 18px;
  background-color: rgba(34, 49, 63, 0.84);
  color: #ffffff;
  padding: 0.7rem 0.95rem;
  border-radius: 999px;
  z-index: 10;
  display: none;
  font-weight: 600;
}

#floorplanner-canvas {
  display: block;
}

.add-item {
  cursor: pointer;
}

.add-item img {
  border-radius: 14px;
}

.btn-file {
  display: inline-block;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.btn-file input[type=file] {
  position: absolute;
  top: 0;
  right: 0;
  min-width: 100%;
  min-height: 100%;
  filter: alpha(opacity=0);
  opacity: 0;
  cursor: inherit;
  display: block;
}

@media (max-width: 991px) {
  .design-topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .design-logo {
    width: min(250px, 65vw);
    max-width: 100%;
  }
}
