:root {
  color-scheme: light;
  --bg: #133653;
  --panel: #ffffff;
  --text: #17202a;
  --muted: #687381;
  --line: #d9e0e7;
  --accent: #2f6f73;
  --accent-dark: #24575a;
  --danger: #9b2d30;
  --danger-bg: #ffe9e9;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
}

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

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  padding: 10px 12px;
}

textarea {
  resize: vertical;
}

button {
  border: 0;
  border-radius: 6px;
  padding: 10px 14px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}

button:hover {
  background: var(--accent-dark);
}

button.secondary {
  background: #fff;
  color: #133653;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.14);
}

.logout-button {
  display: inline-grid;
  width: 44px;
  min-height: 44px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: 6px;
  background: #ffffff;
  color: #133653;
  padding: 0;
  box-shadow: none;
}

.logout-button:hover {
  background: #eef4f6;
  color: #133653;
}

.logout-button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.logout-button:hover svg {
  color: var(--accent-dark);
}

.logout-button:active {
  background: var(--accent);
  color: #ffffff;
}

.page {
  min-height: 100vh;
}

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

.error {
  color: var(--danger);
}

.hidden {
  display: none;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  line-height: 1.15;
}

h1 {
  font-size: clamp(1.8rem, 4vw, 2.5rem);
}

h2 {
  font-size: 1.25rem;
}

label {
  display: grid;
  gap: 6px;
  color: #6f7b87;
  font-size: 0.9rem;
  font-weight: 600;
}

.stack,
.login-form {
  display: grid;
  gap: 16px;
}

.instrument-form-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px 16px;
}

.musician-form-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 16px;
  align-items: stretch;
}

.action-form-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
  gap: 16px;
  align-items: stretch;
}

.musician-field-stack {
  display: grid;
  align-content: start;
  gap: 14px;
}

.musician-notes-field {
  min-height: 100%;
}

.musician-notes-field textarea {
  min-height: 100%;
}

.action-notes-field textarea {
  min-height: 180px;
}

.instrument-editor-shell {
  display: grid;
  gap: 0;
  align-content: stretch;
  grid-template-rows: minmax(0, 1fr);
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.detail-editor-shell {
  display: grid;
  gap: 0;
  align-content: stretch;
  grid-template-rows: auto minmax(0, 1fr);
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.detail-editor-shell .detail-card {
  border-top-left-radius: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  padding-top: 20px;
  align-self: stretch;
}

.instrument-editor-shell #instrument-form,
.instrument-editor-shell #musician-form,
.instrument-editor-shell #rental-start-form,
.instrument-editor-shell #rental-return-form,
.instrument-editor-shell #maintenance-form {
  gap: 0;
  grid-template-rows: auto minmax(0, 1fr);
  height: 100%;
  min-height: 0;
}

.tabbed-form-card {
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  height: 100%;
  min-height: 0;
  overflow: hidden;
  padding-top: 20px;
  position: relative;
  z-index: 1;
}

.card.tabbed-form-card {
  border-top-left-radius: 0;
}

.form-tabs {
  display: flex;
  align-items: end;
  gap: 8px;
  margin: 0 0 -1px;
  padding: 0;
  position: relative;
  z-index: 18;
}

.tab-button {
  min-height: 42px;
  border: 1px solid #c8d2d8;
  border-bottom-color: var(--line);
  border-radius: 8px 8px 0 0;
  background: #cfd9dd;
  color: #596773;
  box-shadow: none;
  padding: 0 18px;
}

.tab-button:hover {
  background: #cfd9dd;
  color: #596773;
}

.tab-button.is-active {
  position: relative;
  z-index: 2;
  border: 1px solid var(--line);
  border-bottom-color: #ffffff;
  background: #ffffff;
  color: var(--accent);
}

.tab-button.is-active:hover {
  background: #ffffff;
  color: var(--accent);
}

.form-tab-panel {
  display: none;
}

.form-tab-panel.is-active {
  display: grid;
  height: 100%;
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
}

.instrument-save-actions {
  position: sticky;
  bottom: 0;
  z-index: 19;
  justify-content: space-between;
  margin: 6px -4px 0;
  padding: 10px 4px 0;
  background: #ffffff;
}

.instrument-save-actions p {
  margin: 0;
}

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

.instrument-save-actions > .form-actions {
  justify-content: flex-end;
}

.attachment-tab-grid {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
  align-items: stretch;
}

.attachment-tab-grid .upload-panel {
  min-height: 100%;
  align-content: start;
}

.detail-current-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: start;
  align-content: start;
  gap: 14px;
  min-height: 0;
}

