:root {
  color-scheme: light;
  --page-top: #fbfcfd;
  --bg: #f4f6f8;
  --bg-soft: #e9eef2;
  --panel: #ffffff;
  --panel-glass: rgba(255, 255, 255, 0.86);
  --topbar-glass: rgba(255, 255, 255, 0.88);
  --panel-soft: #f8fafb;
  --input-bg: #ffffff;
  --label-bg: #f3f6f7;
  --label-text: #26343c;
  --line: #d8e0e6;
  --line-strong: #b8c5cf;
  --text: #17242b;
  --muted: #65747e;
  --accent: #0f766e;
  --accent-strong: #0b5f59;
  --accent-soft: #dff3ef;
  --column-bg: #e4eaee;
  --column-border: #bcc9d1;
  --danger: #b42318;
  --danger-border: #f1c3bd;
  --danger-soft: #fff0ed;
  --warning: #b87a05;
  --warning-border: #ead087;
  --warning-soft: #fff8df;
  --warning-text: #6f4c05;
  --shadow: 0 12px 34px rgba(23, 36, 43, 0.08);
  --card-shadow: 0 8px 20px rgba(23, 36, 43, 0.06);
  --column-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), 0 1px 0 rgba(23, 36, 43, 0.05);
  --dialog-backdrop: rgba(23, 36, 43, 0.38);
  --radius: 8px;
}

body.dark-mode {
  color-scheme: dark;
  --page-top: #11181c;
  --bg: #0f1519;
  --bg-soft: #151f24;
  --panel: #1b252b;
  --panel-glass: rgba(27, 37, 43, 0.9);
  --topbar-glass: rgba(21, 31, 36, 0.92);
  --panel-soft: #172126;
  --input-bg: #111a1f;
  --label-bg: #25343b;
  --label-text: #d9e3e8;
  --line: #33464f;
  --line-strong: #4d626c;
  --text: #edf4f7;
  --muted: #9fb0b9;
  --accent: #2dd4bf;
  --accent-strong: #7dded5;
  --accent-soft: #123f3a;
  --column-bg: #202d34;
  --column-border: #40545f;
  --danger: #ffb4a8;
  --danger-border: #7f352d;
  --danger-soft: #3b1d1a;
  --warning: #f6c967;
  --warning-border: #7b5d1b;
  --warning-soft: #2e2714;
  --warning-text: #f3d68b;
  --shadow: 0 14px 40px rgba(0, 0, 0, 0.38);
  --card-shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
  --column-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 1px 0 rgba(0, 0, 0, 0.28);
  --dialog-backdrop: rgba(0, 0, 0, 0.58);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  height: 100vh;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr) 340px;
  align-content: start;
  background:
    linear-gradient(180deg, var(--page-top) 0, var(--bg) 260px),
    var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.45;
  overflow: hidden;
}

body.login-only {
  display: block;
}

body.login-only > :not(.login-screen) {
  display: none !important;
}

.login-screen {
  display: none;
  min-height: 100dvh;
  place-items: center;
  padding: 24px;
  background: var(--bg);
}

body.login-only .login-screen {
  display: grid;
}

.login-panel {
  display: grid;
  gap: 14px;
  width: min(420px, 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 24px;
}

.login-panel h1 {
  margin: 0 0 6px;
}

.login-panel label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-weight: 800;
}

.login-panel input {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--input-bg);
  color: var(--text);
  padding: 11px 12px;
  font: inherit;
}

.busy-indicator {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 1000;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  max-width: calc(100vw - 36px);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text);
  box-shadow: var(--shadow);
  padding: 10px 12px;
  font-size: 14px;
  font-weight: 800;
}

.busy-indicator[hidden] {
  display: none;
}

.busy-spinner {
  width: 18px;
  height: 18px;
  border: 3px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: busy-spin 0.8s linear infinite;
}

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

body.drawer-closed {
  grid-template-columns: 260px minmax(0, 1fr);
}

button,
input,
select {
  font: inherit;
}

button {
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text);
  padding: 9px 12px;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease, box-shadow 140ms ease;
}

