:root {
  --purple-2: #6366f1;
  --purple-3: #a78bfa;
  --purple-dark: #6d28d9;
  --muted: #374151;
  --busy-blue: #2563eb;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: #111;
  font-family: "Segoe UI", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  background:
    radial-gradient(900px 480px at 15% 10%, rgb(167 139 250 / 45%), transparent 60%),
    linear-gradient(145deg, #312e81 0%, #5b21b6 42%, #7c3aed 100%);
}

body.booting .card {
  visibility: hidden;
}

.shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.card {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 400px;
  zoom: 1.5;
  background: #fff;
  border-radius: 20px;
  padding: 32px 24px 24px;
  box-shadow: 0 24px 60px rgb(49 46 129 / 28%);
}

.ver {
  position: absolute;
  top: 10px;
  right: 12px;
  font-size: 0.68rem;
  color: #9ca3af;
}

.logout {
  position: absolute;
  top: 8px;
  left: 12px;
  border: none;
  background: transparent;
  color: #111;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
}

.title {
  margin: 0;
  text-align: center;
  font-size: 1.85rem;
  color: var(--purple-2);
  font-weight: 800;
}

.step-label {
  text-align: center;
  color: #111;
  font-size: 1rem;
  font-weight: 700;
  margin: 6px 0 10px;
}

.session-pill {
  text-align: center;
  font-size: 0.75rem;
  padding: 6px 10px;
  border-radius: 999px;
  background: #f3f4f6;
  color: #4b5563;
  margin-bottom: 16px;
}

.session-pill.ok {
  background: #d1fae5;
  color: #065f46;
}

.session-pill.wait {
  background: #fef3c7;
  color: #92400e;
}

.connect-bar {
  width: 100%;
  margin-bottom: 14px;
  background: #eef2ff;
  color: #4338ca;
  font-size: 0.88rem;
  padding: 10px;
}

.connect-bar.hidden {
  display: none;
}

.hidden {
  display: none !important;
}

.field {
  display: block;
  margin-bottom: 14px;
}

.field span {
  display: block;
  color: #111;
  font-size: 1rem;
  font-weight: 800;
  margin-bottom: 6px;
}

.field input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #111;
  border-radius: 12px;
  color: #111;
  font-size: 1.05rem;
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.field input::placeholder {
  color: #4b5563;
}

.field input:focus {
  outline: none;
  background: #fff;
  border-color: #4f46e5;
  box-shadow: 0 0 0 4px rgb(79 70 229 / 20%);
}

.field-tip {
  margin: 6px 0 0;
  font-size: 0.72rem;
  color: #6b7280;
  line-height: 1.35;
}

.field-tip code {
  font-size: 0.7rem;
  background: #f3f4f6;
  padding: 1px 4px;
  border-radius: 4px;
}

.field-tip.err {
  color: #b45309;
  font-weight: 600;
}

.field-tip.capture.ok {
  color: #065f46;
  font-weight: 600;
}

.advanced {
  margin: 8px 0 12px;
  font-size: 0.82rem;
  color: var(--muted);
}

.advanced summary {
  cursor: pointer;
  color: var(--purple-2);
}

.bm-help a {
  color: var(--purple-2);
  font-weight: 700;
}

.advanced textarea {
  width: 100%;
  margin-top: 8px;
  padding: 10px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 0.75rem;
  font-family: ui-monospace, monospace;
  resize: vertical;
}

.code-input {
  text-align: center;
  letter-spacing: 0.35em;
  font-size: 1.2rem !important;
  font-weight: 600;
}

.btn {
  border: none;
  border-radius: 10px;
  padding: 13px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
}

.btn.gradient {
  width: 100%;
  background: linear-gradient(90deg, var(--purple-2), var(--purple-3));
  color: #fff;
}

.btn.gradient.light {
  margin-bottom: 10px;
  background: linear-gradient(90deg, #6366f1, #a78bfa);
}

.btn.gradient.dark {
  background: linear-gradient(90deg, #5b21b6, #7c3aed);
}

.btn.gradient:disabled {
  opacity: 0.65;
  cursor: wait;
}

.btn.copy {
  background: #10b981;
  color: #fff;
  padding: 10px 14px;
}

.btn.small {
  width: 100%;
  margin-bottom: 6px;
  padding: 10px;
  font-size: 0.88rem;
}

.btn.small.secondary {
  background: #eef2ff;
  color: #4338ca;
}

.btn.ghost {
  width: 100%;
  margin-top: 8px;
  background: #f3f4f6;
  color: #6b7280;
  font-weight: 500;
}

.busy {
  text-align: center;
  padding: 28px 0;
  color: var(--muted);
}

.spinner {
  width: 36px;
  height: 36px;
  margin: 0 auto 10px;
  border: 3px solid #e5e7eb;
  border-top-color: var(--busy-blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.busy-text {
  color: var(--busy-blue);
  font-weight: 600;
  margin: 0;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.success-box {
  border: 2px solid #059669;
  background: #ecfdf5;
  border-radius: 12px;
  padding: 16px 14px;
  text-align: center;
}

.success-code {
  margin: 0 0 6px;
  font-weight: 800;
  font-size: 1.05rem;
  color: #047857;
}

.success-msg {
  margin: 0 0 10px;
  font-size: 0.9rem;
  color: #065f46;
}

.success-url {
  display: block;
  word-break: break-all;
  font-size: 0.72rem;
  color: #059669;
  text-decoration: underline;
  margin-bottom: 12px;
  line-height: 1.4;
}

.btn.success-copy {
  width: 100%;
  background: #059669;
  color: #fff;
  padding: 12px;
}

.status {
  margin-top: 12px;
  padding: 10px;
  border-radius: 8px;
  font-size: 0.82rem;
  background: #fef3c7;
  color: #92400e;
}

.status.ok {
  background: #d1fae5;
  color: #065f46;
}

.connect-dialog {
  border: none;
  border-radius: 14px;
  padding: 20px;
  max-width: 420px;
  width: calc(100% - 32px);
  box-shadow: 0 20px 60px rgb(0 0 0 / 35%);
}

.connect-dialog::backdrop {
  background: rgb(0 0 0 / 45%);
}

.connect-dialog h2 {
  margin: 0 0 8px;
  font-size: 1.1rem;
}

.dialog-lead {
  font-size: 0.85rem;
  color: #374151;
  line-height: 1.5;
  margin: 0 0 14px;
}

.connect-steps {
  margin: 0 0 12px;
  padding-left: 1.2rem;
}

.connect-steps li {
  margin-bottom: 14px;
  font-size: 0.82rem;
}

.step-hint {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.4;
  margin-top: 4px;
}

kbd {
  background: #f3f4f6;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 0.75rem;
}

#mail-dock,
#note-dock {
  display: none !important;
}

body.signed-in #mail-dock,
body.signed-in #note-dock {
  display: flex !important;
}

@media (min-width: 1280px) {
  body.signed-in .shell {
    padding-left: 548px;
    padding-right: 392px;
  }
}

.note-dock {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 1;
  width: min(520px, calc(100vw - 24px));
  max-height: calc(100vh - 32px);
  flex-direction: column;
  background: #f6f3ff;
  border-radius: 20px;
  box-shadow: 0 24px 60px rgb(49 46 129 / 28%);
  overflow: hidden;
}

.note-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  color: #fff;
  font-size: 1.15rem;
  background: linear-gradient(90deg, #4f46e5, #7c3aed);
}

#note-saved {
  font-size: 1rem;
  font-weight: 700;
}

.note-table-wrap {
  overflow: auto;
  max-height: calc(100vh - 140px);
  padding: 10px;
}

.note-table {
  width: 100%;
  min-width: 480px;
  table-layout: fixed;
  border-collapse: collapse;
  background: #fff;
  border: 1px solid #111;
}

.col-id,
.col-pw {
  width: 22%;
}

.col-name {
  width: 16%;
}

.col-del {
  width: 84px;
}

.note-table th,
.note-table td {
  border: 1px solid #111;
  padding: 0;
  font-size: 1rem;
  color: #111;
  vertical-align: middle;
}

.note-table th {
  padding: 10px 8px;
  text-align: left;
  color: #111;
  font-size: 0.95rem;
  font-weight: 800;
  background: #e5e7eb;
  white-space: nowrap;
}

.note-del-head,
.note-del-cell {
  width: 84px;
  text-align: center;
  white-space: nowrap;
}

.note-table input {
  width: 100%;
  min-width: 0;
  border: none;
  padding: 10px 8px;
  color: #111;
  font-size: 1rem;
  line-height: 1.4;
  background: transparent;
}

.note-table input:focus {
  outline: 2px solid #4f46e5;
  outline-offset: -2px;
  background: #fff;
}

.note-del,
.note-add,
.mail-act {
  border: none;
  background: transparent;
  color: #991b1b;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}

.note-del {
  display: inline-block;
  padding: 8px 10px;
  line-height: 1;
}

.note-add {
  margin: 8px 12px 12px;
  color: #4338ca;
  text-align: left;
}

.mail-item-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: flex-start;
}

.mail-dock {
  position: fixed;
  top: 16px;
  right: 16px;
  left: auto;
  bottom: 16px;
  z-index: 1;
  width: min(360px, calc(100vw - 24px));
  height: calc(100vh - 32px);
  max-height: calc(100vh - 32px);
  display: flex;
  flex-direction: column;
  background: #f6f3ff;
  border-radius: 20px;
  box-shadow: 0 24px 60px rgb(49 46 129 / 28%);
  overflow: hidden;
}

.mail-handle {
  flex: 0 0 auto;
  padding: 14px 16px;
  font-size: 1.15rem;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(90deg, #4f46e5, #7c3aed);
}

.mail-help {
  margin: 10px 12px 0;
  color: #dc2626;
  font-size: 1.05rem;
  font-weight: 800;
  line-height: 1.45;
}

.mail-help p {
  margin: 0;
}

.mail-help p + p {
  margin-top: 2px;
}


.mail-help-name {
  color: #111;
}

#mail-hint {
  white-space: pre-line;
  color: #dc2626;
  font-weight: 800;
}

.mail-address,
.mail-query-line,
.mail-hint,
.mail-setup-note {
  margin: 8px 12px 0;
  font-size: 1rem;
  line-height: 1.45;
  color: #111;
  word-break: break-all;
}

.mail-address {
  font-size: 1.05rem;
  font-weight: 800;
  color: #111;
}

.mail-query-line code {
  background: #f3f4f6;
  padding: 1px 4px;
  border-radius: 4px;
}

.mail-tabs {
  display: flex;
  gap: 6px;
  padding: 10px 12px 0;
}

.mail-tab {
  flex: 0 0 auto;
  white-space: nowrap;
  border: 1px solid #111;
  border-radius: 999px;
  background: #fff;
  color: #111;
  font-size: 0.95rem;
  font-weight: 800;
  padding: 8px 12px;
  cursor: pointer;
}

.mail-tab.is-on {
  background: #111;
  color: #fff;
}

.mail-refresh {
  margin-left: auto;
}

.mail-empty-btn {
  color: #b91c1c;
  border-color: #b91c1c;
}

.mail-empty-btn[hidden] {
  display: none !important;
}

.mail-actions,
.mail-setup {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 12px 0;
}

.mail-setup[hidden],
.mail-actions[hidden],
#mail-use[hidden],
#mail-open[hidden] {
  display: none !important;
}

.mail-setup input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #111;
  border-radius: 8px;
  color: #111;
  font-size: 1rem;
}

.btn.mail-small {
  width: 100%;
  padding: 10px 12px;
  font-size: 1rem;
  background: #eef2ff;
  color: #4338ca;
  text-align: center;
  text-decoration: none;
}

.mail-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  margin: 8px 12px 14px;
  padding: 0;
  background: #fff;
  border: 1px solid #111;
}

