@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,100..1000;1,9..40,100..1000&family=Geist:wght@100..900&family=Inter:wght@100..900&family=Manrope:wght@200..800&family=Plus+Jakarta+Sans:wght@200..800&display=swap');

:root {
  --ink: #22241F;
  --paper: #FBFBF8;
  --white: #FFFFFF;
  --muted: #85877F;
  --line: #E9E9E3;
  --soft: #F3F4ED;
  --lime: #D7F36A;
  --stage: #F0F0EB;
  
  --lime-hover: #D0EE5F;
  --lime-tint: #FBFDEC;
  --soft-hover: #F1F5E2;
  --line-strong: #CDD0C1;
  --accent-olive: #8EA63A;
  --accent-lime-border: #B7CD64;
  --topbar-bg: rgba(251, 251, 248, 0.94);

  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --radius-xl: 22px;
  --radius-2xl: 24px;
  --radius-pill: 9999px;

  --shadow-subtle: 0 4px 16px rgba(34, 36, 31, 0.04);
  --shadow-card: 0 8px 24px rgba(35, 35, 26, 0.045);
  --shadow-float: 0 12px 38px rgba(23, 25, 15, 0.09);

  --font-display: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --transition-fast: 160ms cubic-bezier(0.16, 1, 0.3, 1);
  --transition-normal: 220ms cubic-bezier(0.16, 1, 0.3, 1);
}

/* Dark Mode Theme Tokens */
[data-theme="dark"] {
  --ink: #F2F3EC;
  --paper: #121310;
  --white: #1A1C16;
  --muted: #9FA197;
  --line: #292B23;
  --soft: #22241D;
  --lime: #D7F36A;
  --stage: #161713;
  
  --lime-hover: #E3FB7C;
  --lime-tint: #242B14;
  --soft-hover: #292C23;
  --line-strong: #3D4034;
  --accent-olive: #A2BD46;
  --accent-lime-border: #4D591F;
  --topbar-bg: rgba(18, 19, 16, 0.94);

  --shadow-subtle: 0 4px 16px rgba(0, 0, 0, 0.2);
  --shadow-card: 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-float: 0 12px 38px rgba(0, 0, 0, 0.5);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  transition: background-color var(--transition-normal), color var(--transition-normal);
}

