/* ============================================================
   Timely — App Shell & Screen-Specific Styles
   ============================================================ */

/* ── Page frame ── */
.page-frame {
  display: grid;
  grid-template-columns: 248px 1fr;
  height: 100%;
  background: var(--canvas);
  font-family: var(--font-sans);
}

/* ── Sidebar ── */
.sidebar {
  background: var(--paper);
  border-right: 1px solid var(--ink-200);
  display: flex;
  flex-direction: column;
  padding: var(--s-4) 0;
}

.sidebar .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px var(--s-5) var(--s-5);
  border-bottom: 1px solid var(--ink-100);
  margin-bottom: var(--s-4);
}
.sidebar .brand .org {
  display: flex; flex-direction: column;
  margin-left: auto;
  font-size: var(--t-tiny);
}
.sidebar .brand .org .org-name { font-weight: 600; color: var(--ink-1000); }
.sidebar .brand .org .org-plan { color: var(--ink-500); font-size: var(--t-micro); }

.sidebar .group {
  padding: 0 var(--s-3);
  margin-bottom: var(--s-3);
}
.sidebar .group h6 {
  margin: 0 0 6px;
  padding: 0 var(--s-3);
  font-size: var(--t-micro);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--tracking-mega);
  color: var(--ink-500);
}

.sidebar .nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 32px;
  padding: 0 var(--s-3);
  border-radius: var(--r-2);
  font-size: var(--t-small);
  color: var(--ink-800);
  font-weight: 500;
  cursor: pointer;
  transition: background var(--dur-quick);
  position: relative;
  text-decoration: none;
}
.sidebar .nav-item:hover { background: var(--ink-50); }
.sidebar .nav-item.active {
  background: var(--brand-hero-tint);
  color: var(--brand-hero-deep);
  font-weight: 600;
}
.sidebar .nav-item.active::before {
  content: '';
  position: absolute; left: -12px; top: 6px; bottom: 6px;
  width: 3px; background: var(--brand-hero); border-radius: 0 2px 2px 0;
}
.sidebar .nav-item .ic { width: 16px; height: 16px; flex-shrink: 0; opacity: 0.7; }
.sidebar .nav-item.active .ic { opacity: 1; }
.sidebar .nav-item .count {
  margin-left: auto;
  font-size: var(--t-micro);
  color: var(--ink-500);
  font-family: var(--font-mono);
  font-weight: 500;
}
.sidebar .nav-item.active .count { color: var(--brand-hero); }

.sidebar .footer {
  margin-top: auto;
  padding: var(--s-4) var(--s-5);
  border-top: 1px solid var(--ink-100);
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar .footer .avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #C45A3A, #9C4128);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: var(--t-tiny);
  font-weight: 600;
}
.sidebar .footer .meta { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.sidebar .footer .meta .name { font-size: var(--t-small); font-weight: 600; color: var(--ink-1000); }
.sidebar .footer .meta .email { font-size: var(--t-micro); color: var(--ink-500); }

/* ── Main ── */
.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  height: 56px;
  padding: 0 var(--s-7);
  background: var(--paper);
  border-bottom: 1px solid var(--ink-200);
  flex-shrink: 0;
}
.topbar .crumbs {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--t-small);
  color: var(--ink-500);
}
.topbar .crumbs .sep { color: var(--ink-400); }
.topbar .crumbs .current { color: var(--ink-1000); font-weight: 600; }
.topbar .spacer { flex: 1; }
.topbar .search {
  width: 280px;
  height: 32px;
  background: var(--ink-50);
  border: 1px solid transparent;
}
.topbar .search:hover, .topbar .search:focus-within { background: var(--surface); border-color: var(--ink-200); }
.topbar .kbd {
  display: inline-flex;
  align-items: center;
  padding: 1px 5px;
  font-size: 10px;
  background: var(--surface);
  border: 1px solid var(--ink-200);
  border-radius: 3px;
  color: var(--ink-500);
  font-family: var(--font-mono);
}

/* ── Content ── */
.content {
  flex: 1;
  overflow: auto;
  padding: var(--s-7);
  display: flex;
  flex-direction: column;
  gap: var(--s-6);
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--s-5);
}
.page-head h1 {
  margin: 0;
  font-size: var(--t-display);
  letter-spacing: var(--tracking-tight);
  font-weight: 600;
  color: var(--ink-1000);
  line-height: var(--lh-tight);
}
.page-head .sub {
  margin-top: 6px;
  font-size: var(--t-h3);
  color: var(--ink-500);
}
.page-head .actions {
  display: flex;
  align-items: center;
  gap: var(--s-2);
}

