/* app.css — Ability Plus Maintenance System
   Modern mobile-first design system with CSS custom properties
   Updated: Feb 18, 2026 — UI Modernization */

/* ==============================
   0. Design Tokens
   ============================== */
:root {
  /* Brand */
  --brand: #B30000;
  --brand-dark: #8B0000;
  --brand-light: #fef2f2;

  /* Status */
  --status-open: #2563eb;
  --status-open-bg: #eff6ff;
  --status-pending: #d97706;
  --status-pending-bg: #fffbeb;
  --status-closed: #059669;
  --status-closed-bg: #ecfdf5;
  --status-emergency: #dc2626;

  /* Neutrals */
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;

  /* Surfaces */
  --surface: #ffffff;
  --surface-raised: #ffffff;
  --bg: #f3f4f6;

  /* Spacing scale */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;
  --sp-10: 40px;
  --sp-12: 48px;

  /* Typography */
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "SF Mono", "Cascadia Code", "Fira Code", Consolas, monospace;
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;

  /* Radii */
  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;

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

  /* Transitions */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --duration: 150ms;
}

/* ==============================
   1. Reset & Base
   ============================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--gray-800);
  background: var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--brand);
  text-decoration: none;
  transition: color var(--duration) var(--ease);
}
a:hover { color: var(--brand-dark); }

img { max-width: 100%; height: auto; display: block; }

/* ==============================
   2. Layout
   ============================== */
.page-header {
  background: var(--surface);
  border-bottom: 1px solid var(--gray-200);
  padding: var(--sp-3) var(--sp-4);
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: var(--sp-4);
}

.page-header .logo {
  height: 36px;
  width: auto;
  flex-shrink: 0;
}

.page-header h1 {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--gray-800);
  flex: 1;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.page-header .user-bar {
  font-size: var(--text-sm);
  color: var(--gray-500);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.page-header .user-bar a {
  color: var(--brand);
  font-weight: 600;
}

/* House banner for kiosk */
.house-banner {
  background: var(--brand);
  color: #fff;
  text-align: center;
  padding: var(--sp-2) var(--sp-4);
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: 0.02em;
}

.container {
  max-width: 600px;
  margin: 0 auto;
  padding: var(--sp-4);
}

.container-wide {
  max-width: 960px;
  margin: 0 auto;
  padding: var(--sp-4);
}

.container-kiosk {
  max-width: 540px;
  margin: 0 auto;
  padding: var(--sp-5);
}

/* ==============================
   3. Cards
   ============================== */
.card {
  background: var(--surface-raised);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: var(--sp-5);
  margin-bottom: var(--sp-4);
  border: 1px solid var(--gray-200);
}

.card-flush {
  padding: 0;
}

.card-header {
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--gray-100);
  font-weight: 600;
  font-size: var(--text-lg);
}

.card-body {
  padding: var(--sp-5);
}

/* ==============================
   4. Tiles (Kiosk)
   ============================== */
.tile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-4);
  margin-bottom: var(--sp-5);
}

.tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--sp-6) var(--sp-4);
  border-radius: var(--radius-xl);
  background: var(--surface);
  border: 2px solid var(--gray-200);
  box-shadow: var(--shadow);
  text-decoration: none;
  color: var(--gray-700);
  transition: all var(--duration) var(--ease);
  cursor: pointer;
  min-height: 140px;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.tile:hover, .tile:active {
  border-color: var(--brand);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  text-decoration: none;
  color: var(--gray-800);
}

.tile:active {
  transform: translateY(0);
}

.tile-icon {
  width: 48px;
  height: 48px;
  margin-bottom: var(--sp-3);
}

.tile-count {
  font-size: var(--text-3xl);
  font-weight: 800;
  line-height: 1;
  margin-bottom: var(--sp-1);
}

