/* style.css */
/* Gradienty base is already there – this keeps it */
body {
  min-height: 100vh;
  margin: 0;
  font-family: "Poppins", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, Arial, sans-serif;
  color: var(--text-main);
  background:
    radial-gradient(circle at 0% 0%, rgba(255, 255, 255, 0.85) 0, var(--bg-body) 55%, #f6ebff 100%);
}

/* ... your existing styles ... */

/* Habit meta left column (existing) */
.habit-grid-meta-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* NEW: reset button for habit checkboxes */
.habit-reset-btn {
  align-self: flex-start;
  margin-top: 4px;
  padding: 4px 10px;
  font-size: 0.7rem;
  border-radius: 999px;
  border: none;
  background: var(--bg-soft);
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, transform 0.12s ease;
}

.habit-reset-btn:hover {
  background: rgba(0, 0, 0, 0.06);
  color: var(--text-main);
  transform: translateY(-1px);
}

.habit-reset-btn:active {
  transform: translateY(0);
}

/* Make sure habit graph stays inside the card */
.habit-grid-wrapper {
  max-width: 100%;
}

.habit-graph-card {
  max-width: 100%;
}

#habitGraph {
  width: 100%;
  max-width: 100%;
  height: auto;
  display: block;
}

/* RESET + BASE */

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

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: "Poppins", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial,
    sans-serif;
  background: var(--bg-body);
  color: var(--text-main);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* THEME VARIABLES */

:root {
  --bg-body: #fff9fd;
  --bg-card: #ffffff;
  --bg-soft: rgba(255, 255, 255, 0.96);
  --text-main: #2c2540;
  --text-muted: #746c85;
  --border-soft: #f3d7f0;
  --shadow-soft: 0 18px 40px rgba(83, 55, 94, 0.12);
  --radius-lg: 20px;
  --bg-tile: rgba(255, 255, 255, 0.96);   /* calendar day boxes */
  --bg-panel: rgba(255, 255, 255, 0.96);  /* floating panel */

  --accent-main: #f4a9c7;
  --accent-strong: #e58ac1;
  --accent-soft: #ffe2f0;
}


/* Dark theme surfaces */
body[data-theme="dark"] {
  --bg-body: #171323;
  --bg-card: rgba(24, 18, 38, 0.92);
  --bg-soft: rgba(32, 24, 52, 0.88);
  --border-soft: rgba(255, 255, 255, 0.10);
  --shadow-soft: 0 22px 50px rgba(0, 0, 0, 0.35);
  --title-color: #1f1a2e; /* deep dark purple / charcoal */
}

body[data-theme="dark"] {
  /* BUTTON COLORS – DARK MODE */
  --btn-bg: rgba(32, 24, 48, 0.96);
  --btn-text: #f7ebff;
  --btn-border: rgba(255, 255, 255, 0.10);
  --btn-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);

  --btn-bg-hover: rgba(42, 32, 64, 0.98);
  --btn-bg-active: rgba(54, 42, 78, 0.98);

  --btn-accent-bg: var(--accent-main);
  --btn-accent-text: #fff;
}

/* Dark theme gradient background */
body[data-theme="dark"][data-bgmode="gradient"] {
  background: radial-gradient(120% 120% at 0 0, rgba(196, 157, 255, 0.18) 0, var(--bg-body) 55%, var(--bg-body) 100%);
}

body[data-theme="dark"][data-bgmode="solid"] {
  background: var(--bg-body);
}

/* Dark mode component backgrounds (so cards and controls don't stay white) */
body[data-theme="dark"] .view-tabs,
body[data-theme="dark"] #accentSelect,
body[data-theme="dark"] .theme-toggle,
body[data-theme="dark"] .palette-button,
body[data-theme="dark"] .palette-popover {
  background: var(--bg-soft) !important;
  color: var(--text-main);
  border-color: var(--border-soft);
}

body[data-theme="dark"] .palette-section {
  border-top-color: rgba(255, 255, 255, 0.10);
}

body[data-theme="dark"] .card,
body[data-theme="dark"] .panel-card,
body[data-theme="dark"] .calendar-panel,
body[data-theme="dark"] .day-items-panel,
body[data-theme="dark"] .table-card,
body[data-theme="dark"] .habit-card,
body[data-theme="dark"] .timer-card,
body[data-theme="dark"] .timer-wrapper-card {
  background: var(--bg-card) !important;
  border-color: var(--border-soft);
}

/* Hide the tiny rename/delete buttons on calendar chips */
/* Habits: hide tabs and show only one tracker (selected habit) */
#habitTabs {
  display: none !important;
}

.habit-list-item-active {
  outline: 2px solid rgba(255, 255, 255, 0.0);
  background: rgba(244, 169, 199, 0.18);
  border-radius: 12px;
}

body[data-theme="dark"] .habit-list-item-active {
  background: rgba(196, 157, 255, 0.14);
}

