/* ===== reference-copy.css — SONYA.OS Dark Orange Cyberpunk ===== */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@300;400;500&family=Inter:wght@300;400;500;600;700&display=swap');

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

:root {
  --bg: #050505;
  --bg-panel: #080A0E;
  --bg-card: #111418;
  --bg-card-hover: #161C24;
  --text: #E7EEF6;
  --text-dim: #7D8A99;
  --text-muted: #556070;
  --amber: #FF8A00;
  --amber-light: #FF9F1C;
  --amber-glow: #FFB347;
  --amber-dim: #b8661d;
  --amber-muted: #8a5a1a;
  --amber-rgb: 255, 138, 0;
  --amber-light-rgb: 255, 159, 28;
  --amber-glow-rgb: 255, 179, 71;
  --amber-dim-rgb: 184, 102, 29;
  --amber-muted-rgb: 138, 90, 26;
  --green: #6BE58C;
  --green-dim: #3a8a52;
  --yellow: #FFC04D;
  --red: #FF4D2E;
  --border: rgba(255, 138, 0, 0.12);
  --border-card: rgba(255, 138, 0, 0.18);
  --border-active: rgba(255, 138, 0, 0.35);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --max-w: 440px;
}

html, body {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  overscroll-behavior: none;
  touch-action: none;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-weight: 400;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 50% 0%, rgba(255, 138, 0, 0.025) 0%, transparent 70%),
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 2px,
      rgba(255, 255, 255, 0.012) 2px,
      rgba(255, 255, 255, 0.012) 4px
    );
  pointer-events: none;
  z-index: 0;
}

#app {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top, 0px) + 75px) 16px 40px;
  position: relative;
  z-index: 1;
  min-height: 100vh;
  height: 100dvh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

/* ===== HEADER ===== */

.header {
  padding: 6px 0 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}

.header-top {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
}

.logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.logo-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.logo-icon svg polygon {
  stroke: var(--amber);
  fill: none;
}

.logo-icon svg {
  width: 17px;
  height: 17px;
  stroke: var(--amber);
  fill: none;
  stroke-width: 1.5;
}

.logo-text {
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 500;
  font-size: 17px;
  letter-spacing: 3px;
  color: var(--text);
}

.logo-dot {
  color: var(--amber);
}

.header-status {
  display: flex;
  align-items: center;
  gap: 5px;
  align-self: flex-end;
  margin-right: 12px;
  flex-shrink: 0;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-dot.green {
  background: var(--green);
  box-shadow: 0 0 6px rgba(107,229,140,0.5), 0 0 12px rgba(107,229,140,0.2);
  animation: pulseGreen 2.5s ease-in-out infinite;
}

.status-dot.yellow {
  background: var(--yellow);
  box-shadow: 0 0 6px rgba(255,192,77,0.4);
  animation: blinkYellow 1.2s step-end infinite;
}

.status-dot.red {
  background: var(--red);
  box-shadow: 0 0 6px rgba(255,77,46,0.5);
  animation: blinkRed 0.8s step-end infinite;
}

@keyframes pulseGreen {
  0%, 100% { opacity: 1; box-shadow: 0 0 6px rgba(107,229,140,0.5), 0 0 14px rgba(107,229,140,0.25); background: var(--green); }
  50% { opacity: 0.35; box-shadow: 0 0 0px rgba(107,229,140,0), 0 0 0px rgba(107,229,140,0); background: #0a3d1a; }
}

@keyframes blinkYellow {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

@keyframes blinkRed {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.2; }
}

.status-label {
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 400;
  font-size: 8px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  transition: color 0.3s;
}

.header-sub {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
}

.sub-label {
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 300;
  font-size: 9px;
  letter-spacing: 1px;
  color: var(--text-dim);
  text-transform: lowercase;
}

/* ===== STATUS CARD ===== */

.status-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  margin-bottom: 12px;
  position: relative;
  overflow: hidden;
}

.status-card::after {
  content: '';
  position: absolute;
  top: -1px;
  left: 20%;
  right: 20%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--amber-dim), transparent);
  opacity: 0.35;
}

