/* SAP Fiori Horizon Theme */
:root {
  --shell-bg:        #354A5E;
  --shell-text:      #FFFFFF;
  --page-bg:         #F5F6F7;
  --tile-bg:         #FFFFFF;
  --primary:         #0070F2;
  --primary-hover:   #0064D9;
  --text:            #32363A;
  --text-muted:      #6A6D70;
  --border:          #D9D9D9;
  --error:           #BB0000;
  --success:         #107E3E;
  --shadow:          0 0 0.25rem 0 rgba(0,0,0,.10), 0 0.5rem 1rem 0 rgba(0,0,0,.07);
  --shadow-hover:    0 0 0.5rem 0 rgba(0,0,0,.15), 0 0.75rem 1.5rem 0 rgba(0,0,0,.12);
  --radius:          0.5rem;
  --font:            "72", "72full", Arial, Helvetica, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background: var(--page-bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── Shell Header ────────────────────────────────────────────────────────── */

.shell-header {
  background: var(--shell-bg);
  color: var(--shell-text);
  height: 2.75rem;
  display: flex;
  align-items: center;
  padding: 0 1.25rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 6px rgba(0,0,0,.25);
}

.shell-logo {
  flex: 1;
  font-size: 0.9375rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  user-select: none;
}

.shell-logo-dot {
  width: 1rem;
  height: 1rem;
  background: var(--primary);
  border-radius: 2px;
  flex-shrink: 0;
}

.shell-user {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  font-size: 0.875rem;
}

.shell-username {
  opacity: 0.8;
  font-size: 0.8125rem;
}

.btn-shell {
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.25);
  color: #fff;
  height: 1.75rem;
  padding: 0 0.875rem;
  border-radius: 0.25rem;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  font-family: inherit;
}

.btn-shell:hover { background: rgba(255,255,255,0.22); }

/* ── Layout ──────────────────────────────────────────────────────────────── */

.content {
  padding: 2rem 2.5rem;
  max-width: 1440px;
  margin: 0 auto;
}

.page-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 1.5rem;
}

.page-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.page-header .page-title { margin-bottom: 0; }

/* ── Tile Grid ───────────────────────────────────────────────────────────── */

.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(10.5rem, 1fr));
  gap: 1rem;
}

.tile {
  background: var(--tile-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: 10.5rem;
  transition: box-shadow 0.18s, transform 0.18s;
  border: 1px solid rgba(0,0,0,.04);
}

.tile:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-3px);
}

.tile:active { transform: translateY(-1px); }

.tile-icon-area {
  height: 5.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  flex-shrink: 0;
}

.tile-body {
  padding: 0.625rem 0.875rem 0.75rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-top: 1px solid rgba(0,0,0,.04);
}

.tile-name {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tile-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Login ───────────────────────────────────────────────────────────────── */

.login-page { min-height: 100vh; display: flex; flex-direction: column; }

.login-shell {
  background: var(--shell-bg);
  height: 2.75rem;
  display: flex;
  align-items: center;
  padding: 0 1.25rem;
  color: #fff;
  font-size: 0.9375rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  gap: 0.5rem;
  box-shadow: 0 2px 6px rgba(0,0,0,.25);
}

.login-center {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: linear-gradient(145deg, #EEF2F7 0%, #F5F6F7 60%);
}

.login-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2.5rem 2.25rem;
  width: 100%;
  max-width: 22rem;
  border: 1px solid rgba(0,0,0,.06);
}

.login-card-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.375rem;
}

.login-card-sub {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
}

/* ── Form ────────────────────────────────────────────────────────────────── */

.form-group { margin-bottom: 1.125rem; }

.form-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.375rem;
}

.form-label-note {
  font-weight: 400;
  color: var(--text-muted);
  margin-left: 0.25rem;
}

.form-input {
  width: 100%;
  height: 2.25rem;
  padding: 0 0.75rem;
  border: 1px solid var(--border);
  border-radius: 0.25rem;
  font-size: 0.875rem;
  color: var(--text);
  background: #fff;
  outline: none;
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(0,112,242,.15);
}

.form-input[type="color"] {
  padding: 0.2rem 0.4rem;
  cursor: pointer;
}

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  height: 2.25rem;
  padding: 0 1.125rem;
  border-radius: 0.25rem;
  font-size: 0.875rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
  transition: all 0.15s;
  white-space: nowrap;
}

