/* =========================================
   ROOT DESIGN TOKENS (Corporate Identity)
   ========================================= */
:root {
  --primary: #1E4E8C;
  --primary-dark: #163a68;
  --accent: #2f6fd1;
  --bg: #ffffff;
  --text: #222222;
  --muted: #666666;
  --gray-light: #f5f7fb;
  --border: #e1e5f0;
  --shadow-soft: 0 14px 40px rgba(0, 0, 0, 0.06);
  --radius-lg: 14px;
  --radius-md: 10px;
  --radius-pill: 999px;
  --transition-fast: 0.2s ease;
}

/* RESET */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Inter", "Roboto", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
}

/* =========================================
   GLOBAL PAGE BACKGROUND
   ========================================= */
.page,
.dashboard-page {
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(46, 119, 214, 0.12), transparent 55%),
    radial-gradient(circle at bottom right, rgba(16, 44, 92, 0.12), transparent 55%);
}

/* =========================================
   LOGIN / AUTH PAGE
   ========================================= */
.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.auth-wrapper {
  width: 100%;
  max-width: 420px;
}

.auth-card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  padding: 2.4rem 2.2rem 2rem;
  border: 1px solid var(--border);
  animation: fadeIn 0.5s ease;
}

/* Logo + Brand */
.auth-logo-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.8rem;
}

.auth-logo img {
  height: 50px;
}

.auth-brand-text {
  display: flex;
  flex-direction: column;
}

.auth-brand-name {
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--primary-dark);
}

.auth-brand-tagline {
  font-size: 0.8rem;
  color: var(--muted);
}

/* Heading */
.auth-heading h1 {
  font-size: 1.45rem;
  letter-spacing: -0.03em;
  margin-bottom: 0.3rem;
}

.auth-heading p {
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 1.8rem;
}

/* Form */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.auth-field label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted);
}

.auth-field input {
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  padding: 0.75rem 0.85rem;
  font-size: 0.95rem;
  background: #f9fafc;
  transition: var(--transition-fast);
}

.auth-field input:focus {
  border-color: var(--primary);
  background: #ffffff;
  box-shadow: 0 0 0 1px rgba(46, 119, 214, 0.18);
}

/* Button */
.btn {
  border-radius: var(--radius-pill);
  border: none;
  padding: 0.75rem 1.4rem;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-primary {
  background: linear-gradient(135deg, #2f6fd1, #1E4E8C);
  color: #ffffff;
  box-shadow: 0 12px 30px rgba(30, 78, 140, 0.35);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 40px rgba(30, 78, 140, 0.45);
}

.btn-light {
  background: #f3f6fc;
  border: 1px solid var(--border);
  color: var(--primary-dark);
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius-pill);
  font-size: 0.9rem;
  font-weight: 600;
  transition: var(--transition-fast);
}

.btn-light:hover {
  background: #e8eef8;
}

.logout-btn {
  padding: 0.45rem 1rem;
  border-radius: var(--radius-pill);
  background: #f3f6fc;
  border: 1px solid var(--border);
  font-size: 0.85rem;
  transition: var(--transition-fast);
}

.logout-btn:hover {
  background: #e8eef8;
}

/* Alerts */
.auth-alert {
  font-size: 0.85rem;
  border-radius: var(--radius-md);
  padding: 0.7rem 0.85rem;
  margin-bottom: 1rem;
}

.auth-alert-error {
  background: #ffe8e8;
  color: #b3261e;
  border: 1px solid #f3b4b0;
}

/* =========================================
   DASHBOARD LAYOUT
   ========================================= */
.dashboard-layout {
  display: flex;
  min-height: 100vh;
}

/* SIDEBAR */
.sidebar {
  width: 250px;
  background: #ffffff;
  border-right: 1px solid var(--border);
  box-shadow: 4px 0 20px rgba(0,0,0,0.04);
  padding: 1.5rem 1rem;
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin-bottom: 2rem;
}

.sidebar-logo {
  width: 46px;
}

.sidebar-brand {
  display: flex;
  flex-direction: column;
}

.sidebar-title {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--primary-dark);
}