.detail-actions,
.detail-card-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.detail-card-footer {
  position: sticky;
  bottom: 0;
  z-index: 3;
  margin: 6px -4px 0;
  padding: 10px 4px 0;
  background: #ffffff;
}

.compact-back-button {
  min-width: 84px;
  min-height: 34px;
  padding: 7px 12px;
}

.detail-actions {
  align-items: center;
}

.detail-actions .icon-action,
.detail-actions .secondary-action {
  height: 42px;
  min-height: 42px;
}

.detail-actions .secondary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding-top: 0;
  padding-bottom: 0;
}

.attachment-upload-button {
  justify-self: end;
  min-width: 110px;
}

.form-span-2,
.instrument-form-grid #form-message {
  grid-column: 1 / -1;
}

.form-row-2,
.form-row-3 {
  display: grid;
  gap: 12px;
}

.form-row-2 {
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
}

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

.compact-form-head {
  justify-content: start;
  margin-bottom: 14px;
}

.login-wrapper {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.login-box {
  display: grid;
  grid-template-columns: minmax(170px, 250px) minmax(260px, 340px);
  align-items: center;
  gap: 42px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  background: #1652aa;
  padding: 34px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.34);
}

.login-logo {
  display: grid;
  place-items: center;
}

.login-logo img {
  width: min(250px, 38vw);
  height: auto;
  display: block;
  border-radius: 6px;
}

.login-form input {
  min-height: 46px;
  border-color: rgba(255, 255, 255, 0.38);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12);
}

.login-form button {
  min-height: 46px;
  background: #ffffff;
  color: #133653;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.14);
}

.login-form button:hover {
  background: #e9eef2;
}

.compact-alert {
  margin: 0;
  padding: 10px 12px;
  border-radius: 6px;
  background: var(--danger-bg);
}

.app-shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 18px 0 28px;
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto minmax(360px, 2fr) minmax(180px, 1fr);
  gap: 20px;
}

.app-shell:has([data-fixed-editor]),
.app-shell.is-fixed-editor {
  height: 100vh;
  min-height: 0;
  overflow: hidden;
  grid-template-rows: auto minmax(0, 1fr);
  padding-bottom: 12px;
}

.app-shell.home-shell {
  height: 100vh;
  min-height: 0;
  overflow: hidden;
  grid-template-rows: auto minmax(0, 2fr) minmax(0, 1fr);
  padding-bottom: 12px;
}

.brand-panel,
.card,
.stat-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(23, 32, 42, 0.06);
}

.topbar,
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  padding: 4px 0 2px;
  background: var(--bg);
}

.topbar-title {
  justify-self: start;
  color: #ffffff;
  font-size: 1.75rem;
  font-weight: 750;
}

.topbar-title:hover {
  color: #ffffff;
}

.menu-shell {
  position: relative;
}

.menu-button {
  display: inline-grid;
  width: 44px;
  min-height: 44px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.65);
  background: #ffffff;
  color: #133653;
  padding: 0;
}

.menu-button:hover {
  background: #ffffff;
  color: #133653;
}

.menu-button svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.app-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 30;
  display: grid;
  min-width: 260px;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.22);
}

.app-menu.hidden {
  display: none;
}

.app-menu button {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: flex-start;
  background: #ffffff;
  color: var(--text);
  text-align: left;
}

.app-menu button:hover {
  background: #eef4f6;
  color: var(--text);
}

.app-menu svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.nav-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  border: 1px solid rgba(255, 255, 255, 0.65);
  background: #ffffff;
  color: #133653;
  padding: 0 12px;
  box-shadow: none;
}

.nav-button:hover {
  background: #eef4f6;
  color: #133653;
}

.nav-button svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.brand-button {
  padding: 0;
  border-radius: 0;
  background: transparent;
  color: #ffffff;
  text-align: left;
}

.brand-button:hover {
  background: transparent;
  color: #ffffff;
}

.topbar-logo {
  width: 62px;
  height: 62px;
  object-fit: cover;
  border-radius: 6px;
  flex: 0 0 auto;
}

.topbar h1 {
  font-size: 1.75rem;
  color: #ffffff;
}

.brand-panel {
  padding: 24px;
  display: grid;
  grid-template-columns: 1.3fr auto;
  align-items: center;
  gap: 20px;
}

.brand-panel-logo {
  width: min(170px, 24vw);
  height: auto;
  display: block;
  border-radius: 6px;
}

