/* =============================================================================
 * AMAC Suite Home v2.0.0 -- compact image-first tiles + Pinned section
 * -----------------------------------------------------------------------------
 * Operator reference: Google Workspace Dashboard tile grid (compact white
 * tiles, icon-dominant, no description in the visible tile, 6 tiles per row,
 * whole tile clickable, sections separated horizontally).
 *
 * Adapted for AMAC: kept the description + version/category/role meta line
 * (operator preference) but shrunk them so the emoji icon is the focal point.
 * Added a top "Pinned" section that the user customizes via drag-to-pin /
 * drag-to-unpin, persisted to localStorage[`amac-suite.home.pinned`].
 *
 * Loaded after `/css/styles.css` and `/shared/amac-suite-shell-v1.1.css` so
 * its overrides win on source order.
 * ============================================================================= */

/* ---- Page shell: tighten outer padding so the grid breathes -------------- */
body.suite-shell.suite-home-v2 main.page-shell {
  max-width: 1480px !important;
  padding: 20px 24px !important;
}

/* ---- Hero: collapse to a single thin strip ------------------------------- */
body.suite-shell.suite-home-v2 .hero {
  padding: 12px 18px !important;
  margin-bottom: 14px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 14px !important;
  border-radius: 12px !important;
}
body.suite-shell.suite-home-v2 .hero .brand-row {
  gap: 12px !important;
  align-items: center !important;
}
body.suite-shell.suite-home-v2 .hero .brand-row img {
  width: 42px !important;
  height: 42px !important;
  padding: 4px !important;
}
body.suite-shell.suite-home-v2 .hero .brand-row h1 {
  font-size: 18px !important;
  margin: 0 !important;
}
/* The shared shell (amac-suite-shell-v1.1.css) renders .hero as a DARK navy
   gradient with white text. These v2 overrides load last, so their colors win
   over the shell's — they must therefore be LIGHT, not dark navy. The original
   dark `rgba(2,37,68,…)` values were written as if the hero were a light strip
   and rendered as near-invisible dark-on-dark (subtitle + user/role line). All
   three hero text colors below are white-on-navy at WCAG AAA contrast. */
body.suite-shell.suite-home-v2 .hero .brand-row p {
  font-size: 11px !important;
  margin: 2px 0 0 !important;
  color: rgba(255,255,255,0.82) !important;
}
body.suite-shell.suite-home-v2 .hero .meta {
  font-size: 11px !important;
  color: rgba(255,255,255,0.90) !important;
}
/* "AMAC Suite Navigation" caption — the shell styles .footer-note with the
   muted slate `--ss-muted` (#64748b), ~3.3:1 on the navy hero (below AA).
   Lift it to readable white-on-navy. */
body.suite-shell.suite-home-v2 .hero #suite-nav .footer-note {
  color: rgba(255,255,255,0.70) !important;
}

