/*
 * Ticket Foundry — Shared UI Components
 * All colors use CSS variables defined in theme files.
 * This file is theme-agnostic.
 */

/* ── Layout ───────────────────────────────────────────────── */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 220px;
  min-width: 220px;
  background: var(--crypt);
  border-right: 1px solid var(--slab);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

.page-body {
  padding: 24px 28px;
  flex: 1;
  overflow-y: auto;
}

/* ── Logo ─────────────────────────────────────────────────── */
.logo {
  padding: 22px 18px 18px;
  border-bottom: 1px solid var(--slab);
  margin-bottom: 8px;
  flex-shrink: 0;
}
.logo-mark {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--blood);
  font-weight: 700;
}
.logo-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--wraith);
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Nav ──────────────────────────────────────────────────── */
.nav-section {
  padding: 10px 14px 4px;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--mist);
  margin-top: 6px;
  opacity: 0.7;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  color: var(--mist);
  text-decoration: none;
  border-radius: var(--radius);
  margin: 2px 8px;
  font-size: 13.5px;
  font-weight: 500;
  transition: all 0.15s;
  border: 1px solid transparent;
}
.nav-link:hover { background: var(--slab); color: var(--wraith); }
.nav-link.active {
  background: var(--nav-active-bg);
  color: var(--nav-active-color);
  border-color: var(--nav-active-border);
}
.nav-link.proj-active {
  background: var(--nav-proj-bg);
  color: var(--nav-proj-color);
  border-color: var(--nav-proj-border);
}
.nav-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.nav-divider {
  border: none;
  border-top: 1px solid var(--slab);
  margin: 10px 10px 6px;
}

/* ── Sidebar user ─────────────────────────────────────────── */
.sidebar-user {
  margin-top: auto;
  padding: 14px 16px;
  border-top: 1px solid var(--slab);
  flex-shrink: 0;
}
.sidebar-user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--wraith);
}
.sidebar-user-role {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--mist);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 2px;
}
.sidebar-logout {
  display: inline-block;
  margin-top: 8px;
  font-size: 12px;
  color: var(--mist);
  text-decoration: none;
  transition: color 0.15s;
}
.sidebar-logout:hover { color: var(--blood); }

/* ── Topbar ───────────────────────────────────────────────── */
.topbar {
  background: var(--crypt);
  border-bottom: 1px solid var(--slab);
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-shrink: 0;
}
.page-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--wraith);
  letter-spacing: -0.3px;
}
.page-subtitle {
  font-size: 12px;
  color: var(--mist);
  margin-top: 1px;
}
.topbar-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s;
  text-decoration: none;
  white-space: nowrap;
  line-height: 1;
}
.btn-primary {
  background: var(--acid);
  color: #050800;
  border-color: var(--acid);
}
.btn-primary:hover { background: var(--acid-dim); }
.btn-secondary {
  background: transparent;
  color: var(--venom);
  border-color: var(--venom);
}
.btn-secondary:hover { background: var(--venom-bg); }
.btn-ghost {
  background: transparent;
  color: var(--mist);
  border-color: var(--slab);
}
.btn-ghost:hover { background: var(--slab); color: var(--wraith); }
.btn-danger {
  background: var(--blood-bg);
  color: var(--blood);
  border-color: rgba(255,45,85,0.35);
}
.btn-danger:hover { background: rgba(255,45,85,0.18); }
.btn-sm { padding: 5px 11px; font-size: 12.5px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Forms ────────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--mist);
  margin-bottom: 6px;
}
.form-label .required { color: var(--blood); margin-left: 2px; }
.form-hint { font-size: 11px; color: var(--mist); margin-top: 4px; opacity: 0.7; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="url"],
textarea,
select {
  width: 100%;
  background: var(--tomb);
  border: 1px solid var(--slab);
  border-radius: var(--radius);
  padding: 9px 12px;
  color: var(--wraith);
  font-family: var(--font-body);
  font-size: 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
  -webkit-appearance: none;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--acid);
  box-shadow: 0 0 0 3px rgba(200,255,0,0.08);
}
input::placeholder, textarea::placeholder {
  color: var(--mist);
  opacity: 0.5;
}
textarea { resize: vertical; min-height: 100px; }
select option { background: var(--tomb); color: var(--wraith); }

