/* ===== Daily Expense Tracker app styles =====
   Layered on top of ../../styles.css — reuses its :root tokens, .btn family,
   .rail-kpi / .rail-delta patterns, .chart-legend and .swatch. Everything
   app-specific is prefixed .tk- (or .app- for the header). */

.tk-body {
  background: var(--brand-bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.tk-container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 20px;
  width: 100%;
}

/* ===== App header =====
   A lifted navy gradient (not flat navy-deep) with a gold hairline, so the
   gold badge + two-tone wordmark read clearly instead of vanishing. */
.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background:
    radial-gradient(90% 180% at 0% 0%, rgba(201, 163, 90, 0.16), transparent 60%),
    linear-gradient(100deg, var(--navy) 0%, var(--navy-deep) 70%);
  border-bottom: 1px solid transparent;
  border-image: linear-gradient(90deg,
    rgba(201, 163, 90, 0.15), rgba(232, 207, 154, 0.85) 50%, rgba(201, 163, 90, 0.15)) 1;
}
.app-header-inner {
  display: flex;
  align-items: center;
  gap: 13px;
  padding-top: 10px;
  padding-bottom: 10px;
}
.app-logo {
  display: inline-flex;
  align-items: center;
  gap: 9px;
}
.app-logo img {
  height: 30px;
  width: auto;
  display: block;
  filter: drop-shadow(0 0 9px rgba(232, 207, 154, 0.45));
}
.app-logo-word {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1rem;
  letter-spacing: 0.01em;
  color: #f4f1e8;
  white-space: nowrap;
}
.app-logo-word em {
  font-style: normal;
  background: linear-gradient(120deg, var(--gold-light), var(--gold));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.app-divider {
  width: 1px;
  height: 20px;
  background: rgba(232, 207, 154, 0.3);
}
.app-title {
  color: #cdd6e2;
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: -0.01em;
}
.app-actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
}
.app-export {
  color: var(--gold-light);
  border-color: rgba(232, 207, 154, 0.55);
}
.app-export:hover {
  background: rgba(232, 207, 154, 0.12);
}
.app-export svg { width: 13px; height: 13px; }
.app-export.is-busy { opacity: 0.55; cursor: progress; }

/* ===== Banners ===== */
.tk-banner {
  background: #f6edd7;
  color: #6b5a2c;
  border-bottom: 1px solid var(--gold);
  text-align: center;
  font-size: 0.8rem;
  padding: 8px 16px;
}
.tk-banner--error {
  background: #fbe4e1;
  color: #8c2f24;
  border-bottom-color: #d68078;
}

/* ===== Main layout ===== */
.tk-main {
  flex: 1 1 auto;
  padding-top: 24px;
  padding-bottom: 48px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ===== Toolbar ===== */
.tk-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.tk-select,
.tk-search {
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--brand-ink);
  background: var(--brand-card);
  border: 1px solid var(--brand-border);
  border-radius: 10px;
  padding: 9px 12px;
}
.tk-search { flex: 1 1 220px; max-width: 340px; }
.tk-select:focus,
.tk-search:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201, 163, 90, 0.25);
}
.tk-count {
  font-size: 0.8rem;
  color: var(--brand-muted);
}
.tk-link-btn {
  background: none;
  border: none;
  padding: 0;
  font-family: var(--font-body);
  font-size: 0.8rem;
  color: var(--gold-dark);
  text-decoration: underline;
  cursor: pointer;
}
.tk-link-btn:hover { color: var(--navy); }
.tk-danger { color: #b3311f; }
.tk-danger:hover { color: #8c2f24; }

/* ===== KPI row ===== */
.tk-kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
.tk-kpi-card {
  background: var(--brand-card);
  border: 1px solid var(--brand-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}
.tk-kpi-sm { font-size: 1.15rem; }
.tk-kpi-sub {
  font-size: 0.78rem;
  color: var(--brand-muted);
}
.tk-topcat-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.tk-icon-btn {
  background: none;
  border: none;
  padding: 2px;
  cursor: pointer;
  color: var(--brand-muted);
  display: inline-flex;
}
.tk-icon-btn:hover { color: var(--gold-dark); }
.tk-icon-btn svg { width: 13px; height: 13px; }

/* Budget meter */
.tk-meter {
  margin-top: 10px;
  height: 8px;
  border-radius: 999px;
  background: #eee9dd;
  overflow: hidden;
}
.tk-meter-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--gold-dark), var(--gold), var(--gold-light));
  transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1), background 0.3s ease;
}
.tk-meter-fill.tk-meter-over {
  background: linear-gradient(90deg, #c0392b, #e34948);
}
.tk-budget-form {
  margin-top: 10px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.tk-budget-form input {
  flex: 1 1 90px;
  min-width: 0;
  font-family: var(--font-body);
  font-size: 0.85rem;
  border: 1px solid var(--brand-border);
  border-radius: 8px;
  padding: 7px 10px;
}
.tk-budget-form input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201, 163, 90, 0.25);
}

