:root {
  --ink: #1c1f22;
  --muted: #6b7176;
  --line: #d9dee2;
  --paper: #f7f8f7;
  --panel: #ffffff;
  --brand: #ef735f;
  --brand-dark: #c85645;
  --graphite: #303336;
  --soft-coral: #fff0ed;
  --soft-green: #e7f4ee;
  --soft-blue: #e9f0f8;
  --soft-yellow: #fff7dc;
  --danger: #a9342a;
  font-family: Arial, Helvetica, sans-serif;
}

.portal-hero.compact {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
}

.hero-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.tool-hero-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: min(100%, 1120px);
  margin: 14px auto 0;
  padding: 14px 16px;
  border: 1px solid #e2e7ea;
  border-top: 4px solid var(--brand);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 26px rgba(28, 31, 34, 0.05);
}

.portal-body .tool-hero-card {
  margin: 0 0 18px;
}

.tool-hero-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.tool-hero-brand img {
  width: 54px;
  height: 54px;
  flex: 0 0 auto;
  object-fit: contain;
}

.tool-hero-brand h1 {
  margin: 0;
  color: var(--brand);
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1;
}

.tool-hero-brand p:not(.eyebrow) {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.tool-hero-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.tool-hero-actions .primary-button,
.tool-hero-actions .ghost-button,
.tool-hero-actions .danger-button,
.tool-hero-actions .text-button,
.hero-actions .primary-button,
.hero-actions .ghost-button {
  min-height: 38px;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 14px;
  line-height: 1.1;
}

.tool-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(280px, 0.8fr);
  gap: 16px;
  align-items: start;
  margin-top: 18px;
}

.tool-panel,
.record-card {
  border: 1px solid #e2e7ea;
  border-top: 4px solid var(--brand);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 26px rgba(28, 31, 34, 0.05);
}

.tool-panel {
  display: grid;
  gap: 12px;
  padding: 18px;
}

.tool-panel h2,
.tool-list h2,
.record-card h2 {
  margin: 0;
  font-size: 20px;
}

.tool-panel label {
  display: grid;
  gap: 6px;
  color: #343b42;
  font-size: 13px;
  font-weight: 800;
}

.tool-panel input,
.tool-panel textarea,
.tool-panel select,
.list-toolbar input {
  width: 100%;
  border: 1px solid #d9e0e4;
  border-radius: 7px;
  padding: 10px 11px;
  background: #fff;
  color: #1b1f23;
  font: inherit;
}

.tool-panel textarea {
  min-height: 82px;
  resize: vertical;
}

.tool-panel select {
  min-height: 41px;
}

.tool-panel select.multi-select {
  min-height: 142px;
  padding: 6px;
}

.tool-panel select.multi-select option {
  padding: 7px 8px;
}

.field-help {
  color: #6c7680;
  font-size: 12px;
  font-weight: 700;
}

.form-grid.two {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.metric-list {
  display: grid;
  gap: 10px;
}

.metric-list > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid #e2e7ea;
  border-left: 4px solid var(--brand);
  border-radius: 8px;
  padding: 12px;
  background: #fffaf8;
}

.metric-list strong {
  color: var(--brand);
  font-size: 24px;
  line-height: 1;
}

.metric-list span {
  color: #5d6670;
  font-size: 13px;
  font-weight: 800;
  text-align: right;
}

.app-bridge-panel {
  margin-bottom: 18px;
}

