:root {
  --accent: rgb(234, 77, 73);
  --accent-dark: rgb(200, 52, 48);
  --accent-soft: rgba(234, 77, 73, .12);
  --ink: #000;
  --text: #161616;
  --text-soft: #4a4a48;
  --muted: #8a8a87;
  --line: #ebebe8;
  --shell: #f3f3f1;
  --card: #fff;
  --panel: #f6f6f4;
  --r-xl: 36px;
  --r-lg: 26px;
  --r-md: 16px;
  --font-ui: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}

html {
  background: #fff;
}
body {
  max-width: 76rem;
  margin: 1.25rem auto;
  padding: 2.25rem 2.5rem 1.5rem;
  background: var(--shell);
  border-radius: var(--r-xl);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem 2rem;
  margin: 0 0 3rem;
}
.header .logo {
  display: block;
  padding: 0;
}
.logo-img {
  display: block;
  width: auto;
  height: 44px;
}
.menu-toggle {
  display: none;
  width: 3rem;
  height: 3rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--card);
  cursor: pointer;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
}
.menu-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  border-radius: 2px;
  background: var(--ink);
  transition: transform .2s ease, opacity .2s ease;
}
.menu-toggle.is-open span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.menu-toggle.is-open span:nth-child(2) {
  opacity: 0;
}
.menu-toggle.is-open span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}
.logout-form {
  display: contents;
}
.header .menu .logout-btn {
  margin-left: .25rem;
  padding: .6rem 1.15rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-ui);
  font-size: 1rem;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.header .menu .logout-btn:hover {
  background: var(--accent-soft);
  color: var(--accent-dark);
}
.header .menu {
  gap: .15rem;
  padding: .35rem;
  background: var(--card);
  border-radius: 999px;
}
.header .menu a {
  padding: .6rem 1.15rem;
  border-radius: 999px;
  color: var(--text-soft);
  text-decoration: none;
  transition: background .15s ease, color .15s ease;
}
.header .menu a:hover {
  background: var(--panel);
  color: var(--ink);
}
.header .menu a[aria-current] {
  background: var(--ink);
  color: #fff;
  font-weight: 500;
  text-decoration: none;
}

.footer {
  padding: 2.5rem 0 .5rem;
  text-align: center;
}
.footer::before {
  display: none;
}
.footer small {
  color: var(--muted);
  font-size: .85rem;
}

h1 {
  margin: 0 0 1.75rem;
  font-size: 2rem;
  font-weight: 600;
  letter-spacing: -.03em;
  line-height: 1.15;
}
h2 {
  margin: 0 0 1.25rem;
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -.02em;
}
h3 {
  margin: 0 0 1rem;
  font-size: 1.05rem;
  font-weight: 600;
}
hr {
  width: 100%;
  height: 1px;
  margin: 2.5rem 0;
  border: 0;
  background: var(--line);
}
small {
  color: var(--muted);
}

.mite-tool {
  max-width: 860px;
  margin: 0 auto 1rem;
}
.mite-tool.dashboard {
  max-width: 100%;
}

.mite-tool button {
  padding: .8rem 1.5rem;
  border: none;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-family: var(--font-ui);
  font-size: .95rem;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s ease, color .15s ease, transform .1s ease;
}
.mite-tool button:hover {
  background: var(--accent);
}
.mite-tool button:active {
  transform: translateY(1px);
}
.mite-tool button:disabled {
  opacity: .6;
  cursor: wait;
}
.mite-tool .mite-form button[type="submit"] {
  background: var(--accent);
}
.mite-tool .mite-form button[type="submit"]::after {
  content: "→";
  margin-left: .6rem;
}
.mite-tool .mite-form button[type="submit"]:hover {
  background: var(--ink);
}
.mite-tool .btn-small {
  padding: .45rem 1rem;
  font-size: .85rem;
}
.mite-tool .btn-ghost {
  background: var(--card);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px #dcdcd8;
}
.mite-tool .btn-ghost:hover,
.mite-tool .btn-ghost.is-copied {
  background: var(--ink);
  color: #fff;
  box-shadow: none;
}
.mite-tool .btn-accent {
  background: var(--accent);
  color: #fff;
}
.mite-tool .btn-accent:hover {
  background: var(--ink);
}