.status-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.status-card-title {
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 400;
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-dim);
}

.status-card-time {
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 500;
  font-size: 11px;
  color: var(--amber);
  opacity: 0.8;
}

.status-card-body {
  /* metrics are inside */
}

.freshness-line {
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 300;
  font-size: 9px;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  text-align: center;
}

/* ===== METRICS ===== */

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

.metric {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 6px;
  background: rgba(255,255,255,0.015);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.metric-label {
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 400;
  font-size: 8px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text-muted);
}

.metric-value {
  font-family: 'Inter', sans-serif;
  font-weight: 400;
  font-size: 13px;
  color: var(--text);
  text-align: center;
}

.metric-sub {
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 300;
  font-size: 8px;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  opacity: 0.6;
}

.mini-chart {
  width: 100%;
  height: 20px;
  margin-top: 4px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 2px;
}

.mini-chart svg {
  width: 100%;
  height: 100%;
}

.mini-chart .bar-fill {
  fill: var(--amber);
  opacity: 0.6;
}

.mini-chart .bar-bg {
  fill: rgba(255,138,0,0.08);
}

.mini-chart .dot-on {
  fill: var(--amber);
  opacity: 0.7;
}

.mini-chart .dot-off {
  fill: rgba(255,255,255,0.05);
}

.mini-chart .line-chart {
  stroke: var(--amber);
  stroke-width: 1.2;
  fill: none;
  opacity: 0.7;
}

/* ===== BUTTONS ===== */

.quick-actions {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
  justify-content: center;
}

.qa-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 10px;
  background: rgba(255,255,255,0.015);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  flex: 0 1 60px;
  min-width: 0;
}

.qa-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: var(--amber-dim);
  stroke-width: 1.5;
  transition: stroke 0.2s;
}

.qa-btn span {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 7px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-muted);
  transition: color 0.2s;
}

.qa-btn:active {
  background: rgba(255,138,0,0.08);
  border-color: var(--border-card);
  transform: scale(0.92);
}

.qa-btn:active svg {
  stroke: var(--amber);
}

.qa-btn:active span {
  color: var(--amber-dim);
}

.qa-btn.qa-flash {
  background: rgba(255,138,0,0.12);
  border-color: var(--border-active);
}

.qa-btn.qa-flash svg {
  stroke: var(--amber);
}

.secondary-actions {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}

.secondary-btn {
  flex: 1;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 500;
  font-size: 12px;
  letter-spacing: 2px;
  text-transform: uppercase;
  cursor: pointer;
  border: none;
  outline: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
}

.secondary-btn:first-child {
  background: linear-gradient(135deg, rgba(var(--amber-rgb), 0.12), rgba(var(--amber-rgb), 0.05));
  border-color: var(--border-active);
  color: var(--amber-light);
}

.secondary-btn:last-child {
  background: transparent;
  border-color: var(--border);
  color: var(--text-dim);
}

.secondary-btn:first-child:active {
  transform: scale(0.97);
  background: linear-gradient(135deg, rgba(var(--amber-rgb), 0.2), rgba(var(--amber-rgb), 0.1));
}

.secondary-btn:last-child:active {
  transform: scale(0.97);
  background: rgba(255,255,255,0.03);
  border-color: var(--border-card);
}

/* ===== FEED SECTION ===== */

/* ===== SUMMARY / SWODKA ===== */

.summary-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 14px;
}

.sum-ai-text {
  font-family: 'Inter', sans-serif;
  font-weight: 400;
  font-size: 14px;
  line-height: 1.8;
  color: var(--text);
}

.sum-wrap {
  display: flex;
  flex-direction: column;
  width: 100%;
}

.sum-block {
  padding: 8px 0;
  width: 100%;
}

.sum-stats {
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 300;
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  text-align: center;
  display: block;
  width: 100%;
  clear: both;
}