/* ── Cards ────────────────────────────────────────────────── */
.card {
  background: var(--crypt);
  border: 1px solid var(--slab);
  border-radius: var(--radius-lg);
  padding: 20px;
}

/* ── Badges ───────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 20px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.3px;
  border: 1px solid;
  white-space: nowrap;
}
.badge-urgent   { color: var(--blood);  background: var(--blood-bg);  border-color: rgba(255,45,85,0.35); }
.badge-high     { color: var(--rust);   background: var(--rust-bg);   border-color: rgba(255,107,53,0.35); }
.badge-normal   { color: var(--plague); background: var(--plague-bg); border-color: rgba(0,229,255,0.25); }
.badge-low      { color: var(--mist);   background: rgba(136,146,164,0.08); border-color: var(--slab); }
.badge-new      { color: var(--plague); background: var(--plague-bg); border-color: rgba(0,229,255,0.25); }
.badge-done     { color: var(--acid);   background: var(--acid-bg);   border-color: rgba(200,255,0,0.25); }
.badge-progress { color: var(--bile);   background: var(--bile-bg);   border-color: rgba(255,221,0,0.25); }
.badge-waiting  { color: var(--rust);   background: var(--rust-bg);   border-color: rgba(255,107,53,0.3); }
.badge-planning { color: var(--mist);   background: rgba(136,146,164,0.08); border-color: var(--slab); }
.badge-active   { color: var(--venom);  background: var(--venom-bg);  border-color: rgba(168,85,247,0.3); }
.badge-hold     { color: var(--rust);   background: var(--rust-bg);   border-color: rgba(255,107,53,0.3); }
.badge-complete { color: var(--acid);   background: var(--acid-bg);   border-color: rgba(200,255,0,0.25); }

/* ── Stats row ────────────────────────────────────────────── */
.stats-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}
.stat-pill {
  background: var(--crypt);
  border: 1px solid var(--slab);
  border-radius: var(--radius-lg);
  padding: 14px 20px;
  min-width: 100px;
  flex: 1;
}
.stat-pill-value {
  font-family: var(--font-mono);
  font-size: 26px;
  font-weight: 700;
  color: var(--wraith);
  line-height: 1;
}
.stat-pill-label {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--mist);
  margin-top: 5px;
}

/* ── Filters bar ──────────────────────────────────────────── */
.filters-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  align-items: center;
}
.filters-bar input,
.filters-bar select {
  width: auto;
  flex: 1;
  min-width: 120px;
}
.filters-bar input { max-width: 260px; }

/* ── Kanban board ─────────────────────────────────────────── */
.kanban-board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  align-items: start;
}
.kanban-col {
  background: var(--crypt);
  border: 1px solid var(--slab);
  border-radius: var(--radius-lg);
  padding: 12px;
}
.kanban-col-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding-bottom: 10px;
}
.kanban-col-bar {
  height: 2px;
  width: 28px;
  border-radius: 2px;
}
.kanban-col-label {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--mist);
}
.col-empty {
  text-align: center;
  padding: 28px 0;
  color: var(--mist);
  font-family: var(--font-mono);
  font-size: 11px;
  opacity: 0.5;
}

/* ── Ticket cards ─────────────────────────────────────────── */
.ticket-card {
  background: var(--tomb);
  border: 1px solid var(--slab);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 8px;
  cursor: grab;
  transition: border-color 0.15s;
  user-select: none;
}
.ticket-card:last-child { margin-bottom: 0; }
.ticket-card:hover { border-color: var(--bone); }
.ticket-card:active { cursor: grabbing; }
.ticket-card-num {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--mist);
  margin-bottom: 4px;
}
.ticket-card-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--wraith);
  line-height: 1.35;
  margin-bottom: 8px;
}
.ticket-card-meta {
  font-size: 12px;
  color: var(--mist);
}
.ticket-card-assign {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--venom);
  margin-top: 5px;
}

