/* ===================================================================
   CleanScope — Main Stylesheet
   Mobile-first, touch-friendly design for iPad/phone/tablet
   Primary color: #38761D (Method Cleaning Services dark green)
   ================================================================== */

/* ===================================================================
   1. CSS VARIABLES & COLOR PALETTE
   ================================================================== */

:root {
  /* Brand Colors */
  --color-primary: #38761D;
  --color-primary-light: #D9EAD3;
  --color-primary-dark: #2c5a16;

  /* Neutral Colors */
  --color-bg: #f5f5f5;
  --color-surface: #ffffff;
  --color-text: #333333;
  --color-text-muted: #666666;
  --color-border: #e0e0e0;
  --color-border-light: #f0f0f0;

  /* Status Colors */
  --color-status-blue: #1a73e8;
  --color-status-green: #38761D;
  --color-status-amber: #f59e0b;
  --color-status-red: #dc2626;
  --color-status-gray: #6b7280;

  /* Semantic Colors */
  --color-success: #38761D;
  --color-warning: #f59e0b;
  --color-error: #dc2626;
  --color-info: #1a73e8;

  /* Spacing */
  --spacing-xs: 4px;
  --spacing-sm: 8px;
  --spacing-md: 12px;
  --spacing-lg: 16px;
  --spacing-xl: 20px;
  --spacing-2xl: 24px;
  --spacing-3xl: 32px;

  /* Typography */
  --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
    'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
    sans-serif;
  --font-size-xs: 12px;
  --font-size-sm: 14px;
  --font-size-base: 16px;
  --font-size-lg: 18px;
  --font-size-xl: 20px;
  --font-size-2xl: 24px;

  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;

  /* Border Radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.15);

  /* Z-index Stack */
  --z-base: 0;
  --z-dropdown: 100;
  --z-fixed: 1000;
  --z-modal: 2000;
  --z-tooltip: 3000;

  /* Touch Targets */
  --min-touch-target: 44px;
  --min-touch-target-small: 36px;

  /* Tab Bar Height (keep consistent for padding-bottom on scrollable content) */
  --tab-bar-height: 64px;
  --header-height: 56px;
}

/* ===================================================================
   2. RESET & BASE STYLES
   ================================================================== */

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

html {
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  height: 100%;
}

body {
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  color: var(--color-text);
  background-color: var(--color-bg);
  height: 100%;
  overflow: hidden;
  position: fixed;
  width: 100%;
}

/* Prevent double-tap zoom on buttons and clickable elements on iOS */
button,
a,
input,
select,
textarea,
[role='button'] {
  -webkit-touch-callout: none;
  touch-action: manipulation;
}

/* ===================================================================
   3. TYPOGRAPHY
   ================================================================== */

h1 {
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-bold);
  margin-bottom: var(--spacing-md);
  color: var(--color-text);
}

h2 {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-semibold);
  margin-bottom: var(--spacing-md);
  color: var(--color-text);
}

h3 {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
  margin-bottom: var(--spacing-sm);
  color: var(--color-text);
}

p {
  margin-bottom: var(--spacing-md);
  line-height: 1.6;
}

small,
.text-sm {
  font-size: var(--font-size-sm);
}

.text-xs {
  font-size: var(--font-size-xs);
}

.text-muted {
  color: var(--color-text-muted);
}

.text-center {
  text-align: center;
}

/* ===================================================================
   4. LAYOUT STRUCTURE
   ================================================================== */

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* Header — base styles (overridden by .app-header where needed) */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);
  background-color: var(--color-primary);
  color: var(--color-surface);
  padding: 0 var(--spacing-md);
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: var(--z-fixed);
}

.header-title {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
  flex: 1;
  text-align: center;
}

.header-left {
  position: absolute;
  left: var(--spacing-lg);
}

.header-right {
  position: absolute;
  right: var(--spacing-lg);
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
}

/* Back Button */
.btn-back {
  background: none;
  border: none;
  color: var(--color-surface);
  font-size: var(--font-size-lg);
  cursor: pointer;
  padding: var(--spacing-md);
  margin: calc(var(--spacing-md) * -1);
  min-width: var(--min-touch-target);
  min-height: var(--min-touch-target);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  transition: background-color 200ms ease;
}

.btn-back:active {
  background-color: rgba(0, 0, 0, 0.1);
}

.btn-back:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Sync Status Indicator */
.sync-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background-color: var(--color-status-gray);
  animation: pulse 2s ease-in-out infinite;
}

.sync-dot.synced {
  background-color: var(--color-status-green);
  animation: none;
}

.sync-dot.syncing {
  background-color: var(--color-status-blue);
  animation: pulse 1s ease-in-out infinite;
}

.sync-dot.error {
  background-color: var(--color-status-red);
  animation: pulse 0.5s ease-in-out infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

/* Content Area */
.content-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

main {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: var(--tab-bar-height);
  -webkit-overflow-scrolling: touch;
}

/* Screen Sections */
.screen {
  display: none;
  width: 100%;
  height: 100%;
  padding: var(--spacing-lg);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.screen.active {
  display: block;
}

/* Tab Bar */
.tab-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--tab-bar-height);
  background-color: var(--color-surface);
  border-top: 1px solid var(--color-border);
  display: flex;
  z-index: var(--z-fixed);
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.05);
}

.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: none;
  background: none;
  color: var(--color-text-muted);
  font-size: var(--font-size-xs);
  transition: all 200ms ease;
  min-height: var(--tab-bar-height);
  position: relative;
}

.tab:active {
  background-color: rgba(56, 118, 29, 0.05);
}

.tab.active {
  color: var(--color-primary);
}

.tab-icon {
  font-size: var(--font-size-xl);
  margin-bottom: var(--spacing-xs);
}

.tab-label {
  font-weight: var(--font-weight-medium);
}