/* Magic UI View Transition Ripple */
::view-transition-old(root),
::view-transition-new(root) {
  animation: none;
  mix-blend-mode: normal;
}
::view-transition-old(root) {
  z-index: 1;
}
::view-transition-new(root) {
  z-index: 99999;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

/* App Shell */
.shell {
  max-width: 1440px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Topbar Navigation */
.topbar {
  height: 78px;
  padding: 0 6.2%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: var(--topbar-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 100;
  gap: 32px;
  transition: background-color var(--transition-normal), border-color var(--transition-normal);
}

.brand-nav-group {
  display: flex;
  align-items: center;
  gap: 44px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 22px;
  letter-spacing: -1px;
  color: var(--ink);
  user-select: none;
  cursor: pointer;
}

.brand .mark {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  background: var(--ink);
  display: grid;
  place-items: center;
  color: var(--paper);
  font-size: 16px;
  line-height: 1;
  font-weight: 800;
  box-shadow: 0 2px 6px rgba(34, 36, 31, 0.12);
  transition: background-color var(--transition-normal), color var(--transition-normal);
}

[data-theme="dark"] .brand .mark {
  background: var(--lime);
  color: #121310;
}

.nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-link {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  transition: color var(--transition-fast), background-color var(--transition-fast);
  white-space: nowrap;
}

.nav-link:hover {
  color: var(--ink);
  background: rgba(125, 125, 125, 0.08);
}

.nav-link.active {
  color: var(--ink);
  font-weight: 700;
  background: rgba(125, 125, 125, 0.12);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Magic UI Animated Theme Toggle Button */
.theme-toggle-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--white);
  border: 1px solid var(--line);
  color: var(--ink);
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  user-select: none;
  transition: transform 200ms cubic-bezier(0.34, 1.56, 0.64, 1),
              background 200ms ease,
              border-color 200ms ease,
              box-shadow 200ms ease;
}

.theme-toggle-btn:hover {
  background: var(--soft);
  border-color: var(--line-strong);
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
}

.theme-toggle-btn:active {
  transform: translateY(0) scale(0.92);
}

.theme-toggle-btn .sun-icon,
.theme-toggle-btn .moon-icon {
  position: absolute;
  pointer-events: none;
  transition: transform 500ms cubic-bezier(0.34, 1.56, 0.64, 1),
              opacity 300ms ease;
}

/* Light Mode: Show Sun with smooth spring */
.theme-toggle-btn .sun-icon {
  transform: scale(1) rotate(0deg);
  opacity: 1;
}
.theme-toggle-btn .moon-icon {
  transform: scale(0) rotate(90deg);
  opacity: 0;
}

/* Dark Mode: Show Moon with smooth spring */
[data-theme="dark"] .theme-toggle-btn .sun-icon {
  transform: scale(0) rotate(-90deg);
  opacity: 0;
}
[data-theme="dark"] .theme-toggle-btn .moon-icon {
  transform: scale(1) rotate(0deg);
  opacity: 1;
}

.privacy-badge {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  background: var(--soft);
}

/* Views & Content */
.view {
  display: none;
  padding: 48px 6.2% 80px;
  max-width: 1240px;
  width: 100%;
  margin: 0 auto;
  animation: fadeIn 220ms ease-out forwards;
}

.view.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

.page-title {
  margin: 0 0 32px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 16px;
}

.page-title h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 38px;
  line-height: 1.12;
  letter-spacing: -1.8px;
  margin: 6px 0 8px;
  color: var(--ink);
}

.page-title p {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.5;
  max-width: 600px;
}

.back-btn {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--line);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all var(--transition-fast);
}

.back-btn:hover {
  background: var(--soft);
  border-color: var(--line-strong);
}

/* Hero Section (Home) */
.hero {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 56px;
  align-items: center;
  min-height: 420px;
  margin-bottom: 40px;
}

.hero h1,
.kinetic-text-wrap {
  --hover-padding: calc(1em / 12);
  --text-stroke-width: calc(1em * 125 / 6000);
  font-family: 'Geist', var(--font-display);
  font-size: clamp(38px, 4.8vw, 58px);
  line-height: 1.08;
  letter-spacing: -0.05em;
  font-optical-sizing: auto;
  font-weight: 300;
  margin: 16px 0 16px;
  color: var(--ink);
  cursor: default;
  user-select: none;
}

.kinetic-line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  white-space: nowrap;
}

.kinetic-char {
  display: inline-block;
  font-weight: 300;
  font-optical-sizing: auto;
  will-change: font-weight, -webkit-text-stroke-width, padding;
  -webkit-text-stroke-color: transparent;
  -webkit-text-stroke-width: var(--text-stroke-width);
  transition: font-weight 0.4s cubic-bezier(0.16, 1, 0.3, 1),
              -webkit-text-stroke-color 0.4s cubic-bezier(0.16, 1, 0.3, 1),
              -webkit-text-stroke-width 0.4s cubic-bezier(0.16, 1, 0.3, 1),
              padding 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  padding-inline: 0;
}

/* Magic UI exact neighbor cascade weight and stroke rules */
.kinetic-char:hover {
  font-weight: 900 !important;
  -webkit-text-stroke-color: currentColor !important;
  -webkit-text-stroke-width: calc(var(--text-stroke-width) * 2) !important;
  padding-inline: var(--hover-padding) !important;
}

/* 1st previous neighbor */
.kinetic-char:has(+ .kinetic-char:hover) {
  font-weight: 600 !important;
  padding-inline: var(--hover-padding) !important;
}

