/* ============================================
   SEALED — Material Design 3 Web Theme
   ============================================ */

/* === FONTS === */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* === MD3 COLOR TOKENS === */
:root {
  --md-primary:            #2563eb;
  --md-on-primary:         #ffffff;
  --md-primary-container:  #dbeafe;
  --md-on-primary-container: #1e3a8a;

  --md-secondary:          #0ea5e9;
  --md-secondary-container:#e0f2fe;

  --md-tertiary:           #7c3aed;
  --md-tertiary-container: #ede9fe;

  --md-error:              #dc2626;
  --md-error-container:    #fee2e2;
  --md-on-error:           #ffffff;

  --md-surface:            #ffffff;
  --md-surface-variant:    #f1f5f9;
  --md-surface-container:  #f8fafc;
  --md-surface-container-high: #f1f5f9;

  --md-on-surface:         #0f172a;
  --md-on-surface-variant: #475569;

  --md-outline:            #e2e8f0;
  --md-outline-variant:    #cbd5e1;

  --md-background:         #f8fafc;
  --md-on-background:      #0f172a;

  --md-success:            #16a34a;
  --md-success-container:  #dcfce7;

  /* Elevation shadows */
  --shadow-1: 0 1px 2px rgba(0,0,0,0.06), 0 1px 3px rgba(0,0,0,0.1);
  --shadow-2: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -1px rgba(0,0,0,0.05);
  --shadow-3: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -2px rgba(0,0,0,0.04);

  /* Shape */
  --radius-xs:  4px;
  --radius-sm:  8px;
  --radius-md:  12px;
  --radius-lg:  16px;
  --radius-xl:  24px;
  --radius-full: 9999px;

  /* Type scale */
  --type-display:    2.25rem/1.15 'Inter', sans-serif;
  --type-headline-lg: 2rem/1.2 'Inter', sans-serif;
  --type-headline-md: 1.75rem/1.25 'Inter', sans-serif;
  --type-title-lg:   1.375rem/1.3 'Inter', sans-serif;
  --type-title-md:   1rem/1.4 'Inter', sans-serif;
  --type-body-lg:    1rem/1.6 'Inter', sans-serif;
  --type-body-md:    0.875rem/1.6 'Inter', sans-serif;
  --type-label-lg:   0.875rem/1.4 'Inter', sans-serif;
  --type-label-sm:   0.75rem/1.4 'Inter', sans-serif;
}

/* === RESET & BASE === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; overflow-x: hidden; }
body { max-width: 100vw; overflow-x: hidden;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--md-on-surface);
  background: var(--md-background);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--md-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
.hidden { display: none !important; }

/* === BUTTONS === */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 24px; border-radius: var(--radius-full);
  border: none; cursor: pointer; font-family: 'Inter', sans-serif;
  font-size: 0.9375rem; font-weight: 600; line-height: 1;
  transition: all 0.2s cubic-bezier(0.2, 0, 0, 1);
  text-decoration: none; letter-spacing: 0.01em; white-space: nowrap;
}
.btn:hover { filter: brightness(0.93); transform: translateY(-1px); box-shadow: var(--shadow-2); }
.btn:active { transform: translateY(0); }
.btn-primary  { background: var(--md-primary); color: var(--md-on-primary); box-shadow: var(--shadow-1); }
.btn-outline  { background: transparent; border: 1.5px solid var(--md-primary); color: var(--md-primary); }
.btn-outline:hover { background: var(--md-primary-container); box-shadow: none; }
.btn-ghost    { background: transparent; color: var(--md-on-surface-variant); }
.btn-ghost:hover { background: var(--md-surface-variant); box-shadow: none; filter: none; }
.btn-danger   { background: var(--md-error); color: var(--md-on-error); }
.btn-tonal    { background: var(--md-primary-container); color: var(--md-on-primary-container); }
.btn-lg  { padding: 14px 32px; font-size: 1.0625rem; }
.btn-sm  { padding: 7px 16px; font-size: 0.8125rem; }
.btn-full { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }

/* === NAV === */
.nav {
  background: var(--md-surface); border-bottom: 1px solid var(--md-outline);
  padding: 0 24px; height: 64px; display: flex; align-items: center;
  position: sticky; top: 0; z-index: 100;
  backdrop-filter: blur(12px); background: rgba(255,255,255,0.92);
}
.nav-inner { display: flex; align-items: center; justify-content: space-between; width: 100%; max-width: 1100px; margin: 0 auto; }
.logo { font-size: 1.125rem; font-weight: 800; color: var(--md-on-surface); letter-spacing: -0.02em; }
.logo-emoji { margin-right: 6px; }

