/* Quortek Pool: phone layout for the dashboards (/app, /cms). Desktop and tablet (768 px and up) are not changed.
   Loaded by PanelDefaults (render hook), so it works without rebuilding Filament's CSS.
   On a phone every list row becomes a card: main column on top, short status next to it, buttons in a row below.
   Columns marked ->visibleFrom('md') in PHP stay hidden on phones (Filament class "md:fi-visible"). */

@media (max-width: 767px) {
  /* ---- lists as cards ---- */
  .fi-ta-table thead { display: none; }
  .fi-ta-table, .fi-ta-table > tbody { display: block; width: 100%; }
  .fi-ta-table > tbody > tr.fi-ta-row {
    display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px;
    padding: 12px 14px; border-top: 1px solid rgba(127, 127, 127, .18);
  }
  .fi-ta-table > tbody > tr.fi-ta-row > td:not([class*="fi-visible"]) { display: block; padding: 0 !important; min-width: 0; }
  /* First visible column (name / title with its details) takes most of the first line. */
  .fi-ta-table > tbody > tr.fi-ta-row > td:not([class*="fi-visible"]):first-of-type,
  .fi-ta-table > tbody > tr.fi-ta-row > td[class*="fi-visible"]:first-of-type + td:not([class*="fi-visible"]),
  .fi-ta-table > tbody > tr.fi-ta-row > td[class*="fi-visible"]:first-of-type + td[class*="fi-visible"] + td:not([class*="fi-visible"]) { flex: 1 1 55%; }
  /* Buttons: their own line at the bottom, icon only, big enough to tap (text stays for screen readers). */
  .fi-ta-table > tbody > tr.fi-ta-row > td:has(.fi-ta-actions) { flex: 1 1 100%; }
  .fi-ta-actions { display: flex !important; flex-wrap: wrap; justify-content: flex-start !important; gap: 8px !important; }
  .fi-ta-actions .fi-ac-link-action,
  .fi-ta-actions > .fi-link {
    font-size: 0 !important; gap: 0 !important; min-width: 44px; min-height: 40px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 10px; background: rgba(127, 127, 127, .14);
  }
  .fi-ta-actions .fi-link .fi-icon { width: 20px; height: 20px; }

  /* Text and coloured labels wrap between words. */
  .fi-ta-cell, .fi-ta-text, .fi-ta-text-item, .fi-ta-text-item-label, .fi-ta-text-description { white-space: normal !important; overflow-wrap: break-word; }
  .fi-ta-cell .fi-badge { white-space: normal !important; height: auto !important; text-align: left; line-height: 1.25; padding-top: 3px; padding-bottom: 3px; }
  .fi-ta-cell .fi-badge .truncate { white-space: normal !important; overflow: visible !important; text-overflow: clip !important; }
  .fi-ta-content { overflow-x: visible !important; }

  /* Page buttons (New…, Issue…) easy to tap. */
  .fi-header .fi-ac { flex-wrap: wrap; }
  .fi-header .fi-ac .fi-btn { min-height: 44px; }

  /* Map: a bit shorter on a phone. */
  .qp-map { height: 300px !important; }

}