/* Accent themes */

body[data-accent="pink"] {
  --accent-main: #f4a9c7;
  --accent-strong: #e58ac1;
  --accent-soft: #ffe2f0;
}

body[data-accent="blue"] {
  --accent-main: #6ea8ff;
  --accent-strong: #4c8fff;
  --accent-soft: #e0edff;
}

body[data-accent="mint"] {
  --accent-main: #7dd8b5;
  --accent-strong: #4fbf95;
  --accent-soft: #dbf7ec;
}

body[data-accent="purple"] {
  --accent-main: #c49dff;
  --accent-strong: #aa7dff;
  --accent-soft: #efe5ff;
}

/* Light vs dark contrast for text */

body[data-contrast="dark"] {
  --text-main: #f7ebff;
  --text-muted: rgba(236, 220, 255, 0.75);
}

body[data-theme="dark"]{
  --bg-body: #171323; /* keeps your base dark */
  --bg-card: rgba(24, 18, 36, 0.92);
  --bg-soft: rgba(24, 18, 36, 0.92);
  --border-soft: rgba(255, 255, 255, 0.10);
  --shadow-soft: 0 18px 40px rgba(0,0,0,0.35);

  --bg-tile: rgba(24, 18, 36, 0.92);
  --bg-panel: rgba(24, 18, 36, 0.92);
}

/* Background mode */

body[data-bgmode="gradient"]{
  background: radial-gradient(
    120% 120% at 0 0,
    rgba(255, 255, 255, 0.10) 0,
    var(--bg-body) 55%,
    rgba(255, 255, 255, 0.06) 100%
  );
}

body[data-bgmode="solid"] {
  background: var(--bg-body);
}

/* APP LAYOUT */

.app-shell {
  max-width: 1160px;
  margin: 24px auto 40px;
  padding: 0 16px 80px;
}

/* HEADER */

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  margin-bottom: 18px;
}

.app-title h1 {
  margin: 0;
  font-size: 1.9rem;
  letter-spacing: 0.01em;
  color: var(--title-color);
  text-shadow: 0 6px 20px rgba(0,0,0,0.15);
}

.app-subtitle {
  margin: 4px 0 0;
  font-size: 0.85rem;
  color: var(--text-muted);
  color: var(--title-color);
  text-shadow: 0 6px 20px rgba(0,0,0,0.15)
}

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

/* View tabs */

.view-tabs {
  display: inline-flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.78);
  border-radius: 999px;
  padding: 3px;
  box-shadow: 0 10px 30px rgba(83, 55, 94, 0.18);
}

.view-tab-btn {
  border: none;
  background: transparent;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.8rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.18s ease;
}

.view-tab-btn.view-tab-active {
  background: var(--accent-main);
  color: var(--text-main);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.12);
}

/* Theme controls */

.theme-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

#accentSelect {
  border-radius: 999px;
  border: 1px solid var(--border-soft);
  padding: 4px 10px;
  font-size: 0.78rem;
  background: rgba(255, 255, 255, 0.95);
}

.theme-toggle {
  border-radius: 999px;
  border: 1px solid var(--border-soft);
  padding: 4px 10px;
  font-size: 0.78rem;
  background: rgba(255, 255, 255, 0.95);
  cursor: pointer;
}

/* Palette */

.palette-button {
  border-radius: 999px;
  border: none;
  padding: 6px 10px;
  background: #ffffff;
  box-shadow: 0 8px 16px rgba(83, 55, 94, 0.16);
  cursor: pointer;
}

.palette-popover {
  position: absolute;
  right: 16px;
  top: 64px;
  width: 260px;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 18px 40px rgba(83, 55, 94, 0.18);
  padding: 10px 12px 12px;
  z-index: 40;
}

.palette-popover-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
  margin-bottom: 6px;
}

.palette-close-btn {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 0.86rem;
  padding: 0 4px;
}

.palette-section {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid #f3e6ff;
}

.palette-section-title {
  font-size: 0.76rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.palette-swatches {
  display: flex;
  gap: 8px;
  margin-bottom: 6px;
}

.swatch-btn {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  border: 2px solid transparent;
  cursor: pointer;
}

.swatch-small {
  width: 22px;
  height: 22px;
}

.swatch-active {
  border-color: #111;
}

.palette-slider-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.74rem;
  color: var(--text-muted);
}

.palette-slider-row input[type="range"] {
  flex: 1;
}

.bg-mode-toggle {
  display: inline-flex;
  background: #f7f1ff;
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
}

.bg-mode-btn {
  border-radius: 999px;
  border: none;
  padding: 3px 10px;
  font-size: 0.72rem;
  cursor: pointer;
  background: transparent;
  color: var(--text-muted);
}

.bg-mode-active {
  background: #fff;
  color: var(--text-main);
  box-shadow: 0 8px 18px rgba(83, 55, 94, 0.12);
}

/* Modes */

