/* ==========================================================================
   JM Energy Consulting — Portal Shared Stylesheet
   Style-System konsistent zur Hauptseite (Fraunces + Inter, JM-Logo-Palette).
   ========================================================================== */

:root {
  --bg-deep:    #0B0F14;
  --bg:         #0E141B;
  --bg-2:       #141B23;
  --bg-3:       #1A2330;
  --slate:      #6B8294;
  --slate-soft: #8FA3B3;
  --taupe:      #C8B89F;
  --taupe-soft: #E8DDC8;
  --ivory:      #F2EBDC;
  --line:       #1E2731;
  --line-soft:  #28323F;
  --muted:      #6F7A85;
  --success:    #6ECB8E;
  --warn:       #E0B255;
  --danger:     #E07A6E;
  --info:       #5B8DEF;

  --display: 'Fraunces', Georgia, serif;
  --body: 'Inter', -apple-system, system-ui, sans-serif;
  --mono: 'SF Mono', Menlo, ui-monospace, monospace;

  --radius-sm: 10px;
  --radius:    16px;
  --radius-lg: 22px;
  --radius-xl: 28px;

  --shadow-1: 0 8px 24px -8px rgba(0,0,0,0.35), 0 2px 4px -2px rgba(0,0,0,0.2);
  --shadow-2: 0 24px 48px -12px rgba(0,0,0,0.5), 0 4px 8px -4px rgba(0,0,0,0.25);
  --shadow-glow: 0 0 0 1px rgba(200,184,159,0.18), 0 24px 48px -12px rgba(200,184,159,0.18);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  background: var(--bg-deep); color: var(--ivory);
  font-family: var(--body); font-size: 15px; line-height: 1.6;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
body { min-height: 100vh; overflow-x: hidden; }
::selection { background: var(--taupe); color: var(--bg-deep); }

/* Grain overlay across portal */
body::after {
  content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 200;
  background-image: url("data:image/svg+xml;utf8,<svg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.04 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  opacity: 0.5; mix-blend-mode: overlay;
}

/* Atmospheric brain bg (very subtle in portal) */
.portal-bg {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(ellipse 80% 50% at 75% 30%, rgba(143,163,179,0.05), transparent 60%),
    radial-gradient(ellipse 60% 40% at 20% 80%, rgba(200,184,159,0.04), transparent 60%);
  background-color: var(--bg-deep);
}
.portal-bg::before {
  content: ''; position: absolute; inset: -10%;
  background: url('../assets/hero_artwork_v3.jpg') center/cover no-repeat;
  opacity: 0.06; filter: saturate(0.7) brightness(0.6) blur(2px);
  animation: portalDrift 60s ease-in-out infinite alternate;
}
@keyframes portalDrift { 0% { transform: scale(1.0); } 100% { transform: scale(1.08) translate(-1%, -1%); } }

/* Typography */
h1, h2, h3, h4 { font-family: var(--display); font-weight: 300; letter-spacing: -0.025em; line-height: 1.1; }
h1 { font-size: clamp(36px, 4.6vw, 72px); font-weight: 300; letter-spacing: -0.04em; }
h1 em { font-style: italic; color: var(--taupe); font-weight: 400; }
h2 { font-size: clamp(28px, 3vw, 44px); font-weight: 400; }
h2 em { font-style: italic; color: var(--taupe); font-weight: 400; }
h3 { font-size: 22px; font-weight: 500; }
h4 { font-size: 16px; font-weight: 500; letter-spacing: 0; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 12px;
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.3em; text-transform: uppercase;
  color: var(--taupe); margin-bottom: 22px;
}
.eyebrow::before { content: ''; width: 28px; height: 1px; background: var(--taupe); }
.lede { font-size: 17px; color: var(--slate-soft); max-width: 720px; line-height: 1.55; font-weight: 300; }
.muted { color: var(--muted); }

/* Top Nav */
.nav {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 28px; gap: 20px;
  background: rgba(11,15,20,0.85); backdrop-filter: blur(24px) saturate(140%);
  border-bottom: 1px solid var(--line);
}
.nav .brand { display: flex; align-items: center; gap: 14px; text-decoration: none; color: inherit; }
.nav .brand .logo { font-family: var(--display); font-size: 18px; font-style: italic; }
.nav .brand .logo span { color: var(--taupe); font-style: normal; }
.nav .brand .scope {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.25em; text-transform: uppercase;
  padding: 4px 10px; border: 1px solid var(--line-soft); border-radius: 100px; color: var(--taupe);
}
.nav .nav-links { display: flex; gap: 4px; align-items: center; }
.nav .nav-links a {
  font-size: 13.5px; padding: 9px 14px; border-radius: 8px; color: var(--slate-soft);
  text-decoration: none; transition: all 0.2s ease; position: relative;
}
.nav .nav-links a:hover { color: var(--ivory); background: rgba(255,255,255,0.04); }
.nav .nav-links a.active { color: var(--ivory); background: rgba(200,184,159,0.10); }
.nav .nav-right { display: flex; gap: 10px; align-items: center; }
.nav .user-pill {
  display: flex; align-items: center; gap: 10px; padding: 6px 12px 6px 6px;
  border: 1px solid var(--line-soft); border-radius: 100px;
  font-size: 12.5px; color: var(--slate-soft); text-decoration: none;
  transition: all 0.2s ease;
}
.nav .user-pill:hover { border-color: var(--taupe); color: var(--ivory); }
.nav .user-pill .avatar {
  width: 26px; height: 26px; border-radius: 50%;
  background: linear-gradient(135deg, var(--taupe) 0%, var(--slate-soft) 100%);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600; color: var(--bg-deep); letter-spacing: 0.05em;
}
.nav .signout {
  font-size: 12px; color: var(--muted); padding: 8px 12px; border-radius: 8px;
  border: 1px solid transparent; cursor: pointer; background: transparent;
  font-family: var(--body); transition: all 0.2s ease;
}
.nav .signout:hover { color: var(--danger); border-color: var(--line); }

/* Layout shell */
.shell { position: relative; z-index: 1; min-height: calc(100vh - 60px); }
.container { max-width: 1500px; margin: 0 auto; padding: 48px 28px; position: relative; }
.page-head { margin-bottom: 40px; display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; }
.page-head .head-text { flex: 1; min-width: 280px; }
.page-head h1 { margin-bottom: 12px; }
.page-head .lede { font-size: 16px; }

/* Watermark */
.watermark {
  position: absolute; top: 24px; right: 0;
  font-family: var(--display); font-style: italic; font-weight: 300;
  font-size: clamp(140px, 22vw, 320px); line-height: 0.8; letter-spacing: -0.05em;
  color: transparent; -webkit-text-stroke: 1.2px rgba(200,184,159,0.18);
  pointer-events: none; user-select: none; z-index: 0;
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 12px 22px; border-radius: 100px; font-size: 13.5px; font-weight: 500;
  font-family: var(--body); cursor: pointer; transition: all 0.2s ease;
  text-decoration: none; border: 1px solid transparent; letter-spacing: 0.01em;
}
.btn-primary { background: var(--taupe); color: var(--bg-deep); border-color: var(--taupe); }
.btn-primary:hover { background: var(--taupe-soft); border-color: var(--taupe-soft); transform: translateY(-1px); box-shadow: 0 8px 16px -4px rgba(200,184,159,0.2); }
.btn-secondary { background: transparent; color: var(--ivory); border-color: var(--line); }
.btn-secondary:hover { border-color: var(--taupe); color: var(--taupe); }
.btn-ghost { background: transparent; color: var(--slate-soft); border-color: transparent; padding: 10px 16px; }
.btn-ghost:hover { color: var(--taupe); background: rgba(200,184,159,0.06); }
.btn-danger { background: transparent; color: var(--danger); border-color: rgba(224,122,110,0.3); }
.btn-danger:hover { background: rgba(224,122,110,0.1); border-color: var(--danger); }
.btn-sm { padding: 8px 14px; font-size: 12px; }
.btn-icon { width: 36px; height: 36px; padding: 0; justify-content: center; border: 1px solid var(--line); background: transparent; color: var(--slate-soft); border-radius: 10px; }
.btn-icon:hover { border-color: var(--taupe); color: var(--taupe); }

/* Cards */
.card {
  background: linear-gradient(180deg, var(--bg-2) 0%, var(--bg) 100%);
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 28px; position: relative; overflow: hidden;
  transition: transform 0.4s cubic-bezier(.2,.7,.2,1), border-color 0.3s ease, box-shadow 0.3s ease;
}
.card:hover { border-color: var(--line-soft); box-shadow: var(--shadow-1); }
.card.tile { padding: 32px; min-height: 220px; display: flex; flex-direction: column; cursor: pointer; text-decoration: none; color: inherit; }
a.card.tile, a.card.tile:hover { text-decoration: none; color: inherit; }
.card.tile::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(circle at 0% 0%, rgba(200,184,159,0.08), transparent 60%);
  opacity: 0; transition: opacity 0.4s ease;
}
.card.tile:hover { transform: translateY(-3px); border-color: rgba(200,184,159,0.4); box-shadow: var(--shadow-glow); }
.card.tile:hover::before { opacity: 1; }
.card.tile h3 { font-family: var(--display); font-size: 26px; font-weight: 400; margin-bottom: 8px; }
.card.tile h3 em { font-style: italic; color: var(--taupe); }
.card.tile .desc { color: var(--slate-soft); font-size: 14px; line-height: 1.55; font-weight: 300; flex: 1; max-width: 480px; }
.card.tile .meta {
  margin-top: 20px; display: flex; justify-content: space-between; align-items: center;
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.15em; text-transform: uppercase;
  color: var(--muted);
}
.card.tile .meta .arrow { color: var(--taupe); font-family: var(--body); font-size: 18px; transition: transform 0.3s ease; }
.card.tile:hover .meta .arrow { transform: translateX(4px); }
.card.tile .badge {
  display: inline-flex; padding: 3px 10px; border-radius: 100px; font-size: 10.5px;
  font-family: var(--mono); letter-spacing: 0.15em; text-transform: uppercase;
}
.card.tile .badge.admin { background: rgba(224,122,110,0.10); color: var(--danger); border: 1px solid rgba(224,122,110,0.3); }
.card.tile .badge.shared { background: rgba(91,141,239,0.10); color: var(--info); border: 1px solid rgba(91,141,239,0.3); }
.card.tile .badge.new { background: rgba(110,203,142,0.10); color: var(--success); border: 1px solid rgba(110,203,142,0.3); }

/* Stats / KPI block */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 32px; }
.kpi {
  background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px 22px;
}
.kpi .label {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 10px;
}
.kpi .value { font-family: var(--display); font-size: 38px; font-weight: 300; line-height: 1; letter-spacing: -0.02em; color: var(--ivory); }
.kpi .value em { font-style: italic; color: var(--taupe); font-weight: 400; }
.kpi .delta { margin-top: 8px; font-size: 12px; color: var(--success); display: flex; align-items: center; gap: 6px; }
.kpi .delta.down { color: var(--danger); }
.kpi .delta.flat { color: var(--muted); }

