/* =========================================
   AGENDA GHISOLFI
   Creative Studio — customizable design
========================================= */

:root {
  --background: #F0EDF5;
  --text: #353044;
  --primary: #9275D9;

  --planner: #F4B5D0;
  --routines: #C5B3ED;
  --glish: #91B9EA;
  --career: #F4A98C;
  --selfcare: #E994B5;
  --home: #E9CD65;
  --shopping: #D98DC5;
  --finance: #8DC9AE;
  --goals: #A8A9E8;
  --projects: #F6D5A7;
  --notes: #9BCDCB;
  --calendar: #F5CEDD;

  --panels: #FAF7FC;
  --sidebar: #E8E1F2;
  --completed: #8DC9AE;
  --pending: #E9CD65;
  --urgent: #E58A9B;

  --border: color-mix(in srgb, var(--text) 12%, transparent);
  --muted: color-mix(in srgb, var(--text) 70%, var(--background));
  --shadow: 0 8px 30px rgba(40, 30, 60, 0.05);

  --radius-small: 10px;
  --radius-medium: 16px;
  --radius-large: 24px;

  --sidebar-width: 245px;
}

/* RESET */

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--background);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  line-height: 1.6;
}

h1, h2, h3, h4 {
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  line-height: 1.2;
  margin: 0 0 12px;
}

p {
  margin: 0 0 12px;
}

a {
  color: var(--text);
}

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

button {
  cursor: pointer;
  color: var(--text);
  transition: background 0.2s, transform 0.2s,
    box-shadow 0.2s;
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

button:focus-visible,
a:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 3px;
}

/* BUTTONS */

button {
  border: 1px solid var(--border);
  background: var(--panels);
  padding: 10px 16px;
  border-radius: var(--radius-small);
}

button:not(:disabled):hover {
  filter: brightness(0.97);
}

.primary-button {
  background: var(--primary);
  color: var(--text);
  border: none;
  border-radius: var(--radius-small);
  padding: 12px 20px;
  font-weight: 600;
  text-align: center;
}

/* FORMS */

label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 600;
}

input,
textarea,
select {
  width: 100%;
  padding: 12px 14px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  background: var(--panels);
  color: var(--text);
  outline: none;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px
    color-mix(in srgb, var(--primary) 20%, transparent);
}

input::placeholder,
textarea::placeholder {
  color: var(--muted);
}

textarea {
  min-height: 100px;
  resize: vertical;
}

input[type="checkbox"],
input[type="radio"] {
  width: 17px;
  height: 17px;
  margin: 0;
  accent-color: var(--primary);
  cursor: pointer;
}

/* LOGIN */

.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(
      circle at 10% 20%,
      var(--planner),
      transparent 35%
    ),
    radial-gradient(
      circle at 90% 80%,
      var(--routines),
      transparent 40%
    ),
    var(--background);
}

.login-card {
  width: 100%;
  max-width: 420px;
  padding: 42px;
  background: var(--panels);
  border-radius: 30px;
  box-shadow: var(--shadow);
}

.login-card h1 {
  font-size: 34px;
  letter-spacing: -1.5px;
}

.login-card > p {
  color: var(--muted);
  margin-bottom: 30px;
}

.brand-flower {
  display: inline-block;
  color: var(--primary);
  font-size: 38px;
  line-height: 1;
}

.login-card .brand-flower {
  font-size: 65px;
  margin-bottom: 20px;
}

.login-card .primary-button {
  width: 100%;
}

/* APPLICATION LAYOUT */

.app-layout {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 100vh;
}

/* SIDEBAR */

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  background: var(--sidebar);
  padding: 26px 18px;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  z-index: 100;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 8px 25px;
}

.brand h2 {
  font-size: 20px;
  letter-spacing: -0.8px;
  margin: 0;
}

.brand .brand-flower {
  font-size: 28px;
}

#navigation {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.menu-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--muted);
  margin: 20px 12px 6px;
}

