:root {
  color-scheme: light dark;
  --bg: linear-gradient(135deg, #f5f7fa, #c3cfe2);
  --bg-dark: linear-gradient(135deg, #1f1f28, #151922);
  --surface: rgba(255, 255, 255, 0.88);
  --surface-dark: rgba(21, 25, 34, 0.9);
  --text: #111c2e;
  --text-muted: rgba(17, 28, 46, 0.68);
  --text-primary: #0f4a63;
  --text-dark: #f7f9fc;
  --accent: #0f7a9d;
  --accent-dark: #7cd8ff;
  --accent-rgb: 15, 122, 157;
  --accent-soft: rgba(var(--accent-rgb), 0.12);
  --accent-strong: rgba(var(--accent-rgb), 0.2);
  --warning: #d97706;
  --danger: #d1435f;
  --radius-lg: 24px;
  --radius-md: 18px;
  --shadow: 0 25px 55px rgba(31, 35, 53, 0.2);
  --shadow-strong: 0 35px 65px rgba(var(--accent-rgb), 0.35);
  font-family: "Segoe UI", "Roboto", "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  body[data-theme="default"] {
    background: var(--bg-dark);
    background-image: linear-gradient(rgba(10, 14, 21, 0.78), rgba(10, 14, 21, 0.78)), url("assets/workshop-blue-overall.jpg");
    color: var(--text-dark);
  }

  body[data-theme="default"] .panel,
  body[data-theme="default"] .card,
  body[data-theme="default"] .toolbar,
  body[data-theme="default"] .form-section,
  body[data-theme="default"] .list-item {
    background: var(--surface-dark);
    box-shadow: 0 22px 48px rgba(0, 0, 0, 0.45);
  }

  body[data-theme="default"] .muted {
    color: rgba(247, 249, 252, 0.72);
  }

  body[data-theme="default"] .filter-bar label,
  body[data-theme="default"] .filter-bar legend {
    color: rgba(247, 249, 252, 0.8);
  }

  body[data-theme="default"] .badge,
  body[data-theme="default"] .pill {
    background: rgba(124, 216, 255, 0.16);
    color: var(--accent-dark);
  }

  body[data-theme="default"] .status-loaned {
    background: rgba(209, 67, 82, 0.18);
    color: #ff8a9d;
  }

  body[data-theme="default"] .color-chip {
    border-color: rgba(255, 255, 255, 0.25);
  }

  body[data-theme="default"] .tool-photo.is-placeholder {
    border-color: rgba(124, 216, 255, 0.28);
  }

  body[data-theme="default"] .checkbox-pill {
    background: rgba(124, 216, 255, 0.18);
    color: var(--accent-dark);
  }

  body[data-theme="default"] .storage-slot {
    background: rgba(32, 38, 52, 0.7);
    border-color: rgba(124, 216, 255, 0.18);
  }

  body[data-theme="default"]::before {
    background: rgba(8, 12, 20, 0.58);
  }
}

body.theme-default {
  color-scheme: light;
  --bg: linear-gradient(135deg, #f5f7fa, #c3cfe2);
  --surface: rgba(255, 255, 255, 0.88);
  --text: #111c2e;
  --text-muted: rgba(17, 28, 46, 0.68);
  --text-primary: #0f4a63;
  --accent: #0f7a9d;
  --accent-rgb: 15, 122, 157;
  --warning: #d97706;
  --danger: #d1435f;
  --radius-lg: 24px;
  --radius-md: 18px;
  --shadow: 0 25px 55px rgba(31, 35, 53, 0.2);
  --shadow-strong: 0 35px 65px rgba(var(--accent-rgb), 0.35);
  font-family: "Segoe UI", "Roboto", "Helvetica Neue", Arial, sans-serif;
}

body.theme-sunset {
  color-scheme: light;
  --bg: linear-gradient(135deg, #ffecd2, #fcb69f);
  --surface: rgba(255, 255, 255, 0.9);
  --text: #432c2e;
  --text-muted: rgba(67, 44, 46, 0.72);
  --text-primary: #d65a31;
  --accent: #ff7043;
  --accent-rgb: 255, 112, 67;
  --warning: #f6ad55;
  --danger: #e53e3e;
  --radius-lg: 22px;
  --radius-md: 16px;
  --shadow: 0 26px 52px rgba(222, 84, 63, 0.24);
  --shadow-strong: 0 36px 64px rgba(222, 84, 63, 0.28);
  font-family: "Poppins", "Segoe UI", "Roboto", sans-serif;
  background-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%20width%3D%27320%27%20height%3D%27320%27%20viewBox%3D%270%200%20320%20320%27%3E%3Cdefs%3E%3CradialGradient%20id%3D%27g1%27%20cx%3D%270.3%27%20cy%3D%270.3%27%20r%3D%270.5%27%3E%3Cstop%20offset%3D%270%25%27%20stop-color%3D%27%23ffb199%27%20stop-opacity%3D%270.35%27/%3E%3Cstop%20offset%3D%27100%25%27%20stop-color%3D%27%23ffb199%27%20stop-opacity%3D%270%27/%3E%3C/radialGradient%3E%3CradialGradient%20id%3D%27g2%27%20cx%3D%270.7%27%20cy%3D%270.7%27%20r%3D%270.6%27%3E%3Cstop%20offset%3D%270%25%27%20stop-color%3D%27%23ffd4a3%27%20stop-opacity%3D%270.28%27/%3E%3Cstop%20offset%3D%27100%25%27%20stop-color%3D%27%23ffd4a3%27%20stop-opacity%3D%270%27/%3E%3C/radialGradient%3E%3C/defs%3E%3Crect%20width%3D%27320%27%20height%3D%27320%27%20fill%3D%27none%27/%3E%3Ccircle%20cx%3D%2790%27%20cy%3D%27110%27%20r%3D%2790%27%20fill%3D%27url%28%23g1%29%27/%3E%3Ccircle%20cx%3D%27250%27%20cy%3D%27230%27%20r%3D%27110%27%20fill%3D%27url%28%23g2%29%27/%3E%3C/svg%3E"), linear-gradient(rgba(255, 244, 234, 0.85), rgba(252, 182, 159, 0.78));
  background-size: 520px, cover;
  background-repeat: repeat, no-repeat;
  background-position: center, center;
  background-attachment: fixed, fixed;
}

body.theme-sunset::before {
  background: rgba(255, 179, 143, 0.18);
}

body.theme-forest {
  color-scheme: light;
  --bg: linear-gradient(135deg, #d9f4c7, #89d8a5);
  --surface: rgba(250, 255, 246, 0.9);
  --text: #0f2e1f;
  --text-muted: rgba(15, 46, 31, 0.68);
  --text-primary: #2f855a;
  --accent: #2f855a;
  --accent-rgb: 47, 133, 90;
  --warning: #b7791f;
  --danger: #c05621;
  --radius-lg: 26px;
  --radius-md: 18px;
  --shadow: 0 24px 52px rgba(47, 133, 90, 0.22);
  --shadow-strong: 0 34px 62px rgba(47, 133, 90, 0.26);
  font-family: "Montserrat", "Segoe UI", "Roboto", sans-serif;
  background-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%20width%3D%27320%27%20height%3D%27320%27%20viewBox%3D%270%200%20320%20320%27%3E%3Cdefs%3E%3CradialGradient%20id%3D%27g1%27%20cx%3D%270.35%27%20cy%3D%270.25%27%20r%3D%270.45%27%3E%3Cstop%20offset%3D%270%25%27%20stop-color%3D%27%239fd8b5%27%20stop-opacity%3D%270.35%27/%3E%3Cstop%20offset%3D%27100%25%27%20stop-color%3D%27%239fd8b5%27%20stop-opacity%3D%270%27/%3E%3C/radialGradient%3E%3CradialGradient%20id%3D%27g2%27%20cx%3D%270.75%27%20cy%3D%270.75%27%20r%3D%270.55%27%3E%3Cstop%20offset%3D%270%25%27%20stop-color%3D%27%236dbc8c%27%20stop-opacity%3D%270.28%27/%3E%3Cstop%20offset%3D%27100%25%27%20stop-color%3D%27%236dbc8c%27%20stop-opacity%3D%270%27/%3E%3C/radialGradient%3E%3C/defs%3E%3Crect%20width%3D%27320%27%20height%3D%27320%27%20fill%3D%27none%27/%3E%3Ccircle%20cx%3D%2780%27%20cy%3D%2780%27%20r%3D%27100%27%20fill%3D%27url%28%23g1%29%27/%3E%3Ccircle%20cx%3D%27230%27%20cy%3D%27240%27%20r%3D%27120%27%20fill%3D%27url%28%23g2%29%27/%3E%3C/svg%3E"), linear-gradient(rgba(217, 244, 199, 0.85), rgba(137, 216, 165, 0.78));
  background-size: 520px, cover;
  background-repeat: repeat, no-repeat;
  background-position: center, center;
  background-attachment: fixed, fixed;
}

body.theme-forest::before {
  background: rgba(47, 133, 90, 0.16);
}

body.theme-midnight {
  color-scheme: dark;
  --bg: linear-gradient(135deg, #1f1f3d, #0b1629);
  --surface: rgba(17, 24, 39, 0.88);
  --text: #e5e7ff;
  --text-muted: rgba(197, 203, 255, 0.72);
  --text-primary: #7dd3fc;
  --accent: #38bdf8;
  --accent-rgb: 56, 189, 248;
  --warning: #fbbf24;
  --danger: #f87171;
  --radius-lg: 20px;
  --radius-md: 16px;
  --shadow: 0 30px 60px rgba(56, 189, 248, 0.25);
  --shadow-strong: 0 40px 70px rgba(14, 116, 144, 0.35);
  font-family: "Inter", "Segoe UI", "Roboto", sans-serif;
  background-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%20width%3D%27320%27%20height%3D%27320%27%20viewBox%3D%270%200%20320%20320%27%3E%3Cdefs%3E%3CradialGradient%20id%3D%27g1%27%20cx%3D%270.25%27%20cy%3D%270.2%27%20r%3D%270.5%27%3E%3Cstop%20offset%3D%270%25%27%20stop-color%3D%27%234f46e5%27%20stop-opacity%3D%270.32%27/%3E%3Cstop%20offset%3D%27100%25%27%20stop-color%3D%27%234f46e5%27%20stop-opacity%3D%270%27/%3E%3C/radialGradient%3E%3CradialGradient%20id%3D%27g2%27%20cx%3D%270.75%27%20cy%3D%270.8%27%20r%3D%270.6%27%3E%3Cstop%20offset%3D%270%25%27%20stop-color%3D%27%2338bdf8%27%20stop-opacity%3D%270.28%27/%3E%3Cstop%20offset%3D%27100%25%27%20stop-color%3D%27%2338bdf8%27%20stop-opacity%3D%270%27/%3E%3C/radialGradient%3E%3CradialGradient%20id%3D%27g3%27%20cx%3D%270.5%27%20cy%3D%270.5%27%20r%3D%270.4%27%3E%3Cstop%20offset%3D%270%25%27%20stop-color%3D%27%231d4ed8%27%20stop-opacity%3D%270.25%27/%3E%3Cstop%20offset%3D%27100%25%27%20stop-color%3D%27%231d4ed8%27%20stop-opacity%3D%270%27/%3E%3C/radialGradient%3E%3C/defs%3E%3Crect%20width%3D%27320%27%20height%3D%27320%27%20fill%3D%27none%27/%3E%3Ccircle%20cx%3D%2770%27%20cy%3D%2790%27%20r%3D%27100%27%20fill%3D%27url%28%23g1%29%27/%3E%3Ccircle%20cx%3D%27250%27%20cy%3D%27240%27%20r%3D%27120%27%20fill%3D%27url%28%23g2%29%27/%3E%3Ccircle%20cx%3D%27160%27%20cy%3D%27170%27%20r%3D%2790%27%20fill%3D%27url%28%23g3%29%27/%3E%3C/svg%3E"), linear-gradient(rgba(15, 23, 42, 0.92), rgba(6, 8, 20, 0.92));
  background-size: 520px, cover;
  background-repeat: repeat, no-repeat;
  background-position: center, center;
  background-attachment: fixed, fixed;
}

body.theme-midnight::before {
  background: rgba(8, 12, 24, 0.55);
}

body.theme-retro {
  color-scheme: light;
  --bg: linear-gradient(135deg, #fdfcfb, #e2d1c3);
  --surface: rgba(255, 248, 240, 0.92);
  --text: #3b2f2f;
  --text-muted: rgba(59, 47, 47, 0.68);
  --text-primary: #dd6b20;
  --accent: #ed8936;
  --accent-rgb: 237, 137, 54;
  --warning: #f6ad55;
  --danger: #f56565;
  --radius-lg: 28px;
  --radius-md: 20px;
  --shadow: 0 26px 54px rgba(237, 137, 54, 0.22);
  --shadow-strong: 0 36px 64px rgba(214, 158, 104, 0.28);
  font-family: "Raleway", "Segoe UI", "Roboto", sans-serif;
  background-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%20width%3D%27320%27%20height%3D%27320%27%20viewBox%3D%270%200%20320%20320%27%3E%3Cdefs%3E%3CradialGradient%20id%3D%27g1%27%20cx%3D%270.3%27%20cy%3D%270.3%27%20r%3D%270.5%27%3E%3Cstop%20offset%3D%270%25%27%20stop-color%3D%27%23f6d8ac%27%20stop-opacity%3D%270.35%27/%3E%3Cstop%20offset%3D%27100%25%27%20stop-color%3D%27%23f6d8ac%27%20stop-opacity%3D%270%27/%3E%3C/radialGradient%3E%3CradialGradient%20id%3D%27g2%27%20cx%3D%270.7%27%20cy%3D%270.7%27%20r%3D%270.55%27%3E%3Cstop%20offset%3D%270%25%27%20stop-color%3D%27%23f2b38f%27%20stop-opacity%3D%270.28%27/%3E%3Cstop%20offset%3D%27100%25%27%20stop-color%3D%27%23f2b38f%27%20stop-opacity%3D%270%27/%3E%3C/radialGradient%3E%3C/defs%3E%3Crect%20width%3D%27320%27%20height%3D%27320%27%20fill%3D%27none%27/%3E%3Ccircle%20cx%3D%2790%27%20cy%3D%27120%27%20r%3D%27110%27%20fill%3D%27url%28%23g1%29%27/%3E%3Ccircle%20cx%3D%27240%27%20cy%3D%27230%27%20r%3D%27130%27%20fill%3D%27url%28%23g2%29%27/%3E%3C/svg%3E"), linear-gradient(rgba(253, 252, 251, 0.92), rgba(226, 209, 195, 0.8));
  background-size: 520px, cover;
  background-repeat: repeat, no-repeat;
  background-position: center, center;
  background-attachment: fixed, fixed;
}

body.theme-retro::before {
  background: rgba(237, 137, 54, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  background-image: linear-gradient(rgba(255, 255, 255, 0.78), rgba(255, 255, 255, 0.78)), url("assets/workshop-blue-overall.jpg");
  background-size: cover, cover;
  background-position: center, center;
  background-repeat: no-repeat, no-repeat;
  background-attachment: fixed, fixed;
  color: var(--text);
  display: flex;
  justify-content: center;
  padding: clamp(16px, 4vw, 48px);
  position: relative;
  isolation: isolate;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.08);
  pointer-events: none;
  z-index: -1;
}

.app-shell {
  width: min(1100px, 100%);
  display: grid;
  gap: 24px;
}

.topbar {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.topbar-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.branding {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.brand-copy h1 {
  margin: 0;
  font-size: clamp(1.8rem, 4vw, 2.6rem);
}

.brand-copy .brand-subtitle {
  margin: 0;
  font-size: clamp(1.2rem, 3vw, 1.6rem);
  color: var(--text-primary, inherit);
  font-weight: 600;
}

.brand-copy p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.brand-copy .brand-name {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary, inherit);
}

.brand-copy .brand-tagline {
  font-size: clamp(1.1rem, 3vw, 1.6rem);
  font-weight: 600;
  color: var(--accent);
}

.logo-lockup {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}

.logo-lockup:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 6px;
  border-radius: 24px;
}

.logo-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: clamp(52px, 8vw, 68px);
  height: clamp(52px, 8vw, 68px);
  border-radius: 18px;
  background: radial-gradient(circle at 50% 35%, rgba(255, 235, 59, 0.4), transparent 70%);
  box-shadow: 0 12px 28px rgba(255, 213, 67, 0.35);
}

.logo-mark svg {
  width: 70%;
  height: 70%;
  filter: drop-shadow(0 4px 8px rgba(255, 202, 40, 0.35));
}

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

.field-label .label-title span:first-child {
  flex: 1;
}

.field-label .label-controls {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.field-label .label-controls .field-icon {
  margin: 0;
}

.field-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  background: rgba(var(--accent-rgb), 0.14);
  color: var(--accent);
  font-size: 1.1rem;
  box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), 0.18);
}

.tab-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.tab-nav button {
  border: none;
  background: rgba(var(--accent-rgb), 0.12);
  color: var(--accent);
  font-weight: 600;
  padding: 12px 18px;
  border-radius: 999px;
  font-size: 0.95rem;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.tab-nav button:hover,
.tab-nav button:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 12px 26px rgba(var(--accent-rgb), 0.24);
  outline: none;
}

.tab-nav button[aria-current="page"] {
  background: var(--accent);
  color: white;
  box-shadow: var(--shadow-strong);
}

.panels {
  display: grid;
  gap: 24px;
}

.panel {
  display: none;
  background: var(--surface);
  backdrop-filter: blur(18px);
  border-radius: var(--radius-lg);
  padding: clamp(24px, 4vw, 40px);
  box-shadow: var(--shadow);
  gap: 24px;
}

.panel.active {
  display: grid;
}

.panel header {
  display: grid;
  gap: 8px;
}

.panel header h2 {
  margin: 0;
  font-size: clamp(1.5rem, 3vw, 2rem);
}

.panel header p {
  margin: 0;
  color: var(--text-muted);
}

.dashboard-grid {
  display: grid;
  gap: 18px;
}

@media (min-width: 720px) {
  .dashboard-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  }
}

.card {
  border-radius: var(--radius-md);
  padding: 18px 22px;
  display: grid;
  gap: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.card h3 {
  margin: 0;
  font-size: 1.05rem;
}

.card--settings {
  gap: 16px;
  align-content: start;
}

.card--dashboard h3 {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.card--dashboard h3 span[aria-hidden="true"] {
  font-size: 1.3rem;
}

.card-link {
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.card-link:focus-visible {
  outline: 3px solid rgba(var(--accent-rgb), 0.45);
  outline-offset: 4px;
}

.card-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 22px 48px rgba(31, 35, 53, 0.2);
}

.loan-alert {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--text-primary);
  font-weight: 600;
  transition: background 160ms ease, color 160ms ease, box-shadow 160ms ease;
  cursor: pointer;
}

.loan-alert-icon {
  font-size: 1.2rem;
  line-height: 1;
}

.loan-alert-text {
  font-size: 0.95rem;
  font-weight: 500;
}

.loan-alert--success {
  background: rgba(46, 204, 113, 0.18);
  color: #1f6c3f;
}

.loan-alert--info {
  background: rgba(var(--accent-rgb), 0.14);
  color: #0f4a63;
}

.loan-alert--warning {
  background: rgba(255, 193, 7, 0.24);
  color: #7c4d00;
}

.loan-alert--danger {
  background: rgba(244, 67, 54, 0.2);
  color: #7f1d1d;
  box-shadow: 0 0 0 1px rgba(244, 67, 54, 0.35);
}

.loan-alert--hidden {
  display: none;
}

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

.loan-alert:focus-visible {
  outline: 3px solid rgba(var(--accent-rgb), 0.45);
  outline-offset: 3px;
}

.loan-alert:hover {
  background: var(--accent-strong);
}

.loan-filter-info {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--text-primary);
  flex-wrap: wrap;
}

.loan-filter-info span[aria-hidden="true"] {
  font-size: 1.4rem;
}

.loan-filter-info span:not([aria-hidden]) {
  flex: 1 1 auto;
}

.loan-filter-info button {
  padding: 6px 12px;
  border-radius: 10px;
  margin-left: auto;
  flex-shrink: 0;
}

.loan-item--overdue {
  border-left: 4px solid var(--danger);
  background: rgba(244, 67, 54, 0.14);
}

.loan-item--overdue .badge {
  background: rgba(244, 67, 54, 0.16);
  color: var(--danger);
}

.list-item.is-highlighted,
.loan-item--overdue.is-highlighted {
  box-shadow: 0 0 0 2px rgba(var(--accent-rgb), 0.35);
  animation: highlightPulse 1.2s ease-in-out 2;
}

@keyframes highlightPulse {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-2px);
  }
}