button:hover {
  border-color: var(--accent);
  box-shadow: 0 6px 18px rgba(15, 118, 110, 0.12);
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(15, 118, 110, 0.22);
  outline-offset: 2px;
}

#newDashboard,
#newPreset {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

#newDashboard:hover,
#newPreset:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}

.edit-control {
  display: none;
}

body.edit-mode .edit-control {
  display: inline-flex;
}

body.edit-mode .dashboard-import-panel {
  display: grid;
}

body:not(.edit-mode) .dashboard-import-panel {
  display: none;
}

.sidebar,
.filters {
  min-height: 100vh;
  padding: 20px;
  background: var(--panel-glass);
  backdrop-filter: blur(16px);
  border-right: 1px solid var(--line);
}

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  min-width: 0;
}

.filters {
  position: sticky;
  top: 0;
  max-height: 100vh;
  border-right: 0;
  border-left: 1px solid var(--line);
  overflow-y: auto;
}

body.drawer-closed .filters {
  display: none;
}

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

.drawer-head h2 {
  margin: 0;
  font-size: 18px;
}

.drawer-head button {
  width: 40px;
  height: 40px;
  padding: 0;
  font-size: 22px;
  line-height: 1;
}

.brand {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0;
  margin-bottom: 12px;
}

.sidebar .view-buttons {
  justify-content: flex-start;
  justify-self: stretch;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.preset-control {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.preset-control label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.preset-control select,
.preset-control input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--input-bg);
  color: var(--text);
  padding: 9px 10px;
}

.dashboard-import-control {
  display: grid;
  gap: 5px;
}

.dashboard-list {
  display: grid;
  gap: 8px;
  margin-top: 16px;
  max-width: 100%;
  min-width: 0;
}

.dashboard-row {
  display: grid;
  gap: 6px;
}

body.edit-mode .dashboard-shared-control {
  display: grid;
}

.dashboard-shared-control {
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

body.edit-mode .dashboard-move-control {
  display: grid;
}

.dashboard-move-control {
  gap: 5px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.dashboard-list button {
  text-align: left;
  width: 100%;
  overflow-wrap: anywhere;
}

.dashboard-preset-move,
.move-column-select,
.copy-column-select {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--input-bg);
  color: var(--text);
  padding: 8px 9px;
}

.dashboard-list .active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.app {
  min-width: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: auto;
  scrollbar-width: auto;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  justify-content: stretch;
  gap: 16px;
  padding: 18px 22px;
  background: var(--topbar-glass);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}

.title-block {
  min-width: 0;
}

.title-input {
  width: min(560px, 50vw);
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text);
  font-size: 26px;
  font-weight: 800;
  padding: 4px 8px;
}

body.edit-mode .title-input:hover,
body.edit-mode .title-input:focus {
  border-color: var(--line);
  background: var(--input-bg);
}

.title-input[readonly],
.column-title[readonly] {
  cursor: default;
}

.title-input[readonly]:focus,
.column-title[readonly]:focus {
  outline: 0;
}

.status {
  margin: 3px 8px 0;
  color: var(--muted);
  font-size: 14px;
}

.sidebar-status {
  margin: 0 0 12px;
  line-height: 1.45;
}

.actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.view-buttons {
  display: flex;
  gap: 8px;
}

.icon-button {
  width: 42px;
  min-width: 42px;
  padding: 0;
  font-size: 20px;
}

.auth-button {
  max-width: 150px;
  min-width: 74px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.icon-button[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

#toggleDarkMode[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.danger {
  color: var(--danger);
  border-color: var(--danger-border);
  background: var(--danger-soft);
}

.notice {
  margin: 18px 22px 0;
  padding: 12px 14px;
  border: 1px solid var(--warning-border);
  border-radius: var(--radius);
  background: var(--warning-soft);
  color: var(--warning-text);
}

.columns {
  display: flex;
  gap: 16px;
  padding: 22px;
  width: max-content;
  min-width: 100%;
  overflow: visible;
  align-items: start;
  scroll-padding: 22px;
}

.column {
  flex: 0 0 clamp(300px, 28vw, 360px);
  min-height: auto;
  background: var(--column-bg);
  border: 1px solid var(--column-border);
  border-radius: var(--radius);
  padding: 12px;
  box-shadow: var(--column-shadow);
}

body.edit-mode .column.selected {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent), 0 12px 28px rgba(15, 118, 110, 0.09);
}

