/* ══════════════════════════════════════════════════════════
   PiLarp Dashboard — Dark UI
   Optimised for 1280×720, 7" touch, landscape
   ══════════════════════════════════════════════════════════ */

:root {
  --bg:        #080810;
  --surface:   #0f0f1a;
  --surface2:  #141425;
  --border:    #1c1c30;
  --accent:    #6c63ff;
  --accent-lo: rgba(108,99,255,.12);
  --text:      #e6e6f0;
  --muted:     #7a7a90;
  --dimmed:    #4a4a60;
  --success:   #00d4a8;
  --warn:      #f0a500;
  --error:     #ff5555;
  --radius:    14px;
  --radius-sm: 8px;
  --font:      system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  background: var(--bg);
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  height: 100dvh;
  width: 100vw;
  overflow: hidden;          /* no scroll on the root */
  display: flex;
  flex-direction: column;
  user-select: none;
  -webkit-user-select: none;
}

/* ── Layout ─────────────────────────────────────────────── */

.header {
  flex-shrink: 0;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.header-greeting {
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: .04em;
  color: var(--text);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.header-date {
  font-size: .85rem;
  font-weight: 500;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
}

.header-time {
  font-size: 1.3rem;
  font-weight: 300;
  font-variant-numeric: tabular-nums;
  letter-spacing: .02em;
  color: var(--text);
}

.main {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  overflow: hidden;
}

/* ── Panels ─────────────────────────────────────────────── */

.panel {
  padding: 1.75rem 2rem;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.panel + .panel {
  border-left: 1px solid var(--border);
}

.panel-label {
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 1.4rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}

.panel-label .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  display: inline-block;
}

.panel-label .dot.green  { background: var(--success); }
.panel-label .dot.orange { background: var(--warn); }
.panel-label .dot.red    { background: var(--error); }

/* ── Shopify KPIs ───────────────────────────────────────── */

.kpi-grid {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  flex: 1;
  justify-content: center;
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  position: relative;
  overflow: hidden;
  transition: border-color .2s;
}

.kpi-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--accent-lo) 0%, transparent 60%);
  pointer-events: none;
}

.kpi-label {
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: .45rem;
}

.kpi-value {
  font-size: 2.6rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
  color: var(--text);
  line-height: 1;
}

.kpi-value.small-num {
  font-size: 1.9rem;
}

.kpi-sub {
  font-size: .75rem;
  color: var(--muted);
  margin-top: .3rem;
}

/* Loading / error states */
.kpi-loading .kpi-value {
  color: var(--dimmed);
  font-size: 1.4rem;
  font-weight: 400;
}

.kpi-error .kpi-value {
  color: var(--error);
  font-size: .9rem;
  font-weight: 400;
}

/* Skeleton pulse */
@keyframes pulse {
  0%, 100% { opacity: .4; }
  50%       { opacity: .9; }
}
.skeleton {
  animation: pulse 1.5s ease-in-out infinite;
  background: var(--border);
  border-radius: 4px;
  display: inline-block;
  height: 1em;
}

/* ── Notion tasks ───────────────────────────────────────── */

.task-panel {
  overflow: hidden;
}

.task-list {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding-right: .25rem;
}

/* Scrollbar styling (dark) */
.task-list::-webkit-scrollbar       { width: 4px; }
.task-list::-webkit-scrollbar-track { background: transparent; }
.task-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.task-list::-webkit-scrollbar-thumb:hover { background: var(--dimmed); }

.task-item {
  display: flex;
  align-items: flex-start;
  gap: .9rem;
  padding: .95rem 1rem;
  border-radius: var(--radius-sm);
  margin-bottom: .45rem;
  background: var(--surface);
  border: 1px solid var(--border);
  min-height: 52px;           /* large touch target */
  cursor: default;
  transition: border-color .15s, background .15s;
}

.task-item:active {
  background: var(--surface2);
  border-color: var(--accent);
}

.task-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 2px solid var(--dimmed);
  flex-shrink: 0;
  margin-top: .3rem;
}

.task-text {
  font-size: .92rem;
  line-height: 1.45;
  color: var(--text);
  word-break: break-word;
}

.task-placeholder {
  color: var(--dimmed);
  font-size: .88rem;
  text-align: center;
  padding: 2rem 0;
}

/* ── Toast notifications ────────────────────────────────── */

#toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 1000;
  display: flex;
  flex-direction: column-reverse;
  gap: .6rem;
  pointer-events: none;
}

.toast {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: .85rem 1.1rem;
  min-width: 220px;
  max-width: 300px;
  pointer-events: all;
  cursor: pointer;
  position: relative;
  animation: toast-in .25s cubic-bezier(.34,1.56,.64,1) forwards;
}

.toast.removing {
  animation: toast-out .2s ease-in forwards;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateX(40px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes toast-out {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(40px); }
}

.toast-header {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: .35rem;
}

.toast-order {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

.toast-amount {
  font-size: .85rem;
  color: var(--muted);
  margin-top: .15rem;
}

.toast-close {
  position: absolute;
  top: .5rem;
  right: .6rem;
  font-size: .85rem;
  color: var(--dimmed);
  line-height: 1;
}

/* ── Status indicator ───────────────────────────────────── */

.status-bar {
  flex-shrink: 0;
  height: 28px;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 0 2rem;
  background: var(--surface);
  border-top: 1px solid var(--border);
  font-size: .72rem;
  color: var(--dimmed);
  letter-spacing: .04em;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: .35rem;
}

.status-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--dimmed);
}

.status-dot.ok     { background: var(--success); }
.status-dot.error  { background: var(--error); }
.status-dot.loading {
  background: var(--accent);
  animation: pulse 1s ease-in-out infinite;
}

.status-bar-right {
  margin-left: auto;
}

/* ── Not-configured overlay ─────────────────────────────── */

.not-configured {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  flex-direction: column;
  gap: .75rem;
  color: var(--dimmed);
  font-size: .88rem;
  text-align: center;
}

.not-configured a {
  color: var(--accent);
  text-decoration: none;
}

/* ── Responsive (shouldn't scroll horizontally) ─────────── */

@media (max-width: 700px) {
  .main { grid-template-columns: 1fr; }
  .panel + .panel { border-left: none; border-top: 1px solid var(--border); }
  body { overflow-y: auto; height: auto; }
}
