/* Organize My Life V17 — Visual Redesign
   Visual layer only. Does not change application data or behavior. */

:root {
  --vr-bg: #f5f5f7;
  --vr-surface: #ffffff;
  --vr-text: #202033;
  --vr-muted: #777784;
  --vr-gold: #cf9830;
  --vr-gold-soft: #f8edda;
  --vr-border: #e4e2e8;
  --vr-shadow: 0 4px 18px rgba(32, 32, 51, 0.045);
  --vr-radius: 23px;
}

html,
body {
  background: var(--vr-bg);
  color: var(--vr-text);
}

body {
  font-family: system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif;
  line-height: 1.55;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
  transition: background-color .18s ease, color .18s ease,
              box-shadow .18s ease, transform .18s ease;
}

button:active {
  transform: scale(.985);
}

header {
  position: relative;
  background: var(--vr-bg);
  color: var(--vr-text);
  border-radius: 0;
  padding: 20px 16px 14px;
  box-shadow: none;
}

header .container {
  max-width: 960px;
  padding: 8px 4px 14px;
}



header h1 {
  color: var(--vr-text);
  font-size: clamp(27px, 5vw, 36px);
  font-weight: 800;
  letter-spacing: -.7px;
  line-height: 1.15;
  margin: 0;
}

header .sub,
header #greeting {
  color: var(--vr-muted);
  line-height: 1.5;
  overflow-wrap: anywhere;
}

header #todayDate {
  color: var(--vr-gold);
  font-weight: 750;
}

header .user-chip {
  background: #eee8dc;
  color: #51452f;
  border: 1px solid #e8ddc9;
  border-radius: 999px;
  padding: 8px 12px;
}

#v17SettingsGear {
  z-index: 20;
  background: var(--vr-gold-soft);
  color: var(--vr-gold);
  border: 1px solid #efe0c4;
  border-radius: 17px;
  box-shadow: none;
}

#v17SettingsPanel {
  z-index: 100;
  border: 1px solid var(--vr-border);
  border-radius: 21px;
  background: var(--vr-surface);
  color: var(--vr-text);
  box-shadow: 0 16px 42px rgba(32, 32, 51, .14);
}

.container,
main.container {
  width: 100%;
  max-width: 960px;
  margin-left: auto;
  margin-right: auto;
}

main.container {
  padding: 12px 16px 100px;
}

.nav {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 4px 0 20px;
  padding: 9px;
  background: var(--vr-surface);
  border: 1px solid var(--vr-border);
  border-radius: var(--vr-radius);
  box-shadow: var(--vr-shadow);
}

.nav button {
  min-width: 0;
  min-height: 44px;
  padding: 10px 5px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: var(--vr-muted);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.nav button.active {
  background: var(--vr-gold-soft);
  color: #805b17;
  box-shadow: inset 0 0 0 1px rgba(207, 152, 48, .12);
}

.grid {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 245px), 1fr));
  gap: 14px;
}

.card,
.result,
.timer,
.meal {
  min-width: 0;
  background: var(--vr-surface);
  color: var(--vr-text);
  border: 1px solid var(--vr-border);
  border-radius: var(--vr-radius);
  box-shadow: var(--vr-shadow);
  padding: 20px;
  margin-bottom: 15px;
}

.card h2,
.card h3 {
  color: var(--vr-text);
  font-weight: 780;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.card h2 {
  font-size: clamp(18px, 3.8vw, 22px);
  margin: 0 0 14px;
}

.card h3 {
  font-size: 17px;
}

.muted,
.ai-meta {
  color: var(--vr-muted);
}

.stat {
  color: var(--vr-text);
  font-size: clamp(27px, 6vw, 38px);
  font-weight: 850;
  line-height: 1.2;
}

.progress {
  overflow: hidden;
  background: #eeeef2;
  border-radius: 999px;
  min-height: 10px;
}

.bar {
  background: var(--vr-gold);
  border-radius: inherit;
  transition: width .25s ease;
}

.primary {
  border: 1px solid var(--vr-gold);
  border-radius: 15px;
  padding: 11px 16px;
  background: var(--vr-gold);
  color: #ffffff;
  font-weight: 750;
  box-shadow: 0 4px 12px rgba(207, 152, 48, .16);
}

.primary:hover {
  background: #bd8622;
}

button.small {
  border: 1px solid var(--vr-border);
  border-radius: 13px;
  padding: 9px 12px;
  background: #f8f7f9;
  color: var(--vr-text);
  font-weight: 650;
}

button.danger {
  color: #b64040;
  background: #fff1f1;
  border-color: #f5dada;
}

.tag,
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  border-radius: 999px;
  padding: 5px 10px;
  background: var(--vr-gold-soft);
  color: #805b17;
  font-size: 12px;
  overflow-wrap: anywhere;
}

