:root {
  --primary: #2563EB;
  --primary-dark: #1D4ED8;
  --primary-soft: #EFF6FF;
  --secondary: #10B981;
  --secondary-dark: #047857;
  --secondary-soft: #D1FAE5;
  --background: #F3F4F6;
  --surface: #FFFFFF;
  --text-main: #1F2937;
  --text-muted: #6B7280;
  --border: #E5E7EB;
  
  --grad-1-start: #3B82F6;
  --grad-1-end: #1D4ED8;
  --grad-2-start: #10B981;
  --grad-2-end: #047857;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--background);
  color: var(--text-main);
  min-height: 100dvh;
  line-height: 1.6;
  font-size: 15px;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea {
  font: inherit;
  touch-action: manipulation;
}

button {
  cursor: pointer;
  border: 0;
  background: none;
  transition: transform 0.15s ease, background 0.15s ease, opacity 0.15s ease;
}

button:active {
  transform: scale(0.97);
}

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

button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 3px solid #93c5fd;
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

h1, h2, h3, h4, p {
  margin: 0;
}

h1 { font-size: 1.8rem; font-weight: 700; letter-spacing: -0.03em; }
h2 { font-size: 1.35rem; font-weight: 700; letter-spacing: -0.02em; }
h3 { font-size: 1.05rem; font-weight: 600; }
a { color: var(--primary); text-decoration: none; }

.app {
  width: 100%;
  min-height: 100dvh;
}

/* Primary, Outline & Danger Buttons */
.primary, .outline, .danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 11px 20px;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.4;
  text-align: center;
}

.primary {
  background: var(--primary);
  color: #FFFFFF;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

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

.outline {
  border: 1px solid #BFDBFE;
  background: #FFFFFF;
  color: var(--primary);
}

.outline:hover {
  background: var(--primary-soft);
}

.danger {
  color: #B91C1C;
  background: #FEF2F2;
  border: 1px solid #FECACA;
}

.danger:hover {
  background: #FEE2E2;
}

.full {
  width: 100%;
}

.text-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--primary);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 8px;
}

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

/* Forms & Fields */
.field {
  display: block;
  margin: 16px 0;
  min-width: 0;
}

.field > span, .password-label label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 7px;
  color: var(--text-main);
}

.field input, .field select, .field textarea {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 48px;
  border: 1px solid var(--border);
  background: #F9FAFB;
  border-radius: 10px;
  padding: 11px 14px;
  color: var(--text-main);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--primary);
  background: #FFFFFF;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.field input::placeholder, .field textarea::placeholder {
  color: #9CA3AF;
  font-size: 0.9rem;
}

.field textarea {
  min-height: 96px;
  resize: vertical;
}

.field .hint, .hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 6px;
  line-height: 1.5;
}

.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-error {
  color: #B91C1C;
  font-size: 0.88rem;
  background: #FEF2F2;
  border: 1px solid #FECACA;
  border-radius: 10px;
  padding: 12px 14px;
  margin: 14px 0;
}

.form-error:empty {
  display: none;
}

.private-note {
  font-size: 0.82rem;
  background: var(--primary-soft);
  color: #1E40AF;
  border-radius: 10px;
  padding: 10px 14px;
  margin-top: 12px;
  line-height: 1.5;
}

.note {
  font-size: 0.85rem;
  background: #F8FAFC;
  border-inline-start: 3px solid var(--primary);
  padding: 10px 14px;
  margin-top: 12px;
  border-radius: 0 8px 8px 0;
  line-height: 1.6;
}

/* Status Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  line-height: 1.4;
}

.badge.approved, .badge.confirmed, .badge.completed, .badge.verified, .badge.paid {
  color: #047857;
  background: #D1FAE5;
}

.badge.submitted, .badge.nominated, .badge.pending, .badge.unpaid {
  color: #B45309;
  background: #FEF3C7;
}

.badge.published, .badge.reviewed, .badge.applied, .badge.unread {
  color: #1D4ED8;
  background: #EFF6FF;
}

.badge.cancelled, .badge.rejected, .badge.disputed, .badge.inactive {
  color: #B91C1C;
  background: #FEE2E2;
}

/* Dialogs & Modal */
dialog {
  border: none;
  border-radius: 20px;
  padding: 26px;
  width: min(580px, calc(100vw - 32px));
  max-height: 90dvh;
  overflow: auto;
  margin: auto;
  color: var(--text-main);
  background: #FFFFFF;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.2);
}

dialog::backdrop {
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
}

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.dialog-head h2 {
  font-size: 1.3rem;
  color: var(--text-main);
}

.dialog-head .icon-button {
  background: #F3F4F6;
  color: var(--text-muted);
}

/* Toast */
.toast {
  position: fixed;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 24px;
  background: #10B981;
  color: #FFFFFF;
  border-radius: 30px;
  box-shadow: 0 10px 25px -3px rgba(16, 185, 129, 0.4);
  z-index: 1000;
  max-width: min(90vw, 480px);
  width: max-content;
  font-size: 0.92rem;
  font-weight: 500;
  animation: toastIn 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.toast.error {
  background: #EF4444;
  box-shadow: 0 10px 25px -3px rgba(239, 68, 68, 0.4);
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(20px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* Skeleton Loading */
.skeleton {
  height: 140px;
  background: linear-gradient(100deg, #E5E7EB, #F8FAFC, #E5E7EB);
  background-size: 200% 100%;
  animation: pulse 1.6s infinite;
  border-radius: 14px;
  margin-bottom: 14px;
}

@keyframes pulse {
  to { background-position: -200% 0; }
}

/* Empty State */
.empty {
  padding: 50px 24px;
  text-align: center;
  background: #FFFFFF;
  border: 1px dashed #CBD5E1;
  border-radius: 16px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.empty i {
  font-size: 2.2rem;
  color: #93C5FD;
  margin-bottom: 14px;
  display: block;
}

.empty h3 {
  color: var(--text-main);
  margin-bottom: 6px;
  font-size: 1.15rem;
}

.empty p {
  font-size: 0.9rem;
  max-width: 440px;
  margin: 0 auto;
  line-height: 1.6;
}

.empty button {
  margin-top: 18px;
}

/* Responsive Narrow adjustments */
@media (max-width: 620px) {
  .row {
    grid-template-columns: 1fr;
    gap: 0;
  }
  dialog {
    padding: 20px;
    border-radius: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}
