/* ================================================================
   Kundenportal · it4business
   Farbpalette aus Logo:
     Goldorange  #F5A31A
     Dunkelorange #CC5800
     Dunkelgrau  #555555
================================================================ */

:root {
  --primary:       #F5A31A;
  --primary-dark:  #CC5800;
  --primary-light: #FEF3DC;
  --gray-900:      #2c2c2c;
  --gray-700:      #555555;
  --gray-500:      #888888;
  --gray-300:      #cccccc;
  --gray-100:      #f5f5f5;
  --white:         #ffffff;
  --danger:        #d63031;
  --danger-bg:     #fff0ef;
  --success:       #27ae60;

  --shadow-sm:     0 1px 4px rgba(0,0,0,.08);
  --shadow-md:     0 4px 16px rgba(0,0,0,.10);
  --radius:        8px;
  --radius-sm:     5px;
  --font:          'Segoe UI', system-ui, -apple-system, Arial, sans-serif;
}

/* ── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font);
  color: var(--gray-900);
  background: var(--gray-100);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary-dark); text-decoration: none; }
a:hover { color: var(--primary); }

/* ── Login Page ───────────────────────────────────────────── */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(145deg, #fff8ee 0%, #f5f5f5 60%, #ffe8c8 100%);
  padding: 1.5rem;
}

.login-wrapper {
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.login-card {
  background: var(--white);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  padding: 2.5rem 2rem;
  width: 100%;
  border-top: 4px solid var(--primary);
}

.login-logo {
  text-align: center;
  margin-bottom: 1.5rem;
}

.login-logo img {
  max-width: 240px;
  height: auto;
}

.login-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--gray-900);
  text-align: center;
  margin-bottom: .25rem;
}

.login-subtitle {
  font-size: .9rem;
  color: var(--gray-500);
  text-align: center;
  margin-bottom: 1.5rem;
}

/* ── Alerts ───────────────────────────────────────────────── */
.alert {
  padding: .75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}

.alert-error {
  background: var(--danger-bg);
  border: 1px solid #f5c6c6;
  color: var(--danger);
}

.alert-warn {
  background: var(--primary-light);
  border: 1px solid #fad89a;
  color: var(--primary-dark);
}

.alert-icon { font-size: 1rem; flex-shrink: 0; }

/* ── Form ─────────────────────────────────────────────────── */
.login-form { display: flex; flex-direction: column; gap: 1rem; }

.form-group { display: flex; flex-direction: column; gap: .4rem; }

.form-group label {
  font-size: .875rem;
  font-weight: 600;
  color: var(--gray-700);
}

.form-group input,
.input-wrapper input {
  width: 100%;
  padding: .65rem .9rem;
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius-sm);
  font-size: .95rem;
  font-family: var(--font);
  color: var(--gray-900);
  background: var(--white);
  transition: border-color .15s, box-shadow .15s;
  outline: none;
}

.form-group input:focus,
.input-wrapper input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(245,163,26,.18);
}

.input-wrapper {
  position: relative;
}

.input-wrapper input { padding-right: 2.8rem; }

.pw-toggle {
  position: absolute;
  right: .75rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--gray-500);
  padding: 0;
  line-height: 0;
  transition: color .15s;
}

.pw-toggle:hover { color: var(--primary-dark); }

/* ── Buttons ──────────────────────────────────────────────── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .7rem 1.25rem;
  background: var(--primary);
  color: var(--white);
  border: none;
  border-radius: var(--radius-sm);
  font-size: .95rem;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: background .15s, transform .1s;
  text-decoration: none;
}

.btn-primary:hover {
  background: var(--primary-dark);
  color: var(--white);
}

.btn-primary:active { transform: scale(.98); }

.btn-block { width: 100%; margin-top: .5rem; }

.btn-logout {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .4rem .8rem;
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius-sm);
  font-size: .85rem;
  color: var(--gray-700);
  transition: border-color .15s, background .15s;
  white-space: nowrap;
}

.btn-logout:hover {
  border-color: var(--primary);
  color: var(--primary-dark);
  background: var(--primary-light);
}

.login-footer {
  font-size: .8rem;
  color: var(--gray-500);
  text-align: center;
}

/* ── Portal Header ────────────────────────────────────────── */
.portal-body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.portal-header {
  background: var(--white);
  border-bottom: 3px solid var(--primary);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: .6rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.header-logo img {
  height: 40px;
  width: auto;
  display: block;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.header-user {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .875rem;
  color: var(--gray-700);
}

.header-user svg { color: var(--primary); flex-shrink: 0; }

.user-name { font-weight: 600; }
.user-kdnr { color: var(--gray-500); font-size: .8rem; }

/* ── Main ─────────────────────────────────────────────────── */
.portal-main {
  flex: 1;
  padding: 1.5rem 1rem 2rem;
}

.portal-inner {
  max-width: 1200px;
  margin: 0 auto;
}

/* ── Welcome Bar ──────────────────────────────────────────── */
.welcome-bar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.welcome-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--gray-900);
}