.sum-error {
  text-align: center;
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 400;
  font-size: 12px;
  color: var(--amber-dim);
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 12px;
  justify-content: center;
}

.chip {
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 400;
  font-size: 8px;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}

.chip:active {
  transform: scale(0.95);
}

.chip-active {
  border-color: var(--border-active);
  color: var(--amber-light);
  background: rgba(255,138,0,0.06);
}

.feed-section {
  margin-top: 0;
}

.feed-header {
  margin-bottom: 12px;
}

.feed-divider {
  display: block;
  height: 1px;
  background: var(--border);
  width: 100%;
}

.feed {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 60px;
  transition: opacity 0.2s ease;
}

.feed-refreshing {
  opacity: 0.6;
}

.feed-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 40px 16px;
  color: var(--text-muted);
}

.placeholder-icon {
  font-size: 20px;
  color: var(--amber-dim);
  opacity: 0.3;
}

.placeholder-text {
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 300;
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: lowercase;
}

/* ===== FEED ITEM ===== */

.feed-item {
  display: flex;
  padding: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s, background 0.2s;
  touch-action: pan-y;
  z-index: 0;
}

.feed-item::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius-md);
  pointer-events: none;
  z-index: 3;
}

.feed-item .feed-item-inner {
  display: flex;
  gap: 10px;
  padding: 12px 14px;
  flex: 0 0 100%;
  transition: transform 0.6s cubic-bezier(0.25, 0.1, 0.25, 1);
  will-change: transform;
  position: relative;
  z-index: 2;
  background: var(--bg-card);
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.feed-item.swiped .feed-item-inner {
  transform: translateX(-152px);
}

.feed-item.swipe-closing .feed-item-inner {
  transform: translateX(0) !important;
  transition: transform 0.6s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.swipe-actions {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 152px;
  display: flex;
  z-index: 10;
  transform: translateX(152px);
  transition: transform 0.6s cubic-bezier(0.25, 0.1, 0.25, 1);
  pointer-events: auto;
  background: var(--bg-card);
}

.feed-item.swiped .swipe-actions {
  transform: translateX(0);
}

.swipe-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  gap: 4px;
  flex-direction: column;
  flex-shrink: 0;
  touch-action: manipulation;
  z-index: 11;
  position: relative;
}

.swipe-btn-edit {
  width: 56px;
  background: var(--bg-card-hover);
  border-radius: 0;
}

.swipe-btn-delete {
  width: 96px;
  background: linear-gradient(180deg, rgba(224,32,32,0.95), rgba(160,16,16,0.95));
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.swipe-btn svg {
  width: 18px;
  height: 18px;
  stroke: #fff;
  fill: none;
  stroke-width: 1.5;
}

.swipe-btn span {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 8px;
  letter-spacing: 1px;
  color: #fff;
  text-transform: uppercase;
}

.swipe-btn {
  width: 76px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  gap: 4px;
  flex-direction: column;
  flex-shrink: 0;
  touch-action: manipulation;
  z-index: 11;
  position: relative;
}

.swipe-btn svg {
  width: 18px;
  height: 18px;
  stroke: #fff;
  fill: none;
  stroke-width: 1.5;
}

.swipe-btn span {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 8px;
  letter-spacing: 1px;
  color: #fff;
  text-transform: uppercase;
}

.swipe-btn-edit {
  background: var(--bg-card-hover);
  border-radius: 0;
}

.swipe-btn-delete {
  background: linear-gradient(180deg, rgba(224,32,32,0.95), rgba(160,16,16,0.95));
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.feed-item.swipe-deleting {
  opacity: 0;
  transform: translateX(40px);
  transition: opacity 0.3s, transform 0.3s;
  max-height: 0;
  padding: 0 14px;
  margin: 0;
  border: none;
  overflow: hidden;
}

.feed-item.swipe-deleting .feed-item-inner::before {
  display: none;
}

.feed-item-inner::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  border-radius: 1px;
  opacity: 0.6;
  z-index: 2;
}

.feed-item:hover {
  border-color: var(--border-card);
  background: var(--bg-card-hover);
}

/* category left border colours */
.feed-food .feed-item-inner::before { background: var(--amber); }
.feed-toilet .feed-item-inner::before { background: var(--amber-light); }
.feed-health .feed-item-inner::before { background: var(--red); }
.feed-behavior .feed-item-inner::before,
.feed-mood .feed-item-inner::before { background: var(--amber-glow); }
.feed-sleep .feed-item-inner::before { background: var(--amber-dim); }
.feed-play .feed-item-inner::before { background: var(--amber); }
.feed-home .feed-item-inner::before { background: var(--amber-muted); }
.feed-care .feed-item-inner::before { background: var(--amber-light); }
.feed-alert .feed-item-inner::before { background: var(--red); }
.feed-note .feed-item-inner::before,
.feed-observation .feed-item-inner::before { background: var(--text-dim); }
.feed-photo .feed-item-inner::before { background: var(--amber-dim); }
.feed-funny .feed-item-inner::before { background: var(--amber-muted); }
.feed-system .feed-item-inner::before { background: var(--text-muted); }

/* visual sub-type overrides for colour and icon stroke */
.feed-visual-alert-red::before { background: var(--red); }
.feed-visual-alert-yellow::before { background: var(--yellow); }
.feed-visual-alert-repeat::before { background: var(--red); }

.feed-icon-wrap {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
}

.feed-icon-wrap svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke-width: 1.5;
}

/* icon colours per category */
.feed-food .feed-icon-wrap svg { stroke: var(--amber); }
.feed-toilet .feed-icon-wrap svg { stroke: var(--amber-light); }
.feed-health .feed-icon-wrap svg { stroke: var(--red); }
.feed-behavior .feed-icon-wrap svg,
.feed-mood .feed-icon-wrap svg { stroke: var(--amber-glow); }
.feed-sleep .feed-icon-wrap svg { stroke: var(--amber-dim); }
.feed-play .feed-icon-wrap svg { stroke: var(--amber); }
.feed-home .feed-icon-wrap svg { stroke: var(--amber-muted); }
.feed-care .feed-icon-wrap svg { stroke: var(--amber-light); }
.feed-alert .feed-icon-wrap svg { stroke: var(--red); }
.feed-note .feed-icon-wrap svg,
.feed-observation .feed-icon-wrap svg { stroke: var(--text-dim); }
.feed-photo .feed-icon-wrap svg { stroke: var(--amber-dim); }
.feed-funny .feed-icon-wrap svg { stroke: var(--amber-muted); }
.feed-system .feed-icon-wrap svg { stroke: var(--text-muted); }

.feed-content {
  flex: 1;
  min-width: 0;
}

.feed-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.feed-item-category {
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 400;
  font-size: 8px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text-dim);
}

