/* ==========================================================================
   Social Media Calendar — theme layer over Bootstrap 5.3.8
   Mobile first. Every breakpoint below is min-width.
   ========================================================================== */

:root {
  /* Core palette */
  --ink:        #16202c;
  --ink-2:      #3d4c5c;
  --ink-3:      #6b7c8d;
  --paper:      #f4f6f5;
  --surface:    #ffffff;
  --line:       #dfe5e3;

  /* Brand */
  --jade:       #0f5c4e;
  --jade-700:   #0b4539;
  --jade-100:   #e3efeb;
  --amber:      #e0a106;
  --amber-100:  #fdf3dc;
  --coral:      #d6455b;
  --coral-100:  #fce8ea;
  --leaf:       #2e9e7e;
  --leaf-100:   #e2f4ee;
  --slate-100:  #eceff1;

  /* Shape & depth — three levels only, tied to elevation not decoration */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;
  --shadow-1: 0 1px 2px rgba(22, 32, 44, .06);
  --shadow-2: 0 4px 16px rgba(22, 32, 44, .10);

  --rail-w: 244px;
  --tabbar-h: 62px;

  /* Bootstrap variable overrides */
  --bs-body-bg: var(--paper);
  --bs-body-color: var(--ink);
  --bs-body-font-family: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --bs-primary: var(--jade);
  --bs-primary-rgb: 15, 92, 78;
  --bs-link-color: var(--jade);
  --bs-link-hover-color: var(--jade-700);
  --bs-border-color: var(--line);
  --bs-border-radius: var(--r-md);
}

* { -webkit-tap-highlight-color: transparent; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--bs-body-font-family);
  background: var(--paper);
  color: var(--ink);
  font-size: .95rem;
  line-height: 1.55;
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
}

h1, h2, h3, h4, h5, .h-display {
  font-weight: 800;
  letter-spacing: -.02em;
  color: var(--ink);
}

.page-title { font-size: 1.35rem; margin: 0; }
.page-sub   { color: var(--ink-3); font-size: .85rem; margin: .15rem 0 0; }

a { text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible {
  outline: 3px solid var(--jade);
  outline-offset: 2px;
  border-radius: 4px;
}

/* --------------------------------------------------------------------------
   Shell: bottom tab bar on phones, left rail from lg up
   -------------------------------------------------------------------------- */
.app-topbar {
  position: sticky;
  top: 0;
  z-index: 1030;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: .6rem .9rem;
  padding-top: calc(.6rem + env(safe-area-inset-top));
  display: flex;
  align-items: center;
  gap: .75rem;
}

.brand-mark {
  width: 34px; height: 34px;
  border-radius: 9px;
  background: var(--jade);
  color: #fff;
  display: grid; place-items: center;
  font-size: .95rem;
  flex: 0 0 auto;
}

.brand-text { font-weight: 800; font-size: .98rem; letter-spacing: -.02em; line-height: 1.1; }
.brand-text small { display: block; font-weight: 500; font-size: .7rem; color: var(--ink-3); letter-spacing: 0; }

.app-main { padding: 1rem .9rem 1.5rem; }

.app-rail { display: none; }

@media (min-width: 992px) {
  body { padding-bottom: 0; }

  .app-rail {
    display: flex;
    flex-direction: column;
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--rail-w);
    background: var(--ink);
    color: #cfd8dd;
    padding: 1rem .75rem;
    overflow-y: auto;
    z-index: 1040;
  }
  .app-rail .brand-text { color: #fff; }
  .app-rail .brand-text small { color: #8fa3ad; }

  .rail-link {
    display: flex; align-items: center; gap: .7rem;
    padding: .6rem .7rem;
    border-radius: var(--r-sm);
    color: #b9c6cd;
    font-size: .9rem;
    font-weight: 500;
  }
  .rail-link:hover { background: rgba(255,255,255,.07); color: #fff; text-decoration: none; }
  .rail-link.active { background: var(--jade); color: #fff; font-weight: 700; }
  .rail-link i { width: 18px; text-align: center; font-size: .9rem; }
  .rail-group {
    font-size: .68rem; font-weight: 700; color: #6f8089;
    padding: 1rem .7rem .35rem; letter-spacing: .04em;
  }

  .app-topbar { margin-left: var(--rail-w); padding: .85rem 1.5rem; }
  .app-main   { margin-left: var(--rail-w); padding: 1.25rem 1.5rem 3rem; max-width: 1400px; }
  .tabbar     { display: none !important; }
}

/* Bottom tab bar (phones + tablets) */
.tabbar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface);
  border-top: 1px solid var(--line);
  display: flex;
  z-index: 1050;
}
.tabbar a {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 3px;
  color: var(--ink-3);
  font-size: .66rem;
  font-weight: 600;
  padding-top: 6px;
}
.tabbar a:hover { text-decoration: none; }
.tabbar a i { font-size: 1.05rem; }
.tabbar a.active { color: var(--jade); }
.tabbar a.active i { transform: translateY(-1px); }

/* --------------------------------------------------------------------------
   Cards & panels
   -------------------------------------------------------------------------- */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
}
.panel-pad { padding: 1rem; }
@media (min-width: 768px) { .panel-pad { padding: 1.25rem; } }

.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: .75rem;
  padding: .85rem 1rem;
  border-bottom: 1px solid var(--line);
}
.panel-head h2 { font-size: 1rem; margin: 0; }

