/* ===========================================================================
   Mühendis App — Yönetim Portalı
   Modern dashboard tema. Sınıf sözleşmesi app.js ile birebir korunmuştur;
   yalnızca görsel katman yenilenmiştir (JS davranışı değişmez).
   =========================================================================== */

:root {
  color-scheme: light dark;

  /* Marka (logo ile uyumlu teal) */
  --brand: #0097b2;
  --brand-strong: #007f96;
  --brand-soft: rgba(0, 151, 178, 0.12);
  --accent: #00b59c;

  /* Yüzeyler & metin (light) */
  --bg: #eef3f6;
  --bg-grid: rgba(8, 71, 86, 0.04);
  --surface: #ffffff;
  --surface-2: #f6fafb;
  --surface-3: #eef5f7;
  --text: #0d1b24;
  --muted: #5a6b78;
  --faint: #8a98a3;
  --line: #dde8ed;
  --line-strong: #c8d8df;

  /* Durum renkleri */
  --good: #14a06b;
  --good-soft: rgba(20, 160, 107, 0.12);
  --warn: #c98a12;
  --warn-soft: rgba(201, 138, 18, 0.14);
  --danger: #d23b3b;
  --danger-soft: rgba(210, 59, 59, 0.12);

  /* Sidebar (koyu) */
  --nav: #062a35;
  --nav-2: #04222b;
  --nav-text: #b9ccd4;
  --nav-text-active: #ffffff;

  /* Gölgeler & yarıçap */
  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(13, 27, 36, 0.06), 0 2px 6px rgba(13, 27, 36, 0.04);
  --shadow: 0 6px 18px rgba(13, 38, 47, 0.08), 0 1px 3px rgba(13, 38, 47, 0.06);
  --shadow-lg: 0 24px 60px rgba(13, 38, 47, 0.18);
  --ring: 0 0 0 3px var(--brand-soft);

  --sidebar-w: 256px;
  --sidebar-w-collapsed: 76px;

  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ----------------------------- Dark mode --------------------------------- */
/* Auto dark only when the user has NOT picked a theme manually; otherwise the
   manual :root[data-theme="..."] blocks below win and the toggle works both ways. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #0b161c;
    --bg-grid: rgba(255, 255, 255, 0.02);
    --surface: #11212a;
    --surface-2: #15272f;
    --surface-3: #1a2f38;
    --text: #e9f1f4;
    --muted: #9fb1ba;
    --faint: #74878f;
    --line: #21343d;
    --line-strong: #2c424c;
    --brand-soft: rgba(0, 181, 156, 0.16);
    --good-soft: rgba(20, 160, 107, 0.2);
    --warn-soft: rgba(201, 138, 18, 0.22);
    --danger-soft: rgba(210, 59, 59, 0.2);
    --nav: #081b22;
    --nav-2: #06151b;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.6);
  }
}

/* Manuel tema override (topbar düğmesi) */
:root[data-theme="dark"] {
  --bg: #0b161c;
  --bg-grid: rgba(255, 255, 255, 0.02);
  --surface: #11212a;
  --surface-2: #15272f;
  --surface-3: #1a2f38;
  --text: #e9f1f4;
  --muted: #9fb1ba;
  --faint: #74878f;
  --line: #21343d;
  --line-strong: #2c424c;
  --brand-soft: rgba(0, 181, 156, 0.16);
  --good-soft: rgba(20, 160, 107, 0.2);
  --warn-soft: rgba(201, 138, 18, 0.22);
  --danger-soft: rgba(210, 59, 59, 0.2);
  --nav: #081b22;
  --nav-2: #06151b;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.6);
}
:root[data-theme="light"] { color-scheme: light; }

* { box-sizing: border-box; }
html, body { min-height: 100%; }

/* hidden attribute her zaman display'i ezmeli (app.js .hidden ile gizler) */
[hidden] { display: none !important; }

body {
  margin: 0;
  color: var(--text);
  background:
    linear-gradient(var(--bg-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--bg-grid) 1px, transparent 1px),
    var(--bg);
  background-size: 30px 30px, 30px 30px, auto;
}

button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--brand); }
::selection { background: var(--brand-soft); }