.feed-food .feed-item-category { color: var(--amber); }
.feed-toilet .feed-item-category { color: var(--amber-light); }
.feed-health .feed-item-category { color: var(--red); }
.feed-behavior .feed-item-category,
.feed-mood .feed-item-category { color: var(--amber-glow); }
.feed-sleep .feed-item-category { color: var(--amber-dim); }
.feed-play .feed-item-category { color: var(--amber); }
.feed-home .feed-item-category { color: var(--amber-muted); }
.feed-care .feed-item-category { color: var(--amber-light); }
.feed-alert .feed-item-category { color: var(--red); }
.feed-note .feed-item-category,
.feed-observation .feed-item-category { color: var(--text-dim); }
.feed-photo .feed-item-category { color: var(--amber-dim); }
.feed-funny .feed-item-category { color: var(--amber-muted); }
.feed-system .feed-item-category { color: var(--text-muted); }

.feed-item-time {
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 300;
  font-size: 9px;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.feed-item-text {
  font-family: 'Inter', sans-serif;
  font-weight: 400;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  word-break: break-word;
}

.feed-item-meta {
  display: flex;
  gap: 4px;
  margin-top: 6px;
  flex-wrap: wrap;
}

.feed-tag {
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 400;
  font-size: 8px;
  letter-spacing: 0.8px;
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid var(--border);
  text-transform: uppercase;
  color: var(--text-dim);
  background: rgba(255,255,255,0.015);
}

.feed-tag.tag-ok {
  border-color: rgba(107,229,140,0.25);
  color: var(--green);
  background: rgba(107,229,140,0.06);
}

.feed-tag.tag-amber {
  border-color: rgba(var(--amber-rgb), 0.25);
  color: var(--amber);
  background: rgba(var(--amber-rgb), 0.06);
}
.feed-tag.tag-orange {
  border-color: rgba(var(--amber-light-rgb), 0.25);
  color: var(--amber-light);
  background: rgba(var(--amber-light-rgb), 0.06);
}
.feed-tag.tag-red {
  border-color: rgba(255,77,46,0.25);
  color: var(--red);
  background: rgba(255,77,46,0.06);
}
.feed-tag.tag-gold {
  border-color: rgba(var(--amber-glow-rgb), 0.25);
  color: var(--amber-glow);
  background: rgba(var(--amber-glow-rgb), 0.06);
}
.feed-tag.tag-dim {
  border-color: rgba(var(--amber-dim-rgb), 0.25);
  color: var(--amber-dim);
  background: rgba(var(--amber-dim-rgb), 0.06);
}
.feed-tag.tag-muted {
  border-color: rgba(var(--amber-muted-rgb), 0.25);
  color: var(--amber-muted);
  background: rgba(var(--amber-muted-rgb), 0.06);
}
.feed-tag.tag-gray {
  border-color: rgba(125,138,153,0.25);
  color: var(--text-dim);
  background: rgba(125,138,153,0.06);
}

/* ===== MODAL ===== */

.modal-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s, visibility 0.25s;
}