/* ===== Charts ===== */
.tk-charts {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: 16px;
}
.tk-chart-card {
  background: var(--brand-card);
  border: 1px solid var(--brand-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  min-width: 0;
}
.tk-chart-card--wide { grid-column: 1 / -1; }
.tk-chart-title {
  font-size: 0.95rem;
  margin-bottom: 14px;
  color: var(--brand-ink);
}
.tk-donut-wrap {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}
.tk-donut {
  width: 170px;
  height: 170px;
  flex-shrink: 0;
  overflow: visible;
}
.tk-legend { flex: 1 1 150px; }
.tk-bars,
.tk-trend {
  width: 100%;
  height: auto;
  overflow: visible;
  display: block;
}

/* Chart marks (visuals mirror the landing carousel's, but animations here
   are gated on .is-drawn added by tracker.js, not on carousel classes). */
.tk-donut-seg {
  cursor: pointer;
  transform-origin: 100px 100px;
  opacity: 0;
  transform: scale(0.85);
  transition: opacity 0.4s ease, transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1), stroke-width 0.2s ease;
}
.is-drawn .tk-donut-seg { opacity: 1; transform: scale(1); }
.tk-donut-seg:hover, .tk-donut-seg:focus-visible { stroke-width: 30; outline: none; }
.tk-donut-total {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 19px;
  fill: var(--brand-ink);
}
.tk-donut-total-label {
  font-family: var(--font-body);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  fill: var(--brand-muted);
}

.tk-grid-line { stroke: #eceae0; stroke-width: 1; }
.tk-axis-label {
  font-family: var(--font-body);
  font-size: 10px;
  fill: var(--brand-muted);
}
.tk-bar {
  fill: #2a78d6;
  cursor: pointer;
  transform-box: fill-box;
  transform-origin: bottom;
  transform: scaleY(0);
  transition: transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.2s ease;
}
.tk-bar--today { fill: var(--gold); }
.is-drawn .tk-bar { transform: scaleY(1); }
.tk-bar:hover { opacity: 0.8; }

.tk-trend-area {
  fill: #2a78d6;
  opacity: 0;
  transition: opacity 0.5s ease 0.4s;
}
.is-drawn .tk-trend-area { opacity: 0.1; }
.tk-trend-stroke {
  fill: none;
  stroke: #2a78d6;
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  transition: stroke-dashoffset 0.8s cubic-bezier(0.65, 0, 0.35, 1);
}
.is-drawn .tk-trend-stroke { stroke-dashoffset: 0; }
.tk-trend-dot {
  fill: #2a78d6;
  stroke: var(--brand-card);
  stroke-width: 2;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.3s ease 0.5s;
}
.is-drawn .tk-trend-dot { opacity: 1; }
.tk-trend-label {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 11px;
  fill: var(--brand-ink);
}
.tk-budget-line {
  stroke: var(--gold-dark);
  stroke-width: 1.5;
  stroke-dasharray: 6 4;
}
.tk-chart-empty {
  font-family: var(--font-body);
  font-size: 11px;
  fill: var(--brand-muted);
}

@media (prefers-reduced-motion: reduce) {
  .tk-donut-seg, .tk-bar, .tk-trend-stroke, .tk-trend-area, .tk-trend-dot, .tk-meter-fill {
    transition: none !important;
  }
}

/* ===== Add-expense form ===== */
.tk-form-card {
  background: var(--brand-card);
  border: 1px solid var(--brand-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}
.tk-entry-form {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-end;
}
.tk-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 0 1 auto;
}
.tk-field--grow { flex: 1 1 180px; }
.tk-field--submit {
  flex-direction: row;
  gap: 8px;
}
.tk-field label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--brand-muted);
}
.tk-opt { font-weight: 400; }
.tk-field input,
.tk-field select {
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--brand-ink);
  background: var(--brand-card);
  border: 1px solid var(--brand-border);
  border-radius: 10px;
  padding: 9px 12px;
  min-width: 0;
  width: 100%;
}
.tk-field input:focus,
.tk-field select:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201, 163, 90, 0.25);
}
#f-date { width: 150px; }
#f-amount { width: 120px; }
#f-category, #f-method { width: auto; }

