:root {
  color-scheme: light;
  --page: #f4f3f0;
  --surface: #ffffff;
  --surface-subtle: #f7f7f5;
  --text: #191b1f;
  --text-muted: #60646c;
  --border: #d8d9d6;
  --border-strong: #aeb2b7;
  --accent: #334e68;
  --accent-hover: #293f54;
  --accent-active: #203344;
  --focus: #52718d;
  --error: #8a2f2b;
  --error-surface: #faf4f3;
  --disabled: #e3e4e1;
  --disabled-text: #898d92;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #111315;
  --surface: #1a1d20;
  --surface-subtle: #202428;
  --text: #eef0f1;
  --text-muted: #a8afb6;
  --border: #343a40;
  --border-strong: #59616a;
  --accent: #7199b8;
  --accent-hover: #83a9c5;
  --accent-active: #6088a7;
  --focus: #7da5c3;
  --error: #ef9b95;
  --error-surface: #321f20;
  --disabled: #2b2f33;
  --disabled-text: #858c93;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--page);
  -webkit-text-size-adjust: 100%;
}

body {
  min-width: 0;
  min-height: 100vh;
  min-height: 100svh;
  margin: 0;
  background: var(--page);
  color: var(--text);
}

button,
input {
  font: inherit;
}

button,
input,
a {
  -webkit-tap-highlight-color: transparent;
}