.column-head {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.column-title-row {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  align-items: center;
  gap: 6px;
}

body.edit-mode .column-title-row {
  grid-template-columns: 36px auto minmax(0, 1fr);
}

.column-collapse-toggle {
  display: grid;
  place-items: center;
  width: 36px;
  min-width: 36px;
  height: 36px;
  min-height: 36px;
  padding: 0;
  font-size: 18px;
  line-height: 1;
}

.column-reorder {
  gap: 4px;
}

.reorder-column {
  display: grid;
  place-items: center;
  width: 36px;
  min-width: 36px;
  min-height: 36px;
  padding: 0;
  font-size: 16px;
  line-height: 1;
}

.column-title {
  min-width: 0;
  flex: 1;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text);
  font-weight: 800;
  padding: 8px;
}

body.edit-mode .column-title:hover,
body.edit-mode .column-title:focus {
  border-color: var(--line);
  background: var(--input-bg);
}

.remove-column {
  width: 40px;
  padding: 0;
  color: var(--danger);
}

.column-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.collapsed-column .column-tools,
.collapsed-column .card-list {
  display: none;
}

.collapsed-column .column-head {
  margin-bottom: 0;
}

.sort-due,
.column-view-toggle,
.done-toggle,
.create-card {
  white-space: nowrap;
  padding-inline: 10px;
}

.create-card {
  width: 42px;
  min-width: 42px;
  padding: 0;
  font-size: 24px;
  line-height: 1;
}

body.edit-mode .column-view-toggle,
body.edit-mode .done-toggle,
body.edit-mode .create-card,
body.edit-mode .sort-due {
  display: none;
}

.move-column-select,
.copy-column-select {
  max-width: 190px;
}

.column-view-toggle[data-view-mode="compact"],
.column-view-toggle[data-view-mode="details"],
.done-toggle[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.checkbox-label {
  display: grid !important;
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: center;
  gap: 10px !important;
  line-height: 1.35;
}

.checkbox-label input {
  width: 18px;
  height: 18px;
  min-height: 18px;
  padding: 0;
  margin: 0;
}

.checkbox-label span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.card-list {
  min-height: 160px;
  display: grid;
  align-items: start;
  grid-auto-rows: max-content;
  gap: 12px;
}

.card {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--card-shadow);
}

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

.card p {
  margin: 4px 0;
  color: var(--muted);
  font-size: 13px;
}

.labels {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.label {
  border-left: 4px solid var(--label);
  background: var(--label-bg);
  border-radius: 4px;
  padding: 3px 7px;
  font-size: 12px;
  color: var(--label-text);
}

.label-dots {
  display: none;
}

.label-dot {
  display: inline-block;
  flex: 0 0 auto;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--label);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--label) 55%, transparent);
}

.compact-label-legend {
  display: none;
}

.card-foot {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 10px;
  font-size: 12px;
}

.card-foot span {
  margin-right: auto;
  color: var(--muted);
  min-width: 120px;
}

.card-inline-details {
  display: none;
  margin-top: 10px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.card-inline-details p {
  color: var(--text);
  white-space: pre-wrap;
}

.card-inline-details dl {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 4px 10px;
  margin: 10px 0 0;
  font-size: 13px;
}

.card-inline-details dt {
  color: var(--muted);
  font-weight: 700;
}

.card-inline-details dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

.column.compact-column .card {
  padding: 10px 34px 10px 12px;
}

.column.compact-column .compact-label-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  margin: -2px 0 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
}

.compact-label-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  max-width: 100%;
}

.compact-label-legend-item span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.column.compact-column .card h3 {
  margin-bottom: 0;
  padding-right: 2px;
}

.column.compact-column .card p,
.column.compact-column .labels,
.column.compact-column .card-inline-details,
.column.compact-column .card-foot {
  display: none;
}

.column.compact-column .label-dots {
  position: absolute;
  top: 50%;
  right: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transform: translateY(-50%);
}

.column.details-column .card-inline-details {
  display: block;
}

.column.collapsed-column {
  grid-row: auto;
}