.tile-label {
  font-size: var(--text-sm);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Tile color variants */
.tile-submit {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.tile-submit:hover, .tile-submit:active {
  background: var(--brand-dark);
  border-color: var(--brand-dark);
  color: #fff;
}
.tile-submit .tile-icon { filter: brightness(0) invert(1); }

.tile-open { border-left: 4px solid var(--status-open); }
.tile-open .tile-count { color: var(--status-open); }

.tile-pending { border-left: 4px solid var(--status-pending); }
.tile-pending .tile-count { color: var(--status-pending); }

.tile-closed { border-left: 4px solid var(--status-closed); }
.tile-closed .tile-count { color: var(--status-closed); }

/* Full-width tile */
.tile-full {
  grid-column: 1 / -1;
}

/* ==============================
   5. Typography
   ============================== */
h1 { font-size: var(--text-2xl); font-weight: 700; color: var(--gray-900); margin-bottom: var(--sp-4); }
h2 { font-size: var(--text-xl); font-weight: 600; color: var(--gray-800); margin-bottom: var(--sp-3); }
h3 { font-size: var(--text-lg); font-weight: 600; color: var(--gray-700); margin-bottom: var(--sp-2); }

.notice {
  text-align: center;
  font-style: italic;
  color: var(--gray-500);
  margin-bottom: var(--sp-3);
  font-size: var(--text-sm);
}

.section-title {
  font-size: var(--text-sm);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gray-400);
  margin-bottom: var(--sp-3);
}

/* ==============================
   6. Forms
   ============================== */
.form-group {
  margin-bottom: var(--sp-4);
}

label {
  display: block;
  font-weight: 600;
  margin-bottom: var(--sp-1);
  font-size: var(--text-sm);
  color: var(--gray-700);
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="date"],
input[type="datetime-local"],
input[type="number"],
input[type="password"],
input[type="search"],
select,
textarea {
  width: 100%;
  padding: var(--sp-3) var(--sp-4);
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: var(--text-base);
  font-family: var(--font);
  background: var(--surface);
  color: var(--gray-800);
  transition: border-color var(--duration) var(--ease), box-shadow var(--duration) var(--ease);
  appearance: none;
  -webkit-appearance: none;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(179, 0, 0, 0.12);
}

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

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

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%236b7280' viewBox='0 0 16 16'%3E%3Cpath d='M4.5 6l3.5 4 3.5-4z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 36px;
}

.checkbox-group {
  margin: var(--sp-2) 0 var(--sp-3);
}

.checkbox-group input[type="checkbox"] {
  width: auto;
  margin-right: var(--sp-2);
  vertical-align: middle;
  accent-color: var(--brand);
}

.checkbox-group label {
  display: inline;
  font-weight: normal;
  font-size: var(--text-base);
}

/* Read-only field display */
.field-display {
  background: var(--gray-50);
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  padding: var(--sp-3) var(--sp-4);
  font-size: var(--text-base);
  color: var(--gray-700);
  font-weight: 500;
}

/* ==============================
   7. Buttons
   ============================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-5);
  border: none;
  border-radius: var(--radius);
  font-size: var(--text-base);
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  transition: all var(--duration) var(--ease);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  line-height: 1.5;
}

.btn:hover { text-decoration: none; }

.btn-block {
  display: flex;
  width: 100%;
}

.btn-primary {
  background: var(--brand);
  color: #fff;
}
.btn-primary:hover {
  background: var(--brand-dark);
  color: #fff;
}

.btn-success {
  background: var(--status-closed);
  color: #fff;
}
.btn-success:hover {
  background: #047857;
  color: #fff;
}

.btn-danger {
  background: #dc2626;
  color: #fff;
}
.btn-danger:hover {
  background: #b91c1c;
  color: #fff;
}

.btn-outline {
  background: transparent;
  color: var(--gray-600);
  border: 1.5px solid var(--gray-300);
}
.btn-outline:hover {
  background: var(--gray-50);
  border-color: var(--gray-400);
  color: var(--gray-700);
}

.btn-ghost {
  background: transparent;
  color: var(--brand);
  padding: var(--sp-2) var(--sp-3);
}
.btn-ghost:hover {
  background: var(--brand-light);
  color: var(--brand-dark);
}

.btn-sm {
  padding: var(--sp-2) var(--sp-3);
  font-size: var(--text-sm);
  border-radius: var(--radius-sm);
}

.btn-lg {
  padding: var(--sp-4) var(--sp-6);
  font-size: var(--text-lg);
  border-radius: var(--radius-lg);
}

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: var(--radius);
}

/* Submit buttons in forms */
button[type="submit"],
input[type="submit"] {
  width: 100%;
  padding: var(--sp-4);
  background: var(--brand);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: var(--text-base);
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  margin-top: var(--sp-2);
  transition: background var(--duration) var(--ease);
}

