/* ── Variables & Reset ─────────────────────────────────────────────────────── */
:root {
  --ink:          #1a1a18;
  --ink-muted:    #5a5a56;
  --ink-faint:    #9a9a94;
  --paper:        #faf9f6;
  --paper-warm:   #f2efe8;
  --paper-card:   #fff;
  --rule:         #e2dfd6;
  --rule-dark:    #ccc9be;
  --accent:       #2d4a3e;
  --accent-light: #4a7a68;
  --accent-pale:  #e8f0ed;
  --warn:         #7a5c1e;
  --warn-pale:    #fdf4e3;
  --danger:       #8b3a2f;
  --radius:       6px;
  --radius-lg:    12px;
}

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

body {
  font-family: 'DM Sans', -apple-system, sans-serif;
  background:  var(--paper);
  color:       var(--ink);
  min-height:  100vh;
  font-size:   14px;
  line-height: 1.6;
  overflow:    hidden;
}


/* ── Auth System (Split Screen) ─────────────────────────────────────────────── */
.auth-overlay {
  position: fixed;
  inset:    0;
  background: var(--paper);
  z-index:  10000;
  display:  flex;
}

.auth-split {
  display: flex;
  width:   100vw;
  height:  100vh;
}

/* Left Side: Branding */
.auth-branding {
  flex:           1;
  background:     var(--ink);
  color:          white;
  padding:        48px;
  display:        flex;
  flex-direction: column;
  justify-content: space-between;
  overflow-y:     auto;
}

.auth-copy h1 {
  font-family:    'Playfair Display', serif;
  font-size:      38px;
  line-height:    1.1;
  letter-spacing: -0.02em;
  margin-bottom:  16px;
  max-width:      480px;
}

.auth-subheadline {
  font-size:     16px;
  color:         rgba(255,255,255,0.75);
  max-width:     420px;
  line-height:   1.55;
  margin-bottom: 10px;
}

.auth-features {
  list-style:  none !important;
  margin-top:  28px !important;
  padding:     0 !important;
}

.auth-features li {
  display:       flex;
  align-items:   center;
  gap:           12px;
  margin-bottom: 13px;
  color:         rgba(255,255,255,0.6);
  font-size:     14px;
}

.pricing-link {
  display:        inline-block;
  margin-top:     28px;
  background:     transparent;
  border:         1px solid rgba(255,255,255,0.2);
  color:          rgba(255,255,255,0.7);
  font-family:    'DM Mono', monospace;
  font-size:      11px;
  letter-spacing: 0.05em;
  padding:        8px 16px;
  border-radius:  20px;
  cursor:         pointer;
  transition:     all 0.2s;
  text-decoration: none;
}

.pricing-link:hover {
  background:    rgba(255,255,255,0.08);
  border-color:  rgba(255,255,255,0.4);
  color:         white;
}

.pricing-link-sm {
  background:     transparent;
  border:         none;
  color:          var(--ink-faint);
  font-family:    'DM Mono', monospace;
  font-size:      11px;
  letter-spacing: 0.04em;
  cursor:         pointer;
  padding:        0;
  transition:     color 0.2s;
  text-decoration: none;
}

.pricing-link-sm:hover { color: var(--accent); }

.pricing-banner {
  background:    var(--warn-pale);
  border:        1px solid #d4b060;
  border-radius: var(--radius);
  padding:       10px 14px;
  font-size:     13px;
  color:         var(--warn);
  margin-bottom: 20px;
}

.auth-footer-text {
  font-family:    'DM Mono', monospace;
  font-size:      10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color:          var(--ink-muted);
}

/* Right Side: Form */
.auth-form-container {
  flex:            1;
  display:         flex;
  align-items:     center;
  justify-content: center;
  background:      var(--paper);
}

.auth-card {
  width:     100%;
  max-width: 380px;
  text-align: center;
}

.auth-card h2 {
  margin-bottom: 8px;
  color:         var(--ink);
  font-family:   'Playfair Display', serif;
  font-size:     28px;
}

.auth-sub {
  color:         var(--ink-muted);
  margin-bottom: 32px;
  font-size:     14px;
}

.auth-switch { margin-top: 24px; font-size: 13px; }

@media (max-width: 860px) {
  .auth-branding      { display: none; }
  .auth-form-container { padding: 20px; }
}

