/* Neo-brutalist monochrome + sparse orange accent */
:root {
  --bg: #ffffff;
  --bg-dark: #0a0a0a;
  --text: #0a0a0a;
  --text-invert: #ffffff;
  --accent: #ff6a00;
  /* sparse */
  --border: #000000;
  --radius: 3px;
  --border-w: 4px;
  --shadow-y: 6px;
}

@font-face {
  font-family: 'Space Grotesk';
  src: local('Space Grotesk'), local('SpaceGrotesk');
  font-weight: 300 800;
  font-style: normal;
  font-display: swap;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: 'Space Grotesk', system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, Arial, sans-serif;
  height: 100%;
  -webkit-text-size-adjust: 100%;
}

/* Ensure any [hidden] element is fully hidden */
[hidden] {
  display: none !important;
}

.theme-dark {
  background: var(--bg-dark);
  color: var(--text-invert);
}

.theme-light {
  background: var(--bg);
  color: var(--text);
}

.wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px;
}

.app-header {
  border-bottom: var(--border-w) solid var(--border);
  background: transparent;
}

/* Ensure header bar is flex, even when combined on same element */
.header-bar,
.wrap.header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

.header-left,
.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.greeting {
  font-weight: 800;
  font-size: 1.05rem;
  margin-bottom: 18px;
  font-size: 1.25rem;
}

.brand__link {
  text-decoration: none;
  color: inherit;
  font-weight: 900;
  font-size: 1.8rem;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.brand__link--big {
  font-size: 1.8rem;
}

.brand__logo {
  height: 28px;
  width: auto;
  display: block;
}

.header-title {
  font-weight: 900;
  font-size: 1.6rem;
}

.nav {
  display: flex;
  gap: 12px;
}

.nav__link {
  color: inherit;
  text-decoration: none;
  border: var(--border-w) solid var(--border);
  border-radius: var(--radius);
  padding: 6px 10px;
  box-shadow: 0 var(--shadow-y) 0 0 var(--border);
  background: var(--bg);
}

.nav__link--danger {
  background: var(--text);
  color: var(--text-invert);
}

.nav__hint {
  opacity: .7;
}

.app-main {
  padding: 24px 0;
  flex: 1 0 auto;
}
.app-body { display: flex; min-height: 100vh; flex-direction: column; }
.app-footer { border-top: var(--border-w) solid var(--border); background: transparent; padding: 16px 0; }
.footer-bar, .wrap.footer-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.footer-right { display: flex; align-items: center; gap: 12px; }
.footer-link { color: inherit; text-decoration: none; opacity: .8; font-weight: 700; }
.footer-link:hover { opacity: 1; text-decoration: underline; }

/* Feedback floating button */
.feedback-fab {
  position: fixed;
  left: 16px;
  bottom: 16px;
  z-index: 12000;
  border-radius: var(--radius);
}

.title,
.h1,
.h2,
.h3 {
  margin: 0 0 12px;
  font-weight: 800;
}

.h2 {
  font-size: 1.8rem;
}

.h3 {
  font-size: 1.1rem;
}

.card {
  background: var(--bg);
  color: var(--text);
  border: var(--border-w) solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: 0 var(--shadow-y) 0 0 var(--border);
}

.card--auth {
  background: var(--bg);
  color: var(--text);
  border-color: var(--border);
}

.btn {
  display: inline-block;
  padding: 10px 12px;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .02em;
  border: var(--border-w) solid var(--border);
  border-radius: var(--radius);
  background: var(--text-invert);
  color: var(--text);
  box-shadow: 0 var(--shadow-y) 0 0 var(--border);
  transition: transform .05s ease-in-out;
  cursor: pointer;
  text-decoration: none;
}

.btn--plain {
  background: transparent;
  color: inherit;
}

.btn--accent {
  background: var(--accent);
  color: var(--text-invert);
}

.btn--danger {
  background: #b30000;
  color: #fff;
}

.btn--purchase {
  background: #000;
  color: #fff;
}

.btn:active {
  transform: translateY(2px);
  box-shadow: 0 calc(var(--shadow-y) - 2px) 0 0 var(--border);
}

.btn[disabled] {
  opacity: .6;
  cursor: not-allowed;
  filter: grayscale(100%);
}

.field {
  display: block;
  margin-bottom: 12px;
}

.field__label {
  display: block;
  font-weight: 700;
  margin-bottom: 6px;
}

.input {
  width: 100%;
  padding: 12px 10px;
  border: var(--border-w) solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
}

.theme-dark .input {
  background: var(--bg);
  color: var(--text);
}

.input:focus {
  outline: 3px solid var(--accent);
}

.field .help {
  display: block;
  font-size: .85rem;
  opacity: .75;
  margin-top: 4px;
}

.muted {
  opacity: .75;
}
.form-note {
  margin-top: 18px;
}

.grid {
  display: grid;
  gap: 16px;
}

.grid--2 {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.grid--2-fixed {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid--40-60 {
  grid-template-columns: 0.4fr 0.6fr;
}

@media (max-width: 640px) {

  .grid--2-fixed,
  .grid--40-60 {
    grid-template-columns: 1fr;
  }
}

.wallet-balance {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.balance-amount {
  font-size: 2rem;
  font-weight: 800;
}

.balance-label {
  opacity: .8;
}

.habit-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.habit-card {
  border: var(--border-w) solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  background: var(--bg);
  box-shadow: 0 var(--shadow-y) 0 0 var(--border);
  margin-bottom: 12px;
  cursor: pointer;
  position: relative;
}

.habit-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  margin-bottom: 4px;
  font-size: 1.3rem;
}

.habit-title__text {
  flex: 1 1 auto;
}

.habit-toggle {
  font-weight: 900;
  position: absolute;
  bottom: 8px;
  left: 8px;
}

.edit-link {
  color: #000000;
  text-decoration: underline;
  font-weight: 800;
  font-size: .9rem;
  text-transform: uppercase;
}

.habit-meta {
  display: flex;
  gap: 12px;
  font-size: .95rem;
  margin-bottom: 20px;
}

.habit-status {
  margin-top: 18px;
  font-size: .75rem;
}

.habit-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.meta--paused {
  background: #000;
  color: #fff;
  padding: 2px 6px;
  border-radius: var(--radius);
}

.activity-list {
  list-style: none;
  padding: 0;
  margin: 8px 0 0;
  display: grid;
  gap: 6px;
}

.activity-item {
  display: flex;
  justify-content: space-between;
  border: var(--border-w) solid var(--border);
  border-radius: var(--radius);
  padding: 8px;
  background: var(--bg);
  font-size: 0.8rem;
}

.activity-item--positive .activity-type {
  color: #0a7a0a;
}

.activity-item--negative .activity-type {
  color: #b30000;
}

.activity-heading {
  margin-top: 24px;
}

.activity-type {
  font-weight: 800;
}

.activity-time {
  opacity: .75;
}

.banner {
  border: var(--border-w) solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  box-shadow: 0 var(--shadow-y) 0 0 var(--border);
}

.banner--error {
  background: #ffe6e6;
}

/* Modal */
.modal[hidden] {
  display: none !important;
}

.modal {
  position: relative;
  z-index: 10000;
}

.modal__overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .6);
  z-index: 10000;
}

.modal__dialog {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(90vw, 520px);
  background: var(--bg);
  color: var(--text);
  border: var(--border-w) solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 var(--shadow-y) 0 0 var(--border);
  padding: 16px;
  z-index: 10001;
}

.modal__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.modal__footer {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

/* Toasts */
.toast-root {
  position: fixed;
  right: 16px;
  bottom: 16px;
  display: grid;
  gap: 8px;
  z-index: 9999;
}

.toast {
  background: var(--bg);
  color: var(--text);
  border: var(--border-w) solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  box-shadow: 0 var(--shadow-y) 0 0 var(--border);
}

.toast--error {
  background: #ffe6e6;
}

/* Auth layout */
.auth {
  display: block;
  padding-top: 16px;
}

.form--login {
  width: 100%;
}

.form--login .field {
  margin-bottom: 16px;
}

.form--login .field__label {
  font-size: 1.05rem;
}

.form--login .input {
  padding: 16px 14px;
  font-size: 1.05rem;
}

.form--login .btn {
  width: auto;
}

.btn--menu {
  background: var(--text-invert);
  color: var(--text);
}

/* Side Menu */
.side-menu[hidden] {
  display: none !important;
}

.side-menu {
  position: relative;
  z-index: 11000;
}

.side-menu__overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .5);
  z-index: 11000;
}

