/* ============ RESET / BASE ============ */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { font-family: 'IBM Plex Sans Thai', 'Inter', system-ui, sans-serif; background: #07090F; color: #E5E7EB; -webkit-font-smoothing: antialiased; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select { font-family: inherit; color: inherit; }
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type="number"] { -moz-appearance: textfield; }

#root { min-height: 100vh; }

/* ============ APP SHELL ============ */
.app {
  position: relative;
  min-height: 100vh;
  padding-bottom: 80px;
  overflow-x: hidden;
}

/* ============ BACKGROUND FX ============ */
.bg-fx {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  overflow: hidden;
}
.bg-grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse at center, black 35%, transparent 80%);
}
.bg-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.35;
  animation: float 18s ease-in-out infinite;
}
.bg-blob-1 { background: #F59E0B; width: 500px; height: 500px; top: -120px; left: -80px; animation-delay: 0s; }
.bg-blob-2 { background: #3B82F6; width: 600px; height: 600px; top: 40%; right: -150px; animation-delay: -6s; }
.bg-blob-3 { background: #10B981; width: 450px; height: 450px; bottom: -100px; left: 40%; animation-delay: -12s; }

@keyframes float {
  0%, 100% { transform: translate(0,0) scale(1); }
  33% { transform: translate(30px, -40px) scale(1.05); }
  66% { transform: translate(-30px, 30px) scale(0.95); }
}

.bg-noise {
  position: absolute; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.06 0'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: 0.5;
  mix-blend-mode: overlay;
}

/* ============ TOPBAR ============ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 16px 32px;
  background: rgba(10, 13, 22, 0.7);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 280px; }
.brand-mark {
  width: 44px; height: 44px;
  display: grid; place-items: center;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(245,158,11,0.15);
}
.brand-title {
  font-weight: 800; font-size: 18px; letter-spacing: 1px;
  background: linear-gradient(135deg, #FBBF24, #F59E0B);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.brand-sub { font-size: 11px; color: #6B7280; margin-top: 1px; }

.tabs { display: flex; gap: 4px; flex: 1; justify-content: center; }
.tab {
  position: relative;
  display: flex; align-items: center; gap: 8px;
  padding: 10px 18px;
  border-radius: 12px;
  color: #9CA3AF;
  font-size: 14px; font-weight: 500;
  transition: all 0.25s cubic-bezier(.2,.9,.3,1);
  letter-spacing: 0.2px;
}
.tab:hover { color: #E5E7EB; background: rgba(255,255,255,0.04); }
.tab.active { color: #F9FAFB; background: rgba(245,158,11,0.12); }
.tab-icon { font-size: 14px; opacity: 0.8; }
.tab-glow {
  position: absolute;
  inset: -1px;
  border-radius: 12px;
  border: 1px solid rgba(245,158,11,0.4);
  box-shadow: 0 0 24px rgba(245,158,11,0.25), inset 0 1px 0 rgba(255,255,255,0.05);
  pointer-events: none;
}

.topbar-meta { display: flex; align-items: center; gap: 12px; }
.meta-pill {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 14px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 999px;
  font-size: 12px; color: #D1D5DB;
}
.meta-dot { width: 7px; height: 7px; border-radius: 50%; background: #10B981; box-shadow: 0 0 8px #10B981; animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.5; } }
.avatar {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, #F59E0B, #D97706);
  border-radius: 10px;
  display: grid; place-items: center;
  font-weight: 700; font-size: 12px;
  color: #1F2937;
  box-shadow: 0 6px 16px rgba(245,158,11,0.3);
}

/* ============ MAIN / PAGE HEAD ============ */
.main {
  position: relative;
  z-index: 1;
  max-width: 1440px;
  margin: 0 auto;
  padding: 36px 32px;
}
.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 32px;
  margin-bottom: 32px;
  animation: slideDown 0.6s cubic-bezier(.2,.9,.3,1) both;
}
.page-eyebrow {
  font-size: 11px;
  letter-spacing: 2px;
  font-weight: 600;
  color: #F59E0B;
  margin-bottom: 8px;
}
.page-title {
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: #F9FAFB;
  margin-bottom: 6px;
}
.page-sub { font-size: 14px; color: #9CA3AF; }
.head-stats { display: flex; gap: 24px; }
.head-stat {
  text-align: right;
}
.head-stat-label { font-size: 11px; color: #6B7280; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 4px; }
.head-stat-value { font-size: 24px; font-weight: 700; }
.head-stat-suffix { font-size: 13px; font-weight: 500; color: #9CA3AF; margin-left: 4px; }

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-12px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ============ HERO CARD ============ */
.hero-card {
  position: relative;
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 32px;
  padding: 36px 40px;
  background: linear-gradient(135deg, rgba(31,41,55,0.6) 0%, rgba(17,24,39,0.6) 100%);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 24px;
  backdrop-filter: blur(20px);
  box-shadow: 0 20px 60px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.06);
  margin-bottom: 40px;
  overflow: hidden;
  animation: slideUp 0.6s cubic-bezier(.2,.9,.3,1) 0.05s both;
}
.hero-card::before {
  content: '';
  position: absolute;
  top: -50%; right: -20%;
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(245,158,11,0.15), transparent 70%);
  pointer-events: none;
}
.hero-left { display: flex; flex-direction: column; justify-content: center; gap: 8px; }
.hero-label { font-size: 12px; color: #9CA3AF; text-transform: uppercase; letter-spacing: 2px; font-weight: 600; }
.hero-amount {
  font-size: 64px;
  font-weight: 800;
  letter-spacing: -2px;
  background: linear-gradient(135deg, #FBBF24, #F59E0B 60%, #D97706);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  line-height: 1;
  margin: 4px 0 16px;
}
.hero-meta { display: flex; align-items: center; gap: 24px; }
.hero-meta-item { display: flex; flex-direction: column; gap: 2px; }
.meta-key { font-size: 11px; color: #6B7280; text-transform: uppercase; letter-spacing: 1px; }
.meta-val { font-size: 20px; font-weight: 700; color: #F3F4F6; }
.meta-divider { width: 1px; height: 30px; background: rgba(255,255,255,0.1); }
.hero-right { display: grid; place-items: center; }

/* ============ DONUT ============ */
.donut { position: relative; width: 200px; height: 200px; }
.donut-center {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
}
.donut-pct { font-size: 42px; font-weight: 800; color: #F9FAFB; letter-spacing: -1px; }
.donut-pct span { font-size: 18px; color: #9CA3AF; margin-left: 2px; }
.donut-label { font-size: 11px; color: #6B7280; text-transform: uppercase; letter-spacing: 1.5px; margin-top: 2px; }

/* ============ SECTION HEAD ============ */
.section-head {
  display: flex; justify-content: space-between; align-items: center;
  margin: 36px 0 20px;
}
.section-head h2 { font-size: 18px; font-weight: 700; color: #F3F4F6; letter-spacing: -0.2px; }
.section-tools { display: flex; align-items: center; gap: 12px; font-size: 11px; color: #9CA3AF; }
.legend-key { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 4px; vertical-align: middle; }
.section-link { color: #F59E0B; font-size: 13px; font-weight: 500; cursor: pointer; transition: opacity 0.2s; }
.section-link:hover { opacity: 0.7; }

/* ============ CATEGORY CARDS ============ */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}
.cat-card {
  position: relative;
  background: rgba(17,20,30,0.7);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 20px;
  overflow: hidden;
  backdrop-filter: blur(20px);
  transition: all 0.4s cubic-bezier(.2,.9,.3,1);
  animation: slideUp 0.6s cubic-bezier(.2,.9,.3,1) both;
  cursor: default;
}
.cat-card:nth-child(2) { animation-delay: 0.1s; }
.cat-card:nth-child(3) { animation-delay: 0.2s; }
.cat-card:hover {
  transform: translateY(-4px);
  border-color: var(--cat-color);
  box-shadow: 0 24px 60px -20px var(--cat-glow), 0 1px 0 rgba(255,255,255,0.08) inset;
}
.cat-card-bg {
  position: absolute;
  top: 0; left: 0; right: 0; height: 4px;
}
.cat-card::before {
  content: '';
  position: absolute;
  top: -50px; right: -50px;
  width: 200px; height: 200px;
  background: radial-gradient(circle, var(--cat-glow), transparent 70%);
  opacity: 0.3;
  transition: opacity 0.4s;
  pointer-events: none;
}
.cat-card:hover::before { opacity: 0.6; }
.cat-card-inner { padding: 24px 24px 22px; position: relative; }

.cat-header { display: flex; align-items: center; gap: 14px; margin-bottom: 24px; }
.cat-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: grid; place-items: center;
  font-size: 22px; color: white; font-weight: 700;
}
.cat-title { flex: 1; }
.cat-name { font-size: 16px; font-weight: 700; color: #F3F4F6; }
.cat-id { font-size: 10px; color: #6B7280; letter-spacing: 1px; margin-top: 2px; }
.cat-badge {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px; font-weight: 600;
}
.badge-dot { width: 6px; height: 6px; border-radius: 50%; }
.badge-safe { background: rgba(16,185,129,0.15); color: #34D399; border: 1px solid rgba(16,185,129,0.3); }
.badge-safe .badge-dot { background: #10B981; box-shadow: 0 0 6px #10B981; }
.badge-warn { background: rgba(245,158,11,0.15); color: #FBBF24; border: 1px solid rgba(245,158,11,0.3); }
.badge-warn .badge-dot { background: #F59E0B; box-shadow: 0 0 6px #F59E0B; }
.badge-danger { background: rgba(239,68,68,0.15); color: #FCA5A5; border: 1px solid rgba(239,68,68,0.3); }
.badge-danger .badge-dot { background: #EF4444; box-shadow: 0 0 6px #EF4444; animation: pulse 1.5s ease-in-out infinite; }

.cat-budget-row { display: grid; grid-template-columns: 1fr auto 1fr; gap: 16px; align-items: center; margin-bottom: 22px; }
.cat-row-label { font-size: 11px; color: #6B7280; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 4px; }
.cat-row-value { font-size: 20px; font-weight: 700; color: #F3F4F6; display: flex; align-items: center; gap: 6px; cursor: pointer; transition: color 0.2s; }
.cat-row-value:hover { color: var(--cat-color); }
.edit-hint { font-size: 12px; opacity: 0; transition: opacity 0.2s; }
.cat-row-value:hover .edit-hint { opacity: 0.6; }
.cat-divider { width: 1px; height: 28px; background: rgba(255,255,255,0.08); }
.budget-edit { display: flex; align-items: center; gap: 6px; }
.budget-edit input {
  width: 130px;
  padding: 6px 10px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--cat-color);
  border-radius: 8px;
  font-size: 16px; font-weight: 600;
  outline: none;
}
.budget-edit button {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: var(--cat-color);
  color: white; font-weight: 700;
}

/* ============ PROGRESS BAR ============ */
.cat-progress { margin-bottom: 22px; }
.progress-track {
  position: relative;
  height: 12px;
  background: rgba(255,255,255,0.04);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 8px;
  border: 1px solid rgba(255,255,255,0.04);
}
.progress-fill {
  position: relative;
  height: 100%;
  border-radius: 999px;
  transition: width 0.8s cubic-bezier(.2,.9,.3,1);
  overflow: hidden;
}
.progress-shine {
  position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
  animation: shine 2.4s linear infinite;
  width: 80px;
}
@keyframes shine {
  0% { transform: translateX(-100px); }
  100% { transform: translateX(400px); }
}
.progress-overflow {
  position: absolute;
  right: 8px; top: 50%; transform: translateY(-50%);
  font-size: 10px; font-weight: 700; color: white;
  background: #EF4444; padding: 1px 6px; border-radius: 4px;
}
.progress-meta { display: flex; align-items: center; gap: 8px; font-size: 12px; color: #9CA3AF; }
.progress-pct { font-weight: 700; font-size: 14px; }
.progress-sep { opacity: 0.4; }

/* ============ CAT FOOTER ============ */
.cat-footer { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; padding-top: 16px; border-top: 1px solid rgba(255,255,255,0.06); }
.cat-foot-stat { text-align: center; }
.foot-num { display: block; font-size: 18px; font-weight: 700; color: #E5E7EB; }
.foot-label { display: block; font-size: 10px; color: #6B7280; text-transform: uppercase; letter-spacing: 0.5px; margin-top: 2px; }

/* ============ ACTIVITY ============ */
.activity-card {
  background: rgba(17,20,30,0.7);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 20px;
  overflow: hidden;
  backdrop-filter: blur(20px);
}
.activity-row {
  display: grid;
  grid-template-columns: 80px 48px 1fr auto auto;
  gap: 16px;
  align-items: center;
  padding: 16px 24px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  transition: background 0.2s;
  animation: slideUp 0.4s ease both;
}
.activity-row:last-child { border-bottom: none; }
.activity-row:hover { background: rgba(255,255,255,0.02); }
.act-time-h { font-size: 14px; font-weight: 600; color: #F3F4F6; }
.act-time-d { font-size: 11px; color: #6B7280; }
.act-cat {
  width: 36px; height: 36px; border-radius: 10px;
  display: grid; place-items: center;
  font-size: 16px; color: white;
}
.act-detail { min-width: 0; }
.act-title { display: flex; gap: 10px; align-items: baseline; }
.act-craft { font-weight: 600; color: #E5E7EB; font-size: 14px; }
.act-count { font-size: 12px; color: #9CA3AF; }
.act-note { font-size: 12px; color: #6B7280; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.act-cat-tag {
  font-size: 11px; font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid;
  background: rgba(255,255,255,0.02);
}
.act-amount { font-weight: 700; font-size: 14px; color: #FCA5A5; font-variant-numeric: tabular-nums; }
.amount-minus { opacity: 0.7; margin-right: 2px; }

/* ============ LOG PAGE ============ */
.log-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 24px;
  align-items: start;
}
.form-panel, .preview-panel {
  background: rgba(17,20,30,0.7);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 20px;
  padding: 28px;
  backdrop-filter: blur(20px);
  animation: slideUp 0.5s cubic-bezier(.2,.9,.3,1) both;
}
.panel-section { margin-bottom: 24px; }
.panel-section:last-child { margin-bottom: 0; }
.panel-label {
  display: flex; align-items: center; gap: 10px;
  font-size: 12px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 1.5px;
  color: #9CA3AF;
  margin-bottom: 14px;
}
.step-num {
  width: 22px; height: 22px;
  background: rgba(245,158,11,0.15);
  border: 1px solid rgba(245,158,11,0.3);
  color: #FBBF24;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 11px; font-weight: 700;
}

/* ============ CAT PICKER ============ */
.cat-picker { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.cat-pick {
  position: relative;
  padding: 18px 16px;
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 14px;
  text-align: left;
  transition: all 0.3s cubic-bezier(.2,.9,.3,1);
  overflow: hidden;
}
.cat-pick::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(circle at top right, var(--cat-glow), transparent 60%);
  opacity: 0; transition: opacity 0.3s;
  pointer-events: none;
}
.cat-pick:hover {
  border-color: var(--cat-color);
  transform: translateY(-2px);
}
.cat-pick:hover::before { opacity: 0.3; }
.cat-pick.active {
  border-color: var(--cat-color);
  background: rgba(255,255,255,0.04);
  box-shadow: 0 12px 32px -12px var(--cat-glow), inset 0 1px 0 rgba(255,255,255,0.06);
}
.cat-pick.active::before { opacity: 0.5; }
.cat-pick-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: grid; place-items: center;
  font-size: 18px; color: white;
  margin-bottom: 10px;
}
.cat-pick-name { font-size: 14px; font-weight: 600; color: #F3F4F6; }
.cat-pick-remain { font-size: 11px; color: #9CA3AF; margin-top: 4px; }
.cat-pick-check {
  position: absolute;
  top: 12px; right: 12px;
  width: 22px; height: 22px;
  background: var(--cat-color);
  border-radius: 50%;
  display: grid; place-items: center;
  color: white; font-weight: 700; font-size: 12px;
  animation: pop 0.3s cubic-bezier(.2,1.4,.4,1) both;
}
@keyframes pop { from { transform: scale(0); } to { transform: scale(1); } }

/* ============ CRAFT GRID ============ */
.craft-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.craft-pick {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px;
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 10px;
  font-size: 13px;
  transition: all 0.2s;
}
.craft-pick:hover { border-color: rgba(255,255,255,0.15); background: rgba(255,255,255,0.04); }
.craft-pick.active {
  background: rgba(245,158,11,0.1);
  border-color: rgba(245,158,11,0.5);
  color: #FBBF24;
}
.craft-emoji { font-size: 16px; }
.craft-name { font-weight: 500; }

/* ============ FORM FIELDS ============ */
.form-row { display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.form-field { position: relative; display: flex; flex-direction: column; gap: 6px; }
.form-field.full { grid-column: 1 / -1; }
.form-field label { font-size: 11px; color: #9CA3AF; font-weight: 500; letter-spacing: 0.3px; }
.text-input, .date-input, select.text-input {
  width: 100%;
  padding: 12px 14px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  font-size: 14px; color: #F3F4F6;
  outline: none;
  transition: all 0.2s;
  font-weight: 500;
}
.text-input:focus, .date-input:focus, select.text-input:focus {
  border-color: #F59E0B;
  background: rgba(255,255,255,0.05);
  box-shadow: 0 0 0 3px rgba(245,158,11,0.15);
}
.date-input { color-scheme: dark; }
.text-input.full { width: 100%; }
.text-input span.prefix { position: absolute; left: 14px; top: 50%; }
.form-field .prefix { position: absolute; left: 14px; top: 38px; color: #9CA3AF; pointer-events: none; }
.form-field:has(.prefix) input { padding-left: 28px; }

.num-input {
  display: flex; align-items: center;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  overflow: hidden;
}
.num-input:focus-within { border-color: #F59E0B; box-shadow: 0 0 0 3px rgba(245,158,11,0.15); }
.num-input button {
  width: 44px; height: 44px;
  background: rgba(255,255,255,0.04);
  font-size: 18px; font-weight: 600;
  color: #D1D5DB;
  transition: all 0.15s;
}
.num-input button:hover { background: rgba(245,158,11,0.15); color: #FBBF24; }
.num-input input {
  flex: 1; width: 100%;
  text-align: center;
  padding: 12px 8px;
  background: transparent;
  border: none;
  font-size: 18px; font-weight: 700;
  color: #F3F4F6;
  outline: none;
}
.field-suffix { position: absolute; right: 60px; bottom: 12px; font-size: 12px; color: #6B7280; pointer-events: none; }

.submit-btn {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  width: 100%;
  padding: 18px 24px;
  background: linear-gradient(135deg, #FBBF24, #F59E0B 60%, #D97706);
  color: #0B1220;
  border-radius: 14px;
  font-size: 15px; font-weight: 700; letter-spacing: 0.3px;
  margin-top: 8px;
  transition: all 0.25s cubic-bezier(.2,.9,.3,1);
  box-shadow: 0 12px 32px -8px rgba(245,158,11,0.45), inset 0 1px 0 rgba(255,255,255,0.3);
  position: relative;
  overflow: hidden;
}
.submit-btn::before {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25), transparent);
  transform: translateX(-100%);
  transition: transform 0.6s;
}
.submit-btn:hover::before { transform: translateX(100%); }
.submit-btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 16px 40px -8px rgba(245,158,11,0.55); }
.submit-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.submit-btn.warn { background: linear-gradient(135deg, #F87171, #EF4444 60%, #B91C1C); color: white; box-shadow: 0 12px 32px -8px rgba(239,68,68,0.45); }
.submit-icon { font-size: 16px; }
.submit-arrow { font-size: 14px; opacity: 0.7; transition: transform 0.25s; }
.submit-btn:hover .submit-arrow { transform: translateX(4px); }

/* ============ PREVIEW PANEL ============ */
.preview-label { font-size: 11px; color: #9CA3AF; text-transform: uppercase; letter-spacing: 2px; font-weight: 600; margin-bottom: 14px; }
.preview-card {
  position: relative;
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 16px;
  padding: 24px;
  overflow: hidden;
}
.preview-cat-strip { position: absolute; top: 0; left: 0; right: 0; height: 3px; }
.preview-cat { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; font-weight: 700; color: #F3F4F6; }
.preview-cat-icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: grid; place-items: center;
  color: white; font-size: 14px;
}

.calc-display {
  background: rgba(0,0,0,0.25);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 20px;
  font-variant-numeric: tabular-nums;
}
.calc-line { display: flex; justify-content: space-between; padding: 6px 0; }
.calc-line.big { font-size: 18px; font-weight: 700; }
.calc-key { color: #9CA3AF; font-size: 13px; }
.calc-val { color: #F3F4F6; font-weight: 600; }
.calc-val.danger { color: #FCA5A5; }
.calc-divider { height: 1px; background: rgba(255,255,255,0.08); margin: 8px 0; }

.budget-state {
  background: linear-gradient(135deg, rgba(245,158,11,0.05), rgba(245,158,11,0.02));
  border: 1px solid rgba(245,158,11,0.15);
  border-radius: 12px;
  padding: 16px;
}
.bs-row { display: flex; justify-content: space-between; font-size: 13px; color: #D1D5DB; }
.bs-row strong { color: #F3F4F6; font-weight: 700; font-size: 16px; }
.bs-row.after strong { font-size: 20px; color: #86EFAC; }
.bs-row.after strong.danger { color: #FCA5A5; }
.bs-arrow { text-align: center; padding: 6px 0; color: #6B7280; font-size: 16px; }

.warning-banner {
  margin-top: 14px;
  padding: 10px 14px;
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.3);
  border-radius: 10px;
  font-size: 13px;
  color: #FCA5A5;
  display: flex; align-items: center; gap: 8px;
}

.quick-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; }
.qs-item {
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px;
  padding: 14px;
  text-align: center;
}
.qs-label { font-size: 10px; color: #9CA3AF; text-transform: uppercase; letter-spacing: 1px; }
.qs-value { font-size: 28px; font-weight: 800; color: #FBBF24; line-height: 1; margin: 6px 0 2px; }
.qs-sub { font-size: 11px; color: #6B7280; }

/* ============ TABLE ============ */
.entries-table {
  background: rgba(17,20,30,0.7);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 16px;
  overflow: hidden;
  backdrop-filter: blur(20px);
}
.table-head, .table-row {
  display: grid;
  grid-template-columns: 90px 100px 150px 60px 1fr 120px;
  gap: 16px;
  padding: 14px 24px;
  align-items: center;
}
.table-head {
  background: rgba(255,255,255,0.03);
  font-size: 11px;
  color: #9CA3AF;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.table-head .right, .table-row .right { text-align: right; }
.table-row {
  font-size: 14px;
  color: #D1D5DB;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  transition: background 0.2s;
  animation: slideUp 0.4s ease both;
}
.table-row:last-child { border-bottom: none; }
.table-row:hover { background: rgba(255,255,255,0.02); }
.cat-chip {
  display: inline-block;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 6px;
  border: 1px solid;
}
.td-workers { font-weight: 700; color: #F3F4F6; }
.td-amount { font-weight: 700; font-variant-numeric: tabular-nums; color: #F3F4F6; }
.td-note { color: #9CA3AF; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ============ OT PAGE ============ */
.btn-primary {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 22px;
  background: linear-gradient(135deg, #FBBF24, #F59E0B);
  color: #0B1220;
  border-radius: 12px;
  font-weight: 700; font-size: 14px;
  box-shadow: 0 8px 24px -6px rgba(245,158,11,0.4);
  transition: all 0.2s;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 12px 32px -6px rgba(245,158,11,0.55); }
.btn-primary span:first-child { font-size: 18px; font-weight: 700; }

.ot-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.ot-stat {
  display: flex; align-items: center; gap: 16px;
  padding: 20px 22px;
  background: rgba(17,20,30,0.7);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 16px;
  backdrop-filter: blur(20px);
  transition: all 0.3s;
  animation: slideUp 0.5s cubic-bezier(.2,.9,.3,1) both;
}
.ot-stat:nth-child(2) { animation-delay: 0.08s; }
.ot-stat:nth-child(3) { animation-delay: 0.16s; }
.ot-stat:nth-child(4) { animation-delay: 0.24s; }
.ot-stat:hover { transform: translateY(-2px); border-color: rgba(255,255,255,0.12); }
.ot-stat-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: grid; place-items: center;
  font-size: 20px;
  font-weight: 700;
}
.ot-stat.pending .ot-stat-icon { background: rgba(245,158,11,0.15); color: #FBBF24; border: 1px solid rgba(245,158,11,0.3); }
.ot-stat.approved .ot-stat-icon { background: rgba(16,185,129,0.15); color: #34D399; border: 1px solid rgba(16,185,129,0.3); }
.ot-stat.rejected .ot-stat-icon { background: rgba(239,68,68,0.15); color: #FCA5A5; border: 1px solid rgba(239,68,68,0.3); }
.ot-stat.total .ot-stat-icon { background: rgba(99,102,241,0.15); color: #A5B4FC; border: 1px solid rgba(99,102,241,0.3); }
.ot-stat-num { font-size: 28px; font-weight: 800; color: #F3F4F6; line-height: 1; }
.ot-stat-label { font-size: 12px; color: #9CA3AF; margin-top: 4px; }

.ot-form-card {
  background: rgba(17,20,30,0.7);
  border: 1px solid rgba(245,158,11,0.2);
  border-radius: 20px;
  padding: 28px;
  margin-bottom: 24px;
  backdrop-filter: blur(20px);
  animation: slideUp 0.4s cubic-bezier(.2,.9,.3,1) both;
  box-shadow: 0 20px 60px -20px rgba(245,158,11,0.25);
}
.ot-form-head { font-size: 16px; font-weight: 700; color: #F3F4F6; margin-bottom: 20px; }
.ot-form-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 20px; }
.ot-form-grid .form-field.full { grid-column: 1 / -1; }
.seg-control { display: flex; gap: 4px; background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.08); border-radius: 10px; padding: 4px; }
.seg-control button {
  flex: 1; padding: 10px 8px;
  border-radius: 6px;
  font-size: 13px; font-weight: 500;
  color: #9CA3AF;
  transition: all 0.2s;
}
.seg-control button:hover { color: #E5E7EB; }
.seg-control button.active { background: var(--cat-color); color: white; box-shadow: 0 4px 12px rgba(0,0,0,0.3); }

.ot-form-foot {
  display: flex; justify-content: space-between; align-items: center;
  padding-top: 20px;
  border-top: 1px solid rgba(255,255,255,0.06);
}
.ot-preview { display: flex; align-items: center; gap: 12px; font-size: 13px; color: #9CA3AF; }
.ot-preview strong { color: #E5E7EB; font-weight: 500; }
.ot-preview-amount { font-size: 18px; font-weight: 800; color: #FBBF24; }

/* OT LIST */
.ot-list { display: grid; gap: 16px; }
.ot-card {
  position: relative;
  display: flex;
  background: rgba(17,20,30,0.7);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 16px;
  overflow: hidden;
  backdrop-filter: blur(20px);
  animation: slideUp 0.5s cubic-bezier(.2,.9,.3,1) both;
  transition: all 0.3s;
}
.ot-card:hover { transform: translateX(4px); border-color: rgba(255,255,255,0.12); }
.ot-card-side { width: 6px; flex-shrink: 0; }
.ot-card-main { flex: 1; padding: 20px 24px; }
.ot-card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.ot-cat { padding: 6px 12px; border-radius: 8px; font-size: 13px; font-weight: 600; }
.ot-status-pill {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px; font-weight: 600;
}
.ot-status-pill.status-pending { background: rgba(245,158,11,0.15); color: #FBBF24; border: 1px solid rgba(245,158,11,0.3); }
.ot-status-pill.status-approved { background: rgba(16,185,129,0.15); color: #34D399; border: 1px solid rgba(16,185,129,0.3); }
.ot-status-pill.status-rejected { background: rgba(239,68,68,0.15); color: #FCA5A5; border: 1px solid rgba(239,68,68,0.3); }
.status-dot { width: 7px; height: 7px; background: currentColor; border-radius: 50%; }
.status-dot.pulse { animation: pulse 1.5s ease-in-out infinite; box-shadow: 0 0 6px currentColor; }

.ot-card-body { display: grid; grid-template-columns: 1.2fr 1fr 160px; gap: 24px; align-items: center; }
.ot-detail { display: grid; gap: 6px; }
.ot-detail-row { display: flex; justify-content: space-between; font-size: 12px; }
.ot-detail-row span { color: #9CA3AF; }
.ot-detail-row strong { color: #E5E7EB; font-weight: 600; }
.ot-reason { }
.ot-reason-label { font-size: 10px; color: #6B7280; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 4px; }
.ot-reason-text { font-size: 13px; color: #D1D5DB; line-height: 1.5; }
.ot-amount-box {
  text-align: right;
  background: rgba(245,158,11,0.08);
  border: 1px solid rgba(245,158,11,0.2);
  border-radius: 12px;
  padding: 14px;
}
.ot-amount-label { font-size: 10px; color: #9CA3AF; text-transform: uppercase; letter-spacing: 1px; }
.ot-amount-value { font-size: 20px; font-weight: 800; color: #FBBF24; margin-top: 4px; }

.ot-actions { display: flex; gap: 8px; margin-top: 16px; padding-top: 16px; border-top: 1px solid rgba(255,255,255,0.06); justify-content: flex-end; }
.btn-ghost {
  padding: 9px 18px;
  border-radius: 10px;
  font-size: 13px; font-weight: 600;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.02);
  color: #D1D5DB;
  transition: all 0.2s;
}
.btn-ghost:hover { background: rgba(255,255,255,0.06); }
.btn-ghost.success { color: #34D399; border-color: rgba(16,185,129,0.3); }
.btn-ghost.success:hover { background: rgba(16,185,129,0.15); }
.btn-ghost.danger { color: #FCA5A5; border-color: rgba(239,68,68,0.3); }
.btn-ghost.danger:hover { background: rgba(239,68,68,0.15); }

/* ============ REPORT PAGE ============ */
.craft-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 12px; }
.craft-summary-card {
  background: rgba(17,20,30,0.7);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 14px;
  padding: 18px;
  backdrop-filter: blur(20px);
  transition: all 0.3s;
  animation: slideUp 0.5s cubic-bezier(.2,.9,.3,1) both;
}
.craft-summary-card:hover { transform: translateY(-3px); border-color: rgba(245,158,11,0.3); box-shadow: 0 12px 32px -12px rgba(245,158,11,0.25); }
.cs-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.cs-icon { font-size: 20px; }
.cs-name { font-size: 14px; font-weight: 600; color: #E5E7EB; }
.cs-num { font-size: 28px; font-weight: 800; color: #F3F4F6; line-height: 1; }
.cs-num span { font-size: 12px; font-weight: 500; color: #9CA3AF; margin-left: 4px; }
.cs-bar { height: 6px; background: rgba(255,255,255,0.04); border-radius: 999px; overflow: hidden; margin: 12px 0; }
.cs-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #FBBF24, #F59E0B);
  border-radius: 999px;
  box-shadow: 0 0 12px rgba(245,158,11,0.4);
  animation: barFill 1s cubic-bezier(.2,.9,.3,1) both;
}
@keyframes barFill { from { width: 0; } }
.cs-amount { font-size: 13px; font-weight: 700; color: #FBBF24; }
.cs-meta { font-size: 11px; color: #6B7280; margin-top: 2px; }

/* MOVEMENT */
.movement-card {
  background: rgba(17,20,30,0.7);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 20px;
  padding: 28px;
  backdrop-filter: blur(20px);
  margin-bottom: 12px;
}
.movement-legend { display: flex; gap: 20px; margin-bottom: 24px; font-size: 12px; color: #9CA3AF; }
.ml-item { display: flex; align-items: center; gap: 8px; }
.ml-dot { width: 12px; height: 12px; border-radius: 4px; }
.movement-chart {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 16px;
  height: 240px;
  align-items: end;
}
.mc-bar-wrap {
  display: flex; flex-direction: column;
  align-items: center;
  height: 100%;
  position: relative;
  animation: slideUp 0.6s cubic-bezier(.2,.9,.3,1) both;
}
.mc-total { font-size: 11px; font-weight: 600; color: #E5E7EB; margin-bottom: 8px; }
.mc-bar {
  width: 100%; max-width: 56px;
  flex: 1;
  display: flex; flex-direction: column; justify-content: flex-end;
  gap: 2px;
  background: rgba(255,255,255,0.02);
  border-radius: 8px 8px 0 0;
  padding: 2px;
}
.mc-bar-seg {
  border-radius: 4px;
  min-height: 4px;
  transition: all 0.6s cubic-bezier(.2,.9,.3,1);
}
.mc-bar-seg:hover { filter: brightness(1.15); }
.mc-date { font-size: 11px; color: #9CA3AF; margin-top: 8px; font-weight: 500; }

/* FILTERS */
.filter-bar { display: flex; gap: 16px; }
.filter-group { display: flex; align-items: center; gap: 10px; }
.filter-label { font-size: 11px; color: #9CA3AF; text-transform: uppercase; letter-spacing: 1px; }
.filter-chips { display: flex; gap: 4px; background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.06); border-radius: 10px; padding: 3px; }
.filter-chips button {
  padding: 6px 14px;
  font-size: 12px; font-weight: 600;
  color: #9CA3AF;
  border-radius: 7px;
  transition: all 0.2s;
}
.filter-chips button:hover { color: #E5E7EB; }
.filter-chips button.active { background: var(--cat-color, #F59E0B); color: white; }

/* TIMELINE */
.timeline {
  position: relative;
  padding-left: 24px;
}
.timeline-row {
  position: relative;
  padding: 10px 0 10px 24px;
  animation: slideUp 0.4s cubic-bezier(.2,.9,.3,1) both;
}
.tl-marker {
  position: absolute;
  left: -4px; top: 22px;
  width: 14px; height: 14px;
  border-radius: 50%;
  border: 3px solid #07090F;
  z-index: 2;
}
.tl-line {
  position: absolute;
  left: 2px; top: 0; bottom: 0;
  width: 1px;
  background: linear-gradient(180deg, rgba(255,255,255,0.1), rgba(255,255,255,0.04));
}
.timeline-row:last-child .tl-line { display: none; }
.tl-card {
  background: rgba(17,20,30,0.7);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px;
  padding: 14px 18px;
  backdrop-filter: blur(12px);
  transition: all 0.2s;
}
.tl-card:hover { border-color: rgba(255,255,255,0.12); transform: translateX(4px); }
.tl-top { display: flex; justify-content: space-between; margin-bottom: 6px; }
.tl-date { font-size: 13px; font-weight: 600; color: #E5E7EB; }
.tl-time { font-size: 11px; color: #9CA3AF; }
.tl-mid { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.tl-cat { font-size: 14px; font-weight: 600; }
.tl-amount { font-size: 16px; font-weight: 700; color: #FCA5A5; font-variant-numeric: tabular-nums; }
.tl-bot { font-size: 12px; color: #9CA3AF; }
.tl-workers { color: #D1D5DB; font-weight: 500; }
.tl-sep { margin: 0 8px; opacity: 0.4; }
.tl-note { font-style: italic; }

/* ============ TOAST ============ */
.toast {
  position: fixed;
  bottom: 32px; right: 32px;
  display: flex; align-items: center; gap: 14px;
  padding: 14px 20px;
  background: rgba(17,20,30,0.95);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 14px;
  backdrop-filter: blur(24px);
  box-shadow: 0 24px 60px rgba(0,0,0,0.5), 0 0 40px rgba(245,158,11,0.15);
  z-index: 1000;
  animation: toastIn 0.4s cubic-bezier(.2,1.2,.4,1) both;
  max-width: 420px;
}
@keyframes toastIn {
  from { transform: translateY(20px) scale(0.9); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}
.toast-icon {
  width: 32px; height: 32px;
  border-radius: 10px;
  display: grid; place-items: center;
  font-size: 14px; font-weight: 700;
}
.toast-success .toast-icon { background: rgba(16,185,129,0.2); color: #34D399; border: 1px solid rgba(16,185,129,0.3); }
.toast-info .toast-icon { background: rgba(59,130,246,0.2); color: #93C5FD; border: 1px solid rgba(59,130,246,0.3); }
.toast-warn .toast-icon { background: rgba(245,158,11,0.2); color: #FBBF24; border: 1px solid rgba(245,158,11,0.3); }
.toast-msg { font-size: 14px; color: #E5E7EB; font-weight: 500; }

/* ============ RESPONSIVE ============ */
@media (max-width: 1200px) {
  .hero-card, .log-grid { grid-template-columns: 1fr; }
  .cat-grid { grid-template-columns: 1fr; }
  .ot-stats, .craft-summary { grid-template-columns: repeat(2, 1fr); }
  .ot-card-body { grid-template-columns: 1fr; }
  .ot-form-grid, .form-row { grid-template-columns: 1fr 1fr; }
  .movement-chart { gap: 8px; }
  .tabs { gap: 0; }
  .tab span:not(.tab-icon):not(.tab-glow) { display: none; }
}
@media (max-width: 720px) {
  .topbar { padding: 12px 16px; flex-wrap: wrap; gap: 12px; }
  .brand { min-width: 0; flex: 1; }
  .brand-text { display: none; }
  .main { padding: 24px 16px; }
  .page-head { flex-direction: column; align-items: flex-start; }
  .page-title { font-size: 26px; }
  .hero-amount { font-size: 44px; }
  .craft-grid { grid-template-columns: repeat(2, 1fr); }
}