#navigation button {
  width: 100%;
  text-align: left;
  padding: 10px 14px;
  border: none;
  background: transparent;
  border-radius: 9px;
}

#navigation button:hover {
  background: var(--panels);
}

#navigation button.active {
  background: var(--primary);
  font-weight: 700;
}

#logout-button {
  margin-top: 24px;
  width: 100%;
  background: transparent;
}

/* MAIN CONTENT */

.main-content {
  width: 100%;
  min-width: 0;
  max-width: 1600px;
  padding: 32px 38px;
  margin: 0 auto;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-bottom: 28px;
}

#current-date {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}

#page-title {
  font-size: 34px;
  letter-spacing: -1.2px;
  margin: 0;
}

#menu-toggle {
  display: none;
}

/* WELCOME CARD */

.welcome-card {
  background: linear-gradient(
    120deg,
    var(--planner),
    var(--routines)
  );
  padding: 34px;
  border-radius: var(--radius-large);
  margin-bottom: 24px;
}

.welcome-card h2 {
  font-size: clamp(26px, 4vw, 42px);
  letter-spacing: -1.4px;
  margin: 10px 0;
}

.welcome-card p {
  margin: 0;
}

/* STATISTICS */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.stat-card {
  padding: 20px;
  min-height: 125px;
  border-radius: var(--radius-medium);
}

.stat-card p {
  font-size: 12px;
  font-weight: 500;
}

.stat-card h2 {
  font-size: 36px;
  letter-spacing: -1px;
  margin: 0;
}

.stat-card.pink {
  background: var(--planner);
}

.stat-card.mint {
  background: var(--completed);
}

.stat-card.yellow {
  background: var(--pending);
}

.stat-card.lilac {
  background: var(--routines);
}

/* PANELS */

.panel {
  padding: 26px;
  background: var(--panels);
  border-radius: var(--radius-large);
  margin-bottom: 22px;
  box-shadow: var(--shadow);
}

.panel h2 {
  font-size: 22px;
  letter-spacing: -0.5px;
}

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

.section-title {
  margin: 28px 0 16px;
  font-size: 24px;
}

/* PERSONAL SPACES */

.spaces-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.space-card {
  position: relative;
  display: flex;
  align-items: flex-end;
  text-align: left;
  min-height: 110px;
  padding: 20px;
  border: none;
  border-radius: var(--radius-medium);
  font-family: 'Outfit', sans-serif;
  font-size: 18px;
  font-weight: 500;
}

.space-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

.space-card[data-color="planner"] {
  background: var(--planner);
}

.space-card[data-color="routines"] {
  background: var(--routines);
}

.space-card[data-color="glish"] {
  background: var(--glish);
}

.space-card[data-color="career"] {
  background: var(--career);
}

.space-card[data-color="selfcare"] {
  background: var(--selfcare);
}

.space-card[data-color="home"] {
  background: var(--home);
}

.space-card[data-color="shopping"] {
  background: var(--shopping);
}

.space-card[data-color="finance"] {
  background: var(--finance);
}

.space-card[data-color="goals"] {
  background: var(--goals);
}

.space-card[data-color="projects"] {
  background: var(--projects);
}

.space-card[data-color="notes"] {
  background: var(--notes);
}

.space-card[data-color="calendar"] {
  background: var(--calendar);
}

/* TASKS AND LISTS */

.task-item,
.habit-item,
.list-item,
.priority-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border-bottom: 1px solid var(--border);
  overflow-wrap: anywhere;
}

.task-item:last-child,
.habit-item:last-child,
.list-item:last-child {
  border-bottom: none;
}

.task-info {
  flex: 1;
  min-width: 0;
}

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

.task-meta,
.task-description,
.empty-state {
  font-size: 12px;
  color: var(--muted);
}

.task-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

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

.task-item.completed {
  background: color-mix(
    in srgb, var(--completed) 20%, transparent
  );
}

.priority-urgent {
  border-left: 4px solid var(--urgent);
}

.priority-high {
  border-left: 4px solid var(--career);
}

.priority-medium {
  border-left: 4px solid var(--pending);
}