/* Status pills */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 100px; font-family: var(--mono);
  font-size: 10.5px; letter-spacing: 0.15em; text-transform: uppercase; font-weight: 500;
}
.pill.gruen   { background: rgba(110,203,142,0.10); color: var(--success); border: 1px solid rgba(110,203,142,0.3); }
.pill.gelb    { background: rgba(224,178,85,0.10); color: var(--warn); border: 1px solid rgba(224,178,85,0.3); }
.pill.rot     { background: rgba(224,122,110,0.10); color: var(--danger); border: 1px solid rgba(224,122,110,0.3); }
.pill.gelbgruen { background: rgba(168,255,96,0.06); color: #B8E287; border: 1px solid rgba(168,255,96,0.25); }
.pill.schwarz { background: rgba(60,67,79,0.30); color: var(--ivory); border: 1px solid var(--line-soft); }
.pill.offen   { background: rgba(143,163,179,0.10); color: var(--slate-soft); border: 1px solid var(--line-soft); }
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; box-shadow: 0 0 8px currentColor; }

/* Tables */
.table {
  width: 100%; border-collapse: collapse; background: var(--bg-2);
  border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden;
}
.table th {
  text-align: left; padding: 14px 18px;
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--muted); font-weight: 500; border-bottom: 1px solid var(--line);
  background: var(--bg-3);
}
.table td { padding: 16px 18px; border-bottom: 1px solid var(--line); font-size: 14px; color: var(--ivory); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: rgba(200,184,159,0.04); }
.table .meta-row { font-size: 12px; color: var(--muted); margin-top: 4px; font-family: var(--mono); }

