/* app2.css — additional styles for v2 pages (date-bucketed bookings, R&M, master data, notes, calendar) */

/* ============ STICKY BOOKINGS HEADER (action bar + date tabs) ============ */
/* Freezes the booking-status legend, action buttons, and date tabs at the
   top of the viewport when the user scrolls down through Current Bookings. */
.bookings-sticky {
  position: sticky;
  top: 72px; /* sits just below the sticky .topbar */
  z-index: 9;
  /* Extend the sticky background out to cover the .page padding gutters
     so content scrolling underneath doesn't peek through. */
  margin: -32px -32px 16px;
  padding: 32px 32px 0;
  background: var(--color-grey-100);
}
@media (max-width: 900px) {
  .bookings-sticky {
    top: 60px;
    margin: -16px -16px 12px;
    padding: 16px 16px 0;
  }
}

/* ============ DATE TABS (Yesterday / Today / Tomorrow / Day After) ============ */
.date-tabs {
  display: flex;
  gap: 8px;
  background: var(--color-white);
  padding: 8px;
  border-radius: 12px;
  border: 1px solid var(--color-grey-200);
  margin-bottom: 16px;
  overflow-x: auto;
}

.date-tab {
  flex: 1;
  min-width: 140px;
  padding: 12px 16px;
  border-radius: 8px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: all 0.15s;
  border: 1px solid transparent;
}

.date-tab:hover {
  background: var(--color-grey-100);
}

.date-tab--active {
  background: var(--color-navy);
  color: var(--color-white);
}

.date-tab--active:hover {
  background: var(--color-navy);
}

.date-tab__label {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  opacity: 0.7;
}

.date-tab--active .date-tab__label {
  opacity: 0.85;
}

.date-tab__date {
  font-size: var(--text-base);
  font-weight: 700;
  font-family: var(--font-display);
}

.date-tab__count {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--text-xs);
  font-weight: 600;
  margin-top: 2px;
  opacity: 0.8;
}

.date-tab__count-pill {
  display: inline-block;
  background: var(--color-yellow);
  color: var(--color-navy);
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  min-width: 22px;
  text-align: center;
}

.date-tab--active .date-tab__count-pill {
  background: var(--color-yellow);
  color: var(--color-navy);
}

/* ============ CATEGORY GROUP HEADER ============ */
.cat-group {
  background: var(--color-white);
  border: 1px solid var(--color-grey-200);
  border-radius: 12px;
  margin-bottom: 16px;
  overflow: hidden;
}

.cat-group__header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: var(--color-grey-100);
  border-bottom: 1px solid var(--color-grey-200);
}

.cat-group__swatch {
  width: 4px;
  height: 24px;
  border-radius: 2px;
}

.cat-group__name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-base);
  color: var(--color-navy);
}

.cat-group__count {
  margin-left: auto;
  font-size: var(--text-sm);
  color: var(--color-grey-600);
  font-weight: 600;
}