/* ── Stats row ── */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--s-4);
}
.stat {
  background: var(--surface);
  border: 1px solid var(--ink-200);
  border-radius: var(--r-4);
  padding: var(--s-5);
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
  overflow: hidden;
}
.stat .label {
  font-size: var(--t-tiny);
  color: var(--ink-500);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  font-weight: 600;
}
.stat .value {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: var(--tracking-tight);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--ink-1000);
  line-height: var(--lh-tight);
}
.stat .delta {
  font-size: var(--t-tiny);
  color: var(--ink-500);
}
.stat .delta.up { color: var(--success); }
.stat .delta.down { color: var(--danger); }
.stat.brand { background: var(--brand-hero-tint); border-color: var(--brand-hero-soft); }
.stat.brand .label { color: var(--brand-hero-deep); }

/* ── Filters bar ── */
.filters {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  flex-wrap: wrap;
}

/* ── Section header ── */
.section-head {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  margin-bottom: var(--s-3);
}
.section-head h3 {
  margin: 0;
  font-size: var(--t-h2);
  font-weight: 600;
  letter-spacing: var(--tracking-tight);
  color: var(--ink-1000);
}
.section-head .total {
  margin-left: auto;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--ink-500);
  font-size: var(--t-small);
}
.section-head hr {
  flex: 1;
  border: 0;
  border-top: 1px dashed var(--ink-200);
  margin: 0;
}

/* ── Persistent timer FAB ── */
.timer-fab {
  position: absolute;
  right: var(--s-7);
  bottom: var(--s-7);
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: 10px var(--s-3) 10px var(--s-4);
  background: var(--ink-1000);
  color: #fff;
  border-radius: var(--r-pill);
  box-shadow: 0 12px 32px rgba(31,26,23,0.32), 0 0 0 1px rgba(255,255,255,0.04);
  z-index: 50;
}
.timer-fab .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--brand-hero);
  box-shadow: 0 0 0 0 rgba(196,90,58,0.6);
  animation: live-pulse-bright 1.4s ease-out infinite;
}
@keyframes live-pulse-bright {
  0% { box-shadow: 0 0 0 0 rgba(196,90,58,0.7); }
  70% { box-shadow: 0 0 0 8px rgba(196,90,58,0); }
  100% { box-shadow: 0 0 0 0 rgba(196,90,58,0); }
}
.timer-fab .meta { display: flex; flex-direction: column; line-height: 1.25; }
.timer-fab .meta .l1 { font-size: var(--t-tiny); font-weight: 600; }
.timer-fab .meta .l2 { font-size: 10px; color: rgba(255,255,255,0.6); font-weight: 500; }
.timer-fab .clock {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: var(--t-h2);
  font-weight: 600;
  margin-left: var(--s-2);
  color: #fff;
  letter-spacing: -0.01em;
}
.timer-fab .ctrl {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  color: #fff;
  background: rgba(255,255,255,0.08);
  transition: background var(--dur-quick);
}
.timer-fab .ctrl:hover { background: rgba(255,255,255,0.16); }
.timer-fab .ctrl.stop { background: var(--brand-hero); }
.timer-fab .ctrl.stop:hover { background: var(--brand-hero-deep); }

/* ── Weekly grid ── */
.wgrid {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--surface);
  border: 1px solid var(--ink-200);
  border-radius: var(--r-4);
  overflow: hidden;
  font-size: var(--t-small);
}
.wgrid th, .wgrid td {
  border-bottom: 1px solid var(--ink-100);
  border-right: 1px solid var(--ink-100);
  padding: 0;
  vertical-align: middle;
}
.wgrid th:last-child, .wgrid td:last-child { border-right: 0; }
.wgrid tr:last-child td { border-bottom: 0; }
.wgrid th {
  background: var(--ink-25);
  padding: 10px 14px;
  font-size: var(--t-micro);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--ink-500);
  text-align: center;
}
.wgrid th.today { color: var(--brand-hero); background: var(--brand-hero-tint); }
.wgrid th .day { display: block; font-size: var(--t-h2); color: var(--ink-1000); margin-top: 2px; font-family: var(--font-mono); font-weight: 600; }
.wgrid th.today .day { color: var(--brand-hero-deep); }

.wgrid .proj-cell { padding: 12px 16px; font-size: var(--t-small); min-width: 220px; }
.wgrid .proj-cell .pname { font-weight: 600; color: var(--ink-1000); display: flex; align-items: center; }
.wgrid .proj-cell .ptask { font-size: var(--t-tiny); color: var(--ink-500); margin-top: 2px; padding-left: 16px; }