/* 2nd previous neighbor */
.kinetic-char:has(+ .kinetic-char + .kinetic-char:hover) {
  font-weight: 400 !important;
}

/* 1st next neighbor */
.kinetic-char:hover + .kinetic-char {
  font-weight: 600 !important;
  padding-inline: var(--hover-padding) !important;
}

/* 2nd next neighbor */
.kinetic-char:hover + .kinetic-char + .kinetic-char {
  font-weight: 400 !important;
}

.hero p {
  font-size: 16px;
  line-height: 1.65;
  color: var(--muted);
  max-width: 440px;
  margin-bottom: 24px;
}

.upload-zone {
  min-height: 200px;
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius-2xl);
  background: var(--soft);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 20px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-normal);
}

.upload-zone:hover {
  border-color: var(--accent-olive);
  background: var(--soft-hover);
}

.upload-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--white);
  display: grid;
  place-items: center;
  font-size: 20px;
  margin-bottom: 10px;
  box-shadow: var(--shadow-subtle);
  color: var(--ink);
}

.upload-zone strong {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
}

.upload-zone small {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

/* Aceternity UI 3D Card Container & Body */
.mock-wrap {
  height: 340px;
  position: relative;
  display: grid;
  place-items: center;
  perspective: 1100px;
  user-select: none;
}

.mock-card-body {
  width: 100%;
  height: 100%;
  position: relative;
  display: grid;
  place-items: center;
  transform-style: preserve-3d;
  will-change: transform;
  transition: transform 0.15s ease-out;
}

.photo-preview {
  width: 82%;
  height: 270px;
  border-radius: var(--radius-xl);
  overflow: hidden;
  position: relative;
  background: linear-gradient(180deg, #D6E5DF 0%, #B5D1C1 38%, #668776 39%, #41624F 62%, #253B36 100%);
  box-shadow: 0 25px 55px rgba(37, 40, 32, 0.16), 0 10px 20px rgba(0, 0, 0, 0.06);
  transform-style: preserve-3d;
  transform: translateZ(40px);
  transition: transform 0.25s ease-out, box-shadow 0.3s ease;
}

[data-theme="dark"] .photo-preview {
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5), 0 10px 25px rgba(0, 0, 0, 0.3);
}

.hero-preview-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

.card-glare {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle 280px at 50% 50%, rgba(255, 255, 255, 0.35), transparent 70%);
  opacity: 0;
  transition: opacity 0.35s ease;
  mix-blend-mode: overlay;
  z-index: 5;
}

.photo-artwork {
  width: 100%;
  height: 100%;
  position: relative;
}

.photo-artwork .sun {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: #F4DF9A;
  position: absolute;
  right: 21%;
  top: 17%;
}

.photo-artwork .mountain {
  position: absolute;
  bottom: 37%;
  left: -5%;
  width: 115%;
  height: 45%;
  background: #849E8B;
  clip-path: polygon(0 100%, 20% 22%, 36% 75%, 59% 0, 78% 75%, 92% 28%, 100% 100%);
}

.photo-artwork .mountain.back {
  bottom: 25%;
  background: #587665;
  opacity: 0.85;
  clip-path: polygon(0 100%, 20% 40%, 40% 73%, 65% 0, 83% 67%, 100% 36%, 100% 100%);
}

.photo-artwork .water {
  position: absolute;
  bottom: 0;
  width: 100%;
  height: 36%;
  background: linear-gradient(180deg, #6B9A91, #254944);
}

.float-badge {
  position: absolute;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  box-shadow: var(--shadow-float);
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  transform-style: preserve-3d;
  will-change: transform;
  transition: transform 0.25s ease-out, box-shadow 0.25s ease-out;
  z-index: 10;
}

.float-badge.a { 
  left: 0; 
  top: 35px; 
  transform: translateZ(85px);
}

.float-badge.b { 
  right: 0; 
  bottom: 30px; 
  transform: translateZ(105px);
}

.tiny-icon {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  background: var(--soft);
  display: grid;
  place-items: center;
  font-size: 13px;
  color: var(--ink);
}

/* Home Category Feature Cards */
.category-cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 10px;
}