.mode-toggle-group {
  display: inline-flex;
  gap: 4px;
}

.mode-btn {
  border-radius: 999px;
  border: none;
  padding: 4px 10px;
  font-size: 0.78rem;
  background: var(--bg-soft);
  cursor: pointer;
  color: var(--text-main);
  box-shadow: 0 8px 18px rgba(83, 55, 94, 0.12);
}

.mode-btn.active {
  background: var(--accent-main);
  color: var(--text-main);
}

.mode-btn-danger {
  background: #fff0f3;
  color: #d7446c;
}

/* CALENDAR ROW */

.calendar-tabs-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.calendar-tabs-label {
  font-size: 0.78rem;
  color: var(--title-color);
  text-shadow: 0 6px 20px rgba(0,0,0,0.15);
}

.calendar-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.calendar-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: 999px;
  border: none;
  padding: 4px 10px 4px 8px;
  font-size: 0.76rem;
  background: var(--bg-soft);
  cursor: pointer;
  box-shadow: 0 8px 16px rgba(83, 55, 94, 0.06);
}

.calendar-chip-active {
  background: var(--accent-main);
  color: var(--text-main);
}

.calendar-chip-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
}

.calendar-chip-add {
  background: var(--bg-soft);
}

.chip-icon-btn {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 0.72rem;
}

/* MAIN LAYOUT */

.main-layout {
  display: block;
  position: relative;
}

/* Calendar layout */

.calendar-layout {
  margin-top: 10px;
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(260px, 1.3fr);
  gap: 16px;
}

/* Calendar card */

.calendar-panel {
  background: var(--bg-soft);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  padding: 14px 16px 18px;
}

.calendar-header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.month-switcher {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  border: none;
  border-radius: 999px;
  background: #f3e8ff;
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.month-label {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

#monthName {
  font-weight: 600;
}

#yearNumber {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.hint-text {
  margin: 0;
  font-size: 0.74rem;
  color: var(--text-muted);
}

/* Calendar grid */

.calendar {
  margin-top: 8px;
}

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.calendar-weekdays span {
  text-align: center;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
}

.calendar-day {
  background: var(--bg-tile);
  border-radius: 12px;
  min-height: 74px;
  padding: 4px 6px 6px;
  font-size: 0.78rem;
  position: relative;
  box-shadow: 0 6px 15px rgba(83, 55, 94, 0.08);
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.calendar-day:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(83, 55, 94, 0.18);
}

.calendar-day.empty {
  background: transparent;
  box-shadow: none;
  cursor: default;
}

/* Day header row */

.calendar-day-number-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.calendar-day-number {
  font-size: 0.8rem;
}

.calendar-day-today-pill {
  font-size: 0.62rem;
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
}

/* Today + selected */

.calendar-day.today {
  border: 1px solid var(--accent-main);
}

.calendar-day.selected {
  outline: 2px solid #2c2540;
}

/* Day chips */

