:root {
  --bg: #ffffff;
  --panel: #ffffff;
  --border: #e2e8e4;
  --text: #0f172a;
  --muted: #64748b;
  --teal: #0f9d70;
  --teal-dark: #0b7a57;
  --soft: #f4f7f6;
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --danger-border: #fecaca;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Auth (login) screen ---------- */
#matrix {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 0;
  display: block;
  pointer-events: none;
}

.auth-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow: hidden;
}

.auth-logo {
  display: flex;
  justify-content: center;
  margin-bottom: 18px;
  position: relative;
  z-index: 1;
}
.auth-logo img { width: 180px; height: auto; }

.stage {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(3px);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 40px 36px 36px;
  box-shadow: 0 20px 60px rgba(15,23,42,0.1);
  text-align: center;
}

.stage h1 {
  font-size: 22px;
  letter-spacing: 2px;
  margin: 0 0 6px;
  font-weight: 700;
}
.stage .subtitle {
  color: var(--muted);
  font-size: 14px;
  margin: 0 0 28px;
}

.field { text-align: left; margin-bottom: 18px; }
.field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
  margin-bottom: 8px;
}
.field input[type="email"],
.field input[type="password"],
.field input[type="text"] {
  width: 100%;
  padding: 14px 16px;
  font-size: 15px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: var(--soft);
  color: var(--text);
}
.field input:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(15,157,112,0.15);
}

.field-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.field-row label { margin-bottom: 0; }
.link-sm { font-size: 13px; color: var(--teal); }

.remember-row { display: flex; align-items: center; gap: 8px; margin-bottom: 20px; font-size: 14px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 15px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.5px;
  border: none;
  border-radius: 10px;
  background: var(--teal);
  color: #fff;
  cursor: pointer;
  width: 100%;
}
.btn:hover { background: var(--teal-dark); }
.btn:disabled { background: #cbd5e1; cursor: not-allowed; }
.btn-secondary { background: var(--soft); color: var(--text); border: 1.5px solid var(--border); }
.btn-secondary:hover { background: #eaeef0; }
.btn-sm { padding: 9px 14px; font-size: 13px; width: auto; }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #b91c1c; }

.alert {
  padding: 12px 14px;
  font-size: 14px;
  border-radius: 10px;
  margin-bottom: 18px;
  text-align: left;
}
.alert-error { background: var(--danger-bg); color: var(--danger); border: 1px solid var(--danger-border); }
.alert-success { background: #ecfdf5; color: var(--teal-dark); border: 1px solid #a7f3d0; }

/* ---------- App shell (sidebar + content) ---------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 250px;
  flex-shrink: 0;
  background: #fff;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.sidebar-brand { padding: 24px 20px 16px; }
.sidebar-brand img { height: 46px; width: auto; }

.sidebar-user {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 8px 16px 20px;
  border-bottom: 1px solid var(--border);
}
.avatar-lg { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; margin-bottom: 10px; }
.avatar-lg-initials {
  display: flex; align-items: center; justify-content: center;
  background: var(--text); color: #fff;
  font-size: 20px; font-weight: 700;
}
.sidebar-user-name { font-size: 14px; font-weight: 700; }
.sidebar-user-title { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; margin-top: 2px; }

.sidebar-nav { display: flex; flex-direction: column; padding: 16px 12px; gap: 2px; flex: 1; }
.sidebar-nav a {
  display: flex;
  align-items: center;
  padding: 10px 14px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}
.sidebar-nav a:hover { background: var(--soft); color: var(--text); text-decoration: none; }
.sidebar-nav a.active { background: rgba(15,157,112,0.1); color: var(--teal-dark); text-decoration: none; }
.sidebar-section-label {
  margin-top: 14px;
  padding: 8px 14px 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--muted);
}
.sidebar-nav a.sidebar-subitem { padding-left: 26px; }

.sidebar-bottom { padding: 14px 16px 20px; border-top: 1px solid var(--border); }
.sidebar-profile-link {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 6px; border-radius: 8px;
  font-size: 13px; font-weight: 600; color: var(--text);
}
.sidebar-profile-link:hover { background: var(--soft); text-decoration: none; }
.sidebar-profile-link.active { background: rgba(15,157,112,0.1); color: var(--teal-dark); }
.avatar-sm { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; }
.avatar-sm-initials {
  display: flex; align-items: center; justify-content: center;
  background: var(--text); color: #fff;
  font-size: 11px; font-weight: 700;
}

.app-content { flex: 1; min-width: 0; }
.app-main { max-width: 1000px; margin: 0; padding: 32px 40px 60px; }

/* ---------- Profile page ---------- */
.profile-avatar-row { display: flex; align-items: center; gap: 20px; margin-bottom: 24px; }
.avatar-xl { width: 96px; height: 96px; border-radius: 50%; object-fit: cover; }
.avatar-xl-initials {
  display: flex; align-items: center; justify-content: center;
  background: var(--text); color: #fff;
  font-size: 30px; font-weight: 700;
}
.readonly-field { padding: 12px 14px; background: var(--soft); border: 1.5px solid var(--border); border-radius: 10px; font-size: 14px; color: var(--muted); }

.page-header { margin-bottom: 24px; }
.page-header h1 { font-size: 26px; margin: 0 0 4px; }
.page-header p { color: var(--muted); margin: 0; font-size: 14px; }

.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px 22px;
  box-shadow: 0 2px 10px rgba(15,23,42,0.03);
}
.card + .card { margin-top: 16px; }

.grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.stat-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 20px;
}
.stat-card .stat-label { font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); font-weight: 600; }
.stat-card .stat-value { font-size: 28px; font-weight: 700; margin-top: 6px; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
table th {
  text-align: left;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  font-weight: 600;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
table td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
table tr:last-child td { border-bottom: none; }
table tr:hover td { background: var(--soft); }

.toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; gap: 12px; flex-wrap: wrap; }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.badge-yeni { background: #e0f2fe; color: #075985; }
.badge-gorusuluyor { background: #fef3c7; color: #92400e; }
.badge-teklif_verildi { background: #ede9fe; color: #5b21b6; }
.badge-muzakere { background: #fee2e2; color: #991b1b; }
.badge-satis_tamamlandi { background: #d1fae5; color: #065f46; }
.badge-kaybedildi { background: #f1f5f9; color: #475569; }
.badge-iletisimde { background: #fef3c7; color: #92400e; }
.badge-nitelikli { background: #ede9fe; color: #5b21b6; }
.badge-donusturuldu { background: #d1fae5; color: #065f46; }

.kanban { display: grid; grid-template-columns: repeat(6, minmax(180px, 1fr)); gap: 14px; overflow-x: auto; }
.kanban-col { background: var(--soft); border-radius: 12px; padding: 12px; min-width: 180px; }
.kanban-col h3 { font-size: 13px; margin: 0 0 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }
.kanban-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 10px;
  font-size: 13px;
}
.kanban-card .deal-title { font-weight: 600; margin-bottom: 4px; }
.kanban-card .deal-value { color: var(--teal-dark); font-weight: 600; font-size: 12px; }

form.stacked .field { margin-bottom: 16px; }
.form-actions { display: flex; gap: 10px; margin-top: 20px; }

textarea {
  width: 100%;
  padding: 12px 14px;
  font-size: 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: var(--soft);
  font-family: inherit;
  resize: vertical;
}
select {
  width: 100%;
  padding: 12px 14px;
  font-size: 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: var(--soft);
  font-family: inherit;
}

.empty-state { text-align: center; padding: 48px 20px; color: var(--muted); }
.muted { color: var(--muted); }
.text-sm { font-size: 13px; }