/* Scrollbar */
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 99px; border: 2px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--faint); background-clip: content-box; }

.app-shell { min-height: 100vh; }

[data-view] { display: none; }
.app-shell[data-state="auth"] [data-view="auth"] { display: grid; }
.app-shell[data-state="dashboard"] [data-view="dashboard"] { display: grid; }

/* =========================================================================
   AUTH / GİRİŞ
   ========================================================================= */
.auth-view {
  min-height: 100vh;
  grid-template-columns: 1.05fr 1fr;
  align-items: stretch;
}

.auth-view .brand-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 22px;
  padding: 64px;
  color: #eafcff;
  background:
    radial-gradient(1100px 540px at 12% -10%, rgba(0, 181, 156, 0.45), transparent 60%),
    radial-gradient(900px 600px at 100% 120%, rgba(0, 151, 178, 0.55), transparent 55%),
    linear-gradient(160deg, #04222b 0%, #073945 55%, #06303a 100%);
  overflow: hidden;
}
.auth-view .brand-panel::after {
  content: "";
  position: absolute; inset: 0;
  background:
    linear-gradient(rgba(255,255,255,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.04) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: radial-gradient(80% 80% at 30% 20%, #000 30%, transparent 80%);
  pointer-events: none;
}
.auth-view .brand-panel > * { position: relative; z-index: 1; }
.auth-view .brand-logo { width: 64px; height: 64px; border-radius: 16px; background: rgba(255,255,255,0.06); padding: 10px; box-shadow: var(--shadow); }
.auth-view .eyebrow { letter-spacing: 0.16em; text-transform: uppercase; font-size: 12px; font-weight: 700; color: var(--accent); margin: 0; }
.auth-view .brand-panel h1 { font-size: clamp(30px, 4vw, 46px); line-height: 1.05; margin: 6px 0 0; font-weight: 800; letter-spacing: -0.02em; }

.auth-view .login-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-self: center;
  justify-self: center;
  width: min(420px, 86vw);
  padding: 40px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  margin: 40px;
}
.login-panel::before {
  content: "Portal Girişi";
  font-size: 22px; font-weight: 800; letter-spacing: -0.01em;
}
.login-panel .field { display: flex; flex-direction: column; gap: 7px; }
.login-panel label { font-size: 13px; font-weight: 600; color: var(--muted); }

input[type="text"], input[type="password"], input[type="number"], input[type="date"], textarea, select {
  width: 100%;
  padding: 11px 13px;
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  transition: border-color .15s, box-shadow .15s, background .15s;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--brand); box-shadow: var(--ring); background: var(--surface); }
textarea { resize: vertical; }

/* Butonlar */
.primary-button {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  padding: 12px 18px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-strong) 100%);
  border: none; border-radius: var(--radius-sm);
  box-shadow: 0 8px 18px rgba(0, 127, 150, 0.28);
  transition: transform .12s, box-shadow .12s, filter .12s;
}
.primary-button:hover { transform: translateY(-1px); filter: brightness(1.05); box-shadow: 0 12px 24px rgba(0, 127, 150, 0.32); }
.primary-button:active { transform: translateY(0); }
.primary-button:disabled { opacity: .55; cursor: not-allowed; box-shadow: none; transform: none; }
.primary-button.compact { padding: 9px 16px; }
.primary-button .button-icon { font-size: 18px; line-height: 1; }