.sidebar-sub {
  font-size: 0.78rem;
  color: var(--muted);
}

/* NAVIGATION */
.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.nav-item {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.92rem;
  color: var(--text);
  transition: var(--transition-fast);
}

.nav-item:hover {
  background: var(--gray-light);
}

.nav-item.active {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 6px 20px rgba(30, 78, 140, 0.25);
}

/* MAIN AREA */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* TOPBAR */
.topbar {
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  padding: 1rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.page-title {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.user-badge {
  background: var(--gray-light);
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-pill);
  font-size: 0.9rem;
  color: var(--primary-dark);
  font-weight: 600;
}

/* CONTENT */
.content {
  padding: 2rem;
}

/* ACTION BAR */
.action-bar {
  display: flex;
  gap: 1rem;
  margin-bottom: 2.2rem;
  padding-bottom: 0.5rem;
  position: relative;
  z-index: 5;
}

/* GRID CARDS */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
  margin-top: 1rem;
}

.card {
  background: #ffffff;
  padding: 1.7rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  border: 1px solid var(--border);
  transition: var(--transition-fast);
  position: relative;
  z-index: 1;
}

.card:hover {
  transform: translateY(-3px);
  z-index: 2;
}

.card h3 {
  font-size: 1.1rem;
  margin-bottom: 0.8rem;
  color: var(--primary-dark);
}

.kpi-number {
  font-size: 2rem;
  font-weight: 700;
}

/* CARD FOOTER */
.card-footer {
  margin-top: 1.4rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-start;
}

/* =========================================
   FORM GRID (Kunden, Termine, Aufträge)
   ========================================= */
.form-grid {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.form-field {
  flex: 1;
  min-width: 200px;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.form-field label {
  font-size: 0.82rem;
  color: var(--muted);
}

.form-field input,
.form-field textarea,
.form-field select {
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  padding: 0.6rem 0.75rem;
  font-size: 0.9rem;
  background: #f9fafc;
  transition: var(--transition-fast);
}

.form-field input:focus,
.form-field textarea:focus,
.form-field select:focus {
  border-color: var(--primary);
  background: #ffffff;
  box-shadow: 0 0 0 1px rgba(46, 119, 214, 0.18);
}

/* =========================================
   TABLES
   ========================================= */
.table-wrapper {
  width: 100%;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}

.data-table th,
.data-table td {
  padding: 0.55rem 0.6rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.data-table th {
  font-weight: 600;
  color: var(--muted);
  background: #f8f9fc;
}

/* TABLE BUTTONS */
.table-btn {
  padding: 0.35rem 0.7rem;
  border-radius: var(--radius-pill);
  font-size: 0.78rem;
  background: var(--gray-light);
  border: 1px solid var(--border);
  transition: var(--transition-fast);
}

.table-btn:hover {
  background: #e8eef8;
}

.table-btn.edit {
  background: #e6f7ea;
  border-color: #b7e1c2;
  color: #256b3f;
}

.table-btn.delete {
  background: #ffe8e8;
  border-color: #f3b4b0;
  color: #b3261e;
}

/* =========================================
   DETAIL PAGE (Kunde, Auftrag)
   ========================================= */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.2rem;
  margin-bottom: 1rem;
}

.detail-item label {
  font-size: 0.78rem;
  color: var(--muted);
  display: block;
  margin-bottom: 0.2rem;
}

.detail-item span {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text);
}

.detail-notes {
  background: #f9fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem;
  font-size: 0.9rem;
  white-space: pre-wrap;
}

/* STATUS BADGES */
.status-badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
}

.status-offen {
  background: #fff4e5;
  color: #b25e09;
}

.status-in_bearbeitung {
  background: #e6f2ff;
  color: #1E4E8C;
}

.status-erledigt {
  background: #e6f7ea;
  color: #256b3f;
}

/* Animation */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