.priority-low {
  border-left: 4px solid var(--completed);
}

.status-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  background: var(--sidebar);
}

.status-completed {
  background: var(--completed);
}

.status-pending {
  background: var(--pending);
}

.status-waiting {
  background: var(--career);
}

.empty-state {
  padding: 20px 0;
  text-align: center;
}

/* APPEARANCE */

.theme-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 22px 0;
}

.theme-colors-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 20px 0;
}

.color-field {
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: var(--radius-medium);
  padding: 15px;
  min-width: 0;
}

.color-label {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 12px;
}

.color-input-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.color-picker {
  appearance: none;
  -webkit-appearance: none;
  width: 44px;
  min-width: 44px;
  height: 44px;
  padding: 0;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
}

.color-picker::-webkit-color-swatch-wrapper {
  padding: 0;
}

.color-picker::-webkit-color-swatch {
  border: none;
  border-radius: 9px;
}

.color-picker::-moz-color-swatch {
  border: none;
  border-radius: 9px;
}

.hex-input {
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 10px 8px;
  font-family: monospace;
  font-size: 13px;
  text-transform: uppercase;
}

.hex-input:invalid:not(:placeholder-shown) {
  border-color: var(--urgent);
}

.theme-preview {
  padding: 25px;
  border-radius: var(--radius-large);
  background: var(--background);
  color: var(--text);
  border: 1px solid var(--border);
}

.theme-preview h3 {
  font-size: 26px;
  letter-spacing: -0.8px;
}

.theme-preview .space-card {
  min-height: 75px;
  font-size: 14px;
}

.theme-preview .primary-button {
  display: inline-block;
}

/* SAVED PALETTES */

#palette-form {
  margin-top: 20px;
}

#saved-palettes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 20px;
}

.palette-card {
  padding: 18px;
  background: var(--background);
  border-radius: var(--radius-medium);
  border: 1px solid var(--border);
}

.palette-swatches {
  display: flex;
  height: 32px;
  overflow: hidden;
  border-radius: 8px;
  margin: 12px 0;
}

.palette-swatches span {
  flex: 1;
}

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

/* INTEGRATIONS */

.integration-card {
  padding: 22px;
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: var(--radius-medium);
  margin-top: 16px;
}

#google-status,
#chatgpt-status {
  color: var(--muted);
  font-size: 12px;
}

/* TASK DIALOG */

dialog {
  width: min(540px, calc(100% - 32px));
  max-height: 90vh;
  max-height: 90dvh;
  overflow-y: auto;
  padding: 30px;
  background: var(--panels);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-large);
  box-shadow: 0 20px 80px rgba(30, 20, 40, 0.18);
}

dialog::backdrop {
  background: rgba(30, 20, 40, 0.4);
  backdrop-filter: blur(4px);
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

/* PROGRESS */

progress {
  width: 100%;
  height: 9px;
  appearance: none;
  border: none;
  border-radius: 20px;
  overflow: hidden;
  background: var(--sidebar);
}

progress::-webkit-progress-bar {
  background: var(--sidebar);
}

progress::-webkit-progress-value {
  background: var(--primary);
}

progress::-moz-progress-bar {
  background: var(--primary);
}

/* TABLES */

.table-wrapper {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th {
  font-size: 12px;
  font-weight: 600;
  background: var(--background);
}

/* MESSAGES */

#login-message,
#app-message,
#theme-message,
#task-message {
  font-size: 13px;
  overflow-wrap: anywhere;
}

[role="status"]:empty {
  display: none;
}

.error-message {
  color: var(--text);
  background: var(--urgent);
  padding: 10px;
  border-radius: 8px;
}

.success-message {
  color: var(--text);
  background: var(--completed);
  padding: 10px;
  border-radius: 8px;
}

/* SCROLLBAR */

::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}

::-webkit-scrollbar-thumb {
  background: var(--primary);
  border-radius: 10px;
}

/* TABLET */