.day-event-chips {
  margin-top: 4px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.day-event-chip {
  border-radius: 999px;
  padding: 2px 7px;
  font-size: 0.68rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.day-event-chip-completed {
  opacity: 0.6;
  text-decoration: line-through;
}

.day-more-chip {
  font-size: 0.68rem;
  color: var(--text-muted);
}

/* DAY ITEMS PANEL */

.day-items-panel {
  background: var(--bg-soft);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  padding: 14px 14px 18px;
}

.day-items-panel h2 {
  margin: 0 0 6px;
  font-size: 1rem;
}

.day-items-list {
  max-height: 380px;
  overflow: auto;
  padding-right: 3px;
}

.item-card {
  border-radius: 16px;
  border-left: 4px solid var(--accent-main);
  padding: 6px 9px 7px;
  background: var(--bg-panel);
  margin-bottom: 6px;
  font-size: 0.78rem;
  box-shadow: 0 8px 20px rgba(83, 55, 94, 0.08);
}

.item-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 3px;
}

.item-type-pill {
  border-radius: 999px;
  padding: 2px 6px;
  font-size: 0.65rem;
  background: var(--accent-soft);
  color: var(--accent-strong);
  margin-right: 6px;
}

.item-time {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.item-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.item-complete-checkbox {
  width: 14px;
  height: 14px;
}

.item-delete-btn {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 0.8rem;
  color: #c64863;
}

.item-title {
  font-size: 0.8rem;
}

.item-completed .item-title {
  text-decoration: line-through;
  opacity: 0.7;
}

/* TABLE VIEW */

.view-section {
  display: block;
}

.view-hidden {
  display: none;
}

.table-wrapper-card {
  margin-top: 10px;
  background: var(--bg-soft);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  padding: 14px 16px 18px;
}

.table-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.table-header h2 {
  margin: 0;
}

.table-subtitle {
  margin: 2px 0 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.table-filters {
  display: flex;
  gap: 10px;
  font-size: 0.78rem;
}

.table-filters select {
  font-size: 0.78rem;
  border-radius: 999px;
  border: 1px solid var(--border-soft);
  padding: 3px 8px;
}

.table-scroll {
  margin-top: 10px;
  max-height: none;
  overflow: visible;
}

.items-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}

.items-table th,
.items-table td {
  padding: 6px 8px;
  border-bottom: 1px solid rgba(243, 215, 240, 0.8);
}

.items-table th {
  text-align: left;
  font-size: 0.76rem;
  color: var(--text-muted);
}

.table-input,
.table-select {
  width: 100%;
  border-radius: 8px;
  border: 1px solid var(--border-soft);
  padding: 4px 6px;
  font-size: 0.76rem;
  background: var(--row-bg);
}

.table-time-cell {
  display: flex;
  align-items: center;
  gap: 6px;
}

.table-all-day-label {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.7rem;
  color: var(--text-muted);
}

.table-complete-checkbox {
  width: 14px;
  height: 14px;
}

.table-view-btn, .table-delete-btn, .table-new-add {
  background: var(--btn-bg);
  color: var(--btn-text)
}

.table-view-btn:hover, .table-delete-btn:hover, .table-new-add:hover {
  background: var(--btn-bg-hover);
  color: var(--btn-accent-text)
}

.table-add-btn {
  border-radius: 999px;
  border: none;
  padding: 3px 8px;
  font-size: 0.74rem;
  cursor: pointer;
  background: var(--btn-bg);
  color: var(--accent-main);
}

.table-new-row td {
  background: var(--row-bg);
}

/* HABIT VIEW */

.habit-wrapper-card {
  margin-top: 10px;
  background: var(--bg-soft);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  padding: 14px 16px 18px;
}

.habit-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
}

.habit-subtitle {
  margin: 2px 0 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.habit-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 0.78rem;
}

.habit-controls select,
.habit-controls input[type="color"] {
  border-radius: 999px;
  border: 1px solid var(--border-soft);
  padding: 3px 8px;
  font-size: 0.76rem;
  background: var(--bg-soft);
}

/* Habit body */

.habit-body {
  margin-top: 12px;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 2.2fr);
  gap: 16px;
}

/* Habit side list */

.habit-side-title {
  margin: 0 0 6px;
  font-size: 0.86rem;
}

.habit-list {
  list-style: none;
  padding: 0;
  margin: 0 0 8px;
  max-height: 200px;
  overflow: auto;
}

.habit-list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  margin-bottom: 4px;
  border-radius: 10px;
  background: var(--bg-soft);
  box-shadow: 0 6px 16px rgba(83, 55, 94, 0.08);
}

.habit-list-label {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

.habit-color-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
}

.habit-delete-btn {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 0.78rem;
  color: #d7446c;
}

.habit-form {
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.habit-input {
  border-radius: 12px;
  border: 1px solid var(--border-soft);
  padding: 6px 10px;
  font-size: 0.8rem;
  background: var(--bg-soft);
}

.habit-add-btn {
  align-self: flex-start;
}

/* Habit tabs */

.habit-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 6px;
}

.habit-tab {
  border-radius: 999px;
  border: none;
  padding: 3px 9px;
  font-size: 0.74rem;
  cursor: pointer;
  background: var(--bg-soft);
  color: var(--text-main);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.habit-tab-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
}

.habit-tab.active {
  background: var(--accent-main);
  color: var(--text-main);
}

/* Habit grid */

.habit-grid-wrapper {
  background: var(--bg-soft);
  border-radius: 16px;
  padding: 10px 10px 12px;
  box-shadow: 0 10px 26px rgba(83, 55, 94, 0.12);
}

.habit-grid {
  margin-top: 6px;
  max-height: 310px;
  overflow: auto;
  padding: 4px 4px 4px 0;
}

