:root {
  color: #1b1e22;
  background: #f2f4f5;
  font-family: "Segoe UI", "Microsoft YaHei UI", sans-serif;
  font-synthesis: none;
  letter-spacing: 0;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: #f2f4f5;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.text-input {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border: 1px solid #bdc5c9;
  border-radius: 5px;
  outline: 0;
  background: #ffffff;
  color: #1b1e22;
  font-size: 14px;
}

.text-input:focus {
  border-color: #2796ae;
  box-shadow: 0 0 0 3px rgba(39, 150, 174, 0.16);
}

.text-input.readonly {
  background: #f2f4f5;
  color: #687279;
}

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

.auth-panel {
  width: min(520px, 100%);
  padding: 34px;
  border: 1px solid #d4dade;
  border-radius: 7px;
  background: #ffffff;
}

.auth-heading {
  display: flex;
  align-items: center;
  gap: 18px;
}

.auth-heading > img {
  border-radius: 7px;
}

.eyebrow {
  margin: 0 0 8px;
  color: #747e84;
  font-size: 11px;
  font-weight: 750;
}

h1,
h2,
p {
  overflow-wrap: anywhere;
}

.auth-panel h1,
.setup-copy h1 {
  margin: 0;
  font-size: 26px;
  line-height: 1.25;
}

.auth-tabs {
  height: 42px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
  margin-top: 28px;
  padding: 3px;
  border: 1px solid #d4dade;
  border-radius: 6px;
  background: #f2f4f5;
}

.auth-tab {
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #69747a;
  font-size: 13px;
  font-weight: 700;
}

.auth-tab.active {
  background: #ffffff;
  color: #1b1e22;
  box-shadow: 0 1px 3px rgba(27, 30, 34, 0.12);
}

form {
  display: grid;
  gap: 10px;
  margin-top: 24px;
}

form label,
.form-grid label {
  display: block;
  margin-bottom: 7px;
  color: #4b545a;
  font-size: 12px;
  font-weight: 700;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.password-field {
  height: 44px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  align-items: center;
  border: 1px solid #bdc5c9;
  border-radius: 5px;
}

.password-field:focus-within {
  border-color: #2796ae;
  box-shadow: 0 0 0 3px rgba(39, 150, 174, 0.16);
}

.password-field input {
  min-width: 0;
  height: 100%;
  padding: 0 12px;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 14px;
}

.password-field button,
.icon-button {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #566168;
}

.password-field button:hover,
.icon-button:hover {
  background: #eef2f3;
}

svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
}

.submit-button,
.download-button,
.secondary-button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 5px;
  font-size: 13px;
  font-weight: 750;
  text-decoration: none;
}

.submit-button,
.download-button {
  background: #e95039;
  color: #ffffff;
}

.submit-button:hover,
.download-button:hover {
  background: #ce422f;
}

.submit-button:disabled,
.secondary-button:disabled {
  cursor: wait;
  opacity: 0.55;
}

.form-error,
.inline-error {
  min-height: 18px;
  margin: 0;
  color: #ba3427;
  font-size: 12px;
}

.avatar-registration,
.profile-editor {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 2px 0 8px;
}

.avatar-preview {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid #c6cdd1;
  border-radius: 50%;
  background: #e8f1f3;
  color: #237d91;
  font-weight: 800;
}

.avatar-preview.large {
  width: 68px;
  height: 68px;
  font-size: 20px;
}

.avatar-preview.small {
  width: 32px;
  height: 32px;
  font-size: 10px;
}

.avatar-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.file-button {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  margin: 0;
  padding: 0 12px;
  border: 1px solid #abb5ba;
  border-radius: 5px;
  background: #ffffff;
  color: #32393e;
  cursor: pointer;
  font-size: 12px;
}

.file-button:hover {
  background: #f1f4f5;
}

.remove-avatar {
  margin-left: 6px;
  color: #a23a30;
}

.join-bar {
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  border-bottom: 1px solid #d4dade;
  background: #ffffff;
}

.join-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  color: inherit;
  text-decoration: none;
}

.join-brand img {
  border-radius: 6px;
}

.join-brand strong {
  font-size: 15px;
}

.text-button {
  border: 0;
  background: transparent;
  color: #606a70;
  font-size: 12px;
}

.account-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.account-button {
  height: 42px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 9px 0 5px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: #32393e;
  font-size: 12px;
  font-weight: 700;
}

.account-button:hover {
  border-color: #d4dade;
  background: #f5f7f7;
}

.join-main {
  width: min(840px, calc(100% - 32px));
  margin: 32px auto 56px;
}

.setup-panel {
  min-height: 190px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 30px;
  border: 1px solid #d4dade;
  border-radius: 7px;
  background: #ffffff;
}

.setup-copy > p:last-child {
  margin: 10px 0 0;
  color: #687279;
  font-size: 13px;
}