@media (max-width: 1100px) {
  .main-content {
    padding: 26px;
  }

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

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

/* MOBILE */

@media (max-width: 760px) {
  .app-layout {
    display: block;
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: min(280px, 85vw);
    transform: translateX(-105%);
    visibility: hidden;
    transition: transform 0.25s ease,
      visibility 0.25s;
    box-shadow: var(--shadow);
  }

  .sidebar.open,
  .sidebar.is-open {
    transform: translateX(0);
    visibility: visible;
  }

  #menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
  }

  .main-content {
    padding: 18px;
  }

  .topbar {
    gap: 10px;
    flex-wrap: wrap;
  }

  #page-title {
    font-size: 25px;
  }

  #new-task-button {
    font-size: 12px;
    padding: 10px 12px;
  }

  .welcome-card {
    padding: 24px;
  }

  .spaces-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .space-card {
    min-height: 95px;
    padding: 16px;
    font-size: 16px;
  }

  .panel {
    padding: 20px;
  }

  .stat-card {
    padding: 16px;
    min-height: 100px;
  }

  .stat-card h2 {
    font-size: 28px;
  }

  .theme-colors-grid {
    grid-template-columns: 1fr;
  }

  #saved-palettes {
    grid-template-columns: 1fr;
  }

  .login-card {
    padding: 28px;
  }

  .task-item {
    flex-wrap: wrap;
  }

  input, textarea, select {
    font-size: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
    animation: none !important;
  }
}
#monthly-menu button{display:block;width:100%;text-align:left;margin:3px 0} #navigation button[hidden]{display:none!important}.monthly-controls,.vision-actions{display:flex;gap:8px;align-items:center;flex-wrap:wrap;margin-bottom:12px}.monthly-grid{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:5px}.monthly-grid>strong{text-align:center;font-size:12px}.monthly-day{min-height:95px;display:flex;flex-direction:column;align-items:stretch;text-align:left;overflow:hidden;padding:6px!important;border:1px solid #bcb0ce!important;background:transparent!important;color:inherit!important}.monthly-today,.monthly-selected{outline:2px solid #9275d9}.monthly-chip{display:block;font-size:11px;border-left:4px solid;padding:3px;overflow-wrap:anywhere}.vision-photos{--vision-columns:3}.vision-mosaic{columns:var(--vision-columns);column-gap:12px}.vision-photo{break-inside:avoid;margin-bottom:12px;overflow:hidden;border-radius:12px}.vision-photo img{display:block;width:100%;height:auto;object-fit:cover}.vision-grid{display:grid;grid-template-columns:repeat(var(--vision-columns),minmax(0,1fr));gap:12px}.vision-grid img{aspect-ratio:1;object-fit:cover}.vision-carousel{display:flex;overflow-x:auto;scroll-snap-type:x mandatory;gap:12px}.vision-carousel .vision-photo{flex:0 0 65%;scroll-snap-align:start}.vision-carousel img{height:320px}.vision-actions button{font-size:11px;padding:4px!important}.vision-actions{margin:5px 0}@media(max-width:600px){.vision-mosaic{columns:2}.vision-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.monthly-day{min-height:65px;padding:2px!important}.monthly-chip{font-size:9px}}

/* dashboard cover, separate from gallery editor */
#vision-board.cover-display{padding:0!important;background:transparent!important;box-shadow:none!important;border:0!important;overflow:hidden;border-radius:16px}#vision-board[hidden]{display:none!important}.cover-photos{display:grid;gap:5px;grid-template-columns:repeat(var(--vision-columns,3),minmax(0,1fr));grid-auto-rows:minmax(0,1fr);height:260px;overflow:hidden}.cover-small{height:160px}.cover-large{height:380px}.cover-photos img{width:100%;height:100%;min-height:0;object-fit:cover;display:block;border-radius:5px}.cover-mosaic{grid-template-rows:repeat(2,minmax(0,1fr));grid-auto-flow:column;grid-auto-columns:minmax(0,1fr)}.cover-mosaic img:first-child{grid-row:span 2}.cover-mosaic img:only-child{grid-column:1/-1}.cover-grid{grid-auto-flow:column;grid-template-rows:1fr;grid-auto-columns:minmax(0,1fr)}.cover-carousel{display:flex;overflow-x:auto;scroll-snap-type:x mandatory}.cover-carousel img{flex:0 0 65%;scroll-snap-align:start}@media(max-width:600px){.cover-photos{height:180px}.cover-small{height:110px}.cover-large{height:260px}}