.inline-import-form {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.inline-import-form input[type="file"] {
  min-width: min(260px, 100%);
}

.tool-hint,
.compact-list,
.empty-state {
  color: #68727c;
  font-size: 13px;
  line-height: 1.45;
}

.compact-list {
  margin: 0;
  padding-left: 18px;
}

.check-row {
  display: flex !important;
  grid-template-columns: none !important;
  align-items: center;
  gap: 8px;
}

.check-row input {
  width: auto;
}

.tool-list {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.list-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.list-toolbar form {
  display: flex;
  gap: 8px;
}

.record-card {
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 16px;
  overflow-wrap: anywhere;
}

.record-card p {
  margin: 0;
  color: #48525b;
  line-height: 1.45;
}

.record-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.record-head h3 {
  margin: 0 0 4px;
  font-size: 18px;
}

.record-head span,
.note-card small,
.pill-list a,
.mapping-grid span {
  color: #6c7680;
  font-size: 12px;
  font-weight: 800;
}

.text-danger-button {
  width: fit-content;
  border: 0;
  background: transparent;
  color: #9c2f23;
  cursor: pointer;
  font-weight: 900;
}

.note-grid {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.note-card.pinned {
  border-color: #ef735f;
  background: #fff8f6;
}

.pill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill-list a {
  border: 1px solid #e0e5e8;
  border-radius: 999px;
  padding: 7px 10px;
  text-decoration: none;
}

.pill-list a.active {
  border-color: #ef735f;
  background: #fff1ee;
  color: #8f2f22;
}

.mapping-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.mapping-grid div {
  display: grid;
  gap: 4px;
  border: 1px solid #e5eaed;
  border-top: 4px solid var(--brand);
  border-radius: 7px;
  padding: 10px;
  background: #fafbfc;
}

.table-scroll {
  overflow-x: auto;
  max-width: 100%;
}

.preview-table {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
  font-size: 13px;
}

.preview-table th,
.preview-table td {
  border-bottom: 1px solid #e5eaed;
  padding: 9px 10px;
  text-align: left;
  vertical-align: top;
}

.preview-table th {
  background: #f5f8f9;
  color: #343b42;
}

@media (max-width: 760px) {
  .portal-hero.compact,
  .list-toolbar,
  .record-head {
    align-items: stretch;
    flex-direction: column;
  }

  .tool-layout,
  .form-grid.two {
    grid-template-columns: 1fr;
  }

  .hero-actions,
  .list-toolbar form {
    width: 100%;
  }

  .hero-actions > *,
  .list-toolbar input,
  .list-toolbar button {
    width: 100%;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  min-width: 320px;
}

.portal-body {
  background:
    linear-gradient(180deg, #fff 0, #f7f8f7 220px),
    var(--paper);
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
a {
  min-height: 40px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px clamp(16px, 3vw, 34px);
  background: #fff;
  color: var(--ink);
  border-bottom: 4px solid #f3b7ad;
  box-shadow: 0 1px 4px rgba(30, 30, 30, 0.06);
}

.brand {
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
}

.brand img {
  width: clamp(105px, 16vw, 160px);
  height: auto;
  display: block;
  border-radius: 4px;
}

.brand h1,
.panel h2,
.week-control h2 {
  margin: 0;
  line-height: 1.1;
  letter-spacing: 0;
}

.brand h1 {
  font-size: 26px;
  font-weight: 800;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--brand);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}

.top-actions,
.dialog-actions,
.card-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.inline-form {
  display: inline-flex;
  margin: 0;
}

.portal-shell-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 12px clamp(16px, 3vw, 34px);
  background: #fff;
  border-bottom: 4px solid #f3b7ad;
  box-shadow: 0 1px 4px rgba(30, 30, 30, 0.06);
}

.portal-brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  min-height: 44px;
  color: var(--ink);
  text-decoration: none;
}

.portal-brand img {
  width: 46px;
  height: 46px;
  display: block;
  border-radius: 10px;
}

.portal-brand span {
  display: grid;
  gap: 2px;
}

.portal-brand small {
  color: var(--brand);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.portal-brand strong {
  font-size: 18px;
}

.portal-nav,
.portal-user {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
}

.portal-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 8px 10px;
  color: var(--graphite);
  font-weight: 800;
  text-decoration: none;
  border-radius: 6px;
}

.portal-nav a:hover {
  background: #fff1ee;
  color: var(--brand-dark);
}

.portal-user span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.portal-main {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 42px;
}

.portal-notice {
  margin-bottom: 16px;
  padding: 12px 14px;
  border: 1px solid #c9e1d5;
  border-left: 5px solid #57a677;
  border-radius: 8px;
  background: #f0faf4;
  font-weight: 800;
}

.login-screen {
  display: grid;
  min-height: calc(100vh - 120px);
  place-items: center;
}

.login-card,
.portal-panel,
.app-tile {
  background: var(--panel);
  border: 1px solid var(--line);
  border-top: 4px solid var(--brand);
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(30, 30, 30, 0.06);
}

.login-card {
  width: min(420px, 100%);
  padding: 26px;
}

.login-card h1,
.portal-hero h1,
.portal-panel h1,
.portal-panel h2,
.app-tile h2 {
  margin: 0;
  line-height: 1.12;
}

.login-card h1 {
  font-size: 30px;
  margin-bottom: 20px;
}

.portal-form,
.admin-form {
  display: grid;
  gap: 14px;
}

.form-error {
  margin: 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: #fff1ee;
  color: var(--danger);
  font-weight: 800;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 800;
}

.check-row input {
  width: 16px;
  height: 16px;
}

.portal-hero {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 18px;
  margin-bottom: 20px;
}

.portal-hero h1 {
  font-size: clamp(30px, 5vw, 46px);
}

.portal-hero p {
  max-width: 620px;
  margin: 8px 0 0;
  color: var(--muted);
  font-weight: 700;
}

.dashboard-hub {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}

.dashboard-welcome,
.dashboard-card {
  border: 1px solid #e0e5e8;
  border-top: 4px solid var(--brand);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 26px rgba(28, 31, 34, 0.05);
}

.dashboard-welcome {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 15px 16px;
}

.dashboard-welcome h1 {
  margin: 0;
  color: var(--brand);
  font-size: clamp(24px, 4vw, 34px);
  line-height: 1.05;
}

.dashboard-welcome p,
.dashboard-empty {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.dashboard-briefing {
  display: grid;
  gap: 10px;
}

.dashboard-briefing {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 14px;
}

.dashboard-card {
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 178px;
  padding: 13px;
}

.dashboard-card-link {
  color: inherit;
  text-decoration: none;
}

.dashboard-card-head {
  display: grid;
  gap: 5px;
}

.dashboard-card-head h2 {
  margin: 0;
  color: var(--ink);
  font-size: 17px;
  line-height: 1.15;
}

.dashboard-count {
  color: var(--ink);
  font-size: 30px;
  font-weight: 800;
  line-height: 1;
}

.dashboard-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.dashboard-list li {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.dashboard-list strong {
  color: var(--ink);
  font-size: 13px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.dashboard-list span {
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 800;
  line-height: 1.25;
}

.admin-overview-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.admin-subnav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: -4px 0 14px;
}

.admin-subnav a {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  border: 1px solid #e0e5e8;
  border-radius: 8px;
  padding: 8px 13px;
  background: #fff;
  color: #59636d;
  font-size: 13px;
  font-weight: 900;
  text-decoration: none;
}

.admin-subnav a.active,
.admin-subnav a:hover {
  border-color: #f0b8ad;
  color: #c94f3f;
  background: #fff8f6;
}

.admin-overview-card {
  display: grid;
  gap: 10px;
  min-height: 168px;
  padding: 14px;
  border: 1px solid #e0e5e8;
  border-top: 4px solid var(--brand);
  border-radius: 8px;
  background: #fff;
  color: inherit;
  text-decoration: none;
  box-shadow: 0 10px 26px rgba(28, 31, 34, 0.05);
}

.admin-overview-card h2,
.admin-overview-card p {
  margin: 0;
}

.admin-overview-card h2 {
  color: var(--ink);
  font-size: 18px;
  line-height: 1.15;
}

.admin-overview-card p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.35;
}

.admin-overview-card strong {
  color: var(--brand);
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
}

.admin-overview-card > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.admin-overview-card.muted-card {
  background: #fbfcfc;
}

.admin-settings-panel {
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) minmax(0, 1.2fr);
  gap: 16px;
  align-items: start;
}

.admin-settings-panel h2,
.admin-settings-panel p {
  margin: 0;
}

.admin-settings-panel p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.module-pill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.module-pill {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  border: 1px solid #e0e5e8;
  border-radius: 999px;
  padding: 5px 9px;
  color: #59636d;
  font-size: 11px;
  font-weight: 900;
}

.module-pill.ready {
  background: #e7f4ee;
  color: #256041;
}

.module-pill.planned {
  background: #f0f2f3;
}

.admin-module-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.admin-module-summary .admin-overview-card {
  min-height: 132px;
}

.admin-module-grid,
.admin-practice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.admin-module-card {
  display: grid;
  gap: 14px;
  border-top: 4px solid var(--brand);
}

.admin-module-head {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  justify-content: space-between;
}

.admin-module-head h2,
.admin-module-head p,
.admin-info-card h2,
.admin-info-card p {
  margin: 0;
}

.admin-module-head h2,
.admin-info-card h2 {
  color: var(--ink);
  font-size: 18px;
  line-height: 1.2;
}

.admin-module-head p,
.admin-info-card p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.4;
}

.admin-module-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.admin-module-meta span {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  border: 1px solid #e0e5e8;
  border-radius: 999px;
  padding: 5px 9px;
  color: #59636d;
  font-size: 11px;
  font-weight: 900;
}

.inline-admin-link {
  color: #c94f3f;
  font-size: 13px;
  font-weight: 900;
  text-decoration: none;
}

.inline-admin-link:hover {
  text-decoration: underline;
}

.admin-info-card {
  border-top: 4px solid var(--brand);
}

.admin-info-card dl {
  display: grid;
  gap: 11px;
  margin: 0;
}

.admin-info-card dl div {
  display: grid;
  gap: 3px;
}

.admin-info-card dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.admin-info-card dd {
  margin: 0;
  color: var(--ink);
  font-size: 14px;
  font-weight: 850;
  overflow-wrap: anywhere;
}

.app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 10px;
}

.unread-note-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 1.2fr) auto;
  gap: 16px;
  align-items: center;
  margin-bottom: 18px;
  border: 1px solid #f0b8ad;
  border-top: 4px solid var(--brand);
  border-radius: 8px;
  padding: 16px;
  background: #fff8f6;
  box-shadow: 0 10px 26px rgba(28, 31, 34, 0.05);
}

.unread-note-panel h2,
.unread-note-panel p {
  margin: 0;
}

.unread-note-panel ul {
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.unread-note-panel li {
  display: grid;
  gap: 2px;
}

.unread-note-panel li span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.admin-entry-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
  border: 1px solid #e0e5e8;
  border-top: 4px solid var(--brand);
  border-radius: 8px;
  padding: 14px 16px;
  background: #fff;
  box-shadow: 0 10px 26px rgba(28, 31, 34, 0.05);
}

.admin-entry-panel h2,
.admin-entry-panel p {
  margin: 0;
}

.app-tile {
  display: flex;
  min-height: 132px;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  padding: 14px;
}

.app-tile.locked {
  opacity: 0.62;
}

.app-tile h2 {
  font-size: 20px;
}

.app-tile p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.42;
}

.locked-note,
.role-pill {
  display: inline-flex;
  width: fit-content;
  min-height: 32px;
  align-items: center;
  border-radius: 999px;
  padding: 6px 10px;
  background: #f0f2f3;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.portal-panel {
  padding: 18px;
  margin-bottom: 16px;
}

.empty-module {
  max-width: 720px;
}

.empty-module p {
  color: var(--muted);
  line-height: 1.5;
}

.therapy-frame-card {
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.therapy-game-frame {
  display: block;
  width: 100%;
  height: 920px;
  min-height: 820px;
  border: 0;
  background: #fbf8f5;
}

.admin-form {
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  align-items: end;
}

.admin-form .permission-box,
.admin-form button,
.user-card-head {
  grid-column: 1 / -1;
}

.permission-box {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px 12px;
}

.user-list {
  display: grid;
  gap: 14px;
}

.user-card {
  margin-bottom: 0;
}

.user-card-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.user-card-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-weight: 700;
}

.connection-banner {
  margin: 14px clamp(16px, 3vw, 34px) 0;
  padding: 12px 14px;
  border: 1px solid #f1b4a9;
  border-left: 5px solid var(--brand);
  border-radius: 8px;
  background: #fff4f1;
  color: var(--ink);
  font-weight: 800;
}

.hint {
  color: var(--muted);
  line-height: 1.45;
  margin: 0 0 12px;
}

.layout {
  display: grid;
  grid-template-columns: minmax(300px, 380px) minmax(0, 1fr);
  gap: 22px;
  padding: 22px clamp(16px, 3vw, 34px) 34px;
}

.workspace {
  min-width: 0;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-top: 4px solid var(--brand);
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(30, 30, 30, 0.05);
}

.form-panel {
  padding: 20px;
  align-self: start;
  position: sticky;
  top: 16px;
  min-width: 0;
  overflow: hidden;
}

.panel-heading,
.week-control {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

form,
.filter-row {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--graphite);
  font-size: 13px;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #cdd3d8;
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 10px 11px;
  outline: none;
}

textarea {
  resize: vertical;
  min-height: 78px;
}

fieldset {
  border: 1px solid var(--line);
  border-radius: 8px;
  margin: 0;
  padding: 12px;
}

legend {
  color: var(--graphite);
  font-size: 13px;
  font-weight: 800;
  padding: 0 6px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(239, 115, 95, 0.18);
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.slot-columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
  gap: 8px;
  min-width: 0;
}