.login-shell {
  display: grid;
  min-height: 100vh;
  min-height: 100svh;
  align-items: center;
  padding: max(1rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) max(1rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
}

.login-panel {
  width: min(100%, 27.5rem);
  margin-inline: auto;
  padding: 1.5rem;
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  background: var(--surface);
  box-shadow: 0 0.75rem 2rem rgba(28, 31, 35, 0.07);
}

.login-header {
  margin-bottom: 1.75rem;
}

.brand {
  display: inline-flex;
  min-height: 2.75rem;
  align-items: center;
  gap: 0.625rem;
  color: var(--text);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 2rem;
  height: 2rem;
  place-items: center;
  border-radius: 0.375rem;
  background: var(--text);
  color: var(--surface);
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand-name {
  font-size: 0.9375rem;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.brand:focus-visible,
.password-toggle:focus-visible,
.login-button:focus-visible {
  outline: 3px solid rgba(82, 113, 141, 0.35);
  outline-offset: 3px;
}

.login-heading {
  margin-top: 1.75rem;
}

.login-heading h1 {
  margin: 0;
  font-size: clamp(1.625rem, 8vw, 2rem);
  font-weight: 680;
  letter-spacing: -0.035em;
  line-height: 1.15;
}

.login-heading p {
  margin: 0.625rem 0 0;
  color: var(--text-muted);
  font-size: 0.9375rem;
  line-height: 1.55;
}

.account-heading {
  margin-top: 1.25rem;
}

.eyebrow {
  margin-bottom: 0.5rem !important;
  color: var(--accent) !important;
  font-size: 0.75rem !important;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.form-message {
  margin: -0.25rem 0 1.25rem;
  padding: 0.75rem 0.875rem;
  border: 1px solid #e3c8c5;
  border-radius: 0.5rem;
  background: var(--error-surface);
  color: var(--error);
  font-size: 0.875rem;
  line-height: 1.45;
}

.form-message[hidden] {
  display: none;
}

.success-message {
  margin: -0.25rem 0 1.25rem;
  padding: 0.75rem 0.875rem;
  border: 1px solid #cdd8d1;
  border-radius: 0.5rem;
  background: #f4f8f5;
  color: #30533b;
  font-size: 0.875rem;
  line-height: 1.45;
}

.login-form {
  display: grid;
  gap: 1.125rem;
}

.field-group {
  display: grid;
  gap: 0.5rem;
}

.field-group label {
  color: #303338;
  font-size: 0.875rem;
  font-weight: 620;
  line-height: 1.35;
}

.field-hint {
  margin: -0.125rem 0 0;
  color: var(--text-muted);
  font-size: 0.75rem;
  line-height: 1.45;
}

.field-group input {
  width: 100%;
  min-width: 0;
  min-height: 3rem;
  padding: 0.6875rem 0.75rem;
  border: 1px solid var(--border-strong);
  border-radius: 0.5rem;
  outline: none;
  background: var(--surface);
  color: var(--text);
  font-size: 1rem;
  line-height: 1.5;
}

.field-group input:hover:not(:disabled) {
  border-color: #858a91;
}

.field-group input:focus {
  border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(82, 113, 141, 0.16);
}

.field-group input:disabled {
  border-color: var(--border);
  background: var(--surface-subtle);
  color: var(--disabled-text);
  cursor: not-allowed;
}

.login-form.was-validated input:invalid {
  border-color: var(--error);
}

.login-form.was-validated input:invalid:focus {
  box-shadow: 0 0 0 3px rgba(138, 47, 43, 0.13);
}

.remember-login {
  display: grid;
  min-height: 2.75rem;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 0.7rem;
  color: var(--text);
  cursor: pointer;
}

.remember-login input {
  width: 1.1rem;
  height: 1.1rem;
  min-height: 0;
  margin: 0;
  accent-color: var(--accent);
}

.remember-login span { display: grid; gap: 0.1rem; }
.remember-login strong { font-size: 0.8125rem; font-weight: 650; }
.remember-login small { color: var(--text-muted); font-size: 0.72rem; font-weight: 450; }
.remember-login:has(input:focus-visible) { outline: 3px solid rgba(82,113,141,.3); outline-offset: 3px; border-radius: 0.25rem; }

.password-control {
  position: relative;
}

.password-control input {
  padding-right: 6.25rem;
}

.password-toggle {
  position: absolute;
  top: 0.125rem;
  right: 0.25rem;
  bottom: 0.125rem;
  min-width: 5.25rem;
  min-height: 2.75rem;
  padding: 0 0.625rem;
  border: 0;
  border-radius: 0.375rem;
  background: transparent;
  color: var(--accent);
  font-size: 0.8125rem;
  font-weight: 650;
  cursor: pointer;
}

.password-toggle:hover {
  background: var(--surface-subtle);
  color: var(--accent-hover);
}

.password-toggle:active {
  background: #ecece9;
  color: var(--accent-active);
}

.password-toggle:disabled {
  color: var(--disabled-text);
  cursor: not-allowed;
}

.login-button {
  width: 100%;
  min-height: 3rem;
  margin-top: 0.25rem;
  padding: 0.6875rem 1rem;
  border: 1px solid var(--accent);
  border-radius: 0.5rem;
  background: var(--accent);
  color: #ffffff;
  font-size: 0.9375rem;
  font-weight: 680;
  line-height: 1.4;
  cursor: pointer;
}

.login-button:hover:not(:disabled) {
  border-color: var(--accent-hover);
  background: var(--accent-hover);
}

.login-button:active:not(:disabled) {
  border-color: var(--accent-active);
  background: var(--accent-active);
}

.login-button:disabled {
  border-color: var(--disabled);
  background: var(--disabled);
  color: var(--disabled-text);
  cursor: not-allowed;
}

.account-user {
  margin: 1.25rem 0 0;
  color: var(--text-muted);
  font-size: 0.8125rem;
  line-height: 1.5;
  text-align: center;
}

.account-details {
  display: grid;
  gap: 0;
  margin: 0 0 1.5rem;
  border-block: 1px solid var(--border);
}

.account-details div {
  display: flex;
  min-height: 3rem;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 0.75rem;
}

.account-details div + div {
  border-top: 1px solid var(--border);
}

.account-details dt,
.account-details dd {
  margin: 0;
  font-size: 0.875rem;
}

.account-details dt {
  color: var(--text-muted);
}

.account-details dd {
  overflow-wrap: anywhere;
  color: var(--text);
  font-weight: 620;
  text-align: right;
}

.secondary-button {
  width: 100%;
  min-height: 3rem;
  padding: 0.6875rem 1rem;
  border: 1px solid var(--border-strong);
  border-radius: 0.5rem;
  background: var(--surface);
  color: var(--text);
  font-size: 0.9375rem;
  font-weight: 650;
  cursor: pointer;
}

.secondary-button:hover {
  border-color: #858a91;
  background: var(--surface-subtle);
}

.secondary-button:active {
  background: #ecece9;
}

.secondary-button:focus-visible {
  outline: 3px solid rgba(82, 113, 141, 0.35);
  outline-offset: 3px;
}

.login-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.375rem;
  margin-top: 1.5rem;
  color: var(--text-muted);
  font-size: 0.75rem;
  line-height: 1.5;
  text-align: center;
}

@media (min-width: 37.5rem) {
  .login-shell {
    padding: 2rem;
  }

  .login-panel {
    padding: 2rem;
  }
}

@media (max-height: 42.5rem) {
  .login-shell {
    align-items: start;
    padding-block: max(0.75rem, env(safe-area-inset-top)) max(0.75rem, env(safe-area-inset-bottom));
  }

  .login-panel {
    padding-block: 1.25rem;
  }

  .login-header {
    margin-bottom: 1.25rem;
  }

  .login-heading {
    margin-top: 1.125rem;
  }
}

@media (forced-colors: active) {
  .brand-mark,
  .login-button {
    border: 1px solid ButtonText;
  }
}

/* Authenticated code store */
.workspace-body {
  min-width: 0;
  overflow-x: hidden;
}

.app-header {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  min-height: 4rem;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.625rem max(1rem, env(safe-area-inset-right)) 0.625rem max(1rem, env(safe-area-inset-left));
  border-bottom: 1px solid var(--border);
  background: var(--page);
}

.app-nav {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.875rem;
}

.app-nav a,
.back-link {
  color: var(--accent);
  font-weight: 650;
  text-decoration: none;
}

.app-nav a:hover,
.back-link:hover {
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.app-user {
  display: none;
  color: var(--text-muted);
}

.app-main {
  width: min(100%, 92rem);
  margin-inline: auto;
  padding: 1.25rem max(1rem, env(safe-area-inset-right)) max(2rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
}

.app-main.app-main-clean {
  padding-top: max(0.75rem, env(safe-area-inset-top));
}

.app-main-centered {
  display: grid;
  min-height: 100vh;
  min-height: 100svh;
  align-items: start;
  justify-items: center;
}

.project-overview {
  width: min(100%, 56rem);
  margin: 0;
  padding: clamp(1rem, 3vw, 2rem);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  background: var(--surface);
  box-shadow: 0 0.75rem 2rem rgba(28, 31, 35, 0.06);
}

.app-main.app-main-clean.app-main-centered {
  padding: max(0.75rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) max(1.25rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
}

.project-overview .project-grid {
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
}

.project-overview .project-grid > .empty-list {
  grid-column: 1 / -1;
  text-align: center;
}

.project-overview .compact-panel {
  max-width: none;
  background: var(--surface-subtle);
}

.page-eyebrow {
  margin-top: 1.25rem !important;
}

.page-heading,
.project-heading {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.page-heading h1,
.project-heading h1,
.empty-state h1 {
  margin: 0.25rem 0 0;
  font-size: clamp(1.75rem, 7vw, 2.5rem);
  letter-spacing: -0.04em;
  line-height: 1.1;
}

.page-heading p,
.project-heading p,
.empty-state p {
  margin: 0.5rem 0 0;
  color: var(--text-muted);
  line-height: 1.5;
}

.panel,
.upload-panel,
.file-sidebar,
.file-content {
  border: 1px solid var(--border);
  border-radius: 0.625rem;
  background: var(--surface);
}

.panel {
  padding: 1rem;
}

.panel h2,
.upload-panel h2,
.sidebar-heading h2 {
  margin: 0;
  font-size: 1rem;
  letter-spacing: -0.015em;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.button {
  display: inline-flex;
  width: auto;
  min-height: 2.75rem;
  align-items: center;
  justify-content: center;
  padding: 0.5625rem 0.875rem;
  border-radius: 0.45rem;
  font-size: 0.875rem;
  font-weight: 650;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
}

.workspace-body .secondary-button {
  width: auto;
  min-height: 2.75rem;
}

.primary-button {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
}

.primary-button:hover {
  border-color: var(--accent-hover);
  background: var(--accent-hover);
}

.danger-button {
  border: 1px solid #c9a8a5;
  background: #fff;
  color: var(--error);
}

.danger-button:hover {
  border-color: var(--error);
  background: var(--error-surface);
}

.button:focus-visible,
.workspace-body input:focus,
.workspace-body textarea:focus,
.workspace-body select:focus,
.workspace-body summary:focus-visible,
.tree-label:focus-visible {
  outline: 3px solid rgba(82, 113, 141, 0.28);
  outline-offset: 2px;
}

.button:disabled,
.file-picker:has(input:disabled) {
  border-color: var(--disabled);
  background: var(--disabled);
  color: var(--disabled-text);
  cursor: not-allowed;
}

.workspace-body input,
.workspace-body textarea,
.workspace-body select {
  width: 100%;
  min-width: 0;
  min-height: 2.75rem;
  padding: 0.625rem 0.7rem;
  border: 1px solid var(--border-strong);
  border-radius: 0.45rem;
  outline: 0;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 1rem;
}

.workspace-body textarea {
  min-height: 7rem;
  resize: vertical;
}

.inline-form,
.stack-form,
.sidebar-action form,
.edit-panel form {
  display: grid;
  gap: 0.75rem;
}

.stack-form label,
.sidebar-action label,
.edit-panel label {
  font-size: 0.8125rem;
  font-weight: 650;
}

.project-grid,
.file-tree,
.version-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.project-grid {
  display: grid;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.project-card a {
  display: flex;
  min-height: 5.5rem;
  flex-direction: column;
  justify-content: center;
  gap: 0.5rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 0.625rem;
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
}

.project-card a:hover {
  border-color: var(--border-strong);
  background: var(--surface-subtle);
}

.project-name {
  font-weight: 680;
}

.project-meta,
.file-meta {
  color: var(--text-muted);
  font-size: 0.8125rem;
}

.compact-panel {
  max-width: 42rem;
}

.compact-panel h2 {
  margin-bottom: 0.875rem;
}

.notice {
  margin-bottom: 1rem;
  padding: 0.75rem 0.875rem;
  border-radius: 0.45rem;
  font-size: 0.875rem;
}

.notice-success {
  border: 1px solid #cdd8d1;
  background: #f4f8f5;
  color: #30533b;
}

.upload-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1rem;
  padding: 1rem;
  border-style: dashed;
  transition: border-color 120ms ease, background 120ms ease;
}

.upload-panel p {
  margin: 0.35rem 0 0;
  color: var(--text-muted);
  font-size: 0.875rem;
  line-height: 1.45;
}

.upload-panel.is-dragging {
  border-color: var(--accent);
  background: #f2f5f7;
}

.file-picker {
  position: relative;
  overflow: hidden;
}

.file-picker input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.upload-status {
  width: 100%;
  color: var(--accent);
  font-size: 0.8125rem;
}

.upload-status:empty {
  display: none;
}

.upload-status.is-error {
  color: var(--error);
}

.repository-layout {
  display: grid;
  min-width: 0;
  gap: 1rem;
}

.file-sidebar,
.file-content {
  min-width: 0;
  overflow: hidden;
}

.sidebar-heading,
.file-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--border);
}

.sidebar-title {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 0.5rem;
}

.sidebar-title > span {
  color: var(--text-muted);
  font-size: 0.75rem;
}

.tree-search {
  width: min(10rem, 58%);
  flex: 0 1 10rem;
}

.workspace-body .tree-search input {
  min-height: 2.75rem;
  padding: 0.5rem 0.625rem;
  font-size: 1rem;
}

.file-tree {
  max-height: 38rem;
  overflow: auto;
  padding: 0.4rem;
  scrollbar-gutter: stable;
}

.file-tree ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.tree-node {
  min-width: 0;
}

.tree-node-directory > details > summary,
.tree-file-link {
  display: flex;
  min-width: 0;
  min-height: 2.75rem;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.625rem;
  border-radius: 0.375rem;
  color: var(--text);
  font-size: 0.8125rem;
  text-decoration: none;
  cursor: pointer;
}

.tree-node-directory > details > summary {
  list-style: none;
  font-weight: 620;
}

.tree-node-directory > details > summary::-webkit-details-marker {
  display: none;
}

.tree-node-directory > details > summary:hover,
.tree-file-link:hover,
.tree-file-link[aria-current="page"] {
  background: #eff2f4;
}

.tree-node-directory > details > summary:focus-visible,
.tree-file-link:focus-visible {
  outline: 3px solid rgba(82, 113, 141, 0.25);
  outline-offset: -2px;
}

.tree-children {
  margin-left: 1rem !important;
  padding-left: 0.45rem !important;
  border-left: 1px solid #e1e3e1;
}

.tree-chevron {
  width: 0;
  height: 0;
  flex: 0 0 auto;
  border-top: 0.25rem solid transparent;
  border-bottom: 0.25rem solid transparent;
  border-left: 0.35rem solid #777d83;
  transform-origin: 35% 50%;
}

details[open] > summary > .tree-chevron {
  transform: rotate(90deg);
}

.tree-icon {
  position: relative;
  display: block;
  width: 0.95rem;
  height: 0.78rem;
  flex: 0 0 auto;
}

.tree-icon-folder {
  margin-top: 0.1rem;
  border: 1px solid #889097;
  border-radius: 0.15rem;
  background: #eef0f1;
}

.tree-icon-folder::before {
  position: absolute;
  top: -0.3rem;
  left: -0.0625rem;
  width: 0.45rem;
  height: 0.25rem;
  border: 1px solid #889097;
  border-bottom: 0;
  border-radius: 0.12rem 0.12rem 0 0;
  background: #eef0f1;
  content: "";
}

.tree-icon-file {
  border: 1px solid #90969c;
  border-radius: 0.1rem;
  background: #fff;
}

.tree-icon-file::after {
  position: absolute;
  top: 0.18rem;
  right: 0.15rem;
  left: 0.15rem;
  height: 1px;
  background: #b1b5b9;
  box-shadow: 0 0.2rem 0 #b1b5b9, 0 0.4rem 0 #b1b5b9;
  content: "";
}

.tree-name {
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tree-count,
.tree-size {
  flex: 0 0 auto;
  color: var(--text-muted);
  font-size: 0.6875rem;
  font-weight: 500;
}

.tree-count {
  min-width: 1.25rem;
  padding: 0.12rem 0.35rem;
  border-radius: 999px;
  background: #eceeec;
  text-align: center;
}

.sidebar-action {
  border-top: 1px solid var(--border);
}

.sidebar-action summary,
.edit-panel summary {
  min-height: 2.75rem;
  padding: 0.75rem 1rem;
  color: var(--accent);
  font-size: 0.8125rem;
  font-weight: 650;
  cursor: pointer;
}

.sidebar-action form,
.edit-panel form {
  padding: 0 1rem 1rem;
}

.file-content {
  min-height: 18rem;
}

.file-header {
  align-items: flex-start;
}

.file-path {
  margin: 0 0 0.3rem;
  overflow-wrap: anywhere;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.875rem;
  font-weight: 650;
}

.code-view,
.diff-view {
  max-width: 100%;
  margin: 0;
  overflow: auto;
  background: #fbfbfa;
  color: #25282c;
  font: 0.8125rem/1.65 ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  tab-size: 2;
}

.code-view {
  max-height: 42rem;
  padding-block: 0.75rem;
}

.code-line {
  display: grid;
  min-width: max-content;
  grid-template-columns: 3.5rem minmax(0, 1fr);
}

.line-number {
  padding-right: 0.875rem;
  color: #92969b;
  text-align: right;
  user-select: none;
}

.line-content {
  padding-right: 1rem;
  white-space: pre;
}

.syntax-string { color: #6b4d24; }
.syntax-comment { color: #6d756f; font-style: italic; }
.syntax-number { color: #76536f; }
.syntax-word { color: #315a76; font-weight: 600; }

.editor-actions {
  display: flex;
  min-height: 3.5rem;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 1rem;
  border-bottom: 1px solid var(--border);
}

.copy-status {
  color: #30533b;
  font-size: 0.8125rem;
}

.binary-notice,
.empty-preview,
.empty-state {
  padding: clamp(1.5rem, 6vw, 3rem);
}

.binary-notice p,
.empty-preview p {
  color: var(--text-muted);
  line-height: 1.5;
}

.edit-panel {
  border-top: 1px solid var(--border);
}

.edit-panel textarea {
  min-height: 24rem;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  line-height: 1.55;
  tab-size: 2;
}

.project-settings {
  display: block;
  margin-top: 1rem;
}

.project-settings > summary {
  min-height: 2.75rem;
  padding: 0.75rem 0.875rem;
  color: var(--accent);
  font-size: 0.875rem;
  font-weight: 650;
  cursor: pointer;
}

.project-settings-content {
  display: grid;
  gap: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.versions-layout {
  display: grid;
  gap: 1rem;
  margin-bottom: 1rem;
}

.versions-layout .panel h2,
.version-list-panel h2 {
  margin-bottom: 1rem;
}

.version-list {
  border-top: 1px solid var(--border);
}

.version-row {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  justify-content: space-between;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
}

.version-row a {
  color: var(--accent);
  font-weight: 680;
  text-decoration: none;
}

.version-row p,
.version-row > span {
  margin: 0.3rem 0 0;
  color: var(--text-muted);
  font-size: 0.8125rem;
  line-height: 1.5;
}

.diff-view {
  padding: 1rem 0;
  border: 1px solid var(--border);
  border-radius: 0.625rem;
}

.diff-line {
  display: block;
  min-width: max-content;
  padding-inline: 1rem;
  white-space: pre;
}

.diff-add { background: #eef6f0; color: #28583a; }
.diff-remove { background: #faf0ef; color: #7a302c; }
.diff-info { color: #42637e; }

.empty-list {
  padding: 1rem;
  color: var(--text-muted);
  font-size: 0.875rem;
  line-height: 1.5;
}

.account-link {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.75rem;
  text-decoration: none;
}

/* Authenticated application dashboard */
.dashboard-body {
  min-width: 0;
  overflow-x: hidden;
}

.dashboard-header {
  display: flex;
  min-height: 4.5rem;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem max(1rem, env(safe-area-inset-right)) 0.75rem max(1rem, env(safe-area-inset-left));
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.user-avatar {
  display: grid;
  width: 2.875rem;
  height: 2.875rem;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  background: var(--surface);
  color: #42464c;
  text-decoration: none;
}

.user-avatar:hover,
.user-avatar[aria-current="page"] {
  border-color: #7f858c;
  background: var(--surface-subtle);
  color: var(--text);
}

.user-avatar:active {
  background: #ecece9;
}

.user-avatar:focus-visible,
.application-tile:focus-visible {
  outline: 3px solid rgba(82, 113, 141, 0.3);
  outline-offset: 3px;
}

.user-avatar-icon {
  position: relative;
  width: 1.25rem;
  height: 1.25rem;
}

.user-avatar-icon::before,
.user-avatar-icon::after {
  position: absolute;
  left: 50%;
  display: block;
  background: currentColor;
  content: "";
  transform: translateX(-50%);
}

.dashboard-avatar {
  position: absolute;
  z-index: 20;
  top: max(1rem, env(safe-area-inset-top));
  right: max(1rem, env(safe-area-inset-right));
}

.user-menu {
  position: absolute;
  z-index: 30;
  top: max(1rem, env(safe-area-inset-top));
  right: max(1rem, env(safe-area-inset-right));
}

.user-menu .dashboard-avatar {
  position: static;
  list-style: none;
  cursor: pointer;
}

.user-menu .dashboard-avatar::-webkit-details-marker {
  display: none;
}

.user-menu[open] .dashboard-avatar {
  border-color: #7f858c;
  background: var(--surface-subtle);
  color: var(--text);
}

.user-menu-dropdown {
  position: absolute;
  top: calc(100% + 0.55rem);
  right: 0;
  width: min(17rem, calc(100vw - 2rem));
  padding: 0.45rem;
  border: 1px solid var(--border);
  border-radius: 0.6rem;
  background: var(--surface);
  box-shadow: 0 0.85rem 2.25rem rgba(28, 31, 35, 0.14);
}

.user-menu-dropdown p {
  display: grid;
  gap: 0.15rem;
  margin: 0 0 0.35rem;
  padding: 0.65rem 0.7rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

.user-menu-dropdown p span {
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.user-menu-dropdown p strong {
  overflow-wrap: anywhere;
  font-size: 0.875rem;
}

.user-menu-dropdown a {
  display: flex;
  min-height: 2.75rem;
  align-items: center;
  padding: 0.65rem 0.7rem;
  border-radius: 0.4rem;
  color: var(--text);
  font-size: 0.875rem;
  font-weight: 620;
  text-decoration: none;
}

.user-menu-dropdown a:hover,
.user-menu-dropdown a[aria-current="page"] {
  background: var(--surface-subtle);
  color: var(--accent);
}

.user-menu-dropdown a:focus-visible {
  outline: 3px solid rgba(82, 113, 141, 0.3);
  outline-offset: -1px;
}

.theme-toggle {
  display: flex;
  width: 100%;
  min-height: 2.75rem;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.65rem 0.7rem;
  border: 0;
  border-top: 1px solid var(--border);
  border-radius: 0 0 0.4rem 0.4rem;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 620;
  cursor: pointer;
}

.theme-toggle:hover { background: var(--surface-subtle); }
.theme-toggle:focus-visible { outline: 3px solid rgba(82,113,141,.3); outline-offset: -1px; }
.theme-toggle i { position: relative; width: 2.25rem; height: 1.25rem; flex: 0 0 auto; border: 1px solid var(--border-strong); border-radius: 1rem; background: var(--disabled); transition: background 120ms ease, border-color 120ms ease; }
.theme-toggle i::after { position: absolute; top: 0.14rem; left: 0.15rem; width: 0.82rem; height: 0.82rem; border-radius: 50%; background: var(--surface); box-shadow: 0 1px 3px rgba(0,0,0,.25); content: ""; transition: transform 120ms ease; }
.theme-toggle[aria-checked="true"] i { border-color: var(--accent); background: var(--accent); }
.theme-toggle[aria-checked="true"] i::after { transform: translateX(0.95rem); }

.user-avatar-icon::before {
  top: 0.0625rem;
  width: 0.46rem;
  height: 0.46rem;
  border-radius: 50%;
}

.user-avatar-icon::after {
  bottom: 0.0625rem;
  width: 0.92rem;
  height: 0.58rem;
  border-radius: 0.6rem 0.6rem 0.25rem 0.25rem;
}

.dashboard-main {
  display: grid;
  min-height: calc(100vh - 4.5rem);
  min-height: calc(100svh - 4.5rem);
  place-items: center;
  padding: max(1.5rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) max(1.5rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
}

.dashboard-main-home {
  min-height: 100vh;
  min-height: 100svh;
}

.dashboard-main-home:not(.dashboard-main-user) {
  align-items: start;
  padding-top: max(4.5rem, calc(env(safe-area-inset-top) + 4rem));
}

.dashboard-main-user {
  align-items: start;
  padding-top: max(1rem, env(safe-area-inset-top));
}

.application-overview {
  width: min(100%, 64rem);
}

.dashboard-heading {
  margin-bottom: 1.25rem;
  text-align: center;
}

.dashboard-heading h1 {
  margin: 0;
  font-size: clamp(1.6rem, 7vw, 2.1rem);
  font-weight: 680;
  letter-spacing: -0.035em;
  line-height: 1.15;
}

.dashboard-heading p:not(.eyebrow) {
  margin: 0.625rem 0 0;
  color: var(--text-muted);
  line-height: 1.5;
}

.dashboard-notice {
  width: min(100%, 30rem);
  margin: 0 auto 1rem;
  padding: 0.75rem 0.875rem;
  border: 1px solid #cdd8d1;
  border-radius: 0.5rem;
  background: #f4f8f5;
  color: #30533b;
  font-size: 0.875rem;
  text-align: center;
}

.application-grid {
  display: grid;
  width: min(100%, 42rem);
  margin: 0 auto;
  padding: 0;
  gap: 1rem;
  list-style: none;
}

.application-tile {
  display: flex;
  min-height: 11rem;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.4rem;
  border: 1px solid var(--border);
  border-radius: 0.7rem;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 0.5rem 1.5rem rgba(28, 31, 35, 0.055);
  text-decoration: none;
  text-align: center;
}

.application-tile:hover {
  border-color: var(--border-strong);
  background: #fdfdfc;
  box-shadow: 0 0.65rem 1.7rem rgba(28, 31, 35, 0.075);
}

.application-tile:active {
  background: var(--surface-subtle);
  box-shadow: 0 0.25rem 0.8rem rgba(28, 31, 35, 0.05);
}

.application-icon {
  display: grid;
  min-width: 2.75rem;
  height: 2.75rem;
  place-items: center;
  margin-bottom: 1rem;
  border-radius: 0.45rem;
  background: #e9edf0;
  color: var(--accent);
  font: 700 0.8rem/1 ui-monospace, SFMono-Regular, Consolas, monospace;
}

.application-title {
  font-size: 1.0625rem;
  font-weight: 690;
  letter-spacing: -0.02em;
}

.application-description {
  margin-top: 0.45rem;
  color: var(--text-muted);
  font-size: 0.8125rem;
  line-height: 1.5;
}

.application-icon-board {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 0.2rem;
}

.application-icon-board i {
  display: block;
  width: 0.32rem;
  border-radius: 0.08rem;
  background: currentColor;
}

.application-icon-board i:nth-child(1) { height: 0.72rem; }
.application-icon-board i:nth-child(2) { height: 1.05rem; }
.application-icon-board i:nth-child(3) { height: 0.88rem; }

.application-icon-status i {
  width: 0.8rem;
  height: 0.8rem;
  border: 0.18rem solid currentColor;
  border-radius: 50%;
  box-shadow: 0 0 0 0.22rem #e9edf0, 0 0 0 0.34rem currentColor;
}

.application-icon-folder i {
  position: relative;
  width: 1.35rem;
  height: 0.9rem;
  border: 0.13rem solid currentColor;
  border-radius: 0.16rem;
}

.application-icon-folder i::before {
  position: absolute;
  top: -0.42rem;
  left: -0.13rem;
  width: 0.62rem;
  height: 0.3rem;
  border: 0.13rem solid currentColor;
  border-bottom: 0;
  border-radius: 0.13rem 0.13rem 0 0;
  content: "";
}

.application-icon-calendar i {
  width: 1.25rem;
  height: 1.15rem;
  border: 0.13rem solid currentColor;
  border-radius: 0.15rem;
  background: linear-gradient(to bottom, currentColor 0 0.25rem, transparent 0.25rem);
}

.application-action {
  margin-top: auto;
  padding-top: 1rem;
  color: var(--accent);
  font-size: 0.8125rem;
  font-weight: 680;
}

.user-management {
  width: min(100%, 32rem);
  padding: 0 1.25rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: 0.7rem;
  background: var(--surface);
  box-shadow: 0 0.75rem 2rem rgba(28, 31, 35, 0.06);
}

.user-management > .back-link,
.project-overview .back-link {
  display: inline-flex;
  min-height: 2.875rem;
  align-items: center;
}

.user-management-admin { width: min(100%, 52rem); }

.user-management-heading {
  margin: 1.5rem 0;
  text-align: left;
}

.user-management .account-details {
  margin-bottom: 1rem;
}

.account-password-section {
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

.account-session-section {
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

.account-session-section h2 { margin: 0; font-size: 1rem; letter-spacing: -0.015em; }
.account-session-section p { margin: 0.45rem 0 1rem; color: var(--text-muted); font-size: 0.8125rem; line-height: 1.5; }
.account-session-section .button { width: auto; }
.account-session-list { display: grid; gap: 0.55rem; margin: 0 0 1rem; padding: 0; list-style: none; }
.account-session-list li { display: grid; min-width: 0; grid-template-columns: auto minmax(0,1fr); align-items: center; gap: 0.7rem; padding: 0.75rem; border: 1px solid var(--border); border-radius: 0.5rem; background: var(--surface-subtle); }
.account-session-list li > div { display: grid; min-width: 0; gap: 0.2rem; }
.account-session-list strong { overflow-wrap: anywhere; font-size: 0.8125rem; }
.account-session-list small { color: var(--text-muted); font-size: 0.7rem; line-height: 1.45; }
.session-device-icon { position: relative; width: 1.45rem; height: 1.05rem; border: 1px solid var(--border-strong); border-radius: 0.18rem; }
.session-device-icon::after { position: absolute; bottom: -0.28rem; left: 0.3rem; width: 0.85rem; height: 0.15rem; border-radius: 1rem; background: var(--border-strong); content: ""; }
.session-current { grid-column: 2; justify-self: start; padding: 0.25rem 0.45rem; border-radius: 1rem; background: var(--surface); color: var(--accent); font-size: 0.65rem; font-weight: 700; white-space: nowrap; }
.session-empty { display: block !important; color: var(--text-muted); font-size: 0.8rem; }

.account-password-section h2 {
  margin: 0;
  font-size: 1rem;
  letter-spacing: -0.015em;
}

.account-password-section > p {
  margin: 0.45rem 0 1rem;
  color: var(--text-muted);
  font-size: 0.8125rem;
  line-height: 1.5;
}

.account-message {
  margin: 0 0 1rem;
}

.account-password-form {
  gap: 0.875rem;
}

.account-password-button { width: auto; }

.account-logout {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.user-administration {
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

.user-administration-header { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 0.75rem; margin-bottom: 1rem; }
.user-administration-header h2 { margin: 0; font-size: 1rem; }
.user-administration-header p { margin: 0.4rem 0 0; color: var(--text-muted); font-size: 0.8125rem; }
.user-administration-header .button { width: auto; }
.user-management-layout { display: grid; gap: 0.75rem; }
.managed-user-list { display: grid; align-content: start; gap: 0.4rem; }
.managed-user-select { display: grid; width: 100%; min-height: 3.75rem; grid-template-columns: 2.25rem minmax(0,1fr) auto; align-items: center; gap: 0.7rem; padding: 0.6rem 0.7rem; border: 1px solid var(--border); border-radius: 0.5rem; background: var(--surface); color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.managed-user-select:hover { border-color: var(--border-strong); background: var(--surface-subtle); }
.managed-user-select:focus-visible { outline: 3px solid rgba(82,113,141,.3); outline-offset: 1px; }
.managed-user-select.is-selected { border-color: var(--accent); background: #f2f5f7; }
.managed-user-select > span:nth-child(2) { display: grid; min-width: 0; gap: 0.15rem; }
.managed-user-select strong { overflow: hidden; font-size: 0.875rem; text-overflow: ellipsis; white-space: nowrap; }
.managed-user-select small { color: var(--text-muted); font-size: 0.7rem; }
.managed-user-initial { display: grid; width: 2.25rem; height: 2.25rem; place-items: center; border-radius: 50%; background: var(--accent); color: white; font-size: 0.78rem; font-weight: 700; }
.managed-user-content { min-width: 0; }
.managed-user-placeholder { display: grid; min-height: 12rem; place-items: center; padding: 1rem; border: 1px dashed var(--border); border-radius: 0.55rem; color: var(--text-muted); font-size: 0.8125rem; text-align: center; }
.managed-user-placeholder[hidden], .managed-user-detail[hidden] { display: none; }
.managed-user-detail { display: grid; gap: 1rem; padding: 1rem; border: 1px solid var(--border); border-radius: 0.55rem; background: var(--surface-subtle); }
.managed-user-detail > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.managed-user-detail h3 { margin: 0.2rem 0 0; font-size: 1.05rem; }
.managed-user-detail > header > span { color: var(--text-muted); font-size: 0.75rem; }
.managed-user-detail form { display: grid; gap: 0.75rem; }
.managed-user-detail fieldset { display: grid; gap: 0.55rem; margin: 0; padding: 0.75rem; border: 1px solid var(--border); border-radius: 0.45rem; background: var(--surface); }
.managed-user-detail legend { padding: 0 0.3rem; color: var(--text-muted); font-size: 0.75rem; font-weight: 650; }
.managed-user-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.managed-user-actions .button { width: auto; }
.managed-user-empty { margin: 0; padding: 1rem; border: 1px dashed var(--border); border-radius: 0.5rem; color: var(--text-muted); font-size: 0.8rem; text-align: center; }
.permission-check { display: flex !important; min-height: 2.25rem; grid-template-columns: auto 1fr; align-items: center; gap: 0.55rem !important; }
.permission-check input { width: 1rem !important; min-height: 1rem !important; }
.permission-check-admin { align-items: flex-start; padding: 0.55rem; border-radius: 0.4rem; background: var(--surface-subtle); }
.permission-check-admin > span { display: grid; gap: 0.15rem; }
.permission-check-admin strong { font-size: 0.8rem; }
.permission-check-admin small { color: var(--text-muted); font-size: 0.7rem; font-weight: 500; line-height: 1.4; }
.owner-protection-notice { padding: 0.85rem; border: 1px solid var(--border); border-radius: 0.5rem; background: var(--surface); }
.owner-protection-notice strong { font-size: 0.82rem; }
.owner-protection-notice p { margin: 0.35rem 0 0; color: var(--text-muted); font-size: 0.75rem; line-height: 1.45; }
.account-dialog .dialog-content label { display: grid; gap: 0.45rem; color: var(--text); font-size: 0.8125rem; font-weight: 650; }
.optional-field { margin-left: 0.3rem; color: var(--text-muted); font-size: 0.7rem; font-weight: 500; }
.account-dialog .field-hint { margin: -0.35rem 0 0; color: var(--text-muted); font-size: 0.72rem; line-height: 1.45; }
.account-dialog .account-password-form { display: block; }

/* Shared calendar */
.calendar-main { width: 100%; min-height: 100vh; min-height: 100svh; padding: max(0.75rem, env(safe-area-inset-top)) max(0.75rem, env(safe-area-inset-right)) max(1rem, env(safe-area-inset-bottom)) max(0.75rem, env(safe-area-inset-left)); }
.calendar-app { width: min(100%, 92rem); margin-inline: auto; }
.calendar-header, .calendar-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem; }
.calendar-header { min-height: 3.125rem; margin-bottom: 0.75rem; padding-right: 3.75rem; }
.calendar-header h1 { margin: 0.65rem 0 0; font-size: clamp(1.6rem, 6vw, 2.1rem); letter-spacing: -0.035em; }
.calendar-header-actions, .calendar-navigation, .calendar-views { display: flex; gap: 0.5rem; }
.calendar-header-actions .button, .calendar-navigation .button { width: auto; }
.calendar-toolbar { padding: 0.75rem; border: 1px solid var(--border); border-radius: 0.65rem 0.65rem 0 0; background: var(--surface); }
.calendar-toolbar h2 { margin: 0; font-size: 1rem; text-align: center; }
.calendar-views { padding: 0.2rem; border: 1px solid var(--border); border-radius: 0.45rem; background: var(--surface-subtle); }
.calendar-views button { min-height: 2.35rem; padding: 0.45rem 0.65rem; border: 0; border-radius: 0.32rem; background: transparent; color: var(--text-muted); font: inherit; font-size: 0.8rem; font-weight: 650; cursor: pointer; }
.calendar-views button.is-active { background: var(--surface); color: var(--accent); box-shadow: 0 1px 4px rgba(28,31,35,.1); }
.calendar-content { min-height: 34rem; border: 1px solid var(--border); border-top: 0; border-radius: 0 0 0.65rem 0.65rem; background: var(--surface); overflow-x: auto; }
.calendar-month { display: grid; min-width: 46rem; grid-template-columns: repeat(7, minmax(0,1fr)); }
.calendar-weekday { padding: 0.55rem; border-bottom: 1px solid var(--border); color: var(--text-muted); font-size: 0.7rem; font-weight: 700; text-align: center; text-transform: uppercase; }
.calendar-day { min-height: 7.25rem; padding: 0.35rem; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.calendar-day:nth-child(7n) { border-right: 0; }
.calendar-day.is-outside { background: #fafaf8; color: var(--text-muted); }
.calendar-day-number { display: grid; width: 2rem; height: 2rem; place-items: center; margin-left: auto; border: 0; border-radius: 50%; background: transparent; font: inherit; cursor: pointer; }
.calendar-day.is-today .calendar-day-number { background: var(--accent); color: white; }
.calendar-day-events { display: grid; gap: 0.2rem; }
.calendar-day-events > span { padding-left: 0.35rem; color: var(--text-muted); font-size: 0.68rem; }
.calendar-event { width: 100%; min-height: 1.45rem; padding: 0.2rem 0.35rem; overflow: hidden; border: 0; border-left: 0.2rem solid; border-radius: 0.22rem; background: #eef1f3; color: var(--text); font: inherit; font-size: 0.68rem; text-align: left; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.calendar-event:disabled { opacity: 1; cursor: default; }
.owner-event-0 { border-color:#496a82; background:#edf2f5; }.owner-event-1 { border-color:#7a5a78; background:#f3eef3; }.owner-event-2 { border-color:#55705c; background:#eef4ef; }.owner-event-3 { border-color:#8a6538; background:#f6f1ea; }.owner-event-4 { border-color:#6d6288; background:#f1eff6; }.owner-event-5 { border-color:#486f72; background:#edf4f4; }
.nrw-event { border-color:#a8a9a5; background:#f2f2ef; color:#65686d; }
.calendar-week { display: grid; min-width: 54rem; grid-template-columns: repeat(7,minmax(0,1fr)); }
.calendar-week-day { display: flex; min-height: 38rem; flex-direction: column; gap: 0.35rem; padding: 0.5rem; border-right: 1px solid var(--border); }
.calendar-week-day:last-child { border-right:0; }.calendar-week-day > button:first-child { min-height:2.75rem; border:0; border-bottom:1px solid var(--border); background:transparent; font:inherit; font-size:.8rem; font-weight:700; cursor:pointer; }.calendar-week-day.is-today > button:first-child { color:var(--accent); }
.calendar-day-view { min-width: 0; }
.calendar-day-all-day { display: grid; min-height: 3.5rem; grid-template-columns: 4.25rem minmax(0,1fr); align-items: start; gap: 0.75rem; padding: 0.65rem 0.75rem; border-bottom: 1px solid var(--border); background: var(--surface-subtle); }
.calendar-day-all-day > strong { padding-top: 0.25rem; color: var(--text-muted); font-size: 0.7rem; }
.calendar-day-all-day-events, .calendar-hour-events { display: grid; min-width: 0; gap: 0.25rem; }
.calendar-day-all-day-events > span { padding: 0.25rem 0; color: var(--text-muted); font-size: 0.75rem; }
.calendar-hour-row { display: grid; min-height: 3.5rem; grid-template-columns: 4.25rem minmax(0,1fr); }
.calendar-hour-row > time { padding: 0.4rem 0.65rem 0 0; color: var(--text-muted); font-size: 0.7rem; text-align: right; }
.calendar-hour-slot { position: relative; min-width: 0; padding: 0.25rem; border-bottom: 1px solid var(--border); border-left: 1px solid var(--border); }
.calendar-hour-create { position: absolute; z-index: 0; inset: 0; width: 100%; border: 0; background: transparent; cursor: crosshair; }
.calendar-hour-create:hover { background: rgba(82,113,141,.05); }
.calendar-hour-create:focus-visible { z-index: 2; outline: 3px solid rgba(82,113,141,.28); outline-offset: -3px; }
.calendar-hour-events { position: relative; z-index: 1; pointer-events: none; }
.calendar-hour-events .calendar-event { min-height: 2rem; pointer-events: auto; }
.calendar-fab { position: fixed; z-index: 25; right: max(1rem, env(safe-area-inset-right)); bottom: max(1rem, env(safe-area-inset-bottom)); display: grid; width: 3.25rem; height: 3.25rem; place-items: center; padding: 0; border: 1px solid var(--accent); border-radius: 50%; background: var(--accent); color: #fff; box-shadow: 0 .55rem 1.4rem rgba(28,31,35,.22); font: 400 2rem/1 sans-serif; cursor: pointer; }
.calendar-fab:hover { border-color: var(--accent-hover); background: var(--accent-hover); transform: translateY(-1px); }
.calendar-fab:active { border-color: var(--accent-active); background: var(--accent-active); box-shadow: 0 .25rem .75rem rgba(28,31,35,.18); transform: translateY(0); }
.calendar-fab:focus-visible { outline: 3px solid rgba(82,113,141,.35); outline-offset: 3px; }
.calendar-agenda { display:grid; }.calendar-agenda-row { display:grid; grid-template-columns:minmax(8rem,11rem) 1fr; gap:1rem; padding:.9rem 1rem; border-bottom:1px solid var(--border); border-left:.22rem solid; cursor:pointer; }.calendar-agenda-row time { color:var(--text-muted); font-size:.8rem; }.calendar-agenda-row div { display:grid; gap:.25rem; }.calendar-agenda-row span { color:var(--text-muted); font-size:.75rem; }
.calendar-agenda-row.is-readonly { cursor: default; }
.calendar-loading { padding:2rem; color:var(--text-muted); text-align:center; }
.calendar-all-day { display:flex !important; grid-template-columns:auto 1fr; align-items:center; }.calendar-all-day input { width:1rem !important; min-height:1rem !important; }
.calendar-settings-content { display:grid; gap:1.25rem; padding:1.25rem; }.calendar-settings-content section { display:grid; gap:.65rem; }.calendar-settings-content h3 { margin:0 0 .25rem; font-size:.9rem; }.calendar-filter { display:flex !important; min-height:2.5rem; grid-template-columns:auto auto 1fr; align-items:center; gap:.55rem !important; }.calendar-filter input { width:1rem !important; min-height:1rem !important; }.calendar-color { width:.65rem; height:.65rem; border-radius:50%; background:#496a82; }.owner-color-1{background:#7a5a78}.owner-color-2{background:#55705c}.owner-color-3{background:#8a6538}.owner-color-4{background:#6d6288}.owner-color-5{background:#486f72}.nrw-color{background:#a8a9a5}
.calendar-import-button { position:relative; overflow:hidden; cursor:pointer; }.calendar-import-button input { position:absolute; width:1px; height:1px; opacity:0; }.calendar-danger-zone { padding-top:1rem; border-top:1px solid var(--border); }.calendar-danger-zone form { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:.75rem; }.calendar-danger-zone .button { width:auto; }

/* Authenticated portal applications */
.portal-body {
  min-width: 0;
  overflow-x: hidden;
}

.portal-main {
  display: grid;
  width: 100%;
  min-height: 100vh;
  min-height: 100svh;
  align-items: start;
  justify-items: center;
  padding: max(0.75rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) max(1.5rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
}

.portal-section {
  width: min(100%, 68rem);
}

.portal-section-wide {
  width: min(100%, 86rem);
}

.kanban-body .portal-main {
  align-items: start;
  justify-items: center;
}

.portal-panel,
.files-section {
  padding: 1.25rem;
  border: 1px solid var(--border);
  border-radius: 0.7rem;
  background: var(--surface);
  box-shadow: 0 0.75rem 2rem rgba(28, 31, 35, 0.055);
}

.portal-error {
  width: min(100%, 32rem);
}

.portal-error h1 {
  margin: 0 0 0.75rem;
  font-size: 1.5rem;
}

.portal-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.portal-heading h1 {
  margin: 0;
  font-size: clamp(1.65rem, 6vw, 2.15rem);
  font-weight: 680;
  letter-spacing: -0.035em;
}

.portal-heading .eyebrow {
  margin-top: 1.2rem;
}

.portal-heading p:not(.eyebrow) {
  margin: 0.45rem 0 0;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.portal-body input,
.portal-body textarea,
.portal-body select {
  width: 100%;
  min-height: 2.75rem;
  padding: 0.68rem 0.75rem;
  border: 1px solid var(--border-strong);
  border-radius: 0.45rem;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 1rem;
}

.portal-body textarea {
  min-height: 5rem;
  resize: vertical;
}

.portal-body input:focus-visible,
.portal-body textarea:focus-visible,
.portal-body select:focus-visible {
  border-color: var(--focus);
  outline: 3px solid rgba(82, 113, 141, 0.25);
  outline-offset: 1px;
}

.portal-body label {
  display: grid;
  gap: 0.4rem;
  color: #303338;
  font-size: 0.8125rem;
  font-weight: 620;
}

/* Kanban */
.kanban-board {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 1rem;
}

.kanban-column {
  width: 100%;
  min-width: 0;
  padding: 0.85rem;
  border: 1px solid var(--border);
  border-radius: 0.65rem;
  background: #ebebe8;
}

.kanban-column.is-drop-target {
  border-color: var(--focus);
  background: #e6ebee;
}

.kanban-column > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.1rem 0.2rem 0.75rem;
}

.kanban-column > header h2 {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.015em;
}

.kanban-column > header span {
  min-width: 1.6rem;
  padding: 0.18rem 0.4rem;
  border-radius: 1rem;
  background: #d7d8d5;
  color: var(--text-muted);
  font-size: 0.75rem;
  text-align: center;
}

.kanban-card-list {
  display: grid;
  gap: 0.65rem;
  min-height: 3rem;
}

.kanban-card {
  border: 1px solid #d2d3d0;
  border-left-width: 0.22rem;
  border-radius: 0.5rem;
  background: var(--surface);
  box-shadow: 0 0.2rem 0.7rem rgba(28, 31, 35, 0.04);
  cursor: grab;
  overflow: hidden;
}

.kanban-card.priority-low { border-left-color: #77828b; }
.kanban-card.priority-normal { border-left-color: var(--accent); }
.kanban-card.priority-high { border-left-color: #8b632f; }
.kanban-card.priority-critical { border-left-color: var(--error); }

.kanban-card.is-dragging {
  opacity: 0.55;
}

.kanban-drop-placeholder {
  position: relative;
  height: 0.6rem;
  flex: 0 0 0.6rem;
}

.kanban-drop-placeholder::before {
  position: absolute;
  top: 50%;
  right: 0.2rem;
  left: 0.2rem;
  height: 2px;
  border-radius: 1rem;
  background: var(--focus);
  content: "";
  transform: translateY(-50%);
}

.kanban-column.is-drop-target .kanban-empty {
  display: none;
}

.kanban-card-open {
  display: block;
  width: 100%;
  padding: 0.85rem;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.kanban-card-open:hover { background: #fafaf8; }

.kanban-card-open:focus-visible {
  outline: 3px solid rgba(82, 113, 141, 0.3);
  outline-offset: -3px;
}

.kanban-card-open h3 {
  margin: 0;
  font-size: 0.9375rem;
  line-height: 1.35;
}

.kanban-card-open > p {
  display: -webkit-box;
  overflow: hidden;
  margin: 0.45rem 0 0;
  color: var(--text-muted);
  font-size: 0.8125rem;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.priority-label {
  display: inline-flex;
  align-items: center;
  min-height: 1.35rem;
  margin-bottom: 0.55rem;
  padding: 0.12rem 0.42rem;
  border: 1px solid var(--border);
  border-radius: 1rem;
  background: var(--surface-subtle);
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 720;
  letter-spacing: 0.025em;
  text-transform: uppercase;
}

.priority-label-high { border-color: #d7c5aa; color: #725126; }
.priority-label-critical { border-color: #dfc0bd; color: var(--error); }

.kanban-add-button {
  width: 100%;
  min-height: 2.75rem;
  margin-top: 0.7rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid transparent;
  border-radius: 0.45rem;
  background: transparent;
  color: var(--accent);
  font-size: 0.8125rem;
  font-weight: 650;
  text-align: left;
  cursor: pointer;
}

.kanban-add-button:hover { border-color: var(--border); background: rgba(255, 255, 255, 0.55); }
.kanban-add-button:focus-visible { outline: 3px solid rgba(82, 113, 141, 0.3); outline-offset: 1px; }

.kanban-empty {
  margin: 0;
  padding: 0.8rem;
  color: var(--text-muted);
  font-size: 0.8125rem;
  text-align: center;
}

.kanban-dialog {
  width: min(calc(100% - 2rem), 44rem);
  max-height: min(50rem, calc(100vh - 2rem));
  max-height: min(50rem, calc(100dvh - 2rem));
  margin: auto;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: 0.75rem;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1.5rem 4rem rgba(17, 20, 24, 0.24);
  overflow: auto;
}

.kanban-dialog::backdrop {
  background: rgba(25, 27, 31, 0.46);
}

.kanban-dialog[open] { animation: kanban-dialog-in 120ms ease-out; }

@keyframes kanban-dialog-in {
  from { opacity: 0; transform: translateY(0.35rem); }
  to { opacity: 1; transform: translateY(0); }
}

.dialog-form { margin: 0; }

.dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 1.25rem 1rem;
  border-bottom: 1px solid var(--border);
}

.dialog-header h2 {
  margin: 0;
  font-size: 1.3rem;
  letter-spacing: -0.025em;
}

.dialog-header p:not(.eyebrow) {
  margin: 0.35rem 0 0;
  color: var(--text-muted);
  font-size: 0.8125rem;
  line-height: 1.45;
}

.dialog-close {
  display: grid;
  width: 2.75rem;
  height: 2.75rem;
  flex: 0 0 auto;
  place-items: center;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 0.45rem;
  background: transparent;
  color: var(--text-muted);
  font: 400 1.55rem/1 sans-serif;
  cursor: pointer;
}

.dialog-close:hover { border-color: var(--border); background: var(--surface-subtle); color: var(--text); }
.dialog-close:focus-visible { outline: 3px solid rgba(82, 113, 141, 0.3); outline-offset: 1px; }

.dialog-content {
  display: grid;
  gap: 1rem;
  padding: 1.25rem;
}

.dialog-field-grid {
  display: grid;
  gap: 1rem;
}

.dialog-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.65rem;
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
  background: var(--surface-subtle);
}

.dialog-delete-form {
  padding: 0 1.25rem 1.25rem;
  background: var(--surface-subtle);
}

.dialog-delete-form[hidden] { display: none; }

.board-settings-dialog { width: min(calc(100% - 2rem), 58rem); }

.lane-settings {
  display: grid;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
}

.lane-setting {
  display: grid;
  gap: 0.75rem;
  padding: 0.85rem;
  border: 1px solid var(--border);
  border-radius: 0.55rem;
  background: var(--surface-subtle);
}

.lane-setting-heading {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.6rem;
}

.lane-setting-heading > span {
  display: grid;
  width: 1.55rem;
  height: 1.55rem;
  place-items: center;
  border-radius: 50%;
  background: #e1e4e6;
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 700;
}

.lane-setting-heading small { color: var(--text-muted); font-size: 0.75rem; }

.lane-rename-form,
.lane-create-form {
  display: grid;
  gap: 0.6rem;
}

.lane-setting-actions {
  display: flex;
  gap: 0.5rem;
}

.lane-setting-actions form { margin: 0; }
.lane-setting-actions .button { min-width: 2.75rem; padding-inline: 0.75rem; }

.lane-delete-form {
  display: grid;
  gap: 0.6rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.lane-create-form {
  padding: 1rem 1.25rem 1.25rem;
  border-top: 1px solid var(--border);
}

/* Server status */
.status-grid {
  display: grid;
  gap: 1rem;
}

.status-card {
  display: grid;
  min-width: 0;
  gap: 0.5rem;
  padding: 1.1rem;
  border: 1px solid var(--border);
  border-radius: 0.65rem;
  background: var(--surface);
  box-shadow: 0 0.45rem 1.25rem rgba(28, 31, 35, 0.045);
}

.status-card > span,
.status-card small {
  color: var(--text-muted);
  font-size: 0.8125rem;
}

.status-card > strong {
  overflow-wrap: anywhere;
  font-size: 1.05rem;
}

.status-card progress {
  width: 100%;
  height: 0.45rem;
  border: 0;
  border-radius: 1rem;
  overflow: hidden;
  background: #e3e4e1;
  accent-color: var(--accent);
}

.service-list {
  display: grid;
  gap: 0.7rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.service-list li {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.65rem;
  font-size: 0.875rem;
}

.service-list strong {
  font-size: 0.8125rem;
}

.status-dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: #8b8e92;
}

.status-dot.is-ok { background: #3e6b4b; }
.status-dot.is-error { background: var(--error); }

/* Personal file space */
.files-section {
  width: min(100%, 92rem);
  min-height: calc(100svh - 2rem);
}

.file-browser-heading {
  margin-bottom: 0.8rem;
}

.file-explorer-layout {
  display: grid;
  min-height: 72svh;
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  background: var(--surface);
  box-shadow: 0 0.4rem 1.5rem rgba(28, 31, 35, 0.05);
}

.file-explorer-sidebar {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0.85rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface-subtle);
}

.file-sidebar-title {
  color: var(--text-muted);
  font-size: 0.67rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.file-explorer-content {
  min-width: 0;
  padding: 0.9rem;
}

.file-storage {
  display: grid;
  width: 100%;
  gap: 0.45rem;
  margin-top: auto;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.75rem;
}

.file-storage span {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
}

.file-storage strong {
  color: var(--text);
}

.file-storage progress,
.file-upload-progress progress {
  width: 100%;
  height: 0.38rem;
  border: 0;
  border-radius: 1rem;
  background: var(--disabled);
  overflow: hidden;
}

.file-storage progress::-webkit-progress-bar,
.file-upload-progress progress::-webkit-progress-bar { background: var(--disabled); }
.file-storage progress::-webkit-progress-value,
.file-upload-progress progress::-webkit-progress-value { background: var(--accent); }
.file-storage progress::-moz-progress-bar,
.file-upload-progress progress::-moz-progress-bar { background: var(--accent); }

.file-area-tabs {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.35rem;
  margin: 0;
}

.file-area-tabs.has-one-area {
  grid-template-columns: minmax(0, 1fr);
}

.file-area-tabs a {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 0.7rem;
  padding: 0.55rem;
  border: 1px solid transparent;
  border-radius: 0.48rem;
  color: var(--text);
  text-decoration: none;
  transition: border-color 140ms ease, background 140ms ease;
}

.file-area-tabs a:hover {
  border-color: var(--border);
  background: var(--surface);
}

.file-area-tabs a.is-active {
  border-color: color-mix(in srgb, var(--accent) 25%, var(--border));
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
}

.file-area-tabs a > span:last-child {
  display: grid;
  min-width: 0;
  gap: 0.15rem;
}

.file-area-tabs strong { font-size: 0.84rem; }
.file-area-tabs small {
  color: var(--text-muted);
  font-size: 0.7rem;
}

.file-area-icon {
  position: relative;
  display: block;
  width: 2.1rem;
  height: 2.1rem;
  flex: 0 0 auto;
  border-radius: 0.55rem;
  background: var(--surface-subtle);
}

.file-area-private::before {
  position: absolute;
  width: 0.72rem;
  height: 0.58rem;
  top: 0.9rem;
  left: 0.69rem;
  border: 1.5px solid var(--text-muted);
  border-radius: 0.16rem;
  content: "";
}

.file-area-private::after {
  position: absolute;
  width: 0.46rem;
  height: 0.45rem;
  top: 0.51rem;
  left: 0.82rem;
  border: 1.5px solid var(--text-muted);
  border-bottom: 0;
  border-radius: 0.4rem 0.4rem 0 0;
  content: "";
}

.file-area-shared::before,
.file-area-shared::after {
  position: absolute;
  width: 0.48rem;
  height: 0.48rem;
  top: 0.56rem;
  border: 1.5px solid var(--text-muted);
  border-radius: 50%;
  content: "";
}

.file-area-shared::before { left: 0.48rem; }
.file-area-shared::after { right: 0.48rem; }

.file-readonly-label {
  display: inline-flex;
  min-height: 1.8rem;
  align-items: center;
  padding: 0.25rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 2rem;
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 650;
  white-space: nowrap;
}

.file-space-switch {
  display: flex;
  gap: 0.4rem;
  margin: 0;
  overflow-x: auto;
  padding-bottom: 0.2rem;
}

.file-space-switch a {
  flex: 0 0 auto;
  padding: 0.4rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 0.4rem;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 620;
  text-decoration: none;
}

.file-space-switch a:hover,
.file-space-switch a.is-active {
  border-color: var(--accent);
  color: var(--text);
}

.file-visibility-list {
  display: grid;
  gap: 0.45rem;
}

.file-visibility-user {
  display: grid !important;
  min-height: 3.4rem;
  grid-template-columns: auto 2.25rem minmax(0, 1fr);
  align-items: center;
  gap: 0.65rem !important;
  padding: 0.55rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: var(--surface);
}

.file-visibility-user > input {
  width: 1rem !important;
  min-height: 1rem !important;
}

.file-visibility-user > span:last-child {
  display: grid;
  min-width: 0;
  gap: 0.15rem;
}

.file-visibility-user strong { font-size: 0.8rem; }
.file-visibility-user small { color: var(--text-muted); font-size: 0.68rem; }

.file-browser-tabs {
  display: grid;
  gap: 0.25rem;
  margin: 0;
  padding-top: 0.7rem;
  border-top: 1px solid var(--border);
  border-bottom: 0;
}

.file-browser-tabs a {
  position: relative;
  display: inline-flex;
  min-height: 2.25rem;
  align-items: center;
  gap: 0.45rem;
  justify-content: space-between;
  padding: 0.4rem 0.55rem;
  border-radius: 0.4rem;
  color: var(--text-muted);
  font-size: 0.8125rem;
  font-weight: 650;
  text-decoration: none;
}

.file-browser-tabs a::after {
  display: none;
}

.file-browser-tabs a:hover,
.file-browser-tabs a.is-active {
  background: var(--surface);
  color: var(--text);
}
.file-browser-tabs a span {
  display: grid;
  min-width: 1.3rem;
  height: 1.3rem;
  place-items: center;
  border-radius: 1rem;
  background: var(--surface-subtle);
  font-size: 0.68rem;
}

.file-command-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.65rem;
  margin-bottom: 0.6rem;
  padding-bottom: 0.7rem;
  border-bottom: 1px solid var(--border);
}

.file-command-primary,
.file-picker-group,
.file-view-switch {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.file-command-primary .button {
  width: auto;
  white-space: nowrap;
}

.file-search {
  position: relative;
}

.file-search::before {
  position: absolute;
  top: 50%;
  left: 0.85rem;
  width: 0.65rem;
  height: 0.65rem;
  border: 1.5px solid var(--text-muted);
  border-radius: 50%;
  content: "";
  pointer-events: none;
  transform: translateY(-60%);
}

.file-search::after {
  position: absolute;
  top: calc(50% + 0.35rem);
  left: 1.45rem;
  width: 0.35rem;
  height: 1.5px;
  background: var(--text-muted);
  content: "";
  pointer-events: none;
  transform: rotate(45deg);
}

.portal-body .file-search input {
  min-height: 2.5rem;
  padding-left: 2.25rem;
  font-size: 0.8125rem;
}

.portal-body .file-sort select {
  min-height: 2.5rem;
  font-size: 0.8125rem;
}

.file-view-switch {
  align-self: stretch;
  padding: 0.2rem;
  border: 1px solid var(--border);
  border-radius: 0.48rem;
  background: var(--surface-subtle);
}

.file-view-switch button {
  min-height: 2rem;
  padding: 0.35rem 0.55rem;
  border: 0;
  border-radius: 0.34rem;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 650;
  cursor: pointer;
}

.file-view-switch button.is-active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 4px rgba(28, 31, 35, 0.08);
}

.file-breadcrumb-row {
  display: flex;
  min-height: 2.5rem;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 0.6rem;
  padding: 0.3rem 0.45rem;
  border: 1px solid var(--border);
  border-radius: 0.45rem;
  background: var(--surface);
}

.file-parent-link {
  display: grid;
  width: 2rem;
  height: 2rem;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 0.4rem;
  color: var(--text);
  text-decoration: none;
}

.file-breadcrumbs {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  gap: 0.35rem;
  color: var(--text-muted);
  font-size: 0.8125rem;
}

.file-breadcrumbs a {
  color: var(--accent);
  overflow-wrap: anywhere;
}

.file-drop-zone {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-bottom: 0.85rem;
  padding: 0.65rem 0.8rem;
  border: 1px dashed var(--border-strong);
  border-radius: 0.6rem;
  background: var(--surface-subtle);
}

.file-drop-zone.is-dragover,
.file-drop-zone.is-uploading {
  border-color: var(--focus);
  background: #eef2f4;
}

.file-drop-zone > div:first-child {
  display: grid;
  gap: 0.2rem;
}

.file-drop-zone strong { font-size: 0.8125rem; }
.file-drop-zone span {
  color: var(--text-muted);
  font-size: 0.75rem;
}

.file-picker {
  display: inline-flex !important;
  width: fit-content;
  cursor: pointer;
}

.file-picker input {
  position: absolute;
  width: 1px;
  height: 1px;
  min-height: 0;
  opacity: 0;
}

.file-upload-progress {
  display: grid;
  flex-basis: 100%;
  grid-template-columns: minmax(6rem, 1fr) auto;
  align-items: center;
  gap: 0.65rem;
}

#file-upload-status {
  color: var(--text-muted);
  font-size: 0.75rem;
}

#file-upload-status.is-error { color: var(--error); }

.file-selection-bar {
  display: flex;
  min-height: 3rem;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid #b9c7d1;
  border-radius: 0.5rem;
  background: #f0f5f8;
}

.file-selection-bar[hidden] { display: none; }
.file-selection-bar > label,
.file-selection-bar > div {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}
.file-selection-bar label {
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 650;
}
.portal-body .file-selection-bar input {
  width: 1rem;
  min-height: 1rem;
}
.file-selection-bar button {
  min-height: 2rem;
  padding: 0.35rem 0.5rem;
  border: 0;
  border-radius: 0.35rem;
  background: transparent;
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 650;
  cursor: pointer;
}
.file-selection-bar button:hover { background: rgba(51, 78, 104, 0.08); }
.file-selection-bar button.is-danger { color: var(--error); }

.file-list-heading {
  display: grid;
  grid-template-columns: 2rem minmax(15rem, 1fr) 10.5rem 5.5rem 5rem;
  gap: 0.65rem;
  padding: 0.45rem 0.65rem;
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 650;
  letter-spacing: 0.035em;
  text-transform: uppercase;
}
.file-list-heading[hidden],
.file-upload-progress[hidden] { display: none; }

.personal-file-list {
  border: 1px solid var(--border);
  border-radius: 0.45rem;
  background: var(--surface);
  overflow: visible;
}

.file-item {
  position: relative;
  display: grid;
  min-width: 0;
  grid-template-columns: 2rem minmax(15rem, 1fr) 10.5rem 5.5rem 5rem;
  align-items: center;
  gap: 0.65rem;
  padding: 0.48rem 0.6rem;
  border-bottom: 1px solid var(--border);
}

.file-item:last-child { border-bottom: 0; }
.file-item:hover { background: var(--surface-subtle); }
.file-item.is-selected { background: #f2f6f8; }

.file-select {
  display: grid;
  width: 2rem;
  height: 2rem;
  place-items: center;
}

.portal-body .file-select input {
  width: 1rem;
  min-height: 1rem;
  margin: 0;
}

.file-item-primary {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 0.7rem;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  text-decoration: none;
}

button.file-item-primary { cursor: pointer; }
.file-item-primary:hover strong { color: var(--accent); }

.file-item-copy {
  display: grid;
  min-width: 0;
  gap: 0.18rem;
}

.file-item-copy strong {
  font-size: 0.825rem;
  font-weight: 630;
  overflow-wrap: anywhere;
}

.file-item-copy small,
.trash-item small {
  color: var(--text-muted);
  font-size: 0.69rem;
  line-height: 1.4;
}

.file-item-modified,
.file-item-size {
  min-width: 0;
  color: var(--text-muted);
  font-size: 0.69rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-item-size {
  text-align: right;
}

.file-type-icon {
  position: relative;
  display: grid;
  width: 2.15rem;
  height: 2.15rem;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 0.42rem;
  background: var(--surface-subtle);
  color: var(--text-muted);
}

.file-type-icon::after {
  font-size: 0.55rem;
  font-weight: 760;
  letter-spacing: 0.02em;
}

.file-type-folder {
  border-color: #c7b98f;
  background: #f5f0df;
}
.file-type-folder::before {
  position: absolute;
  top: 0.45rem;
  left: 0.45rem;
  width: 0.72rem;
  height: 0.28rem;
  border-radius: 0.12rem 0.12rem 0 0;
  background: #b49b59;
  content: "";
}
.file-type-folder::after {
  width: 1.25rem;
  height: 0.85rem;
  margin-top: 0.22rem;
  border-radius: 0.15rem;
  background: #c8ad61;
  content: "";
}
.file-type-image::after { content: "IMG"; }
.file-type-pdf::after { content: "PDF"; color: #94443f; }
.file-type-text::after { content: "TXT"; }
.file-type-archive::after { content: "ZIP"; color: #7a6135; }
.file-type-document::after { content: "DOC"; color: #446985; }
.file-type-sheet::after { content: "XLS"; color: #467154; }
.file-type-presentation::after { content: "PPT"; color: #94613c; }
.file-type-audio::after { content: "AUD"; }
.file-type-video::after { content: "VID"; }
.file-type-file::after { content: "FILE"; font-size: 0.47rem; }

.file-item-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 0.35rem;
  justify-content: flex-end;
}

.file-visibility-eye {
  position: relative;
  display: block;
  width: 2.15rem;
  height: 2.15rem;
  flex: 0 0 auto;
  padding: 0;
  border: 0;
  border-radius: 0.35rem;
  background: transparent;
  color: var(--accent);
}

button.file-visibility-eye { cursor: pointer; }
button.file-visibility-eye:hover,
button.file-visibility-eye:focus-visible { background: var(--surface-subtle); }
.file-visibility-eye.is-readonly { opacity: 0.72; }

.file-visibility-eye::before,
.file-visibility-eye::after {
  position: absolute;
  top: 50%;
  left: 50%;
  content: "";
}

.file-visibility-eye::before {
  width: 0.95rem;
  height: 0.95rem;
  border: 1.5px solid currentColor;
  border-radius: 72% 12%;
  transform: translate(-50%, -50%) rotate(45deg);
}

.file-visibility-eye::after {
  width: 0.28rem;
  height: 0.28rem;
  border-radius: 50%;
  background: currentColor;
  transform: translate(-50%, -50%);
}

.file-quick-action {
  min-height: 2rem;
  padding: 0.42rem 0.5rem;
  border-radius: 0.35rem;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 650;
  text-decoration: none;
}

.file-quick-action:hover { background: var(--surface-subtle); }

.file-item-menu {
  position: relative;
}

.file-item-menu[open] { z-index: 15; }
.file-item-menu summary {
  display: grid;
  width: 2.15rem;
  height: 2.15rem;
  place-items: center;
  border-radius: 0.35rem;
  color: var(--text-muted);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  list-style: none;
  cursor: pointer;
}
.file-item-menu summary::-webkit-details-marker { display: none; }
.file-item-menu summary:hover { background: var(--surface-subtle); color: var(--text); }

.file-item-popover {
  position: absolute;
  top: calc(100% + 0.3rem);
  right: 0;
  display: grid;
  width: min(15.5rem, calc(100vw - 3rem));
  gap: 0.15rem;
  padding: 0.4rem;
  border: 1px solid var(--border);
  border-radius: 0.55rem;
  background: var(--surface);
  box-shadow: 0 0.75rem 2rem rgba(28, 31, 35, 0.14);
}

.file-item-popover > a,
.file-item-popover > button,
.file-menu-danger {
  width: 100%;
  min-height: 2.25rem;
  padding: 0.5rem 0.6rem;
  border: 0;
  border-radius: 0.35rem;
  background: transparent;
  color: var(--text);
  font-size: 0.76rem;
  font-weight: 600;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.file-item-popover > a:hover,
.file-item-popover > button:hover,
.file-menu-danger:hover { background: var(--surface-subtle); }
.file-menu-danger { color: var(--error); }

.file-item-popover form {
  display: block;
  padding: 0;
  border: 0;
}

.file-item-popover form label {
  display: grid;
  gap: 0.3rem;
  color: var(--text-muted);
  font-size: 0.68rem;
}

.portal-body .file-item-popover input {
  min-height: 2.25rem;
  font-size: 0.76rem;
}

.file-item-popover .button {
  min-height: 2.25rem;
  padding: 0.45rem 0.55rem;
  font-size: 0.72rem;
}

.file-menu-divider {
  height: 1px;
  margin: 0.25rem 0;
  background: var(--border);
}

.file-visibility-inheritance {
  display: grid;
  gap: 0.35rem;
  margin-bottom: 0.65rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 0.45rem;
  background: var(--surface-subtle);
  color: var(--text-muted);
  font-size: 0.74rem;
}

.file-visibility-inheritance[hidden] { display: none; }
.file-visibility-inheritance a {
  width: fit-content;
  color: var(--accent);
  font-weight: 650;
  text-decoration: none;
}
.file-visibility-inheritance a:hover { text-decoration: underline; }

.file-visibility-actions {
  flex-wrap: wrap;
}

.file-visibility-actions [data-file-visibility-inherit] {
  margin-right: auto;
}

.personal-file-list[data-view="grid"] {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(12.5rem, 1fr));
  gap: 0.65rem;
  padding: 0.65rem;
  border: 0;
  background: transparent;
}

.personal-file-list[data-view="grid"] .file-item {
  min-height: 9.5rem;
  grid-template-columns: auto 1fr auto;
  grid-template-rows: auto 1fr;
  align-items: start;
  padding: 0.65rem;
  border: 1px solid var(--border);
  border-radius: 0.58rem;
  background: var(--surface);
}

.personal-file-list[data-view="grid"] .file-item:hover {
  border-color: var(--border-strong);
  box-shadow: 0 0.45rem 1.2rem rgba(28, 31, 35, 0.06);
}

.personal-file-list[data-view="grid"] .file-select { grid-column: 1; grid-row: 1; }
.personal-file-list[data-view="grid"] .file-item-actions { grid-column: 3; grid-row: 1; }
.personal-file-list[data-view="grid"] .file-item-modified,
.personal-file-list[data-view="grid"] .file-item-size { display: none; }
.personal-file-list[data-view="grid"] .file-quick-action { display: none; }
.personal-file-list[data-view="grid"] .file-item-primary {
  grid-column: 1 / -1;
  grid-row: 2;
  flex-direction: column;
  align-items: flex-start;
  align-self: stretch;
  justify-content: center;
  padding: 0.35rem;
}
.personal-file-list[data-view="grid"] .file-type-icon {
  width: 2.65rem;
  height: 2.65rem;
}
.personal-file-list[data-view="grid"] .file-item-copy strong { font-size: 0.86rem; }
.personal-file-list[data-view="grid"] .file-item-popover { top: 2.25rem; }
.personal-file-list[data-view="grid"] .file-empty-state { grid-column: 1 / -1; }
.personal-file-list[data-view="grid"] + .file-filter-empty,
.personal-file-list[data-view="grid"] ~ .file-filter-empty { margin-top: 0.75rem; }
.personal-file-list[data-view="grid"] ~ .file-list-heading { display: none; }

.file-filter-empty {
  margin: 0;
  padding: 2rem;
  color: var(--text-muted);
  text-align: center;
}

.file-empty-state {
  display: grid;
  min-height: 10rem;
  place-content: center;
  gap: 0.35rem;
  padding: 2rem;
  color: var(--text-muted);
  text-align: center;
}
.file-empty-state strong { color: var(--text); font-size: 0.9rem; }
.file-empty-state span { font-size: 0.78rem; }

.file-dialog { width: min(92vw, 31rem); }
.file-preview-dialog { width: min(94vw, 62rem); }
.file-preview-content {
  display: grid;
  min-height: 20rem;
  max-height: 70vh;
  place-items: center;
  padding: 1rem;
  overflow: auto;
  background: var(--surface-subtle);
}
.file-preview-content img {
  display: block;
  max-width: 100%;
  max-height: 64vh;
  border-radius: 0.35rem;
  object-fit: contain;
}
.file-preview-content pre {
  width: 100%;
  min-height: 18rem;
  margin: 0;
  color: var(--text);
  font: 0.78rem/1.6 ui-monospace, SFMono-Regular, Consolas, monospace;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.file-preview-loading { color: var(--text-muted); font-size: 0.82rem; }

.trash-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.85rem;
  padding: 0.8rem 0;
}
.trash-toolbar > div { display: grid; gap: 0.2rem; }
.trash-toolbar strong { font-size: 0.875rem; }
.trash-toolbar span { color: var(--text-muted); font-size: 0.75rem; }
.trash-toolbar .button { width: auto; }
.trash-list {
  border: 1px solid var(--border);
  border-radius: 0.55rem;
  overflow: hidden;
}
.trash-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem;
  border-bottom: 1px solid var(--border);
}
.trash-item:last-child { border-bottom: 0; }
.trash-item > div:nth-child(2) { display: grid; min-width: 0; gap: 0.2rem; }
.trash-item strong { font-size: 0.825rem; overflow-wrap: anywhere; }
.trash-item-actions { display: flex; gap: 0.45rem; }
.trash-item-actions form { margin: 0; }
.trash-item-actions .button { width: auto; min-height: 2.25rem; padding: 0.45rem 0.55rem; font-size: 0.72rem; }

@media (min-width: 50rem) {
  .file-explorer-layout {
    grid-template-columns: 15rem minmax(0, 1fr);
  }
  .file-explorer-sidebar {
    border-right: 1px solid var(--border);
    border-bottom: 0;
  }
  .file-command-bar {
    grid-template-columns: auto minmax(12rem, 1fr) minmax(9rem, 11rem) auto;
    align-items: center;
  }
  .file-drop-zone {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
  }
}

@media (max-width: 64rem) {
  .file-list-heading,
  .file-item {
    grid-template-columns: 2rem minmax(12rem, 1fr) 10rem 5rem;
  }
  .file-list-heading span:nth-child(4),
  .file-item-size {
    display: none;
  }
}

@media (max-width: 37.499rem) {
  .files-section { padding: 1rem; }
  .file-browser-heading { align-items: flex-start; flex-direction: column; }
  .file-storage { width: 100%; }
  .file-explorer-layout { min-height: 0; }
  .file-explorer-sidebar { padding: 0.7rem; }
  .file-explorer-content { padding: 0.65rem; }
  .file-area-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.45rem; }
  .file-area-tabs.has-one-area { grid-template-columns: minmax(0, 1fr); }
  .file-area-tabs a { gap: 0.5rem; padding: 0.65rem; }
  .file-area-icon { width: 1.8rem; height: 1.8rem; }
  .file-area-private::before { top: 0.78rem; left: 0.54rem; }
  .file-area-private::after { top: 0.39rem; left: 0.67rem; }
  .file-area-shared::before,
  .file-area-shared::after { top: 0.42rem; }
  .file-area-shared::before { left: 0.34rem; }
  .file-area-shared::after { right: 0.34rem; }
  .file-command-primary { display: grid; grid-template-columns: 1fr 1fr; }
  .file-command-primary .button { width: 100%; padding-inline: 0.45rem; font-size: 0.76rem; }
  .file-picker-group { width: 100%; }
  .file-picker-group .button { flex: 1; justify-content: center; padding-inline: 0.35rem; font-size: 0.72rem; }
  .file-selection-bar { align-items: flex-start; flex-direction: column; }
  .file-selection-bar > div { width: 100%; flex-wrap: wrap; }
  .file-list-heading { display: none; }
  .file-item { grid-template-columns: 1.75rem minmax(0, 1fr) auto; padding-inline: 0.45rem; }
  .file-item-modified,
  .file-item-size { display: none; }
  .file-item-actions { grid-column: 3; }
  .file-quick-action { display: none; }
  .file-item-copy small { max-width: 13rem; }
  .file-type-icon { width: 2rem; height: 2rem; }
  .personal-file-list[data-view="grid"] { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.45rem; padding: 0; }
  .personal-file-list[data-view="grid"] .file-item { min-height: 9rem; }
  .trash-toolbar { align-items: flex-start; flex-direction: column; }
  .trash-item { grid-template-columns: auto minmax(0, 1fr); }
  .trash-item-actions { grid-column: 1 / -1; }
  .trash-item-actions .button { flex: 1; }
}

/* Dark theme keeps the restrained palette while preserving component contrast. */
html[data-theme="dark"] .login-panel,
html[data-theme="dark"] .user-management,
html[data-theme="dark"] .user-menu-dropdown,
html[data-theme="dark"] .application-tile,
html[data-theme="dark"] .panel,
html[data-theme="dark"] .upload-panel,
html[data-theme="dark"] .file-sidebar,
html[data-theme="dark"] .file-content,
html[data-theme="dark"] .portal-panel,
html[data-theme="dark"] .files-section,
html[data-theme="dark"] .status-card,
html[data-theme="dark"] .kanban-card,
html[data-theme="dark"] .kanban-dialog,
html[data-theme="dark"] .calendar-toolbar,
html[data-theme="dark"] .calendar-content {
  box-shadow: none;
}

html[data-theme="dark"] .field-group label,
html[data-theme="dark"] .portal-body label { color: var(--text); }

html[data-theme="dark"] input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
html[data-theme="dark"] textarea,
html[data-theme="dark"] select,
html[data-theme="dark"] .workspace-body input,
html[data-theme="dark"] .workspace-body textarea,
html[data-theme="dark"] .workspace-body select {
  border-color: var(--border-strong);
  background: #15181b;
  color: var(--text);
}

html[data-theme="dark"] .secondary-button,
html[data-theme="dark"] .danger-button { background: var(--surface); }
html[data-theme="dark"] .secondary-button:hover,
html[data-theme="dark"] .secondary-button:active,
html[data-theme="dark"] .password-toggle:active { background: var(--surface-subtle); }
html[data-theme="dark"] .primary-button,
html[data-theme="dark"] .login-button { border-color: #466f8f; background: #466f8f; color: #fff; }
html[data-theme="dark"] .primary-button:hover,
html[data-theme="dark"] .login-button:hover { border-color: #527e9f; background: #527e9f; }
html[data-theme="dark"] .brand-mark { background: #e5e8ea; color: #17191c; }
html[data-theme="dark"] .form-message { border-color: #68403e; }
html[data-theme="dark"] .success-message,
html[data-theme="dark"] .notice-success,
html[data-theme="dark"] .dashboard-notice { border-color: #385143; background: #18261e; color: #9dcaab; }
html[data-theme="dark"] .user-avatar { color: var(--text-muted); }
html[data-theme="dark"] .user-avatar:hover,
html[data-theme="dark"] .user-menu[open] .dashboard-avatar { border-color: var(--border-strong); }
html[data-theme="dark"] .user-avatar:active { background: var(--surface-subtle); }
html[data-theme="dark"] .application-tile:hover { background: #202428; }
html[data-theme="dark"] .application-icon { background: #26313a; }
html[data-theme="dark"] .managed-user-select.is-selected { background: #202c34; }
html[data-theme="dark"] .managed-user-initial,
html[data-theme="dark"] .calendar-day.is-today .calendar-day-number { background: #466f8f; }

html[data-theme="dark"] .tree-node-directory > details > summary:hover,
html[data-theme="dark"] .tree-file-link:hover,
html[data-theme="dark"] .tree-file-link[aria-current="page"] { background: #252b30; }
html[data-theme="dark"] .tree-children { border-color: var(--border); }
html[data-theme="dark"] .tree-icon-folder,
html[data-theme="dark"] .tree-icon-folder::before { border-color: var(--border-strong); background: #272c31; }
html[data-theme="dark"] .tree-icon-file { border-color: var(--border-strong); background: #202428; }
html[data-theme="dark"] .tree-count { background: #2a2f34; }
html[data-theme="dark"] .code-view,
html[data-theme="dark"] .diff-view { background: #14171a; color: #dfe3e5; }
html[data-theme="dark"] .line-number { color: #747d85; }
html[data-theme="dark"] .syntax-string { color: #d2aa72; }
html[data-theme="dark"] .syntax-comment { color: #87928a; }
html[data-theme="dark"] .syntax-number { color: #c99bc0; }
html[data-theme="dark"] .syntax-word { color: #80afd0; }
html[data-theme="dark"] .diff-add { background: #17271d; color: #9dcaab; }
html[data-theme="dark"] .diff-remove { background: #2d1d1d; color: #e5aaa5; }
html[data-theme="dark"] .diff-info { color: #91b5cf; }

html[data-theme="dark"] .calendar-day.is-outside { background: #171a1d; }
html[data-theme="dark"] .calendar-views { background: #16191c; }
html[data-theme="dark"] .calendar-views button.is-active { background: #272b2f; }
html[data-theme="dark"] .calendar-event { color: #e8ebed; }
html[data-theme="dark"] .owner-event-0 { background:#1c2a33; }
html[data-theme="dark"] .owner-event-1 { background:#2b222c; }
html[data-theme="dark"] .owner-event-2 { background:#202c23; }
html[data-theme="dark"] .owner-event-3 { background:#30271d; }
html[data-theme="dark"] .owner-event-4 { background:#292431; }
html[data-theme="dark"] .owner-event-5 { background:#1d2b2c; }
html[data-theme="dark"] .nrw-event { background:#292b2c; color:#b6babd; }

html[data-theme="dark"] .kanban-column { background: #171a1d; }
html[data-theme="dark"] .kanban-column.is-drop-target { background: #1d2931; }
html[data-theme="dark"] .kanban-column > header span,
html[data-theme="dark"] .lane-setting-heading > span { background: #2b3035; }
html[data-theme="dark"] .kanban-card { border-color: var(--border); }
html[data-theme="dark"] .kanban-card-open:hover { background: #22262a; }
html[data-theme="dark"] .kanban-add-button:hover { background: #202428; }
html[data-theme="dark"] .priority-label-high { border-color:#725d41; color:#d7ae74; }
html[data-theme="dark"] .priority-label-critical { border-color:#754744; }
html[data-theme="dark"] .dialog-actions { background: #171a1d; }
html[data-theme="dark"] .file-drop-zone.is-dragover,
html[data-theme="dark"] .file-drop-zone.is-uploading { background: #1d2931; }
html[data-theme="dark"] .file-area-tabs a.is-active { background: #1d2931; }
html[data-theme="dark"] .file-selection-bar { border-color: #3c5261; background: #1b2931; }
html[data-theme="dark"] .file-item.is-selected { background: #1d2931; }
html[data-theme="dark"] .file-item-popover { box-shadow: 0 0.75rem 2rem rgba(0, 0, 0, 0.32); }
html[data-theme="dark"] .file-view-switch button.is-active { background: #292e33; box-shadow: none; }
html[data-theme="dark"] .file-type-folder { border-color: #665d45; background: #2b291f; }
html[data-theme="dark"] .file-type-folder::before { background: #9c864d; }
html[data-theme="dark"] .file-type-folder::after { background: #ad9554; }
html[data-theme="dark"] .status-card progress { background: #2b3035; }

@media (max-height: 50rem) {
  .dashboard-main-user {
    align-items: start;
    padding-top: max(1rem, env(safe-area-inset-top));
  }
}

.sr-only,
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

@media (max-width: 37.499rem) {
  .calendar-header {
    align-items: flex-start;
    margin-bottom: 0.5rem;
  }

  .calendar-header h1 {
    margin-top: 0.25rem;
    font-size: 1.45rem;
  }

  .calendar-header-actions .button {
    min-height: 2.75rem;
    padding-inline: 0.65rem;
    font-size: 0.78rem;
  }

  .calendar-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    padding: 0.5rem;
  }

  .calendar-navigation {
    gap: 0.25rem;
    justify-content: space-between;
  }

  .calendar-navigation .button {
    min-width: 2.5rem;
    min-height: 2.5rem;
    padding: 0.35rem 0.55rem;
    font-size: 0.78rem;
  }

  .calendar-toolbar h2 {
    grid-column: 1;
    grid-row: 2;
    padding: 0.2rem 0;
    font-size: 0.85rem;
    text-align: center;
  }

  .calendar-views {
    display: grid;
    width: 100%;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-row: 3;
    gap: 0;
  }

  .calendar-views button {
    min-height: 2.15rem;
    padding: 0.35rem 0.42rem;
    font-size: 0.7rem;
  }

  .calendar-content {
    min-height: 0;
    overflow-x: hidden;
  }

  .calendar-content[data-view="day"] {
    min-height: 0;
    overflow: auto;
    scrollbar-gutter: stable;
  }

  body.calendar-day-mode {
    width: 100%;
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
    overscroll-behavior: none;
  }

  .calendar-day-mode .calendar-main {
    display: block;
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
  }

  .calendar-day-mode .calendar-app {
    display: flex;
    height: 100%;
    min-height: 0;
    flex-direction: column;
  }

  .calendar-day-mode .calendar-header,
  .calendar-day-mode .calendar-toolbar {
    flex: 0 0 auto;
  }

  .calendar-day-mode .calendar-content[data-view="day"] {
    max-height: none;
    min-height: 0;
    flex: 1 1 auto;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
  }

  .calendar-month,
  .calendar-week {
    width: 100%;
    min-width: 0;
  }

  .calendar-weekday {
    padding: 0.38rem 0.1rem;
    font-size: 0.61rem;
  }

  .calendar-day {
    min-width: 0;
    min-height: 4.15rem;
    padding: 0.15rem;
    cursor: pointer;
  }

  .calendar-day-number {
    width: 1.75rem;
    height: 1.75rem;
    margin-inline: auto;
    font-size: 0.72rem;
  }

  .calendar-day-events {
    display: flex;
    min-height: 0.65rem;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.14rem;
    padding-top: 0.18rem;
  }

  .calendar-day-events .calendar-event,
  .calendar-week-day > .calendar-event {
    width: 0.42rem;
    min-width: 0.42rem;
    height: 0.42rem;
    min-height: 0.42rem;
    padding: 0;
    border: 0;
    border-radius: 50%;
    color: transparent;
    font-size: 0;
  }

  .calendar-day-events > span {
    display: none;
  }

  .calendar-day-events .owner-event-0,
  .calendar-week-day > .owner-event-0 { background: #496a82; }
  .calendar-day-events .owner-event-1,
  .calendar-week-day > .owner-event-1 { background: #7a5a78; }
  .calendar-day-events .owner-event-2,
  .calendar-week-day > .owner-event-2 { background: #55705c; }
  .calendar-day-events .owner-event-3,
  .calendar-week-day > .owner-event-3 { background: #8a6538; }
  .calendar-day-events .owner-event-4,
  .calendar-week-day > .owner-event-4 { background: #6d6288; }
  .calendar-day-events .owner-event-5,
  .calendar-week-day > .owner-event-5 { background: #486f72; }
  .calendar-day-events .nrw-event,
  .calendar-week-day > .nrw-event { background: #a8a9a5; }

  .calendar-week-day {
    min-width: 0;
    min-height: 25rem;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem;
  }

  .calendar-week-day > button:first-child {
    width: 100%;
    min-height: 3.25rem;
    padding: 0.25rem 0.1rem;
    overflow-wrap: anywhere;
    font-size: 0.62rem;
  }

  .calendar-agenda-row {
    grid-template-columns: 5.6rem minmax(0, 1fr);
    gap: 0.65rem;
    padding: 0.75rem 0.65rem;
  }

  .calendar-day-all-day,
  .calendar-hour-row {
    grid-template-columns: 3.4rem minmax(0, 1fr);
  }

  .calendar-day-all-day {
    padding-inline: 0.45rem;
  }

  .calendar-hour-row > time {
    padding-right: 0.45rem;
  }

  .calendar-fab {
    right: max(0.9rem, env(safe-area-inset-right));
    bottom: max(0.9rem, env(safe-area-inset-bottom));
  }
}

@media (min-width: 37.5rem) {
  .app-main { padding: 2rem; }
  .app-main.app-main-clean { padding-top: 1rem; }
  .app-header { padding-inline: 2rem; }
  .app-user { display: inline; }
  .project-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .inline-form { grid-template-columns: minmax(0, 1fr) auto; }
  .upload-panel { flex-direction: row; align-items: center; justify-content: space-between; flex-wrap: wrap; }
  .upload-status { flex-basis: 100%; }
  .version-row { flex-direction: row; }
  .version-row > span { text-align: right; }
  .dashboard-header { padding-inline: 2rem; }
  .login-shell { padding: 2rem 2rem clamp(6rem, 13vh, 9rem); }
  .dashboard-main { align-items: start; padding: 1rem 2rem 2rem; }
  .dashboard-main-home:not(.dashboard-main-user) { align-items: center; padding: 2rem 2rem clamp(6rem, 13vh, 9rem); }
  .app-main.app-main-clean.app-main-centered { align-items: start; padding: 1rem 2rem 2rem; }
  .portal-main { align-items: start; padding: 1rem 2rem 2rem; }
  .kanban-body .portal-main { align-items: start; padding: 1rem 2rem 2rem; }
  .user-management { padding: 0 1.75rem 1.75rem; }
  .application-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .portal-panel,
  .files-section { padding: 1.75rem; }
  .status-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .file-drop-zone { flex-direction: row; align-items: center; justify-content: space-between; flex-wrap: wrap; }
  .file-toolbar { grid-template-columns: auto minmax(0, 1fr); align-items: center; }
  .file-toolbar .inline-form { grid-template-columns: minmax(0, 1fr) auto; justify-self: end; width: min(100%, 28rem); }
  .dialog-field-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .user-management-layout { grid-template-columns: minmax(12rem, 15rem) minmax(0, 1fr); }
  .lane-rename-form,
  .lane-create-form { grid-template-columns: minmax(0, 1fr) auto; align-items: end; }
  .lane-delete-form { grid-template-columns: minmax(0, 1fr) auto; align-items: end; }
}

@media (min-width: 37.5rem) and (max-height: 50rem) {
  .dashboard-main-user {
    align-items: start;
    padding-top: max(1rem, env(safe-area-inset-top));
  }
}

@media (min-width: 56rem) {
  .page-heading,
  .project-heading { flex-direction: row; align-items: flex-end; }
  .repository-layout { grid-template-columns: minmax(18rem, 25rem) minmax(0, 1fr); }
  .versions-layout { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .project-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kanban-board { flex-direction: row; align-items: flex-start; overflow-x: auto; padding-bottom: 0.4rem; }
  .kanban-column { flex: 1 0 min(20rem, calc((100% - 2rem) / 3)); }
  .status-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .status-card-wide { grid-column: span 2; }
}

@media (min-width: 56rem) and (min-height: 42rem) {
  .app-main.app-main-repository {
    height: 100vh;
    height: 100svh;
    padding: 1rem 2rem 1.25rem;
    overflow: hidden;
  }

  .repository-page {
    display: flex;
    width: 100%;
    height: 100%;
    min-height: 0;
    flex-direction: column;
    gap: 0.75rem;
  }

  .repository-page .project-heading,
  .repository-page .upload-panel,
  .repository-page .project-settings,
  .repository-page > .notice {
    flex: 0 0 auto;
    margin: 0;
  }

  .repository-page .upload-panel {
    padding-block: 0.75rem;
  }

  .repository-page > .repository-layout {
    min-height: 0;
    flex: 1 1 auto;
  }

  .repository-page .file-sidebar {
    display: flex;
    min-height: 0;
    flex-direction: column;
    overflow: auto;
  }

  .repository-page .file-tree {
    min-height: 0;
    max-height: none;
    flex: 1 1 auto;
  }

  .repository-page .file-content {
    height: 100%;
    min-height: 0;
    overflow: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  .upload-panel { transition: none; }
  .kanban-dialog[open] { animation: none; }
}
