body {
    margin: 0;
    padding: 0;
    background-color: #FEFAE6;
    font-family: sans-serif;
}

.app-container {
    min-height: 100vh;
}

.header {
    background-color: #FAF4BD;
    color: #E87C3A;
    padding: 20px 24px;
  position: relative;
    display: flex;
  justify-content: flex-end;
    align-items: center;
}

.header h1 { margin: 0; font-size: 24px; font-weight: bold; }
.subtitle { margin: 4px 0 0; font-size: 13px; opacity: 0.8; }
.header-center {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
}
.header-right { text-align: right; }
.date-text { margin: 0; font-size: 13px; opacity: 0.8; }
.status-text { margin: 4px 0 0; font-size: 18px; font-weight: bold; }

.logo {
    width: 40px;
    height: 40px;
    margin-right: 12px;
}

.top-logo-button {
  position: fixed;
  top: 18px;
  left: 18px;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  border: 1px solid #324566;
  background: linear-gradient(130deg, #73A4DB, #33659C);
  box-shadow: 0 12px 28px #324566;
  display: grid;
  place-items: center;
  padding: 0;
  line-height: 0;
  cursor: pointer;
  z-index: 140;
}

.top-logo-button:focus-visible {
  outline: 2px solid #73A4DB;
  outline-offset: 2px;
}

.top-logo-icon {
  width: 30px;
  height: 30px;
  display: block;
  margin: 0;
  object-fit: contain;
  object-position: center;
}

.side-nav-overlay {
  position: fixed;
  inset: 0;
  background: #e87d3a78;
  backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.24s ease;
  z-index: 120;
}

.side-nav-panel {
  position: fixed;
  top: 0;
  left: 0;
  width: min(84vw, 320px);
  height: 100dvh;
  padding: 24px 20px;
  background: linear-gradient(170deg, #DB6D3A, #b64a18);
  border-right: 1px solid rgba(245, 239, 213, 0.2);
  text-align: right;
  box-shadow: 22px 0 44px rgba(0, 0, 0, 0.4);
  transform: translateX(-100%);
  transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
  z-index: 130;
  display: grid;
  align-content: start;
  gap: 14px;
}

.side-nav-title {
  margin: 0;
  font-family: "Cinzel", Georgia, serif;
  font-size: 1.1rem;
  letter-spacing: 0.1rem;
  color: #FAF4BD;
}

.side-nav-list {
  list-style: none;
  padding: 0;
  margin: 12px 0 0;
  display: grid;
  gap: 10px;
}

.side-nav-link {
  display: block;
  text-decoration: none;
  color: #FAF4BD;
  font-weight: 700;
  letter-spacing: 0.04em;
  border-radius: 12px;
  border: 1px solid rgba(245, 239, 213, 0.2);
  background: rgba(255, 255, 255, 0.04);
  padding: 12px 14px;
  transition: background 0.18s ease, transform 0.18s ease;
}

.side-nav-link:hover {
  background: rgba(245, 239, 213, 0.12);
  transform: translateX(-2px);
}

.side-nav-link:focus-visible {
  outline: 2px solid rgba(245, 239, 213, 0.7);
  outline-offset: 2px;
}

.nav-open .side-nav-overlay {
  opacity: 1;
  pointer-events: auto;
}

.nav-open .side-nav-panel {
  transform: translateX(0);
}

.main-content {
    max-width: 600px;
    margin: 0 auto;
    padding: 24px 16px;
}

.home-main-content {
  max-width: 1120px;
}

.progress-section { margin-bottom: 24px; }
.progress-labels {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
    font-size: 14px;
    color: #BE7961;
}

.progress-track {
    height: 10px;
    background-color: #FAF4BD;
    border-radius: 9999px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background-color: #E87C3A;
    border-radius: 9999px;
    transition: width 0.3s ease;
}

.card {
    background-color: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 1px 4px #BE7961;
}

.card h2 { margin: 0 0 12px; font-size: 16px; color: #BE7961; }

.habit-form {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: nowrap;
  width: 100%;
}

.habit-form > div {
  flex: 1 1 auto;
  min-width: 0;
}

#habit-input {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.frequency-field,
.target-date-field {
  flex: 1 1 auto;
  min-width: 0;
}

#frequency,
#target-date-input {
  width: 100%;
  box-sizing: border-box;
}

.target-date-label {
  display: block;
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 600;
  color: #be7961;
}
input {
    flex: 1;
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid #F3C248;
    color: #BE7961;
    font-size: 14px;
    outline: none;
}

  select {
    width: 100%;
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid #F3C248;
    color: #BE7961;
    font-size: 14px;
    outline: none;
    background-color: #fff;
  }

button#add-btn {
    padding: 10px 20px;
    background-color: #E87C3A;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    flex: 0 0 auto;
    white-space: nowrap;
    height: fit-content;
}

@media (max-width: 1024px) {
  .habit-form {
    gap: 10px;
  }
}

@media (max-width: 768px) {
  .habit-form {
    flex-wrap: wrap;
    gap: 12px;
  }

  .habit-form > div,
  .frequency-field,
  .target-date-field {
    flex: 1 1 100%;
    min-width: 0;
  }

  button#add-btn {
    flex: 1 1 100%;
    width: 100%;
  }
}

