.tool-shell {
  min-height: 100dvh;
  background: var(--background);
  color: var(--foreground);
  padding-bottom: calc(var(--mobile-bottom-height) + env(safe-area-inset-bottom, 0px) + 0.5rem);
}

.tool-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--background);
  z-index: 10;
}

.tool-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--foreground);
  text-decoration: none;
}

.tool-brand-logo {
  height: 2.25rem;
  width: auto;
  object-fit: contain;
  display: block;
  border-radius: var(--radius);
}

.tool-brand-icon {
  width: 2rem;
  height: 2rem;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--primary), #06b6d4);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
}

.tool-brand-text {
  font-size: 1rem;
  font-weight: 700;
}

.theme-toggle {
  width: 2.5rem;
  height: 2.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--muted);
  color: var(--foreground);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0;
}

.theme-toggle svg {
  width: 1.1rem;
  height: 1.1rem;
}

.tool-bottom-nav {
  display: block;
}

.tool-quick-sheet {
  position: fixed;
  inset: 0;
  background: rgb(0 0 0 / 0.4);
  z-index: 120;
  display: none;
  align-items: flex-end;
}

.tool-quick-sheet.open {
  display: flex;
}

.tool-quick-sheet-panel {
  width: calc(100% - 1rem);
  margin: 0 auto calc(var(--mobile-bottom-height) + env(safe-area-inset-bottom, 0px) + 0.45rem);
  background: var(--card);
  border-radius: 1.2rem;
  border: 1px solid var(--border);
  padding: 1rem;
  padding-bottom: 1rem;
}

.tool-quick-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.8rem;
}

.tool-quick-sheet-header h3 {
  font-size: 1rem;
}

.tool-quick-close {
  width: 2rem;
  height: 2rem;
}

.tool-quick-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.tool-quick-card {
  border: 1px solid var(--border);
  border-radius: 0.85rem;
  background: color-mix(in srgb, var(--muted) 72%, transparent);
  color: var(--foreground);
  min-height: 6.4rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 600;
}

.tool-quick-card svg {
  width: 1.6rem;
  height: 1.6rem;
  color: var(--primary);
}

.tool-layout {
  max-width: 980px;
  margin: 0 auto;
  padding: 1rem;
  display: grid;
  gap: 1rem;
}

.tool-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  padding: 1rem;
}

.tool-title {
  margin-bottom: 0.5rem;
  font-size: 1.5rem;
}

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

.tool-grid {
  display: grid;
  gap: 0.75rem;
}

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

.tool-field label {
  display: block;
  margin-bottom: 0.25rem;
  color: var(--muted-foreground);
  font-size: 0.875rem;
}

.tool-field input,
.tool-field select,
.tool-field textarea {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--background);
  color: var(--foreground);
  border-radius: var(--radius);
  padding: 0.55rem 0.65rem;
}

.tool-actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin: 0.8rem 0 1rem;
}

.btn-primary,
.btn-secondary {
  border-radius: var(--radius);
  padding: 0.35rem 0.85rem;
  font-weight: 600;
  font-size: 0.86rem;
  line-height: 1.2;
  box-shadow: none;
  transform: none;
}

.btn-primary {
  background: var(--primary);
  color: var(--primary-foreground);
  border: 1px solid var(--primary);
}

.btn-secondary {
  border: 1px solid var(--border);
  background: transparent;
}

.btn-primary:hover,
.btn-secondary:hover {
  filter: brightness(0.98);
}

.result-box {
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 0.75rem;
  background: var(--muted);
}

.lastday-headline {
  margin-bottom: 0.75rem;
}

.lastday-headline h2 {
  font-size: 1.15rem;
  margin-bottom: 0.25rem;
}

.lastday-title {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.lastday-title-icon {
  width: 1.1rem;
  height: 1.1rem;
  color: var(--primary);
  flex: 0 0 auto;
}

.lastday-headline p {
  color: var(--muted-foreground);
  font-size: 0.92rem;
}

.lastday-result p + p {
  margin-top: 0.45rem;
}

.lastday-note {
  margin-top: -0.2rem;
}

.lastday-result-block {
  display: grid;
  gap: 0.75rem;
}

.lastday-future {
  margin-top: 0.75rem;
}

.lastday-future h3 {
  font-size: 1.05rem;
  margin-bottom: 0.5rem;
}

.lastday-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: 100%;
}

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

.lastday-table th,
.lastday-table td {
  padding: 0.6rem 0.65rem;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  text-align: center;
  white-space: nowrap;
}

.lastday-table th:last-child,
.lastday-table td:last-child {
  border-right: 0;
}

.lastday-table thead th {
  background: color-mix(in srgb, var(--primary) 90%, #ffffff);
  color: var(--primary-foreground);
  font-weight: 700;
}

.lastday-table tbody tr:nth-child(even) {
  background: color-mix(in srgb, var(--muted) 42%, transparent);
}

.lastday-table .is-highlight {
  color: #b91c1c;
  font-weight: 600;
}

.cv-block {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem;
  background: var(--background);
}

.cv-block-hd {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.salary-table-wrap {
  overflow-x: auto;
}

.salary-table {
  width: 100%;
  border-collapse: collapse;
}

.salary-table th,
.salary-table td {
  border-bottom: 1px solid var(--border);
  text-align: left;
  padding: 0.55rem;
  white-space: nowrap;
}

@media (max-width: 760px) {
  .tool-grid.cols-2 {
    grid-template-columns: 1fr;
  }

  .tool-field input,
  .tool-field select,
  .tool-field textarea {
    font-size: 16px;
  }

  .lastday-table-wrap {
    border: 0;
    overflow: visible;
  }

  .lastday-table {
    min-width: 0;
    border-collapse: separate;
    border-spacing: 0 0.65rem;
  }

  .lastday-table thead {
    display: none;
  }

  .lastday-table,
  .lastday-table tbody,
  .lastday-table tr,
  .lastday-table td {
    display: block;
    width: 100%;
  }

  .lastday-table tr {
    border: 1px solid var(--border);
    border-radius: 0.65rem;
    padding: 0.45rem;
    background: var(--card) !important;
    box-shadow: 0 2px 10px rgb(15 23 42 / 0.04);
  }

  .lastday-table td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    text-align: right;
    border-right: 0;
    border-bottom: 0;
    padding: 0.42rem 0.5rem;
    white-space: normal;
    background: color-mix(in srgb, var(--muted) 55%, transparent);
    border-radius: 0.45rem;
    margin-top: 0.25rem;
    font-size: 0.92rem;
  }

  .lastday-table td:first-child {
    margin-top: 0;
  }

  .lastday-table td::before {
    content: attr(data-label) "：";
    display: block;
    flex: 0 0 7.2rem;
    text-align: left;
    font-weight: 700;
    color: var(--muted-foreground);
    font-size: 0.8rem;
    line-height: 1.2;
  }

  .lastday-table td span {
    display: inline-block;
    font-weight: 600;
  }
}

@media (min-width: 1025px) {
  .tool-shell {
    padding-bottom: 0;
  }

  .tool-bottom-nav {
    display: none;
  }

  .tool-quick-sheet {
    display: none !important;
  }
}
