@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* ============================================================
   Vine'd - Main Stylesheet
   Colors: BG #FAF6F1 | Accent #D4944A | Border #E8E0D8
   Font: Inter
   ============================================================ */

/* -- Tasting 2-column layout (ref: consuption.html) --------- */
.tasting-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 20px;
  align-items: start;
}
.tasting-list { min-width: 0; }
.tasting-sidebar { min-width: 0; }

@media (max-width: 900px) {
  .tasting-layout {
    grid-template-columns: 1fr;
  }
  .tasting-sidebar {
    order: 2;
  }
}

/* -- Page header flex wrap for consumption ------------------ */
#page-tasting .page-header {
  flex-wrap: wrap;
  gap: 12px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #FAF6F1;
  color: #1C1917;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  font-size: 14px;
}

/* -- Scrollbar ----------------------------------------------- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #FAF6F1; }
::-webkit-scrollbar-thumb { background: #E8E0D8; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #D4944A; }

/* -- Links & Focus ------------------------------------------- */
a { color: #D4944A; text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font-family: inherit; }
input:focus, select:focus, textarea:focus { outline: none; border-color: #D4944A !important; }
button:focus-visible { outline: 2px solid #D4944A; outline-offset: 2px; }

/* -- App Shell ----------------------------------------------- */
#app-wrapper { display: flex; min-height: 100vh; max-width: 100%; }

/* -- Sidebar ------------------------------------------------- */
#sidebar {
  width: 240px;
  min-height: 100vh;
  background: #FFFFFF;
  border-right: 1px solid #E8E0D8;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  z-index: 200;
  transition: transform .25s ease;
}

.sidebar-logo {
  padding: 22px 20px 18px;
  border-bottom: 1px solid #E8E0D8;
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-logo .logo-icon,
.sidebar-logo .nav-icon {
  font-size: 26px;
  line-height: 1;
  display: flex; align-items: center; justify-content: center;
  color: #D4944A;
  width: auto; flex-shrink: 0;
}
.sidebar-logo .logo-text {
  font-size: 18px;
  font-weight: 800;
  color: #1C1917;
  letter-spacing: 2px;
}
.sidebar-logo .logo-text span { color: #6b1e2e; }
.logo-tagline {
  font-size: 10px;
  color: #A8956E;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-top: 1px;
}

/* Nav */
.sidebar-nav { flex: 1; padding: 12px 0; overflow-y: auto; }
.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: #A8956E;
  padding: 10px 20px 4px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  margin: 1px 8px;
  border-radius: 8px;
  cursor: pointer;
  color: #57534E;
  font-weight: 500;
  font-size: 13.5px;
  transition: background .15s, color .15s;
  text-decoration: none;
  border: none;
  background: none;
  width: calc(100% - 16px);
  text-align: left;
}
.nav-item .nav-icon {
  font-size: 16px; flex-shrink: 0;
  width: 20px; text-align: center;
  display: flex; align-items: center; justify-content: center;
}
.nav-item .nav-icon svg { display: block; flex-shrink: 0; }
.nav-item:hover { background: #FDF5EC; color: #1C1917; }
.nav-item.active { background: #FDF5EC; color: #D4944A; font-weight: 600; }

/* Sub-menu item (Favourites under Inventory) */
.nav-item.nav-sub-item {
  padding-left: 42px;
  font-size: 12.5px;
  color: #A8956E;
  margin-top: -2px;
}
.nav-item.nav-sub-item:hover { color: #D4944A; background: #FDF5EC; }
.nav-item.nav-sub-item.active { color: #D4944A; font-weight: 600; background: #FDF5EC; }
.nav-item.nav-sub-item .nav-icon { width: 18px; color: inherit; }

.nav-item .nav-badge {
  margin-left: auto;
  background: #D4944A;
  color: #fff;
  border-radius: 10px;
  padding: 1px 7px;
  font-size: 11px;
  font-weight: 600;
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 14px 20px;
  border-top: 1px solid #E8E0D8;
}
.sidebar-stats {
  background: #FAF6F1;
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 12px;
}
.sidebar-stats .stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}
.sidebar-stats .stat-row:last-child { margin-bottom: 0; }
.sidebar-stats .stat-label { font-size: 11px; color: #A8956E; }
.sidebar-stats .stat-value { font-size: 13px; font-weight: 700; color: #1C1917; }
.sidebar-stats .stat-value.accent { color: #D4944A; }

.user-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.user-avatar {
  width: 34px; height: 34px;
  background: #D4944A;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; color: #fff;
  flex-shrink: 0;
}
.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 13px; font-weight: 600; color: #1C1917; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-email { font-size: 11px; color: #A8956E; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.btn-logout {
  background: none; border: none; cursor: pointer;
  color: #A8956E; font-size: 16px; padding: 4px;
  transition: color .15s;
}
.btn-logout:hover { color: #D4944A; }

/* -- Main Content --------------------------------------------- */
#main-content {
  flex: 1;
  margin-left: 240px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  max-width: 100%;
  overflow-x: hidden;
}

/* -- Top Bar (mobile only) ----------------------------------- */
#topbar {
  display: none;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: #FFFFFF;
  border-bottom: 1px solid #E8E0D8;
  position: sticky;
  top: 0;
  z-index: 100;
}
#topbar .topbar-title { font-size: 17px; font-weight: 700; color: #1C1917; }
#hamburger {
  background: none; border: none; cursor: pointer;
  font-size: 20px; color: #57534E; padding: 2px;
}

/* -- Page ----------------------------------------------------- */
.page { display: none; padding: 28px 32px; flex: 1; width: 100%; box-sizing: border-box; }
.page.active { display: block; }

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
  flex-wrap: wrap;
}
.page-title { font-size: 22px; font-weight: 800; color: #1C1917; letter-spacing: -.3px; }
.page-subtitle { font-size: 13px; color: #A8956E; margin-top: 2px; }

/* -- Buttons -------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px; border-radius: 8px;
  font-size: 13.5px; font-weight: 600;
  cursor: pointer; border: none;
  transition: background .15s, opacity .15s;
  white-space: nowrap;
}
.btn-primary { background: #D4944A; color: #fff; }
.btn-primary:hover { background: #C07F3A; }
.btn-secondary { background: #FFFFFF; color: #1C1917; border: 1.5px solid #E8E0D8; }
.btn-secondary:hover { background: #FAF6F1; }
.btn-danger { background: #FEE2E2; color: #DC2626; }
.btn-danger:hover { background: #FECACA; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-icon { padding: 7px; border-radius: 7px; font-size: 15px; }

/* -- Stats Cards ---------------------------------------------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
  width: 100%;
  max-width: 100%;
}
.stat-card {
  background: #FFFFFF;
  border: 1px solid #E8E0D8;
  border-radius: 12px;
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
  min-width: 0;
}
.stat-card .card-label {
  font-size: 12px; font-weight: 500;
  color: #A8956E; margin-bottom: 8px;
  text-transform: uppercase; letter-spacing: .5px;
}
.stat-card .card-value {
  font-size: 26px; font-weight: 800;
  color: #1C1917; letter-spacing: -.5px;
  line-height: 1;
  margin-bottom: 4px;
  word-break: break-all;
  overflow-wrap: break-word;

}
.stat-card .card-sub { font-size: 12px; color: #A8956E; }
.stat-card .card-icon {
  font-size: 28px;
  margin-bottom: 8px;
  display: block;
}
.stat-card.stat-card-gain { border-left: 3px solid #10B981; }
.stat-card.stat-card-loss { border-left: 3px solid #EF4444; }
.stat-card.accent-card { background: #D4944A; border-color: #D4944A; }
.stat-card.accent-card .card-label,
.stat-card.accent-card .card-value,
.stat-card.accent-card .card-sub { color: #fff; }
.stat-card.accent-card .card-icon { opacity: .2; }

/* -- Charts Row ----------------------------------------------- */
.charts-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}
.chart-card {
  background: #FFFFFF;
  border: 1px solid #E8E0D8;
  border-radius: 12px;
  padding: 20px;
}
.chart-card.wide { grid-column: span 2; }
.chart-card .chart-title {
  font-size: 14px; font-weight: 700;
  color: #1C1917; margin-bottom: 16px;
}
.chart-container { position: relative; height: 200px; }

/* -- Dashboard Row 2 (Location | Varietal) ------------------- */
.dash-row2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}
.dash-trend-card { margin-bottom: 20px; }
.trend-toggles { display: flex; gap: 4px; }
.trend-btn {
  padding: 4px 12px;
  border-radius: 6px;
  border: 1.5px solid #E8E0D8;
  cursor: pointer;
  font-weight: 600;
  font-size: 12px;
  background: transparent;
  color: #A8956E;
  transition: all .15s;
}
.trend-btn:hover { background: #FDF5EC; color: #D4944A; border-color: #D4944A; }
.trend-btn.active { background: #D4944A; color: #FFFFFF; border-color: #D4944A; }

/* -- Location Value Bars -------------------------------------- */
.loc-value-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.loc-value-row:last-child { margin-bottom: 0; }
.loc-name { font-size: 13px; color: #57534E; width: 120px; max-width: 120px; flex-shrink: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.loc-bar-wrap { flex: 1; height: 6px; background: #EDE7E0; border-radius: 3px; overflow: hidden; }
.loc-bar-fill { height: 100%; background: #D4944A; border-radius: 3px; transition: width .4s ease; min-width: 2px; }
.loc-value-label { font-size: 13px; font-weight: 700; color: #D4944A; min-width: 80px; text-align: right; flex-shrink: 0; }

/* -- Row 2 varietal list padding ----------------------------- */
#dash-varietal-list { padding: 16px 20px; }

/* -- Inventory Filter Wrap & Summary Bar --------------------- */
.inv-filter-wrap {
  background: #FFFFFF;
  border: 1px solid #E8E0D8;
  border-radius: 12px;
  padding: 16px 20px 12px;
  margin-bottom: 16px;
}
.inv-summary-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: #57534E;
  padding-top: 6px;
  border-top: 1px solid #F5EDE0;
}

/* -- Location Badge (inventory table) ------------------------ */
.inv-loc-badge {
  display: inline-block;
  background: rgba(212,148,74,.13);
  color: #D4944A;
  border: 1px solid rgba(212,148,74,.27);
  border-radius: 20px;
  padding: 2px 10px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

/* -- Bottle Thumbnail placeholder ---------------------------- */
.bottle-thumb {
  width: 36px; height: 48px;
  background: #FAF6F1;
  border: 1px solid #E8E0D8;
  border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  cursor: default;
}

/* -- Modal Section Label -------------------------------------- */
.modal-section-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .7px;
  color: #A8956E;
  border-bottom: 1px solid #E8E0D8;
  padding-bottom: 6px;
  margin-bottom: 14px;
}

/* -- Wide Wine Modal ------------------------------------------ */
.wine-modal-wide { max-width: 700px; }

/* -- Label Photo ---------------------------------------------- */
.wine-label-photo {
  position: relative;
  width: 80px;
  height: 100px;
  border: 2px dashed #ddd;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background: #fafafa;
  transition: border-color 0.2s;
}
.wine-label-photo:hover { border-color: #D4944A; }
.label-photo-placeholder { text-align: center; }
.label-photo-remove { display: none; }
.wine-label-photo.has-photo .label-photo-placeholder { display: none; }
.wine-label-photo.has-photo #wine-label-img { display: block; }
.wine-label-photo.has-photo .label-photo-remove { display: flex; align-items: center; justify-content: center; }
.wine-label-photo.has-photo { border-style: solid; border-color: #e0e0e0; background: #fff !important; }

/* -- Recent Consumption Items --------------------------------- */
.rc-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 20px;
  border-bottom: 1px solid #F5EDE0;
}
.rc-item:last-child { border-bottom: none; }
.rc-left { flex: 1; min-width: 0; }
.rc-wine { font-size: 13px; font-weight: 600; color: #1C1917; margin-bottom: 2px; }
.rc-meta { font-size: 11px; color: #A8956E; }
.rc-right { text-align: right; flex-shrink: 0; margin-left: 12px; }
.rc-rating { font-size: 13px; font-weight: 700; color: #D4944A; }
.rc-price { font-size: 11px; color: #57534E; margin-top: 2px; }

/* -- Section Cards -------------------------------------------- */
.content-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}
.section-card {
  background: #FFFFFF;
  border: 1px solid #E8E0D8;
  border-radius: 12px;
  overflow: hidden;
}
.section-card.full-width { grid-column: 1 / -1; }
.section-header {
  padding: 16px 20px;
  border-bottom: 1px solid #E8E0D8;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.section-title { font-size: 14px; font-weight: 700; color: #1C1917; }
.section-link { font-size: 12px; color: #D4944A; cursor: pointer; }
.section-link:hover { text-decoration: underline; }

/* -- Table ---------------------------------------------------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
  padding: 10px 16px;
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .5px;
  color: #A8956E;
  background: #FAF6F1;
  border-bottom: 1px solid #E8E0D8;
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}
thead th:hover { color: #D4944A; }
thead th .sort-icon { margin-left: 4px; opacity: .5; }
thead th.sorted .sort-icon { opacity: 1; color: #D4944A; }
tbody tr {
  border-bottom: 1px solid #F5EDE0;
  transition: background .1s;
}
tbody tr:hover { background: #FDF9F5; }
tbody tr:last-child { border-bottom: none; }
tbody td { padding: 12px 16px; font-size: 13px; color: #1C1917; }
tbody td .text-muted { color: #A8956E; font-size: 12px; }

/* -- Badges / Status Pills ------------------------------------ */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px; font-weight: 600;
  white-space: nowrap;
}
.badge-green  { background: #D1FAE5; color: #065F46; }
.badge-orange { background: #FEF3C7; color: #92400E; }
.badge-blue   { background: #DBEAFE; color: #1E40AF; }
.badge-red    { background: #FEE2E2; color: #991B1B; }
.badge-gray   { background: #F3F4F6; color: #374151; }
.badge-purple { background: #EDE9FE; color: #5B21B6; }

/* -- Search & Filters Bar ------------------------------------- */
.filter-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  align-items: center;
}
.search-box {
  position: relative;
  flex: 1;
  min-width: 180px;
  max-width: 320px;
}
.search-box .search-icon {
  position: absolute; left: 10px; top: 50%;
  transform: translateY(-50%);
  color: #A8956E; font-size: 14px; pointer-events: none;
}
.search-box input {
  width: 100%;
  padding: 8px 12px 8px 32px;
  border: 1.5px solid #E8E0D8;
  border-radius: 8px;
  background: #FFFFFF;
  font-size: 13px;
  color: #1C1917;
}
.search-box input::placeholder { color: #A8956E; }

select.filter-select {
  padding: 8px 32px 8px 12px;
  border: 1.5px solid #E8E0D8;
  border-radius: 8px;
  background: #FFFFFF url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23A8956E'/%3E%3C/svg%3E") no-repeat right 10px center;
  appearance: none;
  font-size: 13px;
  color: #1C1917;
  cursor: pointer;
}

/* -- Favorite star -------------------------------------------- */
.fav-btn {
  background: none; border: none; cursor: pointer;
  font-size: 16px; color: #E8E0D8;
  padding: 2px; transition: color .15s;
}
.fav-btn.active, .fav-btn:hover { color: #F59E0B; }

/* -- Pagination ----------------------------------------------- */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-top: 1px solid #E8E0D8;
  font-size: 12px;
  color: #A8956E;
  flex-wrap: wrap;
  gap: 8px;
}
.pagination-btns { display: flex; gap: 4px; }
.pagination-btns button {
  padding: 5px 10px;
  border: 1.5px solid #E8E0D8;
  border-radius: 6px;
  background: #fff; cursor: pointer;
  font-size: 12px; color: #57534E;
  transition: all .15s;
}
.pagination-btns button:hover,
.pagination-btns button.active { background: #D4944A; color: #fff; border-color: #D4944A; }
.pagination-btns button:disabled { opacity: .4; cursor: not-allowed; }

/* -- Modal ---------------------------------------------------- */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,.35);
  z-index: 500;
}
.modal-overlay.open { display: block !important; }
.modal-overlay.open .modal {
  margin: 0 auto;
  width: 100%;
  max-width: 540px;
}

.modal {
  background: #FFFFFF;
  border-radius: 14px;
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.15);
  position: relative;
}
.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid #E8E0D8;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-title { font-size: 16px; font-weight: 700; color: #1C1917; }
.modal-close {
  background: none; border: none; cursor: pointer;
  font-size: 20px; color: #A8956E; padding: 2px;
  line-height: 1;
}
.modal-close:hover { color: #1C1917; }
.modal-body { padding: 20px 24px; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid #E8E0D8;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* -- Form Fields ---------------------------------------------- */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 12px; font-weight: 600; color: #57534E; margin-bottom: 6px; text-transform: uppercase; letter-spacing: .4px; }
.form-control {
  width: 100%;
  padding: 8px 14px;
  border: 1px solid rgb(232, 224, 216);
  border-radius: 8px;
  background: #FFFFFF;
  font-size: 14px;
  color: #1A1A1A;
  transition: border-color .15s;
}
.form-control::placeholder { color: #A8956E; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
textarea.form-control { resize: vertical; min-height: 80px; }

/* -- Activity Feed -------------------------------------------- */
.activity-list { list-style: none; }
.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid #F5EDE0;
}
.activity-item:last-child { border-bottom: none; }
.activity-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-top: 5px;
  flex-shrink: 0;
}
.activity-dot.green { background: #10B981; }
.activity-dot.orange { background: #D4944A; }
.activity-dot.blue { background: #3B82F6; }
.activity-dot.red { background: #EF4444; }
.activity-text { font-size: 13px; color: #1C1917; line-height: 1.4; flex: 1; }
.activity-time { font-size: 11px; color: #A8956E; white-space: nowrap; }

/* -- Producer / Wine Card List -------------------------------- */
.list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid #F5EDE0;
}
.list-item:last-child { border-bottom: none; }
.list-item-icon {
  width: 38px; height: 38px;
  background: #FAF6F1;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.list-item-info { flex: 1; min-width: 0; }
.list-item-title { font-size: 13px; font-weight: 600; color: #1C1917; }
.list-item-sub { font-size: 12px; color: #A8956E; }
.list-item-right { text-align: right; flex-shrink: 0; }
.list-item-value { font-size: 14px; font-weight: 700; color: #1C1917; }
.list-item-count { font-size: 12px; color: #A8956E; }

/* -- Tasting Notes Cards -------------------------------------- */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  padding: 20px;
}
.note-card {
  background: #FFFFFF;
  border: 1px solid #E8E0D8;
  border-radius: 12px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.note-card-header { display: flex; align-items: flex-start; justify-content: space-between; }
.note-wine-name { font-size: 14px; font-weight: 700; color: #1C1917; }
.note-date { font-size: 11px; color: #A8956E; }
.note-occasion { }
.note-desc { font-size: 13px; color: #57534E; line-height: 1.5; }
.note-ratings { display: flex; gap: 16px; }
.note-rating { text-align: center; }
.note-rating .r-label { font-size: 10px; color: #A8956E; text-transform: uppercase; letter-spacing: .4px; margin-bottom: 2px; }
.note-rating .r-value { font-size: 15px; font-weight: 700; color: #D4944A; }
.note-stars { color: #F59E0B; font-size: 13px; }
.note-footer { display: flex; align-items: center; justify-content: space-between; }

/* -- Card list - hide on desktop, show on mobile ------------- */
.card-list { display: none; }

/* -- Delivery Cards ------------------------------------------- */
.delivery-card {
  background: #FFFFFF;
  border: 1px solid #E8E0D8;
  border-radius: 12px;
  padding: 18px 20px;
  margin-bottom: 12px;
}
.delivery-card-header {
  display: flex; align-items: flex-start;
  justify-content: space-between; margin-bottom: 12px;
}
.delivery-tracking { font-size: 14px; font-weight: 700; color: #1C1917; }
.delivery-carrier { font-size: 12px; color: #A8956E; margin-top: 2px; }
.delivery-meta { display: flex; gap: 20px; flex-wrap: wrap; margin-top: 10px; }
.delivery-meta-item { font-size: 12px; color: #57534E; }
.delivery-meta-item strong { color: #1C1917; font-weight: 600; }

/* -- Loader --------------------------------------------------- */
.loader-wrap {
  display: flex; align-items: center; justify-content: center;
  padding: 60px; color: #A8956E;
}
.spinner {
  width: 28px; height: 28px;
  border: 3px solid #E8E0D8;
  border-top-color: #D4944A;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  margin-right: 12px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #A8956E;
}
.empty-state .empty-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state p { font-size: 14px; }

/* -- Toast ---------------------------------------------------- */
#toast-container {
  position: fixed;
  bottom: 20px; right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  background: #1C1917;
  color: #fff;
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 13px;
  box-shadow: 0 4px 20px rgba(0,0,0,.2);
  display: flex; align-items: center; gap: 8px;
  animation: slideIn .2s ease;
  min-width: 220px;
}
.toast.success { border-left: 4px solid #10B981; }
.toast.error   { border-left: 4px solid #EF4444; }
.toast.info    { border-left: 4px solid #3B82F6; }
@keyframes slideIn { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }

/* -- LOGIN PAGE ----------------------------------------------- */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #FAF6F1;
  padding: 20px;
}
.login-card {
  background: #FFFFFF;
  border: 1px solid #E8E0D8;
  border-radius: 18px;
  padding: 44px 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 4px 40px rgba(0,0,0,.07);
}
.login-logo {
  text-align: center;
  margin-bottom: 32px;
}
.login-logo .logo-emoji { font-size: 40px; display: block; margin-bottom: 10px; }
.login-logo .logo-name {
  font-size: 26px; font-weight: 800;
  color: #1C1917; letter-spacing: -.5px;
}
.login-logo .logo-name span { color: #D4944A; }
.login-logo .logo-tag { font-size: 13px; color: #A8956E; margin-top: 4px; }
.login-title { font-size: 18px; font-weight: 700; color: #1C1917; margin-bottom: 4px; }
.login-sub { font-size: 13px; color: #A8956E; margin-bottom: 24px; }
.login-error {
  background: #FEE2E2;
  color: #991B1B;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 16px;
  display: none;
}
.login-error.show { display: block; }
.login-btn {
  width: 100%;
  padding: 12px;
  background: #D4944A;
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s;
  margin-top: 8px;
}
.login-btn:hover { background: #C07F3A; }
.login-btn:disabled { opacity: .6; cursor: not-allowed; }

/* -- RESPONSIVE ----------------------------------------------- */
@media (max-width: 1100px) {
  .charts-row { grid-template-columns: 1fr 1fr; }
  .charts-row .chart-card.wide { grid-column: span 2; }
}

@media (max-width: 900px) {
  .charts-row { grid-template-columns: 1fr; }
  .charts-row .chart-card.wide { grid-column: span 1; }
  .content-grid { grid-template-columns: 1fr; }
  .dash-row2 { grid-template-columns: 1fr; }
}

/* -- Invoices table responsive wrap -------------------------- */
.section-card .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* -- Delivery page wrapper ------------------------------------ */
#deliveries-list { padding: 0 0 20px; }

@media (max-width: 767px) {
  body { -webkit-tap-highlight-color: transparent; overflow-x: hidden; }

  /* Hide sidebar on mobile */
  #sidebar {
    display: none;
  }
  #sidebar-overlay {
    display: none;
  }

  /* Show bottom tab bar on mobile */
  #topbar { display: flex !important; }
  #bottom-tabs { display: flex !important; }
  #main-content { margin-left: 0; overflow-x: hidden; padding-bottom: 70px; }
}

/* Bottom tab bar base styles */
#bottom-tabs {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #fff;
  border-top: 1px solid #E8E0D8;
  justify-content: flex-start;
  padding: 6px 8px;
  padding-bottom: calc(6px + env(safe-area-inset-bottom, 0px));
  z-index: 200;
  overflow-x: auto;
  white-space: nowrap;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  gap: 4px;
}

#bottom-tabs::-webkit-scrollbar {
  display: none;
}

.bottom-tab {
  flex-shrink: 0;
}

/* Desktop: hide bottom tabs */
@media (min-width: 768px) {
  #bottom-tabs { display: none !important; }

  .page { padding: 16px; overflow-x: hidden; }
  .stats-grid { min-width: 0; overflow-x: auto; }
  .dash-row2 > * { min-width: 0; }
  .content-grid > * { min-width: 0; }
  .page-header { margin-bottom: 16px; }
  .page-title { font-size: 18px; }

  .form-row { grid-template-columns: 1fr; }

  .modal-overlay { align-items: flex-end; padding: 0; }
  .modal { border-radius: 16px 16px 0 0; max-width: 100%; max-height: 90vh; }

  .filter-bar { flex-direction: column; align-items: stretch; }
  .search-box { max-width: 100%; }

  /* Mobile table → card view for inventory */
  .mobile-cards .table-wrap { display: none; }
  .mobile-cards .card-list { display: block; }
  /* Delivery cards mobile spacing */
  .delivery-card { margin-bottom: 10px; }
  /* Invoice table columns compress on mobile */
  #invoices-table th:nth-child(4),
  #invoices-table td:nth-child(4) { display: none; }
  .wine-card {
    background: #FFFFFF;
    border: 1px solid #E8E0D8;
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 10px;
  }
  .wine-card-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 8px; }
  .wine-card-name { font-size: 14px; font-weight: 700; color: #1C1917; }
  .wine-card-winery { font-size: 12px; color: #A8956E; }
  .wine-card-meta { display: flex; flex-wrap: wrap; gap: 8px; }
  .wine-card-meta span { font-size: 11px; color: #57534E; background: #FAF6F1; padding: 3px 8px; border-radius: 20px; }
  .wine-card-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; padding-top: 10px; border-top: 1px solid #F5EDE0; }
  /* Varietal bar labels on mobile - abbreviate long names */
  #dash-varietal-list .loc-value-row { margin-bottom: 10px; }
  #dash-varietal-list .loc-name,
  #dash-varietal-list .var-label {
    min-width: 40px !important;
    max-width: 75px !important;
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  #dash-varietal-list .loc-value-label { font-size: 11px; min-width: 40px; }
  #dash-varietal-list .loc-bar-wrap { min-width: 30px; }
}

@media (max-width: 768px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .login-card { padding: 30px 22px; }
  .cards-grid { grid-template-columns: 1fr; padding: 12px; }
  /* Invoice Modal Footer - Smaller buttons on mobile */
  #modal-invoice-form .modal-footer { flex-wrap: wrap; gap: 8px; }
  #modal-invoice-form .modal-footer .btn { font-size: 12px !important; padding: 8px 12px !important; }
  #modal-invoice-form .modal-footer .btn.btn-danger { font-size: 12px !important; padding: 8px 12px !important; }
}

/* Inline dropdown add button */
.btn-inline-add { cursor:pointer;color:#D4944A;font-size:14px;margin-left:4px;font-weight:700; }
.btn-inline-add:hover { color:#C07F3A; }

/* Settings page */
#page-settings .settings-table { width:100%;border-collapse:collapse; }
#page-settings .settings-table th { text-align:left;padding:12px 16px;background:#FAF6F1;border-bottom:2px solid #E8E0D8;font-size:11px;font-weight:700;text-transform:uppercase;letter-spacing:.5px;color:#6B6B6B; }
#page-settings .settings-table td { padding:10px 16px;border-bottom:1px solid #F0EBE5;vertical-align:middle; }
#page-settings .settings-table tr:last-child td { border-bottom:none; }
#page-settings .settings-table tr:hover td { background:#FDFCFB; }
.settings-option-name { font-size:14px;color:#1C1917; }
.settings-option-actions { text-align:right;white-space:nowrap; }
.settings-category-row td { background:#FAF6F1 !important;font-weight:700;font-size:13px;color:#1C1917;padding:12px 16px !important; }
.settings-category-row:hover td { background:#FAF6F1 !important; }
.settings-add-row { display:flex;gap:8px;margin-top:8px;max-width:400px; }
.settings-add-row input { flex:1; }
.btn-delete-option { background:none;border:none;color:#999;font-size:16px;cursor:pointer;padding:4px 8px;border-radius:6px; }
.btn-delete-option:hover { color:#c00;background:#FEE2E2; }
.settings-empty { text-align:center;padding:40px;color:#A8956E;font-size:14px; }