.cat-feature-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  padding: 24px;
  text-align: left;
  cursor: pointer;
  transition: all var(--transition-normal);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 190px;
  position: relative;
}

.cat-feature-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-card);
  border-color: var(--line-strong);
}

.cat-feature-card.highlight {
  border-color: var(--accent-lime-border);
  background: var(--white);
}

[data-theme="dark"] .cat-feature-card.highlight {
  background: #1C1F16;
}

.cat-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 16px;
}

.cat-icon-tile {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: var(--soft);
  display: grid;
  place-items: center;
  font-size: 20px;
  color: var(--ink);
  transition: background-color var(--transition-fast);
}

.cat-feature-card:hover .cat-icon-tile {
  background: var(--lime-tint);
}

.cat-pill-badge {
  font-size: 11px;
  font-weight: 700;
  color: #121310;
  background: var(--lime);
  padding: 3px 9px;
  border-radius: var(--radius-pill);
}

.cat-feature-card h3 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.4px;
  color: var(--ink);
  margin-bottom: 6px;
}

.cat-feature-card p {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.45;
}

.cat-card-footer {
  margin-top: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

/* EDIT CATEGORY: Tool Rows List */
.tool-rows-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tool-row-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 18px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  transition: all var(--transition-normal);
  cursor: pointer;
  text-align: left;
  position: relative;
}

.tool-row-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-card);
  border-color: var(--line-strong);
  background: var(--soft);
}

.tool-row-card:active {
  transform: translateY(0);
}

.tool-row-left {
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
}

.tool-icon-box {
  width: 44px;
  height: 44px;
  border-radius: 13px;
  background: var(--soft);
  display: grid;
  place-items: center;
  font-size: 18px;
  color: var(--ink);
  flex-shrink: 0;
  transition: background-color var(--transition-fast);
}

.tool-row-card:hover .tool-icon-box {
  background: var(--lime-tint);
}

.tool-row-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.tool-row-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tool-row-header strong {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.3px;
}

.tool-number-badge {
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  background: var(--soft);
  padding: 2px 7px;
  border-radius: 6px;
}

.tool-row-info p {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}

.tool-row-right {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

.tool-tag {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  background: var(--soft);
  padding: 4px 10px;
  border-radius: 6px;
  display: inline-block;
}

.tool-arrow {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--soft);
  display: grid;
  place-items: center;
  font-size: 13px;
  color: var(--muted);
  transition: all var(--transition-fast);
}

.tool-row-card:hover .tool-arrow {
  background: var(--ink);
  color: var(--paper);
  transform: translateX(3px);
}

/* ============================================================== */
/* WORKSPACE LAYOUT (STAGE + SETTINGS PANEL)                      */
/* ============================================================== */
.workspace-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 24px;
  align-items: start;
}

.stage-container {
  min-height: 540px;
  background: var(--stage);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.stage-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
  background: var(--topbar-bg);
}

.stage-hint {
  font-size: 11px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

.stage-topbar-tools {
  display: flex;
  align-items: center;
  gap: 12px;
}

.stage-tool-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all var(--transition-fast);
}

.stage-tool-btn:hover {
  color: var(--ink);
  background: var(--soft);
}

.stage-viewport {
  flex: 1;
  min-height: 420px;
  display: grid;
  place-items: center;
  padding: 24px;
  position: relative;
  overflow: hidden;
}

.canvas-wrapper {
  position: relative;
  display: inline-block;
  max-width: 100%;
  max-height: 100%;
  box-shadow: 0 16px 45px rgba(0, 0, 0, 0.2);
  border-radius: 6px;
  overflow: hidden;
  background: #111;
}