.habit-grid-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.habit-grid-meta-left {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* little donut */

.habit-progress-pie {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: conic-gradient(var(--accent-main) 0 110deg, rgba(0, 0, 0, 0.12) 110deg 360deg);
}

.habit-progress-pie-inner {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: var(--bg-soft);
  font-size: 0.68rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Habit rows */

.habit-row {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 4px;
  align-items: center;
  margin-bottom: 2px;
}

.habit-row-label {
  font-size: 0.75rem;
  color: var(--text-main);
  padding-right: 4px;
}

.habit-row-cells {
  display: flex;
  gap: 2px;
}

/* Habit cells */

.habit-cell {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: 1px solid var(--border-soft);
  background: transparent;
  padding: 0;
  cursor: pointer;
}

.habit-cell-filled {
  border-color: transparent;
}

/* Layout variants */

.habit-layout-graph .habit-row-cells .habit-cell {
  border-radius: 999px;
}

.habit-layout-hive .habit-row-cells .habit-cell {
  border-radius: 6px;
}

.habit-layout-tree .habit-row-cells .habit-cell {
  border-radius: 999px 999px 4px 4px;
}

/* Shape variants */

.habit-shape-circle .habit-cell,
.habit-shape-circle .habit-progress-pie,
.habit-shape-circle .habit-progress-pie-inner {
  border-radius: 999px;
}

.habit-shape-rounded .habit-cell {
  border-radius: 8px;
}

/* Font variants */

.habit-font-soft .habit-row-label {
  font-family: "Segoe Script", "Comic Sans MS", system-ui;
}

.habit-font-mono .habit-row-label {
  font-family: "JetBrains Mono", "SF Mono", Menlo, monospace;
}

/* Year mode table */

.habit-year-table {
  overflow: auto;
}

.habit-year-grid {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.72rem;
}

.habit-year-grid th,
.habit-year-grid td {
  padding: 2px 3px;
  border-bottom: 1px solid #f3e6ff;
}

.habit-year-grid th {
  position: sticky;
  top: 0;
  background: var(--bg-soft);
}

.habit-year-grid .month-sticky {
  position: sticky;
  left: 0;
  background: var(--bg-soft);
}

.habit-year-cell-btn {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  border: 1px solid #f3d7f0;
  padding: 0;
  background: transparent;
  cursor: pointer;
}

.habit-year-cell-btn.filled {
  border-color: transparent;
}

.habit-year-cell-btn.disabled {
  opacity: 0;
  border-color: transparent;
  cursor: default;
}

/* Habit graph */

.habit-graph-card {
  margin-top: 8px;
  padding: 8px 10px 10px;
  border-radius: 14px;
  background: var(--bg-soft);
}

.habit-graph-title {
  font-size: 0.8rem;
  margin-bottom: 4px;
}

.habit-graph-legend {
  margin-top: 4px;
  font-size: 0.74rem;
  color: var(--text-muted);
}

/* TIMER VIEW */

.timer-wrapper-card {
  margin-top: 10px;
  background: var(--bg-soft);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  padding: 14px 16px 18px;
}

.timer-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.timer-subtitle {
  margin: 2px 0 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

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

.btn {
  border-radius: 999px;
  border: none;
  padding: 6px 12px;
  font-size: 0.8rem;
  cursor: pointer;
}

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

.timer-btn-secondary,
.pomodoro-btn-secondary {
  background: #f3e6ff;
}

.timer-body {
  margin-top: 12px;
}

.timer-card {
  max-width: 460px;
  margin: 0 auto;
  background: #1e1630;
  border-radius: 24px;
  padding: 18px 18px 16px;
  color: var(--text-main);
  box-shadow: 0 22px 46px rgba(5, 0, 22, 0.7);
}

/* Pomodoro internal */

.pomodoro-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.pomodoro-title {
  font-weight: 500;
}

.pomodoro-mascot-select {
  border-radius: 999px;
  border: none;
  padding: 4px 8px;
  font-size: 0.78rem;
  background: rgba(47, 34, 78, 0.9);
  color: var(--text-main);
}

.pomodoro-circle {
  width: 180px;
  height: 180px;
  border-radius: 999px;
  background: radial-gradient(circle at 30% 20%, #ffecff 0, #fbbad5 30%, #3b264d 70%, #140b26 100%);
  margin: 0 auto 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.55);
}

.pomodoro-circle-lg {
  width: 200px;
  height: 200px;
}

.pomodoro-emoji {
  font-size: 2.5rem;
  margin-bottom: 2px;
}

.pomodoro-time {
  font-size: 1.7rem;
  font-weight: 600;
}

.pomodoro-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 10px;
}

.pomodoro-btn {
  background: #ffd4e4;
  color: #32182a;
}

.pomodoro-duration-select {
  border-radius: 999px;
  border: none;
  padding: 4px 9px;
  font-size: 0.78rem;
  background: rgba(47, 34, 78, 0.9);
  color: #f7ebff;
}

.timer-extra-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  font-size: 0.78rem;
  margin-bottom: 8px;
}

.timer-extra select,
.timer-extra input[type="checkbox"] {
  margin-left: 4px;
}

.timer-extra select {
  border-radius: 999px;
  border: none;
  padding: 3px 7px;
  font-size: 0.76rem;
  background: rgba(47, 34, 78, 0.9);
  color: #f7ebff;
}

.timer-status {
  text-align: center;
  font-size: 0.8rem;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

/* FLOATING PANELS */

.floating-panel {
  position: fixed;
  right: 18px;
  bottom: 16px;
  width: 260px;
  border-radius: 18px;
  background: var(--bg-panel);
  box-shadow: 0 18px 40px rgba(83, 55, 94, 0.26);
  z-index: 50;
}

.floating-panel-mini {
  width: 230px;
}

.floating-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 10px;
  border-bottom: 1px solid #f3e6ff;
  cursor: grab;
}

.floating-body {
  padding: 8px 10px 10px;
}

.panel-toggle-btn {
  border-radius: 999px;
  border: none;
  padding: 2px 6px;
  font-size: 0.76rem;
  cursor: pointer;
  background: #f3e6ff;
}

/* Panel collapsed */

.panel-collapsed .floating-body {
  display: none;
}

/* Item form */

.item-form .field {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-bottom: 6px;
  font-size: 0.76rem;
}

.item-form span {
  color: var(--text-main);
}

.item-form input,
.item-form select {
  border-radius: 10px;
  border: 1px solid var(--border-soft);
  padding: 4px 8px;
  font-size: 0.76rem;
}

.field-inline {
  flex-direction: row;
  align-items: center;
  gap: 6px;
}

.pill-toggle-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.pill-toggle {
  border-radius: 999px;
  border: none;
  padding: 3px 8px;
  font-size: 0.76rem;
  background: var(--accent-main);
  color: #fff;
  cursor: pointer;
}

.pill-toggle-off {
  background: #f3e6ff;
  color: #6d5c8b;
}

.time-input.time-disabled {
  opacity: 0.5;
}

/* MINI TIMER */

.mini-timer-body {
  font-size: 0.78rem;
}

.mini-timer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.mini-emoji {
  font-size: 1.4rem;
}

.mini-time {
  font-weight: 600;
}

.mini-timer-controls {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

.mini-actions {
  display: flex;
  gap: 4px;
}

/* PANIC OVERLAY */

.panic-overlay {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at top left, rgba(255, 172, 193, 0.28), transparent 60%),
    radial-gradient(circle at bottom right, rgba(178, 196, 255, 0.26), transparent 55%),
    #070511;
  z-index: 100;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding-top: 40px;
}

.panic-inner {
  width: min(960px, 100% - 32px);
  background: var(--bg-soft);
  border-radius: 20px;
  box-shadow: 0 24px 60px rgba(45, 30, 77, 0.45);
  padding: 14px 16px 16px;
  position: relative;
  overflow: hidden;
}

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

.panic-title {
  font-weight: 600;
}

.panic-exit-btn {
  background: #f4a9c7;
  color: #fff;
}

.panic-content {
  font-size: 0.9rem;
  color: #333;
  background: rgba(9, 6, 20, 0.96);
  border-radius: 22px;
  padding: 26px 26px 20px;
  box-shadow: 0 26px 70px rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.08);
  width: min(460px, 100% - 32px);
  position: relative;
  text-align: center;   /* <-- add this */
}