.secondary-button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px; font-weight: 600;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  transition: background .14s, border-color .14s, transform .12s;
}
.secondary-button:hover { background: var(--surface-3); border-color: var(--faint); }
.secondary-button:active { transform: translateY(1px); }
.secondary-button:disabled { opacity: .5; cursor: not-allowed; }
.secondary-button.mini { padding: 6px 11px; font-size: 12.5px; }
.secondary-button.danger { color: var(--danger); border-color: var(--danger-soft); }
.secondary-button.danger:hover { background: var(--danger-soft); border-color: var(--danger); }

.text-button {
  background: none; border: none; padding: 6px 4px;
  color: var(--brand); font-weight: 600; font-size: 13px;
  border-bottom: 1px dashed transparent; border-radius: 0;
}
.text-button:hover { border-bottom-color: var(--brand); }

.icon-button {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; font-size: 18px;
  background: var(--surface); color: var(--muted);
  border: 1px solid var(--line); border-radius: 11px;
  transition: background .14s, color .14s, border-color .14s, transform .3s;
}
.icon-button:hover { background: var(--surface-3); color: var(--text); border-color: var(--line-strong); }
.icon-button:disabled { opacity: .5; cursor: not-allowed; }
#refresh-button:active { transform: rotate(180deg); }

.form-error { color: var(--danger); font-size: 13px; min-height: 18px; margin: 2px 0 0; font-weight: 600; }

/* Onay bekleme paneli */
.approval-panel {
  display: flex; gap: 14px; align-items: flex-start;
  padding: 16px; margin-top: 4px;
  background: var(--brand-soft);
  border: 1px solid var(--brand);
  border-radius: var(--radius-sm);
}
.approval-icon {
  flex: none; width: 42px; height: 42px;
  display: grid; place-items: center; font-size: 20px;
  background: var(--brand); color: #fff; border-radius: 12px;
  animation: pulse 1.8s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(0,151,178,.5);} 50% { box-shadow: 0 0 0 10px rgba(0,151,178,0);} }
.approval-panel strong { display: block; margin-bottom: 4px; }
.approval-panel p { margin: 0 0 10px; font-size: 13px; color: var(--muted); }
.approval-actions { display: flex; gap: 8px; }

/* =========================================================================
   DASHBOARD SHELL
   ========================================================================= */
.dashboard-view {
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
  transition: grid-template-columns .22s ease;
}
.app-shell.sidebar-expanded .dashboard-view { grid-template-columns: var(--sidebar-w-collapsed) 1fr; }

/* Sidebar */
.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 6px;
  padding: 18px 14px;
  color: var(--nav-text);
  background: linear-gradient(180deg, var(--nav) 0%, var(--nav-2) 100%);
  border-right: 1px solid rgba(255,255,255,0.05);
  overflow-y: auto; overflow-x: hidden;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 10px 18px; margin-bottom: 6px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  font-weight: 800; font-size: 16px; color: #fff; white-space: nowrap;
}
.brand-logo.small { width: 38px; height: 38px; border-radius: 11px; background: rgba(255,255,255,0.08); padding: 6px; flex: none; }