/* full-width cover: balanced columns, no empty trailing tracks */
#vision-board.cover-display{width:100%;max-width:none;min-width:0;align-self:stretch;justify-self:stretch;grid-column:1/-1;box-sizing:border-box}
.cover-photos{width:100%;max-width:none;box-sizing:border-box;height:clamp(160px,19vw,280px)}
.cover-photos.cover-small{height:clamp(100px,12vw,170px)}
.cover-photos.cover-large{height:clamp(220px,26vw,380px)}
.cover-mosaic{grid-template-columns:repeat(var(--cover-cols,3),minmax(0,1fr));grid-auto-flow:column;grid-auto-columns:minmax(0,1fr);overflow-x:auto}
.cover-mosaic img:first-child{grid-row:span 2}
.cover-mosaic img:nth-child(even):last-child{grid-row:span 2}
.cover-grid{grid-template-columns:repeat(var(--grid-cols,3),minmax(0,1fr));grid-auto-columns:minmax(0,1fr);overflow-x:auto}
.cover-carousel img{flex:0 0 calc((100% - 10px)/3);min-width:0}
@media(max-width:600px){.cover-photos{height:160px}.cover-photos.cover-small{height:100px}.cover-photos.cover-large{height:220px}.cover-carousel img{flex-basis:75%}}

.cover-photo-frame{overflow:hidden;min-width:0;min-height:0;border-radius:5px;background:var(--panel,#faf7fc)}.cover-mosaic .cover-photo-frame:first-child,.cover-mosaic .cover-photo-frame:nth-child(even):last-child{grid-row:span 2}.cover-mosaic .cover-photo-frame:only-child{grid-column:1/-1}.cover-carousel .cover-photo-frame{flex:0 0 calc((100% - 10px)/3);scroll-snap-align:start}.cover-photo-frame img{width:100%;height:100%;border-radius:0}.photo-frame-dialog{width:min(560px,94vw);max-height:90vh;overflow:auto;border:0;border-radius:18px;padding:24px;background:#faf7fc;color:#353044}.photo-frame-dialog::backdrop{background:#0007}.photo-frame-form{display:grid;gap:12px}.photo-frame-preview{height:180px;overflow:hidden;background:#e8e1f2;border-radius:8px;cursor:grab}.photo-frame-preview img{width:100%;height:100%;display:block;pointer-events:none}.photo-frame-form label{display:block}.photo-frame-form input[type=range]{display:block;width:100%}.photo-frame-form .vision-actions{justify-content:flex-end}@media(max-width:600px){.cover-carousel .cover-photo-frame{flex-basis:75%}}

/* adaptive cover */
.cover-photos{gap:var(--cover-gap,5px)}
.cover-photos.cover-adaptive{display:flex;flex-direction:column;height:auto;overflow:visible;gap:var(--cover-gap,5px)}
.adaptive-row{display:flex;align-items:stretch;gap:var(--cover-gap,5px);min-width:0;width:100%;}
.cover-adaptive .cover-photo-frame{flex:1 1 0;min-width:0;height:auto;position:relative;max-height:380px;background:transparent;}
.cover-adaptive .cover-photo-frame img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;}
.cover-adaptive.cover-small .cover-photo-frame{max-height:170px}.cover-adaptive.cover-medium .cover-photo-frame{max-height:280px}
.cover-live-preview{margin:12px 0 20px;width:100%;overflow:hidden;border-radius:12px}.vision-editor-grid .vision-photo{cursor:grab}.photo-frame-preview{max-height:400px}.photo-frame-preview img{min-height:0}