/* ===== Entries table ===== */
.tk-table-card {
  background: var(--brand-card);
  border: 1px solid var(--brand-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.tk-table-scroll {
  max-height: 480px;
  overflow-y: auto;
  overflow-x: auto;
}
.tk-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.83rem;
}
.tk-table th {
  position: sticky;
  top: 0;
  background: var(--navy-deep);
  color: var(--gold-light);
  text-align: left;
  font-weight: 600;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 10px 14px;
  z-index: 1;
}
.tk-table td {
  padding: 9px 14px;
  border-bottom: 1px solid var(--brand-border);
  color: var(--brand-ink);
  vertical-align: middle;
}
.tk-table tr:hover td { background: #faf8f2; }
.tk-num { text-align: right; }
td.tk-num {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  white-space: nowrap;
}
.tk-cat-cell {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}
.tk-desc-cell {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tk-muted { color: var(--brand-muted); }
.tk-actions-col { width: 90px; }
.tk-row-actions {
  display: flex;
  gap: 4px;
  justify-content: flex-end;
}
.tk-row-btn {
  background: none;
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 4px 6px;
  cursor: pointer;
  color: var(--brand-muted);
  display: inline-flex;
}
.tk-row-btn:hover {
  color: var(--navy);
  border-color: var(--brand-border);
  background: #f3efe5;
}
.tk-row-btn--del:hover { color: #b3311f; }
.tk-row-btn svg { width: 14px; height: 14px; }
.tk-sample-flag {
  font-size: 0.62rem;
  color: var(--gold-dark);
  background: #f6eeda;
  border-radius: 999px;
  padding: 1px 7px;
  margin-left: 6px;
  vertical-align: 1px;
}
.tk-table-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  border-top: 1px solid var(--brand-border);
  background: #faf8f2;
  font-size: 0.83rem;
  color: var(--brand-muted);
}
.tk-table-foot strong {
  color: var(--brand-ink);
  font-variant-numeric: tabular-nums;
}
.tk-empty-row td {
  text-align: center;
  color: var(--brand-muted);
  padding: 28px 14px;
}

/* ===== Empty state ===== */
.tk-empty {
  background: var(--brand-card);
  border: 1px dashed var(--brand-border);
  border-radius: var(--radius);
  text-align: center;
  padding: 40px 24px;
}
.tk-empty-icon { font-size: 2rem; margin-bottom: 8px; }
.tk-empty h2 { font-size: 1.1rem; }
.tk-empty p {
  color: var(--brand-muted);
  font-size: 0.9rem;
  max-width: 46ch;
  margin: 0 auto 18px;
}

/* ===== Footer ===== */
.tk-footer {
  background: var(--navy-deep);
  color: #93a1b4;
  font-size: 0.78rem;
  padding: 18px 0;
  margin-top: auto;
}
.tk-footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.tk-footer p { margin: 0; }
.tk-footer-links {
  display: flex;
  align-items: center;
  gap: 16px;
}
.tk-footer a { color: var(--gold-light); text-decoration: none; }
.tk-footer a:hover { text-decoration: underline; }

/* ===== Tabs ===== */
.tk-tabs {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  background: var(--brand-card);
  border: 1px solid var(--brand-border);
  border-radius: 12px;
  box-shadow: var(--shadow);
}
.tk-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--brand-muted);
  background: none;
  border: none;
  border-radius: 9px;
  padding: 9px 16px;
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease;
}
.tk-tab svg { width: 15px; height: 15px; }
.tk-tab:hover { color: var(--brand-ink); }
.tk-tab.is-active {
  color: var(--navy-deep);
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
  box-shadow: 0 4px 12px rgba(201, 163, 90, 0.3);
}
.tk-panel { margin-top: 4px; }
.tk-panel > * + * { margin-top: 20px; }

/* ===== Insights view ===== */
#insights-body > * + * { margin-top: 22px; }
.tk-ins-section { }
.tk-ins-heading {
  font-size: 0.78rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--gold-dark);
  margin-bottom: 12px;
}