.empty-state {
    text-align: center;
    padding: 32px 0;
    color: #BE7961;
}

.habit-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.habit-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    border-radius: 10px;
    border: 2px solid #F3C248;
    background-color: #fafafa;
    transition: all 0.2s ease;
}

.habit-item.done {
    border-color: #E87C3A;
    background-color: #f5f3ff;
}

.check-btn {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid #F3C248;
    background-color: white;
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.habit-item.done .check-btn {
    background-color: #E87C3A;
    border-color: #E87C3A;
}

.habit-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.habit-name { font-size: 15px; color: #BE7961; }

.habit-meta {
    font-size: 12px;
    color: #BE7961;
}

.habit-item.done .habit-name {
    color: #E87C3A;
    text-decoration: line-through;
    opacity: 0.7;
}

.habit-item.done .habit-meta {
    color: #E87C3A;
    opacity: 0.8;
}

.badge {
    font-size: 12px;
    background-color: #ede9fe;
    color: #E87C3A;
    padding: 2px 8px;
    border-radius: 9999px;
    font-weight: 600;
}

.delete-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #d1d5db;
    font-size: 16px;
}

.weekly-table-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.week-range-label {
  margin: 0;
  font-size: 13px;
  color: #BE7961;
}

.weekly-check-table {
  overflow-x: auto;
}

.weekly-grid {
  width: 100%;
  min-width: 0;
  border-collapse: collapse;
  table-layout: fixed;
}

.weekly-grid th,
.weekly-grid td {
  border: 1px solid #f2dfb2;
  padding: 8px;
  text-align: center;
}

.weekly-grid thead th {
  background-color: #fff7e5;
  color: #8a5b47;
  font-size: 13px;
}

.weekly-grid .habit-col {
  text-align: left;
  width: 34%;
  min-width: 0;
}

.week-check-cell {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid #d9a57d;
  background: #ffffff;
  cursor: pointer;
  display: inline-block;
  transition: transform 0.15s ease, background-color 0.15s ease;
}

.week-check-cell:hover {
  transform: scale(1.05);
}

.week-check-cell.checked {
  background: #e87d3a;
  border-color: #e87d3a;
}

.edit-btn {
  background-color: #33659C;
  color: #FAF4BD;
  border: none;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.edit-btn:hover {
  background-color: #2b5788;
}

.edit-cancel-btn {
  background-color: #8b95a5;
}

.edit-cancel-btn:hover {
  background-color: #798394;
}

.habit-edit-form {
  flex: 1;
  display: grid;
  gap: 8px;
}

.habit-edit-dates {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 10px;
}

.habit-edit-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #8a5b47;
  margin-bottom: 4px;
}

.habit-edit-input {
  width: 100%;
  box-sizing: border-box;
}

.month-filter {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.month-label {
  font-size: 14px;
  color: #BE7961;
  font-weight: 600;
}

.month-picker {
  flex: 0 0 190px;
}

.week-empty {
  padding: 18px 8px;
}

.monthly-week-tables {
  display: grid;
  gap: 14px;
}

.month-week-block {
  border: 1px solid #f2dfb2;
  border-radius: 10px;
  padding: 10px;
  background-color: #fffef8;
}

.month-week-title {
  margin: 0 0 10px;
  font-size: 14px;
  color: #8a5b47;
}

.month-week-grid {
  min-width: 0;
  table-layout: fixed;
}

.month-week-grid .habit-col {
  width: 220px;
  min-width: 220px;
}

.unscheduled-td {
  background-color: #f5f0e3;
}

.month-week-grid th,
.month-week-grid td {
  min-width: 52px;
}

.unscheduled-cell {
  display: inline-block;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px dashed #e8d8b9;
  opacity: 0.7;
}