.nav-list { display: flex; flex-direction: column; gap: 3px; }
.nav-item {
  display: flex; align-items: center; gap: 13px;
  padding: 11px 13px; width: 100%;
  font-size: 14px; font-weight: 600; text-align: left; white-space: nowrap;
  color: var(--nav-text);
  background: transparent; border: none; border-radius: 11px;
  transition: background .14s, color .14s;
}
.nav-item span[aria-hidden] {
  flex: none; width: 26px; height: 26px;
  display: grid; place-items: center; font-size: 16px;
  border-radius: 8px; background: rgba(255,255,255,0.05);
  transition: background .14s, color .14s;
}
.nav-item:hover { background: rgba(255,255,255,0.06); color: #fff; }
.nav-item.active { color: var(--nav-text-active); background: rgba(0, 181, 156, 0.16); }
.nav-item.active span[aria-hidden] { background: var(--accent); color: #04222b; }
.nav-item.active { position: relative; }
.nav-item.active::before {
  content: ""; position: absolute; left: -14px; top: 50%; transform: translateY(-50%);
  width: 4px; height: 22px; border-radius: 0 4px 4px 0; background: var(--accent);
}

/* Collapsed (desktop) */
.app-shell.sidebar-expanded .sidebar-brand span,
.app-shell.sidebar-expanded .nav-item span:not([aria-hidden]) { display: none; }
.app-shell.sidebar-expanded .nav-item { justify-content: center; padding: 11px 0; }

/* Workspace */
.workspace { display: flex; flex-direction: column; min-width: 0; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 28px;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar-title { display: flex; align-items: center; gap: 14px; }
.topbar .eyebrow { margin: 0; font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--faint); font-weight: 700; }
.topbar h2 { margin: 0; font-size: 21px; font-weight: 800; letter-spacing: -0.02em; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.menu-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; font-size: 19px;
  background: var(--surface); color: var(--muted);
  border: 1px solid var(--line); border-radius: 11px;
}
.menu-toggle:hover { background: var(--surface-3); color: var(--text); }

.status-line {
  min-height: 0; margin: 0 28px;
  color: var(--brand-strong); font-size: 13px; font-weight: 600;
}
.status-line:not(:empty) {
  min-height: auto; margin-top: 14px;
  padding: 10px 14px; border-radius: var(--radius-sm);
  background: var(--brand-soft); border: 1px solid var(--brand);
}

#overview-section { padding: 22px 28px 36px; display: flex; flex-direction: column; gap: 22px; }
.section-content { padding: 22px 28px 40px; display: flex; flex-direction: column; gap: 20px; }

/* Metrik kartları */
.metrics-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.metric-card {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; gap: 10px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.metric-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--line-strong); }
.metric-card::after {
  content: ""; position: absolute; right: -30px; top: -30px;
  width: 96px; height: 96px; border-radius: 50%;
  background: radial-gradient(circle, var(--brand-soft), transparent 70%);
}
.metric-label { font-size: 13px; color: var(--muted); font-weight: 600; }
.metric-card strong { font-size: 34px; font-weight: 800; letter-spacing: -0.03em; line-height: 1; }
.metric-card:nth-child(1) { border-top: 3px solid var(--danger); }
.metric-card:nth-child(2) { border-top: 3px solid var(--brand); }
.metric-card:nth-child(3) { border-top: 3px solid var(--warn); }
.metric-card:nth-child(4) { border-top: 3px solid var(--good); }

.content-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* Paneller */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 20px;
  animation: rise .28s ease both;
}
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.panel-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.panel-header h3 { margin: 0; font-size: 16px; font-weight: 700; letter-spacing: -0.01em; }
.table-panel { padding: 20px 20px 8px; }

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px; font-size: 12px; font-weight: 700;
  color: var(--brand-strong); background: var(--brand-soft);
  border-radius: 99px; white-space: nowrap;
}

/* Detay listeleri */
.detail-list { display: grid; gap: 2px; }
.detail-list.wide { grid-template-columns: repeat(2, 1fr); gap: 2px 28px; }
.detail-list > div {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 11px 2px; border-bottom: 1px dashed var(--line);
}
.detail-list dt { color: var(--muted); font-size: 13px; font-weight: 500; margin: 0; }
.detail-list dd { margin: 0; font-weight: 600; text-align: right; }

/* Modül listesi */
.module-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.module-item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 11px 13px; font-size: 13px; font-weight: 600;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm);
}
.module-state { font-size: 12px; font-weight: 700; color: var(--faint); padding: 3px 9px; border-radius: 99px; background: var(--surface-3); }
.module-state.enabled { color: var(--good); background: var(--good-soft); }
.profile-panel .detail-list { margin-top: -4px; }

/* =========================================================================
   TABLOLAR
   ========================================================================= */