/* ── Pricing Modal ──────────────────────────────────────────────────────────── */
.pricing-modal-overlay {
  display:         none;
  position:        fixed;
  inset:           0;
  background:      rgba(10,10,8,0.55);
  z-index:         20000;
  align-items:     center;
  justify-content: center;
  backdrop-filter: blur(4px);
  padding:         20px;
}

.pricing-modal-overlay.open { display: flex; }

.pricing-modal {
  background:    var(--paper-card);
  border:        1px solid var(--rule-dark);
  border-radius: var(--radius-lg);
  width:         100%;
  max-width:     560px;
  padding:       36px 40px 28px;
  position:      relative;
  box-shadow:    0 24px 64px rgba(0,0,0,0.18);
  max-height:    90vh;
  overflow-y:    auto;
}

.pricing-close {
  position:        absolute;
  top:             16px;
  right:           16px;
  background:      transparent;
  border:          none;
  color:           var(--ink-faint);
  cursor:          pointer;
  width:           30px;
  height:          30px;
  border-radius:   50%;
  display:         flex;
  align-items:     center;
  justify-content: center;
  transition:      all 0.2s;
}

.pricing-close:hover { background: var(--paper-warm); color: var(--ink); }

.pricing-header { margin-bottom: 28px; }

.pricing-eyebrow {
  font-family:    'DM Mono', monospace;
  font-size:      10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color:          var(--accent-light);
  margin-bottom:  8px;
}

.pricing-title {
  font-family:    'Playfair Display', serif;
  font-size:      26px;
  font-weight:    500;
  letter-spacing: -0.01em;
  color:          var(--ink);
  margin-bottom:  6px;
}

.pricing-sub { font-size: 13px; color: var(--ink-muted); }

.pricing-section-label {
  font-family:    'DM Mono', monospace;
  font-size:      10px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color:          var(--ink-faint);
  margin-bottom:  14px;
}

.credit-tiers {
  display:               grid;
  grid-template-columns: repeat(3, 1fr);
  gap:                   10px;
}

.credit-tier {
  border:        1px solid var(--rule-dark);
  border-radius: var(--radius);
  padding:       16px 14px;
  text-align:    center;
  background:    var(--paper);
  position:      relative;
  transition:    border-color 0.15s;
}

.credit-tier:hover { border-color: var(--accent-light); }

.featured-tier {
  border-color: var(--accent-light);
  background:   var(--accent-pale);
}

.credit-badge {
  font-family:    'DM Mono', monospace;
  font-size:      9px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color:          var(--accent);
  background:     white;
  border:         1px solid var(--accent-light);
  border-radius:  3px;
  padding:        2px 6px;
  display:        inline-block;
  margin-top:     6px;
}

.credit-amount {
  font-family:   'DM Mono', monospace;
  font-size:     12px;
  color:         var(--ink-muted);
  margin-bottom: 6px;
}

.credit-price {
  font-family:   'Playfair Display', serif;
  font-size:     26px;
  font-weight:   500;
  color:         var(--ink);
  line-height:   1;
  margin-bottom: 4px;
}

.credit-per { font-size: 11px; color: var(--ink-faint); }

.sub-plan {
  border:          1px solid var(--rule-dark);
  border-radius:   var(--radius);
  padding:         20px;
  background:      var(--paper);
  display:         flex;
  align-items:     center;
  justify-content: space-between;
  gap:             20px;
}

.sub-plan-name {
  font-family:    'DM Mono', monospace;
  font-size:      10px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color:          var(--ink-muted);
  margin-bottom:  4px;
}

.sub-plan-price {
  font-family:   'Playfair Display', serif;
  font-size:     28px;
  font-weight:   500;
  color:         var(--ink);
  margin-bottom: 12px;
}

.sub-plan-price span {
  font-family: 'DM Sans', sans-serif;
  font-size:   13px;
  font-weight: 400;
  color:       var(--ink-muted);
}

.sub-plan-features { list-style: none; padding: 0; }

.sub-plan-features li {
  display:       flex;
  align-items:   center;
  gap:           8px;
  font-size:     13px;
  color:         var(--ink-muted);
  margin-bottom: 7px;
}