/* TIMER FULLSCREEN OVERLAY */

.timer-fullscreen-overlay {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at top left, rgba(255, 172, 193, 0.24), transparent 60%),
    radial-gradient(circle at bottom right, rgba(178, 196, 255, 0.24), transparent 55%),
    rgba(9, 6, 20, 0.98);
  z-index: 120;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 22px 18px 28px;
  overflow: hidden;
}

.timer-fullscreen-inner {
  width: min(980px, 100%);
  margin-top: 6px;
  position: relative;
  z-index: 2;
}

.timer-fullscreen-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  color: #f7ebff;
}

.timer-fullscreen-title {
  font-size: 0.9rem;
}

/* Emoji field (background floaties) */

.emoji-field {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}

.emoji-float {
  position: absolute;
  animation-name: floatEmoji;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
}

/* When body is in timer full-screen, adjust timer card */

body.timer-fullscreen-mode .timer-wrapper-card {
  background: transparent;
  box-shadow: none;
  padding: 0;
}

body.timer-fullscreen-mode .timer-header {
  display: none;
}

body.timer-fullscreen-mode .timer-card {
  max-width: 520px;
}

/* Float animation */

@keyframes floatEmoji {
  0% {
    transform: translateY(0) translateX(0);
  }
  50% {
    transform: translateY(-40px) translateX(10px);
  }
  100% {
    transform: translateY(40px) translateX(-6px);
  }
}

/* UTILITIES */

.hidden {
  display: none !important;
}

.no-select {
  user-select: none;
}

/* RESPONSIVE */

@media (max-width: 880px) {
  .app-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .header-right {
    flex-wrap: wrap;
  }

  .calendar-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .day-items-panel {
    order: -1;
  }

  .habit-body {
    grid-template-columns: minmax(0, 1fr);
  }

  .floating-panel {
    right: 10px;
    left: 10px;
    width: auto;
  }
}

/* Table completed state */
.items-table tr.table-row-completed .table-input-title {
  text-decoration: line-through;
  opacity: 0.6;
}

.items-table tr.table-row-completed {
  --row-bg: rgba(250, 223, 240, 0.18);
}


/* TABLE APPLY BUTTON */
.table-apply-btn{
  padding:6px 12px;
  border-radius:999px;
  border:1px solid var(--border-soft);
  background:var(--accent-main);
  color:#fff;font-size:0.78rem;
  box-shadow:0 10px 20px rgba(83,55,94,0.12)}

.table-apply-btn:hover{
  filter:brightness(0.98)
}