.mail-more {
  width: 100%;
  margin-top: 8px;
  border: 1px solid #111;
  border-radius: 8px;
  background: #fff;
  color: #111;
  font-size: 1rem;
  font-weight: 800;
  padding: 10px;
  cursor: pointer;
}

.mail-item {
  margin: 0;
  padding: 10px 12px;
  background: #fff;
  border: none;
  border-bottom: 1px solid #111;
  border-radius: 0;
}

.mail-item:last-child {
  border-bottom: none;
}

.mail-item-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.mail-subject {
  margin: 0;
  min-width: 0;
  font-size: 1.05rem;
  font-weight: 800;
  line-height: 1.4;
  color: #111;
}

.mail-time {
  flex: 0 0 auto;
  white-space: nowrap;
  font-size: 0.95rem;
  font-weight: 800;
  line-height: 1.4;
  color: #111;
}

.mail-item-actions {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  align-items: center;
  margin-top: 8px;
  overflow: auto;
}

.mail-act {
  flex: 0 0 auto;
  border: 1px solid #111;
  border-radius: 6px;
  background: #fff;
  padding: 6px 10px;
  line-height: 1.2;
}

.mail-meta,
.mail-snippet {
  margin: 6px 0 0;
  font-size: 0.98rem;
  color: #111;
  line-height: 1.5;
}

.mail-empty {
  margin: 8px 4px 4px;
  padding: 22px 12px;
  border-radius: 14px;
  text-align: center;
  font-size: 1rem;
  font-weight: 700;
  color: #111;
  background: #fff;
}

.mail-code {
  flex: 0 0 auto;
  white-space: nowrap;
  border: 1px solid #065f46;
  border-radius: 6px;
  padding: 6px 10px;
  background: #047857;
  color: #fff;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
}
