/* ========================================================
   НГТУ · КАЛЕНДАРЬ
   Точный визуальный стиль согласно макету (Фото 1)
   Адаптивность для телефонов и ПК (Touch / Keyboard / Wide)
   ======================================================== */

:root {
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  
  /* Primary & Neutral colors */
  --bg-app: #FFFFFF;
  --bg-page: #F6F7F9;
  --text-primary: #111111;
  --text-secondary: #767676;
  --text-muted: #8E8E93;
  --border-subtle: #EEEEEE;
  
  /* Categories colors (Photo 1 exact hex values) */
  /* Учёба */
  --study-accent: #C02626;
  --study-bg: #FDF2F2;
  
  /* События вуза */
  --event-accent: #657D2C;
  --event-bg: #F7F8EE;
  
  /* Личное */
  --personal-accent: #4A6B2F;
  --personal-bg: #F0F5E8;
  
  /* Reminder box */
  --reminder-bg: #FBF8F3;
  --reminder-border: #ECE7DE;
  
  /* Avatar */
  --avatar-bg: #EAEBDC;
  --avatar-text: #506428;
  
  /* Buttons */
  --btn-dark: #111111;
  --btn-dark-hover: #222222;
  
  /* Shadows & Radii */
  --shadow-card: 0 4px 18px rgba(0, 0, 0, 0.04);
  --shadow-modal: 0 20px 40px rgba(0, 0, 0, 0.16);
  --radius-card: 14px;
  --radius-btn: 9999px;
}

/* ========================================================
   Base Reset & Mobile Polish
   ======================================================== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-page);
  color: var(--text-primary);
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* ========================================================
   App Layout Wrapper (Centered phone preview on desktop)
   ======================================================== */
.app-layout {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
  padding: 0;
  transition: padding 0.25s ease;
}

.phone-frame {
  width: 100%;
  max-width: 440px;
  background: var(--bg-app);
  min-height: 100vh;
  min-height: 100dvh;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.07);
  display: flex;
  flex-direction: column;
  position: relative;
  transition: max-width 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s ease, border-radius 0.3s ease;
}

.screen-content {
  padding: max(20px, env(safe-area-inset-top, 20px)) max(22px, env(safe-area-inset-right, 22px)) max(28px, env(safe-area-inset-bottom, 28px)) max(22px, env(safe-area-inset-left, 22px));
  display: flex;
  flex-direction: column;
  flex: 1;
}

/* ========================================================
   App Header: "НГТУ · КАЛЕНДАРЬ", Toggle & Avatar
   ======================================================== */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
  gap: 12px;
}

.app-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.app-brand-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: #4B5E28;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}


/* Avatar Badge */
.avatar-badge {
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  border-radius: 50%;
  background: var(--avatar-bg);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.avatar-badge:hover {
  transform: scale(1.05);
  background: #E2E6D0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.avatar-badge:active {
  transform: scale(0.97);
}

.avatar-letter {
  font-size: 1rem;
  font-weight: 700;
  color: var(--avatar-text);
  line-height: 1;
}

/* ========================================================
   Main Column Wrappers (Adaptive 1-col mobile / 2-col desktop)
   ======================================================== */
.desktop-main-columns {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.calendar-column {
  display: flex;
  flex-direction: column;
}

.events-column {
  display: flex;
  flex-direction: column;
  flex: 1;
}

/* ========================================================
   Month Title & "сегодня" Row
   ======================================================== */
.month-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
}

.month-title-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
}

.month-title {
  font-size: 1.95rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  line-height: 1.1;
  user-select: none;
}

.month-nav-arrow {
  background: transparent;
  border: none;
  font-size: 1.4rem;
  line-height: 1;
  color: #A0A0A5;
  cursor: pointer;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  touch-action: manipulation;
  transition: all 0.15s ease;
  user-select: none;
}

.month-nav-arrow:hover {
  color: #111111;
  background: #F0F0F0;
  transform: scale(1.06);
}

.month-nav-arrow:active {
  transform: scale(0.94);
  background: #E5E5E5;
}

.today-indicator {
  background: transparent;
  border: 1px solid transparent;
  font-size: 0.95rem;
  color: var(--text-secondary);
  font-weight: 400;
  cursor: pointer;
  min-height: 44px;
  padding: 8px 12px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  touch-action: manipulation;
  transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
  user-select: none;
}

.today-indicator:hover {
  color: var(--text-primary);
  background: #F4F4F4;
  border-color: #EAEAEA;
}

.today-indicator:active {
  background: #EBEBEB;
}

/* ========================================================
   Calendar Weekdays & Grid
   ======================================================== */