.stats-grid,
.grid {
  display: grid;
  gap: 20px;
}

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

.stat-card {
  padding: 20px;
}

.stat-card span {
  display: block;
  color: var(--muted);
  font-size: 0.85rem;
}

.stat-card strong {
  display: block;
  margin-top: 8px;
  font-size: 1.9rem;
}

.grid {
  grid-template-columns: 1.15fr 1fr;
  align-items: start;
}

.home-columns {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: stretch;
  gap: 20px;
  min-height: 0;
}

.home-shell .home-columns,
.home-shell .maintenance-card {
  min-height: 0;
}

.master-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.85fr);
  align-items: start;
  gap: 20px;
  min-height: 0;
}

.master-page {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 14px;
  min-height: min(720px, calc(100vh - 130px));
}

.master-list-card,
.master-form-card {
  display: grid;
  gap: 16px;
}

.master-list-card {
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
}

.master-list-card .list {
  overflow: auto;
  min-height: 0;
  padding-right: 4px;
}

.card {
  padding: 24px;
}

.active-rentals-card,
.available-card,
.maintenance-card {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 16px;
  min-height: 0;
}

.active-rentals-list,
.available-list,
.maintenance-list {
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 0;
  overflow: auto;
  padding-right: 4px;
}

.rental-item,
.maintenance-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafb;
  color: var(--text);
  text-align: left;
}

.rental-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

.rental-main:hover,
.rental-main:focus {
  background: transparent;
}

.maintenance-item:hover {
  background: #edf6f7;
}

.rental-item strong,
.rental-item span,
.rental-item small,
.maintenance-item strong,
.maintenance-item span,
.maintenance-item small,
.available-main strong,
.available-main span,
.available-main small {
  display: block;
}

.rental-item span,
.rental-item small,
.maintenance-item span,
.maintenance-item small {
  margin-top: 4px;
}

.rental-item span,
.maintenance-item span {
  color: var(--accent);
  font-weight: 750;
}

.rental-item small,
.maintenance-item small {
  color: var(--muted);
}

.rental-person,
.maintenance-meta {
  min-width: 170px;
  text-align: right;
}

.available-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafb;
}

.available-main {
  padding: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.available-main:hover {
  background: transparent;
  color: var(--text);
}

.available-main span {
  margin-top: 4px;
  color: var(--accent);
  font-weight: 750;
}

.available-main small {
  margin-top: 4px;
  color: var(--muted);
}

.available-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.overview-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafb;
}