button[type="submit"]:hover,
input[type="submit"]:hover {
  background: var(--brand-dark);
}

button[type="submit"]:disabled {
  background: var(--gray-300);
  cursor: not-allowed;
}

/* ==============================
   8. Tables
   ============================== */
.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: var(--sp-4);
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
}

th, td {
  padding: var(--sp-3) var(--sp-4);
  text-align: left;
  font-size: var(--text-sm);
  border-bottom: 1px solid var(--gray-100);
}

th {
  background: var(--gray-50);
  font-weight: 600;
  color: var(--gray-600);
  white-space: nowrap;
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

tbody tr:hover {
  background: var(--gray-50);
}

tbody tr:last-child td {
  border-bottom: none;
}

/* ==============================
   9. Alerts / Messages
   ============================== */
.alert {
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--radius);
  margin-bottom: var(--sp-4);
  font-size: var(--text-sm);
  font-weight: 500;
  display: flex;
  align-items: flex-start;
  gap: var(--sp-2);
}

.alert-success {
  background: var(--status-closed-bg);
  border: 1px solid #a7f3d0;
  color: #065f46;
}

.alert-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
}

.alert-warning {
  background: var(--status-pending-bg);
  border: 1px solid #fde68a;
  color: #92400e;
}

.alert-info {
  background: var(--status-open-bg);
  border: 1px solid #bfdbfe;
  color: #1e40af;
}

/* ==============================
   10. Badges
   ============================== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.badge-open { background: var(--status-open-bg); color: var(--status-open); }
.badge-pending { background: var(--status-pending-bg); color: var(--status-pending); }
.badge-closed { background: var(--status-closed-bg); color: var(--status-closed); }
.badge-active { background: var(--status-closed-bg); color: var(--status-closed); }
.badge-inactive { background: #fef2f2; color: #dc2626; }
.badge-emergency { background: #fef2f2; color: var(--status-emergency); }

/* ==============================
   11. Ticket Cards
   ============================== */
.ticket-card {
  background: var(--surface);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: var(--sp-4);
  margin-bottom: var(--sp-3);
  transition: box-shadow var(--duration) var(--ease);
}

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

.ticket-card .ticket-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--sp-2);
}

.ticket-card .ticket-id {
  font-weight: 700;
  font-size: var(--text-base);
  color: var(--gray-800);
}

.ticket-card .ticket-id a {
  color: var(--brand);
}

.ticket-card .ticket-body {
  font-size: var(--text-sm);
  color: var(--gray-600);
  line-height: 1.6;
}

.ticket-card .ticket-body > div {
  margin-bottom: var(--sp-1);
}

.ticket-card .ticket-body strong {
  color: var(--gray-700);
}

.ticket-card .ticket-actions {
  margin-top: var(--sp-3);
  padding-top: var(--sp-3);
  border-top: 1px solid var(--gray-100);
}

/* ==============================
   12. Action Bar
   ============================== */
.action-bar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  justify-content: flex-end;
  align-items: center;
  margin: var(--sp-4) 0;
}

.action-bar .btn {
  flex: 0 0 auto;
}

/* ==============================
   13. Pagination
   ============================== */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--sp-1);
  margin: var(--sp-4) 0;
  flex-wrap: wrap;
}

.pagination a,
.pagination span {
  padding: var(--sp-2) var(--sp-3);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-weight: 500;
  text-decoration: none;
  color: var(--gray-600);
  transition: all var(--duration) var(--ease);
}

.pagination a:hover {
  background: var(--gray-50);
  border-color: var(--gray-300);
  text-decoration: none;
}

.pagination .active {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}

.pagination .disabled {
  color: var(--gray-300);
  pointer-events: none;
}

/* ==============================
   14. Auth Pages
   ============================== */