.filters h2 {
  font-size: 15px;
  margin: 18px 0 10px;
}

.filters label {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
  font-size: 14px;
}

.filters input,
.filters select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 9px 10px;
  background: var(--input-bg);
  color: var(--text);
}

.filters select {
  min-height: 94px;
}

.filters select:not([multiple]) {
  min-height: 0;
}

.hidden-list {
  display: grid;
  gap: 8px;
}

.hidden-list button {
  text-align: left;
  overflow-wrap: anywhere;
}

dialog {
  width: min(760px, calc(100vw - 28px));
  max-width: calc(100vw - 28px);
  max-height: calc(100dvh - 28px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 0;
  overflow: auto;
  background: var(--panel);
  color: var(--text);
}

dialog::backdrop {
  background: var(--dialog-backdrop);
}

.card-form,
.card-detail-view {
  display: grid;
  gap: 16px;
  padding: 22px;
  min-width: 0;
}

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

.dialog-head h2 {
  margin: 0;
}

.dialog-close {
  width: 42px;
  min-width: 42px;
  padding: 0;
}

.form-section {
  display: grid;
  gap: 12px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-soft);
  padding: 14px;
}

.form-section h3 {
  margin: 0;
  font-size: 15px;
}

.section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.compact-icon {
  width: 36px;
  min-width: 36px;
  min-height: 36px;
  padding: 0;
  font-size: 16px;
}

.form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-field-wide,
.form-grid .form-field:first-child:last-child {
  grid-column: 1 / -1;
}

.card-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.card-form .checkbox-label {
  grid-column: 1 / -1;
  justify-self: start;
}

.card-form input,
.card-form textarea,
.card-form select {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--input-bg);
  color: var(--text);
  padding: 10px 11px;
  font: inherit;
}

.card-form textarea {
  min-height: 96px;
  resize: vertical;
}

.card-form select[multiple] {
  min-height: 132px;
  padding: 6px;
}

.card-form select[multiple] option {
  border-radius: 6px;
  margin: 2px 0;
  padding: 8px 10px;
}

.card-form select[multiple] option:checked {
  background: linear-gradient(0deg, var(--accent), var(--accent));
  color: #fff;
  font-weight: 800;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 4px;
}

.dialog-actions button {
  min-width: 120px;
}

.detail-description {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(110px, max-content) minmax(0, 1fr);
  gap: 8px 16px;
  margin: 0;
}

.detail-grid dt {
  color: var(--muted);
  font-weight: 800;
}

.detail-grid dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

.detail-labels {
  min-height: 28px;
}

.editable-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.editable-label button {
  width: 22px;
  min-width: 22px;
  min-height: 22px;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  font-size: 18px;
  line-height: 1;
}

.label-add-button {
  justify-self: start;
}

.label-picker {
  display: grid;
  gap: 8px;
  padding-top: 2px;
}

.label-picker-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.label-picker button,
.label-create-form button {
  border-left: 4px solid var(--label);
  background: var(--label-bg);
  color: var(--label-text);
  min-height: 36px;
}

.label-picker .label-create-toggle {
  width: 40px;
  min-width: 40px;
  padding: 0;
  border-left-color: var(--accent);
  color: var(--accent);
  font-weight: 900;
}

.label-create-form {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(96px, max-content) max-content;
  gap: 8px;
  align-items: end;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--input-bg);
}

.label-create-form label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.label-create-form input {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-soft);
  color: var(--text);
  padding: 8px 10px;
  font: inherit;
}

.label-create-form input[type="color"] {
  min-width: 72px;
  padding: 4px;
}

.empty-detail {
  margin: 0;
  color: var(--muted);
}

.attachment-list {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.attachment-row,
.attachment-upload {
  display: flex;
  gap: 8px;
  align-items: center;
  min-width: 0;
}

.attachment-upload input {
  flex: 1 1 auto;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--input-bg);
  color: var(--text);
  padding: 9px 10px;
}

.attachment-preview {
  display: grid;
  gap: 8px;
  margin: 0;
  min-width: 0;
  max-width: 100%;
}

.attachment-preview img {
  display: block;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  max-height: 420px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--input-bg);
}