/* Drag and drop */
.sortable-ghost {
  opacity: 0.3;
  background: var(--bone) !important;
  border: 1px dashed var(--acid) !important;
}
.sortable-drag {
  opacity: 0.95;
  box-shadow: 0 8px 24px rgba(0,0,0,0.8) !important;
  transform: rotate(1.5deg);
}
.col-tickets.drag-over {
  background: var(--acid-bg);
  border-radius: var(--radius);
  outline: 1px dashed rgba(200,255,0,0.2);
  min-height: 60px;
}

/* ── Modal ────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 20px;
  overflow-y: auto;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}
.modal {
  background: var(--crypt);
  border: 1px solid var(--bone);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 720px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.8);
  transform: translateY(-10px);
  transition: transform 0.2s;
}
.modal-overlay.open .modal { transform: translateY(0); }
.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--slab);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.modal-title { font-size: 17px; font-weight: 600; color: var(--wraith); }
.modal-num {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--acid);
  margin-top: 3px;
  letter-spacing: 1px;
}
.modal-body { padding: 24px; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--slab);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}
.close-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--mist);
  font-size: 20px;
  padding: 4px;
  line-height: 1;
  transition: color 0.15s;
}
.close-btn:hover { color: var(--blood); }

/* ── Detail grid (inside modal) ───────────────────────────── */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 24px;
  margin-bottom: 20px;
}
.detail-item label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--mist);
  display: block;
  margin-bottom: 4px;
}
.detail-item p { font-size: 14px; color: var(--wraith); }
.detail-item.full { grid-column: 1 / -1; }
.desc-text {
  background: var(--tomb);
  border: 1px solid var(--slab);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--ghost);
  white-space: pre-wrap;
}

/* ── Comments ─────────────────────────────────────────────── */
.comments-section {
  margin-top: 20px;
  border-top: 1px solid var(--slab);
  padding-top: 20px;
}
.comment-item {
  background: var(--tomb);
  border: 1px solid var(--slab);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 10px;
}
.comment-meta {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--mist);
  margin-bottom: 6px;
}
.comment-author { font-weight: 700; color: var(--venom); }
.comment-body { font-size: 13.5px; color: var(--ghost); line-height: 1.5; }

/* ── Attachments ──────────────────────────────────────────── */
.attachment-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}
.attachment-image {
  border: 1px solid var(--slab);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--tomb);
}
.attachment-image img {
  width: 100%;
  height: 110px;
  object-fit: cover;
  display: block;
}
.attachment-image-meta {
  padding: 5px 7px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.attachment-file {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--tomb);
  border: 1px solid var(--slab);
  border-radius: var(--radius);
  margin-bottom: 6px;
}
.attachment-filename {
  font-size: 13px;
  color: var(--plague);
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}
.attachment-filename:hover { text-decoration: underline; }
.attachment-size {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--mist);
}
.attachment-remove {
  background: none;
  border: none;
  color: var(--mist);
  cursor: pointer;
  font-size: 15px;
  padding: 4px;
  line-height: 1;
  transition: color 0.15s;
}
.attachment-remove:hover { color: var(--blood); }

/* Drop zone */
.drop-zone {
  border: 1px dashed var(--slab);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  color: var(--mist);
  font-size: 12.5px;
  transition: all 0.15s;
  cursor: pointer;
  margin-bottom: 12px;
}
.drop-zone:hover,
.drop-zone.drag-over {
  border-color: var(--acid);
  background: var(--acid-bg);
  color: var(--acid);
}