.auth-page {
  min-height: calc(100vh - 80px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-4);
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: var(--sp-8);
  border: 1px solid var(--gray-200);
}

.auth-card .logo-wrap {
  text-align: center;
  margin-bottom: var(--sp-6);
}

.auth-card .logo-wrap img {
  max-width: 200px;
  margin: 0 auto;
}

.auth-card h2 {
  text-align: center;
  font-size: var(--text-xl);
  margin-bottom: var(--sp-5);
}

.auth-footer {
  text-align: center;
  margin-top: var(--sp-5);
  padding-top: var(--sp-4);
  border-top: 1px solid var(--gray-100);
  font-size: var(--text-sm);
  color: var(--gray-500);
}

/* ==============================
   15. Stats Cards (Dashboard)
   ============================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: var(--sp-3);
  margin-bottom: var(--sp-5);
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: var(--sp-4) var(--sp-3);
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.stat-value {
  font-size: var(--text-3xl);
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: var(--sp-1);
}

.stat-label {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gray-500);
}

/* ==============================
   16. Photo Upload
   ============================== */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: var(--sp-2);
  margin-top: var(--sp-2);
}

.photo-thumb {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--gray-200);
  background: var(--gray-50);
}

.photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-thumb .photo-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(0,0,0,0.6);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  line-height: 1;
  padding: 0;
}

.photo-thumb .photo-remove:hover {
  background: rgba(220,38,38,0.9);
}

.photo-add {
  aspect-ratio: 1;
  border: 2px dashed var(--gray-300);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--duration) var(--ease);
  color: var(--gray-400);
  background: var(--gray-50);
}

.photo-add:hover {
  border-color: var(--brand);
  color: var(--brand);
  background: var(--brand-light);
}

.photo-add svg {
  width: 28px;
  height: 28px;
  margin-bottom: var(--sp-1);
}

.photo-add span {
  font-size: var(--text-xs);
  font-weight: 600;
}

/* ==============================
   17. Status Message
   ============================== */
.status-msg {
  margin-top: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--radius);
  font-weight: 600;
  text-align: center;
  font-size: var(--text-sm);
}

.status-success { background: var(--status-closed-bg); color: #065f46; border: 1px solid #a7f3d0; }
.status-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.status-loading { background: var(--status-open-bg); color: #1e40af; border: 1px solid #bfdbfe; }

/* ==============================
   18. Ticket list (kiosk)
   ============================== */
.ticket-list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--sp-3);
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  color: var(--brand);
  font-weight: 600;
  font-size: var(--text-sm);
  padding: var(--sp-2) 0;
}

.back-link:hover {
  color: var(--brand-dark);
}

.empty-state {
  text-align: center;
  padding: var(--sp-10) var(--sp-4);
  color: var(--gray-400);
}

.empty-state svg {
  width: 64px;
  height: 64px;
  margin: 0 auto var(--sp-4);
  opacity: 0.5;
}

.empty-state p {
  font-size: var(--text-sm);
  font-weight: 500;
}

/* ==============================
   19. Helpers
   ============================== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-sm { font-size: var(--text-sm); }
.text-muted { color: var(--gray-500); }
.font-bold { font-weight: 700; }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: var(--sp-2); }
.mt-2 { margin-top: var(--sp-4); }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: var(--sp-2); }
.mb-2 { margin-bottom: var(--sp-4); }
.hidden { display: none; }

.divider {
  height: 1px;
  background: var(--gray-200);
  margin: var(--sp-4) 0;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* ==============================
   20. Chart containers
   ============================== */
.chart-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-4);
  margin-bottom: var(--sp-5);
}

.chart-card {
  background: var(--surface);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: var(--sp-4);
  box-shadow: var(--shadow-sm);
}

.chart-card h3 {
  font-size: var(--text-sm);
  color: var(--gray-600);
  margin-bottom: var(--sp-3);
}

.chart-wrap {
  position: relative;
  height: 250px;
}

/* ==============================
   21. Mobile Breakpoints
   ============================== */