/* PRIVATE MODE (blur text so it can't be read) */
body.mode-private .item-title,
body.mode-private .day-event-chip,
body.mode-private .day-more-chip,
body.mode-private .table-input-title,
body.mode-private .table-new-title{
  filter: blur(7px);
}
body.mode-private .item-title,
body.mode-private .day-event-chip,
body.mode-private .day-more-chip{
  user-select: none;
}

/* FOCUS OVERLAY (cute emoji background, uses current theme background) */
.focus-overlay{
  position:fixed;
  inset:0;
  z-index:110;
  display:flex;
  justify-content:center;
  align-items:flex-start;
  padding-top:40px;
  background: var(--bg-body);
}
body[data-bgmode="gradient"] .focus-overlay{
  background: radial-gradient(120% 120% at 0 0, rgba(255,255,255,0.86) 0, var(--bg-body) 55%, var(--bg-body) 100%);
}
body[data-theme="dark"][data-bgmode="gradient"] .focus-overlay{
  background: radial-gradient(120% 120% at 0 0, rgba(196, 157, 255, 0.18) 0, var(--bg-body) 55%, var(--bg-body) 100%);
}
.focus-inner{
  width:min(960px, 100% - 32px);
  background: var(--bg-card);
  border-radius: 20px;
  box-shadow: var(--shadow-soft);
  padding: 14px 16px 16px;
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border-soft);
}
.focus-bar{
  display:flex;
  justify-content:space-between;
  align-items:center;
  margin-bottom: 8px;
}
.focus-title{font-weight:600;}
.focus-exit-btn{
  background: var(--bg-body);
  border: 1px solid var(--border-soft);
  color: var(--text-main);
}
.focus-content{
  font-size:0.9rem;
  color: var(--text-main);
  background: var(--bg-soft);
  border-radius: 22px;
  padding: 26px 26px 20px;
  border: 1px solid var(--border-soft);
  width: min(520px, 100% - 32px);
  margin: 0 auto;
  text-align:center;
  position: relative;
}

/* HABITS: remove internal scroll areas */
.habit-list{
  max-height: none !important;
  overflow: visible !important;
}

.habit-grid{
  max-height: none !important;
  overflow: visible !important;
}

.habit-grid-wrapper{
  overflow: visible !important;
}

:root {
  /* BUTTON COLORS – LIGHT MODE */
  --btn-bg: rgba(255, 255, 255, 0.95);
  --btn-text: var(--text-main);
  --btn-border: var(--border-soft);
  --btn-shadow: 0 8px 18px rgba(83, 55, 94, 0.12);

  --btn-bg-hover: rgba(255, 255, 255, 1);
  --btn-bg-active: rgba(240, 230, 255, 0.95);

  --btn-accent-bg: var(--accent-main);
  --btn-accent-text: #fff;
  --title-color: #ffffff;

}


/* GLOBAL BUTTON STYLING */
button,
.btn {
  background: var(--btn-bg);
  color: var(--btn-text);
  border: 1px solid var(--btn-border);
  border-radius: 999px;
  box-shadow: var(--btn-shadow);
  cursor: pointer;
  transition:
    background 0.18s ease,
    color 0.18s ease,
    box-shadow 0.18s ease,
    transform 0.12s ease;
}

button:hover,
.btn:hover {
  background: var(--btn-bg-hover);
}

button:active,
.btn:active {
  background: var(--btn-bg-active);
  transform: translateY(1px);
}

/* Accent buttons (primary actions) */
.btn.primary,
button.primary {
  background: var(--btn-accent-bg);
  color: var(--btn-accent-text);
  border-color: transparent;
}

.btn.primary:hover,
button.primary:hover {
  filter: brightness(1.05);
}

.icon-btn {
  background: transparent;
  border: none;
  box-shadow: none;
}

/* ===== AUTH (SUPABASE) MENU ===== */
.auth-wrap{
  position: fixed !important;
  top: 14px !important;
  right: 14px !important;
  left: auto !important;
  z-index: 99999 !important;
}

.auth-toggle{
  border: none;
  background: rgba(0,0,0,0.06);
  color: var(--text-main);
  border-radius: 12px;
  padding: 8px 10px;
  cursor: pointer;
  font-size: 16px;
  box-shadow: 0 10px 24px rgba(83,55,94,0.12);
}
body[data-theme="dark"] .auth-toggle{ background: rgba(255,255,255,0.08); }

.auth-panel{
  position: absolute;
  left: 0;
  top: calc(100% + 10px);
  width: 260px;
  background: var(--bg-soft);
  border: 1px solid rgba(0,0,0,0.10);
  box-shadow: 0 12px 30px rgba(0,0,0,0.12);
  border-radius: 14px;
  padding: 12px;
  z-index: 9999;
}
body[data-theme="dark"] .auth-panel{
  border-color: rgba(255,255,255,0.12);
  box-shadow: 0 12px 30px rgba(0,0,0,0.35);
}
.auth-title{ 
  font-weight: 700; 
  margin-bottom: 6px; 
  color: var(--text-main); 
}

