.nav-link,
.btn,
.service-btn,
.module-link {
  border: 0;
  background: transparent;
  cursor: pointer;
  transition: background var(--ease), color var(--ease), border-color var(--ease);
}

.nav-link {
  min-height: var(--touch);
  padding: 0 var(--space-3);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: 500;
  font-size: 14px;
}

.nav-link:hover {
  color: var(--text);
  background: var(--bg-hover);
}

.nav-link.is-active {
  color: var(--text);
  background: var(--bg-hover);
  box-shadow: none;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 2rem;
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  white-space: nowrap;
  font-weight: 500;
  font-size: 14px;
  box-shadow: none;
}

.btn:hover {
  background: var(--bg-hover);
  border-color: var(--border-strong);
}

.btn--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn--primary:hover {
  background: #1f6feb;
  border-color: #1f6feb;
  color: #fff;
}

.btn--ghost {
  background: transparent;
}

.btn--danger {
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 40%, var(--border));
}

.btn--sm {
  min-height: 1.75rem;
  padding: 3px 10px;
  font-size: 12px;
}

.btn--icon {
  width: var(--touch);
  min-height: var(--touch);
  padding: 0;
}

.service-btn {
  width: 100%;
  min-height: 2rem;
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-1);
}

.service-btn:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.service-btn.is-active {
  color: var(--accent-strong);
  background: var(--accent-soft);
  border-color: transparent;
}

.service-btn:disabled,
.service-btn.is-disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

@media (max-width: 720px) {
  .service-btn {
    width: 2.5rem;
    min-width: 2.5rem;
    min-height: 2.5rem;
    flex: 0 0 auto;
    aspect-ratio: 1;
  }
}

.module-link {
  text-align: left;
  min-height: var(--touch);
  padding: 0.35rem 0.625rem;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  font-weight: 500;
  font-size: 14px;
  white-space: normal;
  word-break: normal;
  overflow-wrap: normal;
  hyphens: none;
  min-width: 0;
}

.module-link > .icon {
  margin-top: 0.15em;
}

.module-link > span {
  min-width: 0;
  flex: 1 1 auto;
  white-space: normal;
  word-break: normal;
  overflow-wrap: normal;
  hyphens: none;
}

.module-link:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.module-link.is-active {
  background: var(--accent-soft);
  color: var(--text);
}

.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  margin-bottom: var(--space-3);
}

.field label {
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 500;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 2rem;
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-deep);
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--focus);
  outline: none;
  box-shadow: none;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  background: var(--bg-elevated);
}

.table {
  width: 100%;
  border-collapse: collapse;
  min-width: 520px;
}

.table th,
.table td {
  text-align: left;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}

.table th {
  font-size: 14px;
  letter-spacing: normal;
  text-transform: none;
  color: var(--text-muted);
  font-weight: 600;
  background: var(--bg-deep);
}

.table tr:last-child td {
  border-bottom: 0;
}

.table tr:hover td {
  background: var(--bg-hover);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0 6px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-muted);
  font-weight: 500;
}

.badge--ok {
  color: var(--success);
  border-color: color-mix(in srgb, var(--success) 40%, var(--border));
  background: rgba(63, 185, 80, 0.12);
}

.badge--off {
  color: var(--text-faint);
}

.badge--pink {
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 40%, var(--border));
  background: var(--accent-warm-soft);
}

.list {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-elevated);
}

.list__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-2);
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-subtle);
  min-height: 2.5rem;
  min-width: 0;
}

.list__row:last-child {
  border-bottom: 0;
}

.list__meta {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.list__title {
  font-weight: 600;
  font-size: 14px;
}

.list__icon {
  width: 2rem;
  height: 2rem;
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent-strong);
  margin-right: var(--space-2);
  flex-shrink: 0;
}

.list__row-main {
  display: flex;
  align-items: center;
  min-width: 0;
  flex: 1 1 12rem;
}