.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  margin-bottom: 12px;
  user-select: none;
}

.weekday-col {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  padding: 4px 0;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  row-gap: 8px;
  column-gap: 2px;
  text-align: center;
  margin-bottom: 20px;
  outline: none;
  touch-action: pan-y pinch-zoom; /* Horizontal touch swipe supported */
}

.calendar-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  min-width: 40px;
  position: relative;
  cursor: pointer;
  user-select: none;
  touch-action: manipulation;
  border-radius: 10px;
  padding: 2px 0;
  transition: background-color 0.15s ease, transform 0.12s ease;
}

.calendar-cell:active {
  transform: scale(0.94);
}

.day-number {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.15s ease;
}

.calendar-cell.other-month .day-number {
  color: #CCCCCC;
}

.calendar-cell:hover .day-number {
  background: #F3F3F3;
  transform: scale(1.05);
}

/* Today circle (if not selected) */
.calendar-cell.is-today:not(.selected) .day-number {
  border: 1.5px solid #111111;
  font-weight: 700;
}

/* Selected day */
.calendar-cell.selected .day-number {
  background: #111111 !important;
  color: #FFFFFF !important;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}

/* Event indicator dots */
.cell-dots-wrap {
  display: flex;
  gap: 3px;
  align-items: center;
  justify-content: center;
  height: 6px;
  margin-top: 2px;
}

.event-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  transition: transform 0.15s ease;
}

.calendar-cell:hover .event-dot {
  transform: scale(1.2);
}

.dot-study {
  background-color: var(--study-accent);
}

.dot-event {
  background-color: var(--event-accent);
}

.dot-personal {
  background-color: var(--personal-accent);
}

/* ========================================================
   Calendar Divider Line (Photo 1)
   ======================================================== */
.calendar-divider {
  height: 1px;
  background-color: #EFEFEF;
  margin-bottom: 18px;
  width: 100%;
}

/* ========================================================
   Events Section & Event Cards (Photo 1)
   ======================================================== */
.events-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 24px;
}

.events-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.event-card {
  position: relative;
  border-radius: 12px;
  padding: 13px 16px;
  min-height: 52px;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  overflow: hidden;
  user-select: none;
}

.event-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.06);
}

.event-card:active {
  transform: scale(0.985);
}

/* Card 1: Учёба */
.event-card.card-study {
  background-color: var(--study-bg);
  border-left: 4.5px solid var(--study-accent);
}

/* Card 2: Событие */
.event-card.card-event {
  background-color: var(--event-bg);
  border-left: 4.5px solid var(--event-accent);
}

/* Card 3: Личное */
.event-card.card-personal {
  background-color: var(--personal-bg);
  border-left: 4.5px solid var(--personal-accent);
}

.event-title {
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 3px;
  letter-spacing: -0.01em;
}

.event-subtitle {
  font-size: 0.82rem;
  font-weight: 400;
  color: var(--text-secondary);
}

.event-card.completed {
  opacity: 0.55;
  text-decoration: line-through;
}

.empty-state {
  text-align: center;
  padding: 28px 16px;
  color: var(--text-secondary);
  font-size: 0.92rem;
  background: #FAF9F6;
  border-radius: 12px;
  border: 1px dashed #E2DFD7;
  line-height: 1.5;
}

/* ========================================================
   Reminder Banner (Photo 1)
   ======================================================== */
.reminder-banner {
  background-color: var(--reminder-bg);
  border: 1px solid var(--reminder-border);
  border-radius: 12px;
  padding: 10px 14px;
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
  cursor: pointer;
  touch-action: manipulation;
  transition: opacity 0.2s ease, transform 0.15s ease, box-shadow 0.15s ease;
  user-select: none;
}

.reminder-banner:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}

.reminder-banner:active {
  transform: scale(0.99);
}

.reminder-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background-color: var(--study-accent);
  flex-shrink: 0;
}

.reminder-text-wrap {
  flex: 1;
}

.reminder-text {
  font-size: 0.86rem;
  font-weight: 500;
  color: #333333;
}

.reminder-close-btn {
  background: transparent;
  border: none;
  font-size: 1.3rem;
  line-height: 1;
  color: #999999;
  cursor: pointer;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  touch-action: manipulation;
  margin-right: -8px;
  transition: all 0.15s ease;
}

.reminder-close-btn:hover {
  color: #333333;
  background: rgba(0, 0, 0, 0.06);
}

/* ========================================================
   Bottom Action Button: "(+) Добавить событие"
   ======================================================== */
.app-bottom-bar {
  margin-top: auto;
  padding-top: 14px;
  padding-bottom: max(6px, env(safe-area-inset-bottom, 6px));
}