/* Stat tiles — the number is the hero, the label stays quiet */
.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: .85rem .9rem;
  height: 100%;
}
.stat .val { font-size: 1.6rem; font-weight: 800; letter-spacing: -.03em; line-height: 1.1; }
.stat .lab { font-size: .75rem; color: var(--ink-3); font-weight: 600; margin-top: .2rem; }
.stat .trend { font-size: .72rem; font-weight: 700; }
.stat.accent-jade  { border-left: 3px solid var(--jade); }
.stat.accent-amber { border-left: 3px solid var(--amber); }
.stat.accent-coral { border-left: 3px solid var(--coral); }
.stat.accent-leaf  { border-left: 3px solid var(--leaf); }

/* --------------------------------------------------------------------------
   Month calendar grid
   -------------------------------------------------------------------------- */
.cal-head {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-bottom: 4px;
}
.cal-head div {
  text-align: center;
  font-size: .68rem;
  font-weight: 700;
  color: var(--ink-3);
  padding: .25rem 0;
}
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.cal-cell {
  position: relative;
  min-height: 62px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: .3rem .35rem;
  display: block;
  color: inherit;
  overflow: hidden;
}
.cal-cell:hover { border-color: var(--jade); text-decoration: none; }
.cal-cell.out { background: #f7f9f8; opacity: .55; }
.cal-cell.weekend { background: #fafbfa; }
.cal-cell.today { border-color: var(--jade); border-width: 2px; }
.cal-cell.today .cal-day { background: var(--jade); color: #fff; }
.cal-day {
  font-size: .75rem; font-weight: 700;
  width: 22px; height: 22px;
  display: grid; place-items: center;
  border-radius: 50%;
}
.cal-dots { display: flex; flex-wrap: wrap; gap: 3px; margin-top: .3rem; }
.cal-dot { width: 6px; height: 6px; border-radius: 50%; }
.cal-dot.posted  { background: var(--leaf); }
.cal-dot.planned { background: var(--amber); }
.cal-dot.task    { background: var(--jade); }
.cal-dot.overdue { background: var(--coral); }
.cal-count {
  position: absolute; right: .3rem; top: .3rem;
  font-size: .65rem; font-weight: 700; color: var(--ink-3);
}
.cal-mini { display: none; }

@media (min-width: 768px) {
  .cal-cell { min-height: 108px; padding: .4rem .45rem; }
  .cal-dots { display: none; }
  .cal-mini { display: block; margin-top: .3rem; }
  .cal-mini .chip {
    display: block;
    font-size: .68rem;
    line-height: 1.25;
    padding: 2px 5px;
    border-radius: 4px;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 600;
  }
  .chip.posted  { background: var(--leaf-100);  color: #14614b; }
  .chip.planned { background: var(--amber-100); color: #7d5a02; }
  .chip.task    { background: var(--jade-100);  color: var(--jade-700); }
  .chip.overdue { background: var(--coral-100); color: #96223a; }
}

/* --------------------------------------------------------------------------
   24-hour day rail — the core of the single-day view
   -------------------------------------------------------------------------- */
.day-rail { position: relative; }
.hour-row {
  display: grid;
  grid-template-columns: 52px 1fr;
  border-top: 1px solid var(--line);
  min-height: 52px;
}
.hour-row:last-child { border-bottom: 1px solid var(--line); }
.hour-label {
  font-size: .68rem;
  font-weight: 700;
  color: var(--ink-3);
  padding: .35rem .5rem 0 0;
  text-align: right;
  border-right: 1px solid var(--line);
}
.hour-slot { padding: .3rem .3rem .3rem .6rem; }
.hour-row.is-now { background: linear-gradient(90deg, var(--jade-100), transparent 60%); }
.hour-row.is-now .hour-label { color: var(--jade); }
.hour-row.off-hours .hour-label { opacity: .45; }

.slot-item {
  display: block;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--ink-3);
  border-radius: var(--r-sm);
  padding: .5rem .6rem;
  margin-bottom: .35rem;
  color: inherit;
  box-shadow: var(--shadow-1);
}
.slot-item:hover { text-decoration: none; box-shadow: var(--shadow-2); }
.slot-item.state-past    { border-left-color: var(--leaf); }
.slot-item.state-current { border-left-color: var(--amber); background: #fffdf6; }
.slot-item.state-future  { border-left-color: var(--jade); }
.slot-item.is-task       { border-left-color: var(--jade); background: var(--jade-100); }
.slot-title { font-weight: 700; font-size: .85rem; line-height: 1.3; }
.slot-meta  { font-size: .72rem; color: var(--ink-3); display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .2rem; }

/* Metric pills inside a post row */
.metric-pills { display: flex; gap: .4rem; flex-wrap: wrap; margin-top: .4rem; }
.metric-pill {
  font-size: .7rem; font-weight: 700;
  background: var(--slate-100);
  border-radius: 20px;
  padding: 2px 8px;
  color: var(--ink-2);
}
.metric-pill i { margin-right: 3px; opacity: .7; }

/* --------------------------------------------------------------------------
   Badges: performance grade, status, priority
   -------------------------------------------------------------------------- */
.tag {
  display: inline-flex; align-items: center; gap: .3rem;
  font-size: .7rem; font-weight: 700;
  padding: .18rem .5rem;
  border-radius: 20px;
  white-space: nowrap;
}
.grade-high    { background: var(--leaf-100);  color: #14614b; }
.grade-low     { background: var(--coral-100); color: #96223a; }
.grade-mid     { background: var(--slate-100); color: var(--ink-2); }
.grade-pending { background: var(--amber-100); color: #7d5a02; }
.grade-none    { background: var(--slate-100); color: var(--ink-3); }

.st-done      { background: var(--leaf-100);  color: #14614b; }
.st-overdue   { background: var(--coral-100); color: #96223a; }
.st-progress  { background: var(--amber-100); color: #7d5a02; }
.st-pending   { background: var(--slate-100); color: var(--ink-2); }
.st-cancelled { background: var(--slate-100); color: var(--ink-3); text-decoration: line-through; }

.pr-urgent { background: var(--coral); color: #fff; }
.pr-high   { background: var(--amber); color: #3d2c00; }
.pr-normal { background: var(--slate-100); color: var(--ink-2); }
.pr-low    { background: var(--slate-100); color: var(--ink-3); }

.plat-tag { background: var(--jade-100); color: var(--jade-700); }

/* --------------------------------------------------------------------------
   Forms & buttons
   -------------------------------------------------------------------------- */
.form-label { font-size: .8rem; font-weight: 700; color: var(--ink-2); margin-bottom: .25rem; }
.form-hint  { font-size: .75rem; color: var(--ink-3); margin-top: .25rem; }
.form-control, .form-select {
  border-color: var(--line);
  border-radius: var(--r-sm);
  padding: .55rem .7rem;
  font-size: .92rem;
  /* 16px on mobile stops iOS zooming the viewport on focus */
}
@media (max-width: 575.98px) {
  .form-control, .form-select { font-size: 16px; }
}
.form-control:focus, .form-select:focus {
  border-color: var(--jade);
  box-shadow: 0 0 0 3px rgba(15, 92, 78, .14);
}

.btn { border-radius: var(--r-sm); font-weight: 700; font-size: .88rem; padding: .55rem .9rem; }
.btn-primary { background: var(--jade); border-color: var(--jade); }
.btn-primary:hover, .btn-primary:focus { background: var(--jade-700); border-color: var(--jade-700); }
.btn-outline-primary { color: var(--jade); border-color: var(--jade); }
.btn-outline-primary:hover { background: var(--jade); border-color: var(--jade); }
.btn-quiet {
  background: var(--surface); border: 1px solid var(--line); color: var(--ink-2);
}
.btn-quiet:hover { border-color: var(--ink-3); color: var(--ink); }

/* Floating action button — thumb-reachable on phones */
.fab {
  position: fixed;
  right: 16px;
  bottom: calc(var(--tabbar-h) + 16px + env(safe-area-inset-bottom));
  width: 54px; height: 54px;
  border-radius: 50%;
  background: var(--jade);
  color: #fff;
  display: grid; place-items: center;
  font-size: 1.2rem;
  box-shadow: var(--shadow-2);
  z-index: 1045;
  border: none;
}
.fab:hover { background: var(--jade-700); color: #fff; text-decoration: none; }
@media (min-width: 992px) { .fab { display: none; } }

/* --------------------------------------------------------------------------
   Tables — collapse into stacked rows on phones
   -------------------------------------------------------------------------- */
.table-clean { width: 100%; font-size: .86rem; margin: 0; }
.table-clean th {
  font-size: .72rem;
  font-weight: 700;
  color: var(--ink-3);
  border-bottom: 1px solid var(--line);
  padding: .5rem .6rem;
  white-space: nowrap;
}
.table-clean th a { color: inherit; }
.table-clean td {
  padding: .6rem;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.table-clean tbody tr:last-child td { border-bottom: 0; }
.num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }

@media (max-width: 767.98px) {
  .table-stack thead { display: none; }
  .table-stack tbody tr {
    display: block;
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    margin-bottom: .5rem;
    padding: .6rem .7rem;
    background: var(--surface);
  }
  .table-stack tbody td {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: .25rem 0;
    border: 0;
  }
  .table-stack tbody td::before {
    content: attr(data-label);
    font-size: .72rem;
    font-weight: 700;
    color: var(--ink-3);
    flex: 0 0 auto;
  }
  .table-stack tbody td.cell-main { display: block; }
  .table-stack tbody td.cell-main::before { display: none; }
  .num { text-align: right; }
}

/* --------------------------------------------------------------------------
   Empty states — an invitation, not an apology
   -------------------------------------------------------------------------- */
.empty {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--ink-3);
}
.empty i { font-size: 1.75rem; color: var(--line); display: block; margin-bottom: .6rem; }
.empty p { margin: 0 0 .75rem; font-size: .88rem; }

/* Screenshot thumbnails */
.shot-thumb {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--slate-100);
}
.shot-sm { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }

/* Notification dropdown */
.notif-item { padding: .6rem .8rem; border-bottom: 1px solid var(--line); display: block; color: inherit; }
.notif-item:hover { background: var(--paper); text-decoration: none; }
.notif-item.unread { background: var(--jade-100); }
.notif-item .t { font-weight: 700; font-size: .82rem; }
.notif-item .m { font-size: .78rem; color: var(--ink-3); }
.notif-dot {
  position: absolute; top: 4px; right: 4px;
  min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 8px;
  background: var(--coral); color: #fff;
  font-size: .62rem; font-weight: 700;
  display: grid; place-items: center;
}

/* Segmented control for view switching */
.seg { display: inline-flex; background: var(--slate-100); border-radius: var(--r-sm); padding: 3px; gap: 2px; }
.seg a {
  font-size: .78rem; font-weight: 700; color: var(--ink-2);
  padding: .32rem .7rem; border-radius: 5px;
}
.seg a:hover { text-decoration: none; }
.seg a.active { background: var(--surface); color: var(--jade); box-shadow: var(--shadow-1); }

/* Timeline used on the daily work report */
.tl { position: relative; padding-left: 1.1rem; }
.tl::before {
  content: ''; position: absolute; left: 4px; top: .4rem; bottom: .4rem;
  width: 2px; background: var(--line);
}
.tl-item { position: relative; padding-bottom: .85rem; }
.tl-item::before {
  content: ''; position: absolute; left: -1.1rem; top: .45rem;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--jade);
}

.divider-soft { height: 1px; background: var(--line); margin: 1rem 0; }

.text-muted-2 { color: var(--ink-3) !important; }
.fs-tiny { font-size: .72rem; }
.break-any { overflow-wrap: anywhere; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

@media print {
  .app-rail, .tabbar, .app-topbar, .fab, .no-print { display: none !important; }
  .app-main { margin: 0; padding: 0; }
  .panel { box-shadow: none; border-color: #ccc; }
}