.toggle {
  position: relative;
  width: 2.25rem;
  height: 1.25rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-deep);
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
}

.toggle::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 0.875rem;
  height: 0.875rem;
  border-radius: 50%;
  background: var(--text-muted);
  transition: transform var(--ease), background var(--ease);
}

.toggle.is-on {
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
}

.toggle.is-on::after {
  transform: translateX(0.95rem);
  background: var(--accent-strong);
}

.menu {
  position: relative;
}

.menu__panel {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 0.35rem);
  min-width: 200px;
  padding: var(--space-1);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  z-index: 40;
  box-shadow: 0 8px 24px rgba(1, 4, 9, 0.4);
}

.menu.is-open .menu__panel {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.menu__item {
  text-align: left;
  min-height: 2rem;
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  background: transparent;
  border: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: 500;
  font-size: 14px;
}

.menu__item:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.toolbar {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.split {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: var(--space-4);
}

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

.panel {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  padding: var(--space-4);
  box-shadow: none;
}

.panel h3 {
  margin-bottom: var(--space-2);
  font-size: 14px;
  color: var(--text-muted);
  letter-spacing: normal;
  text-transform: none;
  font-weight: 600;
}

.timeline {
  display: flex;
  flex-direction: column;
}

.timeline__item {
  display: grid;
  grid-template-columns: 5rem minmax(0, 1fr);
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--border-subtle);
  min-width: 0;
}

.timeline__item > div:last-child {
  min-width: 0;
}

.timeline__item:last-child {
  border-bottom: 0;
}

.timeline__when {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
}

/* Design kit */
.swatch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: var(--space-2);
}

.swatch {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-elevated);
}

.swatch__color {
  height: 3.5rem;
}

.swatch__meta {
  padding: var(--space-2);
  font-size: 12px;
  font-family: var(--font-mono);
}

.icon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: var(--space-2);
}

.icon-tile {
  min-height: 4.5rem;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 500;
}

.type-sample {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: var(--space-4);
  background: var(--bg-elevated);
  margin-bottom: var(--space-2);
}

.type-sample__label {
  color: var(--text-faint);
  font-size: 12px;
  letter-spacing: normal;
  text-transform: none;
  margin-bottom: var(--space-2);
  font-weight: 600;
}

/* Design Kit host mount (inside .main only) */
.dk-mount {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  min-width: 0;
}

.dk-vstack {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-width: 0;
}

.dk-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-width: 0;
}

.dk-form .field {
  margin-bottom: 0;
}

.dk-empty {
  text-align: center;
  padding: var(--space-5) var(--space-4);
  margin: 0;
}

.dk-grid {
  display: grid;
  gap: var(--space-4);
  min-width: 0;
}

.dk-grid--catalog {
  grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
}

.dk-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-width: 0;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  box-shadow: none;
  overflow: hidden;
  padding: var(--space-4);
}

.dk-card--compact {
  padding: 0;
  gap: 0;
}

.dk-card--compact > .dk-image {
  border-radius: 0;
}

.dk-card--compact > .dk-vstack,
.dk-card--compact > .toolbar,
.dk-card--compact > .dk-card__body {
  padding: var(--space-3) var(--space-4) var(--space-4);
  gap: var(--space-2);
}

.dk-card .dk-vstack {
  gap: var(--space-2);
}

.dk-card h1,
.dk-card h2 {
  margin: 0;
  font-size: 14px;
  line-height: 1.3;
}

.dk-card p {
  margin: 0;
  font-size: 12px;
  line-height: 1.35;
}

.dk-card p.muted {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.dk-card .toolbar {
  margin-top: auto;
  gap: var(--space-1);
}

.dk-card .btn {
  min-height: 1.75rem;
  padding: 3px 10px;
  font-size: 12px;
}

.dk-image {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  background: var(--bg-deep);
  overflow: hidden;
}

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