.mite-tool ul {
  padding-left: 1.2rem;
}
.success {
  color: green;
}
.error {
  margin-bottom: 1.25rem;
  padding: 1rem 1.25rem;
  border-radius: var(--r-md);
  background: var(--accent-soft);
  color: var(--accent-dark);
}
span.alert {
  color: var(--accent);
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: .3rem .85rem;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: .78rem;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
}
.tag.tag-soft {
  background: var(--panel);
  color: var(--text-soft);
}
.tag.tag-soft::before {
  content: "";
  width: .45rem;
  height: .45rem;
  margin-right: .5rem;
  border-radius: 50%;
  background: var(--accent);
}

.card {
  margin-bottom: 2.5rem;
  padding: 1.75rem 2rem;
  background: var(--card);
  border-radius: var(--r-lg);
}

.mite-tool table {
  width: 100%;
  margin-bottom: 1.25rem;
  border-collapse: collapse;
  background: var(--card);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.mite-tool table th,
.mite-tool table td {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
.mite-tool table thead th {
  padding-top: 1.25rem;
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
}
.mite-tool table tbody tr:last-child td {
  border-bottom: 0;
}
.status-table .ok {
  background: #e6ffe6;
}
.status-table .warn {
  background: #fff4e6;
}
tr td small {
  font-size: .85em;
}
.status-table .col-service,
.status-table .col-hours {
  color: var(--muted);
  user-select: none;
  -webkit-user-select: none;
}
.status-table .col-service {
  width: 28%;
}
.status-table .col-hours {
  width: 11%;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.no-copy::before {
  content: attr(data-text);
}
.status-table tfoot td {
  border-top: 1px solid var(--line);
  border-bottom: 0;
  background: var(--panel);
}
.sum-row .sum-label {
  margin-right: 1rem;
  font-size: .78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
}
.sum-row .sum-value {
  margin-right: 1rem;
  font-size: 1.25rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.total {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem 2rem;
  margin-bottom: 2.5rem;
  padding: 1.75rem 2rem;
  background: var(--ink);
  color: #fff;
  border-radius: var(--r-lg);
}
.total-main {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  flex: 1;
  gap: .5rem 1.5rem;
}
.total-label {
  font-size: .8rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #a5a5a2;
}
.total-value {
  font-size: 2.75rem;
  font-weight: 500;
  letter-spacing: -.03em;
  line-height: 1.1;
}
.total-amount {
  color: #a5a5a2;
  font-size: 1.05rem;
}
.mite-tool .total .btn-ghost {
  background: transparent;
  color: #fff;
  box-shadow: inset 0 0 0 1px #4a4a48;
}
.mite-tool .total .btn-ghost:hover {
  background: var(--accent);
  box-shadow: none;
}
.total-quota {
  flex-basis: 100%;
  margin: 0;
  padding-top: 1rem;
  border-top: 1px solid #2c2c2b;
}
.total-quota small {
  color: #a5a5a2;
}
.total-quota .alert {
  color: #ff8a86;
}

.project-block {
  margin-bottom: 3rem;
}
.project-title {
  margin-bottom: 1rem;
  padding-left: .5rem;
  overflow-wrap: anywhere;
}
.mite-tool table td {
  overflow-wrap: anywhere;
}

.ai-box {
  margin-top: 1rem;
}
.ai-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
}
.ai-actions [hidden] {
  display: none;
}
.ai-mode {
  display: inline-flex;
  flex-basis: 100%;
  gap: .15rem;
  width: fit-content;
  padding: .25rem;
  background: var(--card);
  border-radius: 999px;
}
.mode-option {
  cursor: pointer;
}
.mode-option input {
  position: absolute;
  width: 1px;
  min-height: 0;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.mode-option span {
  display: block;
  padding: .4rem 1rem;
  border-radius: 999px;
  font-size: .85rem;
  font-weight: 500;
  color: var(--text-soft);
  transition: background .15s ease, color .15s ease;
}
.mode-option:hover span {
  background: var(--panel);
}
.mode-option input:checked + span {
  background: var(--ink);
  color: #fff;
}
.mode-option input:focus-visible + span {
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.ai-actions .ai-wish {
  flex: 1 1 260px;
  width: auto;
  min-height: 40px;
  max-height: 40px;
  padding: 0 1.1rem;
  border-radius: 999px;
  font-size: .9rem;
}
.ai-output {
  display: block;
  box-sizing: border-box;
  width: 100%;
  margin-top: 1rem;
  padding: 1.1rem 1.4rem;
  border: 1.5px solid #c9c9c4;
  border-radius: var(--r-md);
  background: var(--card);
  font-family: var(--font-ui);
  font-size: .95rem;
  line-height: 1.6;
  resize: vertical;
}
.ai-output:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.ai-output[hidden],
.ai-status[hidden],
.ai-count[hidden] {
  display: none;
}
.ai-count {
  margin: .5rem 0 0 .5rem;
  color: var(--muted);
  font-size: .85rem;
}
.ai-status {
  margin: .75rem 0 0;
  color: var(--accent-dark);
  font-size: .9rem;
}

.filterRow {
  display: block;
  width: 100%;
  margin-bottom: 1.5rem;
}
.filterRow label:not(.radio-option) > span {
  display: block;
  margin-bottom: .6rem;
  font-size: .85rem;
  font-weight: 600;
  color: var(--text-soft);
}
select, input {
  box-sizing: border-box;
  width: 100%;
  min-height: 56px;
  max-height: 56px;
  padding: 5px 1.25rem;
  border: 1.5px solid #c9c9c4;
  border-radius: var(--r-md);
  background-color: #fff;
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 1rem;
  color-scheme: light;
  transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease, opacity .15s ease;
}
select:hover, input:hover {
  border-color: #9a9a95;
}
select:focus, input:focus {
  outline: none;
  border-color: var(--accent);
  background-color: #fff;
  box-shadow: 0 0 0 4px var(--accent-soft);
}
select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 48px;
  cursor: pointer;
  background-repeat: no-repeat;
  background-position: right 20px center;
  background-size: 14px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 8'%3E%3Cpath d='M1 1l6 6 6-6' fill='none' stroke='%23161616' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
.month-picker {
  position: relative;
}
.month-picker-input {
  padding-right: 48px;
  cursor: pointer;
  background-repeat: no-repeat;
  background-position: right 20px center;
  background-size: 18px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23161616' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4.5' width='18' height='16' rx='3'/%3E%3Cpath d='M3 9.5h18M8 2.5v4M16 2.5v4'/%3E%3C/svg%3E");
}
.month-picker-input::placeholder {
  color: var(--muted);
}
.is-inactive {
  opacity: .45;
  cursor: not-allowed;
}
.month-picker-popup {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  z-index: 20;
  width: 300px;
  max-width: 90vw;
  padding: 1.25rem;
  background: var(--card);
  border-radius: var(--r-lg);
  box-shadow: 0 24px 48px rgba(0, 0, 0, .14), 0 0 0 1px var(--line);
}
.month-picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.month-picker-year {
  font-weight: 600;
  font-size: 1.05rem;
}
.month-picker-popup .month-picker-nav {
  width: 36px;
  height: 36px;
  min-height: 0;
  padding: 0;
  border-radius: 50%;
  background: var(--panel);
  color: var(--ink);
  font-size: 1.1rem;
  line-height: 1;
}
.month-picker-popup .month-picker-nav:hover {
  background: var(--ink);
  color: #fff;
}
.month-picker-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .5rem;
  margin-bottom: 1rem;
}
.month-picker-popup .month-picker-cell {
  min-height: 0;
  padding: .7rem 0;
  border-radius: 12px;
  background: var(--panel);
  color: var(--ink);
  font-size: .9rem;
}
.month-picker-popup .month-picker-cell:hover {
  background: var(--ink);
  color: #fff;
}
.month-picker-popup .month-picker-cell.is-selected {
  background: var(--accent);
  color: #fff;
}
.month-picker-popup .month-picker-clear {
  display: block;
  width: 100%;
  min-height: 0;
  padding: .25rem 0 0;
  background: none;
  color: var(--muted);
  font-size: .85rem;
  font-weight: 400;
  text-align: center;
  text-decoration: underline;
}
.month-picker-popup .month-picker-clear:hover {
  background: none;
  color: var(--accent);
}
label.toggle input {
  width: auto !important;
}

.tabs {
  display: inline-flex;
  gap: .15rem;
  margin-bottom: 1.75rem;
  padding: .35rem;
  background: var(--card);
  border-radius: 999px;
}
.mite-tool .tabs .tab-btn {
  padding: .65rem 1.4rem;
  background: none;
  color: var(--text-soft);
  font-weight: 500;
}
.mite-tool .tabs .tab-btn:hover {
  background: var(--panel);
  color: var(--ink);
}
.mite-tool .tabs .tab-btn.is-active {
  background: var(--ink);
  color: #fff;
}
.tab-panel[hidden] {
  display: none;
}

.radio-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .75rem;
}
.radio-row > span {
  flex-basis: 100%;
  margin-bottom: .1rem;
  font-size: .85rem;
  font-weight: 600;
  color: var(--text-soft);
}
.radio-option {
  display: inline-flex;
  align-items: center;
  gap: .75rem;
  padding: .75rem 1.1rem;
  border-radius: 999px;
  background: var(--panel);
  cursor: pointer;
  transition: box-shadow .15s ease, background .15s ease;
}
.radio-option:hover {
  background: #efefec;
}
.radio-option:has(input:checked) {
  background: var(--card);
  box-shadow: inset 0 0 0 2px var(--ink);
}
.radio-option input[type="radio"] {
  width: auto;
  min-height: 0;
  max-height: none;
  padding: 0;
  border: none;
  background: none;
  accent-color: var(--accent);
  cursor: pointer;
}

@media (max-width: 860px) {
  .header {
    flex-wrap: wrap;
    margin-bottom: 1.75rem;
  }
  .menu-toggle {
    display: flex;
  }
  .header .menu {
    display: none;
    flex-basis: 100%;
    flex-direction: column;
    gap: .15rem;
    padding: .5rem;
    border-radius: var(--r-lg);
  }
  .header .menu.is-open {
    display: flex;
  }
  .header .menu a,
  .header .menu .logout-btn {
    display: block;
    box-sizing: border-box;
    width: 100%;
    margin: 0;
    padding: .85rem 1.1rem;
    text-align: left;
  }
  .logout-form {
    display: block;
    margin-top: .25rem;
    padding-top: .25rem;
    border-top: 1px solid var(--line);
  }
}

@media (max-width: 720px) {
  body {
    margin: 0;
    padding: 1.25rem 1rem;
    border-radius: 0;
  }
  h1 {
    font-size: 1.65rem;
  }
  .card {
    padding: 1.25rem;
  }
  .tabs {
    display: flex;
    box-sizing: border-box;
    width: 100%;
  }
  .radio-option {
    box-sizing: border-box;
    width: 100%;
  }
  .mite-tool .tabs .tab-btn {
    flex: 1;
    padding: .65rem .75rem;
  }
  .total {
    padding: 1.25rem;
  }
  .total-value {
    font-size: 2.1rem;
  }
  .ai-mode {
    display: flex;
    width: 100%;
  }
  .mode-option {
    flex: 1;
  }
  .mode-option span {
    text-align: center;
    padding: .5rem .5rem;
  }
  .ai-actions .ai-wish {
    flex-basis: 100%;
  }

  .mite-tool table:not(.status-table) {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
  }

  .status-table,
  .status-table tbody,
  .status-table tfoot,
  .status-table tr,
  .status-table td {
    display: block;
  }
  .status-table thead {
    display: none;
  }
  .status-table tbody tr {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: .15rem 1rem;
    padding: .9rem 1.1rem;
    border-bottom: 1px solid var(--line);
  }
  .status-table tbody tr:last-child {
    border-bottom: 0;
  }
  .mite-tool .status-table tbody td {
    padding: 0;
    border: 0;
    width: auto;
  }
  .status-table tbody td:first-child {
    grid-column: 1 / -1;
    font-weight: 500;
  }
  .status-table .col-service,
  .status-table .col-hours {
    font-size: .85rem;
  }
  .status-table .col-hours {
    text-align: right;
  }
  .mite-tool .status-table tfoot td {
    padding: .9rem 1.1rem;
  }
}

.mite-tool.login {
  max-width: 440px;
  margin-top: 4vh;
}
.login-card h1 {
  margin-bottom: .5rem;
}
.login-hint {
  margin: 0 0 1.75rem;
  color: var(--muted);
}
.login-card button[type="submit"] {
  width: 100%;
}