/* ============ MACHINE STATUS DOT ============ */
.mdot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 2px solid var(--color-white);
  box-shadow: 0 0 0 1px var(--color-grey-300);
}
.mdot--available   { background: #16a34a; }
.mdot--occupied    { background: #dc2626; }
.mdot--unavailable { background: #9ca3af; }

.mdot-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.mdot-legend {
  display: flex;
  gap: 16px;
  font-size: var(--text-xs);
  color: var(--color-grey-600);
  margin-left: auto;
}

.mdot-legend > span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* ============ BOOKING ROW (within category group) ============ */
.bk-row {
  display: grid;
  grid-template-columns: 120px 200px 1fr 1fr 110px 70px;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-top: 1px solid var(--color-grey-100);
  font-size: var(--text-sm);
  transition: background 0.1s;
}

.bk-row:first-of-type { border-top: none; }
.bk-row:hover { background: var(--color-grey-50, #fafafa); }

/* Column header for Current Bookings — aligns to the .bk-row grid and rides
   along inside the frozen .bookings-sticky region. */
.bk-head {
  display: grid;
  grid-template-columns: 120px 200px 1fr 1fr 110px 70px;
  align-items: center;
  gap: 12px;
  padding: 10px 18px;
  background: var(--color-grey-100);
  border: 1px solid var(--color-grey-200);
  border-radius: 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-grey-600);
  margin-top: 12px;
}
@media (max-width: 1100px) {
  .bk-head { display: none; }
}

.bk-row__id {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 12px;
  color: var(--color-grey-600);
  font-weight: 600;
}

.bk-row__customer {
  font-weight: 600;
  color: var(--color-navy);
}

.bk-row__sub {
  font-size: 12px;
  color: var(--color-grey-600);
  margin-top: 2px;
}

.bk-row__time {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--color-navy);
}

.bk-row__shift-pill {
  display: inline-block;
  font-size: 10px;
  text-transform: uppercase;
  background: var(--color-grey-100);
  color: var(--color-grey-700);
  padding: 2px 6px;
  border-radius: 4px;
  margin-top: 2px;
  letter-spacing: 0.05em;
}

@media (max-width: 1100px) {
  .bk-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}

/* ============ DAILY NOTES PAGE ============ */
.note-card {
  background: var(--color-white);
  border: 1px solid var(--color-grey-200);
  border-radius: 12px;
  padding: 20px 24px;
  margin-bottom: 16px;
  position: relative;
}

.note-card__date {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-lg);
  color: var(--color-navy);
  margin-bottom: 8px;
}

.note-card__date-pill {
  background: var(--color-yellow);
  color: var(--color-navy);
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.note-card__author {
  font-size: var(--text-xs);
  color: var(--color-grey-600);
  margin-bottom: 10px;
}

.note-card__body {
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--color-grey-800);
  white-space: pre-wrap;
}

.note-card__body--editable {
  width: 100%;
  border: 1px dashed var(--color-grey-300);
  border-radius: 8px;
  padding: 12px;
  font-family: inherit;
  font-size: var(--text-base);
  resize: vertical;
  min-height: 80px;
}
.note-card__body--editable:focus {
  outline: none;
  border-color: var(--color-navy);
  border-style: solid;
}

.note-banner {
  background: linear-gradient(135deg, rgba(11,31,58,0.04), rgba(245,196,0,0.06));
  border: 1px solid var(--color-grey-200);
  border-radius: 12px;
  padding: 12px 16px;
  font-size: var(--text-sm);
  color: var(--color-grey-700);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ============ R&M OVERVIEW ============ */
.rm-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 1100px) {
  .rm-grid { grid-template-columns: 1fr; }
}

/* Overview columns: scroll the list inside each column while the card header
   (title + subtitle) stays frozen at the top of the column. */
.rm-ov-card {
  padding: 0;
  max-height: calc(100vh - 300px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.rm-ov-card .card__header {
  position: sticky;
  top: 0;
  z-index: 3;
  margin: 0;
  padding: 20px 22px 16px;
  background: white;
  border-bottom: 1px solid var(--border-default);
}

.rm-overdue-banner {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-left: 4px solid #dc2626;
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.rm-overdue-banner__icon {
  background: #dc2626;
  color: white;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.rm-overdue-banner__title {
  font-family: var(--font-display);
  font-weight: 700;
  color: #991b1b;
  font-size: var(--text-base);
}
.rm-overdue-banner__sub {
  font-size: var(--text-xs);
  color: #7f1d1d;
}

.countdown-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-xs);
  padding: 4px 10px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.countdown-pill--ok { background: #dcfce7; color: #166534; }
.countdown-pill--soon { background: #fef3c7; color: #92400e; }
.countdown-pill--overdue { background: #fee2e2; color: #991b1b; }

/* ============ MASTER DATA TABS ============ */
.tab-bar {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--color-grey-200);
  margin-bottom: 20px;
  background: var(--color-white);
  padding: 0 8px;
  border-radius: 12px 12px 0 0;
  border: 1px solid var(--color-grey-200);
  border-bottom: none;
  flex-wrap: wrap;
}

.tab-btn {
  padding: 14px 18px;
  font-weight: 600;
  font-size: var(--text-sm);
  color: var(--color-grey-600);
  border-bottom: 3px solid transparent;
  margin-bottom: -1px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.tab-btn:hover { color: var(--color-navy); }
.tab-btn--active {
  color: var(--color-navy);
  border-bottom-color: var(--color-yellow);
}

/* ============ CALENDAR ============ */
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--color-grey-200);
  border: 1px solid var(--color-grey-200);
  border-radius: 12px;
  overflow: hidden;
}

.cal-head {
  background: var(--color-grey-100);
  padding: 10px 12px;
  text-align: center;
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--color-grey-600);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.cal-cell {
  background: var(--color-white);
  min-height: 110px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cal-cell--today { background: #fffbe6; }
.cal-cell--out { background: var(--color-grey-50, #fafafa); color: var(--color-grey-400); }

.cal-cell__date {
  font-weight: 700;
  font-family: var(--font-display);
  color: var(--color-navy);
  font-size: var(--text-sm);
}

.cal-cell--today .cal-cell__date {
  background: var(--color-yellow);
  color: var(--color-navy);
  display: inline-block;
  border-radius: 999px;
  padding: 0 8px;
  align-self: flex-start;
}

.cal-evt {
  background: var(--color-grey-100);
  border-left: 3px solid var(--color-navy);
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 600;
  color: var(--color-navy);
}

.cal-evt--more {
  background: transparent;
  border: none;
  color: var(--color-grey-600);
  font-size: 11px;
  padding: 2px 6px;
}

/* ============ DELETE-RESTRICTED HINT ============ */
.restricted-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--color-grey-500);
  background: var(--color-grey-100);
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 600;
}

/* ============ COMMON HELPERS used by v2 pages ============ */
.page {
  padding: 32px;
  max-width: 1400px;
}
/* All Bookings needs the full width so the 8-column table doesn't overflow. */
.page--allbookings {
  max-width: none;
}
@media (max-width: 900px) {
  .page { padding: 16px; }
}

.page-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-grey-200);
  gap: 12px;
  flex-wrap: wrap;
}
.card__title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
  color: var(--color-navy);
  margin: 0;
}
.card__sub {
  font-size: 12px;
  color: var(--color-grey-600);
  margin-top: 2px;
}
.card__body { padding: 0; }

.status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
  color: var(--color-white);
}
.status--gray   { background: #6b7280; color: var(--color-white); }
.status--blue   { background: #2563eb; color: var(--color-white); }
.status--green  { background: #16a34a; color: var(--color-white); }
.status--yellow { background: #d97706; color: var(--color-white); }
.status--orange { background: #ea580c; color: var(--color-white); }
.status--red    { background: #dc2626; color: var(--color-white); }
.status--purple { background: #7c3aed; color: var(--color-white); }

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.table th {
  text-align: left;
  padding: 12px 16px;
  background: var(--color-grey-50, #fafafa);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-grey-600);
  border-bottom: 1px solid var(--color-grey-200);
}
.table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-grey-100);
  vertical-align: middle;
}
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: var(--color-grey-50, #fafafa); }

.input, .select {
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--color-grey-300);
  border-radius: 8px;
  font-size: 14px;
  background: var(--color-white);
  color: var(--color-grey-800);
}
.input:focus, .select:focus {
  outline: none;
  border-color: var(--color-navy);
}

/* ============ ALL BOOKINGS PAGE ============ */
.ab-layout {
  display: grid;
  /* Sidebar trimmed so the bookings table gets more horizontal room. */
  grid-template-columns: 180px 1fr;
  gap: 16px;
  align-items: flex-start;
}
@media (max-width: 900px) {
  .ab-layout { grid-template-columns: 1fr; }
}

.ab-sidebar {
  background: var(--color-white);
  border: 1px solid var(--color-grey-200);
  border-radius: 12px;
  padding: 8px;
  max-height: calc(100vh - 200px);
  overflow-y: auto;
  position: sticky;
  top: 96px;
}

.ab-side-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 6px;
  text-align: left;
  font-size: 13px;
  color: var(--color-grey-800);
  cursor: pointer;
  background: transparent;
  border: none;
  font-family: inherit;
}
.ab-side-item:hover { background: var(--color-grey-100); }
.ab-side-item--active {
  background: rgba(255,213,0,0.18);
  color: var(--color-navy);
  font-weight: 700;
}
.ab-side-item--month  { padding-left: 22px; font-size: 12px; }
.ab-side-item--day    { padding-left: 38px; font-size: 12px; color: var(--color-grey-700); }
.ab-side-count {
  margin-left: auto;
  font-size: 11px;
  color: var(--color-grey-500);
  background: var(--color-grey-100);
  padding: 1px 6px;
  border-radius: 999px;
  min-width: 22px;
  text-align: center;
}
.ab-side-item--active .ab-side-count {
  background: var(--color-navy);
  color: var(--color-white);
}

.ab-main {
  background: var(--color-white);
  border: 1px solid var(--color-grey-200);
  border-radius: 12px;
  overflow: hidden;
}

.ab-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--color-grey-200);
}
.ab-header__title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  color: var(--color-navy);
}
.ab-header__sub {
  font-size: 12px;
  color: var(--color-grey-500);
  margin-top: 2px;
}

.ab-table {
  max-height: calc(100vh - 280px);
  overflow-y: auto;
}

.ab-row {
  display: grid;
  /* chat / date / category / machine+operator / company / location / shift */
  grid-template-columns: 36px 110px 130px 190px 1.1fr 1.4fr 80px;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-grey-100);
  font-size: 13px;
  cursor: pointer;
  transition: background 0.1s;
}
.ab-row:hover { background: var(--color-grey-50, #fafafa); }
.ab-row--head {
  background: var(--color-grey-50, #fafafa);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-grey-600);
  cursor: default;
  position: sticky;
  top: 0;
  z-index: 1;
}
.ab-row--head:hover { background: var(--color-grey-50, #fafafa); }

.ab-row__chat {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(34,197,94,0.15);
  color: #15803d;
}

.ab-cat {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ab-machine {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}
.ab-machine__stack {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.ab-machine__op {
  font-weight: 500;
  font-size: 11.5px;
  color: var(--color-grey-500);
}
.ab-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #2563eb;
  flex-shrink: 0;
}
.ab-dot--multi { background: #7C3AED; }

.ab-cr-icon {
  display: grid;
  place-items: center;
  background: #7C3AED;
  color: white;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 700;
}

@media (max-width: 1200px) {
  .ab-row {
    grid-template-columns: 32px 100px 120px 160px 1fr 1.2fr;
  }
  .ab-row > div:nth-child(7) { display: none; }
  .ab-row--head > div:nth-child(7) { display: none; }
}

/* ============ CUSTOMER PRICE LIST (Account & Finance) ============ */
.pricelist {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}
.pricelist__customers {
  position: sticky;
  top: 88px;
  padding-bottom: 8px;
}
.pricelist__customer-list {
  display: flex;
  flex-direction: column;
  max-height: 60vh;
  overflow-y: auto;
  border-top: 1px solid var(--border-default);
}
.pricelist__customer {
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: left;
  padding: 11px 16px;
  background: none;
  border: none;
  border-left: 3px solid transparent;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.pricelist__customer + .pricelist__customer {
  border-top: 1px solid var(--color-grey-100);
}
.pricelist__customer:hover { background: var(--color-grey-50); }
.pricelist__customer--active {
  background: var(--color-grey-50);
  border-left-color: var(--color-yellow, #F4B400);
}
.pricelist__customer-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--color-navy);
}
.pricelist__customer-code {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--color-grey-500);
}
.pricelist__customer--active .pricelist__customer-code { color: var(--color-grey-700); }

.pricelist__stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 0 18px 16px;
}
.pricelist__stat {
  flex: 1;
  min-width: 130px;
  padding: 12px 14px;
  background: var(--color-grey-50);
  border: 1px solid var(--border-default);
  border-radius: 10px;
}
.pricelist__stat-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-grey-500);
  margin-bottom: 4px;
}
.pricelist__stat-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--color-navy);
}
.pricelist__table th,
.pricelist__table td { vertical-align: middle; }

@media (max-width: 900px) {
  .pricelist { grid-template-columns: 1fr; }
  .pricelist__customers { position: static; }
  .pricelist__customer-list { max-height: 240px; }
}
