:root {
  --bg: #0b1220;
  --surface: #111a2e;
  --surface-soft: #18243d;
  --text: #e6edf7;
  --muted: #9bb0ce;
  --line: #2a3a57;
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --danger: #fb7185;
  --radius: 12px;
  --shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 15% 20%, #1d2d4e 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, #112846 0%, transparent 35%),
    var(--bg);
}

h1,
h2,
p {
  margin: 0;
}

a {
  color: #93c5fd;
}

.login-shell {
  min-height: 100vh;
  width: min(100% - 2rem, 980px);
  margin: 0 auto;
  display: grid;
  align-content: center;
  gap: 1rem;
  padding: 2rem 0;
}

.landing-shell {
  min-height: 100vh;
  width: min(100% - 2rem, 1600px);
  margin: 0 auto;
  display: grid;
  align-content: center;
  gap: 1rem;
  padding: 2rem 0;
}

.login-card,
.landing-card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.login-card {
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
  padding: 1.6rem;
}

.landing-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.2rem 1.4rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.landing-card {
  padding: 1.4rem;
}

h1 {
  letter-spacing: 0.05em;
  font-size: clamp(1.2rem, 2.5vw, 1.7rem);
}

.login-card h1 {
  text-align: center;
  margin-bottom: 1rem;
}

h2 {
  font-size: 1.2rem;
  margin-bottom: 0.5rem;
}

.subtitle,
.onboarding-note,
#welcome-text,
.api-state {
  color: var(--muted);
}

.onboarding-note {
  margin-top: 0.45rem;
  margin-bottom: 1.15rem;
}

#login-form {
  display: grid;
  gap: 0.65rem;
}

label {
  font-size: 0.92rem;
  color: var(--muted);
}

input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
  color: var(--text);
  padding: 0.72rem 0.8rem;
  font-size: 0.98rem;
}

input:focus {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}

select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
  color: var(--text);
  padding: 0.72rem 0.8rem;
  font-size: 0.98rem;
}

select:focus {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}

button {
  border: 0;
  border-radius: 10px;
  padding: 0.72rem 1rem;
  background: var(--primary);
  color: #eff6ff;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.18s ease;
}

button:hover {
  background: var(--primary-hover);
}

button:disabled {
  opacity: 0.7;
  cursor: wait;
}

.secondary-btn {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
}

.secondary-btn:hover {
  background: var(--surface-soft);
}

.status {
  min-height: 1.15rem;
  margin-top: 0.2rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.status.error {
  color: var(--danger);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem 1rem;
  margin-top: 0.9rem;
}

.transaction-filters {
  grid-template-columns: minmax(240px, 1fr) auto auto auto auto;
  align-items: end;
}

.short-input {
  width: 160px;
}

.form-grid .full-width {
  grid-column: 1 / -1;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.checkbox-row input {
  width: auto;
}

.checkbox-row label {
  margin: 0;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.tag-filter-panel {
  margin-top: 0.9rem;
  padding: 0.9rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
  display: grid;
  gap: 0.8rem;
}

.tag-filter-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.tag-filter-header h3 {
  margin: 0;
  font-size: 0.96rem;
}

.tag-mode-group {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.tag-mode-group label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  font-size: 0.9rem;
}

.tag-filter-caption {
  margin: 0 0 0.35rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.available-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.tag-chip {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  border-radius: 999px;
  padding: 0.25rem 0.55rem;
  font-size: 0.82rem;
  line-height: 1.2;
}

.tag-chip.active {
  background: rgba(37, 99, 235, 0.2);
  border-color: rgba(147, 197, 253, 0.5);
}

.tag-select {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
}

.tag-select input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.tx-tag-btn {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  border-radius: 999px;
  padding: 0.15rem 0.48rem;
  font-size: 0.78rem;
  cursor: pointer;
}

.tx-tag-btn:hover {
  background: rgba(255, 255, 255, 0.06);
}

.tx-tag-btn.active {
  background: rgba(37, 99, 235, 0.2);
  border-color: rgba(147, 197, 253, 0.5);
}

.table-wrap {
  margin-top: 0.9rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th,
td {
  padding: 0.65rem 0.7rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 0.92rem;
}

th {
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
}

tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.empty-row {
  text-align: center;
  color: var(--muted);
}

.edit-btn {
  padding: 0.45rem 0.7rem;
  font-size: 0.82rem;
}

.pager {
  margin-top: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.65rem;
}

#page-info {
  color: var(--muted);
  font-size: 0.92rem;
}

.side-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: min(100%, 430px);
  height: 100vh;
  padding: 1rem;
  background: rgba(3, 8, 18, 0.78);
  backdrop-filter: blur(3px);
  display: grid;
  align-content: center;
  z-index: 20;
}

.side-panel[hidden] {
  display: none;
}

.panel-card {
  max-height: calc(100vh - 2rem);
  overflow: auto;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

@media (max-width: 640px) {
  .login-shell,
  .landing-shell {
    width: min(100% - 1rem, 980px);
  }

  .landing-header,
  .landing-card,
  .login-card {
    padding: 1rem;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .transaction-filters {
    grid-template-columns: 1fr;
  }

  .short-input {
    width: 100%;
  }

  .tag-filter-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .pager {
    justify-content: space-between;
  }
}