.table-scroll { overflow-x: auto; margin: 0 -20px; padding: 0 20px; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.data-table thead th {
  position: sticky; top: 0;
  text-align: left; white-space: nowrap;
  padding: 11px 14px;
  font-size: 11.5px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--muted); background: var(--surface-2);
  border-bottom: 1px solid var(--line-strong);
}
.data-table tbody td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.data-table tbody tr { transition: background .12s; }
.data-table tbody tr:hover { background: var(--surface-2); }
.data-table tbody tr:last-child td { border-bottom: none; }
.col-number { text-align: right; font-variant-numeric: tabular-nums; }
.col-actions { text-align: right; }
.col-select { width: 44px; text-align: center; }
.col-roles { min-width: 160px; }

/* Rozetler */
.status-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; font-size: 12px; font-weight: 700; white-space: nowrap;
  border-radius: 99px;
  color: var(--muted); background: var(--surface-3); border: 1px solid var(--line);
}
.status-badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.status-badge.good { color: var(--good); background: var(--good-soft); border-color: transparent; }
.status-badge.warn { color: var(--warn); background: var(--warn-soft); border-color: transparent; }
.status-badge.bad  { color: var(--danger); background: var(--danger-soft); border-color: transparent; }
.badge-list { display: flex; flex-wrap: wrap; gap: 5px; }
.muted-text { color: var(--faint); font-size: 12.5px; }

.split-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.empty-panel { text-align: center; color: var(--muted); }
.empty-panel p { margin: 0; padding: 20px; font-weight: 500; }
.helper-text { margin: 6px 0 0; color: var(--muted); font-size: 13px; line-height: 1.5; }

/* =========================================================================
   MAKİNE WORKSPACE
   ========================================================================= */
.machine-workspace { padding: 20px; }
.machine-workspace-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.machine-workspace-head h3 { margin: 0; font-size: 17px; font-weight: 700; }

.machine-summary-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin: 18px 0; }
.mini-metric {
  display: flex; flex-direction: column; gap: 6px;
  padding: 14px; background: var(--surface-2);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
}
.mini-metric span { font-size: 12px; color: var(--muted); font-weight: 600; }
.mini-metric strong { font-size: 23px; font-weight: 800; letter-spacing: -0.02em; }

.machine-command-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  padding: 14px; margin-bottom: 4px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm);
}
.command-group { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.command-group.subtle { gap: 14px; }

.machine-table-scroll { margin-top: 6px; }
.machine-table-empty { padding: 40px 20px; text-align: center; color: var(--muted); background: var(--surface-2); border-radius: var(--radius-sm); }
.row-check { width: 17px; height: 17px; accent-color: var(--brand); cursor: pointer; }
.select-all-cell { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; }
.select-all-check { width: 16px; height: 16px; accent-color: var(--brand); }
.data-table tbody tr.is-selected { background: var(--brand-soft); }
.row-actions { display: inline-flex; gap: 6px; justify-content: flex-end; }

/* =========================================================================
   MODAL
   ========================================================================= */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center; padding: 20px;
  background: rgba(6, 22, 28, 0.55);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  animation: fade .15s ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal-card {
  width: min(560px, 100%); max-height: 90vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 16px;
  padding: 22px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  animation: pop .2s cubic-bezier(.16,1,.3,1);
}
.modal-card.large { width: min(720px, 100%); }
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }
.modal-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.modal-header h3 { margin: 0; font-size: 18px; font-weight: 800; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.modal-card .field { display: flex; flex-direction: column; gap: 6px; }
.modal-card .field.full { grid-column: 1 / -1; }
.modal-card .field span { font-size: 13px; font-weight: 600; color: var(--muted); }
.modal-error { color: var(--danger); font-size: 13px; font-weight: 600; min-height: 16px; margin: 0; }
.modal-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding-top: 8px; border-top: 1px solid var(--line); }

