:root {
  color-scheme: dark;
  --bg: #0e151c;
  --panel: #151f28;
  --panel-soft: #1b2731;
  --text: #f4f7f8;
  --muted: #a9b7c2;
  --line: rgba(255,255,255,.12);
  --green: #237f44;
  --green-2: #1a6537;
  --blue: #2167b8;
  --blue-2: #174f91;
  --yellow: #d8a729;
  --red: #cf3d47;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: radial-gradient(circle at top left, #1a2630 0, #0e151c 38rem); color: var(--text); font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; letter-spacing: 0; }
body { display: flex; flex-direction: column; }
a { color: inherit; }
.topbar { height: 64px; display: flex; align-items: center; justify-content: space-between; padding: 0 18px; background: rgba(8, 13, 18, .88); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; backdrop-filter: blur(14px); }
.brand { display: inline-flex; gap: 10px; align-items: center; text-decoration: none; font-weight: 800; }
.brand-logo { width: 34px; height: 34px; }
.topnav { display: flex; gap: 10px; align-items: center; }
.user-chip { max-width: 38vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.logout-form { margin: 0; }
.icon-button { width: 40px; height: 40px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--text); cursor: pointer; }
.logout-button { width: auto; min-width: 92px; padding: 0 10px; font-weight: 800; }
.page { width: min(1180px, 100%); margin: 0 auto; padding: 24px 16px 42px; flex: 1; }
.footer { display: flex; justify-content: space-between; gap: 16px; color: var(--muted); padding: 14px 18px; border-top: 1px solid var(--line); font-size: 13px; }
.hero, .section-block, .camera-view, .form-panel, .logs-panel, .guest-panel { margin-bottom: 28px; }
h1, h2 { margin: 0 0 10px; line-height: 1.15; }
h1 { font-size: clamp(28px, 4vw, 42px); }
h2 { font-size: 20px; color: #e9f0f4; }
p { color: var(--muted); margin: 0 0 14px; }
.admin-actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 0 0 26px; }
.admin-actions a, .back-link, .secondary-button { border: 1px solid var(--line); background: var(--panel-soft); color: var(--text); padding: 10px 14px; border-radius: 8px; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; min-height: 42px; }
.tile-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(174px, 1fr)); gap: 14px; }
.tile { min-height: 178px; border-radius: 8px; border: 1px solid rgba(255,255,255,.10); overflow: hidden; text-decoration: none; box-shadow: 0 16px 40px rgba(0,0,0,.18); }
.tile button, .tile.camera-tile { width: 100%; height: 100%; min-height: 178px; border: 0; color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 18px; cursor: pointer; text-align: center; }
.gate-tile button { background: linear-gradient(160deg, var(--green), var(--green-2)); }
.camera-tile { background: linear-gradient(160deg, var(--blue), var(--blue-2)); }
.tile img { width: 58px; height: 58px; object-fit: contain; }
.tile strong { font-size: 18px; line-height: 1.2; overflow-wrap: anywhere; }
.tile span { color: rgba(255,255,255,.82); font-size: 14px; }
.tile em { font-style: normal; font-weight: 800; font-size: 13px; padding: 6px 10px; border-radius: 8px; background: rgba(0,0,0,.18); }
.tile button:disabled { opacity: .72; cursor: progress; }
.messages { display: grid; gap: 10px; margin-bottom: 18px; }
.message { padding: 12px 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); }
.message.success { border-color: rgba(39, 183, 93, .55); }
.message.error { border-color: rgba(207, 61, 71, .65); }
.app-alert-modal[hidden] { display: none; }
.app-alert-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(2, 6, 10, .72);
  backdrop-filter: blur(8px);
}
.app-alert-card {
  width: min(520px, 100%);
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 8px;
  background: rgba(11,17,23,.97);
  box-shadow: 0 18px 60px rgba(0,0,0,.45);
}
.app-alert-card h2 { margin: 0; }
.app-alert-list { display: grid; gap: 10px; }
.app-alert-item {
  display: grid;
  gap: 5px;
  padding: 12px;
  border-left: 5px solid var(--blue);
  border-radius: 8px;
  background: rgba(255,255,255,.06);
}
.app-alert-item.tone-warning { border-left-color: #d8a729; }
.app-alert-item.tone-success { border-left-color: #237f44; }
.app-alert-item strong { color: var(--text); }
.app-alert-item span { color: var(--muted); }
.app-alert-item a { color: #9fcdff; font-weight: 800; text-decoration: none; }
.app-alert-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.empty { padding: 18px; border: 1px dashed var(--line); border-radius: 8px; }
.auth-panel { min-height: calc(100vh - 190px); display: grid; place-items: center; }
.auth-card, .form-panel, .logs-panel, .guest-panel { background: rgba(21, 31, 40, .86); border: 1px solid var(--line); border-radius: 8px; padding: 22px; box-shadow: 0 24px 60px rgba(0,0,0,.24); }
.auth-card { width: min(430px, 100%); }
.stack-form { display: grid; gap: 14px; }
.stack-form p, .stack-form label { display: grid; gap: 7px; margin: 0; color: var(--muted); }
input, select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 8px; background: #0b1117; color: var(--text); padding: 11px 12px; min-height: 42px; }
input[type="checkbox"] { width: auto; min-height: 0; }
.primary-button { border: 0; border-radius: 8px; min-height: 46px; padding: 12px 16px; color: white; background: linear-gradient(160deg, #2878d0, #1d5ba0); font-weight: 800; cursor: pointer; }
.back-link { margin-bottom: 18px; }
.camera-view { text-align: center; }
.snapshot { width: 100%; max-height: 72vh; object-fit: contain; border-radius: 8px; border: 1px solid var(--line); background: #070b10; display: block; margin: 16px auto; }
.created-link { display: grid; gap: 8px; padding: 14px; border-radius: 8px; border: 1px solid rgba(39, 183, 93, .55); margin-bottom: 16px; }
.notice { margin-top: 18px; border: 1px solid rgba(33,103,184,.6); background: rgba(33,103,184,.12); padding: 14px; border-radius: 8px; color: #cfe5ff; }
.action-notice { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 20px; }
.action-notice strong { color: #fff; }
.action-notice a { color: #fff; font-weight: 800; }
.filter-bar { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 14px 0 18px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; }
.log-table { width: 100%; border-collapse: collapse; min-width: 820px; }
.log-table th, .log-table td { padding: 11px 12px; text-align: left; border-bottom: 1px solid var(--line); color: #dce5ea; }
.log-table th { background: #101923; color: var(--muted); font-size: 13px; }
.log-success td:last-child, .log-success td:nth-child(6) { color: #62d98b; }
.log-error td:last-child, .log-error td:nth-child(6) { color: #ff8d96; }
.log-denied td:last-child, .log-denied td:nth-child(6) { color: #f3cd66; }
@media (max-width: 680px) {
  .topbar { padding: 0 12px; }
  .page { padding: 20px 12px 34px; }
  .tile-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tile, .tile button, .tile.camera-tile { min-height: 150px; }
  .tile strong { font-size: 15px; }
  .tile img { width: 48px; height: 48px; }
  .footer { flex-direction: column; }
}

/* Albrecht branding overrides */
html, body { background: #0b1117; }
body { position: relative; isolation: isolate; }
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    linear-gradient(90deg, rgba(7, 11, 16, .90), rgba(7, 11, 16, .70) 46%, rgba(7, 11, 16, .84)),
    linear-gradient(0deg, rgba(7, 11, 16, .78), rgba(7, 11, 16, .18) 54%, rgba(7, 11, 16, .62)),
    url("/static/img/albrecht-background.jpg") center center / cover no-repeat;
}
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: rgba(8, 12, 16, .18);
}
.topbar {
  background: rgba(7, 11, 16, .82);
  box-shadow: 0 12px 34px rgba(0, 0, 0, .28);
}
.brand { min-width: 0; gap: 0; }
.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: min(48vw, 292px);
  height: 46px;
  padding: 4px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, .96);
  border: 1px solid rgba(255, 255, 255, .18);
  box-shadow: 0 10px 26px rgba(0, 0, 0, .28);
}
.brand-logo.company-logo {
  width: auto;
  max-width: 270px;
  height: auto;
  max-height: 38px;
  object-fit: contain;
  display: block;
}
.brand-app-name {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0;
  color: #f6f8f9;
}
.auth-card, .form-panel, .logs-panel, .guest-panel {
  background: rgba(14, 21, 28, .90);
  backdrop-filter: blur(14px);
}
.message, .admin-actions a, .back-link, .secondary-button, input, select, textarea {
  backdrop-filter: blur(12px);
}
.tile {
  box-shadow: 0 18px 44px rgba(0,0,0,.34);
}
.footer {
  background: rgba(7, 11, 16, .72);
  backdrop-filter: blur(12px);
}
.snapshot {
  box-shadow: 0 20px 52px rgba(0, 0, 0, .36);
}
@media (max-width: 680px) {
  .brand { gap: 0; }
  .brand-mark { max-width: 58vw; height: 42px; padding: 4px 7px; }
  .brand-logo.company-logo { max-width: 185px; max-height: 33px; }
  .brand-app-name { font-size: 12px; }
  body::before { background-position: center top; }
}


/* Mobile guest links and setup */
.share-sheet {
  display: grid;
  gap: 14px;
  margin-bottom: 20px;
  padding: 16px;
  border: 1px solid rgba(39, 183, 93, .55);
  border-radius: 8px;
  background: rgba(35, 127, 68, .12);
}
.share-sheet p,
.qr-card p,
.setup-hero p { margin: 0; }
.share-url-label {
  display: grid;
  gap: 7px;
  color: var(--muted);
}
.share-url-input {
  font-size: 15px;
}
.share-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 10px;
}
.share-actions a,
.share-actions button {
  width: 100%;
}
.qr-card {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 14px;
  border-radius: 8px;
  background: rgba(255, 255, 255, .94);
  color: #121820;
}
.qr-code {
  width: min(100%, 310px);
}
.qr-code svg {
  width: 100%;
  height: auto;
  display: block;
}
.setup-hero {
  margin-bottom: 18px;
}
.setup-panel {
  margin-bottom: 22px;
}
.setup-form {
  display: grid;
  gap: 16px;
}
.setup-list {
  display: grid;
  gap: 14px;
}
.setup-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: rgba(7, 11, 16, .28);
}
.setup-item h3 {
  margin: 0 0 12px;
  font-size: 18px;
}
.setup-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
}
.setup-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
}
.setup-grid label em {
  color: #ff9aa2;
  font-style: normal;
  font-size: 13px;
}
.toggle-row {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,.04);
}
.toggle-row input {
  width: 22px;
  height: 22px;
}
@media (max-width: 680px) {
  .share-actions {
    grid-template-columns: 1fr 1fr;
  }
  .share-actions .primary-button,
  .share-actions .secondary-button {
    min-height: 48px;
    padding-left: 10px;
    padding-right: 10px;
  }
  .setup-grid {
    grid-template-columns: 1fr;
  }
}

/* Dashboard camera live previews */
.camera-live-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}
.camera-live-tile {
  min-height: 0;
  background: rgba(10, 16, 22, .88);
}
.camera-live-link {
  display: grid;
  color: #fff;
  text-decoration: none;
  min-height: 100%;
}
.camera-live-frame {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #05080d;
}
.camera-live-tile .camera-live-img {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  object-fit: contain;
  display: block;
}
.camera-live-badge,
.camera-live-error {
  position: absolute;
  left: 10px;
  bottom: 10px;
  padding: 5px 8px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 800;
  background: rgba(35, 127, 68, .88);
  color: #fff;
}
.camera-live-error {
  display: none;
  background: rgba(207, 61, 71, .92);
}
.camera-archive-badge {
  background: rgba(33, 103, 184, .9);
}
.camera-slide-time {
  position: absolute;
  right: 10px;
  bottom: 10px;
  max-width: calc(100% - 120px);
  padding: 5px 8px;
  border-radius: 8px;
  background: rgba(0,0,0,.68);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  text-align: right;
}
.camera-live-tile[data-camera-state="error"] .camera-live-badge { display: none; }
.camera-live-tile[data-camera-state="error"] .camera-live-error { display: inline-flex; }
.camera-live-tile[data-camera-state="error"] .camera-live-img { opacity: .45; }
.camera-live-meta {
  display: grid;
  gap: 5px;
  padding: 13px 14px 15px;
}
.camera-live-meta strong {
  font-size: 18px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}
.camera-live-meta span {
  color: rgba(255,255,255,.78);
  font-size: 14px;
}
.camera-live-meta .camera-timestamp {
  color: #d9e7ef;
  font-size: 12px;
}
.camera-live-meta .camera-path {
  color: rgba(255,255,255,.56);
  font-size: 11px;
  overflow-wrap: anywhere;
}
.camera-live-meta em {
  width: max-content;
  max-width: 100%;
  font-style: normal;
  font-weight: 800;
  font-size: 13px;
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(33, 103, 184, .7);
}
.camera-detail-panel {
  display: grid;
  gap: 12px;
  width: min(1080px, 100%);
  margin: 0 auto 28px;
}
.camera-detail-frame {
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #05080d;
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 9;
  max-height: min(68vh, 720px);
}
.camera-detail-img {
  width: 100%;
  height: 100%;
  max-height: min(68vh, 720px);
  object-fit: contain;
  display: block;
  background: #05080d;
}
.camera-detail-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 13px;
}
.camera-detail-actions .camera-path {
  overflow-wrap: anywhere;
}
.camera-detail-live-status {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 6px 10px;
  border: 1px solid rgba(33, 103, 184, .45);
  border-radius: 8px;
  background: rgba(33, 103, 184, .14);
  color: #d7ebff;
  font-weight: 700;
}
.camera-detail-live-status.is-error {
  border-color: rgba(207, 61, 71, .62);
  background: rgba(207, 61, 71, .16);
  color: #ffd5d9;
}
@media (max-width: 680px) {
  .camera-live-grid { grid-template-columns: 1fr; }
  .camera-live-meta strong { font-size: 17px; }
  .camera-detail-panel {
    width: 100%;
  }
  .camera-detail-frame {
    aspect-ratio: 4 / 3;
    max-height: 62vh;
  }
  .camera-detail-img {
    max-height: 62vh;
  }
}

/* Larger gate image tiles with readable overlay labels */
.gate-tile {
  min-height: 320px;
  background: #0a1016;
}
.gate-tile button {
  position: relative;
  min-height: 320px;
  padding: 0;
  overflow: hidden;
  background: #0a1016;
}
.gate-visual {
  position: absolute;
  inset: 0 0 86px;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #0a1016;
}
.gate-visual.has-photo::before {
  content: "";
  position: absolute;
  inset: -14px;
  background: var(--gate-image) center center / cover no-repeat;
  filter: blur(10px);
  opacity: .58;
  transform: scale(1.04);
}
.gate-visual.has-photo::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .16);
  pointer-events: none;
}
.gate-visual img {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: .98;
}
.gate-visual img.fallback-icon {
  width: 42%;
  height: 42%;
  object-fit: contain;
  opacity: .95;
}
.gate-overlay {
  position: absolute;
  inset: auto 0 0;
  z-index: 4;
  display: grid;
  gap: 5px;
  min-height: 86px;
  padding: 12px 14px 14px;
  text-align: left;
  background: rgba(0, 0, 0, .74);
}
.gate-overlay strong {
  color: #fff;
  font-size: 20px;
  font-weight: 900;
  text-shadow: 0 2px 8px rgba(0, 0, 0, .85);
}
.gate-overlay span {
  color: rgba(255,255,255,.86);
  text-shadow: 0 2px 8px rgba(0, 0, 0, .72);
}
.gate-overlay em,
.status-badge {
  justify-self: start;
  width: auto;
}
.gate-tile.is-offline button {
  opacity: 1;
  cursor: not-allowed;
}
.gate-tile.is-offline .gate-visual::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  background: rgba(207, 31, 48, .48);
  pointer-events: none;
}
.gate-tile.is-offline .gate-visual img,
.gate-tile.is-locked .gate-visual img {
  opacity: .82;
}
.status-badge-red {
  background: rgba(207, 61, 71, .92) !important;
}
.status-badge-yellow {
  background: rgba(216, 167, 41, .90) !important;
  color: #17130a !important;
}
.message.warning {
  border-color: rgba(216, 167, 41, .75);
}
.dashboard-extra-slot {
  min-height: 72px;
}
.dashboard-extra-placeholder {
  padding: 16px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(11, 17, 23, .56);
  color: var(--muted);
}
.mobile-form ul {
  display: grid;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.mobile-form .form-field {
  display: grid;
  gap: 7px;
  color: var(--muted);
}
.mobile-form .form-field em {
  color: #ff9aa2;
  font-style: normal;
  font-size: 13px;
}
.mobile-form .field-label {
  color: var(--muted);
}
.mobile-form .choice-field > div,
.mobile-form .choice-field > ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.mobile-form .choice-field > div > div,
.mobile-form .choice-field li {
  margin: 0;
}
.mobile-form li label,
.mobile-form .choice-field label,
.mobile-form .single-checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,.04);
  color: var(--text);
}
.mobile-form li input[type="checkbox"],
.mobile-form .choice-field input[type="checkbox"],
.mobile-form .single-checkbox-label input[type="checkbox"] {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  margin: 0;
}
@media (max-width: 680px) {
  .gate-tile,
  .gate-tile button {
    min-height: 210px;
  }
  .gate-visual {
    inset: 0;
  }
  .gate-overlay {
    min-height: 0;
    padding: 46px 14px 14px;
    background: linear-gradient(0deg, rgba(0,0,0,.78), rgba(0,0,0,0));
  }
  .gate-overlay strong {
    font-size: 18px;
  }
  .camera-live-frame {
    aspect-ratio: 4 / 3;
  }
}