.modal-overlay.open {
  opacity: 1;
  visibility: visible;
}

.modal {
  width: calc(100% - 32px);
  max-width: calc(var(--max-w) - 32px);
  max-height: 80vh;
  overflow-y: auto;
  background: var(--bg-panel);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 20px 18px 28px;
  transform: translateY(20px);
  transition: transform 0.25s;
}

.modal-overlay.open .modal {
  transform: translateY(0);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.modal-title {
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 400;
  font-size: 12px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text);
}

.modal-close {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: 1.5px solid var(--border-card);
  border-radius: 4px;
  background: transparent;
  transition: all 0.2s;
  position: relative;
}

.modal-close::before,
.modal-close::after {
  content: '';
  position: absolute;
  width: 10px;
  height: 1.5px;
  background: var(--text-muted);
  border-radius: 1px;
}

.modal-close::before {
  transform: rotate(45deg);
}

.modal-close::after {
  transform: rotate(-45deg);
}

.modal-close:hover {
  border-color: var(--border-active);
  background: rgba(var(--amber-rgb), 0.06);
}

.modal-close:hover::before,
.modal-close:hover::after {
  background: var(--amber);
}

/* ===== FORM ===== */

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

.form-label {
  display: block;
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 400;
  font-size: 9px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.form-input,
.form-textarea {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
  height: 44px;
  -webkit-appearance: none;
  appearance: none;
}

select.form-input {
  padding-right: 28px;
  color: var(--text);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23FF8A00' fill='none' stroke-width='1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 10px 6px;
}

.theme-red select.form-input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23FF2844' fill='none' stroke-width='1.5'/%3E%3C/svg%3E");
}


.select-wrap::after {
  content: '';
  position: absolute;
  right: 12px;
  top: 50%;
  width: 6px;
  height: 6px;
  border: solid var(--amber);
  border-width: 0 1.5px 1.5px 0;
  transform: translateY(-50%) rotate(45deg);
  pointer-events: none;
}

.select-wrap select {
  width: 100%;
}

.form-textarea {
  resize: vertical;
  min-height: 72px;
}