.idea-project-list {
  margin: 6px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 6px;
}

.idea-project-list li {
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(var(--accent-rgb), 0.08);
  color: var(--text-primary);
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.idea-project-list li::before {
  content: "📌";
  font-size: 1rem;
}

.idea-project-list li.idea-empty {
  background: transparent;
  color: var(--text-muted);
  padding-left: 0;
}

.idea-project-list li.idea-empty::before {
  content: "📝";
}

.metric {
  font-size: clamp(1.8rem, 4vw, 2.3rem);
  font-weight: 700;
}

.muted {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.quick-actions button {
  border: none;
  background: var(--accent-soft);
  color: var(--accent);
  padding: 12px 16px;
  border-radius: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.quick-actions button:hover,
.quick-actions button:focus-visible {
  transform: translateY(-1px);
  background: var(--accent-strong);
  box-shadow: var(--shadow-strong);
  outline: none;
}

.toolbar {
  border-radius: var(--radius-md);
  padding: 16px;
  display: grid;
  gap: 16px;
  background: var(--surface);
}

.filter-bar {
  display: grid;
  gap: 16px;
}

.filter-bar fieldset {
  border: none;
  padding: 0;
  margin: 0;
}

.filter-bar legend {
  font-weight: 600;
  margin-bottom: 8px;
}

.filter-options {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.alpha-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.alpha-filter button {
  border: none;
  border-radius: 999px;
  padding: 8px 12px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease, transform 120ms ease;
}

.alpha-filter button:hover,
.alpha-filter button:focus-visible {
  background: var(--accent-strong);
  outline: none;
  transform: translateY(-1px);
}

.alpha-filter button.is-active {
  background: var(--accent);
  color: #fff;
}

.storage-field {
  display: grid;
  gap: 12px;
}

.storage-layout {
  grid-template-columns: minmax(180px, 0.6fr) minmax(260px, 1.4fr);
  align-items: stretch;
}

.quantity-storage-layout {
  grid-template-columns: minmax(160px, 0.45fr) minmax(320px, 1.55fr);
  align-items: start;
}

.quantity-storage-layout .quantity-field {
  align-self: stretch;
}

.quantity-storage-layout .storage-field {
  align-self: stretch;
}

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

.storage-picker {
  display: grid;
  gap: 16px;
}

.storage-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

.storage-slot {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid rgba(var(--accent-rgb), 0.14);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
}

.storage-slot .storage-label,
.storage-extra .storage-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
}

.storage-custom {
  display: none;
}

.storage-slot--custom .storage-custom {
  display: block;
}

.storage-extra {
  display: grid;
  gap: 6px;
}

.quantity-field {
  justify-self: stretch;
}

.quantity-field > input {
  width: 100%;
  min-width: 0;
}

.color-field {
  max-width: 320px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(var(--accent-rgb), 0.12);
  color: var(--accent);
  font-weight: 600;
}

.pill input {
  accent-color: var(--accent);
}

.search-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.search-bar input {
  flex: 1 1 220px;
  padding: 12px 16px;
  border-radius: 14px;
  border: 1px solid rgba(var(--accent-rgb), 0.22);
  background: rgba(255, 255, 255, 0.86);
  font: inherit;
}

.search-bar input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.25);
}

.inventory-list {
  display: grid;
  gap: 18px;
}

.tool-card {
  display: grid;
  gap: 16px;
  border-radius: var(--radius-md);
  padding: 20px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 18px 32px rgba(31, 35, 53, 0.14);
}

.tool-card.is-highlighted {
  outline: 2px solid var(--accent);
  box-shadow: 0 0 0 4px rgba(var(--accent-rgb), 0.25);
  transition: box-shadow 0.3s ease, outline 0.3s ease;
}

.tool-card header {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.tool-identity {
  display: flex;
  align-items: center;
  gap: 14px;
}

.tool-photo {
  width: 72px;
  height: 72px;
  border-radius: 16px;
  overflow: hidden;
  background: rgba(var(--accent-rgb), 0.12);
  display: grid;
  place-items: center;
  font-size: 2rem;
}

.tool-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.tool-photo img[data-placeholder="true"] {
  object-fit: cover;
}

.tool-photo.is-placeholder {
  background: transparent;
  border: 1px solid rgba(var(--accent-rgb), 0.12);
}

.color-chip {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  margin-right: 6px;
  background: var(--chip-color, #9ca3af);
  border: 1px solid rgba(17, 24, 39, 0.15);
  vertical-align: middle;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.85rem;
  font-weight: 600;
  background: var(--accent-soft);
  color: var(--accent);
}

.status-loaned {
  background: rgba(209, 67, 82, 0.16);
  color: var(--danger);
}

.badge-warning {
  background: rgba(255, 193, 7, 0.24);
  color: #7c4d00;
}

.badge-danger {
  background: rgba(244, 67, 54, 0.24);
  color: #7f1d1d;
}

.badge-info {
  background: var(--accent-strong);
  color: var(--accent);
}

.tool-details {
  display: grid;
  gap: 10px;
}

.tool-details dl {
  margin: 0;
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.tool-details dt {
  font-weight: 600;
  color: var(--text-muted);
}

.tool-details dd {
  margin: 0;
}

.tool-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.tool-actions button,
.tool-actions a {
  border: none;
  padding: 10px 14px;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  background: rgba(var(--accent-rgb), 0.12);
  color: var(--accent);
  text-decoration: none;
  transition: transform 160ms ease, background 160ms ease;
}

.tool-actions button:hover,
.tool-actions button:focus-visible,
.tool-actions a:hover,
.tool-actions a:focus-visible {
  transform: translateY(-1px);
  background: rgba(12, 95, 121, 0.16);
  outline: none;
}

.tool-actions .danger {
  background: rgba(209, 67, 82, 0.14);
  color: var(--danger);
}

.empty-state {
  text-align: center;
  padding: 36px 24px;
  border-radius: var(--radius-md);
  background: var(--accent-soft);
  color: var(--text-muted);
}

.form-section {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 20px;
}

.form-feedback {
  min-height: 1.2em;
  margin: 0;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
}

.form-feedback--info {
  color: var(--text-muted);
}

.form-feedback--success {
  color: var(--accent);
}

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

form {
  display: grid;
  gap: 20px;
}

fieldset {
  border: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 16px;
}

legend {
  font-weight: 600;
  margin-bottom: 8px;
}

label {
  display: grid;
  gap: 8px;
  font-weight: 600;
}

label span.helper {
  font-weight: 400;
  font-size: 0.85rem;
  color: var(--text-muted);
}

label.field-label > input,
label.field-label > select,
label.field-label > textarea {
  width: 100%;
}

input[type="text"],
input[type="date"],
input[type="number"],
select,
textarea {
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid rgba(var(--accent-rgb), 0.22);
  background: rgba(255, 255, 255, 0.88);
  font: inherit;
  color: inherit;
}

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

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.25);
}

input[type="file"] {
  padding: 12px 16px;
  border-radius: 14px;
  border: 1px dashed rgba(var(--accent-rgb), 0.35);
  background: rgba(255, 255, 255, 0.86);
}

.inline-group {
  display: grid;
  gap: 16px;
}

.inline-two {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

#loan-form .inline-group.inline-two {
  grid-template-columns: minmax(200px, 0.6fr) minmax(220px, 1fr);
  align-items: flex-start;
}

#loan-form .field-label .label-title {
  justify-content: flex-start;
  gap: 8px;
}

#loan-form .field-label .label-title span:first-child {
  flex: 0 1 auto;
}