.sub-cta {
  background:    var(--accent);
  color:         white;
  border:        none;
  border-radius: var(--radius);
  padding:       11px 22px;
  font-family:   'DM Sans', sans-serif;
  font-size:     13px;
  font-weight:   500;
  cursor:        pointer;
  white-space:   nowrap;
  transition:    background 0.15s;
  flex-shrink:   0;
}

.sub-cta:hover { background: var(--accent-light); }

.pricing-note {
  margin-top:     20px;
  font-family:    'DM Mono', monospace;
  font-size:      10px;
  color:          var(--ink-faint);
  text-align:     center;
  letter-spacing: 0.03em;
}

/* ── App Layout ─────────────────────────────────────────────────────────────── */
#appContent {
  width:  100vw;
  height: 100vh;
}

.app-layout {
  display: flex;
  height:  100vh;
  width:   100vw;
}

/* ── Sidebar ────────────────────────────────────────────────────────────────── */
.sidebar {
  width:      280px;
  min-width:  280px;
  height:     100vh;
  background: var(--paper-warm);
  border-right: 1px solid var(--rule-dark);
  display:    flex;
  flex-direction: column;
  transition: width 0.3s cubic-bezier(0.4,0,0.2,1), min-width 0.3s cubic-bezier(0.4,0,0.2,1);
  overflow-x: hidden;
  flex-shrink: 0;
  z-index:    10;
}

.sidebar.collapsed { width: 68px; min-width: 68px; }

.sidebar-top-nav {
  padding:     12px 16px;
  display:     flex;
  align-items: center;
  min-height:  56px;
}

.hamburger-btn {
  background:      transparent;
  border:          none;
  color:           var(--ink-muted);
  width:           40px;
  height:          40px;
  border-radius:   50%;
  display:         flex;
  align-items:     center;
  justify-content: center;
  cursor:          pointer;
  transition:      background 0.2s, color 0.2s;
  flex-shrink:     0;
}

.hamburger-btn:hover { background: var(--rule); color: var(--ink); }

.sidebar-header { padding: 0 16px 16px 16px; }

.new-spec-btn {
  display:      flex;
  align-items:  center;
  gap:          12px;
  padding:      10px 16px;
  background:   var(--paper-card);
  color:        var(--ink);
  border:       1px solid var(--rule-dark);
  border-radius: 24px;
  font-family:  'DM Sans', sans-serif;
  font-size:    13px;
  font-weight:  500;
  cursor:       pointer;
  width:        100%;
  transition:   all 0.2s;
  overflow:     hidden;
}

.new-spec-btn:hover { background: var(--paper); border-color: var(--accent-light); }

.sidebar.collapsed .sidebar-top-nav  { padding: 12px 0; justify-content: center; }
.sidebar.collapsed .sidebar-header   { padding: 0; display: flex; justify-content: center; }
.sidebar.collapsed .new-spec-btn     { width: 44px; height: 44px; padding: 0; justify-content: center; border-radius: 50%; }

.sidebar.collapsed .new-spec-btn .nav-text,
.sidebar.collapsed .sidebar-footer .nav-text,
.sidebar.collapsed .info,
.sidebar.collapsed .card-title        { display: none; }

.library-container {
  display:        flex;
  flex-direction: column;
  flex:           1;
  overflow:       hidden;
}

.library-list { flex: 1; overflow-y: auto; padding: 0 12px; min-height: 100px; }

.card-title {
  font-family:    'DM Mono', monospace;
  font-size:      10px;
  text-transform: uppercase;
  color:          var(--ink-muted);
  letter-spacing: 0.09em;
}

.spec-card {
  background:    var(--paper-card);
  border:        1px solid var(--rule);
  padding:       8px;
  margin-bottom: 8px;
  border-radius: var(--radius);
  display:       flex;
  align-items:   center;
  gap:           12px;
  cursor:        pointer;
  transition:    all 0.2s;
  position:      relative;
  padding-right: 32px;
}

.spec-card:hover { border-color: var(--accent-light); background: var(--accent-pale); }

.spec-card img {
  width:        44px;
  height:       44px;
  object-fit:   cover;
  border-radius: 4px;
  background:   var(--paper-warm);
  flex-shrink:  0;
}

.spec-card .info {
  display:        flex;
  flex-direction: column;
  overflow:       hidden;
}

