/* ============================================================
   HOME DASHBOARD — home.css
   Card-based grid layout
   ============================================================ */

.dash-page {
  padding: 2rem 2.5rem;
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* ── Top bar ── */
.dash-topbar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}

.dash-title {
  font-size: 1.375rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin: 0;
}

.dash-subtitle {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
  display: block;
}

/* ── Dashboard grid ── */
.dash-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto auto auto;
  gap: 1.25rem;
}

/* ── Base card ── */
.dash-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 2px 6px rgba(15,22,35,0.06), 0 1px 2px rgba(15,22,35,0.04);
  overflow: hidden;
}

.dash-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem 0.75rem;
  border-bottom: 1px solid var(--border-light);
}

.dash-card-title {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.dash-card-link {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--accent-dark);
  text-decoration: none;
  transition: color 0.12s ease;
}

.dash-card-link:hover { color: var(--accent); }

/* ── Empty state ── */
.dash-empty {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 1.5rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.dash-empty .material-symbols-outlined {
  font-size: 18px;
  opacity: 0.5;
}

/* ============================================================
   KPI STRIP — spans full width
   ============================================================ */

.kpi-strip {
  grid-column: 1 / -1;
  display: flex;
  align-items: stretch;
}

.kpi-item {
  flex: 1;
  padding: 1.5rem 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.kpi-divider {
  width: 1px;
  background: var(--border-light);
  align-self: stretch;
  margin: 1rem 0;
}

.kpi-label {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.kpi-value {
  font-family: var(--font-data);
  font-size: 2rem;
  font-weight: 500;
  color: var(--text-primary);
  letter-spacing: -0.03em;
  line-height: 1;
}

.kpi-value-alert {
  color: var(--warning);
}

.kpi-sub {
  font-size: 0.6875rem;
  color: var(--text-muted);
  margin-top: 0.125rem;
}

/* ============================================================
   QUICK ACTIONS
   ============================================================ */

.actions-card {}

.actions-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  padding: 1.25rem 1.5rem;
}

.action-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.625rem;
  padding: 1rem 0.75rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: box-shadow 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
  cursor: pointer;
}

.action-tile:hover {
  box-shadow: var(--shadow-md);
  border-color: #c8cdd8;
  transform: translateY(-1px);
}

.action-tile-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.action-tile-icon .material-symbols-outlined {
  font-size: 22px;
}

/* Colour variants for action tiles */
.action-tile-icon--blue   { background: #e8f0fe; }
.action-tile-icon--blue   .material-symbols-outlined { color: #3b5bdb; }
.action-tile-icon--green  { background: #e8f5e9; }
.action-tile-icon--green  .material-symbols-outlined { color: #2f9e44; }
.action-tile-icon--purple { background: #f3e8ff; }
.action-tile-icon--purple .material-symbols-outlined { color: #7c3aed; }
.action-tile-icon--orange { background: #fff3e0; }
.action-tile-icon--orange .material-symbols-outlined { color: #e8700a; }
.action-tile-icon--sky    { background: #e0f2fe; }
.action-tile-icon--sky    .material-symbols-outlined { color: #0284c7; }
.action-tile-icon--pink   { background: #fce4ec; }
.action-tile-icon--pink   .material-symbols-outlined { color: #c2255c; }

/* Home To Do / Documents widget helpers */
.dash-todo-filter {
  padding: 0.25rem 0.5rem;
  font-size: 0.6875rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text-primary);
}
.todo-row {
  text-decoration: none;
  color: inherit;
}
.schedule-item-supplier .material-symbols-outlined {
  font-size: 14px;
  vertical-align: middle;
  margin-right: 4px;
}
.dash-empty--hidden { display: none; }
.dash-doc-search-wrap {
  padding: 0.625rem 1rem 0;
}
.dash-doc-search-inner {
  position: relative;
}
.dash-doc-search-inner .material-symbols-outlined {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
  color: var(--text-muted);
}
.dash-doc-search-input {
  width: 100%;
  padding: 0.5rem 0.625rem 0.5rem 32px;
  font-size: 0.8125rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.action-tile-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-primary);
  text-align: center;
  line-height: 1.3;
}

/* ============================================================
   DUE THIS WEEK
   ============================================================ */

.schedule-card {
  display: flex;
  flex-direction: column;
  grid-row: span 2;
  min-height: 0;
  overflow: hidden;
}

.schedule-card .schedule-list {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

.schedule-list {
  padding: 0.5rem 0;
}

.schedule-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 1.5rem;
  transition: background 0.1s ease;
}

.schedule-item:hover { background: var(--surface-2); }

.schedule-item.done { opacity: 0.55; }

.schedule-item-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.schedule-item-dot.amber { background: var(--accent); box-shadow: 0 0 0 2px rgba(232,160,32,0.2); }
.schedule-item-dot.green { background: var(--positive); box-shadow: 0 0 0 2px rgba(22,163,74,0.15); }

.schedule-item-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.schedule-item-supplier {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.schedule-item-store {
  font-size: 0.6875rem;
  color: var(--text-muted);
}

.schedule-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.625rem;
  border-radius: 999px;
  font-size: 0.6875rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
  letter-spacing: 0.02em;
}

.schedule-chip.done {
  background: #e8f5e9;
  color: #1b6b2f;
  border: 1px solid #bbdfc8;
}

.schedule-chip.run {
  background: var(--text-primary);
  color: #ffffff;
  transition: background 0.12s ease;
}

.schedule-chip.run:hover { background: #1e2d45; }

/* ============================================================
   DOCUMENTS WIDGET
   ============================================================ */

.documents-card {
  display: flex;
  flex-direction: column;
}

.documents-list {
  padding: 0.5rem 0;
  flex: 1;
  overflow-y: auto;
  max-height: 360px;
}

.doc-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 1.5rem;
  text-decoration: none;
  color: inherit;
  transition: background 0.1s ease;
}

.doc-row:hover { background: var(--surface-2); }

.doc-row__icon {
  font-size: 18px;
  color: var(--accent, #e8a020);
  flex-shrink: 0;
}

.doc-row__body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.doc-row__title {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.doc-row__meta {
  font-size: 0.6875rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.doc-row__time {
  font-family: var(--font-data);
  font-size: 0.6875rem;
  color: var(--text-muted);
  flex-shrink: 0;
  white-space: nowrap;
}

/* ============================================================
   RECENT ACTIVITY — spans full width
   ============================================================ */

.activity-card {
  grid-column: 1 / -1;
}

.activity-list {
  padding: 0.5rem 0;
}

.activity-item {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 0.625rem 1.5rem;
  transition: background 0.1s ease;
  text-decoration: none;
  color: inherit;
}

.activity-item:hover { background: var(--surface-2); }
.activity-item--link { cursor: pointer; }
.activity-item--link:hover .activity-title { color: var(--accent, #c47a1f); }

.activity-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.activity-icon .material-symbols-outlined { font-size: 16px; }

.activity-icon.order   { background: #e8f0fe; color: #3b5bdb; }
.activity-icon.invoice { background: #fff3e0; color: #e8700a; }
.activity-icon.success { background: #e8f5e9; color: #2f9e44; }
.activity-icon.system  { background: var(--surface-2); color: var(--text-muted); }

.activity-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.activity-title {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.activity-meta {
  font-size: 0.6875rem;
  color: var(--text-muted);
}

.activity-time {
  font-family: var(--font-data);
  font-size: 0.6875rem;
  color: var(--text-muted);
  flex-shrink: 0;
  white-space: nowrap;
}

/* ============================================================
   MOBILE
   ============================================================ */

@media (max-width: 768px) {
  .dash-page { padding: 1.25rem; gap: 1rem; }

  .dash-grid { grid-template-columns: 1fr; }

  .schedule-card { grid-row: auto; }
  .schedule-card .schedule-list { max-height: 360px; }

  .kpi-strip {
    grid-column: 1;
    flex-wrap: wrap;
  }

  .kpi-item { min-width: 50%; }
  .kpi-divider { display: none; }

  .actions-grid { grid-template-columns: repeat(3, 1fr); }

  .activity-card { grid-column: 1; }
}

@media (max-width: 480px) {
  .actions-grid { grid-template-columns: repeat(2, 1fr); }
  .kpi-item     { min-width: 100%; }
}