.download-button {
  padding: 0 18px;
  white-space: nowrap;
}

.token-section {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  margin-top: 20px;
  padding: 24px;
  border: 1px solid #d4dade;
  border-radius: 7px;
  background: #ffffff;
}

.token-section h2 {
  margin: 0;
  font-size: 17px;
}

.devices-section {
  margin-top: 20px;
  padding: 24px;
  border: 1px solid #d4dade;
  border-radius: 7px;
  background: #ffffff;
}

.file-transfer-section {
  margin-top: 20px;
  padding: 24px;
  border: 1px solid #d4dade;
  border-radius: 7px;
  background: #ffffff;
}

.transfer-heading-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.online-members {
  color: #7e898f;
  font-size: 10px;
  font-weight: 700;
}

.transfer-heading-actions .icon-button {
  width: 30px;
  height: 30px;
}

.transfer-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 0.72fr);
  gap: 16px;
  margin-top: 20px;
  padding-bottom: 22px;
  border-bottom: 1px solid #d7dde0;
}

.delivery-control,
.recipient-field {
  display: grid;
  align-content: start;
  gap: 8px;
}

.field-label {
  color: #5f696f;
  font-size: 11px;
  font-weight: 700;
}

.delivery-segments {
  min-height: 42px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
  padding: 3px;
  border: 1px solid #cbd2d6;
  border-radius: 6px;
  background: #edf0f1;
}

.delivery-segments label {
  position: relative;
  min-width: 0;
  cursor: pointer;
}

.delivery-segments input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.delivery-segments span {
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 4px;
  color: #626c72;
  font-size: 11px;
  font-weight: 750;
}

.delivery-segments input:checked + span {
  background: #ffffff;
  color: #1d2226;
  box-shadow: 0 1px 3px rgba(27, 30, 34, 0.12);
}

.recipient-field select {
  width: 100%;
  height: 42px;
  padding: 0 36px 0 12px;
  border: 1px solid #cbd2d6;
  border-radius: 6px;
  background: #ffffff;
  color: #293036;
  font: inherit;
  font-size: 12px;
}

.recipient-field.disabled {
  opacity: 0.46;
}

.file-drop {
  grid-column: 1 / -1;
  min-height: 82px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border: 1px dashed #aeb8bd;
  border-radius: 6px;
  background: #f7f9f9;
  cursor: pointer;
}

.file-drop:hover,
.file-drop.dragging {
  border-color: #e95039;
  background: #fff8f6;
}