/* ===================================================================
   5. FORMS & INPUTS
   ================================================================== */

label {
  display: block;
  font-weight: var(--font-weight-medium);
  margin-bottom: var(--spacing-sm);
  color: var(--color-text);
  font-size: var(--font-size-sm);
}

.form-group {
  margin-bottom: var(--spacing-lg);
}

.form-group:last-child {
  margin-bottom: 0;
}

input[type='text'],
input[type='email'],
input[type='tel'],
input[type='date'],
input[type='number'],
textarea,
select {
  width: 100%;
  padding: var(--spacing-md);
  font-size: var(--font-size-base);
  font-family: var(--font-family);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background-color: var(--color-surface);
  color: var(--color-text);
  transition: all 200ms ease;
  min-height: var(--min-touch-target);
  -webkit-appearance: none;
  appearance: none;
}

input[type='text']:focus,
input[type='email']:focus,
input[type='tel']:focus,
input[type='date']:focus,
input[type='number']:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(56, 118, 29, 0.1);
  background-color: var(--color-surface);
}

input:disabled,
textarea:disabled,
select:disabled {
  background-color: var(--color-bg);
  color: var(--color-text-muted);
  cursor: not-allowed;
  opacity: 0.6;
}

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

/* Select dropdown styling */
select {
  padding-right: var(--spacing-2xl);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%23666' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
  background-position: right var(--spacing-md) center;
  background-repeat: no-repeat;
  background-size: 20px;
  padding-right: var(--spacing-2xl);
}

/* Checkbox and Radio */
.checkbox-group,
.radio-group {
  margin-bottom: var(--spacing-lg);
}

.checkbox-item,
.radio-item {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-md);
  min-height: var(--min-touch-target);
  cursor: pointer;
}

input[type='checkbox'],
input[type='radio'] {
  width: 20px;
  height: 20px;
  min-width: 20px;
  min-height: 20px;
  cursor: pointer;
  accent-color: var(--color-primary);
}

.checkbox-item label,
.radio-item label {
  margin: 0;
  cursor: pointer;
  flex: 1;
  font-weight: var(--font-weight-normal);
}

/* Input Error State */
input.error,
textarea.error,
select.error {
  border-color: var(--color-error);
  background-color: rgba(220, 38, 38, 0.05);
}

.error-message {
  color: var(--color-error);
  font-size: var(--font-size-sm);
  margin-top: var(--spacing-xs);
  display: block;
}

/* ===================================================================
   6. BUTTONS
   ================================================================== */

button {
  font-family: var(--font-family);
  cursor: pointer;
  border: none;
  border-radius: var(--radius-md);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-medium);
  transition: all 200ms ease;
  min-height: var(--min-touch-target);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-md);
  padding: var(--spacing-md) var(--spacing-lg);
}

button:active {
  transform: scale(0.98);
}

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

/* Primary Button */
.btn-primary {
  background-color: var(--color-primary);
  color: var(--color-surface);
}

.btn-primary:hover:not(:disabled) {
  background-color: var(--color-primary-dark);
}

.btn-primary:active:not(:disabled) {
  background-color: var(--color-primary-dark);
}

/* Secondary Button */
.btn-secondary {
  background-color: var(--color-bg);
  color: var(--color-text);
  border: 1px solid var(--color-border);
}

.btn-secondary:hover:not(:disabled) {
  background-color: var(--color-border-light);
}

.btn-secondary:active:not(:disabled) {
  background-color: var(--color-border-light);
}

/* Danger Button */
.btn-danger {
  background-color: var(--color-error);
  color: var(--color-surface);
}

.btn-danger:hover:not(:disabled) {
  background-color: #b91c1c;
}

.btn-danger:active:not(:disabled) {
  background-color: #b91c1c;
}

/* Button Sizes */
.btn-lg {
  padding: var(--spacing-lg) var(--spacing-2xl);
  font-size: var(--font-size-lg);
  width: 100%;
}

.btn-sm {
  padding: var(--spacing-sm) var(--spacing-md);
  font-size: var(--font-size-sm);
  min-height: var(--min-touch-target-small);
}

/* Button Block */
.btn-block {
  width: 100%;
}

/* Icon Button */
.btn-icon {
  padding: var(--spacing-md);
  min-width: var(--min-touch-target);
  border-radius: var(--radius-md);
  background-color: transparent;
  color: var(--color-primary);
  border: 1px solid var(--color-border);
}

.btn-icon:hover:not(:disabled) {
  background-color: var(--color-primary-light);
}

/* ===================================================================
   7. CARDS & CONTAINERS
   ================================================================== */

.card {
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  margin-bottom: var(--spacing-lg);
  box-shadow: var(--shadow-sm);
  transition: all 200ms ease;
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--spacing-md);
  padding-bottom: var(--spacing-md);
  border-bottom: 1px solid var(--color-border);
}

.card-title {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
  margin: 0;
}

.card-body {
  margin: 0;
}

.card-footer {
  margin-top: var(--spacing-lg);
  padding-top: var(--spacing-lg);
  border-top: 1px solid var(--color-border);
  display: flex;
  gap: var(--spacing-md);
}

/* Area card with drag handle — horizontal layout */
.area-card {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: var(--spacing-md);
  cursor: pointer;
}

.area-card .card-content {
  flex: 1;
  min-width: 0;
}

.area-card .card-header {
  margin-bottom: var(--spacing-sm);
  padding-bottom: var(--spacing-sm);
}

/* Duplicate area button on area cards */
.btn-duplicate-area {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  min-width: 32px;
  height: 32px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text-muted);
  font-size: 16px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}

.btn-duplicate-area:hover,
.btn-duplicate-area:active {
  background: var(--color-primary-light);
  color: var(--color-primary);
}

.dup-icon {
  display: block;
  position: relative;
  width: 12px;
  height: 14px;
}