.canvas-wrapper canvas {
  display: block;
  max-width: 100%;
  max-height: 400px;
  width: auto;
  height: auto;
  object-fit: contain;
}

.stage-footer {
  border-top: 1px solid var(--line);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--muted);
  background: var(--topbar-bg);
  gap: 14px;
}

.file-info {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.file-info strong {
  color: var(--ink);
  font-size: 12px;
  display: block;
}

.action-btn-sm {
  background: var(--white);
  border: 1px solid var(--line);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
  color: var(--ink);
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.action-btn-sm:hover {
  background: var(--soft);
  border-color: var(--line-strong);
}

/* Settings Panels */
.settings-panel {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  padding: 22px;
  display: flex;
  flex-direction: column;
}

.settings-panel h3 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
  color: var(--ink);
  margin-bottom: 4px;
}

.settings-panel .sub {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 18px;
}

.form-group {
  margin-bottom: 16px;
}

.form-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.input-text, .input-select {
  width: 100%;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper);
  padding: 0 12px;
  font-size: 12px;
  color: var(--ink);
  outline: none;
  transition: border-color var(--transition-fast);
}

.input-text:focus, .input-select:focus {
  border-color: var(--ink);
}

.input-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
}

.input-row .input-text {
  font-weight: 600;
  text-align: center;
}

.input-with-unit {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.input-with-unit .input-text,
.input-with-unit input[type="number"],
.input-with-unit input[type="text"] {
  width: 100%;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper);
  padding: 0 28px 0 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  outline: none;
  transition: border-color var(--transition-fast), background var(--transition-fast), box-shadow var(--transition-fast);
  text-align: left;
}

.input-with-unit .input-text:focus,
.input-with-unit input[type="number"]:focus,
.input-with-unit input[type="text"]:focus {
  border-color: var(--ink);
  background: var(--white);
  box-shadow: 0 0 0 2px var(--lime-tint);
}

.input-with-unit .unit {
  position: absolute;
  right: 10px;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  pointer-events: none;
  text-transform: uppercase;
}

.link-btn {
  width: 34px;
  height: 40px;
  border: 1px solid var(--line);
  background: var(--soft);
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  font-size: 14px;
  color: var(--muted);
  transition: all var(--transition-fast);
}

.link-btn.active {
  background: var(--lime-tint);
  border-color: var(--accent-lime-border);
  color: var(--ink);
}

/* Sliders */
.slider-group {
  margin-bottom: 14px;
}

.slider-header {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 6px;
}

.slider-header strong {
  color: var(--ink);
}

.range-slider {
  width: 100%;
  height: 6px;
  background: var(--line);
  border-radius: 4px;
  outline: none;
  -webkit-appearance: none;
  cursor: pointer;
}

.range-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--ink);
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  transition: transform var(--transition-fast);
}

.range-slider::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

.divider {
  height: 1px;
  background: var(--line);
  margin: 16px 0;
}

/* Presets */
.preset-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 6px;
}

.preset-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  text-align: left;
  padding: 10px 12px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.preset-card:hover {
  border-color: var(--accent-lime-border);
  background: var(--lime-tint);
}

.preset-card.active {
  border-color: var(--accent-lime-border);
  background: var(--lime-tint);
  position: relative;
}

.preset-card strong {
  font-size: 11px;
  display: block;
  color: var(--ink);
}

.preset-card small {
  font-size: 10px;
  color: var(--muted);
  display: block;
  margin-top: 2px;
}

/* Buttons */
.btn-primary {
  width: 100%;
  height: 42px;
  border-radius: var(--radius-sm);
  background: var(--ink);
  color: var(--paper);
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all var(--transition-fast);
}

.btn-primary:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.btn-secondary {
  width: 100%;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper);
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all var(--transition-fast);
  margin-top: 8px;
}

.btn-secondary:hover {
  background: var(--soft);
  border-color: var(--line-strong);
}

.btn-group-row {
  display: flex;
  gap: 8px;
}