input,
select,
textarea {
  min-width: 0;
  max-width: 100%;
  border: 1px solid var(--vr-border);
  border-radius: 13px;
  background: #ffffff;
  color: var(--vr-text);
  padding: 11px 12px;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(207, 152, 48, .24);
  border-color: var(--vr-gold);
}

.task,
.exercise,
.food-item,
.goal,
.history-item {
  min-width: 0;
  border-color: var(--vr-border);
  overflow-wrap: anywhere;
}

.task {
  padding: 13px 0;
}

.check {
  accent-color: var(--vr-gold);
}

.kpi > div {
  background: #faf7f1;
  border: 1px solid #f0e7d8;
  border-radius: 16px;
  padding: 13px 8px;
  text-align: center;
}

.kpi b {
  display: block;
  color: var(--vr-text);
  font-size: 20px;
}

.kpi small {
  color: var(--vr-muted);
}

.water {
  gap: 7px;
}

.water button,
.water > div {
  border-radius: 12px;
}

.quote {
  color: #5d574c;
  line-height: 1.8;
  overflow-wrap: anywhere;
}

.calc-grid {
  gap: 10px;
}

.chart {
  max-width: 100%;
  overflow-x: auto;
}

.ai-chat {
  border-radius: 17px;
}

.ai-user {
  background: #f8edda;
  color: #51452f;
}

.ai-bot {
  background: #f4f4f7;
  color: var(--vr-text);
}

#v17Translator {
  border-radius: 16px;
  box-shadow: var(--vr-shadow);
}

.hidden {
  display: none !important;
}

/* Preserve a readable dark theme when the existing setting is enabled. */
html.dark-mode,
body.dark-mode {
  --vr-bg: #0b1220;
  --vr-surface: #151d2d;
  --vr-text: #e8edf7;
  --vr-muted: #a0acc0;
  --vr-gold: #d8a441;
  --vr-gold-soft: #302a20;
  --vr-border: #29354a;
  --vr-shadow: 0 8px 24px rgba(0, 0, 0, .18);
}

html.dark-mode header,
body.dark-mode header {
  background: var(--vr-bg);
  color: var(--vr-text);
}

html.dark-mode .nav,
body.dark-mode .nav,
html.dark-mode .card,
body.dark-mode .card,
html.dark-mode .result,
body.dark-mode .result,
html.dark-mode .timer,
body.dark-mode .timer,
html.dark-mode .meal,
body.dark-mode .meal {
  background: var(--vr-surface);
  color: var(--vr-text);
  border-color: var(--vr-border);
}

html.dark-mode .nav button.active,
body.dark-mode .nav button.active {
  background: var(--vr-gold-soft);
  color: var(--vr-text);
}

html.dark-mode .card h2,
body.dark-mode .card h2,
html.dark-mode .card h3,
body.dark-mode .card h3,
html.dark-mode .stat,
body.dark-mode .stat {
  color: var(--vr-text);
}

html.dark-mode input,
html.dark-mode select,
html.dark-mode textarea,
body.dark-mode input,
body.dark-mode select,
body.dark-mode textarea {
  background: #0f1727;
  color: var(--vr-text);
  border-color: var(--vr-border);
}

html.dark-mode button.small,
body.dark-mode button.small {
  background: #253147;
  color: var(--vr-text);
  border-color: var(--vr-border);
}

html.dark-mode .kpi > div,
body.dark-mode .kpi > div {
  background: #1c2739;
  border-color: var(--vr-border);
}

html.dark-mode .quote,
body.dark-mode .quote {
  color: var(--vr-text);
}

@media (max-width: 600px) {
  header {
    padding: 18px 12px 10px;
  }

  header .container {
    padding: 12px 4px;
  }

  main.container {
    padding: 10px 12px 90px;
  }

  .nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
    padding: 8px;
    border-radius: 20px;
  }

  .nav button {
    min-height: 43px;
    padding: 9px 3px;
    font-size: 12px;
  }

  .card,
  .result,
  .timer,
  .meal {
    padding: 17px;
    border-radius: 21px;
  }

  .row {
    flex-wrap: wrap;
    gap: 9px;
  }

  .row > input,
  .row > select {
    flex: 1 1 130px;
  }

  .row > button {
    max-width: 100%;
  }

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

@media (max-width: 360px) {
  .nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .card,
  .result,
  .timer,
  .meal {
    padding: 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
  }
}


/* V17 notes export button: responsive and contained in the notes card */
#notes .notes-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  width: 100%;
  max-width: 100%;
  margin-top: 10px;
  box-sizing: border-box;
}

#notes .notes-buttons .primary {
  flex: 1 1 140px;
  min-width: 0;
  max-width: 100%;
  margin: 0;
  box-sizing: border-box;
  white-space: normal;
  overflow-wrap: anywhere;
}

@media (max-width: 380px) {
  #notes .notes-buttons .primary {
    flex-basis: 100%;
    width: 100%;
  }
}