.dup-icon::before,
.dup-icon::after {
  content: '';
  position: absolute;
  border: 1.5px solid currentColor;
  border-radius: 2px;
  width: 9px;
  height: 10px;
}

.dup-icon::before {
  top: 0;
  left: 0;
  background: var(--color-surface);
}

.dup-icon::after {
  bottom: 0;
  right: 0;
  background: var(--color-surface);
}

/* ---- Drag handles ---- */
.drag-handle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  min-width: 32px;
  height: 48px;
  font-size: 20px;
  color: var(--color-text-secondary);
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  border-radius: var(--radius-sm);
  transition: background-color 150ms ease;
}

.drag-handle:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

.drag-handle:active {
  cursor: grabbing;
  background-color: rgba(0, 0, 0, 0.1);
}

.drag-handle-sm {
  width: 24px;
  min-width: 24px;
  height: 36px;
  font-size: 16px;
}

/* ---- Dragging state ---- */
.dragging {
  position: absolute;
  left: 0;
  right: 0;
  z-index: 100;
  opacity: 0.9;
  box-shadow: var(--shadow-lg);
  pointer-events: none;
}

.drag-placeholder {
  border: 2px dashed var(--color-primary);
  border-radius: var(--radius-md);
  background-color: rgba(22, 101, 52, 0.05);
}

.card-list .drag-placeholder {
  margin-bottom: var(--spacing-lg);
}

.task-list .drag-placeholder {
  margin-bottom: var(--spacing-sm);
}

/* Ensure containers support absolute-positioned drag items */
.card-list,
.task-list {
  position: relative;
}

/* Template task items (admin area template editor) */
.template-task-item {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  margin-bottom: var(--spacing-sm);
  padding: var(--spacing-sm);
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
}

.template-task-item .tpl-task-input {
  flex: 1;
  min-width: 0;
  padding: var(--spacing-sm);
  font-size: var(--font-size-sm);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
}

.template-task-item .tpl-task-remove {
  flex-shrink: 0;
}

#tpl-tasks-container {
  position: relative;
}

/* Walkthrough List Items */
.walkthrough-item {
  padding: var(--spacing-lg);
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  margin-bottom: var(--spacing-md);
  cursor: pointer;
  transition: all 200ms ease;
  display: flex;
  justify-content: space-between;
  align-items: start;
}

.walkthrough-item:active {
  background-color: var(--color-primary-light);
  border-color: var(--color-primary);
}

.walkthrough-item-content {
  flex: 1;
}

.walkthrough-item-title {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
  margin-bottom: var(--spacing-xs);
  color: var(--color-text);
}

.walkthrough-item-meta {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  margin-bottom: var(--spacing-xs);
}

.walkthrough-item-badge {
  margin-left: var(--spacing-md);
}

/* Area List Items */
.area-item {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  padding: var(--spacing-md);
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  margin-bottom: var(--spacing-md);
  cursor: pointer;
  transition: all 200ms ease;
}

.area-item:active {
  background-color: var(--color-primary-light);
}

.area-item-content {
  flex: 1;
  min-width: 0;
}

.area-item-name {
  font-weight: var(--font-weight-semibold);
  color: var(--color-text);
  margin-bottom: var(--spacing-xs);
}

.area-item-info {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}

.area-item-delete {
  color: var(--color-error);
  font-size: var(--font-size-lg);
  cursor: pointer;
  padding: var(--spacing-md);
  margin: calc(var(--spacing-md) * -1);
}

/* ===================================================================
   8. STATUS BADGES
   ================================================================== */

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-xs) var(--spacing-md);
  border-radius: var(--radius-md);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  white-space: nowrap;
  line-height: 1;
}

.badge-primary {
  background-color: var(--color-primary-light);
  color: var(--color-primary);
}

.badge-success {
  background-color: rgba(56, 118, 29, 0.1);
  color: var(--color-status-green);
}

.badge-warning {
  background-color: rgba(245, 158, 11, 0.1);
  color: var(--color-status-amber);
}

.badge-error {
  background-color: rgba(220, 38, 38, 0.1);
  color: var(--color-status-red);
}

.badge-info {
  background-color: rgba(26, 115, 232, 0.1);
  color: var(--color-status-blue);
}

.badge-gray {
  background-color: rgba(107, 114, 128, 0.1);
  color: var(--color-status-gray);
}

/* Status Specific */
.status-badge {
  padding: var(--spacing-sm) var(--spacing-md);
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  display: inline-block;
}

.status-in_progress {
  background-color: rgba(26, 115, 232, 0.1);
  color: var(--color-status-blue);
}

.status-completed {
  background-color: rgba(56, 118, 29, 0.1);
  color: var(--color-status-green);
}

.status-proposal_sent {
  background-color: rgba(245, 158, 11, 0.1);
  color: var(--color-status-amber);
}

.status-accepted {
  background-color: rgba(56, 118, 29, 0.1);
  color: var(--color-status-green);
}

.status-declined {
  background-color: rgba(220, 38, 38, 0.1);
  color: var(--color-status-red);
}

.status-archived {
  background-color: rgba(107, 114, 128, 0.1);
  color: var(--color-status-gray);
}

/* ===================================================================
   9. TASK LIST — Compact iPad-Friendly Layout
   ================================================================== */

.task-list {
  margin-bottom: var(--spacing-md);
}

/* Compact mode — tighter spacing for task items */
.task-list.compact .task-item {
  padding: 6px 8px;
  margin-bottom: 2px;
  border-radius: var(--radius-sm);
  border-left: 3px solid transparent;
}

/* Highlight selected (checked) tasks with a subtle green tint */
.task-list.compact .task-item.task-selected {
  background-color: var(--color-primary-light);
  border-left-color: var(--color-primary);
}

/* Deselected tasks get a muted look */
.task-list.compact .task-item:not(.task-selected) {
  opacity: 0.7;
}