.btn-group-row button {
  flex: 1;
}

/* Crop Overlay & Mouse Controls */
.crop-canvas-wrapper {
  cursor: crosshair;
  user-select: none;
  touch-action: none;
}

.crop-overlay {
  position: absolute;
  border: 1.5px solid rgba(255, 255, 255, 0.95);
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.6), inset 0 0 0 1px rgba(0, 0, 0, 0.35);
  cursor: move;
  display: block;
  box-sizing: border-box;
  touch-action: none;
  user-select: none;
}

/* Rule of Thirds Grid */
.crop-grid-line {
  position: absolute;
  pointer-events: none;
  background: rgba(255, 255, 255, 0.35);
}
.crop-grid-h1 { top: 33.333%; left: 0; right: 0; height: 1px; }
.crop-grid-h2 { top: 66.666%; left: 0; right: 0; height: 1px; }
.crop-grid-v1 { left: 33.333%; top: 0; bottom: 0; width: 1px; }
.crop-grid-v2 { left: 66.666%; top: 0; bottom: 0; width: 1px; }

/* Live Dimension Badge inside crop box */
.crop-dim-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(15, 15, 15, 0.88);
  backdrop-filter: blur(8px);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  padding: 2px 9px;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-mono, monospace);
  pointer-events: none;
  white-space: nowrap;
  z-index: 5;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
  letter-spacing: 0.3px;
}

/* 8 Interactive Resize Handles */
.crop-handle {
  position: absolute;
  width: 11px;
  height: 11px;
  background: #ffffff;
  border: 1.5px solid #111111;
  border-radius: 2px;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.45);
  z-index: 10;
  transition: transform 0.1s ease, background-color 0.1s ease;
  box-sizing: border-box;
}

.crop-handle:hover,
.crop-handle.active {
  transform: scale(1.3);
  background: var(--accent-lime, #bbf7d0);
  border-color: #000000;
}

.crop-handle.tl { top: -5.5px; left: -5.5px; cursor: nwse-resize; }
.crop-handle.tc { top: -5.5px; left: calc(50% - 5.5px); cursor: ns-resize; }
.crop-handle.tr { top: -5.5px; right: -5.5px; cursor: nesw-resize; }
.crop-handle.ml { top: calc(50% - 5.5px); left: -5.5px; cursor: ew-resize; }
.crop-handle.mr { top: calc(50% - 5.5px); right: -5.5px; cursor: ew-resize; }
.crop-handle.bl { bottom: -5.5px; left: -5.5px; cursor: nesw-resize; }
.crop-handle.bc { bottom: -5.5px; left: calc(50% - 5.5px); cursor: ns-resize; }
.crop-handle.br { bottom: -5.5px; right: -5.5px; cursor: nwse-resize; }

/* Drag Tip Banner */
.drag-tip-banner {
  background: var(--lime-tint);
  border: 1px solid var(--accent-lime-border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 11px;
  color: var(--ink);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 14px;
}

/* Format Validation Alert Banners */
.alert-banner-danger {
  background: #fef2f2;
  border: 1px solid #f87171;
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 12px;
  color: #b91c1c;
  font-weight: 500;
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.08);
}

[data-theme="dark"] .alert-banner-danger {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(248, 113, 113, 0.4);
  color: #fca5a5;
}

.alert-banner-success {
  background: #f0fdf4;
  border: 1px solid #86efac;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 12px;
  color: #15803d;
  font-weight: 500;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

[data-theme="dark"] .alert-banner-success {
  background: rgba(34, 197, 94, 0.12);
  border-color: rgba(134, 239, 172, 0.35);
  color: #86efac;
}


/* Toast */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--ink);
  color: var(--paper);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  box-shadow: var(--shadow-float);
  display: flex;
  align-items: center;
  gap: 8px;
  animation: toastSlideUp 200ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
  pointer-events: auto;
}