/* ── List view table ──────────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
}
.data-table th {
  padding: 10px 14px;
  text-align: left;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--mist);
  font-weight: 700;
  border-bottom: 1px solid var(--bone);
}
.data-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--slab);
}
.data-table tr {
  cursor: pointer;
  transition: background 0.1s;
}
.data-table tr:hover td { background: var(--tomb); }

/* ── Toast ────────────────────────────────────────────────── */
#toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--slab);
  border: 1px solid var(--bone);
  border-radius: var(--radius);
  padding: 12px 20px;
  color: var(--wraith);
  font-size: 13.5px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.8);
  z-index: 200;
  transform: translateY(20px);
  opacity: 0;
  transition: all 0.25s;
  max-width: 340px;
  font-family: var(--font-body);
}
#toast.show    { transform: translateY(0); opacity: 1; }
#toast.success { border-left: 3px solid var(--acid); }
#toast.error   { border-left: 3px solid var(--blood); }

/* ── Upload progress bar ──────────────────────────────────── */
.upload-progress { display: none; margin-bottom: 10px; }
.upload-progress-bar {
  height: 3px;
  background: var(--slab);
  border-radius: 2px;
  overflow: hidden;
}
.upload-progress-fill {
  height: 3px;
  background: var(--acid);
  border-radius: 2px;
  width: 0%;
  transition: width 0.3s;
}

/* ── Misc ─────────────────────────────────────────────────── */
.divider { border: none; border-top: 1px solid var(--slab); margin: 20px 0; }

.section-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--mist);
  margin-bottom: 12px;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--void); }
::-webkit-scrollbar-thumb { background: var(--slab); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--bone); }
/* ═══════════════════════════════════════════════════════════════
   TICKET FOUNDRY — Mobile Responsive Styles
   Append to the bottom of assets/css/app.css
   Breakpoint: 768px
   ═══════════════════════════════════════════════════════════════ */

/* ── Hamburger button (hidden on desktop) ────────────────────── */
.hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 6px;
  color: var(--ghost);
  font-size: 20px;
  line-height: 1;
  flex-shrink: 0;
}
.hamburger:hover { color: var(--wraith); }

/* Sidebar overlay backdrop (mobile only) */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 199;
  background: rgba(8,10,15,0.7);
  backdrop-filter: blur(3px);
}
.sidebar-backdrop.open { display: block; }