.slot-day {
  display: grid;
  gap: 6px;
  min-width: 0;
  border: 1px solid #e1e6ea;
  border-radius: 8px;
  background: #fbfcfc;
  padding: 8px;
}

.slot-day > strong {
  text-align: center;
  color: var(--brand-dark);
  font-size: 13px;
}

.slot-check {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  min-height: 30px;
  font-size: 10.5px;
  font-weight: 800;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.slot-check input {
  flex: 0 0 auto;
  width: 15px;
  height: 15px;
}

.slot-check span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.slot-time {
  min-height: 32px;
  padding: 6px;
  font-size: 12px;
}

.primary-button,
.ghost-button,
.danger-button,
.text-button {
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  text-decoration: none;
  font-weight: 800;
  white-space: nowrap;
}

.primary-button {
  background: var(--brand);
  color: #111;
}

.primary-button:hover {
  background: #ff8672;
}

.ghost-button {
  background: transparent;
  color: var(--brand-dark);
  border-color: #e5b4ac;
}

.danger-button {
  background: var(--danger);
  color: #fff;
}

.text-button {
  min-height: 34px;
  padding: 6px 8px;
  background: transparent;
  color: var(--brand-dark);
}

.full-width {
  width: 100%;
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.summary-item {
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 5px solid var(--brand);
  border-radius: 8px;
  padding: 12px;
}

.summary-item strong {
  display: block;
  font-size: 24px;
  line-height: 1;
}

.summary-item span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.filters-panel {
  padding: 16px;
  margin-bottom: 14px;
}

.view-switch {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f5f6f6;
}

.view-button {
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  padding: 9px 12px;
  font-weight: 900;
  cursor: pointer;
}

.view-button.active {
  background: #fff;
  color: var(--brand-dark);
  box-shadow: 0 1px 2px rgba(30, 30, 30, 0.08);
}

.quick-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.quick-filter-row button {
  min-height: 34px;
  border: 1px solid #e1e6ea;
  border-radius: 999px;
  padding: 7px 11px;
  background: #fff;
  color: #46505a;
  cursor: pointer;
  font-size: 12px;
  font-weight: 900;
}

.quick-filter-row button:hover,
.quick-filter-row button.active {
  border-color: #f0b8ad;
  background: #fff1ee;
  color: var(--brand-dark);
}

.filter-row {
  grid-template-columns: minmax(180px, 2fr) repeat(3, minmax(140px, 1fr));
}

.week-control {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 0;
}

.week-control label {
  width: min(240px, 100%);
}

.hidden-view {
  display: none !important;
}

.calendar-band {
  display: grid;
  gap: 12px;
}

.calendar-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 14px;
}

.calendar-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.calendar-toolbar h2 {
  margin: 0;
}

.calendar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.calendar-actions .text-button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--brand-dark);
  min-width: 38px;
}

.calendar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.calendar-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 4px;
}

.legend.holiday {
  background: var(--brand);
}

.legend.vacation {
  background: #f8cfc7;
}

.legend.today {
  border: 1px solid var(--line);
  outline: 3px solid rgba(239, 115, 95, 0.22);
  background: #fff;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(34px, 1fr));
  gap: 7px;
}

.calendar-weekday {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-align: center;
}

.calendar-day {
  position: relative;
  display: grid;
  min-height: 54px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-weight: 800;
}

.calendar-day.weekend {
  color: #999;
  background: #fafafa;
}

.calendar-day.vacation {
  background: #fff1ee;
  border-color: #f8cfc7;
}

.calendar-day.holiday {
  color: #fff;
  background: var(--brand);
  border-color: var(--brand);
}

.calendar-day.today {
  outline: 3px solid rgba(239, 115, 95, 0.22);
}

.calendar-day.muted-day {
  visibility: hidden;
}

.calendar-info {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.calendar-info > div:not(.empty) {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 8px;
  background: #faf8f7;
  font-size: 12px;
}

.calendar-info span {
  color: var(--muted);
  text-align: right;
}

.calendar-info-row span {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  flex-wrap: wrap;
}

.calendar-info-row em {
  border-radius: 999px;
  padding: 3px 7px;
  background: #fff1ee;
  color: var(--brand-dark);
  font-style: normal;
  font-size: 10px;
  font-weight: 900;
}

.calendar-info-row.holiday em {
  background: var(--brand);
  color: #fff;
}

.calendar-info-row.vacation em {
  background: #f8cfc7;
  color: #7d352c;
}

.empty.mini {
  padding: 0;
}

.board-title {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  margin-top: 24px;
}

.board-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.board-title h2 {
  margin: 4px 0 0;
  font-size: 22px;
}

.board-range {
  margin: 0;
  color: var(--muted);
  font-weight: 800;
  white-space: nowrap;
}

.board {
  display: grid;
  grid-template-columns: repeat(5, minmax(210px, 1fr));
  gap: 12px;
  align-items: start;
  overflow-x: auto;
  padding-bottom: 8px;
}

.week-board {
  grid-template-columns: repeat(7, minmax(180px, 1fr));
}

.column {
  min-width: 210px;
  background: #f0f2f3;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
}

.column-day {
  background: #f3f7f6;
}

.column-neutral {
  background: #f5f3ef;
}

.column-absent {
  background: #fff1ef;
  border-color: #f0b8ad;
}

.column-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.column-title h3 {
  margin: 0 0 10px;
  font-size: 14px;
}

.column-title h3 {
  margin: 0;
}

.column-title span {
  min-width: 26px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--brand-dark);
  font-size: 12px;
  font-weight: 900;
}

.patient-card {
  background: #fff;
  border: 1px solid #d9dee2;
  border-top: 3px solid var(--brand);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 10px;
}