@keyframes toastSlideUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Floating Global History Bar (Undo / Redo) */
.floating-history-bar {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--topbar-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-pill);
  padding: 6px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow-float);
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transition: opacity var(--transition-fast), transform var(--transition-fast), visibility var(--transition-fast);
}

.floating-history-bar.visible {
  opacity: 1;
  pointer-events: auto;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.floating-history-bar:hover {
  border-color: var(--ink);
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.16);
}

.history-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--line);
  transition: all var(--transition-fast);
  cursor: pointer;
}

.history-btn:hover:not(:disabled) {
  background: var(--soft);
  border-color: var(--line-strong);
  transform: translateY(-1px);
}

.history-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.history-divider {
  width: 1px;
  height: 20px;
  background: var(--line);
}

.history-badge {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 6px;
  max-width: 160px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Responsive */
@media (max-width: 850px) {
  .topbar {
    padding: 0 5%;
    gap: 16px;
  }
  .brand-nav-group {
    gap: 20px;
  }
  .view {
    padding: 32px 5% 60px;
  }
  .hero {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  .workspace-layout {
    grid-template-columns: 1fr;
  }
  .category-cards-grid {
    grid-template-columns: 1fr;
  }
  .floating-history-bar {
    bottom: 16px;
    padding: 4px 8px;
  }
  .tool-tag {
    display: none;
  }
}

/* ============================================================== */
/* ADVANCED COMPRESS CONTROLS                                     */
/* ============================================================== */
.segmented-control {
  display: flex;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  padding: 3px;
  gap: 2px;
}

.segment-btn {
  flex: 1;
  padding: 7px 8px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
  border-radius: var(--radius-pill);
  transition: all var(--transition-fast);
  text-align: center;
  white-space: nowrap;
}

.segment-btn:hover {
  color: var(--ink);
}

.segment-btn.active {
  background: var(--white);
  color: var(--ink);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

[data-theme="dark"] .segment-btn.active {
  background: #2A2D25;
  color: #F2F3EC;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.input-with-select {
  display: flex;
  align-items: stretch;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper);
  overflow: hidden;
  transition: border-color var(--transition-fast);
  margin-top: 6px;
}

.input-with-select:focus-within {
  border-color: var(--ink);
}

.input-with-select .text-input {
  border: none;
  border-radius: 0;
  flex: 1;
  min-width: 0;
  padding: 0 12px;
  background: transparent;
  outline: none;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}

.input-with-select .unit-select {
  border: none;
  border-left: 1px solid var(--line);
  border-radius: 0;
  background: var(--soft);
  padding: 0 14px;
  font-weight: 700;
  font-size: 12px;
  color: var(--ink);
  cursor: pointer;
  width: auto;
  outline: none;
}

.quick-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip-btn {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  padding: 4px 10px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.chip-btn:hover {
  color: var(--ink);
  border-color: var(--line-strong);
  background: var(--soft-hover);
}

.chip-btn.active {
  background: var(--lime-tint);
  border-color: var(--accent-lime-border);
  color: #121310;
}

.calibrated-status-card {
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.calibrated-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
}

.calibrated-row strong {
  color: var(--ink);
  font-weight: 600;
}

.calibrated-row strong.highlight-text {
  color: #2F6F3E;
  font-weight: 700;
}

[data-theme="dark"] .calibrated-row strong.highlight-text {
  color: var(--lime);
}

.radio-pill-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 6px;
}

.radio-pill {
  position: relative;
  cursor: pointer;
  display: block;
}

.radio-pill input {
  position: absolute;
  opacity: 0;
}

.radio-pill span {
  display: block;
  padding: 8px 10px;
  font-size: 11.5px;
  font-weight: 600;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper);
  color: var(--muted);
  transition: all var(--transition-fast);
}

.radio-pill input:checked + span {
  border-color: var(--accent-lime-border);
  background: var(--lime-tint);
  color: #121310;
}

[data-theme="dark"] .radio-pill input:checked + span {
  background: #25281E;
  color: #F2F3EC;
}

.summary-stat-box {
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.stat-badge-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
}

.savings-pill {
  font-size: 11px;
  font-weight: 700;
  background: var(--lime);
  color: #121310;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
}

.stat-detail-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  color: var(--muted);
}