.task-item {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 4px;
  padding: var(--spacing-sm) var(--spacing-md);
  background-color: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-sm);
  margin-bottom: 2px;
}

/* Task main: checkbox+text on left, frequency on right, single row */
.task-main {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

/* Task row: checkbox + text in one line */
.task-row {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  margin: 0;
  font-weight: var(--font-weight-normal);
  line-height: 1.35;
  flex: 1;
  min-width: 0;
}

.task-row input[type='checkbox'] {
  margin-top: 1px;
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  min-width: 18px;
}

.task-text {
  font-size: 13px;
  color: var(--color-text);
  word-break: break-word;
  flex: 1;
}

.custom-tag {
  display: inline-block;
  font-size: 10px;
  background-color: var(--color-primary-light);
  color: var(--color-primary);
  padding: 1px 5px;
  border-radius: 3px;
  margin-left: 4px;
  font-weight: var(--font-weight-semibold);
  vertical-align: middle;
}

/* Inline frequency controls beside task text */
.task-freq-inline {
  display: flex;
  gap: 4px;
  align-items: center;
  flex-shrink: 0;
}

/* Small frequency selects for inline use */
.freq-sm {
  padding: 3px 20px 3px 6px;
  font-size: 12px;
  min-height: 28px;
  height: 28px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background-color: var(--color-surface);
  color: var(--color-text);
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 12 12'%3E%3Cpath fill='%23999' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 5px center;
}

.freq-sm:focus {
  outline: none;
  border-color: var(--color-primary);
}

.freq-times-sm, .freq-sm.freq-times {
  width: 52px;
  flex-shrink: 0;
}

.freq-period-sm, .freq-sm.freq-period {
  min-width: 80px;
  flex: 1;
}

.freq-days-sm, .freq-sm.freq-days {
  min-width: 80px;
}

/* Task toolbar — buttons above task list */
.task-toolbar {
  display: flex;
  gap: var(--spacing-sm);
  margin-bottom: var(--spacing-sm);
}

.task-toolbar .btn-sm {
  font-size: 12px;
  padding: 5px 10px;
  min-height: 32px;
}

/* Area-level default frequency */
.area-default-freq {
  background-color: var(--color-primary-light);
  border: 1px solid rgba(56, 118, 29, 0.2);
  border-radius: var(--radius-md);
  padding: 8px 10px;
  margin-bottom: var(--spacing-md);
}

.area-default-freq-label {
  font-size: 12px;
  font-weight: var(--font-weight-semibold);
  color: var(--color-primary-dark);
  margin-bottom: 4px;
  display: block;
}

.area-default-freq-row {
  display: flex;
  gap: 4px;
  align-items: center;
  flex-wrap: wrap;
}

.area-default-freq-row .freq-select {
  padding: 4px 22px 4px 8px;
  font-size: 13px;
  min-height: 32px;
  border: 1px solid rgba(56, 118, 29, 0.3);
  border-radius: var(--radius-sm);
  background-color: var(--color-surface);
  color: var(--color-text);
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 6px center;
}

.area-default-freq-row .freq-times-sm {
  width: 56px;
  flex-shrink: 0;
}

.area-default-freq-row .freq-period-sm {
  min-width: 90px;
  flex: 1;
}

.area-default-freq-row .freq-days-sm {
  min-width: 90px;
}

.area-default-freq-row .btn {
  font-size: 12px;
  padding: 5px 14px;
  min-height: 32px;
  white-space: nowrap;
}

/* ---- Compact area header ---- */
.area-header-compact {
  padding: 8px 0;
  margin-bottom: 4px;
}

.area-header-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.area-header-row:last-child {
  margin-bottom: 0;
}

.area-name-inline {
  flex: 1;
  font-size: 15px;
  font-weight: var(--font-weight-semibold);
  padding: 6px 8px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
}

.area-time-label {
  font-size: 13px;
  color: var(--color-text-muted);
  white-space: nowrap;
}

.area-time-inline {
  width: 60px;
  padding: 5px 6px;
  font-size: 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  text-align: center;
}

.area-time-unit {
  font-size: 12px;
  color: var(--color-text-muted);
}

/* Area notes section */
.area-notes-section {
  margin-bottom: 8px;
}

.area-notes-label {
  display: block;
  font-size: 13px;
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-muted);
  margin-bottom: 4px;
}

.area-notes-input {
  width: 100%;
  box-sizing: border-box;
  padding: 6px 8px;
  font-size: 14px;
  font-family: inherit;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  resize: vertical;
  min-height: 40px;
}

.area-notes-input:focus {
  outline: none;
  border-color: var(--color-primary);
}

/* -------------------------------------------------------
   Fixtures / Room Counts Section (Restroom & Office)
   ------------------------------------------------------- */
.fixtures-section {
  background: var(--color-primary-light);
  border: 1px solid rgba(56, 118, 29, 0.2);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 12px;
}

.fixtures-header {
  font-size: 13px;
  font-weight: var(--font-weight-bold);
  color: var(--color-primary-dark);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.fixtures-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Thin divider between fixture groups */
.fixture-group-divider {
  height: 1px;
  background: rgba(56, 118, 29, 0.15);
  margin: 4px 0 2px 0;
}

/* Sub-group heading (e.g. "Wash Fountains", "Conference Rooms") */
.fixture-group-label {
  font-size: 12px;
  font-weight: var(--font-weight-semibold);
  color: var(--color-primary);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-bottom: -2px;
}

.fixture-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: var(--min-touch-target-small);
}

.fixture-row-sub {
  padding-left: 14px;
}

.fixture-label {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-normal);
  color: var(--color-text);
  flex: 1;
  min-width: 0;
  margin: 0;
  cursor: pointer;
}

.fixture-select {
  width: 72px;
  min-width: 72px;
  min-height: var(--min-touch-target-small);
  padding: 6px 24px 6px 10px;
  font-size: var(--font-size-sm);
  font-family: inherit;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background-color: var(--color-surface);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  color: var(--color-text);
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}

