/* ============================================================
   Northline Ops — Hebei Tunnel Beidou Program
   Refined Western industrial ops aesthetic
   ============================================================ */

:root {
  --ink: #15202b;
  --ink-soft: #3d4f5f;
  --muted: #6b7c8c;
  --line: #d8e0e8;
  --line-strong: #b8c5d1;
  --bg: #e8eef3;
  --bg-deep: #d5dee7;
  --surface: #fbfcfd;
  --surface-raised: #ffffff;
  --accent: #0f4c5c;
  --accent-mid: #176275;
  --accent-soft: #d4e8ee;
  --accent-glow: rgba(15, 76, 92, 0.12);
  --ok: #1f6b4a;
  --ok-bg: #e4f3eb;
  --warn: #9a6b1f;
  --warn-bg: #f8efd9;
  --info: #2a5f8f;
  --info-bg: #e3eef8;
  --danger: #9b3a3a;
  --danger-bg: #f8e4e4;
  --pending: #5a6470;
  --pending-bg: #eef1f4;
  --shadow-sm: 0 1px 2px rgba(21, 32, 43, 0.04), 0 1px 3px rgba(21, 32, 43, 0.06);
  --shadow-md: 0 4px 16px rgba(21, 32, 43, 0.06), 0 1px 3px rgba(21, 32, 43, 0.04);
  --shadow-lg: 0 16px 40px rgba(21, 32, 43, 0.08), 0 4px 12px rgba(21, 32, 43, 0.04);
  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 16px;
  --font-display: "Fraunces", "Georgia", serif;
  --font-ui: "Sora", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
  --nav-w: 248px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html {
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-ui);
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
  line-height: 1.5;
  background-image:
    radial-gradient(ellipse 80% 50% at 10% -10%, rgba(15, 76, 92, 0.07), transparent 55%),
    radial-gradient(ellipse 60% 40% at 100% 0%, rgba(42, 95, 143, 0.05), transparent 50%),
    linear-gradient(180deg, #eef3f7 0%, var(--bg) 40%, #e4ebf1 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  z-index: 9999;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

img {
  max-width: 100%;
  display: block;
}

/* ---------- Layout ---------- */

.app {
  display: grid;
  grid-template-columns: var(--nav-w) 1fr;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 1.75rem 1.15rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
  background: linear-gradient(165deg, #0d3a47 0%, #0f4c5c 48%, #134e5e 100%);
  color: #e8f2f5;
  box-shadow: 4px 0 24px rgba(15, 76, 92, 0.15);
  z-index: 20;
  overflow-y: auto;
}

.brand {
  padding: 0 0.5rem;
  animation: fadeUp 0.7s var(--ease) both;
}

.brand-mark {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.brand-icon {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: linear-gradient(145deg, #2a8a9e, #0f4c5c);
  border: 1px solid rgba(255, 255, 255, 0.18);
  display: grid;
  place-items: center;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.brand-icon svg {
  width: 18px;
  height: 18px;
  stroke: #fff;
  fill: none;
  stroke-width: 1.6;
}

.brand-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.2rem;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.brand-sub {
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(232, 242, 245, 0.55);
  font-weight: 500;
}

.project-chip {
  margin-top: 1rem;
  padding: 0.85rem 0.9rem;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(8px);
}

.project-chip .label {
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(232, 242, 245, 0.45);
  margin-bottom: 0.3rem;
}

.project-chip .title {
  font-size: 0.82rem;
  font-weight: 500;
  line-height: 1.35;
  color: #f0f7f9;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1;
  animation: fadeUp 0.7s var(--ease) 0.08s both;
}

.nav-section {
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(232, 242, 245, 0.4);
  padding: 0.75rem 0.75rem 0.4rem;
  font-weight: 500;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.7rem 0.85rem;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 500;
  color: rgba(232, 242, 245, 0.72);
  transition: background 0.25s var(--ease), color 0.25s var(--ease), transform 0.25s var(--ease);
}

.nav-link svg {
  width: 17px;
  height: 17px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.7;
  opacity: 0.85;
  flex-shrink: 0;
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.nav-link.active {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.sidebar-foot {
  padding: 0.85rem;
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 0.72rem;
  color: rgba(232, 242, 245, 0.55);
  line-height: 1.45;
  animation: fadeUp 0.7s var(--ease) 0.15s both;
}

.sidebar-foot strong {
  display: block;
  color: rgba(232, 242, 245, 0.85);
  font-weight: 500;
  margin-bottom: 0.2rem;
  font-size: 0.78rem;
}

.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 15;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 2rem;
  background: rgba(251, 252, 253, 0.82);
  backdrop-filter: blur(14px) saturate(1.2);
  border-bottom: 1px solid rgba(216, 224, 232, 0.85);
  animation: fadeDown 0.55s var(--ease) both;
}

.topbar-left {
  min-width: 0;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.72rem;
  color: var(--muted);
  margin-bottom: 0.2rem;
}

.breadcrumb span:last-child {
  color: var(--ink-soft);
}

.page-title {
  font-family: var(--font-display);
  font-size: 1.55rem;
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.15;
  color: var(--ink);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-shrink: 0;
}

.meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  background: var(--surface-raised);
  border: 1px solid var(--line);
  font-size: 0.72rem;
  color: var(--ink-soft);
  box-shadow: var(--shadow-sm);
}

.meta-pill .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 3px rgba(31, 107, 74, 0.15);
  animation: pulse 2.4s ease-in-out infinite;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 0.95rem;
  border-radius: 8px;
  border: 1px solid transparent;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.22s var(--ease);
  white-space: nowrap;
}

.btn svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
}

.btn-ghost {
  background: var(--surface-raised);
  border-color: var(--line);
  color: var(--ink-soft);
}

.btn-ghost:hover {
  border-color: var(--line-strong);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

.btn-primary {
  background: linear-gradient(165deg, var(--accent-mid), var(--accent));
  color: #fff;
  box-shadow: 0 2px 8px rgba(15, 76, 92, 0.25);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(15, 76, 92, 0.3);
}

.content {
  padding: 1.5rem 2rem 2.5rem;
  flex: 1;
}

/* ---------- Panels ---------- */

.panel {
  background: var(--surface-raised);
  border: 1px solid rgba(216, 224, 232, 0.9);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.15rem 1.35rem;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #fff 0%, #f8fafb 100%);
}

.panel-head h2 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.panel-head p {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 0.2rem;
}

.panel-body {
  padding: 1.25rem 1.35rem;
}

.panel-body.flush {
  padding: 0;
}

/* ---------- Stats ---------- */

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.35rem;
}

.stat {
  position: relative;
  padding: 1.2rem 1.25rem 1.15rem;
  background: var(--surface-raised);
  border: 1px solid rgba(216, 224, 232, 0.95);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  animation: fadeUp 0.65s var(--ease) both;
}

.stat:nth-child(1) { animation-delay: 0.05s; }
.stat:nth-child(2) { animation-delay: 0.1s; }
.stat:nth-child(3) { animation-delay: 0.15s; }
.stat:nth-child(4) { animation-delay: 0.2s; }

.stat::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--accent);
  border-radius: 0 2px 2px 0;
}

.stat.ok::before { background: var(--ok); }
.stat.warn::before { background: var(--warn); }
.stat.info::before { background: var(--info); }

.stat-label {
  font-size: 0.72rem;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 500;
  margin-bottom: 0.55rem;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 1.85rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--ink);
}

.stat-value .unit {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--muted);
  margin-left: 0.25rem;
  letter-spacing: 0;
}

