* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding-top: 52px;
  padding-bottom: 48px;
  background: #f4f6f8;
  color: #151a1f;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
  color: #0a66c2;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px;
  overflow-x: hidden;
}

.app-shell-header {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 52px;
  padding: 8px 18px;
  background: #071f4f;
  color: #fff;
  box-shadow: 0 1px 8px rgb(6 20 48 / 20%);
}

.app-shell-brand {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  gap: 10px;
  color: #fff;
  font-weight: 800;
}

.app-shell-brand:hover {
  color: #fff;
  text-decoration: none;
}

.app-shell-brand img {
  display: block;
  width: 34px;
  height: 34px;
  border-radius: 8px;
}

.app-shell-brand span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-shell-version {
  flex: 0 0 auto;
  color: #dbe7ff;
  font-size: 13px;
  font-weight: 700;
}

.app-shell-actions {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 10px;
}

.app-shell-capture {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid rgb(255 255 255 / 20%);
  border-radius: 6px;
  background: #24c6a6;
  color: #fff;
  font-size: 13px;
  font-weight: 800;
}

.app-shell-capture:hover {
  color: #fff;
  text-decoration: none;
}

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

.logout-form {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 12px;
}

h1 {
  margin: 0 0 20px;
  font-size: 28px;
}

input,
select,
textarea,
button {
  width: 100%;
  border: 1px solid #c9d2dc;
  border-radius: 6px;
  padding: 10px 12px;
  font: inherit;
}

button {
  background: #0a66c2;
  border-color: #0a66c2;
  color: #fff;
  cursor: pointer;
}

.link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: auto;
  min-height: 36px;
  padding: 7px 11px;
  background: #dfe7ef;
  border-color: #c9d2dc;
  border-radius: 6px;
  color: #22303d;
  font-weight: 700;
  line-height: 1.1;
}

.badge-link {
  position: relative;
}

.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: #b42318;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
}

.primary-link {
  background: #24c6a6;
  border-color: #24c6a6;
  color: #fff;
}

.primary-link:hover {
  color: #fff;
}

.danger-form {
  display: flex;
  justify-content: flex-end;
  margin: 12px 0 0;
}

.danger-button {
  width: auto;
  padding: 7px 10px;
  background: #b42318;
  border-color: #b42318;
}

.dashboard-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: flex-start;
  margin: 12px 0 12px;
}

.record-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid #24c6a6;
  border-radius: 6px;
  background: #24c6a6;
  color: #fff;
  font-weight: 700;
}

.record-cta:hover {
  color: #fff;
  text-decoration: none;
}

.icon-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border: 1px solid #c9d2dc;
  border-radius: 6px;
  background: #fff;
  color: #22303d;
  font-size: 30px;
  font-weight: 600;
  line-height: 1;
}

.icon-action:hover {
  color: #0a66c2;
  text-decoration: none;
}

.brand-footer {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  height: 44px;
  padding: 7px 18px;
  background: #071f4f;
  box-shadow: 0 -1px 8px rgb(6 20 48 / 18%);
}

.brand-footer img {
  display: block;
  width: 100px;
  height: 27px;
}

.quick-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 18px;
}

.quick-tabs a {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid #c9d2dc;
  border-radius: 6px;
  background: #fff;
  color: #22303d;
  font-weight: 700;
}

.quick-tabs a.active {
  background: #0a66c2;
  border-color: #0a66c2;
  color: #fff;
}

.quick-tabs span {
  font-weight: 500;
  opacity: .8;
}

.sub-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 18px;
}

.sub-tabs a {
  display: inline-flex;
  padding: 5px 8px;
  border: 1px solid #dbe2ea;
  border-radius: 5px;
  background: #fff;
  color: #465461;
  font-size: 13px;
}

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

.login-card {
  width: min(420px, 100%);
  display: grid;
  gap: 14px;
  background: #fff;
  border: 1px solid #dbe2ea;
  border-radius: 8px;
  padding: 24px;
  box-shadow: 0 12px 30px rgba(21, 26, 31, .08);
}

.login-card h1 {
  margin: 0 0 6px;
}

.login-error {
  margin: 0;
  padding: 10px 12px;
  background: #ffe1e1;
  color: #7b1b1b;
  border-radius: 6px;
}

.notice,
.token-secret {
  margin: 0;
  padding: 12px;
  background: #e6f4ea;
  color: #1f5f32;
  border-radius: 6px;
}