.primary-add-button {
  width: 100%;
  min-height: 52px;
  background-color: var(--btn-dark);
  color: #FFFFFF;
  border: none;
  border-radius: var(--radius-btn);
  font-size: 0.98rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  touch-action: manipulation;
  transition: background-color 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
  user-select: none;
}

.primary-add-button:hover {
  background-color: var(--btn-dark-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
}

.primary-add-button:active {
  transform: scale(0.985);
}

.plus-icon {
  stroke-width: 2.2;
}

/* ========================================================
   Modals & Popups
   ======================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(16px, env(safe-area-inset-top, 16px)) max(16px, env(safe-area-inset-right, 16px)) max(16px, env(safe-area-inset-bottom, 16px)) max(16px, env(safe-area-inset-left, 16px));
  z-index: 1000;
  animation: fadeIn 0.18s ease-out;
}

.modal-overlay.hidden {
  display: none !important;
}

.modal-card {
  background: #FFFFFF;
  border-radius: 20px;
  width: 100%;
  max-width: 460px;
  padding: 24px;
  box-shadow: var(--shadow-modal);
  max-height: calc(100vh - 40px);
  max-height: calc(100dvh - 40px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  animation: slideUp 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-close-btn {
  background: transparent;
  border: none;
  font-size: 1.6rem;
  line-height: 1;
  color: #888888;
  cursor: pointer;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  touch-action: manipulation;
  margin-right: -8px;
  transition: all 0.15s ease;
}

.modal-close-btn:hover {
  color: #111111;
  background: #F0F0F0;
}

/* Form inputs & mobile zoom prevention (font-size >= 16px) */
.event-form,
.profile-settings-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-row {
  display: flex;
  gap: 12px;
}

.flex-1 {
  flex: 1;
}

label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #444444;
}

/* font-size: 16px prevents iOS Safari from automatically zooming into inputs */
input[type="text"],
input[type="date"],
input[type="time"],
select,
textarea {
  width: 100%;
  font-family: inherit;
  font-size: 16px;
  padding: 11px 13px;
  border: 1px solid #D6D6D6;
  border-radius: 8px;
  color: var(--text-primary);
  background: #FAFAFA;
  min-height: 44px;
  touch-action: manipulation;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

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

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: #111111;
  background: #FFFFFF;
  box-shadow: 0 0 0 2px rgba(17, 17, 17, 0.08);
}

/* Category selector radio cards */
.category-selector {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.category-radio-card {
  border: 1px solid #E0E0E0;
  border-radius: 10px;
  padding: 10px 8px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  min-height: 52px;
  touch-action: manipulation;
  transition: all 0.15s ease;
  position: relative;
  user-select: none;
}

.category-radio-card:hover {
  border-color: #BBBBBB;
}

.category-radio-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.cat-name {
  font-size: 0.82rem;
  font-weight: 700;
  display: block;
}

.cat-desc {
  font-size: 0.68rem;
  color: #777777;
  display: block;
  margin-top: 2px;
}

.category-radio-card.study-radio:has(input:checked) {
  border-color: var(--study-accent);
  background: var(--study-bg);
}

.category-radio-card.event-radio:has(input:checked) {
  border-color: var(--event-accent);
  background: var(--event-bg);
}

.category-radio-card.personal-radio:has(input:checked) {
  border-color: var(--personal-accent);
  background: var(--personal-bg);
}

/* Modal action buttons (Touch targets >= 44px) */
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 10px;
}

.modal-actions-spaced {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 24px;
  gap: 8px;
  flex-wrap: wrap;
}

.right-btn-group {
  display: flex;
  gap: 8px;
  align-items: center;
}

.modal-actions-vertical {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 20px;
}

.submit-btn {
  background: #111111;
  color: #FFFFFF;
  border: none;
  min-height: 44px;
  padding: 11px 18px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
  transition: background 0.15s ease, transform 0.1s ease;
}

.submit-btn:hover {
  background: #2A2A2A;
  transform: translateY(-1px);
}

.submit-btn:active {
  transform: scale(0.98);
}

.secondary-btn {
  background: #F0F0F0;
  color: #333333;
  border: none;
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  touch-action: manipulation;
  transition: background 0.15s ease, transform 0.1s ease;
}

.secondary-btn:hover {
  background: #E4E4E4;
  transform: translateY(-1px);
}

.secondary-btn:active {
  transform: scale(0.98);
}

.complete-btn {
  background: #4A6B2F;
  color: #FFFFFF;
  border: none;
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
  transition: background 0.15s ease, transform 0.1s ease;
}