.overview-main {
  display: grid;
  padding: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.overview-main:hover {
  background: transparent;
  color: var(--text);
}

.overview-main strong,
.overview-main span {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.overview-main span {
  color: var(--accent);
  font-weight: 750;
}

.instrument-row .overview-main {
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 14px;
  align-items: center;
}

.instrument-row {
  grid-template-columns: minmax(0, 1.1fr) minmax(150px, 0.9fr) auto;
  gap: 10px;
  padding: 8px 10px;
}

.instrument-main {
  min-height: 32px;
}

.instrument-status-text {
  min-width: 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
  text-align: left;
}

.status-text {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-text.is-rented {
  color: var(--accent);
}

.status-text.is-maintenance {
  color: #b15c00;
}

.status-text.is-free {
  color: var(--muted);
}

.musician-row .overview-main {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 0.9fr) minmax(0, 1fr);
  gap: 14px;
  align-items: center;
}

.bottom-create-button {
  justify-self: end;
  min-height: 36px;
  width: auto;
  padding: 0 14px;
  background: #ffffff;
  color: #133653;
  border: 1px solid rgba(255, 255, 255, 0.7);
}

.bottom-create-button:hover {
  background: #eef4f6;
  color: #133653;
}

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

.status-button {
  display: inline-grid;
  width: 36px;
  min-height: 36px;
  padding: 0;
  place-items: center;
  border-radius: 6px;
}

span.status-button {
  color: #ffffff;
}

.status-button svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.rental-status {
  background: var(--accent);
  color: #ffffff;
}

.rental-status:hover {
  background: var(--accent-dark);
}

.maintenance-status {
  background: #d97824;
  color: #ffffff;
}

.maintenance-status:hover {
  background: #b95f16;
}

.maintenance-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  padding: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.maintenance-main:hover {
  background: transparent;
  color: var(--text);
}

.inline-status {
  display: inline-grid;
  width: 24px;
  min-height: 24px;
  margin-left: 6px;
  vertical-align: middle;
  place-items: center;
  border-radius: 6px;
  color: #ffffff;
}

.inline-status svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-action {
  display: inline-grid;
  width: 42px;
  min-height: 42px;
  padding: 0;
  place-items: center;
  border-radius: 6px;
  text-decoration: none;
}

.icon-action svg {
  width: 25px;
  height: 25px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.secondary-action {
  background: #e8eff1;
  color: #133653;
}

.secondary-action:hover {
  background: #d6e2e5;
  color: #133653;
}

.maintenance-action {
  background: #d97824;
  color: #ffffff;
}

.maintenance-action:hover {
  background: #b95f16;
  color: #ffffff;
}

.danger-action {
  background: var(--danger);
}

.danger-action:hover {
  background: #7e2225;
}

.detail-card {
  display: grid;
  gap: 18px;
}

.detail-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 14px;
}

.back-button {
  min-width: 92px;
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
}

.detail-panel {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafb;
}

.detail-panel h3 {
  margin: 0;
  font-size: 1rem;
}

.current-rental-panel {
  align-content: start;
  grid-column: 1 / -1;
}

.current-rental-grid {
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) minmax(0, 1.2fr);
  gap: 18px;
  align-items: start;
  min-width: 0;
}

.current-rental-data {
  display: grid;
  align-content: start;
  gap: 14px;
  min-width: 0;
}

.rental-head-actions {
  justify-content: flex-end;
}

.detail-side-stack {
  display: grid;
  align-content: start;
  gap: 14px;
  min-height: 0;
  min-width: 0;
}

.detail-panel-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.detail-subpanel {
  display: grid;
  align-content: start;
  gap: 12px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
}

.detail-subpanel h4 {
  margin: 0;
  color: var(--text);
  font-size: 0.95rem;
}

.rental-detail-panel .attachment-list {
  margin-top: 0;
}

.rental-attachments-block {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.rental-attachments-block h4 {
  margin: 0;
  font-size: 0.95rem;
}

.secondary-icon-action {
  width: 36px;
  min-height: 36px;
  background: #e8eff1;
  color: #133653;
}

.secondary-icon-action:hover {
  background: #d6e2e5;
  color: #133653;
}

.secondary-icon-action svg {
  width: 21px;
  height: 21px;
}

.print-action {
  background: #315c72;
  color: #ffffff;
}

.print-action:hover {
  background: #264b5e;
}

.detail-editor-shell .detail-card.tabbed-form-card {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  align-self: stretch;
  height: 100%;
  min-height: 0;
  gap: 0;
  padding: 20px 24px 16px;
}

.instrument-editor-shell .master-form-card.tabbed-form-card {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  align-self: stretch;
  height: 100%;
  min-height: 0;
  gap: 0;
  padding: 20px 24px 16px;
}

.detail-editor-shell .form-tab-panel.is-active {
  align-content: start;
  height: 100%;
  min-height: 0;
}

.instrument-editor-shell .form-tab-panel.is-active {
  align-content: start;
  height: 100%;
  min-height: 0;
}

.data-list {
  display: grid;
  gap: 10px;
  margin: 0;
}

.data-list div {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr);
  gap: 12px;
}

.data-list dt {
  color: var(--muted);
  font-weight: 700;
}

.data-list dd {
  margin: 0;
}

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

.history-item {
  display: grid;
  gap: 3px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.history-item span,
.history-item small {
  color: var(--muted);
}

.empty-state {
  margin: 0;
  padding: 16px;
  border: 1px dashed var(--line);
  border-radius: 6px;
  background: #f8fafb;
}

.search {
  margin: 16px 0;
}

.list {
  display: grid;
  gap: 12px;
}

.list-item {
  text-align: left;
  background: #fff;
  color: var(--text);
  border: 1px solid var(--line);
}

.list-item:hover {
  background: #f6f9fb;
}

.list-item.is-inactive {
  opacity: 0.62;
}

.list-item span,
.list-item small {
  display: block;
  margin-top: 4px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
}

.checkbox-label input {
  width: auto;
}

.form-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.upload-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafb;
}

.upload-panel strong,
.upload-panel span {
  display: block;
}

.upload-panel span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 500;
}

.attachment-manager {
  display: grid;
  align-content: start;
  gap: 14px;
  min-height: 0;
}

.attachment-manager-form {
  display: grid;
  grid-template-columns: minmax(120px, 0.7fr) minmax(180px, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.attachment-manager-form input[type="file"] {
  grid-column: 1 / 3;
}

.attachment-manager-form .attachment-upload-button {
  grid-column: 3;
}

.attachment-preview-grid,
.attachment-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
}

.attachment-entry {
  position: relative;
  min-width: 0;
}

.attachment-preview-item,
.attachment-link {
  display: grid;
  gap: 6px;
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
  text-decoration: none;
}

.attachment-preview-item img,
.attachment-link img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 4px;
  background: #eef4f6;
}