.btn-primary   { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-primary:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-secondary { background: #fff; color: var(--primary); border-color: var(--primary); }
.btn-secondary:hover { background: #EBF3FF; }

.btn-danger    { background: #fff; color: var(--error); border-color: var(--error); }
.btn-danger:hover { background: #FFF0F0; }
.btn-danger:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-sm { height: 1.875rem; padding: 0 0.75rem; font-size: 0.8125rem; }
.btn-full { width: 100%; }

/* ── Alerts ──────────────────────────────────────────────────────────────── */

.alert {
  padding: 0.75rem 1rem;
  border-radius: 0.25rem;
  font-size: 0.875rem;
  margin-bottom: 1rem;
}
.alert-error   { background: #FFEAEA; border: 1px solid #E8A3A3; color: var(--error); }
.alert-success { background: #E8F5EE; border: 1px solid #A3CEAE; color: var(--success); }

/* ── Tabs ────────────────────────────────────────────────────────────────── */

.tabs {
  display: flex;
  border-bottom: 2px solid var(--border);
  margin-bottom: 1.5rem;
}

.tab {
  padding: 0.75rem 1.375rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color 0.15s, border-color 0.15s;
  user-select: none;
}

.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ── Table ───────────────────────────────────────────────────────────────── */

.data-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 1px solid rgba(0,0,0,.05);
}

.data-table th {
  background: #F8F9FA;
  padding: 0.75rem 1rem;
  text-align: left;
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table td {
  padding: 0.875rem 1rem;
  font-size: 0.875rem;
  border-bottom: 1px solid #F0F0F0;
  vertical-align: middle;
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #FAFBFC; }

/* ── Badge ───────────────────────────────────────────────────────────────── */

.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 1rem;
  font-size: 0.75rem;
  font-weight: 600;
}
.badge-super   { background: #E8F0FE; color: #1a56db; }
.badge-user    { background: #F0F0F0; color: var(--text-muted); }
.badge-active  { background: #E8F5EE; color: var(--success); }
.badge-off     { background: #FFEAEA; color: var(--error); }

/* ── Actions ─────────────────────────────────────────────────────────────── */

.row-actions { display: flex; gap: 0.4rem; }

/* ── App Icon Cell ───────────────────────────────────────────────────────── */

.icon-preview {
  width: 2rem;
  height: 2rem;
  border-radius: 0.375rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.125rem;
  flex-shrink: 0;
}

/* ── Modal ───────────────────────────────────────────────────────────────── */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  backdrop-filter: blur(2px);
}

.modal {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: 0 1rem 3rem rgba(0,0,0,.22);
  width: 100%;
  max-width: 28rem;
  max-height: 92vh;
  overflow-y: auto;
  animation: modal-in 0.18s ease;
}

.modal-lg { max-width: 34rem; }

@keyframes modal-in {
  from { opacity: 0; transform: translateY(-12px) scale(.97); }
  to   { opacity: 1; transform: none; }
}

.modal-header {
  padding: 1.25rem 1.5rem 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title { font-size: 1rem; font-weight: 700; }

.modal-close {
  background: none;
  border: none;
  font-size: 1.375rem;
  line-height: 1;
  cursor: pointer;
  color: var(--text-muted);
  padding: 0.125rem;
  font-family: inherit;
  transition: color 0.1s;
}
.modal-close:hover { color: var(--text); }

.modal-body   { padding: 1.25rem 1.5rem; }
.modal-footer { padding: 0 1.5rem 1.375rem; display: flex; gap: 0.75rem; justify-content: flex-end; }

/* ── Permissions Checkboxes ──────────────────────────────────────────────── */

.perm-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.perm-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.625rem;
  border: 1px solid var(--border);
  border-radius: 0.25rem;
  cursor: pointer;
  transition: background 0.1s, border-color 0.1s;
  font-size: 0.8125rem;
}

.perm-item:hover { background: #F0F7FF; border-color: #A8CAFF; }

.perm-item input[type="checkbox"] {
  width: 0.9375rem;
  height: 0.9375rem;
  accent-color: var(--primary);
  cursor: pointer;
  flex-shrink: 0;
}

/* ── Empty / Loading ─────────────────────────────────────────────────────── */

.empty-state {
  text-align: center;
  padding: 3.5rem 2rem;
  color: var(--text-muted);
  font-size: 0.9375rem;
}

.loading-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 3.5rem;
  color: var(--text-muted);
  font-size: 0.875rem;
  gap: 0.75rem;
}

.spinner {
  width: 2rem;
  height: 2rem;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Hebamme / Chat ──────────────────────────────────────────────────────── */

:root {
  --hebamme:       #4CAF50;
  --hebamme-light: #E8F5E9;
  --hebamme-hover: #388E3C;
  --rose:          #E91E8C;
}

.btn-hebamme {
  background: var(--hebamme);
  color: #fff;
  border-color: var(--hebamme);
}
.btn-hebamme:hover { background: var(--hebamme-hover); border-color: var(--hebamme-hover); }

.hebamme-bar {
  background: linear-gradient(90deg, #2E7D32 0%, #4CAF50 100%);
  color: #fff;
  padding: 0.5rem 1rem;
  font-size: 0.8125rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.hebamme-bar select {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.35);
  color: #fff;
  border-radius: 0.25rem;
  padding: 0.25rem 0.5rem;
  font-size: 0.875rem;
  font-family: inherit;
  cursor: pointer;
  outline: none;
  min-width: 10rem;
}

.hebamme-bar select option { background: #2E7D32; color: #fff; }

.chat-layout {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 2.75rem - 3rem);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background: #F7F9FB;
}

.chat-bubble-wrap {
  display: flex;
  flex-direction: column;
  max-width: 72%;
}

.chat-bubble-wrap.user  { align-self: flex-end; align-items: flex-end; }
.chat-bubble-wrap.assistant { align-self: flex-start; align-items: flex-start; }

.chat-bubble {
  padding: 0.75rem 1rem;
  border-radius: 1rem;
  font-size: 0.9rem;
  line-height: 1.6;
  word-break: break-word;
}

.chat-bubble.user {
  background: var(--primary);
  color: #fff;
  border-bottom-right-radius: 0.2rem;
}

.chat-bubble.assistant {
  background: #fff;
  color: var(--text);
  border: 1px solid #E0E0E0;
  border-bottom-left-radius: 0.2rem;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}

.chat-bubble.assistant p { margin: 0 0 0.5em; }
.chat-bubble.assistant p:last-child { margin-bottom: 0; }
.chat-bubble.assistant ul, .chat-bubble.assistant ol { padding-left: 1.25rem; margin: 0.25em 0 0.5em; }
.chat-bubble.assistant li { margin-bottom: 0.25em; }
.chat-bubble.assistant strong { font-weight: 700; }
.chat-bubble.assistant em { font-style: italic; }
.chat-bubble.assistant code {
  background: #F0F0F0;
  padding: 0.1em 0.35em;
  border-radius: 0.2rem;
  font-size: 0.85em;
  font-family: monospace;
}
.chat-bubble.assistant h1,.chat-bubble.assistant h2,.chat-bubble.assistant h3 {
  font-size: 1em;
  font-weight: 700;
  margin: 0.5em 0 0.25em;
}

.chat-sender {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
  padding: 0 0.25rem;
}

.chat-input-area {
  border-top: 1px solid var(--border);
  background: #fff;
  padding: 0.875rem 1.25rem;
  display: flex;
  gap: 0.75rem;
  align-items: flex-end;
}

.chat-textarea {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 0.625rem 0.875rem;
  font-size: 0.9rem;
  font-family: inherit;
  resize: none;
  outline: none;
  max-height: 8rem;
  min-height: 2.75rem;
  line-height: 1.5;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.chat-textarea:focus {
  border-color: var(--hebamme);
  box-shadow: 0 0 0 2px rgba(76,175,80,.15);
}

.chat-send-btn {
  height: 2.75rem;
  width: 2.75rem;
  border-radius: 50%;
  background: var(--hebamme);
  border: none;
  color: #fff;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, transform 0.1s;
}

.chat-send-btn:hover { background: var(--hebamme-hover); }
.chat-send-btn:active { transform: scale(0.95); }
.chat-send-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.chat-empty {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9375rem;
  padding: 4rem 2rem;
}

.chat-empty-icon {
  font-size: 3rem;
  margin-bottom: 0.75rem;
}

.thinking-dots span {
  display: inline-block;
  width: 0.45rem;
  height: 0.45rem;
  background: var(--hebamme);
  border-radius: 50%;
  margin: 0 0.1rem;
  animation: dot-bounce 1.2s infinite;
}
.thinking-dots span:nth-child(2) { animation-delay: 0.2s; }
.thinking-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes dot-bounce {
  0%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-6px); }
}

/* ── Responsive ──────────────────────────────────────────────────────────── */

@media (max-width: 640px) {
  .content { padding: 1rem; }
  .tile-grid { grid-template-columns: repeat(2, 1fr); }
  .perm-grid { grid-template-columns: 1fr; }
  .form-grid-2 { grid-template-columns: 1fr; }
  .data-table td, .data-table th { padding: 0.625rem 0.75rem; }
  .chat-bubble-wrap { max-width: 90%; }
  .chat-messages { padding: 1rem; }
}