.complete-btn:hover {
  background: #3B5725;
  transform: translateY(-1px);
}

.complete-btn:active {
  transform: scale(0.98);
}

.danger-btn {
  background: transparent;
  color: #C02626;
  border: 1px solid #F0C0C0;
  min-height: 44px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
  transition: all 0.15s ease;
}

.danger-btn:hover {
  background: #FDF2F2;
  border-color: #C02626;
}

.danger-btn:active {
  transform: scale(0.98);
}

.danger-outline-btn {
  background: transparent;
  color: #C02626;
  border: 1px solid #F0C0C0;
  min-height: 44px;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.danger-outline-btn:hover {
  background: #FDF2F2;
  border-color: #C02626;
}

.danger-outline-btn:active {
  transform: scale(0.98);
}

.full-width {
  width: 100%;
}

/* Event Detail Modal */
.detail-event-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: #111111;
  margin-bottom: 16px;
  line-height: 1.25;
}

.detail-meta-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 18px;
}

.detail-meta-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.92rem;
  color: #444444;
}

.detail-meta-row svg {
  color: #888888;
  flex-shrink: 0;
}

.detail-notes-box {
  background: #F9F9F9;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 0.88rem;
  color: #555555;
  border-left: 3px solid #CCCCCC;
  line-height: 1.5;
}

/* Profile Modal & Student Settings */
.profile-card {
  max-width: 440px;
}

.profile-hero {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid #EEEEEE;
}

.avatar-large {
  width: 58px;
  height: 58px;
  min-width: 58px;
  min-height: 58px;
  border-radius: 50%;
  background: var(--avatar-bg);
  color: var(--avatar-text);
  font-size: 1.7rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.profile-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.profile-name-input {
  font-size: 1.2rem;
  font-weight: 700;
  padding: 4px 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  min-height: auto;
}

.profile-name-input:hover,
.profile-name-input:focus {
  background: #F6F6F6;
  border-color: #D6D6D6;
}

.profile-user-badge {
  background: #EEEEEE;
  color: #555555;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  letter-spacing: -0.2px;
}

.profile-sub {
  font-size: 0.82rem;
  color: #777777;
  padding-left: 8px;
  margin-top: 2px;
}

.db-status-pill {
  color: #4A6B2F;
  font-weight: 600;
}

/* Notification Setting Row */
.notification-setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #F8F9FA;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid #EAEAEA;
  gap: 12px;
}

.notif-text {
  display: flex;
  flex-direction: column;
}

.notif-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: #222222;
}

.notif-desc {
  font-size: 0.72rem;
  color: #777777;
  margin-top: 1px;
}