@media (max-width: 480px) {
  .page-header {
    padding: var(--sp-2) var(--sp-3);
  }

  .page-header .logo {
    height: 28px;
  }

  .page-header h1 {
    font-size: var(--text-base);
  }

  .container, .container-wide, .container-kiosk {
    padding: var(--sp-3);
  }

  .card {
    padding: var(--sp-4);
    border-radius: var(--radius);
  }

  .tile-grid {
    gap: var(--sp-3);
  }

  .tile {
    min-height: 120px;
    padding: var(--sp-4) var(--sp-3);
  }

  .auth-card {
    padding: var(--sp-5);
  }
}

@media (max-width: 768px) {
  .chart-grid {
    grid-template-columns: 1fr;
  }

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

  .action-bar .btn {
    width: 100%;
    text-align: center;
  }

  .hide-mobile {
    display: none;
  }

  th, td {
    padding: var(--sp-2) var(--sp-3);
    font-size: var(--text-xs);
  }

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

@media (min-width: 769px) {
  .page-header {
    padding: var(--sp-3) var(--sp-6);
  }
}

/* ==============================
   22. Confirm Modal
   ============================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-4);
  opacity: 0;
  visibility: hidden;
  transition: opacity 200ms var(--ease), visibility 200ms;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-dialog {
  background: var(--surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 400px;
  padding: var(--sp-6);
  transform: scale(0.95) translateY(8px);
  transition: transform 200ms var(--ease);
}

.modal-overlay.active .modal-dialog {
  transform: scale(1) translateY(0);
}

.modal-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--sp-4);
}

.modal-icon-danger {
  background: #fef2f2;
  color: #dc2626;
}

.modal-icon-warning {
  background: var(--status-pending-bg);
  color: var(--status-pending);
}

.modal-icon svg {
  width: 24px;
  height: 24px;
}

.modal-title {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--gray-900);
  text-align: center;
  margin-bottom: var(--sp-2);
}

.modal-body {
  font-size: var(--text-sm);
  color: var(--gray-600);
  text-align: center;
  line-height: 1.6;
  margin-bottom: var(--sp-5);
}

.modal-actions {
  display: flex;
  gap: var(--sp-3);
}

.modal-actions .btn {
  flex: 1;
}

.modal-btn-cancel {
  background: var(--gray-100);
  color: var(--gray-700);
  border: 1px solid var(--gray-200);
}

.modal-btn-cancel:hover {
  background: var(--gray-200);
}

/* ==============================
   23. Print
   ============================== */
@media print {
  .page-header, .house-banner, .action-bar, .btn, .photo-add, .photo-remove { display: none; }
  body { background: #fff; }
  .card { box-shadow: none; border: 1px solid #ddd; }
}

/* ==============================
   24. Mobile Improvements (2026-04-15)
   ============================== */

/* Header: let long titles wrap to 2nd line on small screens instead of truncating */
@media (max-width: 480px) {
  .page-header h1 {
    white-space: normal;
    font-size: var(--text-sm);
    line-height: 1.3;
    text-align: center;
  }
  .page-header .user-bar {
    font-size: var(--text-xs);
  }
}

/* Dashboard action buttons: organized grid */
.action-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-2);
  margin: var(--sp-4) 0;
  padding: var(--sp-3);
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--gray-200);
}
.action-grid .btn {
  width: 100%;
  text-align: center;
  padding: var(--sp-2) var(--sp-3);
  font-size: var(--text-sm);
}
.action-grid .btn-full {
  grid-column: 1 / -1;
  font-size: var(--text-base);
  padding: var(--sp-3);
}

/* Search form: 2-column layout on mobile */
.search-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-3);
}
.search-grid .form-group {
  margin-bottom: 0;
}
.search-full {
  grid-column: 1 / -1;
}

/* Houses table: inline action buttons on mobile */
@media (max-width: 480px) {
  .table-actions {
    display: flex;
    gap: var(--sp-1);
  }
  .table-actions .btn-sm {
    padding: var(--sp-1) var(--sp-2);
    font-size: var(--text-xs);
  }
}

/* Ticket detail: read-only field styling */
.field-row .field-value {
  font-size: var(--text-base);
  color: var(--gray-800);
  padding: var(--sp-1) 0;
}
