@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;600&display=swap');

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

html { font-size: 14px; scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  background: var(--bg-page);
  background-image: var(--gradient-bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

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

h1 { font-size: 22px; font-weight: 700; color: var(--text); }
h2 { font-size: 16px; font-weight: 600; color: var(--text); }

.mono { font-family: var(--font-mono); }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #D4D4D8; border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: #A1A1AA; }

::selection { background: rgba(99, 102, 241, 0.2); color: var(--text); }

@keyframes flashOnline {
  0%   { background: var(--success-bg); }
  100% { background: transparent; }
}
@keyframes flashOffline {
  0%   { background: rgba(255, 68, 102, 0.15); }
  100% { background: transparent; }
}
.flash-online  { animation: flashOnline  1.5s ease-out; }
.flash-offline { animation: flashOffline 1.5s ease-out; }

#toast-container {
  position: fixed;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 9999;
}
.toast {
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  color: var(--on-primary);
  box-shadow: var(--shadow-lg), var(--glow-sm);
  animation: toastIn .3s cubic-bezier(0.34, 1.56, 0.64, 1);
  max-width: 320px;
  backdrop-filter: blur(12px);
}
@keyframes toastIn {
  from { opacity: 0; transform: translateY(12px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.toast.success { background: var(--gradient-success); }
.toast.error   { background: var(--gradient-danger); color: #fff; }
.toast.info    { background: var(--gradient-primary); }
.toast.warning { background: var(--gradient-warning); color: #FFFFFF; }

.overlay {
  position: fixed; inset: 0;
  background: var(--overlay-bg);
  display: flex; align-items: center; justify-content: center;
  z-index: 8000;
  backdrop-filter: blur(8px);
  padding: 16px;
}
.dialog {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 24px;
  width: 400px;
  max-width: 100%;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(20px);
  max-height: 90vh;
  overflow-y: auto;
}
.dialog-title  { font-size: 17px; font-weight: 700; margin-bottom: 10px; color: var(--text); }
.dialog-body   { font-size: 13px; color: var(--text-secondary); margin-bottom: 20px; line-height: 1.6; }
.dialog-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 14px;
}
.form-grid-lic {
  display: grid;
  grid-template-columns: repeat(6, 1fr) auto;
  gap: 12px;
  align-items: end;
}
@media (max-width: 900px) {
  .form-grid-lic { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 600px) {
  .form-grid-2 { grid-template-columns: 1fr; }
  .form-grid-lic { grid-template-columns: 1fr 1fr; }
}