/* === LANDING PAGE === */
.hero {
  text-align: center; padding: 96px 24px 72px;
  max-width: 780px; margin: 0 auto;
}
.hero-eyebrow {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--md-primary-container); color: var(--md-on-primary-container);
  border-radius: var(--radius-full); padding: 6px 14px;
  font-size: 0.8125rem; font-weight: 600; margin-bottom: 24px;
  letter-spacing: 0.02em;
}
.hero h1 {
  font-size: clamp(2.25rem, 6vw, 3.5rem); font-weight: 800;
  line-height: 1.1; color: var(--md-on-surface); letter-spacing: -0.03em;
  margin-bottom: 20px;
}
.hero h1 span { color: var(--md-primary); }
.hero .subtitle { font-size: 1.125rem; color: var(--md-on-surface-variant); margin-bottom: 40px; max-width: 560px; margin-left: auto; margin-right: auto; }
.hero-cta { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.hero-note { font-size: 0.8125rem; color: var(--md-on-surface-variant); }

/* Features section */
.features { padding: 32px 24px 72px; max-width: 1100px; margin: 0 auto; }
.section-label {
  text-align: center; font-size: 0.8125rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--md-primary); margin-bottom: 12px;
}
.section-title { text-align: center; font-size: clamp(1.5rem, 3vw, 2rem); font-weight: 800; letter-spacing: -0.02em; margin-bottom: 48px; }
.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; }
.feature-card {
  background: var(--md-surface); border-radius: var(--radius-lg);
  padding: 28px 24px; border: 1px solid var(--md-outline);
  transition: all 0.2s; box-shadow: var(--shadow-1);
}
.feature-card:hover { box-shadow: var(--shadow-3); transform: translateY(-2px); }
.feature-icon {
  width: 48px; height: 48px; border-radius: var(--radius-md);
  background: var(--md-primary-container); display: flex; align-items: center;
  justify-content: center; font-size: 1.5rem; margin-bottom: 16px;
}
.feature-card h3 { font-size: 1rem; font-weight: 700; margin-bottom: 8px; }
.feature-card p { font-size: 0.875rem; color: var(--md-on-surface-variant); line-height: 1.65; }