.side-menu__panel {
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  width: min(90vw, 380px);
  background: var(--bg);
  color: var(--text);
  border-left: var(--border-w) solid var(--border);
  box-shadow: 0 0 0 var(--border-w) var(--border);
  transform: translateX(100%);
  transition: transform .15s ease-out;
  padding: 16px;
  display: flex;
  flex-direction: column;
  z-index: 11001;
}

.side-menu.open .side-menu__panel {
  transform: translateX(0);
}

/* Mobile: full-width top dropdown */
@media (max-width: 640px) {
  .side-menu__panel {
    left: 0;
    right: 0;
    width: 100vw;
    height: auto;
    max-height: 80vh;
    overflow: auto;
    border-left: none;
    border-bottom: var(--border-w) solid var(--border);
    transform: translateY(-100%);
  }
  .side-menu.open .side-menu__panel {
    transform: translateY(0);
  }
}

.side-menu__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.side-menu__nav {
  display: grid;
  gap: 8px;
}

.side-menu__link {
  display: block;
  padding: 12px;
  border: var(--border-w) solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  text-decoration: none;
  font-weight: 800;
}

.side-menu__link--danger {
  background: var(--text);
  color: var(--text-invert);
}

.btn[aria-disabled="true"] {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Access active indicator */
.access-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #2ecc71; /* green */
  color: #ffffff;
  border: var(--border-w) solid var(--border);
  border-radius: var(--radius);
  padding: 2px 8px;
  font-weight: 800;
  font-size: .8rem;
  margin: 4px 0 8px;
  pointer-events: none; /* never block button clicks beneath */
}
.access-indicator__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ffffff;
}

.access-indicator--warn {
  background: #e74c3c; /* red */
}
