/* Taqip — temel tasarım sistemi (tokenlar, bileşenler) */
:root {
  /* Marka */
  --red-50: #fdf2f4; --red-100: #fbe3e7; --red-500: #d92a45; --red-600: #c8102e; --red-700: #a50d26;
  /* Nötr (metin/zemin kontrastları WCAG AA) */
  --ink-900: #14171f; --ink-800: #1f2430; --ink-700: #3a4150; --ink-600: #525a6b; --ink-500: #687083;
  --ink-300: #c5cad3; --ink-200: #e2e5ea; --ink-100: #eef0f3; --ink-50: #f6f7f9;
  --bg: #f4f3f0; --surface: #ffffff;
  --success: #047857; --success-bg: #e7f6ef; --warn: #92400e; --warn-bg: #fff4dc;
  --info: #1d4ed8; --info-bg: #e8f0ff; --violet: #6d28d9; --violet-bg: #f1ecff;

  --font-display: 'Space Grotesk', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-body: 'DM Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;

  --text-xs: .75rem; --text-sm: .875rem; --text-base: 1rem; --text-lg: 1.125rem;
  --text-xl: 1.25rem; --text-2xl: 1.5rem; --text-3xl: 1.875rem;

  --space-1: .25rem; --space-2: .5rem; --space-3: .75rem; --space-4: 1rem; --space-5: 1.25rem;
  --space-6: 1.5rem; --space-8: 2rem; --space-10: 2.5rem; --space-12: 3rem;

  --radius-sm: 6px; --radius-md: 10px; --radius-lg: 14px; --radius-full: 999px;
  --shadow-sm: 0 1px 2px rgba(20,23,31,.06), 0 1px 3px rgba(20,23,31,.04);
  --shadow-md: 0 4px 14px rgba(20,23,31,.08);
  --shadow-lg: 0 18px 50px rgba(20,23,31,.18);
  --ease: cubic-bezier(.16, 1, .3, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink-800); font: var(--text-base)/1.5 var(--font-body); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { font-family: var(--font-display); color: var(--ink-900); line-height: 1.2; margin: 0; letter-spacing: -.01em; }
p { margin: 0; }
img { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--red-600); }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); border: 0; }
.muted { color: var(--ink-500); }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }

:focus-visible { outline: 2px solid var(--red-600); outline-offset: 2px; }
:focus:not(:focus-visible) { outline: none; }

/* Düğmeler */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); min-height: 40px; padding: 0 var(--space-4);
  border: 1px solid var(--ink-200); background: var(--surface); color: var(--ink-800); border-radius: var(--radius-md);
  font-weight: 600; font-size: var(--text-sm); text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: transform 120ms ease, box-shadow 160ms ease, background 160ms ease, border-color 160ms ease; }
.btn:hover { border-color: var(--ink-300); box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.btn:active { transform: none; box-shadow: none; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-primary { background: var(--red-600); border-color: var(--red-600); color: #fff; }
.btn-primary:hover { background: var(--red-700); border-color: var(--red-700); }
.btn-dark { background: var(--ink-900); border-color: var(--ink-900); color: #fff; }
.btn-dark:hover { background: var(--ink-700); border-color: var(--ink-700); }
.btn-success { background: var(--success); border-color: var(--success); color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--ink-100); box-shadow: none; }
.btn-danger { color: #b91c1c; }
.btn-danger:hover { background: #fef2f2; border-color: #f5c2c2; }
.btn-sm { min-height: 32px; padding: 0 var(--space-3); font-size: var(--text-xs); }
.btn-lg { min-height: 48px; padding: 0 var(--space-6); font-size: var(--text-base); }
.btn-icon { min-width: 36px; min-height: 36px; padding: 0; }
.btn-block { width: 100%; }
.btn .spinner { width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Form alanları */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .field > .label { font-size: var(--text-xs); font-weight: 700; color: var(--ink-600); letter-spacing: .02em; }
.field .hint { font-size: var(--text-xs); color: var(--ink-500); }
.input, .field input, .field select, .field textarea {
  width: 100%; min-height: 42px; padding: 9px 12px; background: var(--surface); border: 1px solid var(--ink-300);
  border-radius: var(--radius-md); font-size: var(--text-sm); transition: border-color 150ms ease, box-shadow 150ms ease; }
.field textarea { min-height: 84px; resize: vertical; line-height: 1.45; }
.field input:hover, .field select:hover, .field textarea:hover { border-color: var(--ink-500); }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--red-600); box-shadow: 0 0 0 3px rgba(200,16,46,.15); }
.field input[readonly], .field input:disabled, .field select:disabled, .field textarea:disabled { background: var(--ink-50); color: var(--ink-600); }
.check { display: flex; align-items: flex-start; gap: var(--space-3); font-size: var(--text-sm); cursor: pointer; }
.check input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--red-600); flex: none; }

/* Durum rozetleri */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: var(--radius-full);
  font-size: var(--text-xs); font-weight: 700; white-space: nowrap; background: var(--ink-100); color: var(--ink-700); }
.st-draft { background: var(--ink-100); color: var(--ink-700); }
.st-sent { background: var(--info-bg); color: var(--info); }
.st-viewed { background: var(--violet-bg); color: var(--violet); }
.st-approved { background: var(--success-bg); color: var(--success); }
.st-rejected { background: #fdeaea; color: #b91c1c; }
.st-revision { background: var(--warn-bg); color: var(--warn); }
.st-superseded, .st-archived { background: var(--ink-100); color: var(--ink-600); }

/* Diyalog (yerel <dialog>: odak tuzağı + Esc hazır) */
dialog.dialog { border: 0; padding: 0; border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); width: min(560px, calc(100vw - 24px));
  max-height: calc(100vh - 32px); color: var(--ink-800); background: var(--surface); }
dialog.dialog.wide { width: min(980px, calc(100vw - 24px)); }
dialog.dialog::backdrop { background: rgba(20,23,31,.5); backdrop-filter: blur(2px); }
dialog.dialog[open] { animation: dialogIn 220ms var(--ease); display: flex; flex-direction: column; }
@keyframes dialogIn { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); padding: var(--space-5) var(--space-6); border-bottom: 1px solid var(--ink-100); }
.dialog-head h2 { font-size: var(--text-lg); }
.dialog-body { padding: var(--space-6); overflow: auto; display: grid; gap: var(--space-4); }
.dialog-foot { display: flex; justify-content: flex-end; gap: var(--space-2); padding: var(--space-4) var(--space-6); border-top: 1px solid var(--ink-100); background: var(--ink-50); border-radius: 0 0 var(--radius-lg) var(--radius-lg); flex-wrap: wrap; }

/* Bildirimler */
#lemac-toast { position: fixed; right: 16px; bottom: 16px; z-index: 500; display: grid; gap: 8px; width: min(380px, calc(100vw - 32px)); pointer-events: none; }
.toast { background: var(--ink-900); color: #fff; padding: 12px 16px; border-radius: var(--radius-md); box-shadow: var(--shadow-lg); font-size: var(--text-sm);
  opacity: 0; transform: translateY(10px); transition: opacity 200ms ease, transform 250ms var(--ease); }
.toast.show { opacity: 1; transform: none; }
.toast-error { background: #991b1b; }
.toast-success { background: var(--success); }

/* İskelet yükleme */
.skeleton { background: linear-gradient(90deg, var(--ink-100) 25%, var(--ink-50) 50%, var(--ink-100) 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: var(--radius-sm); min-height: 14px; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

@keyframes fadeUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.fade-up { animation: fadeUp 380ms var(--ease) both; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