/* Pricing */
.pricing { padding: 32px 24px 72px; max-width: 1100px; margin: 0 auto; }
.pricing-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; margin-top: 48px; }
.pricing-card {
  background: var(--md-surface); border: 1px solid var(--md-outline);
  border-radius: var(--radius-xl); padding: 32px 28px; position: relative;
  transition: all 0.2s;
}
.pricing-card:hover { box-shadow: var(--shadow-3); transform: translateY(-2px); }
.pricing-card.featured {
  border-color: var(--md-primary); border-width: 2px;
  background: linear-gradient(145deg, #fff 0%, #eff6ff 100%);
}
.badge {
  background: var(--md-primary); color: #fff;
  font-size: 0.6875rem; font-weight: 700; padding: 4px 12px;
  border-radius: var(--radius-full); position: absolute;
  top: -13px; left: 50%; transform: translateX(-50%); white-space: nowrap;
  letter-spacing: 0.05em; text-transform: uppercase;
}
.pricing-card h3 { font-size: 1.125rem; font-weight: 700; margin-bottom: 4px; }
.price { font-size: 2.5rem; font-weight: 800; color: var(--md-on-surface); margin: 16px 0; letter-spacing: -0.03em; line-height: 1; }
.price span { font-size: 1rem; font-weight: 400; color: var(--md-on-surface-variant); }
.pricing-card ul { list-style: none; margin-bottom: 28px; display: flex; flex-direction: column; gap: 10px; }
.pricing-card ul li { font-size: 0.875rem; color: var(--md-on-surface-variant); display: flex; align-items: flex-start; gap: 8px; }
.pricing-card ul li::before { content: "✓"; color: var(--md-success); font-weight: 700; flex-shrink: 0; margin-top: 1px; }

/* Disclaimer */
.disclaimer-banner {
  background: #fffbeb; border-top: 1px solid #fcd34d;
  padding: 14px 24px; text-align: center; font-size: 0.8125rem; color: #92400e;
}

/* Footer */
footer { background: #0f172a; color: #94a3b8; padding: 32px 24px; margin-top: 80px; }
.footer-inner { max-width: 1100px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 16px; }
.footer-logo { font-size: 1rem; font-weight: 800; color: #fff; }
footer nav { display: flex; gap: 24px; flex-wrap: wrap; }
footer nav a { color: #94a3b8; font-size: 0.8125rem; transition: color 0.15s; }
footer nav a:hover { color: #fff; text-decoration: none; }

/* === AUTH PAGES === */
.auth-page {
  background: var(--md-background); min-height: 100vh;
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.auth-container {
  background: var(--md-surface); border-radius: var(--radius-xl);
  padding: 44px 40px; max-width: 500px; width: 100%;
  border: 1px solid var(--md-outline); box-shadow: var(--shadow-2);
}
.logo-link { font-size: 1.125rem; font-weight: 800; display: block; margin-bottom: 28px; text-decoration: none; color: var(--md-on-surface); }
.auth-container h1 { font-size: 1.75rem; font-weight: 800; margin-bottom: 8px; letter-spacing: -0.02em; }
.auth-sub { color: var(--md-on-surface-variant); font-size: 0.9375rem; margin-bottom: 32px; }
.auth-form { display: flex; flex-direction: column; gap: 20px; }
.auth-switch { text-align: center; margin-top: 24px; font-size: 0.875rem; color: var(--md-on-surface-variant); }

/* Form elements */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 0.875rem; font-weight: 600; color: var(--md-on-surface); }
.form-group input[type=text],
.form-group input[type=email],
.form-group input[type=datetime-local],
.form-group select,
.form-group textarea {
  border: 1.5px solid var(--md-outline-variant);
  border-radius: var(--radius-md); padding: 11px 14px;
  font-size: 0.9375rem; font-family: 'Inter', sans-serif;
  outline: none; width: 100%; background: var(--md-surface);
  color: var(--md-on-surface); transition: border-color 0.15s, box-shadow 0.15s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--md-primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
}
.form-group textarea { resize: vertical; min-height: 90px; }
.req { color: var(--md-error); }
.field-hint { font-size: 0.75rem; color: var(--md-on-surface-variant); }

/* Role / category pickers */
.role-picker, .category-picker { display: flex; gap: 10px; flex-wrap: wrap; }
.role-option, .cat-option {
  display: flex; align-items: center; gap: 8px; cursor: pointer;
  border: 1.5px solid var(--md-outline-variant); border-radius: var(--radius-md);
  padding: 10px 16px; font-size: 0.875rem; font-weight: 600;
  transition: all 0.15s; color: var(--md-on-surface-variant);
}
.role-option:has(input:checked), .cat-option:has(input:checked) {
  border-color: var(--md-primary); background: var(--md-primary-container);
  color: var(--md-on-primary-container);
}
.role-option input, .cat-option input { display: none; }

/* Checkbox label */
.checkbox-label {
  display: flex; align-items: flex-start; gap: 10px;
  font-size: 0.875rem; color: var(--md-on-surface-variant); cursor: pointer; line-height: 1.5;
}
.checkbox-label input[type=checkbox] { margin-top: 2px; width: 16px; height: 16px; flex-shrink: 0; accent-color: var(--md-primary); }

/* E-signature */
.esign-block {
  background: var(--md-surface-variant); border: 1.5px solid var(--md-outline);
  border-radius: var(--radius-lg); padding: 20px; display: flex; flex-direction: column; gap: 14px;
}
.esign-terms { font-size: 0.8125rem; color: var(--md-on-surface-variant); line-height: 1.7; }
.esign-line {
  display: flex; align-items: center; gap: 10px;
  border-top: 2px solid var(--md-on-surface); padding-top: 10px; min-height: 44px;
}
.esign-x { font-size: 1.125rem; color: var(--md-on-surface); font-weight: 700; }
.esign-preview { font-family: 'Georgia', cursive; font-size: 1.5rem; color: var(--md-on-surface); font-style: italic; }

.form-error {
  background: var(--md-error-container); color: #991b1b;
  border-radius: var(--radius-md); padding: 10px 14px; font-size: 0.875rem;
  border-left: 3px solid var(--md-error);
}
.success-message { text-align: center; padding: 24px 0; }
.success-icon { font-size: 3rem; display: block; margin-bottom: 16px; }
.success-message h2 { font-size: 1.5rem; font-weight: 700; margin-bottom: 12px; }
.success-message p { color: var(--md-on-surface-variant); line-height: 1.7; }
.success-message .small { font-size: 0.8125rem; color: var(--md-on-surface-variant); margin-top: 12px; opacity: 0.7; }

/* === APP LAYOUT === */
.app-page { background: var(--md-background); min-height: 100vh; }
.app-header {
  background: rgba(255,255,255,0.92); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--md-outline); padding: 0 20px; height: 64px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 100;
}
.header-right { display: flex; align-items: center; gap: 8px; }
.plan-badge {
  background: var(--md-success-container); color: var(--md-success);
  border: 1px solid #bbf7d0; padding: 3px 10px;
  border-radius: var(--radius-full); font-size: 0.6875rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em;
}

.app-body { display: flex; flex-direction: column; min-height: calc(100vh - 64px); }

/* Sidebar */
.sidebar {
  width: 100%; background: var(--md-surface);
  border-bottom: 1px solid var(--md-outline);
  padding: 12px; overflow-y: visible;
}

/* Desktop: side by side */
@media (min-width: 900px) {
  .app-body { flex-direction: row; height: calc(100vh - 64px); }
  .sidebar {
    width: 228px; border-bottom: none;
    border-right: 1px solid var(--md-outline);
    padding: 20px 12px; flex-shrink: 0; overflow-y: auto;
  }
}
.sidebar-section { margin-bottom: 28px; }
.sidebar-title {
  font-size: 0.6875rem; font-weight: 700; text-transform: uppercase;
  color: var(--md-on-surface-variant); letter-spacing: 0.1em;
  margin-bottom: 8px; padding: 0 8px;
}
.filter-btn {
  display: flex; align-items: center; gap: 8px; width: 100%; text-align: left;
  background: none; border: none; padding: 9px 12px; border-radius: var(--radius-md);
  font-size: 0.875rem; font-family: 'Inter', sans-serif; color: var(--md-on-surface-variant);
  cursor: pointer; margin-bottom: 2px; transition: all 0.15s; font-weight: 500;
}
.filter-btn:hover { background: var(--md-surface-variant); color: var(--md-on-surface); }
.filter-btn.active {
  background: var(--md-primary-container); color: var(--md-on-primary-container); font-weight: 600;
}

/* Log feed */
/* === ARCHIVED SCREEN === */
#archived-screen, #property-entries-screen {
  position: fixed; inset: 0; z-index: 200;
  background: #f8fafc;
  display: flex; flex-direction: column;
}
#archived-screen.hidden, #property-entries-screen.hidden { display: none; }
.archived-header {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 20px;
  background: #1565C0; color: #fff;
  min-height: 60px;
  padding-top: calc(16px + env(safe-area-inset-top, 0px));
}
.archived-back {
  background: none; border: none; color: #fff; font-size: 1rem;
  font-weight: 600; cursor: pointer; padding: 4px 0; white-space: nowrap;
}
.archived-title {
  font-size: 1.1rem; font-weight: 700; color: #fff;
}
.archived-list {
  flex: 1; overflow-y: auto;
  padding: 20px 16px;
  padding-bottom: calc(60px + env(safe-area-inset-bottom, 0px));
  display: flex; flex-direction: column; gap: 10px;
}

.log-feed { flex: 1; overflow-y: auto; padding: 24px; padding-bottom: calc(40px + env(safe-area-inset-bottom, 0px)); }
#log-list { display: flex; flex-direction: column; gap: 10px; }

.log-card {
  background: var(--md-surface); border-radius: var(--radius-lg);
  padding: 18px 20px; border: 1px solid var(--md-outline);
  transition: all 0.18s; box-shadow: var(--shadow-1);
}
.log-card:hover { box-shadow: var(--shadow-2); transform: translateY(-1px); border-color: var(--md-outline-variant); }
.log-card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.log-card-title { font-size: 0.9375rem; font-weight: 600; color: var(--md-on-surface); }
.log-card-cat {
  font-size: 0.6875rem; font-weight: 700; padding: 3px 10px;
  border-radius: var(--radius-full); white-space: nowrap; letter-spacing: 0.04em; text-transform: uppercase;
}
.cat-communication { background: var(--md-primary-container); color: var(--md-on-primary-container); }
.cat-maintenance    { background: #fef3c7; color: #92400e; }
.cat-payment        { background: var(--md-success-container); color: #166534; }
.cat-other          { background: var(--md-surface-variant); color: var(--md-on-surface-variant); }

.log-card-meta {
  font-size: 0.75rem; color: var(--md-on-surface-variant); margin-top: 6px;
  display: flex; align-items: center; gap: 4px;
}
.lock-icon { font-size: 0.6875rem; opacity: 0.7; }
.log-card-desc { font-size: 0.875rem; color: var(--md-on-surface-variant); margin-top: 10px; line-height: 1.65; }
.log-card-photos { margin-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; }
.log-photo-thumb {
  width: 64px; height: 64px; object-fit: cover;
  border-radius: var(--radius-sm); border: 1px solid var(--md-outline); cursor: pointer;
}
.log-card-footer { margin-top: 12px; }
.log-delete-btn {
  font-size: 0.8125rem; color: var(--md-error); background: none; border: none;
  cursor: pointer; font-family: 'Inter', sans-serif; padding: 4px 0;
  transition: opacity 0.15s;
}
.log-delete-btn:hover { opacity: 0.7; }

/* === DRAG TO REORDER === */
.drag-handle {
  color: #cbd5e1; padding: 0 6px 0 0; user-select: none;
  font-size: 1.1rem; line-height: 1; flex-shrink: 0;
  cursor: grab !important;
}
.drag-handle:active { cursor: grabbing !important; }
.sortable-ghost { opacity: 0.4; background: #eff6ff !important; border: 1.5px dashed #93c5fd !important; }
.sortable-drag { box-shadow: var(--shadow-3) !important; opacity: 0.95; }
.log-card-header-inner { display: flex; align-items: flex-start; gap: 4px; flex: 1; min-width: 0; }

/* Disable drag handles when filtered */
.sort-disabled .drag-handle { opacity: 0.2; cursor: default !important; pointer-events: none; }

/* === ARCHIVE BUTTON === */
.log-archive-btn {
  font-size: 0.8125rem; color: #64748b; background: none; border: none;
  cursor: pointer; font-family: 'Inter', sans-serif; padding: 4px 0; margin-left: 12px;
  transition: opacity 0.15s;
}
.log-archive-btn:hover { opacity: 0.7; }
.log-archive-btn.unarchive { color: var(--md-primary); }

/* === DOCUMENT PREVIEW PILL === */
.doc-preview-pill {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--md-surface-variant); border: 1px solid var(--md-outline);
  border-radius: var(--radius-sm); padding: 6px 10px;
  font-size: 0.75rem; font-weight: 500; color: var(--md-on-surface-variant);
  max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  cursor: default;
}
.doc-preview-pill .doc-pill-remove {
  cursor: pointer; opacity: 0.6; font-size: 0.875rem; flex-shrink: 0;
}
.doc-preview-pill .doc-pill-remove:hover { opacity: 1; }

/* Log card document attachment */
.log-doc-link {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--md-surface-variant); border: 1px solid var(--md-outline);
  border-radius: var(--radius-sm); padding: 4px 10px;
  font-size: 0.75rem; color: var(--md-on-surface-variant); text-decoration: none;
  transition: background 0.15s;
}
.log-doc-link:hover { background: var(--md-primary-container); color: var(--md-on-primary-container); text-decoration: none; }

/* === SIDEBAR ACTIONS — always visible === */
@media (min-width: 900px) {
  .sidebar-actions { display: flex !important; flex-direction: column; }
}

.empty-state { text-align: center; padding: 80px 24px; color: var(--md-on-surface-variant); }
.empty-state span { font-size: 3rem; display: block; margin-bottom: 16px; }
.empty-state p { font-size: 0.9375rem; }

.upgrade-banner {
  background: #fffbeb; border: 1px solid #fcd34d; border-radius: var(--radius-lg);
  padding: 16px 20px; font-size: 0.875rem; color: #92400e;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}

/* === MODAL === */
.modal {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.modal-overlay { position: absolute; inset: 0; background: rgba(15,23,42,0.5); backdrop-filter: blur(4px); }
.modal-box {
  background: var(--md-surface); border-radius: var(--radius-xl);
  padding: 32px; max-width: 560px; width: 100%;
  position: relative; z-index: 1; max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow-3); box-sizing: border-box;
}
.upgrade-plan-card { box-sizing: border-box; width: 100%; }
.modal-box h2 { font-size: 1.375rem; font-weight: 700; margin-bottom: 24px; letter-spacing: -0.01em; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

#property-list { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.property-item { font-size: 0.8125rem; color: var(--md-on-surface-variant); padding: 8px 10px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: space-between; gap: 6px; cursor: pointer; transition: background 0.15s; border: 1px solid transparent; }
.property-item:hover, .property-item:active { background: #f1f5f9; border-color: #e2e8f0; }
.property-item-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.property-item-arrow { color: #94a3b8; font-size: 1.1rem; flex-shrink: 0; }

/* ============================================
   TUTORIAL OVERLAY — ANIMATED
   ============================================ */
.tutorial-overlay {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(10, 14, 30, 0.82);
  backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  animation: tutorialFadeIn 0.3s ease;
}
@keyframes tutorialFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.tutorial-card {
  background: #fff;
  border-radius: 28px;
  padding: 0 0 28px;
  width: 100%; max-width: 420px;
  max-height: 90vh;
  box-shadow: 0 24px 80px rgba(0,0,0,0.35);
  animation: tutorialPopIn 0.4s cubic-bezier(0.34, 1.3, 0.64, 1);
  display: flex; flex-direction: column;
  overflow: hidden;
}
@keyframes tutorialPopIn {
  from { transform: scale(0.88); opacity: 0; }
  to   { transform: scale(1);    opacity: 1; }
}

/* Progress bar */
.tutorial-progress-bar {
  height: 4px; background: #e2e8f0; width: 100%; flex-shrink: 0;
}
.tutorial-progress-fill {
  height: 100%; background: linear-gradient(90deg, #1d4ed8, #7c3aed);
  transition: width 0.4s cubic-bezier(0.4,0,0.2,1);
  border-radius: 0 4px 4px 0;
}

/* Step */
.tutorial-step {
  display: none;
  flex-direction: column;
  flex: 1;
  padding: 24px 28px 0;
  animation: stepSlideIn 0.3s cubic-bezier(0.4,0,0.2,1);
}
.tutorial-step.active { display: flex; }
@keyframes stepSlideIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes stepSlideBack {
  from { opacity: 0; transform: translateX(-20px); }
  to   { opacity: 1; transform: translateX(0); }
}
.tutorial-step.slide-back { animation: stepSlideBack 0.3s cubic-bezier(0.4,0,0.2,1); }

/* Scene area */
.tutorial-scene {
  display: flex; align-items: center; justify-content: center;
  position: relative; margin-bottom: 18px; min-height: 90px;
  gap: 16px;
}
.tscene-icon {
  font-size: 3.5rem; line-height: 1; position: relative; z-index: 1;
}
.tscene-icon-sm { font-size: 1.8rem; }
.tscene-glow {
  position: absolute; width: 80px; height: 80px;
  border-radius: 50%; filter: blur(24px); opacity: 0.3; z-index: 0;
}
.glow-blue { background: #3b82f6; }
.glow-red  { background: #ef4444; }
.glow-green { background: #10b981; }

/* Scene-specific */
.tscene-photo-strip {
  display: flex; gap: 8px; margin-top: 8px;
}
.tphoto {
  width: 48px; height: 48px; background: #f1f5f9;
  border-radius: 10px; display: flex; align-items: center;
  justify-content: center; font-size: 1.5rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  animation: photoIn 0.4s ease both;
}
.tphoto:nth-child(1) { animation-delay: 0.1s; }
.tphoto:nth-child(2) { animation-delay: 0.2s; }
.tphoto:nth-child(3) { animation-delay: 0.3s; }
@keyframes photoIn {
  from { opacity: 0; transform: scale(0.6) translateY(10px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.tscene-badge {
  position: absolute; top: 6px; right: 0;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff; font-size: 0.6rem; font-weight: 800;
  letter-spacing: 0.1em; padding: 3px 8px; border-radius: 99px;
  animation: badgePop 0.5s cubic-bezier(0.34,1.5,0.64,1) 0.3s both;
}
@keyframes badgePop {
  from { transform: scale(0); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

/* Confetti */
.confetti-row {
  display: flex; gap: 6px; margin-top: 8px;
}
.conf {
  font-size: 1rem;
  animation: confettiFall 0.6s ease both;
}
.conf:nth-child(1) { animation-delay: 0.1s; }
.conf:nth-child(2) { animation-delay: 0.2s; }
.conf:nth-child(3) { animation-delay: 0.3s; }
.conf:nth-child(4) { animation-delay: 0.4s; }
.conf:nth-child(5) { animation-delay: 0.5s; }
@keyframes confettiFall {
  from { opacity: 0; transform: translateY(-20px) rotate(-20deg); }
  to   { opacity: 1; transform: translateY(0) rotate(0); }
}

/* Animations for icons */
.bounce {
  animation: iconBounce 0.7s cubic-bezier(0.34, 1.6, 0.64, 1) both;
}
.bounce-slow {
  animation: iconBounce 0.9s cubic-bezier(0.34, 1.4, 0.64, 1) 0.1s both;
}
.shake {
  animation: iconShake 0.6s ease both;
}
.pulse-green {
  animation: iconBounce 0.7s cubic-bezier(0.34,1.6,0.64,1) both,
             greenPulse 1.5s ease-in-out 0.7s infinite;
}
.pop {
  animation: iconPop 0.5s cubic-bezier(0.34,1.5,0.64,1) both;
}
.float-up {
  animation: iconBounce 0.7s ease 0.15s both, floatY 2.5s ease-in-out 0.7s infinite;
}
.float-down {
  animation: iconBounce 0.7s ease 0.25s both, floatY 2.5s ease-in-out 1.2s infinite;
}
.slide-up {
  animation: slideUpIn 0.5s cubic-bezier(0.34,1.4,0.64,1) both;
}
.celebrate {
  animation: iconBounce 0.7s cubic-bezier(0.34,1.7,0.64,1) both,
             spin360 0.6s ease 0.7s both;
}

@keyframes iconBounce {
  from { opacity: 0; transform: scale(0.3) translateY(20px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes iconShake {
  0%   { transform: translateX(0); }
  20%  { transform: translateX(-6px) rotate(-5deg); }
  40%  { transform: translateX(6px) rotate(5deg); }
  60%  { transform: translateX(-4px); }
  80%  { transform: translateX(4px); }
  100% { transform: translateX(0); }
}
@keyframes greenPulse {
  0%, 100% { filter: drop-shadow(0 0 0px #10b98100); }
  50%       { filter: drop-shadow(0 0 12px #10b981aa); }
}
@keyframes iconPop {
  from { opacity: 0; transform: scale(0.5); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes floatY {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-8px); }
}
@keyframes slideUpIn {
  from { opacity: 0; transform: translateY(30px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes spin360 {
  from { transform: rotate(0deg); }
  to   { transform: rotate(20deg); }
}

/* Typography */
.tutorial-title {
  font-size: 1.45rem; font-weight: 800;
  color: #0f172a; letter-spacing: -0.025em;
  margin-bottom: 10px; line-height: 1.2;
}
.tutorial-body {
  font-size: 0.9rem; color: #475569; line-height: 1.65; margin-bottom: 12px;
}

/* Stats row (step 1) */
.tutorial-stat-row {
  display: flex; gap: 10px; margin-top: 14px;
}
.tutorial-stat {
  flex: 1; background: #f8fafc; border: 1px solid #e2e8f0;
  border-radius: 12px; padding: 12px; display: flex;
  flex-direction: column; gap: 4px;
}
.tutorial-stat.highlight-stat { background: #eff6ff; border-color: #bfdbfe; }
.tstat-num { font-size: 1.4rem; font-weight: 900; color: #0f172a; }
.tutorial-stat.highlight-stat .tstat-num { color: #1d4ed8; }
.tstat-label { font-size: 0.72rem; color: #64748b; line-height: 1.4; }

/* Examples (step 2) */
.tutorial-examples {
  display: flex; flex-direction: column; gap: 8px; margin-top: 12px;
}
.tutorial-example {
  background: #fef2f2; border: 1px solid #fecaca; border-radius: 10px;
  padding: 9px 12px; font-size: 0.8rem; color: #7f1d1d; font-style: italic;
  animation: exampleIn 0.4s ease both;
}
.tutorial-example:nth-child(1) { animation-delay: 0.1s; }
.tutorial-example:nth-child(2) { animation-delay: 0.25s; }
.tutorial-example:nth-child(3) { animation-delay: 0.4s; }
@keyframes exampleIn {
  from { opacity: 0; transform: translateX(-12px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* Highlight box */
.tutorial-highlight {
  background: #eff6ff; border: 1px solid #bfdbfe;
  border-radius: 10px; padding: 11px 14px;
  font-size: 0.83rem; color: #1e40af; font-weight: 500;
  display: flex; align-items: center; gap: 8px; margin-top: 12px;
}
.tutorial-arrow {
  font-size: 1.2rem;
  animation: arrowPulse 1.2s ease-in-out infinite;
}
@keyframes arrowPulse {
  0%, 100% { transform: translate(0,0); }
  50%       { transform: translate(3px,-3px); }
}

/* Category pills */
.tutorial-cats { display: flex; flex-wrap: wrap; gap: 7px; }
.tcat { font-size: 0.78rem; font-weight: 600; padding: 5px 12px; border-radius: 99px; }
.tcat-comm  { background: #eff6ff; color: #1d4ed8; }
.tcat-maint { background: #fef3c7; color: #92400e; }
.tcat-pay   { background: #f0fdf4; color: #166534; }
.tcat-other { background: #f1f5f9; color: #475569; }

/* Pill row */
.tutorial-pill-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.tutorial-pill {
  background: #f1f5f9; border: 1px solid #e2e8f0;
  border-radius: 99px; padding: 6px 14px;
  font-size: 0.8rem; font-weight: 600; color: #334155;
  animation: pillIn 0.35s cubic-bezier(0.34,1.4,0.64,1) both;
}
.tutorial-pill:nth-child(1) { animation-delay: 0.1s; }
.tutorial-pill:nth-child(2) { animation-delay: 0.2s; }
.tutorial-pill:nth-child(3) { animation-delay: 0.3s; }
@keyframes pillIn {
  from { opacity: 0; transform: scale(0.7); }
  to   { opacity: 1; transform: scale(1); }
}

/* Ready badge (step 7) */
.tutorial-ready-badge {
  background: linear-gradient(135deg, #059669, #10b981);
  color: #fff; font-weight: 700; font-size: 0.9rem;
  padding: 13px 18px; border-radius: 14px; text-align: center;
  margin-top: 16px;
  animation: badgePop 0.5s cubic-bezier(0.34,1.5,0.64,1) 0.4s both;
}

/* Progress dots */
.tutorial-dots {
  display: flex; gap: 7px; justify-content: center;
  padding: 20px 28px 0;
}
.tutorial-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: #e2e8f0; transition: all 0.25s;
}
.tutorial-dot.active {
  background: #1d4ed8; width: 22px; border-radius: 99px;
}

/* Nav */
.tutorial-nav {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 28px 0;
}
.tutorial-nav .btn-primary { flex: 1; }
#tutorial-skip { color: #94a3b8; font-size: 0.875rem; }
#tutorial-skip:hover { color: #64748b; }

/* === RESPONSIVE === */
@media (max-width: 640px) {
  .auth-container { padding: 32px 24px; border-radius: var(--radius-lg); }
  .sidebar { padding: 8px 12px 14px; border-bottom: 2px solid var(--md-outline); }
  .sidebar-section { margin-bottom: 16px; }
  .sidebar-section:last-child { margin-bottom: 0; }
  .filter-btn { display: flex; padding: 13px 14px; font-size: 0.9375rem; margin-bottom: 3px; min-height: 48px; }
  .log-feed { padding: 14px 12px; padding-bottom: calc(60px + env(safe-area-inset-bottom, 0px)); }
  .pricing-grid { grid-template-columns: 1fr; }
  .hero { padding: 64px 20px 48px; }
  .footer-inner { flex-direction: column; text-align: center; }
}

/* === ANDROID / MOBILE APP STYLING === */
@media (max-width: 640px) {
  /* Hide overflow-causing buttons from header on mobile */
  /* export-btn and logout-btn removed from header — handled in sidebar */

  /* Blue Material app bar */
  .app-header {
    background: #1d4ed8;
    backdrop-filter: none;
    border-bottom: none;
    padding-top: env(safe-area-inset-top, 0px);
    height: auto;
    min-height: 64px;
    padding-left: 16px;
    padding-right: 12px;
    padding-bottom: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  }
  .app-header .logo { color: #fff; font-size: 1.125rem; }
  .app-header .plan-badge {
    background: rgba(255,255,255,0.2);
    color: #fff;
    border-color: rgba(255,255,255,0.35);
  }
  .app-header .btn-primary {
    background: #fff;
    color: #1d4ed8;
    font-size: 0.82rem;
    padding: 8px 14px;
    box-shadow: none;
  }
  .app-header .btn-outline {
    border-color: rgba(255,255,255,0.7);
    color: #fff;
    font-size: 0.82rem;
    padding: 8px 12px;
  }
  .app-header .btn-ghost {
    color: rgba(255,255,255,0.85);
    font-size: 1rem;
    padding: 8px 8px;
  }
  .header-right { gap: 6px; }

  /* Sidebar: clean white card feel */
  .sidebar {
    background: #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
  }
  .sidebar-title {
    font-size: 0.7rem;
    padding: 4px 10px 2px;
    color: #94a3b8;
  }
  .filter-btn {
    border-radius: 10px;
    font-size: 0.9375rem;
    font-weight: 500;
    color: #334155;
    padding: 13px 14px;
    min-height: 48px;
  }
  .filter-btn.active {
    background: #dbeafe;
    color: #1d4ed8;
    font-weight: 700;
  }
  .filter-btn:active {
    background: #eff6ff;
  }

  /* Log feed */
  .log-feed { background: #f1f5f9; }
  .log-card { border-radius: 14px; padding: 14px 16px; }
  .log-card-title { font-size: 0.9375rem; }

  /* Empty state */
  .empty-state { padding: 48px 24px; }

  /* Modal full-screen on mobile */
  .modal { padding: 0; align-items: flex-end; }
  .modal-box {
    border-radius: 20px 20px 0 0;
    max-height: 92vh;
    padding: 24px 20px 32px;
    padding-bottom: calc(32px + env(safe-area-inset-bottom, 0px));
  }
  .modal-box h2 { font-size: 1.2rem; margin-bottom: 18px; }

  /* Property items */
  .property-item { font-size: 0.875rem; padding: 8px 10px; }

  /* Auth page */
  .auth-page { align-items: flex-start; padding: 0; }
  .auth-container {
    border-radius: 0;
    min-height: 100vh;
    border: none;
    box-shadow: none;
    padding: 48px 24px 32px;
  }

  /* Remove hover transforms on touch */
  .btn:hover { transform: none; filter: none; box-shadow: none; }
  .log-card:hover { transform: none; box-shadow: var(--shadow-1); }
  .btn:active { opacity: 0.82; }
}