.file-drop > svg {
  width: 25px;
  height: 25px;
  flex: 0 0 auto;
  fill: none;
  stroke: #e95039;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.file-drop > span {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.file-drop strong {
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-drop small {
  color: #778187;
  font-size: 10px;
}

.upload-actions {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
}

.upload-progress {
  min-width: 0;
  flex: 1;
  display: grid;
  grid-template-columns: minmax(100px, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.upload-progress[hidden] {
  display: none;
}

.upload-progress progress {
  width: 100%;
  height: 5px;
  border: 0;
  accent-color: #e95039;
}

.upload-progress span {
  color: #778187;
  font-size: 10px;
}

.upload-actions .submit-button {
  width: auto;
  min-width: 128px;
  margin: 0;
}

.upload-actions .submit-button svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.inline-success {
  grid-column: 1 / -1;
  min-height: 16px;
  margin: -8px 0 0;
  color: #27845b;
  font-size: 11px;
}

.transfer-list {
  display: grid;
  gap: 1px;
  margin-top: 18px;
  overflow: hidden;
  border: 1px solid #d7dde0;
  border-radius: 6px;
  background: #d7dde0;
}

.transfer-row {
  min-height: 66px;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) minmax(110px, auto) auto;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  background: #ffffff;
}

.file-type-icon {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 5px;
  background: #edf0f1;
  color: #5d686e;
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
}

.transfer-identity,
.transfer-meta {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.transfer-identity strong {
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.transfer-identity span,
.transfer-meta span {
  color: #778187;
  font-size: 10px;
}

.transfer-meter {
  width: min(260px, 100%);
  height: 3px;
  overflow: hidden;
  border-radius: 2px;
  background: #dce2e4;
}

.transfer-meter i {
  height: 100%;
  display: block;
  border-radius: inherit;
  background: #e95039;
  transition: width 160ms linear;
}

.transfer-meta {
  text-align: right;
}

.transfer-badge {
  width: max-content;
  justify-self: end;
  padding: 3px 6px;
  border-radius: 4px;
  background: #e8f1f3;
  color: #237d91 !important;
  font-size: 9px !important;
  font-weight: 750;
}

.transfer-badge.broadcast {
  background: #f7e8e4;
  color: #b64735 !important;
}

.transfer-badge.complete {
  background: #e5f2eb;
  color: #27845b !important;
}

.transfer-actions {
  display: flex;
  gap: 6px;
}

.transfer-action {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid #cbd2d6;
  border-radius: 5px;
  background: #ffffff;
  color: #4e595f;
  cursor: pointer;
}

.transfer-action:hover {
  border-color: #9da8ae;
  background: #f2f5f6;
}

.transfer-action.delete {
  border-color: #dfc2bd;
  color: #b64735;
}

.transfer-action svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.section-note {
  margin: 10px 0 0;
  color: #8f9aa0;
  font-size: 11px;
}

.section-heading,
.dialog-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.section-heading h2,
.dialog-heading h2 {
  margin: 0;
  font-size: 17px;
}

.device-count {
  min-width: 27px;
  height: 27px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #e8f1f3;
  color: #237d91;
  font-size: 11px;
  font-weight: 800;
}

.device-list {
  display: grid;
  gap: 1px;
  margin-top: 18px;
  overflow: hidden;
  border: 1px solid #d7dde0;
  border-radius: 6px;
  background: #d7dde0;
}

.device-row {
  min-height: 58px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  background: #ffffff;
}

.owner-device-row {
  grid-template-columns: 34px minmax(140px, 1fr) minmax(120px, 0.7fr) 38px;
}

.device-owner {
  min-width: 0;
}

.device-owner strong,
.device-owner span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.revoke-button {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid #4b3533;
  border-radius: 5px;
  background: #211715;
  color: #f08070;
  cursor: pointer;
}

.revoke-button:hover {
  border-color: #7c443d;
  background: #321e1a;
}

.revoke-button:disabled {
  border-color: #30373b;
  background: #191e21;
  color: #667178;
  cursor: default;
}

.revoke-button svg {
  width: 17px;
  height: 17px;
}

.owner-device-row.revoked {
  opacity: 0.58;
}

.device-icon {
  width: 31px;
  height: 31px;
  display: grid;
  place-items: center;
  border-radius: 5px;
  background: #edf0f1;
  color: #606a70;
  font-size: 9px;
  font-weight: 800;
}

.device-row div {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.device-row strong {
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.device-row div span {
  color: #747e84;
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 10px;
}

.status {
  color: #27845b;
  font-size: 10px;
  font-weight: 750;
}

.status.revoked {
  color: #9a4a40;
}

.empty-state {
  margin: 0;
  padding: 21px;
  background: #ffffff;
  color: #7b858b;
  font-size: 12px;
  text-align: center;
}

.secondary-button {
  padding: 0 16px;
  border: 1px solid #abb5ba;
  background: #ffffff;
  color: #32393e;
}

.secondary-button:hover {
  background: #f1f4f5;
}

.token-output {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 40px;
  align-items: center;
  gap: 8px;
}

.token-output[hidden] {
  display: none;
}

.token-output input {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid #c3cace;
  border-radius: 5px;
  background: #f7f9f9;
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 12px;
}

.token-output > span {
  grid-column: 1 / -1;
  color: #6f797f;
  font-size: 11px;
}

.inline-error {
  grid-column: 1 / -1;
}

.join-flow {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  margin: 20px 0 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid #d4dade;
  border-radius: 7px;
  background: #d4dade;
  list-style: none;
}

.join-flow li {
  min-height: 74px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 16px;
  background: #ffffff;
}

.join-flow span {
  width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  border: 1px solid #b7c0c4;
  border-radius: 50%;
  color: #657077;
  font-size: 11px;
}

.join-flow strong {
  font-size: 12px;
}

.profile-dialog {
  width: min(460px, calc(100% - 32px));
  padding: 0;
  border: 1px solid #c9d0d4;
  border-radius: 7px;
  background: #ffffff;
  color: #1b1e22;
  box-shadow: 0 20px 60px rgba(27, 30, 34, 0.24);
}

.profile-dialog::backdrop {
  background: rgba(27, 30, 34, 0.46);
}

.profile-dialog form {
  margin: 0;
  padding: 26px;
}

.profile-editor {
  margin: 8px 0 6px;
  padding: 16px;
  border: 1px solid #d8dee1;
  border-radius: 6px;
  background: #f7f9f9;
}

.dialog-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* JR Network dark account experience */
:root {
  color-scheme: dark;
  color: #f2f5f6;
  background: #080a0c;
}

body {
  background: #080a0c;
}

.auth-panel,
.join-bar,
.setup-panel,
.token-section,
.file-transfer-section,
.devices-section,
.profile-dialog {
  border-color: #2a3035;
  background: #101417;
  color: #f2f5f6;
}

.eyebrow,
.setup-copy > p:last-child,
.device-row div span,
.empty-state,
.token-output > span {
  color: #8f9aa0;
}

.auth-tabs {
  border-color: #2c3338;
  background: #090c0e;
}

.auth-tab {
  color: #929da3;
}

.auth-tab.active {
  background: #20262a;
  color: #ffffff;
  box-shadow: none;
}

form label,
.form-grid label {
  color: #c3cbd0;
}

.text-input,
.password-field,
.token-output input {
  border-color: #353d43;
  background: #0a0d0f;
  color: #f3f6f7;
}

.text-input.readonly,
.token-output input {
  background: #0b0e10;
  color: #aab4b9;
}

.password-field input {
  color: #f3f6f7;
}

.password-field button,
.icon-button {
  color: #aeb8bd;
}

.password-field button:hover,
.icon-button:hover,
.account-button:hover {
  background: #20262a;
}

.file-button,
.secondary-button {
  border-color: #444e54;
  background: #171c20;
  color: #e0e5e7;
}

.transfer-form {
  border-color: #293035;
}

.field-label {
  color: #aab4b9;
}

.delivery-segments {
  border-color: #353d43;
  background: #090c0e;
}

.delivery-segments span {
  color: #929da3;
}

.delivery-segments input:checked + span {
  background: #242a2e;
  color: #ffffff;
  box-shadow: none;
}

.recipient-field select {
  border-color: #353d43;
  background: #0a0d0f;
  color: #f3f6f7;
}

.file-drop {
  border-color: #465158;
  background: #0b0e10;
}

.file-drop:hover,
.file-drop.dragging {
  border-color: #e95039;
  background: #17100f;
}

.file-drop small,
.upload-progress span,
.online-members,
.transfer-identity span,
.transfer-meta span {
  color: #8f9aa0;
}

.transfer-meter {
  background: #2b3338;
}

.transfer-list {
  border-color: #293035;
  background: #293035;
}

.transfer-row {
  background: #0d1113;
}

.file-type-icon {
  background: #20262a;
  color: #aeb8bd;
}

.transfer-badge {
  background: #16252a;
  color: #56bfd1 !important;
}

.transfer-badge.broadcast {
  background: #2b1b18;
  color: #ef816f !important;
}

.transfer-badge.complete {
  background: #14271f;
  color: #55bd8c !important;
}

.transfer-action {
  border-color: #384147;
  background: #171c20;
  color: #c4ccd0;
}

.transfer-action:hover {
  border-color: #59636a;
  background: #22282c;
}

.transfer-action.delete {
  border-color: #4b3533;
  color: #f08070;
}

.file-button:hover,
.secondary-button:hover {
  background: #22282c;
}

.avatar-preview,
.device-count {
  border-color: #334148;
  background: #16252a;
  color: #56bfd1;
}

.join-bar {
  border-bottom-color: #252b30;
}

.account-button {
  color: #e1e6e8;
}

.account-button:hover {
  border-color: #343c41;
}

.device-list,
.join-flow {
  border-color: #293035;
  background: #293035;
}

.device-row,
.empty-state,
.join-flow li {
  background: #0d1113;
}

.device-icon {
  background: #20262a;
  color: #aeb8bd;
}

.join-flow span {
  border-color: #4a555b;
  color: #bbc4c8;
}

.profile-dialog {
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.72);
}

.profile-dialog::backdrop {
  background: rgba(0, 0, 0, 0.76);
}

.profile-editor {
  border-color: #2c3338;
  background: #0b0e10;
}

@media (max-width: 620px) {
  .auth-layout {
    align-items: start;
    padding: 14px;
  }

  .auth-panel {
    padding: 24px 20px;
  }

  .auth-heading > img {
    width: 54px;
    height: 54px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .join-bar {
    padding: 0 16px;
  }

  .account-button > span:last-child {
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .setup-panel {
    align-items: flex-start;
    flex-direction: column;
    padding: 24px;
  }

  .download-button {
    width: 100%;
  }

  .token-section {
    grid-template-columns: 1fr;
  }

  .file-transfer-section {
    padding: 20px;
  }

  .transfer-form {
    grid-template-columns: 1fr;
  }

  .file-drop,
  .upload-actions {
    grid-column: 1;
  }

  .transfer-row {
    grid-template-columns: 38px minmax(0, 1fr) auto;
  }

  .transfer-meta {
    grid-column: 2;
    text-align: left;
  }

  .transfer-badge {
    justify-self: start;
  }

  .transfer-actions {
    grid-column: 3;
    grid-row: 1 / span 2;
  }

  .secondary-button {
    width: 100%;
  }

  .join-flow {
    grid-template-columns: 1fr;
  }

  .profile-dialog form {
    padding: 22px 18px;
  }

  .owner-device-row {
    grid-template-columns: 34px minmax(0, 1fr) 38px;
  }

  .device-owner {
    grid-column: 2;
  }

  .revoke-button {
    grid-column: 3;
    grid-row: 1 / span 2;
  }
}