.stat-foot {
  margin-top: 0.65rem;
  font-size: 0.75rem;
  color: var(--ink-soft);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.stat-foot .delta {
  color: var(--ok);
  font-weight: 500;
}

.stat-foot .delta.down {
  color: var(--warn);
}

/* ---------- Grid layouts ---------- */

.grid-2 {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 1.15rem;
  margin-bottom: 1.15rem;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.15rem;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}

/* ---------- Progress bars ---------- */

.bar-row {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.bar-item {
  display: grid;
  grid-template-columns: 110px 1fr auto;
  gap: 0.75rem;
  align-items: center;
}

.bar-item .name {
  font-size: 0.8rem;
  color: var(--ink-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bar-track {
  height: 7px;
  background: var(--bg-deep);
  border-radius: 99px;
  overflow: hidden;
  position: relative;
}

.bar-fill {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--accent), #2a8a9e);
  width: 0;
  transition: width 1.1s var(--ease);
}

.bar-fill.ok { background: linear-gradient(90deg, #1f6b4a, #3a9a6e); }
.bar-fill.warn { background: linear-gradient(90deg, #9a6b1f, #c4923a); }
.bar-fill.info { background: linear-gradient(90deg, #2a5f8f, #4a85b5); }

.bar-pct {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--muted);
  min-width: 36px;
  text-align: right;
}

/* ---------- Batch cards (dashboard) ---------- */

.batch-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.batch-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 1rem;
  align-items: center;
  padding: 0.95rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: linear-gradient(135deg, #fff 0%, #f7fafb 100%);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.batch-card:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-sm);
}

.batch-num {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
  background: var(--accent-soft);
  color: var(--accent);
}

.batch-info h3 {
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 0.15rem;
}

.batch-info p {
  font-size: 0.74rem;
  color: var(--muted);
}

.batch-meta {
  text-align: right;
}

/* ---------- Status badges ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.22rem 0.55rem;
  border-radius: 5px;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.badge::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.7;
}

.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-pending { background: var(--pending-bg); color: var(--pending); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }

/* ---------- Tables ---------- */

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  margin-bottom: 1.15rem;
  animation: fadeUp 0.55s var(--ease) both;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.search {
  position: relative;
}

.search input {
  width: 220px;
  padding: 0.55rem 0.85rem 0.55rem 2.1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-raised);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search input:focus {
  border-color: var(--accent-mid);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.search svg {
  position: absolute;
  left: 0.7rem;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  stroke: var(--muted);
  fill: none;
  stroke-width: 1.8;
  pointer-events: none;
}

.select {
  padding: 0.55rem 2rem 0.55rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-raised) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7c8c' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 0.7rem center;
  appearance: none;
  outline: none;
  cursor: pointer;
}

.select:focus {
  border-color: var(--accent-mid);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

table.data thead th {
  text-align: left;
  padding: 0.75rem 1rem;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  background: #f4f7f9;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  position: sticky;
  top: 0;
}

table.data tbody td {
  padding: 0.9rem 1rem;
  border-bottom: 1px solid #eef2f5;
  vertical-align: middle;
  color: var(--ink-soft);
}

table.data tbody tr {
  transition: background 0.15s;
}

table.data tbody tr:hover {
  background: #f6fafb;
}

table.data tbody tr:last-child td {
  border-bottom: none;
}

.cell-strong {
  color: var(--ink);
  font-weight: 500;
}

.cell-mono {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: -0.01em;
}

.cell-muted {
  color: var(--muted);
  font-size: 0.78rem;
}

.track-link {
  color: var(--accent-mid);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  border-bottom: 1px dashed rgba(23, 98, 117, 0.35);
  transition: color 0.15s, border-color 0.15s;
}

.track-link:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.qty {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  color: var(--ink);
}

/* ---------- Tunnel progress grid ---------- */

.tunnel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.9rem;
}

.tunnel-card {
  padding: 1.1rem 1.15rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-raised);
  transition: border-color 0.2s, box-shadow 0.25s, transform 0.25s;
  animation: fadeUp 0.55s var(--ease) both;
}

.tunnel-card:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.tunnel-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.tunnel-name {
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--ink);
}

.tunnel-code {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--muted);
  margin-top: 0.15rem;
}

.tunnel-progress {
  margin: 0.85rem 0 0.65rem;
}

.tunnel-progress .labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.tunnel-progress .labels strong {
  color: var(--ink);
  font-weight: 500;
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

.tunnel-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 0.7rem;
  border-top: 1px solid #eef2f5;
  font-size: 0.72rem;
  color: var(--muted);
}

.avatar-sm {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: linear-gradient(145deg, #2a8a9e, #0f4c5c);
  color: #fff;
  font-size: 0.58rem;
  font-weight: 600;
  display: inline-grid;
  place-items: center;
  margin-right: 0.35rem;
}

/* ---------- Timeline / activity ---------- */

.activity {
  list-style: none;
  display: flex;
  flex-direction: column;
}

.activity li {
  display: grid;
  grid-template-columns: 16px 1fr;
  gap: 0.85rem;
  padding-bottom: 1.1rem;
  position: relative;
}

.activity li:last-child {
  padding-bottom: 0;
}

.activity li::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 14px;
  bottom: 0;
  width: 1px;
  background: var(--line);
}

.activity li:last-child::before {
  display: none;
}

.activity .node {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--surface-raised);
  border: 2px solid var(--accent);
  margin-top: 2px;
  z-index: 1;
}

.activity .node.ok { border-color: var(--ok); }
.activity .node.warn { border-color: var(--warn); }
.activity .node.info { border-color: var(--info); }

.activity .when {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--muted);
  margin-bottom: 0.15rem;
}

.activity .what {
  font-size: 0.82rem;
  color: var(--ink);
  line-height: 1.4;
}

.activity .who {
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 0.2rem;
}

/* ---------- Log strip (audit hint) ---------- */

.audit-strip {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.7rem 1rem;
  margin-bottom: 1.15rem;
  border-radius: var(--radius);
  background: linear-gradient(90deg, rgba(15, 76, 92, 0.06), rgba(42, 95, 143, 0.04));
  border: 1px solid rgba(15, 76, 92, 0.1);
  font-size: 0.76rem;
  color: var(--ink-soft);
  animation: fadeUp 0.5s var(--ease) both;
}

.audit-strip svg {
  width: 16px;
  height: 16px;
  stroke: var(--accent);
  fill: none;
  stroke-width: 1.7;
  flex-shrink: 0;
}

.audit-strip em {
  font-style: normal;
  color: var(--accent);
  font-weight: 500;
}

/* ---------- Mini chart (CSS bars) ---------- */

.mini-chart {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 88px;
  padding-top: 0.5rem;
}

.mini-chart .col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  height: 100%;
  justify-content: flex-end;
}

.mini-chart .col-bar {
  width: 100%;
  max-width: 28px;
  border-radius: 4px 4px 2px 2px;
  background: linear-gradient(180deg, #2a8a9e, var(--accent));
  opacity: 0.85;
  transition: opacity 0.2s, height 0.9s var(--ease);
  min-height: 4px;
}

.mini-chart .col:hover .col-bar {
  opacity: 1;
}

.mini-chart .col-label {
  font-size: 0.62rem;
  color: var(--muted);
  white-space: nowrap;
}

/* ---------- Split overview ring ---------- */

.ring-wrap {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.ring {
  --p: 72;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: conic-gradient(var(--accent) calc(var(--p) * 1%), var(--bg-deep) 0);
  display: grid;
  place-items: center;
  position: relative;
  flex-shrink: 0;
}

.ring::before {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: 50%;
  background: var(--surface-raised);
}

.ring-value {
  position: relative;
  z-index: 1;
  text-align: center;
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1;
}

.ring-value small {
  display: block;
  font-family: var(--font-ui);
  font-size: 0.65rem;
  font-weight: 500;
  color: var(--muted);
  margin-top: 0.25rem;
  letter-spacing: 0;
}

.legend {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  font-size: 0.78rem;
  color: var(--ink-soft);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: var(--accent);
}

.legend-swatch.muted {
  background: var(--bg-deep);
}

/* ---------- Daily log table extras ---------- */

.phase-steps {
  display: flex;
  gap: 3px;
}

.phase-step {
  flex: 1;
  height: 5px;
  border-radius: 2px;
  background: var(--bg-deep);
}

.phase-step.done {
  background: var(--ok);
}

.phase-step.current {
  background: var(--accent-mid);
}

/* ---------- Footer note ---------- */

.page-note {
  margin-top: 1.5rem;
  padding: 1rem 1.15rem;
  border-radius: var(--radius);
  border: 1px dashed var(--line-strong);
  background: rgba(255, 255, 255, 0.5);
  font-size: 0.76rem;
  color: var(--muted);
  line-height: 1.55;
}

.page-note strong {
  color: var(--ink-soft);
  font-weight: 500;
}

/* ---------- Mobile ---------- */

.menu-toggle {
  display: none;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-raised);
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.menu-toggle svg {
  width: 18px;
  height: 18px;
  stroke: var(--ink);
  fill: none;
  stroke-width: 1.8;
}

.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(21, 32, 43, 0.4);
  z-index: 25;
  opacity: 0;
  transition: opacity 0.25s;
}

.overlay.show {
  display: block;
  opacity: 1;
}

@media (max-width: 1100px) {
  .stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  .app {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: min(280px, 86vw);
    transform: translateX(-105%);
    transition: transform 0.3s var(--ease);
    z-index: 30;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .menu-toggle {
    display: inline-flex;
  }

  .topbar,
  .content {
    padding-left: 1.15rem;
    padding-right: 1.15rem;
  }

  .page-title {
    font-size: 1.25rem;
  }

  .topbar-right .btn span,
  .meta-pill.desktop-only {
    display: none;
  }

  .search input {
    width: 160px;
  }

  .bar-item {
    grid-template-columns: 80px 1fr auto;
  }
}

@media (max-width: 520px) {
  .stats {
    grid-template-columns: 1fr;
  }

  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .filters {
    width: 100%;
  }

  .search,
  .search input,
  .select {
    width: 100%;
  }
}

/* ---------- Animations ---------- */

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeDown {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(31, 107, 74, 0.15); }
  50% { box-shadow: 0 0 0 5px rgba(31, 107, 74, 0.08); }
}

.reveal {
  animation: fadeUp 0.6s var(--ease) both;
}

.reveal-d1 { animation-delay: 0.06s; }
.reveal-d2 { animation-delay: 0.12s; }
.reveal-d3 { animation-delay: 0.18s; }