.wgrid .hrs-cell {
  height: 56px; text-align: center;
  font-family: var(--font-mono); font-variant-numeric: tabular-nums;
  font-size: var(--t-small); color: var(--ink-1000);
  position: relative; cursor: pointer; transition: background var(--dur-quick);
}
.wgrid .hrs-cell:hover { background: var(--ink-25); }
.wgrid .hrs-cell.empty { color: var(--ink-300); }
.wgrid .hrs-cell.live {
  background: var(--brand-hero-tint);
  color: var(--brand-hero-deep);
  font-weight: 600;
  position: relative;
}
.wgrid .hrs-cell.live::after {
  content: ''; position: absolute; right: 8px; top: 8px;
  width: 6px; height: 6px; border-radius: 50%; background: var(--brand-hero);
  box-shadow: 0 0 0 0 rgba(196,90,58,0.6);
  animation: live-pulse-bright 1.4s ease-out infinite;
}
.wgrid .total-cell { background: var(--ink-25); font-family: var(--font-mono); font-weight: 600; color: var(--ink-1000); text-align: center; }
.wgrid tfoot td { background: var(--ink-50); font-family: var(--font-mono); font-weight: 600; height: 44px; text-align: center; }
.wgrid tfoot td.proj-cell { text-align: left; padding: 12px 16px; font-family: var(--font-sans); }

/* ── Project detail ── */
.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: var(--s-6);
  align-items: flex-start;
}

.burn-card {
  background: var(--surface);
  border: 1px solid var(--ink-200);
  border-radius: var(--r-4);
  padding: var(--s-6);
}
.burn-card .head {
  display: flex; align-items: center;
  font-size: var(--t-tiny); text-transform: uppercase;
  letter-spacing: var(--tracking-wide); color: var(--ink-500); font-weight: 600;
  margin-bottom: 10px;
}
.burn-card .num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 36px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink-1000);
  line-height: 1;
}
.burn-card .of {
  margin-left: var(--s-2);
  font-size: var(--t-h3);
  color: var(--ink-500);
}
.burn-card .bar {
  height: 10px; margin-top: var(--s-4);
  background: var(--ink-100);
  border-radius: 5px;
  overflow: hidden;
  position: relative;
}
.burn-card .bar .fill {
  position: absolute; left: 0; top: 0; bottom: 0;
  background: var(--brand-hero);
  border-radius: 5px;
}
.burn-card .bar .pace {
  position: absolute; top: -3px; bottom: -3px;
  width: 2px; background: var(--ink-500); border-radius: 1px;
}

/* ── Invoice — preview page ── */
.invoice-preview {
  background: #fff;
  border: 1px solid var(--ink-200);
  border-radius: var(--r-3);
  padding: 36px 40px 32px;
  font-size: var(--t-tiny);
  color: var(--ink-1000);
  box-shadow: var(--shadow-3);
  display: flex;
  flex-direction: column;
  gap: var(--s-5);
}
.invoice-preview .head {
  display: flex; justify-content: space-between; align-items: flex-start;
  border-bottom: 1px solid var(--ink-200);
  padding-bottom: var(--s-5);
}
.invoice-preview h2 {
  margin: 0;
  font-size: 28px; font-weight: 600;
  letter-spacing: var(--tracking-tight);
  color: var(--ink-1000);
}
.invoice-preview .meta-grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: var(--s-4);
  font-size: 11px;
}
.invoice-preview .meta-grid .l { color: var(--ink-500); text-transform: uppercase; letter-spacing: var(--tracking-wide); font-size: 10px; font-weight: 600; }
.invoice-preview .meta-grid .v { color: var(--ink-1000); font-weight: 500; margin-top: 2px; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.invoice-preview .lines { width: 100%; border-collapse: collapse; font-size: 11px; }
.invoice-preview .lines th { text-align: left; font-size: 10px; text-transform: uppercase; letter-spacing: var(--tracking-wide); color: var(--ink-500); padding: 6px 0; border-bottom: 1px solid var(--ink-200); font-weight: 600; }
.invoice-preview .lines td { padding: 8px 0; border-bottom: 1px solid var(--ink-100); }
.invoice-preview .lines .num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.invoice-preview .totals { margin-left: auto; width: 220px; font-size: 11px; }
.invoice-preview .totals .row { display: flex; justify-content: space-between; padding: 4px 0; }
.invoice-preview .totals .row.grand { border-top: 2px solid var(--ink-1000); margin-top: 8px; padding-top: 8px; font-weight: 700; font-size: 14px; }