.patient-card h3 {
  margin: 0;
  font-size: 16px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.week-card {
  cursor: pointer;
}

.week-card h3 {
  font-size: 15px;
}

.week-detail,
.week-note {
  margin: 8px 0 0;
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.week-detail {
  color: var(--brand-dark);
  font-weight: 800;
}

.week-note {
  color: var(--muted);
}

.card-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 8px;
}

.meta {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.status-pill {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 6px 9px;
  font-size: 11px;
  font-weight: 900;
  background: #ffe1dc;
  color: #8f2f22;
}

.status-available .status-pill {
  background: #d7f0df;
  color: #1f6b42;
}

.status-limited .status-pill {
  background: #fff0b8;
  color: #725407;
}

.status-away .status-pill {
  background: #e4e7ea;
  color: #363d43;
}

.status-scheduled .status-pill {
  background: #d7e7f7;
  color: #245d8c;
}

.status-open {
  border-left: 8px solid #ef735f;
  background: linear-gradient(90deg, #fff0ed 0, #fff 42%);
}

.status-available {
  border-left: 8px solid #57a677;
  background: linear-gradient(90deg, #edf8f1 0, #fff 42%);
}

.status-limited {
  border-left: 8px solid #d8a926;
  background: linear-gradient(90deg, #fff8d8 0, #fff 42%);
}

.status-away {
  border-left: 8px solid #8a9299;
  background: linear-gradient(90deg, #f0f2f3 0, #fff 42%);
}

.status-scheduled {
  border-left: 8px solid #4b74a8;
  background: linear-gradient(90deg, #eaf2fb 0, #fff 42%);
}

.history-panel {
  margin-top: 18px;
  padding: 16px;
}

.history-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.history-item {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid #e0e5e8;
  border-left: 5px solid #d9dee2;
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
}

.history-created,
.history-imported {
  border-left-color: #57a677;
}

.history-updated {
  border-left-color: #ef735f;
}

.history-deleted {
  border-left-color: #8a9299;
}

.history-item strong,
.history-item span,
.history-item small {
  display: block;
}

.history-item span,
.history-item small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

dl {
  display: grid;
  gap: 8px;
  margin: 12px 0;
}

dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

dd {
  margin: 2px 0 0;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.empty {
  color: var(--muted);
  font-size: 13px;
  margin: 0;
  padding: 8px 2px;
}

dialog {
  border: 0;
  border-radius: 8px;
  padding: 22px;
  max-width: 420px;
  box-shadow: 0 20px 70px rgba(0, 0, 0, 0.25);
}

.dialog-form {
  display: grid;
  gap: 12px;
}

.dialog-form textarea {
  min-height: 170px;
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.35);
}

.date-picker {
  position: absolute;
  z-index: 20;
  width: 292px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.16);
  padding: 12px;
}

.date-picker.hidden {
  display: none;
}

.date-picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.date-picker-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.date-picker-day {
  display: grid;
  place-items: center;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font-weight: 800;
  cursor: pointer;
}

.date-picker-day:hover,
.date-picker-day.selected {
  border-color: var(--brand);
  background: #fff1ee;
}

.date-picker-day.today {
  outline: 3px solid rgba(239, 115, 95, 0.18);
}

.date-picker-day.muted-day {
  visibility: hidden;
}

@media (max-width: 1180px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .form-panel {
    position: static;
  }

  .filter-row {
    grid-template-columns: repeat(2, minmax(160px, 1fr));
  }

  .summary-strip {
    grid-template-columns: repeat(3, minmax(120px, 1fr));
  }

}

@media (max-width: 720px) {
  .topbar,
  .portal-shell-header,
  .portal-nav,
  .portal-user,
  .brand,
  .panel-heading,
  .week-control {
    align-items: stretch;
    flex-direction: column;
  }

  .portal-main {
    width: min(100% - 24px, 1180px);
    padding-top: 20px;
  }

  .portal-brand img {
    width: 160px;
  }

  .portal-hero {
    align-items: start;
    flex-direction: column;
  }

  .admin-form {
    grid-template-columns: 1fr;
  }

  .view-switch {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }

  .top-actions {
    width: 100%;
  }

  .top-actions > * {
    flex: 1;
  }

  .field-grid,
  .filter-row,
  .summary-strip {
    grid-template-columns: 1fr;
  }

  .slot-columns {
    grid-template-columns: 1fr;
  }

  .calendar-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .board-title {
    align-items: start;
    flex-direction: column;
  }

  .board-range {
    white-space: normal;
  }

  .brand img {
    width: 180px;
  }

  .device-preview-toggle {
    display: none;
  }

  body:not(.portal-body) .topbar {
    gap: 14px;
    padding: 12px;
  }

  body:not(.portal-body) .brand {
    display: grid;
    grid-template-columns: 104px 1fr;
    align-items: center;
    gap: 12px;
  }

  body:not(.portal-body) .brand img {
    width: 104px;
  }

  body:not(.portal-body) .brand h1 {
    font-size: 22px;
  }

  body:not(.portal-body) .top-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  body:not(.portal-body) .top-actions > *,
  body:not(.portal-body) .top-actions .inline-form,
  body:not(.portal-body) .top-actions .inline-form button {
    width: 100%;
  }

  body:not(.portal-body) .layout {
    padding: 14px 12px 28px;
  }

  body:not(.portal-body) .form-panel,
  body:not(.portal-body) .filters-panel,
  body:not(.portal-body) .week-control.panel,
  body:not(.portal-body) .calendar-panel {
    padding: 14px;
  }

  body:not(.portal-body) .summary-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body:not(.portal-body) .summary-item {
    padding: 10px;
  }

  body:not(.portal-body) .summary-item strong {
    font-size: 22px;
  }

  body:not(.portal-body) .week-picker {
    display: grid;
    grid-template-columns: 42px 1fr 42px;
    align-items: end;
    gap: 8px;
  }

  body:not(.portal-body) .week-picker label,
  body:not(.portal-body) .week-picker #weekToday,
  body:not(.portal-body) .week-picker #printWeekTopButton {
    grid-column: 1 / -1;
    width: 100%;
  }

  body:not(.portal-body) .date-field {
    grid-template-columns: 1fr;
  }

  body:not(.portal-body) .date-trigger {
    width: 100%;
  }

  body:not(.portal-body) .board-title {
    align-items: stretch;
  }

  body:not(.portal-body) .board-actions {
    justify-content: stretch;
  }

  body:not(.portal-body) .board-actions > * {
    width: 100%;
  }

  body:not(.portal-body) .board-range {
    justify-content: center;
    white-space: normal;
    text-align: center;
  }

  body:not(.portal-body) .board,
  body:not(.portal-body) .week-board {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    overflow-x: visible;
  }

  body:not(.portal-body) .column {
    min-width: 0;
  }

  body:not(.portal-body) .column-title {
    position: static;
  }

  body:not(.portal-body) .patient-card {
    margin-bottom: 8px;
  }

  body:not(.portal-body) .calendar-grid {
    gap: 5px;
  }

  body:not(.portal-body) .calendar-day {
    min-height: 42px;
    border-radius: 7px;
    font-size: 13px;
  }

  body:not(.portal-body) .calendar-info > div:not(.empty) {
    align-items: start;
    flex-direction: column;
  }

  body:not(.portal-body) dialog {
    width: min(100% - 24px, 420px);
    padding: 16px;
  }

  .quick-filter-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .history-item {
    display: grid;
    gap: 5px;
  }
}

@media print {
  body {
    background: #fff !important;
    color: #111 !important;
  }

  .topbar,
  .connection-banner,
  .form-panel,
  .filters-panel,
  .week-control,
  .calendar-band,
  .history-panel,
  .legal-footer,
  .board-actions .ghost-button,
  dialog,
  .date-picker {
    display: none !important;
  }

  .layout {
    display: block !important;
    padding: 0 !important;
  }

  .workspace {
    width: 100% !important;
  }

  .board-title {
    margin: 0 0 12px !important;
    border-bottom: 2px solid #ef735f;
    padding-bottom: 10px;
  }

  .board-title h2 {
    font-size: 20px;
  }

  .board-range {
    border: 0 !important;
    padding: 0 !important;
  }

  .board,
  .week-board {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px !important;
    overflow: visible !important;
  }

  .column {
    min-width: 0 !important;
    break-inside: avoid;
    border: 1px solid #ccc !important;
    background: #fff !important;
  }

  .patient-card {
    break-inside: avoid;
    box-shadow: none !important;
  }

  .week-card .card-head::after {
    display: none !important;
  }
}

/* Portal polish: bewusst am Ende, damit der bestehende Ferienplaner stabil bleibt. */
.portal-body {
  min-height: 100vh;
  background: #f6f7f8;
  font-family: Arial, Helvetica, sans-serif;
}

.portal-body .portal-shell-header {
  min-height: 68px;
  padding: 10px clamp(18px, 3vw, 32px);
  border-bottom: 1px solid #e2e6e9;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 1px 8px rgba(28, 31, 34, 0.05);
}

.portal-body .portal-brand {
  gap: 14px;
  min-height: 48px;
  min-width: 0;
}

.portal-body .portal-brand img {
  width: 46px;
  height: 46px;
  object-fit: contain;
}

.portal-body .portal-brand > span {
  display: block;
}

.portal-body .portal-brand small {
  color: var(--brand-dark);
  font-size: 10px;
  line-height: 1;
}

.portal-body .portal-brand strong {
  color: var(--ink);
  display: grid;
  gap: 1px;
  font-size: 16px;
  line-height: 1.05;
  font-weight: 900;
  overflow-wrap: anywhere;
}

.portal-body .product-name {
  color: var(--brand);
  font-size: 23px;
  line-height: 1;
}

.portal-body .product-subtitle {
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.portal-right {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-left: auto;
}

.portal-body .portal-nav {
  gap: 4px;
  padding: 3px;
  border: 1px solid #e3e7ea;
  border-radius: 8px;
  background: #f8fafb;
}

.portal-body .portal-nav a {
  min-height: 34px;
  padding: 7px 10px;
  color: #46505a;
  font-size: 13px;
}

.portal-body .portal-user {
  gap: 8px;
}

.portal-body .portal-user span {
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.portal-body .ghost-button,
.portal-body .primary-button {
  min-height: 36px;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 13px;
}

.portal-body .primary-button {
  background: #ef735f;
  color: #171717;
}

.portal-body .portal-main {
  width: min(1080px, calc(100% - 40px));
  padding: 18px 0 40px;
}

.portal-body .login-screen {
  min-height: calc(100vh - 92px);
  align-items: start;
  padding-top: min(9vh, 72px);
}

.portal-body.login-page-body .portal-main {
  flex: 1;
  display: grid;
  align-items: center;
  padding-top: 0;
  padding-bottom: 12px;
}

.portal-body.login-page-body .login-screen {
  min-height: auto;
  padding-top: 24px;
}

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

.portal-body.login-page-body .legal-footer {
  margin-top: 0;
  padding-top: 10px;
  padding-bottom: 18px;
}

.portal-body .login-card {
  width: min(380px, 100%);
  padding: 24px;
  border-radius: 8px;
}

.login-logo {
  width: 74px;
  height: 74px;
  display: block;
  margin: 0 0 18px;
}

.portal-body .login-card h1 {
  margin-bottom: 18px;
  font-size: 26px;
}

.portal-body .login-card .login-product-name {
  margin: 0;
  color: var(--brand);
  font-size: 34px;
  line-height: 1;
}

.portal-body .login-card .login-product-subtitle {
  margin: 6px 0 18px;
  color: var(--ink);
  font-size: 19px;
  font-weight: 900;
  line-height: 1.12;
}

.portal-body .portal-form {
  gap: 12px;
}

.portal-body .portal-form label,
.portal-body .admin-form label {
  color: #30363d;
  font-size: 12px;
}

.portal-body input,
.portal-body select,
.portal-body textarea {
  min-height: 40px;
  border-color: #d7dde2;
  border-radius: 6px;
  font-size: 14px;
}

.portal-body .check-row {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 8px;
  min-height: 28px;
}

.portal-body .check-row input {
  min-height: 0;
  width: 15px;
  height: 15px;
}

.portal-body .portal-hero {
  margin: 0 0 14px;
  padding: 0;
}

.portal-body .portal-hero h1 {
  font-size: clamp(28px, 4vw, 38px);
  letter-spacing: 0;
}

.portal-body .portal-hero .eyebrow,
.portal-body .login-card .eyebrow {
  color: var(--brand);
  font-size: 13px;
  font-weight: 900;
}

.portal-body .portal-hero p {
  max-width: 560px;
  margin-top: 7px;
  color: #65717b;
  font-size: 15px;
  font-weight: 700;
}

.portal-body .app-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 9px;
}

.portal-body .app-tile {
  min-height: 122px;
  gap: 10px;
  padding: 12px 13px;
  border-color: #e0e5e8;
}

.portal-body .app-tile-top {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-bottom: 8px;
}

.portal-body .app-tile:hover {
  border-color: #f0b8ad;
  box-shadow: 0 8px 24px rgba(28, 31, 34, 0.08);
}

.portal-body .app-status {
  display: inline-flex;
  min-height: 23px;
  align-items: center;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 10px;
  font-weight: 900;
}

.portal-body .app-status.ready {
  background: #e7f4ee;
  color: #256041;
}

.portal-body .app-status.planned {
  background: #f0f2f3;
  color: #65717b;
}

.device-preview-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 36px;
  padding: 4px;
  border: 1px solid #e3e7ea;
  border-radius: 8px;
  background: #f8fafb;
}

.device-preview-toggle span {
  padding: 0 6px;
  color: #65717b;
  font-size: 11px;
  font-weight: 900;
}

.device-preview-toggle button {
  min-height: 28px;
  border: 0;
  border-radius: 6px;
  padding: 5px 8px;
  background: transparent;
  color: #46505a;
  cursor: pointer;
  font-size: 12px;
  font-weight: 900;
}

.device-preview-toggle button.active {
  background: var(--brand);
  color: #171717;
}

.portal-body .category-tile {
  border-color: #d7e5df;
  background: linear-gradient(180deg, #ffffff 0, #f8fbf9 100%);
}

.portal-body.preview-tablet .portal-main,
.portal-body.preview-tablet .portal-shell-header,
body.preview-tablet .layout,
body.preview-tablet .topbar,
body.preview-tablet .connection-banner {
  width: min(860px, calc(100% - 32px));
  margin-left: auto;
  margin-right: auto;
}

.portal-body.preview-mobile .portal-main,
.portal-body.preview-mobile .portal-shell-header,
body.preview-mobile .layout,
body.preview-mobile .topbar,
body.preview-mobile .connection-banner {
  width: min(430px, calc(100% - 20px));
  margin-left: auto;
  margin-right: auto;
}

.portal-body.preview-tablet .portal-shell-header,
.portal-body.preview-mobile .portal-shell-header,
body.preview-tablet .topbar,
body.preview-mobile .topbar {
  border-left: 1px solid #e2e6e9;
  border-right: 1px solid #e2e6e9;
}

.portal-body.preview-tablet .app-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.portal-body.preview-mobile .app-grid,
body.preview-mobile .field-grid,
body.preview-mobile .filter-row,
body.preview-mobile .summary-strip,
body.preview-mobile .slot-columns {
  grid-template-columns: 1fr;
}

body.preview-tablet .layout,
body.preview-mobile .layout {
  grid-template-columns: 1fr;
}

body.preview-tablet .form-panel,
body.preview-mobile .form-panel {
  position: static;
}

body.preview-mobile .topbar,
body.preview-mobile .brand,
body.preview-mobile .top-actions,
.portal-body.preview-mobile .portal-shell-header,
.portal-body.preview-mobile .portal-right,
.portal-body.preview-mobile .portal-nav,
.portal-body.preview-mobile .portal-user {
  align-items: stretch;
  flex-direction: column;
}

body.preview-mobile .top-actions > *,
body.preview-mobile .device-preview-toggle {
  width: 100%;
}

body.preview-mobile .device-preview-toggle {
  justify-content: center;
}

body.preview-mobile:not(.portal-body) .brand {
  display: grid;
  grid-template-columns: 104px 1fr;
  align-items: center;
  gap: 12px;
}

body.preview-mobile:not(.portal-body) .brand img {
  width: 104px;
}

body.preview-mobile:not(.portal-body) .top-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

body.preview-mobile:not(.portal-body) .form-panel,
body.preview-mobile:not(.portal-body) .filters-panel,
body.preview-mobile:not(.portal-body) .week-control.panel,
body.preview-mobile:not(.portal-body) .calendar-panel {
  padding: 14px;
}

body.preview-mobile:not(.portal-body) .summary-strip {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

body.preview-mobile:not(.portal-body) .week-picker {
  display: grid;
  grid-template-columns: 42px 1fr 42px;
  align-items: end;
  gap: 8px;
}

body.preview-mobile:not(.portal-body) .week-picker label,
body.preview-mobile:not(.portal-body) .week-picker #weekToday,
body.preview-mobile:not(.portal-body) .week-picker #printWeekTopButton {
  grid-column: 1 / -1;
  width: 100%;
}

body.preview-mobile:not(.portal-body) .date-field {
  grid-template-columns: 1fr;
}

body.preview-mobile:not(.portal-body) .board,
body.preview-mobile:not(.portal-body) .week-board {
  display: grid;
  grid-template-columns: 1fr;
  overflow-x: visible;
}

body.preview-mobile:not(.portal-body) .column {
  min-width: 0;
}

body.preview-mobile:not(.portal-body) .calendar-day {
  min-height: 42px;
}

/* Ferienplaner polish */
body:not(.portal-body) {
  background:
    linear-gradient(180deg, #ffffff 0, #f6f7f8 260px),
    #f6f7f8;
}

body:not(.portal-body) .topbar {
  border-bottom: 1px solid #e2e6e9;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 1px 8px rgba(28, 31, 34, 0.05);
}

body:not(.portal-body) .brand img {
  width: clamp(108px, 14vw, 142px);
}

body:not(.portal-body) .brand h1 {
  font-size: clamp(22px, 3vw, 28px);
}

body:not(.portal-body) .layout {
  align-items: start;
}

body:not(.portal-body) .panel,
body:not(.portal-body) .summary-item,
body:not(.portal-body) .patient-card,
body:not(.portal-body) .column {
  border-color: #e0e5e8;
  box-shadow: 0 1px 3px rgba(28, 31, 34, 0.05);
}

body:not(.portal-body) .form-panel {
  border-top: 4px solid #f3b7ad;
}

body:not(.portal-body) .filters-panel {
  border-top: 4px solid #edf0f2;
}

.week-control.panel {
  margin-bottom: 16px;
  padding: 16px;
  border-top: 4px solid #e7f4ee;
  background: #fff;
}

.week-picker {
  display: flex;
  align-items: end;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.week-picker label {
  width: min(260px, 100%);
}

.date-field {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) auto;
  gap: 6px;
  align-items: center;
}

.date-field input {
  margin: 0;
}

.date-trigger {
  min-height: 40px;
  border: 1px solid #e5b4ac;
  border-radius: 6px;
  padding: 8px 10px;
  background: #fff1ee;
  color: var(--brand-dark);
  cursor: pointer;
  font-size: 12px;
  font-weight: 900;
}

.week-step {
  min-width: 42px;
  font-size: 20px;
  line-height: 1;
}

.print-week-button {
  min-height: 38px;
  border-color: #ef735f !important;
  background: #ef735f !important;
  color: #151515 !important;
  padding: 8px 12px !important;
  border-radius: 6px;
  font-size: 14px;
  line-height: 1.1;
  box-shadow: 0 4px 12px rgba(239, 115, 95, 0.18);
}

.print-week-button:hover {
  background: #ff8672 !important;
}

body:not(.portal-body) .view-switch {
  width: fit-content;
}

body:not(.portal-body) .view-button {
  min-height: 38px;
}

body:not(.portal-body) .summary-strip {
  gap: 12px;
}

body:not(.portal-body) .summary-item {
  border-left: 0;
  border-top: 4px solid var(--brand);
  background: #fff;
}

body:not(.portal-body) .summary-item strong {
  font-size: 26px;
}

body:not(.portal-body) .board-title {
  margin: 18px 0 12px;
  padding: 0 2px;
}

body:not(.portal-body) .board-range {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  border: 1px solid #e0e5e8;
  border-radius: 999px;
  padding: 6px 11px;
  background: #fff;
  color: #46505a;
  font-size: 13px;
}

body:not(.portal-body) .week-board {
  grid-template-columns: repeat(7, minmax(190px, 1fr));
  gap: 10px;
}

body:not(.portal-body) .column {
  background: #f7f9fa;
  padding: 10px;
}

body:not(.portal-body) .column-day {
  background: #f6faf8;
}

body:not(.portal-body) .column-neutral {
  background: #f8f7f4;
}

body:not(.portal-body) .column-absent {
  background: #fff5f2;
}

body:not(.portal-body) .column-title {
  position: sticky;
  top: 0;
  z-index: 1;
  border-radius: 7px;
  padding: 6px;
  background: inherit;
}

body:not(.portal-body) .patient-card {
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

body:not(.portal-body) .patient-card:hover {
  border-color: #f0b8ad;
  box-shadow: 0 8px 22px rgba(28, 31, 34, 0.08);
  transform: translateY(-1px);
}

body:not(.portal-body) .week-card .card-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
}

body:not(.portal-body) .week-card .card-head > div {
  min-width: 0;
}

body:not(.portal-body) .week-card .card-head::after {
  content: "Bearb.";
  grid-column: 1 / -1;
  justify-self: end;
  border-radius: 999px;
  padding: 3px 7px;
  background: #fff1ee;
  color: var(--brand-dark);
  font-size: 10px;
  font-weight: 900;
  line-height: 1.2;
}

body:not(.portal-body) .date-picker {
  width: min(312px, calc(100vw - 24px));
  border-color: #dde3e7;
  box-shadow: 0 18px 55px rgba(28, 31, 34, 0.2);
}

body:not(.portal-body) .date-picker-day.weekend {
  background: #f6f7f8;
  color: #8a9299;
}

body:not(.portal-body) .date-picker-day.holiday {
  border-color: #ef735f;
  background: #fff0ed;
}

body:not(.portal-body) .date-picker-day.vacation {
  box-shadow: inset 0 -4px 0 #d7ecd9;
}

body:not(.portal-body) .date-picker-day.in-week {
  border-color: #7ab493;
  background: #eef8f2;
}

body:not(.portal-body) .date-picker-day.selected {
  border-color: var(--brand);
  background: var(--brand);
  color: #171717;
}

.portal-body .app-tile h2 {
  font-size: 17px;
}

.portal-body .app-tile p {
  margin-top: 4px;
  font-size: 12.5px;
  line-height: 1.32;
}

.portal-body .locked-note,
.portal-body .role-pill {
  min-height: 28px;
  padding: 5px 9px;
  font-size: 11px;
}

.legal-footer {
  width: min(1080px, calc(100% - 32px));
  margin: 10px auto 0;
  padding: 14px 0 22px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: center;
  justify-content: center;
  border-top: 1px solid #e2e6e9;
  color: #7a838b;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.35;
  text-align: center;
}

.legal-footer span:not(:last-child)::after {
  content: "·";
  margin-left: 14px;
  color: #ef735f;
}

@media (max-width: 720px) {
  .portal-body .portal-shell-header {
    gap: 12px;
    align-items: stretch;
  }

  .portal-body .portal-brand {
    width: 100%;
  }

  .portal-right {
    align-items: stretch;
    flex-direction: column;
    margin-left: 0;
  }

  .portal-body .portal-brand img {
    width: 42px;
    height: 42px;
    flex: 0 0 auto;
  }

  .portal-body .portal-brand strong {
    font-size: 15px;
  }

  .portal-body .product-name {
    font-size: 20px;
  }

  .portal-body .product-subtitle {
    font-size: 12px;
  }

  .portal-body .portal-main {
    width: min(100% - 24px, 1080px);
    padding-top: 14px;
  }

  .portal-body .app-grid {
    gap: 8px;
  }

  .portal-body .app-tile {
    min-height: 112px;
    padding: 12px;
  }

  .portal-body .app-tile .primary-button,
  .portal-body .app-tile .locked-note {
    width: 100%;
    justify-content: center;
  }

  .portal-body .login-screen {
    min-height: auto;
    padding-top: 24px;
  }
}

@media (max-width: 720px) {
  .portal-body .device-preview-toggle,
  body:not(.portal-body) .device-preview-toggle {
    display: none !important;
  }

  body:not(.portal-body) .topbar {
    align-items: stretch;
    gap: 12px;
    padding: 12px 14px 10px;
  }

  body:not(.portal-body) .brand {
    display: grid !important;
    grid-template-columns: 92px minmax(0, 1fr);
    gap: 12px;
    align-items: center;
  }

  body:not(.portal-body) .brand img {
    width: 92px;
    max-height: 58px;
    object-fit: contain;
  }

  body:not(.portal-body) .brand .eyebrow {
    margin-bottom: 2px;
    font-size: 10px;
  }

  body:not(.portal-body) .brand h1 {
    font-size: 24px;
    line-height: 1.05;
  }

  body:not(.portal-body) .top-actions {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    width: 100%;
  }

  body:not(.portal-body) .top-actions > *,
  body:not(.portal-body) .top-actions .inline-form button {
    width: 100%;
  }

  body:not(.portal-body) .top-actions .inline-form {
    display: contents;
  }

  body:not(.portal-body) .top-actions .ghost-button,
  body:not(.portal-body) .top-actions .primary-button {
    min-height: 38px;
    padding: 8px 10px;
    border-radius: 7px;
    font-size: 14px;
    line-height: 1.1;
  }

  body:not(.portal-body) #newEntryButton {
    grid-column: 1 / -1;
    min-height: 44px;
  }

  body:not(.portal-body) .connection-banner {
    margin: 10px 12px 0;
  }

  .legal-footer {
    width: min(100% - 24px, 1080px);
    display: grid;
    gap: 5px;
    padding-bottom: 18px;
    font-size: 10.5px;
  }

  .legal-footer span::after {
    content: "" !important;
    margin-left: 0 !important;
  }
}

.portal-body .portal-hero.compact {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
}

.portal-body .tool-layout {
  width: min(100%, 1120px);
}

.portal-body .tool-list {
  width: min(100%, 1120px);
}

@media (max-width: 760px) {
  .portal-body .portal-hero.compact,
  .portal-body .dashboard-welcome,
  .portal-body .list-toolbar,
  .portal-body .record-head {
    align-items: stretch;
    flex-direction: column;
  }

  .portal-body .dashboard-briefing {
    grid-template-columns: 1fr;
  }

  .portal-body .admin-overview-grid,
  .portal-body .admin-settings-panel,
  .portal-body .admin-module-summary,
  .portal-body .admin-module-grid,
  .portal-body .admin-practice-grid {
    grid-template-columns: 1fr;
  }

  .portal-body .admin-overview-card {
    min-height: 0;
  }

  .portal-body .admin-subnav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .portal-body .admin-subnav a {
    width: 100%;
  }

  .portal-body .admin-module-head {
    display: grid;
  }

  .portal-body .therapy-frame-card {
    margin-left: -2px;
    margin-right: -2px;
  }

  .portal-body .therapy-game-frame {
    min-height: 760px;
  }

  .portal-body .dashboard-card {
    min-height: 0;
  }

  .portal-body .tool-layout,
  .portal-body .form-grid.two {
    grid-template-columns: 1fr;
  }

  .portal-body .list-toolbar form,
  .portal-body .inline-import-form {
    display: grid;
    width: 100%;
  }

  .portal-body .unread-note-panel,
  .portal-body .admin-entry-panel {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .portal-body .admin-entry-panel {
    flex-direction: column;
  }

  .portal-body .admin-entry-panel .primary-button {
    width: 100%;
  }

  .portal-body .note-grid {
    grid-template-columns: 1fr;
  }

  .portal-body .note-card {
    min-width: 0;
  }

  .portal-body .tool-panel select.multi-select {
    min-height: 118px;
  }

  .portal-body .tool-panel,
  .portal-body .record-card,
  .portal-body .portal-panel,
  .portal-body .app-tile {
    min-width: 0;
  }

  .portal-body .preview-table {
    min-width: 560px;
  }

  .portal-body .login-card .login-product-name {
    font-size: 31px;
  }

  .portal-body .login-card .login-product-subtitle {
    font-size: 17px;
  }
}

@keyframes praxis-motion-rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes praxis-motion-soft-pop {
  0% {
    transform: scale(0.985);
  }
  70% {
    transform: scale(1.01);
  }
  100% {
    transform: scale(1);
  }
}

.portal-body .portal-hero,
.portal-body .dashboard-welcome,
.portal-body .dashboard-card,
.portal-body .admin-overview-card,
.portal-body .unread-note-panel,
.portal-body .admin-entry-panel,
.portal-body .app-tile,
.portal-body .tool-panel,
.portal-body .record-card,
body:not(.portal-body) .form-panel,
body:not(.portal-body) .filters-panel,
body:not(.portal-body) .week-control.panel,
body:not(.portal-body) .calendar-panel,
body:not(.portal-body) .column,
body:not(.portal-body) .patient-card {
  animation: praxis-motion-rise 0.34s ease both;
}

.portal-body .app-tile:nth-child(2),
.portal-body .record-card:nth-child(2),
body:not(.portal-body) .patient-card:nth-child(2) {
  animation-delay: 0.03s;
}

.portal-body .app-tile:nth-child(3),
.portal-body .record-card:nth-child(3),
body:not(.portal-body) .patient-card:nth-child(3) {
  animation-delay: 0.06s;
}

.portal-body .app-tile:nth-child(4),
.portal-body .record-card:nth-child(4),
body:not(.portal-body) .patient-card:nth-child(4) {
  animation-delay: 0.09s;
}

.portal-body .app-tile,
.portal-body .dashboard-welcome,
.portal-body .dashboard-card,
.portal-body .admin-overview-card,
.portal-body .unread-note-panel,
.portal-body .admin-entry-panel,
.portal-body .tool-panel,
.portal-body .record-card,
body:not(.portal-body) .patient-card,
body:not(.portal-body) .calendar-day,
body:not(.portal-body) .date-picker-day,
.portal-body .primary-button,
.portal-body .ghost-button,
body:not(.portal-body) .primary-button,
body:not(.portal-body) .ghost-button,
body:not(.portal-body) .text-button {
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background-color 0.18s ease;
}

.portal-body .app-tile:hover,
.portal-body .dashboard-welcome:hover,
.portal-body .dashboard-card:hover,
.portal-body .admin-overview-card:hover,
.portal-body .unread-note-panel:hover,
.portal-body .admin-entry-panel:hover,
.portal-body .tool-panel:hover,
.portal-body .record-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(28, 31, 34, 0.08);
}

body:not(.portal-body) .calendar-day:not(.muted-day):hover,
body:not(.portal-body) .date-picker-day:not(.muted-day):hover {
  transform: translateY(-1px);
  box-shadow: 0 7px 18px rgba(28, 31, 34, 0.08);
}

.portal-body .primary-button:active,
.portal-body .ghost-button:active,
body:not(.portal-body) .primary-button:active,
body:not(.portal-body) .ghost-button:active,
body:not(.portal-body) .text-button:active {
  transform: scale(0.98);
}

.portal-notice,
.connection-banner:not(.hidden) {
  animation: praxis-motion-soft-pop 0.26s ease both;
}

.app-simple-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: min(100%, 1120px);
  margin: 14px auto 0;
  padding: 0 16px;
}

.app-toolbar-main {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.app-back-link {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  border: 1px solid rgba(239, 115, 95, 0.38);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--coral, #ef735f);
  font-size: 0.9rem;
  font-weight: 850;
  padding: 0.55rem 0.9rem;
  text-decoration: none;
  box-shadow: 0 10px 28px rgba(28, 31, 34, 0.08);
}

.app-back-link:hover {
  transform: translateY(-1px);
}

.app-preview-toggle {
  margin-left: auto;
}

.app-command-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: min(100%, 1120px);
  margin: 14px auto 0;
  padding: 0 16px;
}

.app-command-title {
  min-width: 0;
}

.app-command-title h1 {
  margin: 0;
  color: var(--coral, #ef735f);
  font-size: clamp(1.55rem, 3vw, 2.4rem);
  line-height: 1;
}

.app-command-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.app-command-actions .primary-button,
.app-command-actions .ghost-button,
.app-command-actions .danger-button,
.app-command-actions .text-button {
  min-height: 38px;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 14px;
  line-height: 1.1;
}

.app-action-bar {
  justify-content: flex-end;
  margin-top: 10px;
}

.tool-page-body .portal-main {
  padding-top: 18px;
}

body.preview-tablet .app-simple-toolbar,
body.preview-tablet .app-command-bar,
body.preview-tablet .tool-hero-card {
  width: min(760px, calc(100% - 24px));
}

body.preview-mobile .app-simple-toolbar,
body.preview-mobile .app-command-bar,
body.preview-mobile .tool-hero-card {
  align-items: stretch;
  flex-direction: column;
  width: min(390px, calc(100% - 24px));
}

body.preview-mobile .app-back-link,
body.preview-mobile .app-command-actions > *,
body.preview-mobile .tool-hero-actions > * {
  justify-content: center;
  width: 100%;
}

body.preview-mobile .app-command-title {
  text-align: center;
}

body:not(.portal-body) .summary-strip {
  grid-template-columns: repeat(5, minmax(96px, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

body:not(.portal-body) .summary-item {
  border-top-width: 3px;
  padding: 9px 11px;
}

body:not(.portal-body) .summary-item strong {
  font-size: 21px;
}

body:not(.portal-body) .summary-item span {
  font-size: 11px;
}

body:not(.portal-body) .filters-panel {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: end;
  gap: 10px 14px;
  padding: 12px;
  margin-bottom: 10px;
}

body:not(.portal-body) .filters-panel .view-switch {
  margin-bottom: 0;
}

body:not(.portal-body) .filters-panel .filter-row {
  display: grid;
  grid-template-columns: minmax(170px, 1.4fr) repeat(3, minmax(126px, 0.8fr));
  gap: 10px;
}

body:not(.portal-body) .filters-panel label {
  font-size: 12px;
}

body:not(.portal-body) .filters-panel input,
body:not(.portal-body) .filters-panel select {
  min-height: 38px;
  margin-top: 6px;
}

body:not(.portal-body) .quick-filter-row {
  grid-column: 1 / -1;
  flex-wrap: nowrap;
  gap: 6px;
  margin-top: 0;
  overflow-x: auto;
  padding-bottom: 2px;
}

body:not(.portal-body) .quick-filter-row button {
  flex: 0 0 auto;
  min-height: 30px;
  padding: 5px 10px;
  font-size: 11px;
}

body:not(.portal-body) .week-control.panel {
  margin-bottom: 10px;
  padding: 12px;
}

body:not(.portal-body) .week-control.panel h2,
body:not(.portal-body) .board-title h2 {
  font-size: 20px;
}

body:not(.portal-body) .week-control.panel .eyebrow {
  margin-bottom: 4px;
}

body:not(.portal-body) .week-picker {
  gap: 6px;
}

body:not(.portal-body) .week-picker label {
  width: min(210px, 100%);
}

body:not(.portal-body) .date-trigger,
body:not(.portal-body) .week-picker .text-button,
body:not(.portal-body) .print-week-button {
  min-height: 38px;
}

body:not(.portal-body) .board-title {
  margin: 14px 0 8px;
}

body:not(.portal-body) .board-actions {
  gap: 6px;
}

body:not(.portal-body) .week-board {
  grid-template-columns: repeat(7, minmax(170px, 1fr));
  gap: 8px;
}

body:not(.portal-body) .column {
  min-width: 170px;
  padding: 8px;
}

body:not(.portal-body) .patient-card {
  padding: 10px;
  margin-bottom: 8px;
}

body:not(.portal-body) .week-detail,
body:not(.portal-body) .week-note {
  margin-top: 6px;
}

/* PraxisPit Dashboard Upgrade */
.portal-body .dashboard-command {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(320px, 1.1fr);
  gap: 14px;
  align-items: stretch;
  margin-bottom: 14px;
  border: 1px solid #e0e5e8;
  border-top: 4px solid var(--brand);
  border-radius: 10px;
  padding: 16px;
  background:
    linear-gradient(135deg, rgba(239, 115, 95, 0.14), rgba(255, 255, 255, 0) 46%),
    #fff;
  box-shadow: 0 14px 34px rgba(28, 31, 34, 0.07);
}

.portal-body .dashboard-command-copy {
  display: grid;
  align-content: center;
  gap: 6px;
  min-width: 0;
}

.portal-body .dashboard-command h1 {
  margin: 0;
  color: var(--brand);
  font-size: clamp(28px, 5vw, 44px);
  line-height: 0.98;
}

.portal-body .dashboard-command-panel {
  display: grid;
  gap: 10px;
  align-content: center;
}

.portal-body .dashboard-search {
  display: grid;
  gap: 6px;
  margin: 0;
  color: #30363d;
  font-size: 12px;
  font-weight: 900;
}

.portal-body .dashboard-search input {
  min-height: 48px;
  border: 1px solid #d9e0e4;
  border-radius: 9px;
  padding: 12px 14px;
  background: #fff;
  color: var(--ink);
  font-size: 15px;
  font-weight: 800;
  box-shadow: inset 0 1px 0 rgba(28, 31, 34, 0.03);
}

.portal-body .dashboard-search input:focus {
  border-color: #f0b8ad;
  outline: 3px solid rgba(239, 115, 95, 0.15);
}

.portal-body .dashboard-quick-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.portal-body .dashboard-quick-row a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  border: 1px solid #f0b8ad;
  border-radius: 999px;
  padding: 7px 11px;
  background: #fff8f6;
  color: #bd4c3d;
  font-size: 12px;
  font-weight: 900;
  text-decoration: none;
}

.portal-body .dashboard-section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  margin: 4px 0 10px;
}

.portal-body .dashboard-section-head h2 {
  margin: 0;
  color: var(--brand);
  font-size: 22px;
  line-height: 1.08;
}

.portal-body .dashboard-app-grid {
  align-items: stretch;
  grid-template-columns: repeat(auto-fit, minmax(235px, 1fr));
  gap: 11px;
}

.portal-body .dashboard-app-tile {
  position: relative;
  overflow: hidden;
  height: 100%;
  min-height: 148px;
  padding: 0;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease, opacity 160ms ease;
}

.portal-body .dashboard-app-tile::after {
  content: "";
  position: absolute;
  inset: auto 12px 0 12px;
  height: 3px;
  border-radius: 999px 999px 0 0;
  background: linear-gradient(90deg, var(--brand), #f0bb4d);
  opacity: 0;
  transition: opacity 160ms ease;
}

.portal-body .dashboard-app-tile:hover {
  transform: translateY(-2px);
}

.portal-body .dashboard-app-tile:hover::after,
.portal-body .dashboard-app-tile.is-favorite::after {
  opacity: 1;
}

.portal-body .app-tile-link {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  height: 100%;
  min-height: 148px;
  gap: 12px;
  padding: 14px;
  color: inherit;
  text-decoration: none;
}

.portal-body .app-tile-link > div {
  display: grid;
  align-content: start;
  min-width: 0;
}

.portal-body .dashboard-app-tile.locked {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  padding: 14px;
}

.portal-body .dashboard-app-tile .app-tile-top {
  justify-content: flex-start;
  padding-right: 34px;
}

.portal-body .dashboard-app-tile h2 {
  color: var(--ink);
  font-size: 20px;
  line-height: 1.08;
}

.portal-body .dashboard-app-tile p {
  font-size: 13px;
  line-height: 1.38;
}

.portal-body .favorite-toggle {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  display: inline-grid;
  place-items: center;
  width: 34px;
  min-height: 34px;
  border: 1px solid #e3e7ea;
  border-radius: 999px;
  background: #fff;
  color: #b5bdc4;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
}

.portal-body .favorite-toggle.is-active {
  border-color: #f0b8ad;
  background: #fff0ed;
  color: var(--brand);
}

.portal-body .app-open-label {
  display: inline-flex;
  width: 100%;
  align-self: end;
  justify-self: stretch;
  min-height: 32px;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  padding: 7px 10px;
  background: var(--brand);
  color: #171717;
  font-size: 12px;
  font-weight: 900;
}

.portal-body .dashboard-app-tile.locked .locked-note {
  align-self: end;
  justify-content: center;
  width: 100%;
}

.portal-body .dashboard-no-results {
  margin-top: 12px;
  padding: 13px 14px;
  border: 1px dashed #d9e0e4;
  border-radius: 8px;
  background: #fff;
}

@media (prefers-reduced-motion: no-preference) {
  .portal-body .dashboard-command,
  .portal-body .dashboard-card,
  .portal-body .dashboard-app-tile {
    animation: dashboard-rise 360ms ease both;
  }

  .portal-body .dashboard-card:nth-child(2) {
    animation-delay: 45ms;
  }

  .portal-body .dashboard-card:nth-child(3) {
    animation-delay: 90ms;
  }

  .portal-body .dashboard-app-tile {
    animation-delay: 120ms;
  }
}

@keyframes dashboard-rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 720px) {
  .portal-body .dashboard-command {
    grid-template-columns: 1fr;
    padding: 14px;
  }

  .portal-body .dashboard-command h1 {
    font-size: 30px;
  }

  .portal-body .dashboard-section-head {
    align-items: stretch;
    flex-direction: column;
  }

  .portal-body .dashboard-section-head .ghost-button {
    justify-content: center;
    width: 100%;
  }

  .portal-body .dashboard-app-grid {
    grid-template-columns: 1fr;
  }

  .portal-body .app-tile-link {
    min-height: 132px;
  }

  .portal-body .dashboard-app-tile.locked {
    min-height: 132px;
  }

  .app-simple-toolbar,
  .app-command-bar,
  .tool-hero-card {
    align-items: stretch;
    flex-direction: column;
    margin-top: 12px;
  }

  .app-simple-toolbar .device-preview-toggle {
    display: none;
  }

  .app-toolbar-main {
    display: grid;
    width: 100%;
    gap: 8px;
  }

  .app-back-link,
  .app-toolbar-main > *,
  .app-command-actions > *,
  .tool-hero-actions > * {
    justify-content: center;
    width: 100%;
  }

  .app-command-title,
  .tool-hero-brand {
    text-align: center;
  }

  .tool-hero-brand {
    flex-direction: column;
    gap: 8px;
  }

  .tool-hero-brand p:not(.eyebrow) {
    font-size: 13px;
  }

  body:not(.portal-body) .summary-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body:not(.portal-body) .filters-panel {
    grid-template-columns: 1fr;
  }

  body:not(.portal-body) .filters-panel .filter-row {
    grid-template-columns: 1fr;
  }
}

body:not(.portal-body) .date-picker {
  width: min(276px, calc(100vw - 20px));
  max-height: min(360px, calc(100dvh - 24px));
  overflow: auto;
  padding: 10px;
}

body:not(.portal-body) .date-picker-grid {
  gap: 4px;
}

body:not(.portal-body) .date-picker-day {
  min-height: 30px;
  border-radius: 5px;
  font-size: 12px;
}

@media (max-width: 720px) {
  body:not(.portal-body) {
    overflow-x: hidden;
  }

  body:not(.portal-body) .app-action-bar {
    width: min(100% - 20px, 1080px);
    padding: 0;
  }

  body:not(.portal-body) .app-command-actions {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
    gap: 8px;
  }

  body:not(.portal-body) .app-command-actions > * {
    justify-content: center;
    width: 100%;
    min-height: 38px;
  }

  body:not(.portal-body) .layout {
    width: 100%;
    max-width: 100%;
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 10px 10px 24px;
  }

  body:not(.portal-body) .workspace {
    width: 100%;
    min-width: 0;
  }

  body:not(.portal-body) .form-panel {
    order: 2;
  }

  body:not(.portal-body) .filters-panel,
  body:not(.portal-body) .week-control.panel,
  body:not(.portal-body) .calendar-panel {
    padding: 12px;
  }

  body:not(.portal-body) .filters-panel .view-switch {
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }

  body:not(.portal-body) .quick-filter-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body:not(.portal-body) .week-control.panel {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
  }

  body:not(.portal-body) .week-picker {
    grid-template-columns: 36px minmax(0, 1fr) 36px;
    gap: 6px;
  }

  body:not(.portal-body) .week-picker label,
  body:not(.portal-body) .week-picker #weekToday,
  body:not(.portal-body) .week-picker #printWeekTopButton {
    grid-column: 1 / -1;
    width: 100%;
  }

  body:not(.portal-body) .date-trigger,
  body:not(.portal-body) .week-picker .text-button,
  body:not(.portal-body) .print-week-button {
    min-height: 36px;
    padding: 7px 9px;
  }

  body:not(.portal-body) .board-title {
    display: grid;
    gap: 8px;
  }

  body:not(.portal-body) .board-actions {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
    gap: 8px;
  }

  body:not(.portal-body) .board-actions > * {
    width: 100%;
  }

  body:not(.portal-body) .board,
  body:not(.portal-body) .week-board {
    grid-template-columns: 1fr;
    gap: 8px;
    overflow-x: visible;
  }

  body:not(.portal-body) .column {
    min-width: 0;
  }

  body:not(.portal-body) .calendar-grid {
    gap: 4px;
  }

  body:not(.portal-body) .calendar-day {
    min-height: 42px;
    padding: 6px;
    font-size: 12px;
  }

  body:not(.portal-body) .date-picker {
    left: 10px !important;
    right: 10px;
    width: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
  }
}