.attachment-preview-item figcaption,
.attachment-preview-item span,
.attachment-link span,
.attachment-link small {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-link small {
  font-weight: 500;
}

.attachment-preview-item {
  margin: 0;
}

.attachment-delete-button {
  position: absolute;
  top: -7px;
  right: -7px;
  display: inline-grid;
  width: 26px;
  min-height: 26px;
  padding: 0;
  place-items: center;
  border: 2px solid #ffffff;
  border-radius: 999px;
  background: var(--danger);
  color: #ffffff;
  box-shadow: 0 6px 16px rgba(23, 32, 42, 0.18);
}

.attachment-delete-button:hover {
  background: #7e2225;
}

.attachment-delete-button svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.file-preview,
.attachment-link.is-file {
  align-items: center;
  grid-template-columns: auto minmax(0, 1fr);
}

.file-preview svg,
.attachment-link svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  color: var(--accent);
}

.attachment-list.is-compact {
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  margin-top: 8px;
}

@media (max-width: 760px) {
  .app-shell {
    width: min(100% - 20px, 1120px);
    padding: 12px 0 20px;
    min-height: 0;
    grid-template-rows: none;
  }

  .login-wrapper {
    padding: 22px;
  }

  .login-box {
    width: min(100%, 360px);
    grid-template-columns: 1fr;
    gap: 26px;
    padding: 26px;
  }

  .login-logo img {
    width: min(210px, 68vw);
  }

  .section-head,
  .topbar-brand,
  .brand-panel {
    align-items: start;
  }

  .brand-panel {
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .topbar {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
  }

  .nav-button {
    justify-content: center;
    min-height: 38px;
    padding: 0 9px;
    font-size: 0.86rem;
  }

  .logout-button {
    justify-self: end;
    grid-column: 3;
    grid-row: 1;
  }

  .nav-button svg {
    width: 17px;
    height: 17px;
  }

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

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

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

  .musician-notes-field textarea {
    min-height: 160px;
  }

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

  .attachment-manager-form input[type="file"],
  .attachment-manager-form .attachment-upload-button {
    grid-column: auto;
  }

  .instrument-editor-shell {
    height: 100%;
    min-height: 0;
  }

  .form-tabs {
  }

  .tab-button {
    flex: 1;
    min-height: 40px;
    padding: 8px;
  }

  .card.tabbed-form-card {
    border-top-right-radius: 0;
  }

  .form-span-2,
  .instrument-form-grid #form-message {
    grid-column: auto;
  }

  .form-row-2,
  .form-row-3,
  .attachment-tab-grid,
  .detail-current-grid,
  .current-rental-grid {
    grid-template-columns: 1fr;
  }

  .current-rental-panel {
    grid-column: auto;
  }

  .topbar-title {
    font-size: 1.25rem;
  }

  .topbar-logo {
    width: 48px;
    height: 48px;
  }

  .brand-panel {
    gap: 16px;
  }

  .stats-grid,
  .grid,
  .home-columns,
  .master-layout {
    grid-template-columns: 1fr;
  }

  .master-list-card {
    min-height: 0;
  }

  .active-rentals-card,
  .available-card,
  .maintenance-card {
    grid-template-rows: none;
  }

  .active-rentals-list,
  .available-list,
  .maintenance-list {
    overflow: auto;
  }

  .rental-item,
  .maintenance-item {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .rental-person,
  .maintenance-meta {
    min-width: 0;
    text-align: left;
  }

  .available-item,
  .overview-item,
  .detail-grid,
  .detail-head {
    grid-template-columns: 1fr;
  }

  .instrument-row .overview-main {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .instrument-row {
    grid-template-columns: 1fr;
    gap: 6px;
    padding: 9px 10px;
  }

  .instrument-status-text {
    font-size: 0.86rem;
  }

  .musician-row .overview-main {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    row-gap: 6px;
  }

  .maintenance-main {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .rental-item,
  .rental-main {
    grid-template-columns: 1fr;
    gap: 8px;
  }

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

  .available-actions {
    display: flex;
    justify-content: stretch;
  }

  .available-actions .icon-action {
    width: 46px;
    min-height: 46px;
  }

  .data-list div {
    grid-template-columns: 1fr;
    gap: 3px;
  }
}