.spec-card .name {
  font-weight:   500;
  font-size:     13px;
  color:         var(--ink);
  white-space:   nowrap;
  overflow:      hidden;
  text-overflow: ellipsis;
}

.spec-card .date { font-size: 11px; color: var(--ink-faint); }

.delete-btn {
  position:        absolute;
  right:           8px;
  top:             50%;
  transform:       translateY(-50%);
  background:      transparent;
  border:          none;
  color:           var(--ink-faint);
  cursor:          pointer;
  padding:         6px;
  border-radius:   4px;
  display:         none;
  align-items:     center;
  justify-content: center;
  transition:      all 0.2s;
}

.spec-card:hover .delete-btn { display: flex; }
.delete-btn:hover { color: var(--danger); background: #fce8e6; }

@media (max-width: 860px) { .delete-btn { display: flex; } }

.sidebar-footer { padding: 16px; border-top: 1px solid var(--rule-dark); }

.btn-text {
  background:  transparent;
  border:      none;
  color:       var(--ink-muted);
  font-family: 'DM Sans', sans-serif;
  font-size:   13px;
  cursor:      pointer;
  display:     flex;
  align-items: center;
  gap:         8px;
  padding:     8px;
  width:       100%;
  transition:  color 0.2s;
}

.btn-text:hover { color: var(--danger); }

.sidebar-search { padding: 0 16px 12px 16px; }

.search-wrapper { position: relative; width: 100%; }

.search-icon {
  position:  absolute;
  left:      10px;
  top:       50%;
  transform: translateY(-50%);
  color:     var(--ink-faint);
}

.search-wrapper input {
  width:         100%;
  padding:       8px 10px 8px 32px;
  border:        1px solid var(--rule-dark);
  border-radius: var(--radius);
  background:    var(--paper-card);
  font-family:   inherit;
  font-size:     12px;
  color:         var(--ink);
  transition:    border-color 0.15s;
}

.search-wrapper input:focus { outline: none; border-color: var(--accent-light); }

.sidebar.collapsed .sidebar-search,
.sidebar.collapsed .card-title { display: none; }

.credit-display {
  display:     flex;
  align-items: center;
  gap:         6px;
  font-family: 'DM Mono', monospace;
  font-size:   11px;
  color:       var(--ink-muted);
  padding:     8px 8px 10px;
}

.credit-icon { color: var(--accent-light); font-size: 10px; }

.credit-display.low             { color: var(--danger); }
.credit-display.low .credit-icon { color: var(--danger); }

.credit-topup {
  margin-left:    auto;
  background:     transparent;
  border:         1px solid var(--rule-dark);
  border-radius:  10px;
  font-family:    'DM Mono', monospace;
  font-size:      10px;
  color:          var(--ink-muted);
  padding:        2px 8px;
  cursor:         pointer;
  transition:     all 0.15s;
}

.credit-topup:hover { border-color: var(--accent-light); color: var(--accent); }

.sidebar.collapsed .credit-display { display: none; }

/* ── Main Workspace ──────────────────────────────────────────────────────────── */
.main-workspace {
  flex:           1;
  height:         100vh;
  overflow-y:     auto;
  background:     var(--paper);
  display:        flex;
  flex-direction: column;
  /* Prevent it from shrinking below content width */
  min-width:      0;
}

.header {
  border-bottom:    1px solid var(--rule-dark);
  padding:          0 40px;
  display:          flex;
  align-items:      center;
  justify-content:  space-between;
  height:           56px;
  background:       var(--paper-card);
  position:         sticky;
  top:              0;
  z-index:          100;
  flex-shrink:      0;
}

.header-brand { display: flex; align-items: center; gap: 16px; }

.logo {
  font-family:    'Playfair Display', serif;
  font-size:      20px;
  font-weight:    500;
  display:        flex;
  align-items:    center;
  gap:            10px;
  color:          var(--ink);
  text-decoration: none;
  letter-spacing: -0.02em;
}

.auth-logo { color: white; }

.logo-mark {
  width:           30px;
  height:          30px;
  background:      var(--accent);
  border-radius:   5px;
  display:         flex;
  align-items:     center;
  justify-content: center;
}

.badge {
  font-family:    'DM Mono', monospace;
  font-size:      10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color:          var(--ink-muted);
  border:         1px solid var(--rule-dark);
  padding:        3px 9px;
  border-radius:  3px;
}

/* ── Workspace Grid ──────────────────────────────────────────────────────────── */
.workspace {
  max-width: 1200px;
  margin:    0 auto;
  padding:   32px 40px;
  display:   grid;
  grid-template-columns: 380px 1fr;
  gap:       28px;
  width:     100%;
}

.left-panel {
  display:        flex;
  flex-direction: column;
  gap:            16px;
  position:       sticky;
  top:            88px;
  /* Ensure the left panel is always visible */
  visibility:     visible;
  opacity:        1;
}

/* ── Cards ───────────────────────────────────────────────────────────────────── */
.card {
  background:    var(--paper-card);
  border:        1px solid var(--rule);
  border-radius: var(--radius-lg);
  overflow:      hidden;
}

.card-header { padding: 12px 18px; border-bottom: 1px solid var(--rule); }
.card-body   { padding: 16px 18px; }

/* ── Dropzone & Preview ─────────────────────────────────────────────────────── */
.dropzone {
  border:        1.5px dashed var(--rule-dark);
  border-radius: var(--radius);
  padding:       28px 16px;
  text-align:    center;
  cursor:        pointer;
  background:    var(--paper);
  transition:    all 0.2s;
  position:      relative;
}

.dropzone:hover, .dropzone.drag-over {
  border-color: var(--accent-light);
  background:   var(--accent-pale);
}

.dropzone input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

.drop-icon {
  width:           40px;
  height:          40px;
  margin:          0 auto 10px;
  background:      var(--paper-warm);
  border:          1px solid var(--rule-dark);
  border-radius:   7px;
  display:         flex;
  align-items:     center;
  justify-content: center;
}

.drop-title { font-size: 13px; font-weight: 500; margin-bottom: 3px; }
.drop-sub   { font-size: 11px; color: var(--ink-faint); }

.preview-outer {
  border-radius: var(--radius);
  overflow:      hidden;
  background:    var(--paper-warm);
  border:        1px solid var(--rule);
  aspect-ratio:  3/4;
  position:      relative;
}

.preview-outer img { width: 100%; height: 100%; object-fit: contain; }

.preview-remove {
  position:        absolute;
  top:             8px;
  right:           8px;
  width:           26px;
  height:          26px;
  background:      rgba(26,26,24,0.7);
  border:          none;
  border-radius:   50%;
  cursor:          pointer;
  color:           #fff;
  display:         flex;
  align-items:     center;
  justify-content: center;
}

/* ── Form Inputs ─────────────────────────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid-1 { display: grid; grid-template-columns: 1fr; gap: 10px; }

.field label {
  display:        block;
  font-family:    'DM Mono', monospace;
  font-size:      10px;
  text-transform: uppercase;
  color:          var(--ink-muted);
  margin-bottom:  5px;
}

.field select,
.field input,
.field textarea {
  width:        100%;
  padding:      8px 10px;
  border:       1px solid var(--rule-dark);
  border-radius: var(--radius);
  background:   var(--paper);
  font-family:  inherit;
  font-size:    13px;
  color:        var(--ink);
  transition:   border-color 0.15s;
}

.field select:focus,
.field input:focus,
.field textarea:focus   { outline: none; border-color: var(--accent-light); }

.field textarea { min-height: 80px; resize: vertical; }
.field .hint    { font-size: 11px; color: var(--ink-faint); margin-top: 4px; }

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

.anchor-unit { font-family: 'DM Mono', monospace; font-size: 11px; color: var(--ink-muted); padding: 8px 4px 8px 0; }

.anchor-callout,
.stretch-callout {
  font-size:     12px;
  color:         var(--accent);
  background:    var(--accent-pale);
  border:        1px solid var(--accent-light);
  border-radius: var(--radius);
  padding:       8px 12px;
  margin-top:    8px;
}

/* ── Buttons ─────────────────────────────────────────────────────────────────── */
.btn {
  display:         flex;
  align-items:     center;
  justify-content: center;
  gap:             7px;
  width:           100%;
  padding:         11px 18px;
  border:          none;
  border-radius:   var(--radius);
  font-family:     inherit;
  font-size:       13px;
  font-weight:     500;
  cursor:          pointer;
  transition:      all 0.15s;
}

.btn-primary  { background: var(--accent); color: white; margin-top: 14px; }
.btn-primary:hover:not(:disabled) { background: var(--accent-light); }

.btn-secondary { background: var(--paper-warm); color: var(--ink-muted); border: 1px solid var(--rule-dark); margin-top: 8px; }
.btn-secondary:hover:not(:disabled) { border-color: var(--accent-light); color: var(--accent); background: var(--accent-pale); }

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

/* ── Right Panel ─────────────────────────────────────────────────────────────── */
.right-panel { display: flex; flex-direction: column; gap: 16px; min-height: 400px; }

.empty-state {
  background:      var(--paper-card);
  border:          1px solid var(--rule);
  border-radius:   var(--radius-lg);
  padding:         64px 32px;
  text-align:      center;
  height:          100%;
  display:         flex;
  flex-direction:  column;
  justify-content: center;
  align-items:     center;
}

.empty-icon {
  width:           56px;
  height:          56px;
  border:          1.5px dashed var(--rule-dark);
  border-radius:   50%;
  margin:          0 auto 16px;
  display:         flex;
  align-items:     center;
  justify-content: center;
}

.empty-title { font-size: 15px; font-weight: 500; color: var(--ink-muted); margin-bottom: 6px; }
.empty-sub   { font-size: 12px; color: var(--ink-faint); }

/* ── Spec Sheet Output ──────────────────────────────────────────────────────── */
.spec-meta-bar {
  background:    var(--paper-card);
  border:        1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding:       16px 22px;
  display:       flex;
  align-items:   flex-start;
  justify-content: space-between;
  gap:           16px;
  margin-bottom: 16px;
}

.spec-name {
  font-family:    'Playfair Display', Georgia, serif;
  font-size:      20px;
  font-weight:    500;
  margin-bottom:  7px;
  letter-spacing: -0.01em;
}

.pill-row { display: flex; flex-wrap: wrap; gap: 6px; }

.pill {
  font-family:    'DM Mono', monospace;
  font-size:      10px;
  letter-spacing: 0.05em;
  padding:        3px 8px;
  border-radius:  3px;
  border:         1px solid var(--rule-dark);
  color:          var(--ink-muted);
  white-space:    nowrap;
}

.pill.green { background: var(--accent-pale); border-color: var(--accent-light); color: var(--accent); }
.pill.amber { background: var(--warn-pale);   border-color: #d4b060;             color: var(--warn); }

.note-card { background: var(--paper-card); border: 1px solid var(--rule); border-radius: var(--radius-lg); overflow: hidden; margin-bottom: 16px; }

.section-bar {
  padding:        10px 20px;
  border-bottom:  1px solid var(--rule);
  background:     var(--paper);
  display:        flex;
  align-items:    center;
  gap:            8px;
  font-family:    'DM Mono', monospace;
  font-size:      10px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color:          var(--ink-muted);
}

.dot       { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }
.dot.amber { background: var(--warn); }
.dot.blue  { background: #3a6b8b; }

.note-body { padding: 14px 20px; font-size: 13px; color: var(--ink-muted); line-height: 1.75; }

.anchor-banner {
  background:    var(--accent-pale);
  border:        1px solid var(--accent-light);
  border-radius: var(--radius-lg);
  padding:       12px 18px;
  display:       flex;
  align-items:   center;
  gap:           10px;
  font-size:     12px;
  color:         var(--accent);
  margin-bottom: 16px;
}

.pom-card { background: var(--paper-card); border: 1px solid var(--rule); border-radius: var(--radius-lg); overflow: hidden; }

.pom-table { width: 100%; border-collapse: collapse; font-size: 12px; }

.pom-table th {
  font-family:    'DM Mono', monospace;
  font-size:      9px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color:          var(--ink-faint);
  font-weight:    400;
  padding:        8px 14px;
  text-align:     left;
  border-bottom:  1px solid var(--rule);
  background:     var(--paper);
  white-space:    nowrap;
}

.pom-table th.r { text-align: right; }
.pom-table td   { padding: 9px 14px; border-bottom: 1px solid var(--rule); vertical-align: middle; }
.pom-table tr:last-child td { border-bottom: none; }
.pom-table tr:hover td      { background: var(--paper); }

.pom-table tr.sec-row td {
  background:     var(--paper-warm);
  font-family:    'DM Mono', monospace;
  font-size:      9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color:          var(--ink-muted);
  padding:        6px 14px;
  font-weight:    500;
  border-bottom:  1px solid var(--rule-dark);
}

.pom-name { color: var(--ink); line-height: 1.4; }
.pom-sub  { font-size: 10px; color: var(--ink-faint); font-style: italic; display: block; margin-top: 1px; }

.pom-val {
  font-family:  'DM Mono', monospace;
  font-size:    12px;
  font-weight:  500;
  color:        var(--ink);
  cursor:       text;
  border-radius: 3px;
  padding:      1px 4px;
  margin:       -1px -4px;
  transition:   background 0.1s;
  display:      inline-block;
  min-width:    28px;
  text-align:   right;
}

.pom-val:hover  { background: var(--paper-warm); }
.pom-val:focus  { outline: none; background: var(--accent-pale); box-shadow: 0 0 0 1.5px var(--accent-light); }
.pom-zero       { color: var(--ink-faint); }

.pom-je {
  font-family: 'DM Mono', monospace;
  font-size:   10px;
  color:       var(--ink-faint);
  display:     block;
  text-align:  right;
  margin-top:  2px;
}

.conf { display: inline-flex; align-items: center; font-family: 'DM Mono', monospace; font-size: 9px; padding: 2px 6px; border-radius: 3px; white-space: nowrap; }
.conf-high { background: #e8f4ec; color: #2a6b3a; }
.conf-med  { background: var(--warn-pale); color: var(--warn); }
.conf-low  { background: #fce8e6; color: var(--danger); }

.pom-val.user-edited {
  background-color: #fffbeb;
  border-color:     #fde68a;
  color:            #92400e;
  position:         relative;
  cursor:           help;
}

.pom-val.user-edited[contenteditable="true"]:focus {
  background-color: white;
  border-color:     #f59e0b;
}

/* ── States ──────────────────────────────────────────────────────────────────── */
.loading-state {
  background:    var(--paper-card);
  border:        1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding:       52px 32px;
  text-align:    center;
}

.spinner {
  width:         32px;
  height:        32px;
  border:        2px solid var(--rule-dark);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation:     spin 0.75s linear infinite;
  margin:        0 auto 16px;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-title { font-size: 14px; font-weight: 500; margin-bottom: 5px; }
.loading-sub   { font-size: 12px; color: var(--ink-muted); }

.error-card {
  background:    #fce8e6;
  border:        1px solid #f5c5c0;
  border-radius: var(--radius-lg);
  padding:       18px 22px;
  display:       flex;
  gap:           12px;
}

.error-title { font-weight: 500; color: var(--danger); margin-bottom: 4px; }
.error-body  { font-size: 13px; color: #6b3030; line-height: 1.6; }

/* ── Mobile ──────────────────────────────────────────────────────────────────── */
.mobile-menu-btn {
  display:    none;
  background: transparent;
  border:     none;
  color:      var(--ink-muted);
  cursor:     pointer;
  padding:    4px;
}

.mobile-backdrop {
  display:         none;
  position:        fixed;
  inset:           0;
  background:      rgba(0,0,0,0.4);
  z-index:         400;
  backdrop-filter: blur(2px);
  opacity:         0;
  transition:      opacity 0.3s ease;
}

@media (max-width: 860px) {
  .workspace {
    grid-template-columns: 1fr;
    padding: 20px;
    gap:     20px;
  }

  .mobile-menu-btn { display: flex; }

  .sidebar-top-nav { display: none; }

  .sidebar {
    position:   fixed;
    top:        0;
    left:       -300px;
    width:      280px;
    min-width:  280px;
    height:     100%;
    z-index:    500;
    box-shadow: 4px 0 24px rgba(0,0,0,0.1);
    transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
  }

  .sidebar.mobile-open { transform: translateX(300px); }

  .mobile-backdrop.show { display: block; opacity: 1; }

  .left-panel { position: static; }

  .header { padding: 0 20px; }

  .auth-card { margin: 20px; padding: 30px 20px; }

  .pricing-modal        { padding: 28px 20px 20px; }
  .credit-tiers         { grid-template-columns: 1fr; gap: 8px; }
  .sub-plan             { flex-direction: column; align-items: flex-start; }
  .sub-cta              { width: 100%; text-align: center; }
}