/* Forms */
.field { margin-bottom: 18px; }
.field label {
  display: block; font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.2em;
  text-transform: uppercase; color: var(--taupe); margin-bottom: 8px; font-weight: 500;
}
.input, .select, .textarea {
  width: 100%; padding: 12px 14px; border-radius: 10px;
  background: var(--bg); border: 1px solid var(--line);
  color: var(--ivory); font-family: var(--body); font-size: 14.5px;
  transition: border-color 0.2s ease, background 0.2s ease;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--taupe); background: var(--bg-2);
  box-shadow: 0 0 0 3px rgba(200,184,159,0.10);
}
.input::placeholder, .textarea::placeholder { color: var(--muted); }
.textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
.help { font-size: 12px; color: var(--muted); margin-top: 6px; }
.error-msg { font-size: 12.5px; color: var(--danger); margin-top: 6px; display: flex; align-items: center; gap: 6px; }

/* Section headers */
.section-h {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 18px; gap: 16px; flex-wrap: wrap;
}
.section-h .title-block .label {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.3em; text-transform: uppercase;
  color: var(--taupe); margin-bottom: 6px;
}
.section-h .title-block h2 { margin: 0; }

/* Empty / loading states */
.empty {
  padding: 60px 32px; text-align: center; border: 1px dashed var(--line-soft);
  border-radius: var(--radius-lg); background: rgba(20,27,35,0.5);
}
.empty .ico { font-size: 32px; color: var(--taupe); margin-bottom: 14px; }
.empty h4 { font-size: 18px; font-weight: 400; margin-bottom: 8px; }
.empty p { color: var(--slate-soft); font-size: 13.5px; max-width: 460px; margin: 0 auto 20px; }
.skeleton { background: linear-gradient(90deg, var(--bg-2), var(--bg-3), var(--bg-2)); background-size: 200% 100%; animation: skel 1.4s linear infinite; border-radius: 8px; }
@keyframes skel { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* Footer */
.portal-footer {
  position: relative; z-index: 1;
  padding: 32px 28px; border-top: 1px solid var(--line);
  display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap;
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.05em; color: var(--muted);
}
.portal-footer a { color: var(--muted); text-decoration: none; margin-left: 24px; }
.portal-footer a:hover { color: var(--taupe); }

/* Toast */
.toast-stack { position: fixed; bottom: 24px; right: 24px; z-index: 400; display: flex; flex-direction: column; gap: 10px; }
.toast {
  padding: 14px 18px; border-radius: 12px; background: var(--bg-2);
  border: 1px solid var(--line-soft); color: var(--ivory); font-size: 13.5px;
  display: flex; align-items: center; gap: 12px; min-width: 280px; max-width: 380px;
  box-shadow: var(--shadow-2);
  animation: toastIn 0.4s cubic-bezier(.2,.7,.2,1);
}
.toast.success { border-color: rgba(110,203,142,0.4); }
.toast.error { border-color: rgba(224,122,110,0.4); }
.toast .ico { font-size: 16px; }
@keyframes toastIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

/* Modal */
.modal-bd { position: fixed; inset: 0; background: rgba(11,15,20,0.75); backdrop-filter: blur(8px); z-index: 350; display: flex; align-items: center; justify-content: center; padding: 24px; }
.modal {
  background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius-xl);
  padding: 32px; max-width: 560px; width: 100%; max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow-2);
}
.modal h3 { margin-bottom: 12px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 28px; }

/* Responsive */
@media (max-width: 800px) {
  .nav { padding: 12px 16px; flex-wrap: wrap; }
  .nav .nav-links { display: none; }
  .container { padding: 32px 16px; }
  h1 { font-size: 32px; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .watermark { font-size: 120px; }
}

/* Utility */
.row { display: flex; gap: 16px; align-items: center; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: 14px; }
.spacer-12 { height: 12px; } .spacer-24 { height: 24px; } .spacer-48 { height: 48px; }
.divider { height: 1px; background: var(--line); margin: 32px 0; }
.text-taupe { color: var(--taupe); }
.text-mono { font-family: var(--mono); }
.text-display { font-family: var(--display); }
.text-italic { font-style: italic; }
.tag {
  display: inline-flex; padding: 3px 10px; border-radius: 100px;
  background: rgba(143,163,179,0.10); color: var(--slate-soft);
  font-size: 11px; font-family: var(--mono); letter-spacing: 0.05em;
}
