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

:root {
  --color-primary:   #2563eb;
  --color-primary-d: #1d4ed8;
  --color-success:   #16a34a;
  --color-danger:    #dc2626;
  --color-warn:      #d97706;
  --color-bg:        #f8fafc;
  --color-surface:   #ffffff;
  --color-border:    #e2e8f0;
  --color-text:      #1e293b;
  --color-muted:     #64748b;

  --radius:   0.5rem;
  --shadow:   0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow-lg:0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -2px rgba(0,0,0,.05);

  --font-sans: system-ui, -apple-system, sans-serif;
  font-family: var(--font-sans);
  font-size: 16px;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-text-size-adjust: 100%;
}

body { min-height: 100dvh; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4em;
  padding: .55em 1.2em;
  border: none; border-radius: var(--radius);
  font-size: 1rem; font-weight: 500; cursor: pointer;
  transition: background .15s, opacity .15s;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary  { background: var(--color-primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--color-primary-d); }
.btn-danger   { background: var(--color-danger);  color: #fff; }
.btn-danger:hover:not(:disabled) { background: #b91c1c; }
.btn-ghost    { background: transparent; color: var(--color-primary); border: 1px solid var(--color-border); }
.btn-ghost:hover:not(:disabled) { background: var(--color-border); }
.btn-lg { font-size: clamp(1rem, 3vw, 1.4rem); padding: .8em 1.6em; }
.btn-icon { width: 2.5rem; height: 2.5rem; padding: 0; border-radius: 50%; }

input, select, textarea {
  width: 100%; padding: .55em .75em;
  border: 1px solid var(--color-border); border-radius: var(--radius);
  font-size: 1rem; font-family: inherit; color: var(--color-text);
  background: var(--color-surface);
  outline: none; transition: border-color .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--color-primary); }

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

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
}

.toast {
  position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 9999;
  padding: .75em 1.25em; border-radius: var(--radius);
  font-size: .9rem; font-weight: 500; color: #fff;
  box-shadow: var(--shadow-lg);
  animation: toast-in .2s ease;
}
.toast.success { background: var(--color-success); }
.toast.error   { background: var(--color-danger); }
@keyframes toast-in { from { opacity:0; transform:translateY(.5rem); } to { opacity:1; transform:none; } }

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 1000;
  display: flex; align-items: center; justify-content: center; padding: 1rem;
}
.modal {
  background: var(--color-surface); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); width: 100%; max-width: 520px;
  max-height: 90dvh; overflow-y: auto; padding: 1.5rem;
}
.modal-title { font-size: 1.1rem; font-weight: 600; margin-bottom: 1rem; }
.modal-actions { display: flex; gap: .75rem; justify-content: flex-end; margin-top: 1.5rem; }

.form-group { margin-bottom: 1rem; display: flex; flex-direction: column; gap: .3rem; }

.badge {
  display: inline-block; padding: .2em .6em;
  border-radius: 999px; font-size: .75rem; font-weight: 600;
}
.badge-admin   { background: #ede9fe; color: #6d28d9; }
.badge-user    { background: #dcfce7; color: #15803d; }
.badge-viewer  { background: #fef9c3; color: #a16207; }
.badge-active  { background: #dcfce7; color: #15803d; }
.badge-inactive{ background: #fee2e2; color: #b91c1c; }

.sr-only { position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0,0,0,0); }
