:root{
  --bg:#ffffff; --text:#111827; --muted:#6b7280; --line:#e5e7eb; --soft:#f9fafb;
  --pill:#f3f4f6; --pillText:#374151;
  --link:#0ea5e9; --shadow:0 1px 2px rgba(0,0,0,.06); --radius:12px;
}

.coffee-wrap{ max-width:1100px; margin:0 auto; padding:0 10px; }
.coffee-table-card{
  border:1px solid var(--line);
  border-radius:var(--radius);
  overflow:hidden;
  box-shadow:var(--shadow);
  background:var(--bg);
}

/* =========================================================
   DESKTOP GRID
   Columns: Origin | Name | Bags | Location | Status | Cupping | Price | Expand
   ========================================================= */
#coffeeTable .coffee-thead,
#coffeeTable .coffee-row-head{
  display:grid;
  grid-template-columns: 1.6fr 2.6fr 1.1fr 1.1fr 1.6fr 0.9fr 0.9fr 56px;
  column-gap:14px;
  align-items:center;
}

.coffee-thead{
  padding:14px 16px;
  border-bottom:1px solid var(--line);
  background:var(--bg);
  font-size:13px;
  color:var(--muted);
  user-select:none;
}

/* Header alignment: keep titles centered like your reference */
#coffeeTable .coffee-thead .coffee-th{
  justify-content:center;
  text-align:center;
  display:flex;
  align-items:center;
  gap:8px;
  min-width:0;
  cursor:pointer;
}
#coffeeTable .coffee-thead .coffee-th.coffee-nosort{ cursor:default; }
#coffeeTable .coffee-thead .coffee-th.coffee-nosort .coffee-sort{ display:none; }

.coffee-sort{ display:inline-flex; width:16px; justify-content:center; font-size:10px; color:var(--muted); }
.coffee-th[aria-sort="none"] .coffee-sort{ opacity:.35; }
.coffee-th[aria-sort="ascending"] .coffee-sort::before{ content:"▲"; }
.coffee-th[aria-sort="descending"] .coffee-sort::before{ content:"▼"; }

.coffee-info{
  display:inline-flex; align-items:center; justify-content:center;
  width:18px; height:18px;
  border:1px solid var(--line);
  border-radius:999px;
  font-size:11px;
  color:var(--muted);
}

.coffee-tbody{ display:block; }
.coffee-row{ border-bottom:1px solid var(--line); }
.coffee-row:last-child{ border-bottom:none; }

.coffee-row-head{
  padding:18px 16px;
  background:var(--bg);
}

.coffee-cell{
  min-width:0;
  overflow:hidden;
  font-size:14px;
  text-align:left; /* default left */
}

/* Origin formatting (readable stacked) */
.coffee-origin{
  white-space:normal;
  line-height:1.55;
  color:var(--text);
}

/* Full name link */
.coffee-name a{
  color:var(--link);
  text-decoration:none;
  font-weight:600;
}
.coffee-name a:hover{ text-decoration:underline; }

/* Keep Bags compact */
.coffee-bags{ white-space:nowrap; font-variant-numeric: tabular-nums; }

/* =========================================================
   CENTER DATA: Location, Status, Cupping, Price
   ========================================================= */
#coffeeTable .coffee-row-head .coffee-location,
#coffeeTable .coffee-row-head .coffee-status,
#coffeeTable .coffee-row-head .coffee-cupping,
#coffeeTable .coffee-row-head .coffee-price{
  text-align:center;
  justify-self:center;
  white-space:nowrap;
}

/* Make the actual status display as simple text (not a pill) */
#coffeeTable .coffee-status{
  display:inline-block;
  background:transparent;
  padding:0;
  border-radius:0;
  color:var(--text);
  font-weight:400;
  max-width:100%;
  overflow:hidden;
  text-overflow:ellipsis;
}

/* Prices/Cupping tighter */
.coffee-cupping, .coffee-price{
  font-variant-numeric: tabular-nums;
}

/* Expand toggle */
.coffee-toggle{
  justify-self:end;
  width:40px; height:40px;
  border:1px solid var(--line);
  border-radius:10px;
  background:#fff;
  display:grid;
  place-items:center;
  cursor:pointer;
}
.coffee-toggle:hover{ background:var(--soft); }

.coffee-chev{
  width:10px; height:10px;
  border-right:2px solid var(--muted);
  border-bottom:2px solid var(--muted);
  transform:rotate(-45deg);
  transition:transform .15s ease;
}
.coffee-row[aria-expanded="true"] .coffee-chev{ transform:rotate(45deg); }

/* =========================================================
   DETAILS / ACCORDION (Astra-safe)
   ========================================================= */
#coffeeTable .coffee-details{
  display:none !important;
  background:var(--soft);
  padding:14px 16px 18px;
}
#coffeeTable .coffee-row[aria-expanded="true"] > .coffee-details{
  display:block !important;
}

.coffee-detail-grid{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:12px;
}

.coffee-panel{
  border:1px solid var(--line);
  background:#fff;
  border-radius:12px;
  padding:12px;
}
.coffee-full-row{ grid-column:1 / -1; }

.coffee-kv{
  display:grid;
  grid-template-columns:120px 1fr;
  gap:10px;
  font-size:13px;
  line-height:1.35;
}
.coffee-k{ color:var(--muted); font-weight:600; }
.coffee-v{ color:var(--text); font-weight:500; }