.stat-detail-line strong {
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
}

/* ============================================================== */
/* KEYBOARD SHORTCUTS & MODAL DIALOG                             */
/* ============================================================== */

/* Shortcuts Toggle Button in Header */
.shortcuts-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--soft);
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.shortcuts-toggle-btn:hover {
  background: var(--soft-hover);
  border-color: var(--line-strong);
  transform: translateY(-1px);
}

.shortcuts-btn-icon {
  font-size: 13px;
}

.shortcuts-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  font-size: 10px;
  font-weight: 700;
  font-family: inherit;
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  color: var(--muted);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

/* Modal Backdrop */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-backdrop.active {
  opacity: 1;
  visibility: visible;
}

/* Modal Dialog Card */
.modal-dialog {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28), 0 0 0 1px rgba(255, 255, 255, 0.05);
  width: 100%;
  max-width: 520px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.95) translateY(8px);
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-backdrop.active .modal-dialog {
  transform: scale(1) translateY(0);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  background: var(--white);
}

.modal-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.modal-icon {
  font-size: 24px;
}

.modal-header h3 {
  font-size: 16px;
  font-weight: 700;
  margin: 0;
  color: var(--ink);
}

.modal-header p {
  font-size: 12px;
  color: var(--muted);
  margin: 2px 0 0 0;
}

.modal-close-btn {
  background: var(--soft);
  border: 1px solid var(--line);
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  transition: all var(--transition-fast);
}

.modal-close-btn:hover {
  background: var(--soft-hover);
  color: var(--ink);
  transform: scale(1.08);
}

.modal-body {
  padding: 20px 22px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.shortcuts-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.shortcuts-category-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--muted);
  margin-bottom: 4px;
}

.shortcut-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
}

.keys-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
}

.keys-wrap .or {
  font-size: 11px;
  color: var(--muted);
  margin: 0 3px;
}

kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--line-strong);
  border-bottom: 2px solid var(--line-strong);
  border-radius: 5px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.shortcuts-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.shortcut-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.shortcut-pill:hover {
  background: var(--lime-tint);
  border-color: var(--accent-lime-border);
  transform: translateY(-1px);
}

.shortcut-pill kbd {
  background: var(--lime);
  color: #121310;
  border-color: var(--accent-lime-border);
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 22px;
  border-top: 1px solid var(--line);
  background: var(--white);
}

@media (max-width: 600px) {
  .shortcuts-btn-text {
    display: none;
  }
  .shortcuts-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Convert Suite & Modern Chips */
.chip-btn {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.chip-btn:hover {
  background: var(--lime-tint);
  border-color: var(--accent-lime-border);
}

.chip-btn.active {
  background: var(--lime);
  color: #121310;
  border-color: var(--accent-lime-border);
}

.metric-card {
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}

.badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 700;
}

/* Transparent Canvas Checkerboard */
.checkerboard-bg {
  background-color: #ffffff;
  background-image: linear-gradient(45deg, #f0f2f5 25%, transparent 25%),
                    linear-gradient(-45deg, #f0f2f5 25%, transparent 25%),
                    linear-gradient(45deg, transparent 75%, #f0f2f5 75%),
                    linear-gradient(-45deg, transparent 75%, #f0f2f5 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0px;
}

.code-textarea {
  width: 100%;
  height: 90px;
  font-family: 'SF Mono', Monaco, Menlo, Consolas, monospace;
  font-size: 11px;
  line-height: 1.4;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper);
  color: var(--ink);
  resize: vertical;
}

.code-textarea:focus {
  outline: none;
  border-color: var(--accent-lime-border);
}