/* Rol seçici */
.role-picker { display: flex; flex-direction: column; gap: 10px; padding: 14px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.role-picker > strong { font-size: 13px; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.check-item { display: flex; align-items: center; gap: 8px; padding: 9px 11px; font-size: 13px; font-weight: 600; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); cursor: pointer; transition: border-color .14s, background .14s; }
.check-item:hover { border-color: var(--brand); }
.check-item input { width: 16px; height: 16px; accent-color: var(--brand); }
.check-item:has(input:checked) { background: var(--brand-soft); border-color: var(--brand); }

/* Excel import */
.import-steps { display: flex; flex-direction: column; gap: 12px; }
.template-download {
  display: inline-flex; align-items: center; gap: 8px; align-self: flex-start;
  padding: 9px 14px; font-weight: 600; text-decoration: none;
  color: var(--brand-strong); background: var(--brand-soft);
  border: 1px solid var(--brand); border-radius: var(--radius-sm);
}
.template-download::before { content: "⬇"; }
.template-download:hover { background: var(--brand); color: #fff; }
.file-drop {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 26px; text-align: center; cursor: pointer;
  color: var(--muted); font-weight: 600;
  background: var(--surface-2);
  border: 2px dashed var(--line-strong); border-radius: var(--radius);
  transition: border-color .15s, background .15s;
}
.file-drop:hover { border-color: var(--brand); background: var(--brand-soft); }
.file-drop input { font-weight: 500; }

.import-result { display: flex; flex-direction: column; gap: 12px; padding: 14px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.import-summary { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; font-size: 13px; }
.import-summary strong { font-size: 14px; margin-right: 4px; }
.import-summary span { padding: 4px 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 99px; font-weight: 600; }
.import-list { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; }
.import-list b { font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.import-list > div { display: grid; grid-template-columns: 80px 1fr 1fr; gap: 8px; padding: 7px 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }

/* =========================================================================
   REPORTS — filtre çubuğu
   ========================================================================= */
.report-filters {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 14px;
  align-items: end;
}
.report-filters .field { display: flex; flex-direction: column; gap: 6px; }
.report-filters .field span { font-size: 13px; font-weight: 600; color: var(--muted); }
.report-group { display: contents; }
.report-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }

/* =========================================================================
   RESPONSIVE
   ========================================================================= */
@media (max-width: 1180px) {
  .metrics-grid { grid-template-columns: repeat(2, 1fr); }
  .machine-summary-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 980px) {
  .content-grid, .split-grid { grid-template-columns: 1fr; }
  .detail-list.wide { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .module-list { grid-template-columns: 1fr; }
}
@media (max-width: 920px) {
  .auth-view { grid-template-columns: 1fr; }
  .auth-view .brand-panel { padding: 40px 28px; min-height: 230px; }
  .auth-view .login-panel { margin: 24px auto; }

  .dashboard-view { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: 0; top: 0; z-index: 60;
    width: min(280px, 84vw); height: 100vh;
    transform: translateX(-104%); transition: transform .24s ease;
    box-shadow: var(--shadow-lg);
  }
  .app-shell.sidebar-open-mobile .sidebar { transform: none; }
  .app-shell.sidebar-open-mobile .dashboard-view::after {
    content: ""; position: fixed; inset: 0; z-index: 55; background: rgba(6,22,28,.5);
  }
  /* mobilde collapse davranışını sıfırla */
  .app-shell.sidebar-expanded .sidebar-brand span,
  .app-shell.sidebar-expanded .nav-item span:not([aria-hidden]) { display: inline; }
  .app-shell.sidebar-expanded .nav-item { justify-content: flex-start; padding: 11px 13px; }

  .topbar { padding: 12px 18px; }
  #overview-section, .section-content { padding: 18px 18px 32px; }
  .status-line { margin: 0 18px; }
  .machine-summary-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .metrics-grid, .machine-summary-grid { grid-template-columns: 1fr 1fr; }
  .machine-workspace-head, .machine-command-bar { flex-direction: column; align-items: stretch; }
  .topbar h2 { font-size: 18px; }
}

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