.coffee-pills{ display:flex; flex-wrap:wrap; gap:8px; min-width:0; }
.coffee-pill{
  background:var(--pill);
  color:var(--pillText);
  border:1px solid var(--line);
  padding:5px 10px;
  border-radius:999px;
  font-size:12px;
  font-weight:600;
  white-space:nowrap;
}

.coffee-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;
}

/* =========================================================
   MOBILE (clean, compact)
   Shows: Full Name + (Status + Price) + Toggle
   Details show everything else.
   ========================================================= */
@media (max-width: 860px){

  /* Hide header row on mobile */
  #coffeeTable .coffee-thead{
    display:none !important;
  }

  /* Turn row head into a clean mobile card layout */
  #coffeeTable .coffee-row-head{
    display:grid;
    grid-template-columns: 1fr 1fr 56px;
    grid-template-rows: auto auto auto auto;
    column-gap:12px;
    row-gap:10px;

    padding:16px;
    position:relative;
    background:var(--bg);
  }

  /* Put toggle button top-right */
  #coffeeTable .coffee-toggle{
    grid-column: 3 / 4;
    grid-row: 1 / 3;
    justify-self:end;
    align-self:start;
    width:44px;
    height:44px;
    border-radius:12px;
  }

  /* 1) Origin (small, muted) — spans full width */
  #coffeeTable .coffee-row-head .coffee-origin{
    grid-column: 1 / 3;
    grid-row: 1;
    margin:0;
    font-size:13px;
    color:var(--muted);
    line-height:1.35;
    white-space:normal;
  }

  /* 2) Name (main title) — spans full width */
  #coffeeTable .coffee-row-head .coffee-name{
    grid-column: 1 / 3;
    grid-row: 2;
    margin:0;
  }
  #coffeeTable .coffee-row-head .coffee-name a{
    font-size:16px;
    line-height:1.35;
    font-weight:700;
    display:inline-block;
  }

  /* Remove desktop centering rules on mobile */
  #coffeeTable .coffee-row-head .coffee-location,
  #coffeeTable .coffee-row-head .coffee-status,
  #coffeeTable .coffee-row-head .coffee-cupping,
  #coffeeTable .coffee-row-head .coffee-price{
    text-align:left;
    justify-self:start;
  }

  /* Meta cells become neat “label over value” blocks */
  #coffeeTable .coffee-row-head .coffee-bags,
  #coffeeTable .coffee-row-head .coffee-location,
  #coffeeTable .coffee-row-head .coffee-cupping,
  #coffeeTable .coffee-row-head .coffee-price{
    display:flex;
    flex-direction:column;
    gap:2px;
    padding:10px 12px;
    border:1px solid rgba(229,231,235,.8);
    border-radius:12px;
    background:#fff;
    font-size:14px;
    line-height:1.25;
    white-space:nowrap;
  }

  /* Place the meta blocks into a 2x2 grid */
  #coffeeTable .coffee-row-head .coffee-bags{
    grid-column: 1 / 2;
    grid-row: 3;
  }
  #coffeeTable .coffee-row-head .coffee-location{
    grid-column: 2 / 3;
    grid-row: 3;
  }
  #coffeeTable .coffee-row-head .coffee-cupping{
    grid-column: 1 / 2;
    grid-row: 4;
  }
  #coffeeTable .coffee-row-head .coffee-price{
    grid-column: 2 / 3;
    grid-row: 4;
  }

  /* Add labels above values (no JS changes needed) */
  #coffeeTable .coffee-row-head .coffee-bags::before{
    content:"Bags";
    font-size:12px;
    color:var(--muted);
    font-weight:600;
  }
  #coffeeTable .coffee-row-head .coffee-location::before{
    content:"Location";
    font-size:12px;
    color:var(--muted);
    font-weight:600;
  }
  #coffeeTable .coffee-row-head .coffee-cupping::before{
    content:"Cupping";
    font-size:12px;
    color:var(--muted);
    font-weight:600;
  }
  #coffeeTable .coffee-row-head .coffee-price::before{
    content:"Price";
    font-size:12px;
    color:var(--muted);
    font-weight:600;
  }

  /* Status becomes a pill on its own row under the name (clean + visible) */
  #coffeeTable .coffee-row-head .coffee-cell:nth-child(5){
    grid-column: 1 / 3;
    grid-row: 5;
    border-top:none;
    padding:0;
    display:block;
  }

  /* Override your desktop “plain text status” and show a nice pill on mobile */
  #coffeeTable .coffee-status{
    display:inline-flex !important;
    padding:8px 12px !important;
    border-radius:999px !important;
    background:#eef2ff !important;
    color:#3730a3 !important;
    font-size:12px !important;
    font-weight:700 !important;
    white-space:nowrap !important;
    max-width:100%;
    overflow:hidden;
    text-overflow:ellipsis;
  }

  /* Details area stays clean on mobile */
  #coffeeTable .coffee-detail-grid{
    grid-template-columns:1fr;
  }
  #coffeeTable .coffee-kv{
    grid-template-columns:110px 1fr;
  }
  #coffeeTable .coffee-pills{
    gap:6px;
  }
  #coffeeTable .coffee-pill{
    font-size:11px;
    padding:4px 8px;
  }
}