.attachment-preview figcaption {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.attachment-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex: 1 1 auto;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--input-bg);
  color: var(--text);
  padding: 10px 12px;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.attachment-link span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
}

.attachment-link,
.attachment-link span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.attachment-delete {
  flex: 0 0 auto;
  color: var(--danger);
}

.upload-status {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 1180px) {
  body {
    grid-template-columns: 230px minmax(0, 1fr) 310px;
  }

  body.drawer-closed {
    grid-template-columns: 230px minmax(0, 1fr);
  }

  .topbar {
    align-items: stretch;
  }

  .title-input {
    width: 100%;
  }

  .actions {
    justify-content: flex-start;
  }

  dialog {
    width: min(680px, calc(100vw - 20px));
    max-height: calc(100dvh - 20px);
  }
}

@media (max-width: 900px) {
  body {
    height: auto;
    min-height: 100vh;
    grid-template-columns: 1fr;
    overflow: visible;
  }

  .app {
    height: auto;
    overflow: visible;
  }

  .sidebar,
  .filters {
    min-height: auto;
    border: 0;
    border-bottom: 1px solid var(--line);
  }

  .sidebar {
    position: static;
    padding: 14px;
  }

  dialog {
    width: calc(100vw - 16px);
    max-width: calc(100vw - 16px);
    max-height: calc(100dvh - 16px);
  }

  .card-form,
  .card-detail-view {
    gap: 14px;
    padding: 16px;
  }

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

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

  .dialog-actions {
    flex-direction: column-reverse;
  }

  .dialog-actions button {
    width: 100%;
    min-height: 46px;
  }

  .attachment-row,
  .attachment-upload {
    align-items: stretch;
    flex-direction: column;
  }

  .attachment-preview img {
    max-height: 62dvh;
  }

  .attachment-link {
    display: grid;
    gap: 4px;
  }

  .attachment-link span {
    max-width: 100%;
  }

  .detail-grid {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .detail-grid dd {
    margin-bottom: 8px;
  }

  .brand {
    margin-bottom: 10px;
  }

  .sidebar .view-buttons {
    margin-bottom: 14px;
  }

  #newDashboard {
    width: 100%;
  }

  .dashboard-list {
    grid-auto-flow: column;
    grid-auto-columns: minmax(260px, min(360px, 82vw));
    overflow-x: auto;
    overscroll-behavior-x: contain;
    padding-bottom: 4px;
    scrollbar-width: thin;
  }

  .dashboard-list button {
    width: auto;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .dashboard-row {
    align-content: start;
  }

  body.drawer-closed {
    grid-template-columns: 1fr;
  }

  .filters {
    position: fixed;
    inset: 0 0 0 auto;
    z-index: 20;
    width: min(420px, 100vw);
    max-height: none;
    border-left: 1px solid var(--line);
    box-shadow: var(--shadow);
  }

  body.drawer-closed .filters {
    display: none;
  }

  .topbar {
    position: static;
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
    padding: 16px 14px;
  }

  .title-input {
    width: 100%;
    font-size: 23px;
  }

  .status {
    margin-left: 8px;
  }

  .actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sidebar .view-buttons {
    justify-self: stretch;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .columns {
    display: grid;
    grid-auto-flow: row;
    grid-template-columns: minmax(0, 1fr);
    grid-auto-columns: initial;
    gap: 14px;
    width: auto;
    min-width: 0;
    overflow-x: visible;
    padding: 14px;
  }

  .column {
    min-height: auto;
  }

  .notice {
    margin: 14px 14px 0;
  }
}

@media (max-width: 520px) {
  button {
    min-height: 44px;
    padding: 10px 11px;
  }

  .sidebar {
    padding: 12px;
  }

  .brand {
    font-size: 19px;
  }

  .dashboard-list {
    grid-auto-columns: minmax(240px, 82vw);
  }

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

  .card-foot {
    align-items: stretch;
  }

  .card-foot span,
  .card-foot button {
    width: 100%;
  }

  .card-foot span {
    min-width: 0;
  }

  .filters {
    width: 100vw;
    padding: 16px;
  }
}

body:not(.edit-mode) .actions {
  display: none;
  justify-content: flex-end;
}