.auth-status{ 
  font-size: 0.85rem; 
  color: var(--text-muted); 
  margin-bottom: 10px; 
}

.auth-label{ 
  display:block; 
  font-size: 0.78rem; 
  color: var(--text-muted); 
  margin: 6px 0 4px; 
}

.auth-input{
  width: 100%;
  padding: 10px 10px;
  border-radius: 12px;
  border: 1px solid rgba(0,0,0,0.12);
  background: rgba(0,0,0,0.03);
  color: var(--text-main);
  outline: none;
}
body[data-theme="dark"] .auth-input{
  border-color: rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.06);
}
.auth-btn{
  width: 100%;
  margin-top: 10px;
  padding: 10px 10px;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 600;
  background: rgba(0,0,0,0.10);
  color: var(--text-main);
}
body[data-theme="dark"] .auth-btn{ 
  background: rgba(255,255,255,0.10); 
}

.auth-btn-ghost{ 
  background: transparent; 
  border: 1px solid rgba(0,0,0,0.12); 
}

body[data-theme="dark"] .auth-btn-ghost{ 
  border-color: rgba(255,255,255,0.12); 
}

.auth-help{ 
  margin-top: 10px; 
  font-size: 0.75rem; 
  color: var(--text-muted); 
  line-height: 1.2rem; 
}

.hidden{ 
  display:none !important; 
}

/* TABLE text follows theme palette */
#tableView, 
#tableView * {
  color: var(--text-main);
}

#tableView th,
#tableView td {
  color: var(--text-main);
}

/* ===== Smooth open/close animation for the auth dropdown ===== */
.auth-panel{
  right: 0 !important;   /* dropdown aligns to the right edge */
  left: auto !important;

  /* animation */
  opacity: 1;
  transform: translateY(0) scale(1);
  transition: opacity 160ms ease, transform 160ms ease;
  transform-origin: top right;
}

/* Instead of display:none, animate hidden state */
.auth-panel.hidden{
  display: block !important;         /* keep it in layout so it can animate */
  opacity: 0;
  transform: translateY(-6px) scale(0.98);
  pointer-events: none;
}

/* =========================
   MOBILE UX FIXES
   ========================= */
@media (max-width: 700px) {

  /* page padding */
  body {
    padding: 12px !important;
  }

  /* keep top controls from overflowing */
  .top-controls,
  .top-bar,
  .header-controls,
  .nav-row {
    flex-wrap: wrap !important;
    gap: 10px !important;
    justify-content: center !important;
  }

  /* title area */
  .title-wrap,
  .hero,
  header {
    text-align: center !important;
    align-items: center !important;
  }

  h1, .title, .app-title {
    font-size: 1.8rem !important;
    line-height: 1.15 !important;
  }

  /* calendar chips row should scroll horizontally (like iOS pills) */
  .calendar-tabs,
  #calendarTabs,
  .calendar-chip-row,
  .calendars-row {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
    padding-bottom: 6px;
    scrollbar-width: none;
  }
  .calendar-tabs::-webkit-scrollbar,
  #calendarTabs::-webkit-scrollbar {
    display: none;
  }

  /* prevent chips from wrapping into ugly stacked rows */
  .calendar-chip,
  .calendar-pill {
    flex: 0 0 auto !important;
  }

  /* main layout: stack columns */
  .layout,
  .main-grid,
  .content-grid,
  .dashboard {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 14px !important;
  }

  /* cards should fill screen */
  .card,
  .panel,
  .calendar-card,
  .today-card,
  .items-card {
    width: 100% !important;
    max-width: 100% !important;
    border-radius: 18px !important;
  }

  /* calendar grid: tighter, still tappable */
  .calendar-grid {
    gap: 8px !important;
  }

  .day-cell,
  .calendar-day,
  .cal-day {
    min-height: 58px !important;
    border-radius: 14px !important;
  }

  .day-number {
    font-size: 0.85rem !important;
  }

  /* table view: make it scroll horizontally instead of squishing */
  .planner-table-wrap,
  .table-wrap,
  #tableView table {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  /* keep bottom “Add item” bar usable */
  .add-item-panel,
  .add-item-drawer,
  #addItemPanel {
    width: calc(100% - 24px) !important;
    left: 12px !important;
    right: 12px !important;
    border-radius: 18px !important;
  }

  /* auth icon (person) safe on mobile */
  .auth-wrap{
    top: 12px !important;
    right: 12px !important;
    left: auto !important;
  }

  .auth-panel{
    right: 0 !important;
    left: auto !important;
    width: min(92vw, 320px) !important;
  }
}

@media (max-width: 700px) {
  * {
    -webkit-tap-highlight-color: transparent;
  }
  button, .calendar-chip {
    touch-action: manipulation;
  }
}