/* German PV flow graphic */
.power-section {
  margin-bottom: 30px;
}
.power-flow-card {
  display: grid;
  gap: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(11, 17, 23, .84);
  box-shadow: 0 18px 44px rgba(0,0,0,.26);
  backdrop-filter: blur(14px);
}
.power-flow-head,
.power-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.power-flow-head strong,
.power-summary strong {
  display: block;
  font-size: 18px;
}
.power-flow-head span,
.power-flow-head em,
.power-summary span {
  color: var(--muted);
  font-style: normal;
  font-size: 13px;
}
.power-flow-head > div {
  min-width: 0;
}
.power-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}
.power-refresh {
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 8px;
  background: rgba(255,255,255,.08);
  color: #f7fbff;
  min-height: 38px;
  padding: 0 12px;
  font-weight: 800;
}
.power-refresh.is-loading {
  opacity: .7;
  pointer-events: none;
}
.power-flow {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px minmax(0, 1fr) 34px minmax(0, 1fr);
  align-items: center;
}
.power-node {
  min-height: 132px;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 8px;
  padding: 14px 10px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 8px;
  text-align: center;
  background: rgba(255,255,255,.055);
}
.power-node svg {
  width: 34px;
  height: 34px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.power-node span {
  min-height: 34px;
  color: rgba(255,255,255,.78);
  font-size: 13px;
  line-height: 1.25;
}
.power-node strong {
  font-size: 22px;
  line-height: 1.1;
}
.power-node-pv {
  color: #ffd166;
  background: rgba(216, 167, 41, .16);
}
.power-node-home {
  color: #7bd88f;
  background: rgba(35, 127, 68, .18);
}
.power-node-grid {
  color: #8fc7ff;
  background: rgba(33, 103, 184, .18);
}
.power-line {
  position: relative;
  height: 2px;
  background: rgba(255,255,255,.28);
}
.power-line::after {
  content: "";
  position: absolute;
  right: -1px;
  top: 50%;
  width: 9px;
  height: 9px;
  border-top: 2px solid rgba(255,255,255,.55);
  border-right: 2px solid rgba(255,255,255,.55);
  transform: translateY(-50%) rotate(45deg);
}
.power-line.is-reverse::after {
  left: -1px;
  right: auto;
  transform: translateY(-50%) rotate(225deg);
}
.power-summary {
  padding: 12px 14px;
  border-radius: 8px;
  background: rgba(255,255,255,.055);
}
.power-flow-card.is-offline {
  border-color: rgba(207, 61, 71, .65);
}
.power-chart {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-radius: 8px;
  background: rgba(255,255,255,.045);
}
.power-chart-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: rgba(255,255,255,.74);
  font-size: 13px;
}
.power-chart-head em {
  color: var(--muted);
  font-style: normal;
}
.power-chart-bars {
  display: grid;
  grid-template-columns: repeat(7, minmax(28px, 1fr));
  align-items: end;
  gap: 7px;
  min-height: 132px;
}
.power-chart-day {
  display: grid;
  grid-template-rows: 92px auto auto;
  align-items: end;
  justify-items: center;
  gap: 4px;
  min-width: 0;
}
.power-chart-day i {
  display: block;
  width: 100%;
  max-width: 18px;
  min-height: 2px;
  border-radius: 6px 6px 2px 2px;
  background: linear-gradient(180deg, #ffd166, #2f8f57);
  box-shadow: 0 0 16px rgba(255, 209, 102, .18);
}
.power-chart-day.is-empty i {
  height: 2px !important;
  background: rgba(255,255,255,.16);
  box-shadow: none;
}
.power-chart-day small,
.power-chart-day em {
  max-width: 100%;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  font-style: normal;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.power-chart-day em {
  color: rgba(255,255,255,.72);
}
@media (max-width: 680px) {
  .power-flow {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .power-line {
    width: 2px;
    height: 24px;
    justify-self: center;
  }
  .power-line::after,
  .power-line.is-reverse::after {
    right: auto;
    left: 50%;
    top: auto;
    bottom: -1px;
    transform: translateX(-50%) rotate(135deg);
  }
  .power-line.is-reverse::after {
    top: -1px;
    bottom: auto;
    transform: translateX(-50%) rotate(-45deg);
  }
  .power-node {
    min-height: 116px;
  }
}

/* Simple permission editor */
.compact-hero {
  margin-bottom: 16px;
}
.permission-panel {
  display: grid;
  gap: 16px;
  margin-bottom: 30px;
}
.permission-user-select,
.permission-editor,
.permission-group {
  display: grid;
  gap: 12px;
}
.permission-user-select label {
  color: var(--muted);
  font-size: 13px;
}
.permission-user-select select {
  width: min(520px, 100%);
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(8, 14, 20, .88);
  color: var(--text);
  padding: 0 12px;
  font: inherit;
}
.permission-group {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(11, 17, 23, .78);
}
.permission-group h2 {
  margin-bottom: 2px;
}
.permission-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
}
.permission-check {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 8px;
  background: rgba(255,255,255,.045);
}
.permission-check input {
  width: 22px;
  height: 22px;
  accent-color: var(--blue);
  flex: 0 0 auto;
}
.permission-check span {
  font-weight: 700;
  overflow-wrap: anywhere;
}
.permission-note {
  border: 1px solid rgba(246, 190, 86, .45);
  background: rgba(246, 190, 86, .12);
  color: #ffe2aa;
  border-radius: 8px;
  padding: 10px 12px;
}
.permission-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.permission-actions button {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  padding: 0 18px;
  background: linear-gradient(160deg, var(--blue), var(--blue-2));
  color: #fff;
  font-weight: 800;
}
.permission-actions button:disabled {
  opacity: .55;
}
@media (max-width: 680px) {
  .permission-group {
    padding: 12px;
  }
  .permission-grid {
    grid-template-columns: 1fr;
  }
  .permission-actions {
    justify-content: stretch;
  }
  .permission-actions .secondary-button,
  .permission-actions button {
    flex: 1 1 100%;
  }
}

/* Time tracking beta */
.time-panel {
  margin-bottom: 22px;
}
.time-details {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,.04);
}
.time-details summary {
  min-height: 50px;
  display: flex;
  align-items: center;
  padding: 0 14px;
  cursor: pointer;
  color: var(--text);
  font-weight: 800;
}
.time-details > section {
  border-top: 1px solid var(--line);
}
.time-primary-entry {
  border-color: rgba(77, 163, 255, .38);
}
.time-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.time-form-grid label {
  display: grid;
  gap: 7px;
  color: var(--muted);
}
.time-form-grid label span {
  color: var(--muted);
}
.time-form-grid label small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}
.time-form-grid label em {
  color: #ff9aa2;
  font-style: normal;
  font-size: 13px;
}
.time-field-wide {
  grid-column: 1 / -1;
}
.time-table {
  min-width: 760px;
}
.time-note {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}
.time-assistant {
  padding: 14px;
  border: 1px solid rgba(216, 167, 41, .55);
  border-radius: 8px;
  background: rgba(216, 167, 41, .12);
}
.time-assistant.done {
  border-color: rgba(35, 127, 68, .55);
  background: rgba(35, 127, 68, .12);
}
.time-worklist {
  padding: 14px;
  border: 1px solid rgba(77, 163, 255, .45);
  border-radius: 8px;
  background: rgba(77, 163, 255, .10);
}
.time-assistant p {
  margin: 6px 0 0;
}
.time-auto-note {
  color: var(--muted);
  font-size: 13px;
}
.time-selected-note {
  color: var(--muted);
  margin: -4px 0 14px;
  line-height: 1.45;
}
.date-jump-button {
  margin-top: 10px;
  width: fit-content;
}
.time-chip-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}
.time-chip-row span,
.time-chip-row a {
  padding: 7px 10px;
  border-radius: 8px;
  background: rgba(255,255,255,.08);
  color: var(--text);
  font-weight: 800;
  text-decoration: none;
}
.time-chip-row .current {
  background: rgba(77, 163, 255, .22);
  border: 1px solid rgba(77, 163, 255, .55);
}
.time-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin: 12px 0 16px;
}
.time-summary-grid span {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,.045);
  color: var(--muted);
}
.time-summary-grid strong {
  color: var(--text);
  font-size: 18px;
}
.time-summary-grid.compact {
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  margin: 10px 0 0;
}
.time-summary-grid.compact span {
  padding: 10px;
}
.time-summary-grid.compact strong {
  font-size: 16px;
}
.absence-helper-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.time-info-card {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid rgba(77,163,255,.45);
  border-radius: 8px;
  background: rgba(77,163,255,.10);
}
.time-info-card.warning {
  border-color: rgba(216,167,41,.55);
  background: rgba(216,167,41,.12);
}
.time-info-card strong,
.time-info-card em {
  color: var(--text);
  font-style: normal;
}
.time-info-card span {
  color: var(--muted);
  font-size: 13px;
}
.day-status-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  margin: 0 0 14px;
  border: 1px solid rgba(77, 163, 255, .38);
  border-radius: 8px;
  background: rgba(77, 163, 255, .08);
}
.day-status-card > div:first-child {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}
.day-status-card > div:first-child strong {
  font-size: 20px;
}
.day-status-card > div:first-child span {
  color: var(--muted);
}
.quick-entry-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.quick-entry-row .secondary-button {
  min-height: 38px;
  padding: 8px 10px;
}
.quick-entry-row .quick-main-button {
  min-height: 44px;
  padding: 8px 14px;
}
.time-card-list {
  display: grid;
  gap: 10px;
}
.time-status-card {
  display: grid;
  gap: 7px;
  padding: 12px;
  border: 1px solid var(--line);
  border-left: 6px solid var(--blue);
  border-radius: 8px;
  background: rgba(255,255,255,.045);
}
.time-status-card strong {
  color: var(--text);
}
.time-status-card span,
.time-status-card em {
  color: var(--muted);
  font-style: normal;
}
.history-card {
  border-left-color: #9fcdff;
}
.absence-vacation,
.absence-company_holiday { border-left-color: #4da3ff; }
.absence-sick { border-left-color: #cf3d47; }
.absence-overtime_day { border-left-color: #d8a729; }
.absence-short_time { border-left-color: #ad7cff; }
.status-approved { background: rgba(35,127,68,.13); }
.status-pending { background: rgba(216,167,41,.12); }
.status-rejected { background: rgba(207,61,71,.12); }
.inline-form {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 0;
}
.inline-form input {
  flex: 1 1 180px;
}
.secondary-danger {
  min-height: 42px;
  border: 1px solid rgba(207,61,71,.55);
  border-radius: 8px;
  padding: 0 14px;
  background: rgba(207,61,71,.22);
  color: #fff;
  font-weight: 800;
}
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
  gap: 8px;
  margin: 12px 0 16px;
}
.calendar-day {
  min-height: 104px;
  display: grid;
  gap: 4px;
  align-content: start;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,.045);
}
.calendar-day-link {
  color: inherit;
  text-decoration: none;
}
.calendar-day-link:hover,
.calendar-day-link:focus-visible {
  border-color: rgba(77,163,255,.7);
  background: rgba(77,163,255,.16);
}
.calendar-day.is-selected {
  outline: 2px solid rgba(77,163,255,.85);
  outline-offset: 2px;
}
.calendar-day strong { font-size: 16px; }
.calendar-day span,
.calendar-day em,
.calendar-day small {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}
.calendar-day.status-offen { border-color: rgba(216,167,41,.75); background: rgba(216,167,41,.13); }
.calendar-day.status-geplant { opacity: .72; }
.calendar-day.has-absence { border-color: rgba(77,163,255,.55); background: rgba(77,163,255,.10); }
.team-calendar-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,.035);
}
.team-calendar-table {
  width: max-content;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}