.fixture-select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(56, 118, 29, 0.1);
}

/* Compact task summary in toolbar */
.task-summary-compact {
  font-size: 12px;
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-muted);
  white-space: nowrap;
}

/* Extra-small buttons for dense toolbars */
.btn-xs {
  font-size: 11px;
  padding: 4px 8px;
  min-height: 26px;
  border-radius: var(--radius-sm);
}

/* Compact frequency-for-all row */
.area-freq-row-compact {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 8px;
  margin-bottom: 6px;
  background-color: var(--color-primary-light);
  border-radius: var(--radius-sm);
}

.area-freq-label-compact {
  font-size: 12px;
  font-weight: var(--font-weight-semibold);
  color: var(--color-primary-dark);
  white-space: nowrap;
  margin-right: 2px;
}

/* Side-by-side action buttons */
.action-buttons-row {
  display: flex;
  gap: var(--spacing-sm);
  margin-top: var(--spacing-lg);
  padding-bottom: var(--spacing-2xl);
}

.action-buttons-row .btn {
  flex: 1;
}

/* Drag handle inside compact task list */
.task-list.compact .drag-handle-sm {
  width: 18px;
  min-width: 18px;
  height: 24px;
  font-size: 12px;
  color: #ccc;
}

/* Legacy classes kept for backward compat */
.task-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.task-item.disabled {
  opacity: 0.7;
}

/* Structured frequency dropdowns (used in area-level default freq) */
.freq-row {
  display: flex;
  gap: var(--spacing-sm);
  align-items: center;
}

.freq-times {
  width: 70px;
  flex-shrink: 0;
}

.freq-period {
  flex: 1;
  min-width: 0;
}

/* Quality check exclusion styles removed — will be added back in Phase 3 (checklist export) */

/* ---- Master Task List (Admin) ---- */
.master-task-item {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  margin-bottom: var(--spacing-sm);
  padding: var(--spacing-sm) var(--spacing-md);
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

.master-task-item .master-task-input {
  flex: 1;
  min-width: 0;
  padding: var(--spacing-sm) var(--spacing-md);
  font-size: var(--font-size-sm);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  min-height: 36px;
}

.master-task-item .master-task-remove {
  flex-shrink: 0;
  padding: var(--spacing-xs) var(--spacing-sm);
  min-height: 32px;
  min-width: 32px;
  font-size: var(--font-size-lg);
  line-height: 1;
}

#master-tasks-container {
  position: relative;
}

/* ---- Template Task Selector (Admin) ---- */
.tpl-task-row {
  display: flex;
  align-items: flex-start;
  gap: var(--spacing-sm);
  margin-bottom: var(--spacing-sm);
  padding: var(--spacing-sm) var(--spacing-md);
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  transition: background-color 150ms ease, border-color 150ms ease;
}

.tpl-task-row.tpl-assigned {
  background-color: rgba(56, 118, 29, 0.04);
  border-color: var(--color-primary-light);
}

.drag-handle-spacer {
  width: 24px;
  min-width: 24px;
  height: 36px;
  flex-shrink: 0;
}

.tpl-task-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
}

.tpl-task-label {
  display: flex;
  align-items: flex-start;
  gap: var(--spacing-sm);
  cursor: pointer;
  margin: 0;
  font-weight: var(--font-weight-normal);
  line-height: 1.4;
}

.tpl-task-label input[type='checkbox'] {
  margin-top: 2px;
  flex-shrink: 0;
}

.tpl-task-master-text {
  flex: 1;
  font-size: var(--font-size-sm);
  color: var(--color-text);
  word-break: break-word;
}

.tpl-task-override {
  margin-top: var(--spacing-xs);
  margin-left: 28px;
}

.tpl-task-override-input {
  width: 100%;
  padding: var(--spacing-sm) var(--spacing-md);
  font-size: var(--font-size-sm);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  min-height: 36px;
  background-color: var(--color-surface);
  color: var(--color-text);
}

.tpl-task-override-input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(56, 118, 29, 0.1);
}

.tpl-task-override-input::placeholder {
  color: var(--color-text-muted);
  font-style: italic;
  font-size: var(--font-size-xs);
}

.task-item-delete {
  color: var(--color-error);
  font-size: var(--font-size-lg);
  cursor: pointer;
  padding: var(--spacing-sm);
  margin: calc(var(--spacing-sm) * -1);
}

/* ===================================================================
   10. PAIN POINTS SECTION
   ================================================================== */

.pain-points-section {
  margin-bottom: var(--spacing-2xl);
}

.pain-points-section h2 {
  margin-bottom: var(--spacing-md);
}

.pain-point-group {
  margin-bottom: var(--spacing-lg);
}

.pain-point-group label {
  display: block;
  font-weight: var(--font-weight-medium);
  font-size: var(--font-size-sm);
  margin-bottom: var(--spacing-sm);
  color: var(--color-text);
}

.pain-point-group textarea {
  width: 100%;
  padding: var(--spacing-md);
  font-size: var(--font-size-base);
  font-family: var(--font-family);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background-color: var(--color-surface);
  color: var(--color-text);
  min-height: 80px;
  resize: vertical;
}

.pain-point-group textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(56, 118, 29, 0.1);
}

.pain-point-count {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  margin-top: var(--spacing-xs);
}

/* ===================================================================
   11. AREA TYPE PICKER (GRID)
   ================================================================== */

.area-type-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-lg);
}

.area-type-card {
  padding: var(--spacing-lg);
  background-color: var(--color-surface);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all 200ms ease;
  text-align: center;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-md);
}

.area-type-card:active {
  border-color: var(--color-primary);
  background-color: var(--color-primary-light);
}

.area-type-icon {
  font-size: 32px;
}