/* ── Mobile breakpoint ───────────────────────────────────────── */
@media (max-width: 768px) {

  /* Show hamburger */
  .hamburger { display: flex; align-items: center; }

  /* Sidebar slides in from left as overlay */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 200;
    width: 240px !important;
    min-width: 240px !important;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: 4px 0 24px rgba(0,0,0,0.5);
  }
  .sidebar.open {
    transform: translateX(0);
  }

  /* Main content takes full width */
  .app-shell {
    flex-direction: column;
  }
  .main-content {
    width: 100%;
    min-width: 0;
  }

  /* Topbar — tighter, add hamburger slot */
  .topbar {
    padding: 10px 14px;
    gap: 10px;
  }
  .topbar > div:first-child {
    flex: 1;
    min-width: 0;
  }
  .page-title { font-size: 15px; }
  .page-subtitle { display: none; }

  /* Topbar actions — shrink buttons */
  .topbar-actions {
    gap: 6px;
    flex-shrink: 0;
  }
  .topbar-actions .btn-ghost {
    display: none; /* hide List View toggle — auto-switch to list on mobile */
  }
  .topbar-actions .btn-primary {
    padding: 5px 10px;
    font-size: 12px;
  }

  /* Page body padding */
  .page-body { padding: 12px 14px; }

  /* Stats row — 3-up grid on mobile instead of scrolling */
  .stats-row {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    overflow: visible;
    flex-wrap: unset;
    margin-bottom: 12px;
  }
  .stat-pill {
    min-width: 0;
    padding: 8px 10px;
  }
  .stat-pill-value { font-size: 18px; }
  .stat-pill-label { font-size: 9px; }
  /* Filters bar — stack vertically */
  .filters-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    margin-bottom: 12px;
  }
  .filters-bar input,
  .filters-bar select {
    width: 100%;
    max-width: none !important;
    font-size: 14px;
    padding: 8px 10px;
  }
  .filters-bar .btn {
    width: 100%;
    padding: 8px;
    font-size: 13px;
  }

  /* Kanban — hide on mobile, show list view instead */
  #kanbanView,
  #t-kanban,
  #p-kanban { display: none !important; }
  #listView,
  #t-list,
  #p-list   { display: block !important; }

  /* Tables — horizontal scroll with sticky first column */
  .data-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -14px;
    padding: 0 14px;
  }
  .data-table {
    min-width: 500px;
    font-size: 12px;
  }
  .data-table th,
  .data-table td {
    padding: 8px 10px;
    white-space: nowrap;
  }
  /* Hide less important columns on mobile */
  .data-table .col-hide-mobile { display: none; }

  /* Modal — slide up from bottom on mobile */
  .modal-overlay {
    padding: 0;
    align-items: flex-end;
    background: rgba(8,10,15,0.85) !important;
  }
  /* Solid bar at bottom so no backdrop bleed-through */
  .modal-overlay::after {
    content: '';
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 8svh;
    background: var(--crypt);
    z-index: 1;
  }
  .modal,
  .modal.modal-lg {
    max-width: 100% !important;
    width: 100%;
    height: 92svh;
    max-height: 92svh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    margin: 0;
    background: var(--crypt) !important;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    z-index: 2;
  }
  .modal-header {
    flex-shrink: 0;
    background: var(--crypt);
  }
  .modal-body {
    flex: 1 1 auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: var(--crypt);
    min-height: 0;
  }
  .modal-footer {
    flex-shrink: 0;
    background: var(--crypt);
    border-top: 1px solid var(--slab);
  }

  /* New Ticket modal form — single column */
  .form-row {
    grid-template-columns: 1fr !important;
    gap: 0;
  }

  /* Detail grid in ticket modal — single column */
  .detail-grid {
    grid-template-columns: 1fr !important;
  }
  .detail-item.full {
    grid-column: 1 !important;
  }

  /* Modal body — bigger tap targets */
  .modal-body input,
  .modal-body select,
  .modal-body textarea {
    font-size: 16px !important; /* prevents iOS zoom */
    padding: 9px 10px;
  }

  /* Modal footer buttons — full width */
  .modal-footer {
    flex-direction: column-reverse;
    gap: 8px;
  }
  .modal-footer .btn {
    width: 100%;
    padding: 10px;
    font-size: 14px;
    text-align: center;
    justify-content: center;
  }

  /* Settings tabs — scrollable horizontal */
  .settings-tabs,
  .org-subnav {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap !important;
    gap: 0 !important;
    padding-bottom: 0;
  }
  .settings-tab,
  .org-tab {
    white-space: nowrap;
    flex-shrink: 0;
    padding: 10px 14px;
    font-size: 12px;
  }

  /* Report tabs */
  .report-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
    padding-bottom: 0;
  }
  .report-tab {
    white-space: nowrap;
    flex-shrink: 0;
    padding: 10px 14px;
    font-size: 12px;
  }

  /* Reports — hide sidebar, stack layout */
  .report-layout {
    flex-direction: column !important;
    gap: 0 !important;
  }
  .report-sidebar {
    display: none !important; /* hide on mobile — too cramped */
  }
  .report-main {
    width: 100% !important;
    min-width: 0 !important;
  }

  /* Settings panels — full width */
  .settings-panel-inner,
  .settings-section {
    max-width: none !important;
  }

  /* User directory table — horizontal scroll */
  .dir-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Projects list table — horizontal scroll */
  #p-list {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Drop zone — larger touch target */
  .drop-zone {
    padding: 24px 16px;
  }

  /* Audit log table */
  .audit-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Toast — bottom center on mobile */
  #toast {
    left: 14px;
    right: 14px;
    bottom: 14px;
    text-align: center;
  }

  /* Login page */
  .login-box {
    margin: 20px 16px !important;
    padding: 24px 20px !important;
  }
}

/* ── Tablet (768px–1024px) — minor adjustments ───────────────── */
@media (min-width: 769px) and (max-width: 1024px) {
  .sidebar { width: 190px; min-width: 190px; }
  .kanban-board { grid-template-columns: repeat(2, 1fr); }
  .page-body { padding: 14px 18px; }
}