.toggle-notif-btn {
  background: #111111;
  color: #FFFFFF;
  border: none;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 8px 14px;
  min-height: 44px;
  border-radius: 8px;
  cursor: pointer;
  touch-action: manipulation;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.toggle-notif-btn.active {
  background: #4A6B2F;
}




/* ========================================================
   Auth Modal & Tabs (Вход / Регистрация)
   ======================================================== */
.auth-card {
  max-width: 420px;
  width: 100%;
}

.modal-subtitle {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.auth-tabs {
  display: flex;
  background: #F1F3F5;
  border-radius: 10px;
  padding: 4px;
  margin-top: 14px;
  margin-bottom: 18px;
  gap: 4px;
}

.auth-tab {
  flex: 1;
  background: transparent;
  border: none;
  border-radius: 7px;
  padding: 9px 12px;
  font-size: 0.88rem;
  font-weight: 600;
  color: #666666;
  cursor: pointer;
  touch-action: manipulation;
  transition: all 0.15s ease;
}

.auth-tab:hover {
  color: #111111;
}

.auth-tab.active {
  background: #FFFFFF;
  color: #111111;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.auth-form-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth-buttons-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
}

.demo-auth-btn {
  background: #F4F6EA;
  color: #485A1D;
  border: 1px solid #D8DFC0;
  border-radius: 8px;
  min-height: 44px;
  padding: 10px 14px;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.15s ease;
}

.demo-auth-btn:hover {
  background: #EAEFD6;
  border-color: #C6D1A2;
  transform: translateY(-1px);
}

.demo-auth-btn:active {
  transform: scale(0.98);
}

.demo-sparkle {
  font-size: 1rem;
}

.auth-alert {
  background: #FDF2F2;
  border: 1px solid #F8D0D0;
  color: #C02626;
  font-size: 0.84rem;
  font-weight: 500;
  padding: 10px 12px;
  border-radius: 8px;
  margin-bottom: 12px;
  line-height: 1.4;
}

.auth-alert.hidden {
  display: none;
}

.avatar-badge.unauthenticated {
  background: #F8F9FA;
  border: 1.5px dashed #657D2C;
  color: #657D2C;
}

/* Toast popup */
.toast {
  position: fixed;
  bottom: max(24px, calc(16px + env(safe-area-inset-bottom, 0px)));
  left: 50%;
  transform: translateX(-50%);
  background: #111111;
  color: #FFFFFF;
  padding: 11px 22px;
  border-radius: 30px;
  font-size: 0.88rem;
  font-weight: 500;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
  z-index: 2000;
  pointer-events: none;
  animation: toastFade 0.25s ease-out;
  white-space: nowrap;
}

.toast.hidden {
  display: none;
}

/* ========================================================
   Keyboard Navigation & Focus-Visible Rings (Accessibility)
   ======================================================== */
:focus-visible {
  outline: 2px solid #657D2C;
  outline-offset: 2px;
}

:focus:not(:focus-visible) {
  outline: none;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
.calendar-cell:focus-visible,
.event-card:focus-visible,
.category-radio-card:focus-visible {
  outline: 2px solid #657D2C;
  outline-offset: 2px;
}

#calendar-grid:focus-visible {
  outline: 2px solid #657D2C;
  outline-offset: 4px;
  border-radius: 12px;
}

/* Keyframe animations */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { transform: translateY(16px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@keyframes toastFade {
  from { transform: translate(-50%, 15px); opacity: 0; }
  to { transform: translate(-50%, 0); opacity: 1; }
}

/* ========================================================
   Responsive Breakpoints & Desktop Mode Layout
   ======================================================== */

/* Desktop Mode: 2-column view on screens >= 768px */
@media (min-width: 768px) {
  body.desktop-mode .app-layout,
  .app-layout.desktop-mode {
    padding: 32px 24px;
    align-items: center;
    justify-content: center;
  }

  body.desktop-mode .phone-frame,
  .app-layout.desktop-mode .phone-frame,
  .phone-frame.desktop-mode {
    max-width: 1040px;
    min-height: auto;
    border-radius: 24px;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(0, 0, 0, 0.06);
    overflow: hidden;
  }

  body.desktop-mode .screen-content,
  .app-layout.desktop-mode .screen-content,
  .phone-frame.desktop-mode .screen-content {
    padding: 32px 36px 36px;
  }

  body.desktop-mode .desktop-main-columns,
  .app-layout.desktop-mode .desktop-main-columns,
  .phone-frame.desktop-mode .desktop-main-columns {
    display: grid;
    grid-template-columns: minmax(360px, 1.15fr) minmax(340px, 1fr);
    column-gap: 40px;
    align-items: start;
  }

  body.desktop-mode .calendar-divider,
  .app-layout.desktop-mode .calendar-divider,
  .phone-frame.desktop-mode .calendar-divider {
    display: none;
  }

  body.desktop-mode .events-column,
  .app-layout.desktop-mode .events-column,
  .phone-frame.desktop-mode .events-column {
    border-left: 1px solid #ECECEC;
    padding-left: 36px;
    min-height: 100%;
    display: flex;
    flex-direction: column;
  }

  body.desktop-mode .calendar-grid,
  .app-layout.desktop-mode .calendar-grid,
  .phone-frame.desktop-mode .calendar-grid {
    row-gap: 12px;
  }

  body.desktop-mode .day-number,
  .app-layout.desktop-mode .day-number,
  .phone-frame.desktop-mode .day-number {
    width: 38px;
    height: 38px;
    font-size: 1.05rem;
  }
}

/* Wide Desktop Screens (1440px+) */
@media (min-width: 1440px) {
  body.desktop-mode .phone-frame,
  .app-layout.desktop-mode .phone-frame,
  .phone-frame.desktop-mode {
    max-width: 1120px;
  }
}

/* Mobile Screens & Narrow Viewports (<= 480px) */
@media (max-width: 480px) {
  .phone-frame {
    max-width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    box-shadow: none;
  }

  .screen-content {
    padding: max(16px, env(safe-area-inset-top, 16px)) max(16px, env(safe-area-inset-right, 16px)) max(24px, env(safe-area-inset-bottom, 24px)) max(16px, env(safe-area-inset-left, 16px));
  }

  .month-title {
    font-size: 1.7rem;
  }



  .modal-actions-spaced {
    flex-direction: column-reverse;
    align-items: stretch;
  }

  .right-btn-group {
    flex-direction: column;
    width: 100%;
  }

  .right-btn-group button,
  .danger-btn {
    width: 100%;
    text-align: center;
  }

  .category-selector {
    grid-template-columns: 1fr;
  }
}