.area-type-name {
  font-weight: var(--font-weight-semibold);
  color: var(--color-text);
}

.area-type-count {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
}

/* Tablet and up: 3 columns */
@media (min-width: 768px) {
  .area-type-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Desktop: 4+ columns */
@media (min-width: 1024px) {
  .area-type-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* ===================================================================
   12. MODALS & OVERLAYS
   ================================================================== */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  display: none;
  align-items: flex-end;
  justify-content: center;
  z-index: var(--z-modal);
  animation: fadeIn 200ms ease;
}

.modal-overlay.visible {
  display: flex;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}

.modal-content {
  background-color: var(--color-surface);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding: var(--spacing-2xl);
  max-width: 100%;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  animation: slideUp 300ms ease;
  box-shadow: var(--shadow-xl);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--spacing-lg);
  padding-bottom: var(--spacing-lg);
  border-bottom: 1px solid var(--color-border);
}

.modal-title {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-semibold);
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  font-size: var(--font-size-xl);
  color: var(--color-text-muted);
  cursor: pointer;
  padding: var(--spacing-md);
  margin: calc(var(--spacing-md) * -1);
  min-width: var(--min-touch-target);
  min-height: var(--min-touch-target);
}

.modal-close:active {
  color: var(--color-text);
}

.modal-body {
  margin-bottom: var(--spacing-lg);
}

.modal-footer {
  display: flex;
  gap: var(--spacing-md);
  flex-direction: column;
}

.modal-footer button {
  width: 100%;
}

/* Dialog (centered modal) */
.dialog-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-modal);
  padding: var(--spacing-lg);
  animation: fadeIn 200ms ease;
}

.dialog-overlay.hidden {
  display: none;
}

.dialog-content {
  background-color: var(--color-surface);
  border-radius: var(--radius-xl);
  padding: var(--spacing-2xl);
  max-width: 500px;
  width: 100%;
  box-shadow: var(--shadow-xl);
  animation: slideDown 300ms ease;
}

@keyframes slideDown {
  from {
    transform: scale(0.95);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

/* ===================================================================
   13. LOADING & PROGRESS
   ================================================================== */

.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.3);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: var(--z-modal);
  animation: fadeIn 200ms ease;
}

