:root {
  --bg: #f5f7f4;
  --surface: #ffffff;
  --surface-soft: #eef3ec;
  --line: #d6dfd2;
  --text: #1b2520;
  --muted: #5e7167;
  --accent: #177e6f;
  --accent-strong: #115f54;
  --warn: #a04242;
  --shadow: 0 14px 38px rgba(20, 42, 35, 0.08);
  --radius: 16px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--text);
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 8% 0%, #d9efe6 0%, transparent 36%),
    radial-gradient(circle at 92% 24%, #ffe9d9 0%, transparent 28%),
    var(--bg);
}

a {
  color: var(--accent-strong);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

h1,
h2,
h3 {
  font-family: "Space Grotesk", "Avenir Next", sans-serif;
  letter-spacing: -0.02em;
  margin: 0 0 10px;
}

p {
  margin: 0 0 12px;
  color: var(--muted);
}

.site-nav {
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(8px);
  background: rgba(245, 247, 244, 0.87);
  border-bottom: 1px solid var(--line);
}

.nav-shell {
  max-width: 1080px;
  margin: 0 auto;
  padding: 14px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.brand {
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding-left: 6px;
  border-left: 1px solid var(--line);
}

.lang-switch a {
  padding: 6px 8px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
}

.lang-switch a.is-active {
  background: #d8ece7;
  color: var(--accent-strong);
}

.nav-links a {
  padding: 7px 10px;
  border-radius: 999px;
}

.nav-links a:hover {
  background: var(--surface-soft);
  text-decoration: none;
}

.page {
  max-width: 1080px;
  margin: 24px auto 42px;
  padding: 0 18px;
}

.hero,
.panel,
.metric,
.table-wrap,
.auth-card,
.flash,
.empty {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.hero,
.panel,
.auth-card,
.table-wrap,
.empty {
  padding: 22px;
}

.metric {
  padding: 16px;
}

.flash {
  padding: 12px 14px;
  margin-bottom: 12px;
}

.flash-success {
  border-left: 4px solid #2f8b5b;
}

.flash-error {
  border-left: 4px solid var(--warn);
}

.flash-info {
  border-left: 4px solid var(--accent);
}

.grid {
  display: grid;
  gap: 14px;
}

.metrics {
  margin-top: 16px;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

.dashboard-double-grid {
  margin-top: 14px;
  grid-template-columns: 3fr 1fr;
  align-items: start;
}

.dash-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.dash-rates-row {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  margin-top: 0;
}

.dash-rate-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #f8fcfa;
  color: var(--muted);
  font-size: 0.86rem;
}

.dash-rate-pill strong {
  color: var(--text);
  font-weight: 700;
}

.dashboard-main-card {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.dash-progress-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-end;
}

.dash-progress-side {
  text-align: right;
}

.dash-big {
  margin: 0;
  font-family: "Space Grotesk", "Avenir Next", sans-serif;
  font-size: 1.18rem;
  color: var(--text);
}

.dash-progress-track {
  width: 100%;
  height: 12px;
  border-radius: 999px;
  background: #e4ece8;
  overflow: hidden;
}

.dash-progress-fill {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 999px;
  transition: width 0.35s ease, background 0.25s ease;
  animation: dash-progress-init 0.85s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.dash-progress-fill.is-ok {
  background: linear-gradient(90deg, #1f8d63 0%, #20a36d 100%);
}

.dash-progress-fill.is-warning {
  background: linear-gradient(90deg, #d48518 0%, #eb9f32 100%);
}

.dash-progress-fill.is-danger {
  background: linear-gradient(90deg, #b13a3a 0%, #da4d4d 100%);
}

.dash-today-row,
.dash-income-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
  padding: 8px 10px;
  border: 1px solid #e8eeea;
  border-radius: 10px;
  background: #fcfefd;
}

.dash-recent-table {
  margin-top: 2px;
}

.dash-recent-table table {
  min-width: 560px;
}

@media (max-width: 980px) {
  .dashboard-double-grid {
    grid-template-columns: 1fr;
  }

  .dash-top-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .dash-rates-row {
    justify-content: flex-start;
    flex-wrap: wrap;
  }
}

.kicker {
  display: inline-block;
  color: var(--accent-strong);
  background: #d8ece7;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.82rem;
  margin-bottom: 12px;
}

.btn,
button {
  appearance: none;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  border-radius: 10px;
  padding: 9px 14px;
  font-weight: 600;
  cursor: pointer;
}

.btn:hover,
button:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  text-decoration: none;
}

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

.btn-danger {
  border-color: #8c3838;
  background: #8c3838;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.form-status {
  margin: 0 0 10px;
  border-radius: 10px;
  padding: 8px 10px;
}

.form-status-success {
  color: #0f5f4d;
  background: #ddf5eb;
  border: 1px solid #b7e5d4;
}

.form-status-error {
  color: #7d2626;
  background: #ffe8e8;
  border: 1px solid #f3c3c3;
}

.form-status-pending {
  color: #225d73;
  background: #e6f4fb;
  border: 1px solid #c8e5f3;
}

.table-wrap {
  margin-top: 12px;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid #e9eee8;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 0.84rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

form > div {
  margin-bottom: 12px;
}

label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
}

input,
select,
textarea {
  width: 100%;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfdfb;
}

select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 34px;
  background-image:
    linear-gradient(45deg, transparent 50%, #557a70 50%),
    linear-gradient(135deg, #557a70 50%, transparent 50%);
  background-position:
    calc(100% - 18px) calc(50% - 3px),
    calc(100% - 12px) calc(50% - 3px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

input[type="checkbox"] {
  width: auto;
  padding: 0;
}

ul {
  margin: 0;
  padding-left: 18px;
}

.auth-wrap {
  min-height: calc(100vh - 170px);
  display: grid;
  place-items: center;
}

.auth-card {
  width: 100%;
  max-width: 430px;
}

.subtle {
  font-size: 0.93rem;
  color: var(--muted);
}

.sp-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.sp-tab {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 999px;
  padding: 7px 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.sp-tab.is-active {
  border-color: var(--accent);
  background: #d8ece7;
}

.sp-tab.is-alert {
  border-color: #d08c1d;
  background: #fff6e8;
}

.sp-tab .dot {
  display: inline-flex;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  align-items: center;
  justify-content: center;
  background: #d08c1d;
  color: #fff;
  font-size: 0.75rem;
}

.sp-section {
  margin-top: 18px;
}

.sp-list {
  display: grid;
  gap: 10px;
}

.sp-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.sp-card.is-approving {
  opacity: 0;
  transform: translateX(88px);
  transition: opacity 0.36s ease, transform 0.36s ease;
}

.sp-card.is-deleting {
  opacity: 0;
  transform: none;
  transition: opacity 0.22s ease;
}

.sp-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.badge {
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 0.78rem;
  padding: 4px 9px;
}

.sp-meta {
  font-size: 0.9rem;
}

.sp-limit {
  font-family: "Space Grotesk", "Avenir Next", sans-serif;
  font-size: 1.08rem;
  color: var(--text);
}

.sp-inline-field {
  display: grid;
  grid-template-columns: auto minmax(130px, 180px) auto;
  align-items: center;
  gap: 8px;
  margin: 8px 0;
}

.sp-inline-field label {
  margin: 0;
}

.sp-inline-field input {
  margin: 0;
}

.sp-icons {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.sp-icons form {
  margin: 0;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.icon-btn svg {
  display: block;
}

.icon-btn.approve {
  border-color: #2f8b5b;
  color: #2f8b5b;
}

.icon-btn.delete {
  border-color: #8c3838;
  color: #8c3838;
}

.sp-popup {
  position: fixed;
  top: 76px;
  right: 18px;
  max-width: 360px;
  z-index: 90;
  background: #fff;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 14px 16px;
  animation: sp-slide-in 0.22s ease;
}

.sp-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(9, 17, 14, 0.55);
  display: grid;
  place-items: center;
  padding: 20px;
}

.sp-modal[hidden] {
  display: none;
}

.sp-modal-card {
  width: min(560px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 16px;
}

.sp-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.sp-modal-head h2 {
  margin: 0;
}

.sp-modal-close {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  padding: 0;
  font-size: 1.1rem;
  line-height: 1;
}

.sp-popup.is-hidden {
  opacity: 0;
  transform: translateX(24px);
  transition: all 0.2s ease;
}

.sp-popup-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--muted);
  padding: 0;
}

.sp-popup-actions {
  margin-top: 10px;
}

.sp-popup-actions form {
  margin: 0;
}

.sp-toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 95;
  border-radius: 10px;
  background: #193a32;
  color: #fff;
  padding: 9px 12px;
  font-weight: 600;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.sp-toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.tech-create {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f9fcfa;
  padding: 14px;
}

.tech-create-grid {
  display: grid;
  gap: 10px;
}

.tech-board {
  margin-top: 18px;
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(4, minmax(220px, 1fr));
  align-items: start;
}

.tech-column {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f6faf8;
  min-height: 280px;
  display: grid;
  grid-template-rows: auto 1fr;
}

.tech-column-head {
  border-bottom: 1px solid #e5ede8;
  padding: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.tech-column-head h2 {
  margin: 0;
  font-size: 1rem;
}

.tech-column-list {
  padding: 10px;
  display: grid;
  gap: 10px;
  align-content: start;
}

.tech-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  box-shadow: 0 6px 14px rgba(22, 39, 33, 0.06);
  cursor: grab;
}

.tech-card.is-dragging {
  opacity: 0.55;
  transform: rotate(1deg);
  cursor: grabbing;
}

.tech-card h3 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.tech-card-description {
  margin: 0 0 8px;
  white-space: pre-wrap;
}

.tech-card-meta {
  font-size: 0.79rem;
  margin: 0 0 8px;
}

.tech-empty {
  border: 1px dashed #bfd1c8;
  border-radius: 10px;
  padding: 10px;
  color: var(--muted);
  font-size: 0.88rem;
  text-align: center;
}

[data-spend-form] {
  position: relative;
  isolation: isolate;
}

[data-spend-form].is-success-submit {
  animation: spend-form-pulse 0.95s ease;
}

[data-spend-submit] {
  position: relative;
  overflow: visible;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

[data-spend-submit].is-loading {
  pointer-events: none;
  background: #14695d;
  border-color: #14695d;
  box-shadow: 0 0 0 0 rgba(20, 105, 93, 0.25);
}

[data-spend-submit].is-loading::after {
  content: "";
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-left: 8px;
  border: 2px solid rgba(255, 255, 255, 0.65);
  border-top-color: #fff;
  border-radius: 50%;
  vertical-align: -1px;
  animation: spend-spin 0.75s linear infinite;
}

[data-spend-submit].is-done {
  background: linear-gradient(135deg, #1e7e4a 0%, #20a36d 100%);
  border-color: #1e7e4a;
  transform: translateY(-1px) scale(1.02);
  box-shadow: 0 8px 18px rgba(30, 126, 74, 0.25);
}

.spend-burst-dot {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 8px;
  height: 8px;
  margin-left: -4px;
  margin-top: -4px;
  border-radius: 999px;
  background: hsl(var(--hue), 70%, 50%);
  pointer-events: none;
  animation: spend-burst 0.65s cubic-bezier(0.17, 0.88, 0.32, 1.2) forwards;
}

.spend-success-ripple {
  position: absolute;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: 2px solid rgba(53, 178, 135, 0.55);
  background: rgba(53, 178, 135, 0.22);
  transform: translate(-50%, -50%) scale(0.2);
  pointer-events: none;
  z-index: 1;
  animation: spend-ripple 0.8s ease-out forwards;
}

.spend-inline-success {
  position: absolute;
  right: 8px;
  top: -10px;
  z-index: 2;
  border-radius: 999px;
  background: #134f3f;
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 5px 10px;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.spend-inline-success.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.spend-widget.is-live-updated {
  animation: spend-widget-flash 0.9s ease;
}

.spend-filters {
  box-shadow: none;
  background: #fbfdfb;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px 12px;
}

.spend-filters-title {
  margin: 0 0 8px;
  font-size: 1rem;
  font-weight: 600;
}

.spend-filter-grid {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px;
}

.spend-filter-grid form > div,
.spend-filter-grid > div {
  margin-bottom: 0;
}

.spend-filter-field {
  flex: 0 0 auto;
}

.spend-filter-grid label {
  margin-bottom: 4px;
  font-size: 0.85rem;
}

.spend-filter-grid input,
.spend-filter-grid select {
  min-width: 0;
  padding: 8px 9px;
}

.spend-filter-currency select {
  width: 92px;
}

.spend-filter-user select {
  width: 140px;
}

.spend-filter-plan select {
  width: 320px;
  max-width: 36vw;
}

.spend-filter-search input {
  width: 260px;
  max-width: 45vw;
}

.spend-filter-per-page select {
  width: 96px;
}

.spend-filter-actions {
  align-items: flex-end;
  justify-content: flex-start;
}

.spend-filter-actions .btn,
.spend-filter-actions button {
  padding: 8px 12px;
}

.pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 14px;
}

.pagination .is-active {
  border-color: var(--accent);
  background: #d8ece7;
}

.pagination .is-disabled {
  pointer-events: none;
  opacity: 0.45;
}

.spend-live-indicator {
  position: fixed;
  left: 50%;
  top: 78px;
  transform: translate(-50%, -8px);
  z-index: 96;
  border-radius: 999px;
  background: #134f3f;
  color: #fff;
  font-weight: 600;
  font-size: 0.85rem;
  padding: 8px 12px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.spend-live-indicator.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

@keyframes sp-slide-in {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.reveal {
  animation: rise 0.45s ease both;
}

.reveal.delay {
  animation-delay: 0.12s;
}

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

@keyframes spend-form-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(23, 126, 111, 0.18);
    background-color: #ffffff;
  }
  35% {
    box-shadow: 0 0 0 10px rgba(23, 126, 111, 0.06);
    background-color: #f0fbf6;
  }
  100% {
    box-shadow: 0 0 0 0 rgba(23, 126, 111, 0);
    background-color: #ffffff;
  }
}

@keyframes spend-spin {
  from {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

@keyframes spend-burst {
  from {
    opacity: 0.95;
    transform: translate(-50%, -50%) scale(1);
  }
  to {
    opacity: 0;
    transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(0.25);
  }
}

@keyframes spend-ripple {
  from {
    opacity: 0.85;
    transform: translate(-50%, -50%) scale(0.2);
  }
  to {
    opacity: 0;
    transform: translate(-50%, -50%) scale(15);
  }
}

@keyframes spend-widget-flash {
  0% {
    box-shadow: 0 0 0 0 rgba(23, 126, 111, 0.3);
    transform: translateY(0);
  }
  35% {
    box-shadow: 0 0 0 14px rgba(23, 126, 111, 0.06);
    transform: translateY(-2px);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(23, 126, 111, 0);
    transform: translateY(0);
  }
}

@keyframes dash-progress-init {
  from {
    width: 0;
  }
  to {
    width: var(--progress-target, 0%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .dash-progress-fill {
    animation: none;
  }
}

@media (max-width: 640px) {
  .nav-shell {
    align-items: flex-start;
    flex-direction: column;
  }

  .page {
    margin-top: 16px;
  }

  .spend-filter-plan select,
  .spend-filter-search input {
    width: 100%;
    max-width: none;
  }
}

@media (max-width: 1020px) {
  .tech-board {
    grid-template-columns: repeat(2, minmax(220px, 1fr));
  }
}

@media (max-width: 740px) {
  .tech-board {
    grid-template-columns: 1fr;
  }
}