/* ---- Glass look (all screen sizes): water background, frosted cards with soft depth. ---- */
.fi-body { background-repeat: no-repeat; background-color: #f2f9fd; background:
    radial-gradient(1100px 520px at 0% -10%, rgba(125, 211, 252, .45), transparent 60%),
    radial-gradient(900px 480px at 100% 0%, rgba(165, 243, 252, .4), transparent 55%),
    linear-gradient(180deg, #eef7fc 0%, #f5fbff 50%, #f0fdff 100%); min-height: 100vh; }
.dark .fi-body { background:
    radial-gradient(1100px 520px at 0% -10%, rgba(14, 116, 144, .35), transparent 60%),
    radial-gradient(900px 480px at 100% 0%, rgba(30, 64, 175, .3), transparent 55%),
    linear-gradient(180deg, #07131d 0%, #0a1824 100%); min-height: 100vh; }
.fi-topbar > nav, .fi-sidebar { background: rgba(255, 255, 255, .55) !important; backdrop-filter: blur(18px) saturate(1.4); -webkit-backdrop-filter: blur(18px) saturate(1.4); }
.dark .fi-topbar > nav, .dark .fi-sidebar { background: rgba(10, 24, 36, .55) !important; }
.fi-section, .fi-wi-stats-overview-stat, .fi-ta-ctn, .fi-wi-chart .fi-section, .qp-glass {
  background: rgba(255, 255, 255, .62) !important; backdrop-filter: blur(14px) saturate(1.3); -webkit-backdrop-filter: blur(14px) saturate(1.3);
  border: 1px solid rgba(255, 255, 255, .7) !important; border-radius: 18px !important;
  box-shadow: 0 10px 30px rgba(3, 60, 100, .10), inset 0 1px 0 rgba(255, 255, 255, .8) !important; }
.dark .fi-section, .dark .fi-wi-stats-overview-stat, .dark .fi-ta-ctn, .dark .qp-glass {
  background: rgba(18, 33, 45, .6) !important; border-color: rgba(255, 255, 255, .08) !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .35), inset 0 1px 0 rgba(255, 255, 255, .06) !important; }
.fi-wi-stats-overview-stat { position: relative; overflow: hidden; transition: transform .25s ease, box-shadow .25s ease; }
.fi-wi-stats-overview-stat::after { content: ""; position: absolute; right: -46px; top: -52px; width: 96px; height: 96px; opacity: .8; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, .9), rgba(14, 165, 233, .22) 60%, transparent 70%); }
.dark .fi-wi-stats-overview-stat::after { background: radial-gradient(circle at 30% 30%, rgba(125, 211, 252, .25), rgba(14, 165, 233, .1) 60%, transparent 70%); }
.fi-wi-stats-overview-stat:hover { transform: translateY(-3px) perspective(700px) rotateX(2deg);
  box-shadow: 0 18px 40px rgba(3, 60, 100, .18), inset 0 1px 0 rgba(255, 255, 255, .9) !important; }
.fi-wi-stats-overview-stat-value { background: linear-gradient(135deg, #0369a1, #0ea5e9); -webkit-background-clip: text; background-clip: text; color: transparent !important; }
.dark .fi-wi-stats-overview-stat-value { background: linear-gradient(135deg, #7dd3fc, #e0f2fe); -webkit-background-clip: text; background-clip: text; }
@media (prefers-reduced-motion: reduce) { .fi-wi-stats-overview-stat, .fi-wi-stats-overview-stat:hover { transition: none; transform: none; } }

/* Shared bits for custom pages (week board, statistics, billing). */
.qp-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.qp-glass { padding: 16px 18px; }
.qp-kpi-label { font-size: 13px; opacity: .7; }
.qp-kpi { font-size: 28px; font-weight: 800; letter-spacing: -.01em; font-variant-numeric: tabular-nums;
  background: linear-gradient(135deg, #0369a1, #0ea5e9); -webkit-background-clip: text; background-clip: text; color: transparent; }
.dark .qp-kpi { background: linear-gradient(135deg, #7dd3fc, #e0f2fe); -webkit-background-clip: text; background-clip: text; }
.qp-pill { display: inline-block; border-radius: 999px; padding: 2px 9px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.qp-pill.ok { background: rgba(22, 163, 74, .14); color: #15803d; } .qp-pill.warn { background: rgba(245, 158, 11, .18); color: #a16207; }
.qp-pill.bad { background: rgba(220, 38, 38, .14); color: #b91c1c; } .qp-pill.gray { background: rgba(148, 163, 184, .22); color: #475569; }
.dark .qp-pill.ok { color: #4ade80; } .dark .qp-pill.warn { color: #fbbf24; } .dark .qp-pill.bad { color: #f87171; } .dark .qp-pill.gray { color: #cbd5e1; }
.qp-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
.qp-table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; opacity: .65; padding: 8px 10px; }
.qp-table td { padding: 10px; border-top: 1px solid rgba(127, 127, 127, .15); vertical-align: top; }
.qp-bar { height: 8px; border-radius: 99px; background: rgba(148, 163, 184, .25); overflow: hidden; }
.qp-bar > span { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #0ea5e9, #22c55e); }
.qp-week { display: grid; grid-template-columns: 120px repeat(7, minmax(96px, 1fr)); gap: 8px; overflow-x: auto; }
.qp-week .h { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; opacity: .7; padding: 4px 6px; }
.qp-week .h.today { color: #0284c7; opacity: 1; }
.qp-week .tech { font-weight: 700; padding: 8px 6px; }
.qp-cell { min-height: 56px; border-radius: 12px; padding: 6px; background: rgba(255, 255, 255, .45); border: 1px dashed rgba(127, 127, 127, .2); }
.dark .qp-cell { background: rgba(255, 255, 255, .03); }
.qp-cell.today { border: 1px solid rgba(14, 165, 233, .55); box-shadow: inset 0 0 0 1px rgba(14, 165, 233, .2); }
.qp-chip { display: block; font-size: 12px; line-height: 1.25; border-radius: 8px; padding: 4px 6px; margin-bottom: 4px; text-decoration: none;
  background: rgba(255, 255, 255, .85); border-left: 4px solid #94a3b8; color: inherit; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dark .qp-chip { background: rgba(255, 255, 255, .07); }
.qp-chip.done { border-left-color: #16a34a; } .qp-chip.planned { border-left-color: #0ea5e9; } .qp-chip.in_progress { border-left-color: #f59e0b; }
.qp-chip.skipped, .qp-chip.missed { border-left-color: #dc2626; }
.qp-chip.due { border-left-color: #a5b4fc; border-left-style: dashed; opacity: .85; }
@media (max-width: 767px) {
  .qp-week { grid-template-columns: 86px repeat(7, 118px); }
  .qp-week .tech, .qp-week .h:first-child { position: sticky; left: 0; z-index: 2; background: rgba(245, 251, 255, .95); font-size: 13px; }
  .dark .qp-week .tech, .dark .qp-week .h:first-child { background: rgba(18, 33, 45, .95); }
}