.loading-overlay.visible {
  display: flex;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.loading-text {
  text-align: center;
  margin-top: var(--spacing-lg);
  color: var(--color-text-muted);
}

/* Progress Bar */
.progress-bar {
  width: 100%;
  height: 4px;
  background-color: var(--color-border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin: var(--spacing-lg) 0;
}

.progress-bar-fill {
  height: 100%;
  background-color: var(--color-primary);
  border-radius: var(--radius-sm);
  transition: width 300ms ease;
}

/* ===================================================================
   14. ALERTS & MESSAGES
   ================================================================== */

.alert {
  padding: var(--spacing-lg);
  margin-bottom: var(--spacing-lg);
  border-radius: var(--radius-lg);
  border-left: 4px solid;
  display: flex;
  gap: var(--spacing-md);
  align-items: flex-start;
}

.alert-icon {
  font-size: var(--font-size-lg);
  flex-shrink: 0;
  margin-top: 2px;
}

.alert-content {
  flex: 1;
}

.alert-title {
  font-weight: var(--font-weight-semibold);
  margin-bottom: var(--spacing-xs);
}

.alert-message {
  font-size: var(--font-size-sm);
  line-height: 1.5;
  margin: 0;
}

.alert-success {
  background-color: rgba(56, 118, 29, 0.1);
  border-left-color: var(--color-status-green);
  color: var(--color-status-green);
}

.alert-error {
  background-color: rgba(220, 38, 38, 0.1);
  border-left-color: var(--color-status-red);
  color: var(--color-status-red);
}

.alert-warning {
  background-color: rgba(245, 158, 11, 0.1);
  border-left-color: var(--color-status-amber);
  color: var(--color-status-amber);
}

.alert-info {
  background-color: rgba(26, 115, 232, 0.1);
  border-left-color: var(--color-status-blue);
  color: var(--color-status-blue);
}

/* ===================================================================
   15. UTILITY CLASSES
   ================================================================== */

.container {
  max-width: 100%;
  margin: 0 auto;
}

.container-sm {
  max-width: 540px;
  margin: 0 auto;
}

.container-md {
  max-width: 720px;
  margin: 0 auto;
}

.container-lg {
  max-width: 1200px;
  margin: 0 auto;
}

/* Spacing Utilities */
.mt-0 { margin-top: 0; }
.mt-xs { margin-top: var(--spacing-xs); }
.mt-sm { margin-top: var(--spacing-sm); }
.mt-md { margin-top: var(--spacing-md); }
.mt-lg { margin-top: var(--spacing-lg); }
.mt-xl { margin-top: var(--spacing-xl); }

.mb-0 { margin-bottom: 0; }
.mb-xs { margin-bottom: var(--spacing-xs); }
.mb-sm { margin-bottom: var(--spacing-sm); }
.mb-md { margin-bottom: var(--spacing-md); }
.mb-lg { margin-bottom: var(--spacing-lg); }
.mb-xl { margin-bottom: var(--spacing-xl); }

.mx-auto { margin-left: auto; margin-right: auto; }
.my-auto { margin-top: auto; margin-bottom: auto; }

.p-0 { padding: 0; }
.p-xs { padding: var(--spacing-xs); }
.p-sm { padding: var(--spacing-sm); }
.p-md { padding: var(--spacing-md); }
.p-lg { padding: var(--spacing-lg); }
.p-xl { padding: var(--spacing-xl); }

/* Flexbox Utilities */
.flex {
  display: flex;
}

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

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

.flex-center {
  align-items: center;
  justify-content: center;
}

.flex-between {
  justify-content: space-between;
}

.gap-sm { gap: var(--spacing-sm); }
.gap-md { gap: var(--spacing-md); }
.gap-lg { gap: var(--spacing-lg); }

/* Grid Utilities */
.grid {
  display: grid;
}

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

.grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

/* Visibility */
.hidden {
  display: none !important;
}

.visible {
  display: block !important;
}

.invisible {
  visibility: hidden;
}

/* Text Utilities */
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.break-words {
  word-break: break-word;
  overflow-wrap: break-word;
}

/* ===================================================================
   16. RESPONSIVE DESIGN
   ================================================================== */

/* Tablet (768px and up) */
@media (min-width: 768px) {
  :root {
    --font-size-base: 17px;
  }

  .screen {
    padding: var(--spacing-2xl);
  }

  .card {
    padding: var(--spacing-2xl);
  }

  .modal-content {
    width: 90%;
    max-width: 600px;
    border-radius: var(--radius-xl);
  }

  .modal-overlay {
    align-items: center;
  }

  .dialog-content {
    max-width: 600px;
  }

  button {
    padding: var(--spacing-lg) var(--spacing-2xl);
  }

  .btn-lg {
    width: auto;
  }
}

/* Desktop (1024px and up) */
@media (min-width: 1024px) {
  .container-lg {
    padding: 0 var(--spacing-2xl);
  }

  .modal-overlay {
    justify-content: flex-end;
  }

  .modal-content {
    width: 50%;
    max-width: 800px;
    border-radius: var(--radius-xl);
    max-height: 100vh;
  }

  .area-type-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}

/* Large Desktop (1440px and up) */
@media (min-width: 1440px) {
  .area-type-grid {
    grid-template-columns: repeat(6, 1fr);
  }
}

/* Small phones (up to 480px) */
@media (max-width: 480px) {
  :root {
    --font-size-base: 15px;
    --spacing-lg: 12px;
    --spacing-xl: 16px;
  }

  .screen {
    padding: var(--spacing-md);
  }

  .card {
    padding: var(--spacing-md);
  }

  button {
    padding: var(--spacing-md);
    width: 100%;
  }

  .btn-lg {
    width: 100%;
  }
}

/* Landscape orientation adjustments */
@media (orientation: landscape) and (max-height: 600px) {
  :root {
    --tab-bar-height: 56px;
    --header-height: 48px;
  }

  .screen {
    padding: var(--spacing-md);
  }

  .modal-content {
    max-height: 90vh;
  }
}

/* ===================================================================
   17. DARK MODE SUPPORT (Future)
   ================================================================== */

@media (prefers-color-scheme: dark) {
  /* Can be extended later if dark mode is needed */
}

/* ===================================================================
   18. ACCESSIBILITY & FOCUS STATES
   ================================================================== */

/* Focus visible for keyboard navigation */
:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

button:focus-visible {
  outline: 2px solid var(--color-surface);
  outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: more) {
  .card {
    border-width: 2px;
  }

  button {
    border: 2px solid currentColor;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ===================================================================
   18b. MISSING UI CLASSES — Layout and component styles
   ================================================================== */

/* Full-width button */
.btn-full-width {
  width: 100%;
}

/* Header back button */
.header-back-btn {
  background: none;
  border: none;
  color: var(--color-surface);
  font-size: 22px;
  cursor: pointer;
  padding: 8px 12px;
  min-width: var(--min-touch-target);
  min-height: var(--min-touch-target);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  transition: background-color 150ms ease;
}

.header-back-btn:active {
  background-color: rgba(0, 0, 0, 0.15);
}

/* App title in header */
.app-title {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
  margin: 0;
  flex: 1;
  text-align: center;
}

/* App header layout */
.app-header {
  display: flex;
  align-items: center;
  height: var(--header-height);
  background-color: var(--color-primary);
  color: var(--color-surface);
  padding: 0 var(--spacing-md);
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: var(--z-fixed);
}

/* Screen content wrapper */
.screen-content {
  max-width: 800px;
  margin: 0 auto;
  padding-bottom: calc(var(--tab-bar-height) + 20px);
}

/* Section headers */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--spacing-md);
}

.section-header h2 {
  margin: 0;
}

.section-header-small {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: var(--spacing-lg);
  margin-bottom: var(--spacing-sm);
}

.section-header-small h3 {
  margin: 0;
  font-size: var(--font-size-base);
}

.section-helper {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  margin-bottom: var(--spacing-md);
}

/* Form sections */
.form-section {
  margin-bottom: var(--spacing-lg);
}

.form-fieldset {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--spacing-md);
  margin-bottom: var(--spacing-lg);
}

.form-fieldset legend {
  font-weight: var(--font-weight-semibold);
  padding: 0 var(--spacing-sm);
  font-size: var(--font-size-base);
}

.field-helper {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  margin-bottom: var(--spacing-md);
}

/* Time input group */
.time-input-group {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.time-input-group input {
  flex: 0 0 100px;
  width: 100px;
}

.time-unit {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  white-space: nowrap;
}

/* Areas section */
.areas-section {
  margin-top: var(--spacing-lg);
}

.area-summary {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}

.task-summary {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}

/* Tasks section */
.tasks-section {
  margin-top: var(--spacing-md);
}

/* Action buttons at bottom of screens */
.action-buttons {
  margin-top: var(--spacing-lg);
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

/* Card meta row and items */
.card-meta-row {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  flex-wrap: wrap;
}

.card-meta {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}

.card-meta-sep {
  color: var(--color-border);
  font-size: var(--font-size-sm);
}

/* Area type label/badge */
.area-type-label {
  font-size: var(--font-size-xs);
  color: var(--color-primary);
  background-color: var(--color-primary-light);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-weight: var(--font-weight-medium);
}

/* Area type picker buttons */
.area-type-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-xs);
  padding: var(--spacing-lg);
  background-color: var(--color-surface);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all 200ms ease;
  min-height: 80px;
}

.area-type-btn:active {
  border-color: var(--color-primary);
  background-color: var(--color-primary-light);
}

/* Login container */
.login-container {
  text-align: left;
}

.logo-area {
  margin-bottom: var(--spacing-lg);
}

.logo-area h2 {
  margin-bottom: var(--spacing-xs);
}

.tagline {
  color: var(--color-text-muted);
  font-size: var(--font-size-base);
}

.login-note {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  margin-top: var(--spacing-sm);
}

.btn-google {
  font-size: var(--font-size-base);
}

.message-area {
  margin-top: var(--spacing-lg);
}

.message {
  padding: var(--spacing-md);
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
}

.message-warning {
  background-color: rgba(245, 158, 11, 0.1);
  color: var(--color-status-amber);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

/* Empty state */
.empty-state {
  text-align: center;
  color: var(--color-text-muted);
  padding: var(--spacing-2xl) var(--spacing-lg);
  font-size: var(--font-size-sm);
}

/* Tab bar button (class variant used in HTML) */
.tab-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: none;
  background: none;
  color: var(--color-text-muted);
  font-size: var(--font-size-xs);
  transition: color 200ms ease;
  min-height: var(--tab-bar-height);
}

.tab-btn:active {
  background-color: rgba(56, 118, 29, 0.05);
}

.tab-btn.active {
  color: var(--color-primary);
}

/* Status badge variants used by statusBadgeHtml */
.badge-blue {
  background-color: rgba(26, 115, 232, 0.1);
  color: var(--color-status-blue);
}

.badge-green {
  background-color: rgba(56, 118, 29, 0.1);
  color: var(--color-status-green);
}

.badge-amber {
  background-color: rgba(245, 158, 11, 0.1);
  color: var(--color-status-amber);
}

.badge-red {
  background-color: rgba(220, 38, 38, 0.1);
  color: var(--color-status-red);
}

/* Walkthrough card */
.walkthrough-card {
  cursor: pointer;
}

.card-header-actions {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.btn-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  color: var(--color-text-muted);
  font-size: 20px;
  line-height: 1;
  border-radius: var(--radius-md);
  cursor: pointer;
  padding: 0;
  transition: all 150ms ease;
}

.btn-icon:hover,
.btn-icon:active {
  background: rgba(220, 38, 38, 0.1);
  color: var(--color-error);
}

/* Task text editing */
.task-text {
  cursor: text;
  border-bottom: 1px dashed transparent;
  transition: border-color 150ms ease;
}

.task-text:hover {
  border-bottom-color: var(--color-border);
}

.task-text-edit {
  font-size: 13px;
  padding: 2px 4px;
  border: 1px solid var(--color-primary);
  border-radius: var(--radius-sm);
  outline: none;
  width: 100%;
  box-sizing: border-box;
}

/* Template card */
.template-card {
  cursor: pointer;
}

/* Template tasks section */
.template-tasks-section {
  margin-top: var(--spacing-md);
}

/* Modal dialog (centered, used by spAlert/spConfirm) */
.modal-dialog {
  background-color: var(--color-surface);
  border-radius: var(--radius-xl);
  padding: var(--spacing-2xl);
  max-width: 400px;
  width: 90%;
  margin: auto;
  box-shadow: var(--shadow-xl);
  text-align: center;
}

.modal-icon {
  font-size: 32px;
  margin-bottom: var(--spacing-md);
}

.modal-icon-success { color: var(--color-success); }
.modal-icon-error { color: var(--color-error); }
.modal-icon-warning { color: var(--color-warning); }
.modal-icon-info { color: var(--color-info); }

.modal-message {
  font-size: var(--font-size-base);
  margin-bottom: var(--spacing-lg);
  color: var(--color-text);
}

.modal-actions {
  display: flex;
  gap: var(--spacing-sm);
  justify-content: center;
}

.modal-actions .btn {
  min-width: 100px;
}

/* Loading spinner and message */
.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.loading-message {
  margin-top: var(--spacing-md);
  color: var(--color-surface);
  font-size: var(--font-size-base);
  text-align: center;
}

.loading-overlay {
  flex-direction: column;
}

/* Sync dot states */
.sync-dot.online {
  background-color: var(--color-status-green);
  animation: none;
}

.sync-dot.offline {
  background-color: var(--color-status-gray);
  animation: pulse 2s ease-in-out infinite;
}

/* ===================================================================
   19. TOAST NOTIFICATIONS (auto-dismiss)
   ================================================================== */

.toast {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%) translateY(-80px);
  z-index: 10001;
  padding: 10px 20px;
  border-radius: var(--radius-lg);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  cursor: pointer;
  opacity: 0;
  transition: transform 300ms ease, opacity 300ms ease;
  max-width: 90%;
  text-align: center;
}

.toast-visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.toast-exit {
  transform: translateX(-50%) translateY(-80px);
  opacity: 0;
}

.toast-success {
  background-color: var(--color-primary);
  color: #fff;
}

.toast-info {
  background-color: var(--color-status-blue);
  color: #fff;
}

.toast-icon {
  margin-right: 6px;
}

/* ===================================================================
   20. PRINT STYLES (Future)
   ================================================================== */

@media print {
  body {
    background-color: white;
  }

  .screen {
    padding: 0;
  }

  .tab-bar,
  header,
  .btn-back {
    display: none;
  }

  main {
    padding-bottom: 0;
  }
}

/* ===================================================================
   20. WEBKIT SPECIFIC
   ================================================================== */

/* iOS Safari specific */
input[type='text'],
input[type='email'],
input[type='tel'],
input[type='date'],
input[type='number'],
textarea,
select {
  font-size: 16px; /* Prevents zoom on iOS */
}

/* Smooth scrolling */
html {
  scroll-behavior: smooth;
}

/* ===================================================================
   END OF STYLESHEET
   ================================================================== */