.token-secret {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
}

code {
  display: inline-block;
  max-width: 100%;
  overflow-wrap: anywhere;
  background: #eef3f8;
  color: #17202a;
  padding: 3px 5px;
  border-radius: 4px;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border: 1px solid #dbe2ea;
  table-layout: fixed;
}

@media (min-width: 761px) {
  .ideas th:nth-child(1),
  .ideas td:nth-child(1) {
    width: 72px;
  }

  .ideas th:nth-child(2),
  .ideas td:nth-child(2) {
    width: 150px;
  }

  .ideas th:nth-child(3),
  .ideas td:nth-child(3) {
    width: 140px;
  }

  .ideas th:nth-child(4),
  .ideas td:nth-child(4) {
    width: auto;
  }

  .ideas th:nth-child(5),
  .ideas td:nth-child(5) {
    width: 150px;
  }

  .ideas th:nth-child(6),
  .ideas td:nth-child(6) {
    width: 140px;
  }
}

th,
td {
  padding: 12px;
  border-bottom: 1px solid #e6ebf0;
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
}

th {
  background: #eef3f8;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .02em;
}

.title {
  font-weight: 700;
}

.excerpt,
.muted {
  color: #64717f;
  font-size: 14px;
  margin-top: 4px;
}

.status,
.tag {
  display: inline-block;
  border-radius: 4px;
  padding: 3px 7px;
  font-size: 13px;
  font-weight: 700;
}

.status {
  background: #dfe7ef;
  color: #22303d;
}

.status-todo {
  background: #fff1bf;
}

.status-doing {
  background: #cfe8ff;
}

.status-done {
  background: #cef3d6;
}

.status-archived {
  background: #e4e4e4;
}

.status-queued {
  background: #e8f2ff;
}

.status-processing {
  background: #d5f6ef;
}

.status-error {
  background: #ffe1e1;
  color: #7b1b1b;
}

.tag {
  background: #e8f2ff;
  margin: 0 4px 4px 0;
}

.queue-error {
  max-height: 180px;
  margin: 8px 0 0;
  white-space: pre-wrap;
  overflow: auto;
  background: #2b1212;
  color: #ffd7d7;
  padding: 10px;
}

.audio-bar {
  position: sticky;
  top: 0;
  z-index: 3;
  background: #f4f6f8;
  padding: 10px 0;
  border-bottom: 1px solid #dbe2ea;
}

.detail audio {
  width: 100%;
  margin: 0;
}

.meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.detail-actions,
.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.inline-form {
  display: inline;
}

.inline-form input[type="hidden"] {
  display: none;
}

.mini-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 78px;
  min-height: 30px;
  padding: 5px 7px;
  border-radius: 5px;
  font-size: 12px;
  line-height: 1.2;
  background: #0a66c2;
  border-color: #0a66c2;
  white-space: nowrap;
}

.mini-button.secondary {
  background: #dfe7ef;
  border-color: #c9d2dc;
  color: #22303d;
}

.mini-button.danger-mini {
  background: #b42318;
  border-color: #b42318;
}

.edit-form {
  display: grid;
  gap: 14px;
  background: #fff;
  border: 1px solid #dbe2ea;
  padding: 18px;
}

.module-card {
  display: grid;
  gap: 14px;
  margin: 18px 0;
  padding: 18px;
  border: 1px solid #dbe2ea;
  background: #fff;
}

.module-card h2 {
  margin: 0 0 6px;
}

.processing-panel {
  display: grid;
  justify-items: center;
  gap: 16px;
  margin-top: 20px;
  padding: 42px 18px;
  border: 1px solid #dbe2ea;
  background: #fff;
  text-align: center;
}

.processing-panel h2 {
  margin: 0;
  font-size: 22px;
}

.waiting-gear {
  width: 58px;
  height: 58px;
  border: 7px solid #dfe7ef;
  border-top-color: #24c6a6;
  border-radius: 50%;
  animation: waiting-gear-turn 900ms linear infinite;
}

@keyframes waiting-gear-turn {
  to {
    transform: rotate(360deg);
  }
}

.recorder-panel {
  display: grid;
  gap: 18px;
  justify-items: center;
  background: #fff;
  border: 1px solid #dbe2ea;
  padding: 24px;
}