.welcome-sub {
  font-size: .875rem;
  color: var(--gray-500);
  margin-top: .2rem;
}

.summary-chips {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  align-items: center;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: .3rem .75rem;
  border-radius: 50px;
  font-size: .8rem;
  font-weight: 600;
}

.chip-orange {
  background: var(--primary-light);
  color: var(--primary-dark);
}

.chip-red {
  background: var(--danger-bg);
  color: var(--danger);
}

/* ── Tab Navigation ───────────────────────────────────────── */
.tab-nav {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--gray-300);
  margin-bottom: 1.25rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.tab-link {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .75rem 1.25rem;
  font-size: .9rem;
  font-weight: 500;
  color: var(--gray-500);
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  white-space: nowrap;
  transition: color .15s, border-color .15s;
  text-decoration: none;
}

.tab-link:hover {
  color: var(--primary-dark);
  background: var(--primary-light);
}

.tab-link.active {
  color: var(--primary-dark);
  border-bottom-color: var(--primary);
  font-weight: 700;
}

.tab-link svg { flex-shrink: 0; }

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 10px;
  background: var(--primary);
  color: var(--white);
  font-size: .72rem;
  font-weight: 700;
  line-height: 1;
}

.badge-red {
  background: var(--danger);
}

/* ── Content Card ─────────────────────────────────────────── */
.content-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--gray-100);
}

.card-header h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--gray-900);
}

.card-count {
  font-size: .8rem;
  color: var(--gray-500);
}

/* ── Table ────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
}

.data-table th {
  padding: .65rem 1rem;
  text-align: left;
  font-size: .78rem;
  font-weight: 700;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: .04em;
  background: var(--gray-100);
  border-bottom: 1px solid var(--gray-300);
  white-space: nowrap;
}

.data-table td {
  padding: .7rem 1rem;
  border-bottom: 1px solid #f0f0f0;
  color: var(--gray-900);
  vertical-align: middle;
}

.data-table tbody tr:last-child td { border-bottom: none; }

.data-table tbody tr:hover { background: #fffaf2; }

.data-table tfoot td {
  padding: .75rem 1rem;
  border-top: 2px solid var(--gray-300);
  background: var(--gray-100);
}

.foot-label {
  font-size: .85rem;
  color: var(--gray-500);
  font-weight: 600;
}

.foot-total {
  font-weight: 700;
  font-size: 1rem;
  color: var(--primary-dark);
}

.row-warn { background: #fff8f0 !important; }
.row-warn:hover { background: #fff3e0 !important; }

/* ── Utility classes ──────────────────────────────────────── */
.text-right  { text-align: right; }
.text-center { text-align: center; }
.text-danger { color: var(--danger); font-weight: 600; }
.nowrap      { white-space: nowrap; }
.mono        { font-family: 'Consolas', 'Courier New', monospace; font-size: .88rem; }

/* ── Status Badge ─────────────────────────────────────────── */
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: .2rem .6rem;
  border-radius: 50px;
  font-size: .75rem;
  font-weight: 700;
  white-space: nowrap;
}

.status-orange {
  background: var(--primary-light);
  color: var(--primary-dark);
}

.status-red {
  background: var(--danger-bg);
  color: var(--danger);
}

.status-warn {
  background: #fff8e1;
  color: #b45309;
}

.status-green {
  background: #f0faf4;
  color: var(--success);
}

/* ── Empty State ──────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 3rem 1.5rem;
  text-align: center;
  gap: .75rem;
}

.empty-state h4 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--gray-700);
}

.empty-state p {
  font-size: .875rem;
  color: var(--gray-500);
  max-width: 340px;
}

/* ── Footer ───────────────────────────────────────────────── */
.portal-footer {
  padding: 1rem 1.5rem;
  text-align: center;
  font-size: .8rem;
  color: var(--gray-500);
  border-top: 1px solid var(--gray-300);
  background: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
}

.footer-sep { color: var(--gray-300); }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 640px) {
  .header-inner { padding: .5rem 1rem; }

  .header-logo img { height: 32px; }

  .user-kdnr { display: none; }

  .portal-main { padding: 1rem .75rem; }

  .welcome-bar { flex-direction: column; }

  .tab-link { padding: .6rem .9rem; font-size: .85rem; }

  .data-table th,
  .data-table td { padding: .55rem .75rem; font-size: .85rem; }

  .card-header { padding: .75rem 1rem; }

  .login-card { padding: 2rem 1.25rem; }
}

@media (max-width: 400px) {
  .header-user .user-name { display: none; }
}
