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

#milk-slosh {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  display: none;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #1a1a2e;
  color: #e8e8e8;
  min-height: 100vh;
  overflow: hidden;
}

.app-container {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  background: linear-gradient(135deg, #16213e 0%, #1a1a2e 100%);
  border-radius: 12px;
  margin-bottom: 1.5rem;
  border: 1px solid #2a2a4a;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo-icon {
  font-size: 2rem;
}

.logo-text {
  font-size: 1.5rem;
  font-weight: 600;
  background: linear-gradient(135deg, #00d9ff, #7c3aed);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.user-name {
  color: #a0a0c0;
  font-size: 0.95rem;
}

.home-link {
  color: #7c3aed;
  text-decoration: none;
  font-size: 0.9rem;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  background: rgba(124, 58, 237, 0.1);
  transition: all 0.2s;
}

.home-link:hover {
  background: rgba(124, 58, 237, 0.2);
}

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  overflow: hidden;
}

.balance-section {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.balance-card {
  flex: 1;
  min-width: 280px;
  background: linear-gradient(135deg, #7c3aed 0%, #5b21b6 100%);
  border-radius: 16px;
  padding: 2rem;
  text-align: center;
  box-shadow: 0 8px 32px rgba(124, 58, 237, 0.3);
}

.balance-label {
  font-size: 1rem;
  color: rgba(255, 255, 255, 0.8);
  margin-bottom: 0.5rem;
}

.balance-amount {
  font-size: 3rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.balance-updated {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.6);
  margin-top: 0.5rem;
}

.exchange-rate-card {
  background: linear-gradient(135deg, #0d3340 0%, #0a2030 100%);
  border: 1px solid #1a5a70;
  border-radius: 16px;
  padding: 1.25rem 1.5rem;
  min-width: 280px;
  box-shadow: 0 4px 20px rgba(0, 180, 220, 0.12);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  justify-content: center;
}

.er-label {
  font-size: 0.85rem;
  color: #5ab8d0;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.er-rate {
  font-size: 1.85rem;
  font-weight: 700;
  color: #00d9ff;
  text-shadow: 0 0 12px rgba(0, 217, 255, 0.3);
  white-space: nowrap;
}

.er-unit {
  font-size: 1rem;
  font-weight: 400;
  color: #4ab8cc;
}

.er-sub {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.er-mean {
  font-size: 0.8rem;
  color: #5090a0;
}

.er-badge {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 20px;
  display: none;
}

.er-badge.above {
  display: inline;
  background: rgba(16, 185, 129, 0.2);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.er-badge.below {
  display: inline;
  background: rgba(245, 158, 11, 0.2);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.35);
}

.er-updated {
  font-size: 0.75rem;
  color: #3a7080;
}

.er-chart-container {
  margin-top: 0.5rem;
  height: 72px;
  position: relative;
  overflow: hidden;
  border-radius: 6px;
  background: #060c12;
}

.er-full-chart-btn {
  margin-top: 0.5rem;
  background: rgba(20, 60, 80, 0.6);
  border: 1px solid rgba(80, 160, 200, 0.3);
  border-radius: 0.35rem;
  color: #5ab8d0;
  font-size: 0.78rem;
  padding: 0.25rem 0.7rem;
  cursor: pointer;
  font-family: monospace;
  transition: background 0.15s;
  width: 100%;
}

.er-full-chart-btn:hover {
  background: rgba(30, 80, 110, 0.7);
  color: #90d8f8;
}

.quick-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.action-btn {
  flex: 1;
  min-width: 120px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 1.25rem 1rem;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 500;
  transition: all 0.2s;
  color: #fff;
}

.action-icon {
  font-size: 1.5rem;
}

.deposit-btn {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.deposit-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.withdraw-btn {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.withdraw-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
}

.transfer-btn {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}

.transfer-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.market-btn {
  background: linear-gradient(135deg, #166534 0%, #14532d 100%);
  border-color: rgba(74, 222, 128, 0.3);
}

.market-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(74, 222, 128, 0.3);
}

.transactions-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #16213e;
  border-radius: 16px;
  border: 1px solid #2a2a4a;
  overflow: hidden;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid #2a2a4a;
}

.section-header h2 {
  font-size: 1.1rem;
  font-weight: 600;
  color: #e0e0e0;
}

.filter-controls select {
  background: #1a1a2e;
  color: #e0e0e0;
  border: 1px solid #3a3a5a;
  border-radius: 8px;
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  cursor: pointer;
}

.transactions-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem;
}

.loading {
  text-align: center;
  padding: 2rem;
  color: #808090;
}

.transaction-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  margin: 0.25rem 0;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 10px;
  transition: background 0.2s;
}

.transaction-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.tx-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.tx-icon.deposit {
  background: rgba(16, 185, 129, 0.2);
}

.tx-icon.withdrawal {
  background: rgba(245, 158, 11, 0.2);
}

.tx-icon.transfer_in {
  background: rgba(59, 130, 246, 0.2);
}

.tx-icon.transfer_out {
  background: rgba(139, 92, 246, 0.2);
}

.tx-details {
  flex: 1;
  min-width: 0;
}

.tx-description {
  font-size: 0.95rem;
  color: #e0e0e0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tx-date {
  font-size: 0.8rem;
  color: #707080;
  margin-top: 0.25rem;
}

.tx-amount {
  font-size: 1.1rem;
  font-weight: 600;
  text-align: right;
}

.tx-amount.positive {
  color: #10b981;
}

.tx-amount.negative {
  color: #f59e0b;
}

.tx-balance {
  font-size: 0.8rem;
  color: #707080;
  text-align: right;
  margin-top: 0.25rem;
}

.empty-state {
  text-align: center;
  padding: 3rem;
  color: #606070;
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s;
  z-index: 100;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  background: #1a1a2e;
  border-radius: 16px;
  border: 1px solid #3a3a5a;
  padding: 1.5rem;
  width: 90%;
  max-width: 400px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s;
  z-index: 101;
}

.modal.active {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, -50%) scale(1);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.modal-header h3 {
  font-size: 1.2rem;
  font-weight: 600;
  color: #e0e0e0;
}

.modal-close {
  background: none;
  border: none;
  color: #808090;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.25rem;
  line-height: 1;
}

.modal-close:hover {
  color: #e0e0e0;
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-size: 0.9rem;
  color: #a0a0b0;
  margin-bottom: 0.5rem;
}

.form-group input {
  width: 100%;
  padding: 0.75rem 1rem;
  background: #16213e;
  border: 1px solid #3a3a5a;
  border-radius: 10px;
  color: #e0e0e0;
  font-size: 1rem;
}

.form-group input:focus {
  outline: none;
  border-color: #7c3aed;
}

.submit-btn {
  width: 100%;
  padding: 0.875rem;
  background: linear-gradient(135deg, #7c3aed 0%, #5b21b6 100%);
  border: none;
  border-radius: 10px;
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.submit-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.4);
}

.submit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #16213e;
  border: 1px solid #3a3a5a;
  border-radius: 10px;
  padding: 1rem 1.5rem;
  color: #e0e0e0;
  font-size: 0.95rem;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s;
  z-index: 200;
}

.toast.active {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.toast.success {
  border-color: #10b981;
}

.toast.error {
  border-color: #ef4444;
}

/* The Syndicate */
.syndicate-section {
  margin-top: 0.5rem;
}

.syndicate-card {
  background: linear-gradient(135deg, #1a0a0a 0%, #2d1515 100%);
  border: 1px solid #4a2020;
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: 0 4px 20px rgba(100, 0, 0, 0.3);
}

.syndicate-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.syndicate-icon {
  font-size: 1.5rem;
  filter: drop-shadow(0 0 8px rgba(200, 50, 50, 0.5));
}

.syndicate-title {
  font-size: 1.3rem;
  font-weight: 700;
  color: #c83232;
  text-transform: uppercase;
  letter-spacing: 2px;
}

.syndicate-tagline {
  font-size: 0.85rem;
  color: #808080;
  font-style: italic;
  margin-bottom: 1rem;
}

.syndicate-content {
  min-height: 80px;
}

.syndicate-available {
  text-align: center;
}

.syndicate-offer {
  color: #d0d0d0;
  margin-bottom: 0.5rem;
}

.syndicate-limit {
  color: #10b981;
  font-weight: 600;
  margin-bottom: 1rem;
}

.syndicate-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 600;
  transition: all 0.2s;
}

.borrow-btn {
  background: linear-gradient(135deg, #7c2d2d 0%, #5c1515 100%);
  color: #fff;
}

.borrow-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(124, 45, 45, 0.5);
}

.repay-btn {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #fff;
  width: 100%;
  margin-top: 1rem;
}

.repay-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.syndicate-debt {
  padding: 1rem;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 10px;
}

.debt-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.debt-label {
  color: #a0a0a0;
  font-size: 0.9rem;
}

.debt-amount {
  font-size: 1.5rem;
  font-weight: 700;
  color: #ef4444;
}

.debt-details {
  margin-bottom: 0.5rem;
}

.debt-row {
  display: flex;
  justify-content: space-between;
  padding: 0.3rem 0;
  font-size: 0.9rem;
  color: #c0c0c0;
}

.debt-row.overdue .time-remaining {
  color: #ef4444;
  font-weight: 700;
  animation: pulse-warning 1s infinite;
}

@keyframes pulse-warning {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.threat-warning {
  background: rgba(239, 68, 68, 0.2);
  border: 1px solid rgba(239, 68, 68, 0.5);
  border-radius: 8px;
  padding: 0.75rem;
  margin-top: 0.75rem;
  font-size: 0.85rem;
  color: #ef4444;
  text-align: center;
}

.syndicate-debt.threat-level-1 {
  border-left: 3px solid #f59e0b;
}

.syndicate-debt.threat-level-2 {
  border-left: 3px solid #ef4444;
}

.syndicate-debt.threat-level-3 {
  border-left: 3px solid #dc2626;
  animation: threat-pulse 2s infinite;
}

.syndicate-debt.threat-level-4,
.syndicate-debt.threat-level-5 {
  border-left: 3px solid #991b1b;
  animation: threat-pulse 1s infinite;
  background: rgba(100, 0, 0, 0.3);
}

@keyframes threat-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
  50% { box-shadow: 0 0 20px 5px rgba(239, 68, 68, 0.2); }
}

.syndicate-modal .modal-header {
  background: linear-gradient(135deg, #2d1515 0%, #1a0a0a 100%);
  margin: -1.5rem -1.5rem 1rem -1.5rem;
  padding: 1rem 1.5rem;
  border-radius: 16px 16px 0 0;
}

.syndicate-modal .modal-header h3 {
  color: #c83232;
}

.syndicate-warning {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 8px;
  padding: 0.75rem;
  margin-bottom: 1rem;
  font-size: 0.85rem;
  color: #f87171;
  text-align: center;
}

.syndicate-submit {
  background: linear-gradient(135deg, #7c2d2d 0%, #5c1515 100%) !important;
}

.syndicate-submit:hover {
  box-shadow: 0 4px 12px rgba(124, 45, 45, 0.5) !important;
}

.syndicate-error {
  color: #808080;
  text-align: center;
  padding: 1rem;
}

/* Unit settings button */
.settings-btn {
  background: rgba(100, 160, 255, 0.08);
  border: 1px solid rgba(100, 160, 255, 0.3);
  color: #88b4f8;
  border-radius: 8px;
  padding: 0.4rem 0.85rem;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
}

.settings-btn:hover {
  background: rgba(100, 160, 255, 0.18);
  border-color: rgba(100, 160, 255, 0.5);
}

/* Settings modal body */
.settings-body {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.settings-desc {
  font-size: 0.9rem;
  color: #9090a8;
}

.unit-options {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.unit-option {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.7rem 1rem;
  border-radius: 10px;
  border: 1px solid #2a2a4a;
  cursor: pointer;
  transition: all 0.2s;
}

.unit-option:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(100, 160, 255, 0.35);
}

.unit-option input[type="radio"] {
  accent-color: #7c3aed;
  width: 1.1rem;
  height: 1.1rem;
  flex-shrink: 0;
  cursor: pointer;
}

.unit-option-content {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.unit-option-name {
  font-size: 0.95rem;
  font-weight: 500;
  color: #e0e0e0;
}

.unit-option-desc {
  font-size: 0.78rem;
  color: #707090;
}

/* Security Center button */
.security-center-btn {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #f87171;
  border-radius: 8px;
  padding: 0.4rem 0.85rem;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
}

.security-center-btn:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.6);
}

/* Security notice banner */
.security-notice {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: 10px;
  padding: 0.6rem 1rem;
  margin-bottom: 0.75rem;
  font-size: 0.83rem;
  color: #d4a84b;
  flex-shrink: 0;
}

.security-notice.dismissed {
  display: none;
}

.security-notice-icon {
  font-size: 1rem;
  flex-shrink: 0;
}

.security-notice-text {
  flex: 1;
  color: #c8a84a;
}

.security-notice-text strong {
  color: #e0b85a;
}

.security-notice-link {
  background: none;
  border: none;
  color: #f59e0b;
  cursor: pointer;
  font-size: 0.83rem;
  text-decoration: underline;
  padding: 0;
}

.security-notice-link:hover {
  color: #fbbf24;
}

.security-notice-close {
  background: none;
  border: none;
  color: #806030;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0 0.25rem;
  line-height: 1;
  flex-shrink: 0;
}

.security-notice-close:hover {
  color: #c8a84a;
}

/* Security modal */
.security-modal {
  max-width: 620px;
  width: 95%;
  max-height: 85vh;
  flex-direction: column;
}

.security-modal.active {
  display: flex;
  flex-direction: column;
}

.security-modal-header {
  background: linear-gradient(135deg, #1a1230 0%, #12101e 100%);
  margin: -1.5rem -1.5rem 0 -1.5rem;
  padding: 1rem 1.5rem;
  border-radius: 16px 16px 0 0;
  border-bottom: 1px solid #3a3a5a;
}

.security-modal-header h3 {
  color: #c0b0e0 !important;
}

.security-modal-body {
  overflow-y: auto;
  flex: 1;
  padding: 1rem 0.25rem 0 0;
}

.security-section {
  border-left: 3px solid #3a3a5a;
  padding: 1rem 0 1rem 1rem;
  margin-bottom: 1rem;
}

.security-section:last-child {
  margin-bottom: 0;
}

.security-section-title {
  font-size: 1rem;
  font-weight: 700;
  color: #c0b0e0;
  margin-bottom: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.security-section p {
  font-size: 0.875rem;
  color: #b0b0c8;
  line-height: 1.6;
  margin-bottom: 0.65rem;
}

.security-section ul,
.security-section ol {
  font-size: 0.875rem;
  color: #a0a0b8;
  line-height: 1.6;
  margin: 0.5rem 0 0.65rem 1.5rem;
}

.security-section li {
  margin-bottom: 0.3rem;
}

.security-section strong {
  color: #d0c8e8;
}

.security-section em {
  color: #c0b8d8;
}

.security-callout {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  color: #d08080 !important;
  font-size: 0.84rem !important;
}

.security-callout-example {
  background: rgba(124, 58, 237, 0.08) !important;
  border-color: rgba(124, 58, 237, 0.25) !important;
  color: #b090d8 !important;
}

.password-redacted {
  display: inline-block;
  background: #2a1a4a;
  color: #2a1a4a;
  border-radius: 4px;
  padding: 0 0.4rem;
  user-select: none;
  font-family: monospace;
  letter-spacing: 2px;
}

.security-section-last {
  border-left-color: #4a3a6a;
  padding-top: 1.25rem;
}

.security-footer-text {
  font-style: italic;
  color: #808090 !important;
  font-size: 0.82rem !important;
  margin-bottom: 1rem !important;
  text-align: center;
}

@media (max-width: 600px) {
  .app-container {
    padding: 0.75rem;
  }

  .header {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }

  .balance-amount {
    font-size: 2.25rem;
  }

  .quick-actions {
    flex-direction: column;
  }

  .action-btn {
    flex-direction: row;
    justify-content: center;
  }
}
