:root {
  --bg: #f8fafc;
  --bg-card: #ffffff;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --radius: 16px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

h1,
 h2,
 h3 {
  margin: 0 0 0.5rem 0;
}

p {
  margin: 0;
}

#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.view {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

#main-view {
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  padding: 0;
}

.view.hidden {
  display: none;
}

.login-card {
  width: min(420px, 100%);
  background: var(--bg-card);
  padding: 2rem;
  border-radius: var(--radius);
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.08);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.subtitle {
  color: var(--muted);
}

label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted);
}

input,
 textarea,
 select {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 1rem;
  background: #fff;
  color: var(--text);
}

textarea {
  resize: vertical;
}

button {
  font: inherit;
  cursor: pointer;
  border-radius: 999px;
  border: none;
  padding: 0.75rem 1.5rem;
  transition: background 0.2s ease;
}

button.primary {
  background: var(--primary);
  color: #fff;
}

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

button.ghost {
  background: rgba(37, 99, 235, 0.1);
  color: var(--primary);
}

button.ghost:hover {
  background: rgba(37, 99, 235, 0.2);
}

button.full {
  width: 100%;
}

.form-feedback {
  min-height: 1.25rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  background: var(--bg-card);
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.05);
}

.tab-bar {
  display: flex;
  overflow-x: auto;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: var(--bg);
}

.tab-button {
  background: rgba(15, 23, 42, 0.04);
  color: var(--muted);
  padding: 0.6rem 1rem;
}

.tab-button.active {
  background: var(--primary);
  color: #fff;
}

.panels {
  flex: 1;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.panel {
  display: none;
  flex-direction: column;
  gap: 1rem;
}

.panel.active {
  display: flex;
}

.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.05);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
}

.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: inset 0 0 0 1px var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.amount {
  font-size: 1.5rem;
  font-weight: 700;
}

.form-grid {
  display: grid;
  gap: 0.75rem;
}

.form-actions {
  display: flex;
  gap: 0.5rem;
}

.list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.75rem;
}

.list li {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  box-shadow: inset 0 0 0 1px var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.table-scroll {
  overflow-x: auto;
}

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

thead {
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
}

thead th {
  text-align: left;
  padding-bottom: 0.75rem;
}

tbody td {
  padding: 0.5rem 0;
  border-top: 1px solid var(--border);
}

.logo-preview {
  width: 120px;
  height: 120px;
  object-fit: contain;
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.05);
  padding: 0.5rem;
  display: none;
}

.inline-form {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: flex-end;
}

.inline-form > div {
  flex: 1 1 120px;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

@media (min-width: 960px) {
  #app {
    background: linear-gradient(180deg, rgba(148, 163, 184, 0.2), transparent);
  }

  .view {
    align-items: stretch;
  }

  #main-view {
    max-width: 1100px;
    margin: 1rem auto;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 30px 60px rgba(15, 23, 42, 0.12);
  }

  .panels {
    max-height: calc(100vh - 200px);
    overflow-y: auto;
  }
}