/* ---- Section container -------------------------------------------------- */
body.suite-shell.suite-home-v2 .home-section {
  background: var(--panel);
  border: 1px solid #e3eaf2;
  border-radius: 14px;
  box-shadow: 0 1px 0 rgba(2,37,68,0.04), 0 6px 16px rgba(2,37,68,0.04);
  padding: 14px 18px 18px;
  margin-bottom: 14px;
}
body.suite-shell.suite-home-v2 .home-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
body.suite-shell.suite-home-v2 .home-section-title {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--amac-navy, var(--ink, #11263d));
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
body.suite-shell.suite-home-v2 .home-section-sub {
  font-size: 10px;
  color: var(--amac-navy, var(--ink, #11263d));
}
body.suite-shell.suite-home-v2 .home-section-empty {
  font-size: 12px;
  color: var(--amac-navy, var(--ink, #11263d));
  font-style: italic;
  padding: 18px 8px;
  text-align: center;
  border: 1px dashed rgba(2,37,68,0.18);
  border-radius: 10px;
}
body.suite-shell.suite-home-v2 .home-section-empty.drop-active {
  background: rgba(46, 120, 183, 0.08);
  border-color: rgba(46, 120, 183, 0.45);
  color: var(--amac-navy, var(--ink, #11263d));
}

/* ---- Tile grid ---------------------------------------------------------- */
body.suite-shell.suite-home-v2 .home-tile-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}
body.suite-shell.suite-home-v2 .home-tile-grid.drop-active {
  outline: 2px dashed rgba(46, 120, 183, 0.45);
  outline-offset: 4px;
  border-radius: 8px;
}

/* ---- Tile --------------------------------------------------------------- */
body.suite-shell.suite-home-v2 .home-tile {
  /* Reset button-default styling -- gotcha #12: body.suite-shell button
     gets the red palette; .home-tile must override. */
  appearance: none;
  background: var(--panel) !important;
  background-image: none !important;
  border: 1px solid #d7e2ef !important;
  border-radius: 12px !important;
  padding: 14px 12px 12px !important;
  cursor: pointer !important;
  text-align: center !important;
  font: inherit !important;
  color: var(--amac-navy, var(--ink, #11263d)) !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  gap: 6px !important;
  min-height: 0 !important;
  position: relative !important;
  transition: transform 0.14s ease, box-shadow 0.14s ease, border-color 0.14s ease !important;
  user-select: none !important;
  overflow: hidden !important;
}
body.suite-shell.suite-home-v2 .home-tile:hover,
body.suite-shell.suite-home-v2 .home-tile:focus-visible {
  border-color: #3aa0e0 !important;
  box-shadow: 0 12px 24px rgba(2,37,68,0.12), 0 2px 0 rgba(46,120,183,0.10) !important;
  transform: translateY(-2px) !important;
  outline: none !important;
}
body.suite-shell.suite-home-v2 .home-tile:active {
  transform: translateY(0) !important;
}

/* ---- Tile icon (emoji) -------------------------------------------------- */
body.suite-shell.suite-home-v2 .home-tile .home-tile-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border-radius: 14px;
  background: linear-gradient(135deg, #f0f6fc, #e1edf7);
  font-size: 36px;
  line-height: 1;
  user-select: none;
}
/* Category-tinted backgrounds for visual variety */
body.suite-shell.suite-home-v2 .home-tile[data-category="Operations"]    .home-tile-icon { background: linear-gradient(135deg, #e3f0fa, #c8e1f5); }
body.suite-shell.suite-home-v2 .home-tile[data-category="HR"]            .home-tile-icon { background: linear-gradient(135deg, #e6f4ec, #c8e5d1); }
body.suite-shell.suite-home-v2 .home-tile[data-category="Quality"]       .home-tile-icon { background: linear-gradient(135deg, #fce8ec, #f5c5cd); }
body.suite-shell.suite-home-v2 .home-tile[data-category="Admin"]         .home-tile-icon { background: linear-gradient(135deg, #f1eef9, #d8d1ee); }
body.suite-shell.suite-home-v2 .home-tile[data-category="Communications"].home-tile-icon { background: linear-gradient(135deg, #fff4e0, #ffe1b3); }
body.suite-shell.suite-home-v2 .home-tile[data-category="Engineering"]   .home-tile-icon { background: linear-gradient(135deg, #e7f3f0, #c4e1d8); }
body.suite-shell.suite-home-v2 .home-tile[data-category="Sales"]         .home-tile-icon { background: linear-gradient(135deg, #fff0d9, #ffd9a3); }
body.suite-shell.suite-home-v2 .home-tile[data-category="Finance"]       .home-tile-icon { background: linear-gradient(135deg, #e6f4ec, #c8e5d1); }
body.suite-shell.suite-home-v2 .home-tile[data-category="Utilities"]     .home-tile-icon { background: linear-gradient(135deg, #f0f6fc, #e1edf7); }

/* ---- Tile text ---------------------------------------------------------- */
body.suite-shell.suite-home-v2 .home-tile .home-tile-name {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.01em;
  color: var(--amac-navy, var(--ink, #11263d));
  margin: 4px 0 0;
  width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
body.suite-shell.suite-home-v2 .home-tile .home-tile-desc {
  font-size: 11px;
  color: var(--amac-navy, var(--ink, #11263d));
  line-height: 1.30;
  margin: 0;
  width: 100%;
  /* 2-line clamp */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-align: center;
}
body.suite-shell.suite-home-v2 .home-tile .home-tile-meta {
  font-size: 10px;
  color: var(--amac-navy, var(--ink, #11263d));
  margin: 2px 0 0;
  letter-spacing: 0.02em;
  width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---- Pin indicator + pin/unpin affordance ------------------------------- */
body.suite-shell.suite-home-v2 .home-tile .home-tile-pin {
  position: absolute;
  top: 6px;
  right: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: transparent;
  border: 0;
  color: var(--amac-navy, var(--ink, #11263d));
  font-size: 13px;
  cursor: pointer;
  padding: 0;
  font-family: inherit;
  transition: background 0.12s ease, color 0.12s ease;
}
body.suite-shell.suite-home-v2 .home-tile:hover .home-tile-pin,
body.suite-shell.suite-home-v2 .home-tile:focus-within .home-tile-pin {
  color: var(--amac-navy, var(--ink, #11263d));
}
body.suite-shell.suite-home-v2 .home-tile .home-tile-pin:hover {
  background: rgba(2,37,68,0.08);
  color: var(--amac-navy, var(--ink, #11263d));
}
body.suite-shell.suite-home-v2 .home-tile[data-pinned="true"] .home-tile-pin {
  color: var(--warn, #e0962f);
}
body.suite-shell.suite-home-v2 .home-tile[data-pinned="true"] .home-tile-pin:hover {
  background: rgba(204, 124, 14, 0.12);
  color: var(--warn, #e0962f);
}

/* ---- Per-app pending-count badge (BUG-000010) --------------------------- */
/* Top-LEFT so it never collides with the top-right pin; the icon is centered,
   so this corner is clear. Fed by home.js applyTileBadge(); [hidden] at 0. */
body.suite-shell.suite-home-v2 .home-tile .home-tile-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: #e11d48;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.02em;
  box-shadow: 0 1px 3px rgba(2, 37, 68, 0.35);
  z-index: 2;
  pointer-events: none;
}
body.suite-shell.suite-home-v2 .home-tile .home-tile-badge[hidden] { display: none; }

/* ---- Drag state --------------------------------------------------------- */
body.suite-shell.suite-home-v2 .home-tile[draggable="true"] { cursor: grab !important; }
body.suite-shell.suite-home-v2 .home-tile[draggable="true"]:active { cursor: grabbing !important; }
body.suite-shell.suite-home-v2 .home-tile.dragging {
  opacity: 0.45 !important;
  border-style: dashed !important;
}

/* ---- Status banner ------------------------------------------------------ */
body.suite-shell.suite-home-v2 #home-status {
  font-size: 11px;
  padding: 6px 10px;
  border-radius: 6px;
  margin-bottom: 10px;
  display: inline-block;
}
body.suite-shell.suite-home-v2 #home-status.status.ok {
  background: rgba(46,154,84,0.08);
  color: var(--ok, #2bb3a3);
  border: 1px solid rgba(46,154,84,0.20);
}
body.suite-shell.suite-home-v2 #home-status.status.error {
  background: rgba(204,34,60,0.08);
  color: var(--bad, #ef5350);
  border: 1px solid rgba(204,34,60,0.22);
}
body.suite-shell.suite-home-v2 #home-status.status.info {
  background: rgba(46,120,183,0.08);
  color: var(--amac-navy, var(--ink, #11263d));
  border: 1px solid rgba(46,120,183,0.20);
}

/* ---- Responsive --------------------------------------------------------- */
@media (max-width: 720px) {
  body.suite-shell.suite-home-v2 .home-tile-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }
  body.suite-shell.suite-home-v2 .home-tile .home-tile-icon {
    width: 52px;
    height: 52px;
    font-size: 28px;
  }
}

/* ---- Mobile adoption v2.0.1 -------------------------------------------------
   Rail-less launcher: v1.2.css (CSS+diag, NO drawer JS) already stacks the hero
   to column ≤1024 via the generic `body.suite-shell .hero` rule. These add the
   left-aligned stack (the v2 base rule forces align-items:center) and a 44px pin
   tap target (the visible dot stays 22px; C4). */
@media (max-width: 1024px) {
  body.suite-shell.suite-home-v2 .hero { align-items: flex-start !important; }

  /* Expand the 22px pin's tap zone to 44px without enlarging the visible dot. */
  body.suite-shell.suite-home-v2 .home-tile .home-tile-pin::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 44px;
    height: 44px;
    transform: translate(-50%, -50%);
  }
}