#loan-form .field-label .field-icon {
  margin: 0;
}

.loan-site-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.checkbox-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
  font-size: 0.85rem;
  line-height: 1.2;
  cursor: pointer;
}

.checkbox-pill input {
  accent-color: var(--accent);
  cursor: pointer;
}

#loan-form select#loan-tool {
  width: 100%;
  max-width: clamp(220px, 32vw, 340px);
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: flex-end;
}

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

.button,
button {
  border: none;
  border-radius: 14px;
  padding: 14px 20px;
  font-weight: 600;
  font: inherit;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

button.primary,
.button.primary {
  background: var(--accent);
  color: white;
  box-shadow: 0 12px 28px rgba(var(--accent-rgb), 0.3);
}

button.secondary,
.button.secondary {
  background: var(--accent-soft);
  color: var(--accent);
}

button.ghost,
.button.ghost {
  background: transparent;
  border: 1px solid rgba(17, 24, 39, 0.12);
  color: inherit;
  box-shadow: none;
}

.button.icon-button,
button.icon-button {
  padding: 8px;
  border-radius: 999px;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  line-height: 1;
  border: 1px solid transparent;
  background: rgba(17, 24, 39, 0.04);
  color: inherit;
}

.button.icon-button.is-loading,
button.icon-button.is-loading {
  cursor: progress;
  opacity: 0.75;
}

.button.icon-button:hover,
.button.icon-button:focus-visible,
button.icon-button:hover,
button.icon-button:focus-visible {
  background: rgba(17, 24, 39, 0.1);
  transform: none;
}

.button.order-toggle,
button.order-toggle {
  width: 32px;
  height: 32px;
  padding: 4px 6px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  border: 1px solid rgba(17, 24, 39, 0.14);
  background: transparent;
  color: rgba(17, 24, 39, 0.68);
}

.button.order-toggle:hover,
.button.order-toggle:focus-visible,
button.order-toggle:hover,
button.order-toggle:focus-visible {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: rgba(var(--accent-rgb), 0.24);
  transform: none;
}

.topbar .icon-button {
  color: var(--text-muted);
}

.topbar .icon-button:hover,
.topbar .icon-button:focus-visible {
  color: var(--text);
}

@media (prefers-color-scheme: dark) {
  .button.icon-button,
  button.icon-button {
    background: rgba(255, 255, 255, 0.08);
  }

  .button.icon-button:hover,
  .button.icon-button:focus-visible,
  button.icon-button:hover,
  button.icon-button:focus-visible {
    background: rgba(255, 255, 255, 0.16);
  }

  .button.order-toggle,
  button.order-toggle {
    background: transparent;
    border-color: rgba(255, 255, 255, 0.18);
    color: rgba(255, 255, 255, 0.82);
  }

  .button.order-toggle:hover,
  .button.order-toggle:focus-visible,
  button.order-toggle:hover,
  button.order-toggle:focus-visible {
    background: rgba(124, 216, 255, 0.12);
    border-color: rgba(124, 216, 255, 0.28);
    color: var(--accent-dark);
  }

  .topbar .icon-button:hover,
  .topbar .icon-button:focus-visible {
    color: var(--accent-dark);
  }
}

button.danger.ghost,
.button.danger.ghost {
  color: var(--danger);
  border-color: rgba(209, 67, 82, 0.45);
}

button.danger,
.button.danger {
  background: rgba(209, 67, 82, 0.16);
  color: var(--danger);
}

button:hover,
button:focus-visible,
.button:hover,
.button:focus-visible {
  transform: translateY(-1px);
  outline: none;
}

.loan-list,
.idea-list {
  display: grid;
  gap: 16px;
}

.list-item {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 12px;
}

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

.list-item p {
  margin: 0;
  color: var(--text-muted);
}

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag {
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 999px;
  padding: 6px 12px;
  font-weight: 600;
  font-size: 0.85rem;
}

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

.theme-option {
  border: none;
  border-radius: 18px;
  padding: 16px;
  display: grid;
  gap: 10px;
  align-content: start;
  text-align: left;
  cursor: pointer;
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
  border: 2px solid transparent;
  font: inherit;
}

.theme-option__preview {
  display: flex;
  gap: 6px;
  height: 28px;
}

.theme-option__preview span {
  flex: 1 1 0;
  border-radius: 10px;
}

.theme-option__label {
  font-weight: 600;
  font-size: 1rem;
}

.theme-option__helper {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.theme-option.is-active {
  border-color: var(--accent);
  box-shadow: var(--shadow-strong);
  transform: translateY(-2px);
}

.theme-option:hover {
  transform: translateY(-2px);
}

.theme-option:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 4px;
}

.theme-option--default .theme-option__preview span:nth-child(1) {
  background: #0f7a9d;
}

.theme-option--default .theme-option__preview span:nth-child(2) {
  background: #f5f7fa;
}

.theme-option--default .theme-option__preview span:nth-child(3) {
  background: #111c2e;
}

.theme-option--sunset .theme-option__preview span:nth-child(1) {
  background: #ff7043;
}

.theme-option--sunset .theme-option__preview span:nth-child(2) {
  background: #fcb69f;
}

.theme-option--sunset .theme-option__preview span:nth-child(3) {
  background: #432c2e;
}

.theme-option--forest .theme-option__preview span:nth-child(1) {
  background: #2f855a;
}

.theme-option--forest .theme-option__preview span:nth-child(2) {
  background: #d9f4c7;
}

.theme-option--forest .theme-option__preview span:nth-child(3) {
  background: #0f2e1f;
}

.theme-option--midnight .theme-option__preview span:nth-child(1) {
  background: #38bdf8;
}

.theme-option--midnight .theme-option__preview span:nth-child(2) {
  background: #1f1f3d;
}

.theme-option--midnight .theme-option__preview span:nth-child(3) {
  background: #e5e7ff;
}

.theme-option--retro .theme-option__preview span:nth-child(1) {
  background: #ed8936;
}

.theme-option--retro .theme-option__preview span:nth-child(2) {
  background: #fdfcfb;
}

.theme-option--retro .theme-option__preview span:nth-child(3) {
  background: #3b2f2f;
}

.tag.missing {
  background: rgba(209, 67, 82, 0.16);
  color: var(--danger);
}

.tag.loaned {
  background: rgba(217, 119, 6, 0.22);
  color: var(--warning);
}

.summary-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.idea-status {
  display: grid;
  gap: 10px;
}

@media (max-width: 640px) {
  body {
    padding: 12px;
  }

  .panel {
    padding: 20px;
  }

  .tool-photo {
    width: 58px;
    height: 58px;
  }

  .tool-details dl {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  }

  .search-bar {
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.inventory-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.inventory-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.inventory-actions button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.inventory-actions .button-icon {
  font-size: 1.1rem;
  line-height: 1;
}

.recent-tools-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.recent-tools-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.recent-tools-header h3 {
  margin: 0;
  font-size: 1.1rem;
}

.recent-tools-list {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.recent-tool {
  position: relative;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid rgba(var(--accent-rgb), 0.14);
  background: rgba(var(--accent-rgb), 0.06);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.recent-tool header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.recent-tool-photo {
  width: 64px;
  height: 64px;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(var(--accent-rgb), 0.12);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.recent-tool-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.recent-tool-photo.is-placeholder {
  background: transparent;
  border: 1px solid rgba(var(--accent-rgb), 0.18);
}

.recent-tool-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.recent-tool-info h4 {
  margin: 0;
  font-size: 1rem;
}

.recent-tool-info time {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.recent-tool .recent-tool-meta {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.recent-tool-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.recent-tools-empty {
  margin: 0;
}

.inventory-count {
  font-weight: 600;
  color: var(--accent);
  font-size: 1rem;
}

.file-label {
  display: grid;
  gap: 8px;
  font-weight: 600;
  color: inherit;
}

.file-label input[type="file"] {
  margin-top: 4px;
}
.file-label.field-label .label-title {
  margin-bottom: 6px;
}
.quantity-field {
  justify-self: stretch;
}

.quantity-field > input {
  width: 100%;
  min-width: 0;
}