.team-calendar-table th,
.team-calendar-table td {
  min-width: 34px;
  height: 38px;
  padding: 5px;
  border-right: 1px solid rgba(255,255,255,.07);
  border-bottom: 1px solid rgba(255,255,255,.07);
  text-align: center;
  color: var(--muted);
  font-size: 12px;
}
.team-calendar-table th:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  min-width: 138px;
  max-width: 180px;
  text-align: left;
  background: #121922;
  color: var(--text);
}
.team-calendar-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #121922;
  color: var(--text);
}
.team-calendar-table thead th:first-child {
  z-index: 3;
}
.team-calendar-table .weekend {
  background: rgba(255,255,255,.035);
}
.team-calendar-table .has-team-absence {
  background: rgba(77,163,255,.10);
}
.team-absence-pill {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  color: #fff;
  font-weight: 900;
  font-size: 12px;
}
.team-absence-pill.absence-vacation,
.team-calendar-legend .absence-vacation { background: #2f7fd1; }
.team-absence-pill.absence-sick,
.team-calendar-legend .absence-sick { background: #b93640; }
.team-absence-pill.absence-overtime_day,
.team-calendar-legend .absence-overtime_day { background: #b88712; }
.team-absence-pill.absence-company_holiday,
.team-calendar-legend .absence-company_holiday { background: #3b8f5a; }
.team-absence-pill.absence-short_time,
.team-calendar-legend .absence-short_time { background: #8054d6; }
.team-absence-pill.status-pending {
  outline: 2px solid rgba(255,255,255,.75);
}
.team-calendar-legend {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
}
.team-calendar-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.team-calendar-legend i {
  width: 10px;
  height: 10px;
  border-radius: 999px;
}
.lexware-export-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 8px 0 10px;
}
.lexware-export-row .inline-form {
  margin: 0;
}
@media (max-width: 680px) {
  .time-form-grid {
    grid-template-columns: 1fr;
  }
  .time-primary-entry {
    padding-left: 12px;
    padding-right: 12px;
  }
  .time-summary-grid.compact {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .quick-entry-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .quick-entry-row .quick-main-button {
    grid-column: 1 / -1;
  }
  .time-form-grid .time-field-work_date,
  .time-form-grid .time-field-hours,
  .time-form-grid .time-field-break_minutes {
    order: -2;
  }
  .time-form-grid .time-field-start_time,
  .time-form-grid .time-field-end_time,
  .time-form-grid .time-field-remainder_type,
  .time-form-grid .time-field-activity,
  .time-form-grid .time-field-note {
    opacity: .92;
  }
  .calendar-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .team-calendar-table th:first-child {
    min-width: 118px;
    max-width: 132px;
  }
  .inline-form {
    display: grid;
  }
}
