:root {
  --bg-main: #000000;
  --bg-card: #1c1c1e;
  --bg-hover: #262629;
  --text-main: #ffffff;
  --text-muted: #a1a1aa;
  --accent-red: #ff5a5f;
  --accent-green: #00d26a;
  --border-color: #2c2c2e;
  --border-radius-lg: 12px;
  --border-radius-sm: 8px;
  --font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial,
    sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.5;
}

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 3rem 1.5rem;
}

h1 {
  font-size: 2.2rem;
  margin-bottom: 0.3rem;
  letter-spacing: -0.5px;
}
h2 {
  font-size: 1.4rem;
  font-weight: 600;
}
.subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 2rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.view {
  display: none;
}
.view.active {
  display: block;
  animation: fadeIn 0.3s ease-out;
}
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.text-red {
  color: var(--accent-red) !important;
  font-weight: 600;
}
.text-green {
  color: var(--accent-green) !important;
  font-weight: 600;
}
.text-muted {
  color: var(--text-muted);
}

/* KARTY - GŁÓWNE (Top) */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 2.5rem;
}
.summary-card {
  background-color: var(--bg-card);
  border-radius: var(--border-radius-lg);
  padding: 1.5rem 2rem;
}
.summary-card span {
  color: var(--text-muted);
  font-size: 0.9rem;
  display: block;
  margin-bottom: 0.5rem;
}
.summary-card strong {
  font-size: 2.2rem;
  font-weight: 700;
}

/* LISTA DŁUŻNIKÓW */
.persons-list {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}
.person-row {
  background-color: var(--bg-card);
  border-radius: var(--border-radius-lg);
  padding: 1.2rem 1.5rem;
  display: flex;
  align-items: center;
  cursor: pointer;
  transition: background-color 0.2s;
}
.person-row:hover {
  background-color: var(--bg-hover);
}

.rank {
  color: var(--text-muted);
  font-size: 0.95rem;
  width: 40px;
  font-weight: 500;
}

.avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background-color: #2c2c2e;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 1.5rem;
  font-size: 1.2rem;
  font-weight: 500;
}

.person-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.person-info .name {
  font-weight: 600;
  font-size: 1.15rem;
}
.person-info .date {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.person-balance-info {
  text-align: right;
}
.person-balance-info .amount {
  font-size: 1.2rem;
}
.person-balance-info .status {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* WIDOK DETALI */
.back-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 2rem;
  padding: 0;
  transition: color 0.2s;
}
.back-btn:hover {
  color: var(--text-main);
}

.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 2.5rem;
}
.detail-user-info {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}
.detail-user-info .avatar {
  width: 80px;
  height: 80px;
  font-size: 2.2rem;
}
.debt-card {
  background-color: var(--bg-card);
  border-radius: var(--border-radius-lg);
  padding: 1.2rem 2rem;
  text-align: right;
  min-width: 180px;
}
.action-buttons {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

/* HISTORIA TRANZAKCJI */
.history-container {
  background-color: var(--bg-card);
  border-radius: var(--border-radius-lg);
  padding: 0 1.5rem;
}
.transaction-row {
  display: flex;
  align-items: center;
  padding: 1.2rem 0;
  border-bottom: 1px solid var(--border-color);
}
.transaction-row:last-child {
  border-bottom: none;
}

.tx-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 1.2rem;
}
.tx-icon.up {
  color: var(--accent-red);
  background-color: rgba(255, 90, 95, 0.1);
}
.tx-icon.down {
  color: var(--accent-green);
  background-color: rgba(0, 210, 106, 0.1);
}

.tx-info {
  flex: 1;
}
.tx-date {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.tx-desc {
  font-size: 1rem;
  color: #ececec;
}
.tx-amount {
  font-size: 1.1rem;
}
.tx-actions {
  margin-left: 15px;
  display: flex;
  gap: 8px;
}

/* BUTONY AKCJI */
.btn-icon {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-icon:hover {
  color: var(--text-main);
}
.btn-icon.small i {
  width: 16px;
  height: 16px;
}
.btn-icon.text-red:hover {
  color: var(--accent-red);
}

/* MODAL */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}
.modal.active {
  display: flex;
  animation: fadeIn 0.2s ease-out;
}
.modal-content {
  background-color: var(--bg-card);
  border-radius: var(--border-radius-lg);
  width: 90%;
  max-width: 400px;
  border: 1px solid var(--border-color);
  overflow: hidden;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
}
.modal-header {
  padding: 1.2rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-header h3 {
  margin: 0;
  font-size: 1.1rem;
}
.modal-body {
  padding: 1.5rem;
}
.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 0.8rem;
}
.form-group {
  margin-bottom: 1.2rem;
}
.form-group label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}
.form-input {
  width: 100%;
  padding: 0.85rem 1rem;
  background-color: var(--bg-main);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  border-radius: var(--border-radius-sm);
  font-family: inherit;
  font-size: 1rem;
  transition: border-color 0.2s;
}
.form-input:focus {
  outline: none;
  border-color: var(--text-muted);
}
.btn {
  padding: 0.7rem 1.4rem;
  border-radius: var(--border-radius-sm);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition:
    background-color 0.2s,
    opacity 0.2s;
}
.btn:hover {
  opacity: 0.9;
}
.btn.text-muted {
  background: transparent;
  color: var(--text-muted);
}
.btn.text-muted:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
}
.btn.primary {
  background-color: var(--text-main);
  color: var(--bg-main);
}
.btn.danger {
  background-color: var(--accent-red);
  color: var(--text-main);
}
/* LOGIN STYLES */
.login-container {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  margin: -3rem -1.5rem;
  padding: 2rem 1.5rem;
}

.login-form {
  width: 100%;
  max-width: 320px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  padding: 2rem;
}

.login-form header {
  text-align: center;
  margin-bottom: 2rem;
}

.login-form header h1 {
  margin-bottom: 0.5rem;
}

.login-form .subtitle {
  justify-content: center;
}

.login-note {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: 1rem;
}