.form-input:focus,
.form-textarea:focus {
  border-color: var(--border-card);
}

.form-submit {
  width: 100%;
  padding: 14px;
  border-radius: var(--radius-md);
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 500;
  font-size: 12px;
  letter-spacing: 2px;
  text-transform: uppercase;
  cursor: pointer;
  border: none;
  outline: none;
  background: linear-gradient(135deg, rgba(var(--amber-rgb), 0.12), rgba(var(--amber-rgb), 0.05));
  border: 1px solid var(--border-active);
  color: var(--amber-light);
  transition: all 0.2s;
  margin-top: 12px;
}

.form-submit:active {
  transform: scale(0.97);
  background: linear-gradient(135deg, rgba(var(--amber-rgb), 0.2), rgba(var(--amber-rgb), 0.1));
}

.form-checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 10px 0;
}

.form-checkbox input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  border: 1.5px solid var(--border-card);
  border-radius: 4px;
  background: rgba(255,255,255,0.02);
  cursor: pointer;
  position: relative;
  transition: all 0.15s;
  margin: 0;
}

.form-checkbox input[type="checkbox"]:checked {
  border-color: var(--amber);
  background: rgba(255, 138, 0, 0.15);
}

.form-checkbox input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 5px;
  width: 4px;
  height: 8px;
  border: solid var(--amber);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.form-checkbox span {
  font-size: 13px;
  color: var(--text);
  font-family: 'Inter', sans-serif;
}

/* ===== MODAL ICON HEADER ===== */

.modal-icon-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.modal-icon-header .mih-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid;
  flex-shrink: 0;
}

.modal-icon-header .mih-icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke-width: 1.5;
}

.modal-icon-header .mih-title {
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 400;
  font-size: 13px;
  letter-spacing: 2px;
  text-transform: uppercase;
}

/* icon header color themes */
.mih-food .mih-icon { border-color: rgba(255,138,0,0.3); background: rgba(255,138,0,0.06); }
.mih-food .mih-icon svg { stroke: var(--amber); }
.mih-food .mih-title { color: var(--amber); }

.mih-health .mih-icon { border-color: rgba(255,77,46,0.3); background: rgba(255,77,46,0.06); }
.mih-health .mih-icon svg { stroke: var(--red); }
.mih-health .mih-title { color: var(--red); }

.mih-toilet .mih-icon { border-color: rgba(var(--amber-light-rgb), 0.3); background: rgba(var(--amber-light-rgb), 0.06); }
.mih-toilet .mih-icon svg { stroke: var(--amber-light); }
.mih-toilet .mih-title { color: var(--amber-light); }

.mih-behavior .mih-icon { border-color: rgba(var(--amber-glow-rgb), 0.3); background: rgba(var(--amber-glow-rgb), 0.06); }
.mih-behavior .mih-icon svg { stroke: var(--amber-glow); }
.mih-behavior .mih-title { color: var(--amber-glow); }

.mih-note .mih-icon { border-color: rgba(125,138,153,0.3); background: rgba(125,138,153,0.06); }
.mih-note .mih-icon svg { stroke: var(--text-dim); }
.mih-note .mih-title { color: var(--text-dim); }

.mih-week .mih-icon { border-color: rgba(255,138,0,0.25); background: rgba(255,138,0,0.05); }
.mih-week .mih-icon svg { stroke: var(--amber); }
.mih-week .mih-title { color: var(--amber); }

.mih-settings .mih-icon { border-color: rgba(125,138,153,0.25); background: rgba(125,138,153,0.05); }
.mih-settings .mih-icon svg { stroke: var(--text-dim); }
.mih-settings .mih-title { color: var(--text-dim); }

/* ===== CATEGORY BADGE IN FORM SELECT ===== */

select.form-input optgroup,
select.form-input option {
  background: var(--bg-card);
  color: var(--text);
}

/* ===== EMPTY STATE ===== */

.feed-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  position: relative;
  overflow: hidden;
}