.record-status {
  color: #465461;
  font-weight: 700;
}

.record-timer {
  font-size: 46px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.record-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.record-actions button {
  width: auto;
  min-width: 100px;
}

.record-actions button[data-start] {
  background: #24c6a6;
  border-color: #24c6a6;
}

.secondary-button {
  background: #dfe7ef;
  border-color: #c9d2dc;
  color: #22303d;
}

.recorder-panel audio {
  width: 100%;
}

.quick-capture-page {
  min-height: calc(100vh - 100px);
}

.quick-recorder {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 18px;
  min-height: min(620px, calc(100vh - 190px));
  padding: 22px;
  text-align: center;
}

.quick-record-button {
  display: grid;
  place-items: center;
  gap: 8px;
  width: min(72vw, 280px);
  aspect-ratio: 1;
  border-radius: 50%;
  border: 8px solid #d5f6ef;
  background: #24c6a6;
  color: #fff;
  font-size: 28px;
  font-weight: 900;
  box-shadow: 0 18px 36px rgb(36 198 166 / 28%);
}

.quick-record-button span:first-child {
  font-size: 58px;
  line-height: .8;
}

.quick-recorder.is-recording .quick-record-button {
  border-color: #ffe1e1;
  background: #b42318;
  box-shadow: 0 18px 36px rgb(180 35 24 / 24%);
}

.quick-recorder.is-sending .quick-record-button {
  border-color: #e8f2ff;
  background: #0a66c2;
}

.transcript-preview {
  background: #f8fafc;
  border: 1px solid #dbe2ea;
  padding: 14px;
}

.transcript-preview h2 {
  margin: 0 0 10px;
  font-size: 18px;
}

.transcript-preview p {
  line-height: 1.55;
  margin: 0 0 10px;
}

label {
  display: grid;
  gap: 6px;
  font-weight: 700;
}

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

.checkbox-label input {
  width: auto;
}

textarea,
input,
select {
  background: #fff;
}

textarea {
  line-height: 1.45;
}

.error {
  white-space: pre-wrap;
  background: #2b1212;
  color: #ffd7d7;
  padding: 12px;
  overflow: auto;
}

@media (max-width: 760px) {
  .page {
    padding: 14px;
  }

  .topbar,
  .detail-header {
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
  }

  .topbar h1 {
    margin-bottom: 0;
    font-size: 24px;
  }

  .logout-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    width: 100%;
  }

  .logout-form > a:not(.link-button),
  .logout-form > span {
    grid-column: 1 / -1;
    min-width: 0;
    overflow-wrap: anywhere;
    font-size: 13px;
  }

  .logout-form .link-button,
  .logout-form button.link-button {
    width: 100%;
    min-width: 0;
  }

  .dashboard-actions {
    align-items: center;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 44px;
    gap: 8px;
  }

  .dashboard-actions .record-cta {
    width: 100%;
    min-width: 0;
  }

  .icon-action {
    width: 44px;
    height: 44px;
    flex-basis: 44px;
  }

  .quick-recorder {
    min-height: calc(100vh - 190px);
    padding: 12px;
  }

  .quick-tabs,
  .sub-tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  .quick-tabs a,
  .sub-tabs a {
    justify-content: center;
    min-width: 0;
    text-align: center;
  }

  table,
  thead,
  tbody,
  tr,
  th,
  td {
    display: block;
  }

  .ideas th,
  .ideas td {
    width: auto;
  }

  thead {
    display: none;
  }

  tr {
    display: grid;
    gap: 8px;
    margin-bottom: 12px;
    padding: 12px;
    border: 1px solid #dbe2ea;
    background: #fff;
  }

  td {
    display: grid;
    grid-template-columns: 88px minmax(0, 1fr);
    gap: 10px;
    padding: 0;
    border-bottom: 0;
  }

  td::before {
    content: attr(data-label);
    color: #64717f;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
  }

  td:not([data-label]) {
    display: block;
  }

  td:not([data-label])::before {
    display: none;
  }

  td[data-label="Idea"] {
    display: block;
  }

  td[data-label="Idea"]::before {
    display: block;
    margin-bottom: 4px;
  }

  .row-actions,
  .detail-actions {
    display: grid;
    grid-template-columns: repeat(3, 78px);
    gap: 6px;
  }

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

  .detail-actions .mini-button {
    width: 100%;
  }
}