/* Verdict hero */
.tk-verdict {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 26px;
  padding: 26px 30px;
  border-radius: 20px;
  background:
    radial-gradient(120% 140% at 100% 0%, rgba(201, 163, 90, 0.22), transparent 55%),
    linear-gradient(135deg, var(--navy) 0%, var(--navy-deep) 100%);
  box-shadow: var(--shadow-lift);
}
.tk-verdict::after {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: var(--v-tone, var(--gold));
}
.tk-verdict--good { --v-tone: #1a9d6e; }
.tk-verdict--caution { --v-tone: #d8a53c; }
.tk-verdict--bad { --v-tone: #e0574a; }
.tk-verdict--neutral { --v-tone: #4d94e6; }
.tk-verdict-gauge { flex-shrink: 0; }
.tk-gauge { width: 118px; height: 118px; }
.tk-gauge-val {
  transform-origin: 66px 66px;
  opacity: 0;
  transform: rotate(-20deg);
  animation: tk-gauge-in 0.9s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
@keyframes tk-gauge-in { to { opacity: 1; transform: rotate(0); } }
.tk-gauge-num {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 30px;
  fill: #f4f1e8;
}
.tk-gauge-lbl {
  font-family: var(--font-body);
  font-size: 9px;
  letter-spacing: 0.14em;
  fill: var(--gold-light);
}
.tk-verdict-text { min-width: 0; }
.tk-verdict-badge {
  display: inline-block;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--navy-deep);
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
  padding: 3px 11px;
  border-radius: 999px;
  margin-bottom: 10px;
}
.tk-verdict-text h2 {
  color: #f7f4ec;
  font-size: 1.4rem;
  line-height: 1.2;
  margin-bottom: 8px;
}
.tk-verdict-text p {
  color: #c3cdd9;
  font-size: 0.92rem;
  line-height: 1.55;
  margin: 0;
}

/* Trajectory */
.tk-traj {
  background: var(--brand-card);
  border: 1px solid var(--brand-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}
.tk-traj-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  margin-bottom: 16px;
}
.tk-traj-stat { display: flex; flex-direction: column; gap: 3px; }
.tk-traj-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--brand-muted);
}
.tk-traj-stat strong {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  color: var(--brand-ink);
}
.tk-traj-proj--good { color: #1a9d6e; }
.tk-traj-proj--caution { color: #bd8a2c; }
.tk-traj-proj--bad { color: var(--brand-danger, #c0392b); }
.tk-traj-proj--neutral { color: #2a78d6; }
.tk-traj-bar {
  position: relative;
  height: 16px;
  border-radius: 999px;
  background: #eef0ea;
  overflow: hidden;
}
.tk-traj-fill {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  border-radius: 999px;
  transition: width 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}
.tk-traj-fill--proj { opacity: 0.4; }
.tk-traj-fill--proj.tk-traj-fill--good { background: #1a9d6e; }
.tk-traj-fill--proj.tk-traj-fill--caution { background: #bd8a2c; }
.tk-traj-fill--proj.tk-traj-fill--bad { background: #c0392b; }
.tk-traj-fill--proj.tk-traj-fill--neutral { background: #2a78d6; }
.tk-traj-fill--spent { background: linear-gradient(90deg, var(--gold-dark), var(--gold)); }
.tk-traj-budget {
  position: absolute;
  top: -3px; bottom: -3px;
  width: 2px;
  background: var(--navy-deep);
  transform: translateX(-1px);
}
.tk-traj-budget::after {
  content: "";
  position: absolute;
  top: -3px; left: 50%;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--navy-deep);
  transform: translateX(-50%);
}
.tk-traj-legend {
  display: flex;
  gap: 16px;
  margin-top: 12px;
  font-size: 0.76rem;
  color: var(--brand-muted);
}
.tk-traj-legend span { display: inline-flex; align-items: center; gap: 6px; }
.tk-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.tk-dot--spent { background: var(--gold); }
.tk-dot--proj { background: #9db4cc; }
.tk-dot--budget { background: var(--navy-deep); }

/* Focus cards */
.tk-focus-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px;
}
.tk-focus-card {
  position: relative;
  background: var(--brand-card);
  border: 1px solid var(--brand-border);
  border-left: 4px solid var(--c, var(--gold));
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}
.tk-focus-top { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.tk-focus-name { font-weight: 700; font-size: 0.9rem; color: var(--brand-ink); }
.tk-focus-tag {
  margin-left: auto;
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #bd8a2c;
  background: rgba(201, 163, 90, 0.16);
  padding: 2px 8px;
  border-radius: 999px;
}
.tk-focus-share {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 2rem;
  line-height: 1;
  color: var(--c, var(--gold-dark));
}
.tk-focus-amt { font-size: 0.85rem; color: var(--brand-muted); margin-top: 2px; }
.tk-focus-note { font-size: 0.82rem; color: var(--brand-ink); margin-top: 10px; line-height: 1.5; }

/* Tips — icon and title share a centered row; the body indents to line up
   with the title rather than running back under the icon. */
.tk-tips { display: grid; gap: 12px; }
.tk-tip {
  --tk-tip-icon: 36px;
  --tk-tip-gap: 12px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  background: var(--brand-card);
  border: 1px solid var(--brand-border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 16px 18px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.tk-tip:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.tk-tip-head {
  display: flex;
  align-items: center;
  gap: var(--tk-tip-gap);
}
.tk-tip-icon {
  flex-shrink: 0;
  width: var(--tk-tip-icon);
  height: var(--tk-tip-icon);
  display: grid;
  place-items: center;
  border-radius: 11px;
  color: var(--tc, var(--gold-dark));
  background: color-mix(in srgb, var(--tc, var(--gold)) 12%, transparent);
}
.tk-tip-icon svg { width: 18px; height: 18px; }
.tk-tip-head h4 {
  font-size: 0.92rem;
  color: var(--brand-ink);
  margin: 0;
  line-height: 1.3;
}
.tk-tip-text {
  font-size: 0.85rem;
  color: var(--brand-muted);
  line-height: 1.55;
  margin: 0 0 0 calc(var(--tk-tip-icon) + var(--tk-tip-gap));
}

/* ===== Calendar heatmap ===== */
#calendar-body > * + * { margin-top: 18px; }
.tk-cal-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.tk-cal-head .tk-ins-heading { margin-bottom: 0; }
.tk-cal-legend {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  color: var(--brand-muted);
}
.tk-heat {
  width: 13px;
  height: 13px;
  border-radius: 4px;
  display: inline-block;
}
/* Sequential gold ramp — reads as intensity without colliding with the
   categorical chart palette. */
.tk-heat-0 { background: #f1efe8; }
.tk-heat-1 { background: #f7ecd2; }
.tk-heat-2 { background: #f0dcaa; }
.tk-heat-3 { background: #e5c47c; }
.tk-heat-4 { background: #d3a95c; }
.tk-heat-5 { background: #b98c3f; }

.tk-cal-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}
.tk-cal-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--brand-card);
  border: 1px solid var(--brand-border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 13px 15px;
}
.tk-cal-stat-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--brand-muted);
}
.tk-cal-stat strong {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  color: var(--brand-ink);
}
.tk-cal-stat-sub { font-size: 0.72rem; color: var(--brand-muted); }

.tk-cal-grid {
  position: relative; /* anchors the day popover's absolute positioning */
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 7px;
  background: var(--brand-card);
  border: 1px solid var(--brand-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}
.tk-cal-dow {
  text-align: center;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--brand-muted);
  padding-bottom: 4px;
}
.tk-cal-blank { aspect-ratio: 1; }
.tk-cal-day {
  position: relative;
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  gap: 2px;
  /* grid items default to min-width:auto, which lets the amount text push the
     whole grid wider than its container on narrow screens */
  min-width: 0;
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: 9px;
  padding: 6px 7px;
  cursor: pointer;
  font-family: var(--font-body);
  color: var(--brand-ink);
  opacity: 0;
  transform: scale(0.9);
  transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
    box-shadow 0.18s ease, border-color 0.18s ease;
}
.tk-cal-grid.is-drawn .tk-cal-day {
  opacity: 1;
  transform: scale(1);
  transition-delay: calc(var(--i) * 6ms);
}
.tk-cal-day:hover {
  border-color: var(--gold-dark);
  box-shadow: 0 4px 12px rgba(11, 26, 44, 0.14);
}
.tk-cal-day:focus-visible {
  outline: 2px solid var(--gold-dark);
  outline-offset: 2px;
}
.tk-cal-day.is-today { border-color: var(--navy); }
.tk-cal-day.is-today .tk-cal-num { font-weight: 800; }
.tk-cal-day.is-selected {
  border-color: var(--navy-deep);
  box-shadow: 0 0 0 2px var(--navy-deep), 0 6px 16px rgba(11, 26, 44, 0.2);
}
.tk-cal-num { font-size: 0.72rem; line-height: 1; opacity: 0.75; }
.tk-cal-amt {
  font-size: 0.74rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
}

/* Day popover — appears anchored to the clicked cell instead of a fixed
   panel, so the detail shows up right where you clicked. */
.tk-cal-pop {
  position: absolute;
  z-index: 30;
  width: 250px;
  max-width: calc(100% - 12px);
  background: var(--brand-card);
  border: 1px solid var(--brand-border);
  border-radius: 12px;
  box-shadow: var(--shadow-lift);
  padding: 12px 14px;
  animation: tk-pop 0.16s cubic-bezier(0.22, 1, 0.36, 1);
}
.tk-cal-pop-arrow {
  position: absolute;
  width: 10px;
  height: 10px;
  left: 50%;
  background: var(--brand-card);
  border: 1px solid var(--brand-border);
  border-right: none;
  border-top: none;
  transform: translateX(-50%) rotate(-45deg);
  bottom: -6px;
}
.tk-cal-pop.is-below .tk-cal-pop-arrow {
  top: -6px;
  bottom: auto;
  border: 1px solid var(--brand-border);
  border-right: none;
  border-top: none;
  transform: translateX(-50%) rotate(135deg);
}
.tk-cal-pop-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 8px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--brand-border);
}
.tk-cal-pop-date { font-size: 0.85rem; font-weight: 700; color: var(--brand-ink); }
.tk-cal-pop-total {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  color: var(--brand-ink);
  margin-left: auto;
}
.tk-cal-pop-close {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: none;
  color: var(--brand-muted);
  cursor: pointer;
}
.tk-cal-pop-close:hover { background: #f3efe5; color: var(--brand-ink); }
.tk-cal-pop-close svg { width: 13px; height: 13px; }
.tk-cal-pop .tk-cal-list {
  max-height: 240px;
  overflow-y: auto;
  overflow-x: hidden;
}
/* The list's cat/desc/amount layout was sized for the old full-width bottom
   panel; squeezed into the 250px popover, long category names (e.g. "Bills &
   Utilities") pushed the row past the edge. Tighten it here specifically. */
.tk-cal-pop .tk-cal-list li {
  gap: 6px;
  padding: 7px 0;
  font-size: 0.78rem;
}
.tk-cal-pop .tk-cal-list-cat {
  max-width: 36%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tk-cal-hint { font-size: 0.85rem; color: var(--brand-muted); margin: 0; }
.tk-cal-list { list-style: none; margin: 0; padding: 0; }
.tk-cal-list li {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 0;
  border-bottom: 1px solid var(--brand-border);
  font-size: 0.85rem;
}
.tk-cal-list li:last-child { border-bottom: none; }
.tk-cal-list-cat { font-weight: 600; color: var(--brand-ink); white-space: nowrap; }
.tk-cal-list-desc {
  color: var(--brand-muted);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tk-cal-list strong { color: var(--brand-ink); white-space: nowrap; }

@media (prefers-reduced-motion: reduce) {
  .tk-cal-day { opacity: 1; transform: none; transition: none; }
  .tk-cal-grid.is-drawn .tk-cal-day { transition-delay: 0ms; }
  .tk-cal-pop { animation: none; }
}

/* ===== Feedback tab ===== */
#panel-feedback > * + * { margin-top: 18px; }
.tk-fb-hero {
  position: relative;
  overflow: hidden;
  border-radius: 20px;
  padding: 26px 30px;
  background:
    radial-gradient(120% 140% at 100% 0%, rgba(201, 163, 90, 0.22), transparent 55%),
    linear-gradient(135deg, var(--navy) 0%, var(--navy-deep) 100%);
  box-shadow: var(--shadow-lift);
}
.tk-fb-hero h2 {
  color: #f7f4ec;
  font-size: 1.35rem;
  line-height: 1.2;
  margin: 10px 0 8px;
}
.tk-fb-hero p { color: #c3cdd9; font-size: 0.92rem; margin: 0; max-width: 60ch; }

.tk-fb-card {
  background: var(--brand-card);
  border: 1px solid var(--brand-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}
.tk-fb-heading { margin-top: 22px; }

.tk-vote-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
}
.tk-vote {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 11px;
  row-gap: 2px;
  align-items: center;
  padding: 13px 15px;
  border: 1.5px solid var(--brand-border);
  border-radius: 12px;
  cursor: pointer;
  background: var(--brand-bg);
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}
.tk-vote:hover { border-color: var(--gold); transform: translateY(-2px); }
.tk-vote input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.tk-vote-icon { grid-row: 1 / span 2; font-size: 1.5rem; line-height: 1; }
.tk-vote-name { font-weight: 700; font-size: 0.87rem; color: var(--brand-ink); }
.tk-vote-sub { font-size: 0.74rem; color: var(--brand-muted); line-height: 1.4; }
/* .is-picked is set by JS so the selected state also works where :has() isn't */
.tk-vote:has(input:checked),
.tk-vote.is-picked {
  border-color: var(--gold-dark);
  background: linear-gradient(135deg, rgba(232, 207, 154, 0.28), rgba(201, 163, 90, 0.14));
  box-shadow: 0 6px 16px rgba(201, 163, 90, 0.22);
}
.tk-vote:has(input:focus-visible) { outline: 2px solid var(--gold-dark); outline-offset: 2px; }

#fb-message {
  width: 100%;
  font-family: var(--font-body);
  font-size: 0.88rem;
  color: var(--brand-ink);
  background: var(--brand-card);
  border: 1px solid var(--brand-border);
  border-radius: 10px;
  padding: 11px 13px;
  resize: vertical;
  line-height: 1.55;
}
#fb-message:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201, 163, 90, 0.25);
}
.tk-fb-row {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  margin-top: 14px;
  flex-wrap: wrap;
}
.tk-fb-privacy {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.76rem;
  color: var(--brand-muted);
  line-height: 1.5;
  margin: 16px 0 0;
}
.tk-fb-privacy svg { width: 15px; height: 15px; flex-shrink: 0; margin-top: 1px; color: var(--gold-dark); }

.tk-fb-success {
  background: var(--brand-card);
  border: 1px solid var(--gold);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-align: center;
  padding: 38px 24px;
}
.tk-fb-success h2 { font-size: 1.15rem; }
.tk-fb-success p {
  color: var(--brand-muted);
  font-size: 0.9rem;
  max-width: 46ch;
  margin: 8px auto 18px;
}
.tk-fb-fallback {
  font-size: 0.8rem !important;
  margin-top: -8px !important;
}
.tk-fb-fallback a { color: var(--gold-dark); }

.tk-support {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  background: linear-gradient(135deg, #fdfaf3, var(--brand-card));
  border: 1px dashed var(--gold);
  border-radius: var(--radius);
  padding: 20px 22px;
}
.tk-support h3 { font-size: 0.98rem; color: var(--brand-ink); margin-bottom: 4px; }
.tk-support p { font-size: 0.85rem; color: var(--brand-muted); margin: 0; max-width: 58ch; line-height: 1.55; }

/* ===== Confirm modal ===== */
.tk-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(6, 15, 28, 0.55);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  animation: tk-fade 0.18s ease;
}
@keyframes tk-fade { from { opacity: 0; } to { opacity: 1; } }
.tk-modal-card {
  width: 100%;
  max-width: 420px;
  background: var(--brand-card);
  border: 1px solid var(--brand-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lift);
  padding: 24px;
  animation: tk-pop 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes tk-pop { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: none; } }
.tk-modal-card h3 { font-size: 1.05rem; color: var(--brand-ink); margin-bottom: 8px; }
.tk-modal-card p {
  font-size: 0.88rem;
  color: var(--brand-muted);
  line-height: 1.55;
  margin: 0 0 18px;
}
.tk-modal-actions { display: flex; justify-content: flex-end; gap: 10px; }
.tk-btn-danger {
  background: linear-gradient(135deg, #d0452f, #b3311f);
  color: #fff;
  border: none;
  box-shadow: 0 6px 16px rgba(179, 49, 31, 0.28);
}
.tk-btn-danger:hover { filter: brightness(1.07); transform: translateY(-1px); }
@media (prefers-reduced-motion: reduce) {
  .tk-modal, .tk-modal-card { animation: none; }
}

.tk-ins-disclaimer {
  font-size: 0.74rem;
  color: var(--brand-muted);
  font-style: italic;
  text-align: center;
  padding-top: 4px;
}
.tk-ins-empty {
  background: var(--brand-card);
  border: 1px dashed var(--brand-border);
  border-radius: var(--radius);
  text-align: center;
  padding: 44px 24px;
}
.tk-ins-empty h2 { font-size: 1.1rem; }
.tk-ins-empty p { color: var(--brand-muted); font-size: 0.9rem; max-width: 44ch; margin: 8px auto 0; }

@media (prefers-reduced-motion: reduce) {
  .tk-gauge-val { animation: none; opacity: 1; transform: none; }
  .tk-traj-fill, .tk-tip { transition: none; }
}

/* ===== Responsive ===== */
@media (max-width: 980px) {
  .tk-kpis { grid-template-columns: repeat(2, 1fr); }
  .tk-charts { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  .app-title, .app-divider { display: none; }
  .tk-kpis { grid-template-columns: 1fr; }
  .tk-entry-form { flex-direction: column; align-items: stretch; }
  .tk-field, #f-date, #f-amount { width: 100%; }
  .tk-field--submit { flex-direction: row; }
  .tk-field--submit .btn { flex: 1; }
  .tk-search { max-width: none; }
  .tk-desc-cell { max-width: 140px; }
  /* Four tabs don't fit one narrow row (they need ~500px); a 2x2 grid keeps
     every tab visible and tappable instead of overflowing or hiding behind a
     scroll strip. */
  .tk-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; width: 100%; }
  .tk-tab { justify-content: center; padding: 10px 8px; font-size: 0.82rem; }
  .tk-verdict { flex-direction: column; text-align: center; padding: 24px 20px; }
  .tk-verdict::after { width: 100%; height: 4px; bottom: auto; }
  .tk-verdict-text h2 { font-size: 1.2rem; }
  .tk-tip { --tk-tip-icon: 32px; --tk-tip-gap: 10px; }
  .tk-cal-grid { gap: 4px; padding: 10px; }
  .tk-cal-day { padding: 4px 5px; border-radius: 7px; }
  .tk-cal-num { font-size: 0.62rem; }
  .tk-cal-amt { font-size: 0.6rem; }
  .tk-cal-pop { width: 220px; }
  .tk-cal-list li { flex-wrap: wrap; }
  .tk-cal-list-desc { flex-basis: 100%; order: 3; }
  .tk-fb-hero { padding: 22px 20px; }
  .tk-fb-hero h2 { font-size: 1.15rem; }
  .tk-fb-card { padding: 18px; }
  .tk-fb-row { flex-direction: column; align-items: stretch; }
  .tk-fb-row .btn { width: 100%; }
  .tk-support { flex-direction: column; align-items: flex-start; }
  .tk-support .btn { width: 100%; justify-content: center; }
}