.empty-glow {
  position: absolute;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,138,0,0.06), transparent);
  animation: emptyPulse 3s ease-in-out infinite;
}

@keyframes emptyPulse {
  0%, 100% { opacity: 0.3; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(1.2); }
}

.empty-cursor {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 20px;
  color: var(--amber-dim);
  animation: blink 1s step-end infinite;
  margin-bottom: 8px;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

.empty-text {
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 300;
  font-size: 12px;
  letter-spacing: 3px;
  color: var(--text-muted);
  text-transform: uppercase;
}

/* ===== FEED ITEM ANIMATION ===== */

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

.feed-item {
  animation: feedFadeIn 0.35s ease-out both;
}

.feed-item:nth-child(1) { animation-delay: 0.02s; }
.feed-item:nth-child(2) { animation-delay: 0.06s; }
.feed-item:nth-child(3) { animation-delay: 0.10s; }
.feed-item:nth-child(4) { animation-delay: 0.14s; }
.feed-item:nth-child(5) { animation-delay: 0.18s; }
.feed-item:nth-child(6) { animation-delay: 0.22s; }
.feed-item:nth-child(7) { animation-delay: 0.26s; }
.feed-item:nth-child(8) { animation-delay: 0.30s; }

/* ===== SYSTEM FOOTER ===== */

.system-footer {
  margin-top: 12px;
  padding: 20px 0 71px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.footer-version {
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 300;
  font-size: 8px;
  letter-spacing: 1px;
  color: var(--text-muted);
}

.footer-bullet {
  font-size: 6px;
  color: var(--amber-dim);
  opacity: 0.4;
}

.footer-status {
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 400;
  font-size: 8px;
  letter-spacing: 1.5px;
  color: var(--green);
}

/* ===== LOADING SPINNER ===== */

.loading-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(5,5,5,0.7);
  z-index: 2000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
}

.loading-overlay.active {
  opacity: 1;
  visibility: visible;
}

.loading-spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--border);
  border-top-color: var(--amber);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ===== SETTINGS CHECKBOX ===== */

input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  position: relative;
  transition: all 0.2s;
  flex-shrink: 0;
}

input[type="checkbox"]:checked {
  border-color: var(--amber-dim);
  background: rgba(var(--amber-dim-rgb), 0.12);
}

input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 6px;
  width: 5px;
  height: 9px;
  border: solid var(--amber-dim);
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg);
}

/* ===== SCROLLBAR ===== */

::-webkit-scrollbar {
  width: 4px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(var(--amber-rgb), 0.12);
  border-radius: 2px;
}

/* ===== MOBILE TWEAKS ===== */

@media (max-width: 420px) {
  #app { padding: calc(env(safe-area-inset-top, 0px) + 75px) 12px 40px; }
  .logo-text { font-size: 15px; letter-spacing: 2.5px; }
  .sub-label { font-size: 8px; }
  .status-label { font-size: 7px; }
  .metric { padding: 10px 4px; }
  .feed-item .feed-item-inner { padding: 10px 12px; }
  .modal { padding: 16px 14px 24px; }
  .modal-full { min-height: 70vh; }
  .empty-text { font-size: 10px; letter-spacing: 2px; }
  .modal-icon-header .mih-title { font-size: 11px; }
}


/* ===== COLOR THEMES ===== */
.theme-red {
  --amber: #FF2844;
  --amber-rgb: 255, 40, 68;
  --amber-light: #FF5577;
  --amber-glow: #FF7799;
  --amber-dim: #CC2244;
  --amber-muted: #991133;
  --amber-dim-rgb: 204, 34, 68;
  --amber-light-rgb: 255, 85, 119;
  --amber-glow-rgb: 255, 119, 153;
  --amber-muted-rgb: 153, 17, 51;
  --border: rgba(255, 40, 68, 0.12);
  --border-card: rgba(255, 40, 68, 0.18);
  --border-active: rgba(255, 40, 68, 0.35);
}

/* ===== COLOR THEMES ===== */
